/** * Copyright 2008-2020 | Fabrice Creuzot (luigifab) * https://www.luigifab.fr/apijs - 6.4.0 * This program is free software, you can redistribute it or modify * it under the terms of the GNU General Public License (GPL). */ Array.prototype.has||(Array.prototype.has=function(t,e){if(t instanceof Array){for(e in t)if(t.hasOwnProperty(e)&&this.has(t[e]))return!0}else for(e in this)if(this.hasOwnProperty(e)&&this[e]===t)return!0;return!1}),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(t,e,i){for(e=e||window,i=0;i1+apijs.dialog.scroll)&&(apijs.dialog.scroll=e,i=0i.body.offsetHeight||!e&&i.defaultView.pageYOffset<=0)&&apijs.dialog.stopScroll(t)},this.onKey=function(t){var e=apijs.dialog,i=e.media,s=e.t1;isNaN(t)||(t={keyCode:t,ctrlKey:!1,altKey:!1,preventDefault:function(){}}),e.has("progress","waiting","lock")?(t.ctrlKey&&[81,87,82,115,116].has(t.keyCode)||t.altKey&&115===t.keyCode||[27,116].has(t.keyCode))&&t.preventDefault():e.has("photo","video")&&122===t.keyCode?(t.preventDefault(),document.webkitFullscreenElement?document.webkitCancelFullScreen():document.mozFullScreenElement?document.mozCancelFullScreen():document.fullscreenElement?document.cancelFullScreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.requestFullscreen?s.requestFullscreen():s.mozRequestFullScreen&&s.mozRequestFullScreen()):e.has("slideshow")?27===t.keyCode?(t.preventDefault(),e.actionClose()):35===t.keyCode?(t.preventDefault(),apijs.slideshow.actionLast()):36===t.keyCode?(t.preventDefault(),apijs.slideshow.actionFirst()):37===t.keyCode?(t.preventDefault(),apijs.slideshow.actionPrev()):39===t.keyCode&&(t.preventDefault(),apijs.slideshow.actionNext()):27===t.keyCode&&(t.preventDefault(),e.actionClose()),e.has("video")&&(32===t.keyCode||80===t.keyCode?(t.preventDefault(),3!==i.networkState&&(i.ended||i.paused?i.play():i.pause())):38===t.keyCode||33===t.keyCode?(t.preventDefault(),3!==i.networkState&&i.duration!==1/0&&i.currentTime/g,">").replace(/\[/g,"<").replace(/]/g,">"),this.t2.appendChild(this.a)),0/g,">").replace(/\[/g,"<").replace(/]/g,">"),this.a.querySelectorAll("a.popup").forEach(function(t){t.addEventListener("click",apijs.openTab)}),this.t2.appendChild(this.a)),this},this.htmlBtnOk=function(){return this.a=document.createElement("div"),this.a.setAttribute("class","btns"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","confirm"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(102)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnConfirm=function(t,e){return this.a=document.createElement("div"),this.a.setAttribute("class","btns"),this.b=document.createElement("button"),this.b.setAttribute("type",t),this.b.setAttribute("class","confirm"),"submit"!==t&&this.b.setAttribute("onclick",e),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(104)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","cancel"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(103)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnNavigation=function(){return this.a=document.createElement("div"),this.a.setAttribute("class","navigation noplaying"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("disabled","disabled"),this.b.setAttribute("class","prev"),this.b.setAttribute("id","apijsPrev"),this.b.setAttribute("onclick","apijs.slideshow.actionPrev();"),this.c=document.createElement("span"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("disabled","disabled"),this.b.setAttribute("class","next"),this.b.setAttribute("id","apijsNext"),this.b.setAttribute("onclick","apijs.slideshow.actionNext();"),this.c=document.createElement("span"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlBtnClose=function(t){return!1===t||(this.a=document.createElement("div"),this.a.setAttribute("class","close noplaying"),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","close"),this.b.setAttribute("onclick","apijs.dialog.actionClose();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(105)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a)),this},this.htmlUpload=function(t,e){return this.a=document.createElement("div"),this.a.setAttribute("class","btns upload"),this.b=document.createElement("input"),this.b.setAttribute("type","file"),this.b.setAttribute("name",t),this.b.setAttribute("id","apijsFile"),e&&this.b.setAttribute("multiple","multiple"),this.b.setAttribute("onchange","apijs.upload.actionChoose(this);"),this.a.appendChild(this.b),this.b=document.createElement("button"),this.b.setAttribute("type","button"),this.b.setAttribute("class","browse"),this.b.setAttribute("onclick","this.previousSibling.click();"),this.c=document.createElement("span"),this.c.appendChild(apijs.i18n.translateNode(e?109:108)),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("div"),this.b.setAttribute("class","filenames"),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgProgress=function(){return this.a=document.createElement("span"),this.a.setAttribute("class","info"),this.t2.appendChild(this.a),this.a=document.createElement("svg"),this.a.setAttribute("id","apijsProgress"),this.b=document.createElement("rect"),this.b.setAttribute("class","auto"),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgLoader=function(t){return this.a=document.createElementNS(this.ns,"svg"),this.a.setAttribute("class","loader"),this.b=document.createElementNS(this.ns,"path"),!1!==t&&this.b.setAttribute("style","opacity:0;"),this.b.setAttribute("d","M75.4 126.63a11.43 11.43 0 0 1-2.1-22.65 40.9 40.9 0 0 0 30.5-30.6 11.4 11.4 0 1 1 22.27 4.87h.02a63.77 63.77 0 0 1-47.8 48.05v-.02a11.38 11.38 0 0 1-2.93.37z"),this.c=document.createElementNS(this.ns,"animateTransform"),this.c.setAttribute("attributeName","transform"),this.c.setAttribute("type","rotate"),this.c.setAttribute("from","0 64 64"),this.c.setAttribute("to","360 64 64"),this.c.setAttribute("dur","5s"),this.c.setAttribute("repeatCount","indefinite"),this.b.appendChild(this.c),this.c=document.createElementNS(this.ns,"animate"),this.c.setAttribute("attributeName","opacity"),this.c.setAttribute("to","1"),this.c.setAttribute("dur","0.01s"),this.c.setAttribute("begin","1s"),this.c.setAttribute("fill","freeze"),!1!==t&&this.b.appendChild(this.c),this.a.appendChild(this.b),this.t2.appendChild(this.a),this},this.htmlSvgPlayer=function(t){return this.a=document.createElement("span"),this.a.setAttribute("class","player noplaying"),this.b=document.createElement("span"),this.b.setAttribute("class","btn play fnt"),this.b.setAttribute("onclick","apijs.dialog.onKey(80);"),this.b.appendChild(document.createTextNode("")),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","svg bar"),this.c=document.createElement("svg"),this.c.setAttribute("class","bar"),this.c.setAttribute("onclick","apijs.player.actionPosition(event);"),this.d=document.createElement("rect"),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","time"),this.b.appendChild(document.createTextNode("00:00 / 00:00")),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","svg vol nomobile"),this.c=document.createElement("svg"),this.c.setAttribute("class","vol"),this.c.setAttribute("onclick","apijs.player.actionVolume(event);"),this.d=document.createElement("rect"),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks audiotrack"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(133)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionAudiotrack(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks videotrack"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(132)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionVideotrack(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks video"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(131)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionVideo(this);"),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("label"),this.b.setAttribute("class","tracks text"),this.b.setAttribute("style","display:none;"),this.b.appendChild(apijs.i18n.translateNode(134)),this.c=document.createElement("em"),this.c.setAttribute("class","nomobile"),this.b.appendChild(this.c),this.c=document.createElement("select"),this.c.setAttribute("lang","mul"),this.c.setAttribute("onchange","apijs.player.actionText(this);"),this.d=document.createElement("option"),this.d.appendChild(apijs.i18n.translateNode(135)),this.c.appendChild(this.d),this.b.appendChild(this.c),this.a.appendChild(this.b),this.b=document.createElement("span"),this.b.setAttribute("class","btn full fnt nomobile"),this.b.setAttribute("onclick","apijs.dialog.onKey(122);"),this.b.appendChild(document.createTextNode("")),this.a.appendChild(this.b),t.appendChild(this.a),this},this.htmlMedia=function(t,e,i,s){var a;return this.a=document.createElement("dl"),this.a.setAttribute("class","media"),this.b=document.createElement("dt"),this.has("photo")?(this.media=document.createElement("img"),this.media.setAttribute("alt",s.replace('"',""))):0'+apijs.i18n.translate(166,apijs.formatNumber(t.size/1048576))+"","*"===this.exts.join()||this.exts.has(t.name.slice(t.name.lastIndexOf(".")+1).toLowerCase())?t.size>1048576*this.onemax?e+=' '+apijs.i18n.translate(168)+"":t.size<=0?e+=' '+apijs.i18n.translate(169)+"":this.files.push(t):e+=' '+apijs.i18n.translate(167)+"",i.push("
"+e+"
"),s+=t.size/1048576},this),0=this.allmax&&i.push('
= '+apijs.i18n.translate(166,apijs.formatNumber(s))+' '+apijs.i18n.translate(168)+"
"),this.files.length===t.files.length?(apijs.html("button.confirm").removeAttribute("disabled"),apijs.html("button.confirm").focus()):apijs.html("button.confirm").setAttribute("disabled","disabled"),apijs.html("div.filenames").innerHTML=i.join(" "))},this.actionConfirm=function(){var s,e;return 0=this.end+2?(this.end=r,0<(e=Math.floor(100*t.loaded/t.total))&&e<100&&(this.updateTitle(e),r=100*(n=r-this.start)/e+10,24