13 lines
4.8 KiB
JavaScript
13 lines
4.8 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 c=g++;return{value:e(c,a[c]),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 c=a[f];c in g||(g[c]={});g=g[c]}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");
|
||
|
(function(){function a(c,b,h){b.match(/^([\w\-]+)$/)||b.split(" ").forEach(function(b){a(c,b,h)});c.addEventListener(b,h,!1)}function e(c,b,h,k){a(c,h,function(a){f.$(b,c).forEach(function(b){a.target==b&&(k.call(b,a),a.stopPropagation())})})}function g(c){var b=[];Object.keys(c).forEach(function(a){var h=c[a].toString();a=encodeURIComponent(a);h=encodeURIComponent(h);b.push(a+"\x3d"+h)});return b.join("\x26")}var f={noop:function(){},$:function(c,b){b=void 0===b?null:b;if("string"!==typeof c)return c;
|
||
|
b=null!==b&&1===b.nodeType?b:document;var a=[];c.match(/^#([\w]+$)/)?a.push(document.getElementById(c.split("#")[1])):a=[].slice.apply(b.querySelectorAll(c));return a},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,b){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"+b+"\n\t\t\t\t\x3cspan class\x3d'close'\x3e\x3c/span\x3e\n\t\t\t\x3c/div\x3e";
|
||
|
b=f.$(".message");void 0!==b[0]&&b[0].remove();f.$("header")[0].insertAdjacentHTML("beforeend",a)},closestParent:function(a,b){if(void 0!==Element.prototype.closest)return a.closest(b);for(;a!==document.documentElement;){for(var c=a,f=(c.document||c.ownerDocument).querySelectorAll(b),e=f.length;0<=--e&&f.item(e)!==c;);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,b,h){var c=!1;return function(f){for(var e=
|
||
|
[],g=0;g<arguments.length;++g)e[g-0]=arguments[g];g=h||this;c||(b.apply(g,e),c=!0,setTimeout(function(){c=!1},a))}},on:function(c,b,h,g){3===arguments.length?(g=h,f.$(c).forEach(function(c){a(c,b,g)})):f.$(c).forEach(function(a){e(a,h,b,g)})},ajax:function(a,b){b=b||{};b.data=b.data||{};b.type=b.type||"GET";b.dataType=b.dataType||"";b.success=b.success||f.noop;b.mimeType=b.mimeType||"application/x-www-form-urlencoded";b.error=b.error||f.noop;var c=new XMLHttpRequest,e=String(b.type).toUpperCase();
|
||
|
"GET"===e&&(a+=a.match(/\?/)?g(b.data):"?"+g(b.data));c.open(e,a);c.onreadystatechange=function(){if(4===c.readyState){var a="json"===c.responseType?JSON.parse(c.responseText):c.responseText;299<c.status?b.error.call(null,c.status,a,c.response):b.success.call(null,a,c.status)}};"json"===b.dataType?(b.data=JSON.stringify(b.data),b.mimeType="application/json"):b.data=g(b.data);c.setRequestHeader("Content-Type",b.mimeType);switch(e){case "GET":c.send(null);break;default:c.send(b.data)}},get:function(a,
|
||
|
b,e){e=void 0===e?null:e;null===e&&(e=b,b={});return f.ajax(a,{data:b,success:e})}};f.on("header","click",".message",function(){f.hide(this)});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")})})})();
|
||
|
//# sourceMappingURL=scripts.min.js.map
|