1
0
Fork 0
mirror of https://github.com/Luzifer/share.git synced 2024-12-21 02:51:17 +00:00
share/frontend/app.js

1 line
8.9 KiB
JavaScript
Raw Normal View History

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(1);var o=null,i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"init",value:function(){var e=this;$(window).bind("hashchange",function(t){e.hashLoad()});var t="Share @ "+window.location.host;$("title,.apptitle").text(t),this.hashLoad()}},{key:"embedFileInfo",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";""!==t?(o=t,$.ajax(t,{method:"HEAD",success:function(t,n,r){e.handleEmbed(t,n,r)},error:function(t,n){e.handleError(t,n)}})):this.handleErrorMessage("File not found")}},{key:"handleEmbed",value:function(e,t,n){var r=this,i=n.getResponseHeader("Content-Type");if($(".container").hide(),$(".filename").text(o.substring(o.lastIndexOf("/")+1)),$(".filelink-href").attr("href",o),i.match(/^image\//))return $(".filelink-src").attr("src",o),void $(".show-image").show();if(i.match(/^video\//)){var a=$("<source>");return a.attr("src",o),a.appendTo($("video")),void $(".show-video").show()}if(i.match(/^audio\/(aac|mp3|mpeg)$/)){var s=$("<source>");return s.attr("src",o),s.appendTo($("audio")),void $(".show-audio").show()}i.match(/^(text\/|application\/javascript)/)?$.ajax(o,{dataType:"text",method:"GET",success:function(e){$("code").text(e),$(".show-text").show(),hljs.initHighlighting()},error:function(e,t){r.handleError(e,t)}}):$(".show-generic").show()}},{key:"handleError",value:function(e,t){var n="";switch(e.status){case 404:n="File not found";break;case 403:n="Not allowed to access file";break;default:n="Something went wrong"}this.handleErrorMessage(n)}},{key:"handleErrorMessage",value:function(e){$(".error").text(e),$(".container").hide(),$(".show-error").show()}},{key:"hashLoad",value:function(){var e=window.location.hash.substring(1);this.embedFileInfo(e)}}]),e}();$(function(){(new i).init()})},function(e,t,n){var r=n(2);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(4)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(3)(!1)).push([e.i,"audio{width:80%}h1{text-align:center;font-size:75px}h2{text-align:center;font-size:24px}pre code{color:#e83e8c}.container{margin-top:30px}.show-generic,.show-image,.show-video,.show-audio,.show-text,.show-error{display:none}\n",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}(r),i=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[n].concat(i).concat([o]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o