spc-pleroma/priv/static/packs/core/admin.js

2 lines
14 KiB
JavaScript

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