1document.body.classList.contains("block-editor-page")||jQuery(document).ready((function(t){function e(t){return t.data("offset")||0}console.log("FILTER SCRIPT LOADED"),window.Iconify&&window.Iconify.scan();const a=t=>{switch(!0){case-1!=t.indexOf("application"):return"fa-solid:file";case-1!=t.indexOf("audio"):return"fa-solid:file-audio";case-1!=t.indexOf("image"):return"fa-solid:file-image";case-1!=t.indexOf("video"):return"fa-solid:file-video";case-1!=t.indexOf("text"):return"fa-solid:file-alt";default:return"fa-solid:file"}};function n(t){return(t.metadata?.FileTitle||t.displayTitle||t.name).toLowerCase()}function i(t){return new Date(t.updated||t.modified||0).getTime()}function o(t){const e=new Date(t);return`${e.getDate()}.${e.getMonth()+1}.${e.getFullYear()%100}`}function s(t,d){return d.find(".spinnery").show(),new Promise(((c,l)=>{const r=bucketBrowserData.allFiles,u=Number(d.attr("data-range")),m=d.attr("data-showDownloadlink"),f=d.attr("data-showdate"),p=d.attr("data-showicon"),b="true"===d.attr("data-istrue"),g=d.attr("data-orderby")||"title",h=d.attr("data-order")||"ascending";if(isNaN(u)){if("undefined"==typeof wp||!wp.data||!wp.data.select("core/editor"))return;u=0}var w=0;!function(t,e){t.data("offset",e)}(d,t),e(d),r?fetch(`${r}`,{credentials:"omit"}).then((t=>t.json())).then((t=>{w=t.items.length;var l=Math.ceil(w/u);const r=d.find(".googlebucketlist");r.empty();const y=document.createElement("ul");y.classList.add("googlebucketlist-ul"),y.setAttribute("aria-label","meita-documents-and-media google-bucket list");let k="",v=function(t,e,a){const o=[...t];return"title"===a?o.sort(((t,a)=>{const o=n(t),s=n(a),d="ascending"===e?o.localeCompare(s,"fi",{sensitivity:"base"}):s.localeCompare(o,"fi",{sensitivity:"base"});return 0!==d?d:i(t)-i(a)})):"date"===a&&o.sort(((t,a)=>{const o="ascending"===e?i(t)-i(a):i(a)-i(t);return 0!==o?o:n(t).localeCompare(n(a),"fi",{sensitivity:"base"})})),o}(t.items,h,g);v.forEach(((t,e)=>{const n=function(t,e){const a=t.metadata?.FileTitle||t.title||t.name||"";return e?a.replace(/_/g," ").replace(/\.[^/.]+$/,""):a}(t,b);k+=`<li class='meita-documents-and-media-listitem' data-search-term="${t.name.toLowerCase().trim().replace(/\s+/g,"")}" data-key="${e}">\n `,"true"==p&&(k+=`<div class='meita-documents-and-media-icon ${a(t.contentType)}'>\n \t <span class="iconify" data-icon="${a(t.contentType)}" ></span>\n </div>`),k+=`<div class="meita-documents-and-media-content">\n <p class='document-name'><a target="_blank" href=${"https://storage.googleapis.com/"+t.bucket+"/"+encodeURIComponent(t.name)} alt='${meita_translations.open+t.name.replace(/_/g," ").replace(/\..*$/,"")}' >${n}</a></p>`,"true"==f&&(k+=`<p class='updated-date' title="Last modified at ${o(t.updated)}">${meita_translations.modified} ${o(t.updated)}</p>`),"true"==m&&(k+=`<p class='download-button'><a class='download-link' rel='noopener' href=${t.mediaLink} alt='${meita_translations.download} ${t.name.replace(/_/g," ").replace(/\..*$/,"")}'>${meita_translations.download}</a></p> `),k+="</div></li>"})),y.innerHTML=k,r.empty().append(y),d.find(".spinnery").hide();const C=e(d);d.find(".googlebucketlist li").hide().slice(C,C+u).show(),u>0&&function(t,a,n,i){let o=i.find(".googlebucketlist");o.find(".pagination").remove();let d=document.createElement("div");d.classList.add("pagination"),d.setAttribute("aria-label","meita-documents-and-media pagination"),o.append(d);const c=Math.floor(a/n),l=c+1;e(i);let r=Math.max(1,l-Math.floor(2.5)),u=Math.min(t,r+5-1);r=Math.max(1,u-5+1);const m=document.createElement("button");m.textContent="«",m.classList.add("first-page"),m.setAttribute("aria-label",meita_translations.first),m.disabled=0===c,m.setAttribute("aria-disabled",0===c?"true":"false"),m.onclick=()=>{c>0&&s(0,i)},d.appendChild(m);const f=document.createElement("button");f.textContent=meita_translations.previous,f.classList.add("prev-page"),f.setAttribute("aria-label",meita_translations.previous),f.disabled=0===c,f.setAttribute("aria-disabled",0===c?"true":"false"),f.onclick=()=>{c>0&&s((c-1)*n,i)},d.appendChild(f);for(let t=r;t<=u;t++){const e=document.createElement("button");e.textContent=t,e.classList.add("num-button"),e.setAttribute("aria-label",meita_translations.page+" "+t),t===l&&(e.classList.add("active"),e.setAttribute("aria-current","page")),e.onclick=e=>{e.preventDefault(),s((t-1)*n,i)},d.appendChild(e)}const p=document.createElement("button");p.textContent=meita_translations.next,p.classList.add("next-page"),p.setAttribute("aria-label",meita_translations.next),p.disabled=l>=t,p.setAttribute("aria-disabled",l>=t?"true":"false"),p.onclick=()=>{l<t&&s((c+1)*n,i)};const b=document.createElement("button");b.textContent="»",b.classList.add("last-page"),b.setAttribute("aria-label",meita_translations.last);const g=(t-1)*n;b.disabled=a>=g,b.setAttribute("aria-disabled",a>=g?"true":"false"),b.onclick=()=>{a<g&&s(g,i)},d.appendChild(p),d.appendChild(b);const h=document.createElement("p");h.setAttribute("aria-label",meita_translations.page+" "+l+meita_translations.of+t),h.textContent=meita_translations.page+" "+l+meita_translations.of+t,h.classList.add("page-of","meita-documents-and-media"),d.appendChild(h)}(l,C,u,d),window.Iconify&&("function"==typeof window.Iconify.scan?window.Iconify.scan(r[0]):"function"==typeof window.Iconify.scanDOM&&window.Iconify.scanDOM(r[0])
1),c()})).catch((t=>{console.error("Error fetching data:",t),l(t)})):c()}))}async function d(e){e.preventDefault();const a=t(e.target).closest(".wp-block-meita-documents-and-media-show-bucket");if(0!==a.length){a.find(".googlebucketlist").hide(),a.find(".pagination").hide(),a.find(".spinnery").show();var n=a.find(".filter").val().toLowerCase().trim();if(""===n)return await s(0,a),a.find(".pagination").show(),a.find(".googlebucketlist").show(),void a.find(".spinnery").hide();a.find(".googlebucketlist li").each((function(){const e=t(this).attr("data-search-term").toLowerCase();!n||e.includes(n)?t(this).show():t(this).hide()})),a.find(".googlebucketlist").show(),a.find(".spinnery").hide()}}document.body.classList.contains("wp-admin")||t(document).ready((async function(){const e=t(".wp-block-meita-documents-and-media-show-bucket");for(const a of e){const e=t(a),n=e.attr("data-listscreen"),i=e.attr("data-istrue");e.data("loaded")||"false"!==n||"true"!==i||(await s(0,e),e.data("loaded",!0))}})),t(".wp-block-meita-documents-and-media-show-bucket").on("click",".documents-and-media-button",d),t(".wp-block-meita-documents-and-media-show-bucket").on("keypress",'input[type="search"]',(function(t){"Enter"===t.key&&(t.preventDefault(),d(t))})),t(".wp-block-meita-documents-and-media-show-bucket").find('input[type="search"]').on("search",(function(a){a.preventDefault();const n=t(a.target).closest(".wp-block-meita-documents-and-media-show-bucket");if(0===n.length)return;const i=e(n);n.find(".googlebucketlist").empty(),n.find(".pagination").hide(),n.find(".spinnery").show(),setTimeout((function(){s(i,n),n.find(".spinnery").hide(),n.find(".pagination").show()}),2e3)}))}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.