function getMediaInfo(t){const e=t.find("a").attr("href")??null,a=t.find("img").attr("src")??null,i=t.find("iframe").attr("src")??null,r=t.find("lite-youtube");return{href:e,imgSrc:a,iframeSrc:i,liteYT:r.length?r.prop("outerHTML"):null}}function buildHeroHTML(t,e){const a=e?`class="${e}" `:"";return t.href?`
`:t.iframeSrc?``:t.liteYT?t.liteYT:`
`}function buildDataAttrs(t){return t.href?{dataImg:`data-img="${encodeURIComponent(t.imgSrc)}"`,dataHref:`data-href="${encodeURIComponent(t.href)}"`,dataIframe:"",dataLiteYT:"",hasHref:!0}:t.iframeSrc?{dataImg:"",dataHref:"",dataIframe:`data-iframe="${encodeURIComponent(t.iframeSrc)}"`,dataLiteYT:"",hasHref:!1}:t.liteYT?{dataImg:"",dataHref:"",dataIframe:"",dataLiteYT:`data-liteYT="${encodeURIComponent(t.liteYT)}"`,hasHref:!1}:{dataImg:`data-img="${encodeURIComponent(t.imgSrc)}"`,dataHref:"",dataIframe:"",dataLiteYT:"",hasHref:!1}}function img_group_reduce(t="topic"){const e="(尚無標籤文字)",a="https://attach2.mobile01.com/images/icons/arrows/",i="all"===t?$("article"):$("article").first(),r=/
\n(
)\n
/g,s=/(- |
- )(
)+(<\/dd>|<\/dt>)/g;i.each(function(){const t=$(this);let i=t.html();i=i.replace(r,"$1").replace(n,"$1"),t.html(i),t.find("dl").each(function(){const t=$(this);t.html(t.html().replace(s,""));const i=[];let r=null;if(t.children().each(function(){const t=this.tagName.toLowerCase();"dt"===t?r=$(this).text().trim()||e:"dd"===t&&(null===r&&(r=e),i.push({label:r,$dd:$(this)}),r=null)}),0===i.length)return;const n=t.data("tab");let c=Math.min(i.length,10);"number"==typeof n&&n{const a=Math.floor(e/h);g[a]||(g[a]={thumbs:[],hero:"",max:i.length-1});const r=getMediaInfo(t.$dd),n=buildDataAttrs(r);n.hasHref&&(u=!0),e%h===0&&(p=buildHeroHTML(r,d)),g[a].hero=p;const s=(e+1)%c===0,l=f&&s?m+f:m,o=0===e?"is-active":"";g[a].thumbs.push(`${t.label}
`),s&&e!==i.length-1&&g[a].thumbs.push('')});const b=u?" c-group":"",v=u?'
':"",I=g.map(t=>{const e=t.max;return`


${t.hero}
${t.thumbs.join("")}
`+v+"
"}).join("");t.after(I).remove()})})}function selectMedia(t,e){if(t.hasClass("is-active"))return;const a=t.attr("data-img"),i=t.attr("data-href"),r=t.attr("data-iframe"),n=t.attr("data-liteyt");if(e.find(".imagectl").removeClass("is-active"),t.addClass("is-active"),a&&e.find(".imagearea img").attr("src",decodeURIComponent(a)),i&&e.find(".imagearea a").attr("href",decodeURIComponent(i)),r)e.find(".imagearea iframe").attr("src","redirect.htm?url="+r);else if(n){e.find(".imagearea").html(decodeURIComponent(n))}const s=e.find(".imagebtn .imagectl"),c=s.index(t),l=s.length-1,o=c
0?c-1:l;e.find(".slick-right").attr("data-r",o),e.find(".slick-left").attr("data-l",d)}$(document).on("mouseover click",".imagectl",function(){const t=$(this).closest(".imageset");selectMedia($(this),t)}),$(document).on("click",".imageset .slick-right",function(){const t=$(this).closest(".imageset"),e=parseInt($(this).attr("data-r"),10);selectMedia(t.find(".imagebtn .imagectl").eq(e),t)}),$(document).on("click",".imageset .slick-left",function(){const t=$(this).closest(".imageset"),e=parseInt($(this).attr("data-l"),10);selectMedia(t.find(".imagebtn .imagectl").eq(e),t)}),$(document).on("contextmenu",".imagectl",function(t){const e=$(this),a=e.attr("data-href"),i=e.closest(".imagebtn");$("imagebtn").removeClass("is-active"),a&&(t.preventDefault(),i.find(".c-group__options").css({position:"fixed",top:`${t.clientY}px`,left:`${t.clientX}px`}),i.addClass("is-active"),i.find("a").attr("href",decodeURIComponent(a)),$(document).one("scroll",()=>i.removeClass("is-active")))}),$(document).on("mouseover",".imageset",function(){$(this).find(".slick-arrow").show()}),$(document).on("mouseout",".imageset",function(){$(this).find(".slick-arrow").hide()});