3 lines
315 KiB
JavaScript
3 lines
315 KiB
JavaScript
|
|
/* Files Gallery 0.15.3 - https://www.files.gallery/ */
|
||
|
|
!function(){const e=(e,t)=>_c.config&&_c.config[e]?Object.assign(t||{},_c.config[e]):t||{};function t(e=_c.current_dir.path,t=_c.current_dir.basename,i){let a=i?0:(_c.file_names||[]).length;document.title="function"==typeof _c.config.title?_c.config.title(e,t,i,a):(_c.config.title||"").replace("%name%",t||"/").replace("%path%",e).replace("%count%",a)}function i(){const e=Swal.getContainer();if(!e)return;const t=getComputedStyle(e),i=e.firstElementChild,a=getComputedStyle(i);(![t.top,t.bottom,t.left].every((e=>0==e||"0px"==e))||e.offsetWidth<window.innerWidth-100||i.offsetWidth<100||e.offsetHeight<window.innerHeight-100||i.offsetHeight<100||1!=t.opacity||1!=a.opacity||"none"==t.pointerEvents||"none"==a.pointerEvents||"none"==t.display||"none"==a.display||"visible"!=t.visibility||"visible"!=a.visibility||"fixed"!=t.position||["absolute","fixed"].includes(a.position))&&document.body.remove()}function a(e){return e?e.replace(/"/g,"""):""}function n(e){return e?e.replace(/</g,"<").replace(/>/g,">"):""}function o(e,t){return'<span class="'+t+'">'+e+"</span>"}function s(e){return _c.allow_download&&_c.allow_mass_download&&ne?`${_c.script}?action=download_dir_zip&dir=${encodeURIComponent(e.path)}&${e.mtime}`:"#"}_c.config=Object.assign({favicon:"<link rel=\"icon\" href=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2337474F' d='M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z' /%3E%3C/svg%3E\" type=\"image/svg+xml\" />",title:(e,t,i,a)=>(t||"/")+(i?"":` [${a}]`),panorama:{is_pano:(e,t)=>{var i=e.dimensions[0],a=e.dimensions[1],n=t.max_texture_size;if(!(n<2048||i<2048||i/a!=2)){if(!e.panorama_resized)return n>=i&&c(e);var o=[i].concat(e.panorama_resized),s=o.pop(),l=screen.availWidth*t.pixel_ratio*6;if(!(s>n)){var r=o.find((e=>n>=e&&e<l))||s;return r===i?c(e):e.url_path.replace(e.basename,"_files_"+r+"_"+e.basename)}}}},history:!0,history_scroll:!0,load_svg_max_filesize:1e5,localStorage_cache:!0,javascript_cache:!0,preview_image_cache:!0,pdf_preview_ratio:.7727272727,load_inline_pdf:!0,inline_pdf_append_url:"",video_preview_ratio:1.5,previews_update:!0,code_max_load:1e6,transitions:!0,respect_prefers_reduced_motion:!1,click:"popup",click_target:"_blank",click_window:[],click_window_popup:!0,topbar_sticky:"scroll",context_menu:!0,video_popup:!1,folder_buttons:["new_file","new_folder","upload","reload","contextmenu"],filter_live:!0,filter_props:["name","filetype","mime","features","title"],map_link:"https://www.google.com/maps/search/?api=1&query={latitude},{longtitude}",folder_preview_ratio:1,file_preview_ratio:1},_c.config||{}),"isConnected"in Node.prototype||Object.defineProperty(Node.prototype,"isConnected",{get(){return this.ownerDocument.contains(this)}}),Element.prototype.toggleAttribute||(Element.prototype.toggleAttribute=function(e,t){return void 0!==t&&(t=!!t),this.hasAttribute(e)?!!t||(this.removeAttribute(e),!1):!1!==t&&(this.setAttribute(e,""),!0)});var l={a:function(e,t,i){return e?i?`<a class="${t} map-link-text" target="_blank" href="${h(e)}">${U.get_svg_icon("marker")+ie.span("google maps")}</a>`:`<a class="${t} map-link map-link-icon" target="_blank" href="${h(e)}" data-lang="google maps" title="${ie.get("google maps")}">${U.get_svg_icon("marker")}</a>`:""},span:function(e,t){return e?'<span class="'+t+' map-link-icon" data-href="'+h(e)+'"'+x("google maps")+">"+U.get_svg_icon("marker")+"</span>":""}};function r(e,t=!1){return`/cdn-cgi/image/${t?"width=480,height=480":"format=jpeg"}${e.cloudflare_convert}`}function c(e,t){let i=!!e.url_path&&encodeURI(e.url_path).replace(/#/g,"%23");return e.is_dir?i||"#":t?_c.allow_download?!i||_c.load_files_proxy_php||["php","htaccess"].includes(e.ext)?`${_c.script}?action=download&file=${encodeURIComponent(e.path)}`:i:"#":e.cloudflare_convert&&!X.browser_images.includes(e.mime1)?r(e):e.is_convert?`${_c.script}?action=file&file=${encodeURIComponent(e.path)}&convert=1`:i&&!_c.load_files_proxy_php?i:`${_c.script}?action=file&file=${encodeURIComponent(e.path)}`}
|
||
|
|
history:_c.config.history,video_autoplay:!0,getDoubleTapZoom:()=>(t.toggle_play(!1),1),getThumbBoundsFn:(e,t)=>{var a=i.items[e];if(img=Y.modal.open?Y.modal.item===a.item&&_class("modal-image",Y.modal.el.preview)[0]:a.img_el,!(a.w&&a.h&&a.msrc&&img&&img.offsetParent&&"svg"!==a.item.ext))return!!t&&d(!0);var n=img.getBoundingClientRect();if(t){if(n.bottom<0||n.top>window.innerHeight)return d(!0);d(!1)}var o=a.w/a.h,s=n.width/n.height,l=getComputedStyle(img),r="cover"===l.objectFit?o<s:o>s,c=r?(img.clientWidth/o-img.clientHeight)/2:0,p=r?0:(img.clientHeight*o-img.clientWidth)/2,m=img.offsetWidth-img.clientWidth,u=parseFloat(l.padding||l.paddingTop||0);return{x:n.left-p+m/2+u,y:n.top-c+window.pageYOffset+m/2+u,w:n.width+2*p-m-2*u,h:n.height+2*c-m-2*u,img:img}},index:0,addCaptionHTMLFn:(e,i)=>{var o=e.item;return"topbar"===p.caption_style?(t.search.innerText=o.basename,!1):"video"===e.type?(K.filter.value||(t.search.innerText=o.basename),m(t.caption_center)):(K.filter.value||m(t.search),o.hasOwnProperty("popup_caption")||(o.popup_caption=`<div class="popup-basename">${n(o.basename)}</div><div class="popup-image-meta">${_(o.dimensions,"popup-dimensions")}${f(o,"popup-filesize")}<span class="popup-date">${U.get_time(o,l,"LLLL",r)}</span></div>${y(o.image,"popup-exif")}${b(o.image,"popup")}`),o.popup_caption?(t.caption_transition_delay&&(t.caption.style.cssText="transition: none; opacity: 0",a&&clearTimeout(a),a=setTimeout((()=>{t.caption.style.cssText="transition: opacity 333ms cubic-bezier(0.33, 1, 0.68, 1)",a=setTimeout((()=>{t.caption.removeAttribute("style")}),333)}),t.caption_transition_delay)),t.caption_center.innerHTML=o.popup_caption,!0):Ce.resetEl(t.caption_center))}};if(e("popup",p),location.search.includes("=")){let e={};location.search.split("&").forEach((t=>{let i=t.match(/popup_(.+)=(.+)$/);i&&(e[i[1]]=!!/^(1|true)$/.test(i[2])||!/^(0|false)$/.test(i[2])&&(isNaN(i[2])?i[2]:1*i[2]))})),Object.keys(e).length&&Object.assign(p,e)}function d(e){e!==i.options.showHideOpacity&&(i.options.showHideOpacity=e,Ce.toggle_class(t.pswp,"pswp--animate_opacity",e))}function u(){var e=t.current_video;e&&e.pause()}function h(){return!i.options.loop&&i.getCurrentIndex()===i.options.getNumItemsFn()-1}function g(){t.pano_viewer&&(t.pano_viewer.destroy(),t.pano_viewer=!1)}p.play_transition||(p.play_transition=p.transition||"glide"),p.transitions&&Object.assign(t.transitions,p.transitions),U.open_popup=(e,a)=>{if(e&&Y.list.items.length&&!t.is_open){var s={index:0};if(o===Y.list.matchingItems){for(var l=0;l<t.slides.length;l++)if(t.slides[l].item===e){s.index=l;break}}else o=Y.list.matchingItems,t.slides=[],o.forEach((function(i,a){var n=i._values;if(function(e){if(e&&e.is_readable)return!!e.is_popup||!(!e.is_browser_video||!p.include_videos)||void 0}(n)){var o={pid:encodeURIComponent(n.basename),item:n};if(ne&&n.is_pano)Object.assign(o,{type:"pano",html:`<div class="popup-pano-placeholder">${U.get_svg_icon("panorama_variant")}</div>`});else if(n.browser_image){var l=!!_c.load_images&&i.elm.firstElementChild,r=!X.image_orientation&&S(n.image),d=l&&!r&&!n.custom_preview;if(Object.assign(o,{type:"image",src:c(n),w:n.image&&"svg"!==n.ext&&(n.image.width||(d?l.naturalWidth:0))||screen.availWidth,h:n.image&&"svg"!==n.ext&&(n.image.height||(d?l.naturalHeight:0))||screen.availHeight,img_el:l,msrc:!(!d||!l.complete)&&l.getAttribute("src")}),r&&(o.w=n.image.height,o.h=n.image.width),d&&!o.msrc&&(l.onload=function(){o.msrc=this.getAttribute("src")}),"ico"===n.ext&&o.w<=16){var m=256/o.w;o.w*=m,o.h*=m}}else n.is_browser_video&&Object.assign(o,{type:"video",html:`<video src="${c(n)}${X.only_touch?"#t=0.001":""}" type="${n.mime}" class="popup-video" controls controlslist="nodownload" playsinline loop></video>`});n===e&&(s.index=t.slides.length),t.slides.push(o)}}));t.slides.length&&(t.previous_focus=document.activeElement,R(),document.documentElement.classList.add("popup-open"),t.is_open=!0,t.caption_transition_delay=333,t.container.classList.toggle("pswp__container-multi",t.slides.length>1),"topbar"!==p.caption_style&&K.filter.value&&(t.search.inne
|