15 lines
5.3 KiB
JavaScript
15 lines
5.3 KiB
JavaScript
var d=d||{};d.scope={};d.ASSUME_ES5=!1;d.ASSUME_NO_NATIVE_MAP=!1;d.ASSUME_NO_NATIVE_SET=!1;d.defineProperty=d.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,g){a!=Array.prototype&&a!=Object.prototype&&(a[e]=g.value)};d.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};d.global=d.getGlobal(this);d.SYMBOL_PREFIX="jscomp_symbol_";
|
|
d.initSymbol=function(){d.initSymbol=function(){};d.global.Symbol||(d.global.Symbol=d.Symbol)};d.Symbol=function(){var a=0;return function(e){return d.SYMBOL_PREFIX+(e||"")+a++}}();d.initSymbolIterator=function(){d.initSymbol();var a=d.global.Symbol.iterator;a||(a=d.global.Symbol.iterator=d.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&d.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return d.arrayIterator(this)}});d.initSymbolIterator=function(){}};
|
|
d.arrayIterator=function(a){var e=0;return d.iteratorPrototype(function(){return e<a.length?{done:!1,value:a[e++]}:{done:!0}})};d.iteratorPrototype=function(a){d.initSymbolIterator();a={next:a};a[d.global.Symbol.iterator]=function(){return this};return a};
|
|
d.iteratorFromArray=function(a,e){d.initSymbolIterator();a instanceof String&&(a+="");var g=0,f={next:function(){if(g<a.length){var b=g++;return{value:e(b,a[b]),done:!1}}f.next=function(){return{done:!0,value:void 0}};return f.next()}};f[Symbol.iterator]=function(){return f};return f};
|
|
d.polyfill=function(a,e){if(e){var g=d.global;a=a.split(".");for(var f=0;f<a.length-1;f++){var b=a[f];b in g||(g[b]={});g=g[b]}a=a[a.length-1];f=g[a];e=e(f);e!=f&&null!=e&&d.defineProperty(g,a,{configurable:!0,writable:!0,value:e})}};d.polyfill("Array.prototype.keys",function(a){return a?a:function(){return d.iteratorFromArray(this,function(a){return a})}},"es6","es3");d.owns=function(a,e){return Object.prototype.hasOwnProperty.call(a,e)};
|
|
d.assign="function"==typeof Object.assign?Object.assign:function(a,e){for(var g=1;g<arguments.length;g++){var f=arguments[g];if(f)for(var b in f)d.owns(f,b)&&(a[b]=f[b])}return a};d.polyfill("Object.assign",function(a){return a||d.assign},"es6","es3");
|
|
(function(){function a(b,c,h){c.match(/^([\w\-]+)$/)||c.split(" ").forEach(function(c){a(b,c,h)});b.addEventListener(c,h,!1)}function e(b,c,h,k){a(b,h,function(a){f.$(c,b).forEach(function(b){a.target==b&&(k.call(b,a),a.stopPropagation())})})}function g(b){var a=[];Object.keys(b).forEach(function(c){var h=b[c].toString();c=encodeURIComponent(c);h=encodeURIComponent(h);a.push(c+"\x3d"+h)});return a.join("\x26")}var f={noop:function(){},$:function(b,a){a=void 0===a?null:a;if("string"!==typeof b)return b;
|
|
a=null!==a&&1===a.nodeType?a:document;var c=[];b.match(/^#([\w]+$)/)?c.push(document.getElementById(b.split("#")[1])):c=[].slice.apply(a.querySelectorAll(b));return c},hasElement:function(a){return 0<f.$(a).length},scrollToTop:function(){window.scroll(0,0)},hide:function(a){a.setAttribute("hidden","hidden")},show:function(a){a.removeAttribute("hidden")},showMessage:function(a,c){a="\x3cdiv class\x3d'message "+a+"'\x3e\n\t\t\t\t\x3cspan class\x3d'icon'\x3e\x3c/span\x3e\n\t\t\t\t"+c+"\n\t\t\t\t\x3cspan class\x3d'close'\x3e\x3c/span\x3e\n\t\t\t\x3c/div\x3e";
|
|
c=f.$(".message");void 0!==c[0]&&c[0].remove();f.$("header")[0].insertAdjacentHTML("beforeend",a)},closestParent:function(a,c){if(void 0!==Element.prototype.closest)return a.closest(c);for(;a!==document.documentElement;){for(var b=a,f=(b.document||b.ownerDocument).querySelectorAll(c),e=f.length;0<=--e&&f.item(e)!==b;);if(-1<e)return a;a=a.parentElement}return null},url:function(a){var b="//"+document.location.host;return b+="/"===a.charAt(0)?a:"/"+a},throttle:function(a,c,f){var b=!1;return function(h){for(var e=
|
|
[],g=0;g<arguments.length;++g)e[g-0]=arguments[g];g=f||this;b||(c.apply(g,e),b=!0,setTimeout(function(){b=!1},a))}},on:function(b,c,h,g){void 0===g?(g=h,f.$(b).forEach(function(b){a(b,c,g)})):f.$(b).forEach(function(a){e(a,h,c,g)})},ajax:function(a,c){c=Object.assign({},{data:{},type:"GET",dataType:"",success:f.noop,mimeType:"application/x-www-form-urlencoded",error:f.noop},c);var b=new XMLHttpRequest,e=String(c.type).toUpperCase();"GET"===e&&(a+=a.match(/\?/)?g(c.data):"?"+g(c.data));b.open(e,a);
|
|
b.onreadystatechange=function(){if(4===b.readyState){var a="json"===b.responseType?JSON.parse(b.responseText):b.responseText;299<b.status?c.error.call(null,b.status,a,b.response):c.success.call(null,a,b.status)}};"json"===c.dataType?(c.data=JSON.stringify(c.data),c.mimeType="application/json"):c.data=g(c.data);b.setRequestHeader("Content-Type",c.mimeType);switch(e){case "GET":b.send(null);break;default:b.send(c.data)}},get:function(a,c,e){e=void 0===e?null:e;null===e&&(e=c,c={});return f.ajax(a,{data:c,
|
|
success:e})}};f.on("header","click",".message",function(a){f.hide(a.target)});f.on("form.js-delete","submit",function(a){!1===confirm("Are you ABSOLUTELY SURE you want to delete this item?")&&(a.preventDefault(),a.stopPropagation())});f.on(".js-clear-cache","click",function(){f.get("/cache_purge",function(){f.showMessage("success","Successfully purged api cache")})});"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(function(a){console.log("Service worker registered",a.scope)}).catch(function(a){console.error("Failed to register service worker",
|
|
a)})})();
|
|
//# sourceMappingURL=scripts.min.js.map
|