pleroma/priv/static/packs/core/admin.js
2020-01-22 16:00:23 +01:00

2 lines
15 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{108:function(e,t,n){"use strict";function a(e){["interactive","complete"].includes(document.readyState)?e():document.addEventListener("DOMContentLoaded",e)}n.r(t),n.d(t,"default",function(){return a})},59:function(e,t,n){var a,o;(function(){(function(){(function(){this.Rails={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]",buttonClickSelector:{selector:"button[data-remote]:not([form]), button[data-confirm]:not([form])",exclude:"form button"},inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])",formDisableSelector:"input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled",formEnableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled",fileInputSelector:"input[name][type=file]:not([disabled])",linkDisableSelector:"a[data-disable-with], a[data-disable]",buttonDisableSelector:"button[data-remote][data-disable-with], button[data-remote][data-disable]"}}).call(this)}).call(this);var r=this.Rails;(function(){(function(){var e;e=null,r.loadCSPNonce=function(){var t;return e=null!=(t=document.querySelector("meta[name=csp-nonce]"))?t.content:void 0},r.cspNonce=function(){return null!=e?e:r.loadCSPNonce()}}).call(this),function(){var e;e=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector,r.matches=function(t,n){return null!=n.exclude?e.call(t,n.selector)&&!e.call(t,n.exclude):e.call(t,n)},r.getData=function(e,t){var n;return null!=(n=e._ujsData)?n[t]:void 0},r.setData=function(e,t,n){return null==e._ujsData&&(e._ujsData={}),e._ujsData[t]=n},r.$=function(e){return Array.prototype.slice.call(document.querySelectorAll(e))}}.call(this),function(){var e,t,n;e=r.$,n=r.csrfToken=function(){var e;return(e=document.querySelector("meta[name=csrf-token]"))&&e.content},t=r.csrfParam=function(){var e;return(e=document.querySelector("meta[name=csrf-param]"))&&e.content},r.CSRFProtection=function(e){var t;if(null!=(t=n()))return e.setRequestHeader("X-CSRF-Token",t)},r.refreshCSRFTokens=function(){var a,o;if(o=n(),a=t(),null!=o&&null!=a)return e('form input[name="'+a+'"]').forEach(function(e){return e.value=o})}}.call(this),function(){var e,t,n,a;n=r.matches,"function"!=typeof(e=window.CustomEvent)&&((e=function(e,t){var n;return(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}).prototype=window.Event.prototype,a=e.prototype.preventDefault,e.prototype.preventDefault=function(){var e;return e=a.call(this),this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),e}),t=r.fire=function(t,n,a){var o;return o=new e(n,{bubbles:!0,cancelable:!0,detail:a}),t.dispatchEvent(o),!o.defaultPrevented},r.stopEverything=function(e){return t(e.target,"ujs:everythingStopped"),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()},r.delegate=function(e,t,a,o){return e.addEventListener(a,function(e){var a;for(a=e.target;a instanceof Element&&!n(a,t);)a=a.parentNode;if(a instanceof Element&&!1===o.call(a,e))return e.preventDefault(),e.stopPropagation()})}}.call(this),function(){var e,t,n,a,o,i;a=r.cspNonce,t=r.CSRFProtection,r.fire,e={"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript",script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},r.ajax=function(e){var t;return e=o(e),t=n(e,function(){var n,a;return a=i(null!=(n=t.response)?n:t.responseText,t.getResponseHeader("Content-Type")),2===Math.floor(t.status/100)?"function"==typeof e.success&&e.success(a,t.statusText,t):"function"==typeof e.error&&e.error(a,t.statusText,t),"function"==typeof e.complete?e.complete(t,t.statusText):void 0}),!(null!=e.beforeSend&&!e.beforeSend(t,e))&&(t.readyState===XMLHttpRequest.OPENED?t.send(e.data):void 0)},o=function(t){return t.url=t.url||location.href,t.type=t.type.toUpperCase(),"GET"===t.type&&t.data&&(t.url.indexOf("?")<0?t.url+="?"+t.data:t.url+="&"+t.data),null==e[t.dataType]&&(t.dataType="*"),t.accept=e[t.dataType],"*"!==t.dataType&&(t.accept+=", */*; q=0.01"),t},n=function(e,n){var a;return(a=new XMLHttpRequest).open(e.type,e.url,!0),a.setRequestHeader("Accept",e.accept),"string"==typeof e.data&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),e.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),t(a),a.withCredentials=!!e.withCredentials,a.onreadystatechange=function(){if(a.readyState===XMLHttpRequest.DONE)return n(a)},a},i=function(e,t){var n,o;if("string"==typeof e&&"string"==typeof t)if(t.match(/\bjson\b/))try{e=JSON.parse(e)}catch(e){}else if(t.match(/\b(?:java|ecma)script\b/))(o=document.createElement("script")).setAttribute("nonce",a()),o.text=e,document.head.appendChild(o).parentNode.removeChild(o);else if(t.match(/\b(xml|html|svg)\b/)){n=new DOMParser,t=t.replace(/;.+/,"");try{e=n.parseFromString(e,t)}catch(e){}}return e},r.href=function(e){return e.href},r.isCrossDomain=function(e){var t,n;(t=document.createElement("a")).href=location.href,n=document.createElement("a");try{return n.href=e,!((!n.protocol||":"===n.protocol)&&!n.host||t.protocol+"//"+t.host==n.protocol+"//"+n.host)}catch(e){return e,!0}}}.call(this),function(){var e,t;e=r.matches,t=function(e){return Array.prototype.slice.call(e)},r.serializeElement=function(n,a){var o,r;return o=[n],e(n,"form")&&(o=t(n.elements)),r=[],o.forEach(function(n){if(n.name&&!n.disabled)return e(n,"select")?t(n.options).forEach(function(e){if(e.selected)return r.push({name:n.name,value:e.value})}):n.checked||-1===["radio","checkbox","submit"].indexOf(n.type)?r.push({name:n.name,value:n.value}):void 0}),a&&r.push(a),r.map(function(e){return null!=e.name?encodeURIComponent(e.name)+"="+encodeURIComponent(e.value):e}).join("&")},r.formElements=function(n,a){return e(n,"form")?t(n.elements).filter(function(t){return e(t,a)}):t(n.querySelectorAll(a))}}.call(this),function(){var e,t,n;t=r.fire,n=r.stopEverything,r.handleConfirm=function(t){if(!e(this))return n(t)},e=function(e){var n,a,o;if(!(o=e.getAttribute("data-confirm")))return!0;if(n=!1,t(e,"confirm")){try{n=confirm(o)}catch(e){}a=t(e,"confirm:complete",[n])}return n&&a}}.call(this),function(){var e,t,n,a,o,i,l,c,u,s,d;u=r.matches,c=r.getData,s=r.setData,d=r.stopEverything,l=r.formElements,r.handleDisabledElement=function(e){if(this,this.disabled)return d(e)},r.enableElement=function(e){var t;return t=e instanceof Event?e.target:e,u(t,r.linkDisableSelector)?i(t):u(t,r.buttonDisableSelector)||u(t,r.formEnableSelector)?a(t):u(t,r.formSubmitSelector)?o(t):void 0},r.disableElement=function(a){var o;return o=a instanceof Event?a.target:a,u(o,r.linkDisableSelector)?n(o):u(o,r.buttonDisableSelector)||u(o,r.formDisableSelector)?e(o):u(o,r.formSubmitSelector)?t(o):void 0},n=function(e){var t;return null!=(t=e.getAttribute("data-disable-with"))&&(s(e,"ujs:enable-with",e.innerHTML),e.innerHTML=t),e.addEventListener("click",d),s(e,"ujs:disabled",!0)},i=function(e){var t;return null!=(t=c(e,"ujs:enable-with"))&&(e.innerHTML=t,s(e,"ujs:enable-with",null)),e.removeEventListener("click",d),s(e,"ujs:disabled",null)},t=function(t){return l(t,r.formDisableSelector).forEach(e)},e=function(e){var t;return null!=(t=e.getAttribute("data-disable-with"))&&(u(e,"button")?(s(e,"ujs:enable-with",e.innerHTML),e.innerHTML=t):(s(e,"ujs:enable-with",e.value),e.value=t)),e.disabled=!0,s(e,"ujs:disabled",!0)},o=function(e){return l(e,r.formEnableSelector).forEach(a)},a=function(e){var t;return null!=(t=c(e,"ujs:enable-with"))&&(u(e,"button")?e.innerHTML=t:e.value=t,s(e,"ujs:enable-with",null)),e.disabled=!1,s(e,"ujs:disabled",null)}}.call(this),function(){var e;e=r.stopEverything,r.handleMethod=function(t){var n,a,o,i,l,c;if(this,c=this.getAttribute("data-method"))return l=r.href(this),a=r.csrfToken(),n=r.csrfParam(),o=document.createElement("form"),i="<input name='_method' value='"+c+"' type='hidden' />",null==n||null==a||r.isCrossDomain(l)||(i+="<input name='"+n+"' value='"+a+"' type='hidden' />"),i+='<input type="submit" />',o.method="post",o.action=l,o.target=this.target,o.innerHTML=i,o.style.display="none",document.body.appendChild(o),o.querySelector('[type="submit"]').click(),e(t)}}.call(this),function(){var e,t,n,a,o,i,l,c,u,s=[].slice;i=r.matches,n=r.getData,c=r.setData,t=r.fire,u=r.stopEverything,e=r.ajax,a=r.isCrossDomain,l=r.serializeElement,o=function(e){var t;return null!=(t=e.getAttribute("data-remote"))&&"false"!==t},r.handleRemote=function(d){var m,f,p,b,h,v,y;return!o(b=this)||(t(b,"ajax:before")?(y=b.getAttribute("data-with-credentials"),p=b.getAttribute("data-type")||"script",i(b,r.formSubmitSelector)?(m=n(b,"ujs:submit-button"),h=n(b,"ujs:submit-button-formmethod")||b.method,v=n(b,"ujs:submit-button-formaction")||b.getAttribute("action")||location.href,"GET"===h.toUpperCase()&&(v=v.replace(/\?.*$/,"")),"multipart/form-data"===b.enctype?(f=new FormData(b),null!=m&&f.append(m.name,m.value)):f=l(b,m),c(b,"ujs:submit-button",null),c(b,"ujs:submit-button-formmethod",null),c(b,"ujs:submit-button-formaction",null)):i(b,r.buttonClickSelector)||i(b,r.inputChangeSelector)?(h=b.getAttribute("data-method"),v=b.getAttribute("data-url"),f=l(b,b.getAttribute("data-params"))):(h=b.getAttribute("data-method"),v=r.href(b),f=b.getAttribute("data-params")),e({type:h||"GET",url:v,data:f,dataType:p,beforeSend:function(e,n){return t(b,"ajax:beforeSend",[e,n])?t(b,"ajax:send",[e]):(t(b,"ajax:stopped"),!1)},success:function(){var e;return e=1<=arguments.length?s.call(arguments,0):[],t(b,"ajax:success",e)},error:function(){var e;return e=1<=arguments.length?s.call(arguments,0):[],t(b,"ajax:error",e)},complete:function(){var e;return e=1<=arguments.length?s.call(arguments,0):[],t(b,"ajax:complete",e)},crossDomain:a(v),withCredentials:null!=y&&"false"!==y}),u(d)):(t(b,"ajax:stopped"),!1))},r.formSubmitButtonClick=function(e){var t;if(this,t=this.form)return this.name&&c(t,"ujs:submit-button",{name:this.name,value:this.value}),c(t,"ujs:formnovalidate-button",this.formNoValidate),c(t,"ujs:submit-button-formaction",this.getAttribute("formaction")),c(t,"ujs:submit-button-formmethod",this.getAttribute("formmethod"))},r.preventInsignificantClick=function(e){var t,n,a;if(this,a=(this.getAttribute("data-method")||"GET").toUpperCase(),t=this.getAttribute("data-params"),n=(e.metaKey||e.ctrlKey)&&"GET"===a&&!t,!(0===e.button)||n)return e.stopImmediatePropagation()}}.call(this),function(){var e,t,n,a,o,i,l,c,u,s,d,m,f,p,b;if(i=r.fire,n=r.delegate,c=r.getData,e=r.$,b=r.refreshCSRFTokens,t=r.CSRFProtection,f=r.loadCSPNonce,o=r.enableElement,a=r.disableElement,s=r.handleDisabledElement,u=r.handleConfirm,p=r.preventInsignificantClick,m=r.handleRemote,l=r.formSubmitButtonClick,d=r.handleMethod,"undefined"!=typeof jQuery&&null!==jQuery&&null!=jQuery.ajax){if(jQuery.rails)throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");jQuery.rails=r,jQuery.ajaxPrefilter(function(e,n,a){if(!e.crossDomain)return t(a)})}r.start=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");return window.addEventListener("pageshow",function(){return e(r.formEnableSelector).forEach(function(e){if(c(e,"ujs:disabled"))return o(e)}),e(r.linkDisableSelector).forEach(function(e){if(c(e,"ujs:disabled"))return o(e)})}),n(document,r.linkDisableSelector,"ajax:complete",o),n(document,r.linkDisableSelector,"ajax:stopped",o),n(document,r.buttonDisableSelector,"ajax:complete",o),n(document,r.buttonDisableSelector,"ajax:stopped",o),n(document,r.linkClickSelector,"click",p),n(document,r.linkClickSelector,"click",s),n(document,r.linkClickSelector,"click",u),n(document,r.linkClickSelector,"click",a),n(document,r.linkClickSelector,"click",m),n(document,r.linkClickSelector,"click",d),n(document,r.buttonClickSelector,"click",p),n(document,r.buttonClickSelector,"click",s),n(document,r.buttonClickSelector,"click",u),n(document,r.buttonClickSelector,"click",a),n(document,r.buttonClickSelector,"click",m),n(document,r.inputChangeSelector,"change",s),n(document,r.inputChangeSelector,"change",u),n(document,r.inputChangeSelector,"change",m),n(document,r.formSubmitSelector,"submit",s),n(document,r.formSubmitSelector,"submit",u),n(document,r.formSubmitSelector,"submit",m),n(document,r.formSubmitSelector,"submit",function(e){return setTimeout(function(){return a(e)},13)}),n(document,r.formSubmitSelector,"ajax:send",a),n(document,r.formSubmitSelector,"ajax:complete",o),n(document,r.formInputClickSelector,"click",p),n(document,r.formInputClickSelector,"click",s),n(document,r.formInputClickSelector,"click",u),n(document,r.formInputClickSelector,"click",l),document.addEventListener("DOMContentLoaded",b),document.addEventListener("DOMContentLoaded",f),window._rails_loaded=!0},window.Rails===r&&i(document,"rails:attachBindings")&&r.start()}.call(this)}).call(this),e.exports?e.exports=r:void 0===(o="function"==typeof(a=r)?a.call(t,n,t,e):a)||(e.exports=o)}).call(this)},893:function(e,t,n){"use strict";n.r(t);var a=n(59),o=n(108),r='.batch-checkbox input[type="checkbox"]';Object(a.delegate)(document,"#batch_checkbox_all","change",function(e){var t=e.target;[].forEach.call(document.querySelectorAll(r),function(e){e.checked=t.checked})}),Object(a.delegate)(document,r,"change",function(){var e=document.querySelector("#batch_checkbox_all");e&&(e.checked=[].every.call(document.querySelectorAll(r),function(e){return e.checked}),e.indeterminate=!e.checked&&[].some.call(document.querySelectorAll(r),function(e){return e.checked}))}),Object(a.delegate)(document,".media-spoiler-show-button","click",function(){[].forEach.call(document.querySelectorAll("button.media-spoiler"),function(e){e.click()})}),Object(a.delegate)(document,".media-spoiler-hide-button","click",function(){[].forEach.call(document.querySelectorAll(".spoiler-button.spoiler-button--visible button"),function(e){e.click()})});var i=function(e){var t=document.querySelector(".input.with_label.domain_block_reject_media"),n=document.querySelector(".input.with_label.domain_block_reject_reports");t&&(t.style.display="suspend"===e.value?"none":"block"),n&&(n.style.display="suspend"===e.value?"none":"block")};Object(a.delegate)(document,"#domain_block_severity","change",function(e){var t=e.target;return i(t)}),Object(o.default)(function(){var e=document.getElementById("domain_block_severity");e&&i(e)})}},[[893,0]]]);
//# sourceMappingURL=admin.js.map