2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
/*! For license information please see 26914.57dd5a366438b238205b.chunk.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[26914],{26914:function(e,t,r){r.r(t),r.d(t,{default:function(){return q},show:function(){return T}}),r(29305),r(32733),r(84701),r(2623),r(44962),r(10849),r(70389),r(36947),r(26437),r(52697),r(78557),r(90076),r(50987),r(83994),r(82367);var n,o,i,a=r(22696),c=r.n(a),l=r(45182),s=r(75384),u=r(79754),d=r(36300),f=r(8566),p=r(10838),v=r(46782),y=r(5898),h=r(67430),b='<div class="formDialogHeader"> <button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1" title="${ButtonBack}"><span class="material-icons arrow_back" aria-hidden="true"></span></button> <h3 class="formDialogHeaderTitle"> ${HeaderUploadLyrics} </h3> </div> <div class="formDialogContent"> <div class="dialogContentInner"> <form class="uploadLyricsForm"> <div class="flex align-items-center" style="margin:1.5em 0"> <h2 style="margin:0">${HeaderAddLyrics}</h2> <button is="emby-button" type="button" class="raised raised-mini btnBrowse"> <span class="material-icons folder" aria-hidden="true"></span> <span>${Browse}</span> </button> </div> <div> <div class="lyricsEditor-dropZone fieldDescription"> <div id="labelDropLyrics">${LabelDropLyricsHere}</div> <output id="lyricsOutput" class="flex align-items-center justify-content-center" style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%"></output> <input type="file" accept=".lrc,.txt" id="uploadLyrics" name="uploadLyrics" style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;opacity:0"/> </div> <div id="fldUpload" class="hide"> <br/> <button is="emby-button" type="submit" class="raised button-submit block"> <span>${Upload}</span> </button> </div> </div> </form> </div> </div> ',m=r(71866),g=(r(10353),r(63001),r(76562));function L(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var l=n&&n.prototype instanceof c?n:c,s=Object.create(l.prototype);return w(s,"_invoke",function(r,n,o){var i,c,l,s=0,u=o||[],d=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return i=t,c=0,l=e,f.n=r,a}};function p(r,n){for(c=r,l=n,t=0;!d&&s&&!o&&t<u.length;t++){var o,i=u[t],p=f.p,v=i[2];r>3?(o=v===n)&&(l=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=r<2&&p<i[1])?(c=0,f.v=n,f.n=i[1]):p<v&&(o=r<3||i[0]>n||n>v)&&(i[4]=r,i[5]=n,f.n=v,c=0))}if(o||r>1)return a;throw d=!0,n}return function(o,u,v){if(s>1)throw TypeError("Generator is already running");for(d&&1===u&&p(u,v),c=u,l=v;(t=c<2?e:l)||!d;){i||(c?c<3?(c>1&&(f.n=-1),p(c,l)):f.n=l:f.v=l);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(d=f.n<0)?l:r.call(n,f))!==a)break}catch(t){i=e,c=1,l=t}finally{s=1}}return{value:t,done:d}}}(r,o,i),!0),s}var a={};function c(){}function l(){}function s(){}t=Object.getPrototypeOf;var u=[][n]?t(t([][n]())):(w(t={},n,(function(){return this})),t),d=s.prototype=c.prototype=Object.create(u);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,w(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=s,w(d,"constructor",s),w(s,"constructor",l),l.displayName="GeneratorFunction",w(s,o,"GeneratorFunction"),w(d),w(d,o,"Generator"),w(d,n,(function(){return this})),w(d,"toString",(function(){return"[object Generator]"})),(L=function(){return{w:i,m:f}})()}function w(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}w=function(e,t,r,n){if(t)o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r;else{var i=function(t,r){w(e,t,(function(e){return this._invoke(t,r,e)}))};i("next",0),i("throw",1),i("return",2)}},w(e,t,r,n)}function A(e,t,r,n,o,i,a){try{var c=e[i](a),l=c.value}catch(e){return void r(e)}c.done?t(l):Promise.resolve(l).then(n,o)}var S=!1;function F(e){f.Ay.hide();var t=e.target.error;t.code!==t.ABORT_ERR&&(0,m.A)(y.Ay.translate("MessageFileReadError"))}function O(e){return e&&[".lrc",".txt"].some((function(t){return e.name.endsWith(t)}))}function k(e){return D.apply(this,arguments)}function D(){var e;return e=L().m((function e(t){var r,a,c,p,v;return L().w((function(e){for(;;)switch(e.n){case 0:if(t.preventDefault(),O(r=i)){e.n=1;break}return(0,m.A)(y.Ay.translate("MessageLyricsFileTypeAllowed")),e.a(2);case 1:return f.Ay.show(),a=d.Ay.parentWithClass(this,"dialog"),c=(0,s.C)(h.tF.getApiClient(o)),p=(0,l.t)(c),e.n=2,(0,g.Qv)(r);case 2:v=e.v,p.uploadLyrics({itemId:n,fileName:r.name,body:v}).then((function(){a.querySelector("#uploadLyrics").value="",f.Ay.hide(),S=!0,u.default.close(a)}));case 3:return e.a(2)}}),e,this)})),D=function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){A(i,n,o,a,c,"next",e)}function c(e){A(i,n,o,a,c,"throw",e)}a(void 0)}))},D.apply(this,arguments)}function T(e){return new Promise((function(t){S=!1,function(e,t){n=(e=e||{}).itemId,o=e.serverId;var r={removeOnClose:!0,scrollY:!1};v.A.tv?r.size="fullscreen":r.size="small";var a,l=u.default.createDialog(r);l.classList.add("formDialog"),l.classList.add("lyricsUploaderDialog"),l.innerHTML=y.Ay.translateHtml(b,"core"),v.A.tv&&p.default.centerFocus.on(l,!1),l.addEventListener("close",(function(){v.A.tv&&p.default.centerFocus.off(l,!1),f.Ay.hide(),t(S)})),u.default.open(l),(a=l).querySelector(".uploadLyricsForm").addEventListener("submit",k),a.querySelector("#uploadLyrics").addEventListener("change",(function(){!function(e,t){var r=t[0];if(!O(r))return e.querySelector("#lyricsOutput").innerHTML="",e.querySelector("#fldUpload").classList.add("hide"),e.querySelector("#labelDropLyrics").classList.remove("hide"),void(i=null);i=r;var n,o=new FileReader;o.onerror=F,o.onloadstart=function(){e.querySelector("#fldUpload").classList.add("hide")},o.onabort=function(){f.Ay.hide(),console.debug("File read cancelled")},o.onload=(n=r,function(){var t='<div><span class="material-icons lyrics" aria-hidden="true" style="transform: translateY(25%);"></span><span>'.concat(c()(n.name),"</span></div>");e.querySelector("#lyricsOutput").innerHTML=t,e.querySelector("#fldUpload").classList.remove("hide"),e.querySelector("#labelDropLyrics").classList.add("hide")}),o.readAsDataURL(r)}(a,this.files)})),a.querySelector(".btnBrowse").addEventListener("click",(function(){a.querySelector("#uploadLyrics").click()})),l.querySelector(".btnCancel").addEventListener("click",(function(){u.default.close(l)}))}(e,t)}))}var q={show:T}},76562:function(e,t,r){function n(e){return new Promise((function(t,r){var n=new FileReader;n.onload=function(e){var r,n,o,i=null===(o=null===(n=null===(r=e.target)||void 0===r?void 0:r.result)||void 0===n?void 0:n.split)||void 0===o?void 0:o.call(n,",")[1];t(i)},n.onerror=r,n.readAsDataURL(e)}))}function o(e){return new Promise((function(t,r){var n=new FileReader;n.onload=function(e){var r,n=null===(r=e.target)||void 0===r?void 0:r.result;t(n)},n.onerror=r,n.readAsText(e)}))}function i(e,t){void 0===t&&(t=1);var r=Math.log(e)/Math.log(1024)|0;return(e/Math.pow(1024,r)).toFixed(t)+" "+(r?"KMGTPEZY"[--r]+"iB":"Bytes")}r.d(t,{Qv:function(){return o},We:function(){return n},iJ:function(){return i}})}}]); |