PluginProbe
Plugin Groups / 2.0.3
Plugin Groups v2.0.3
trunk 1.0.3 1.1.0 1.2.1 1.2.2 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.9 3.0.0
plugin-groups / js / bulk-handler.js

bulk-handler.js in Plugin Groups 2.0.3, at js/bulk-handler.js

1 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 !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=6)}({1:function(e,t){e.exports=window.wp.i18n},6:function(e,t,n){"use strict";n.r(t);var r=n(1);const o={newGroupInput:null,groupSelector:null,init(){document.querySelectorAll('select[name^="action"]').forEach(e=>{e.addEventListener("change",t=>{this.handleChange(e)})})},handleChange(e){switch(this.newGroupInput&&(this.newGroupInput.parentNode.removeChild(this.newGroupInput),this.newGroupInput=null),this.groupSelector&&(this.groupSelector.parentNode.removeChild(this.groupSelector),this.groupSelector=null),e.value){case"add-to-group":this.addToGroup(e)}},addToGroup(e){this.groupSelector||(this.groupSelector=this.makeSelector()),this.groupSelector.addEventListener("change",()=>{"__new"===this.groupSelector.value?this.newGroup(this.groupSelector):this.newGroupInput&&(e.parentNode.removeChild(this.newGroupInput),this.newGroupInput=null)}),e.parentNode.insertBefore(this.groupSelector,e.nextSibling)},makeSelector(){const e=document.createElement("select");e.name="group_id",plgData.forEach(t=>{const n=document.createElement("option");n.value=t.id,n.innerText=t.name,e.appendChild(n)});const t=document.createElement("optgroup"),n=document.createElement("option");return t.label="---------",n.value="__new",n.innerText=Object(r.__)("New group","plugin-groups"),t.appendChild(n),e.appendChild(t),e},newGroup(e){this.newGroupInput||(this.newGroupInput=document.createElement("input"),this.newGroupInput.type="text",this.newGroupInput.className="regular-text",this.newGroupInput.placeholder=Object(r.__)("New group name","plugin-groups"),this.newGroupInput.name="new_group_name"),e.parentNode.insertBefore(this.newGroupInput,e.nextSibling),this.newGroupInput.focus()}};window.addEventListener("load",()=>o.init())}});