%PDF- %PDF-
Direktori : /var/www/cwg/wp-content/plugins/codepress-admin-columns/assets/js/ |
Current File : //var/www/cwg/wp-content/plugins/codepress-admin-columns/assets/js/table.js |
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=18)}([function(t,e){t.exports=jQuery},function(t,e){function n(t,e){if(!t)throw new Error(e||"AssertionError")}n.notEqual=function(t,e,o){n(t!=e,o)},n.notOk=function(t,e){n(!t,e)},n.equal=function(t,e,o){n(t==e,o)},n.ok=n,t.exports=n},function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"a",(function(){return i}));var o=function(){document.querySelectorAll("[data-ac-tip]").forEach((function(t){new i(t)}))},i=function(){function t(t,e){void 0===e&&(e=""),this.element=t,this.content=e||t.dataset.acTip,this.tip=s(this.content),this.initEvents()}return t.prototype.initEvents=function(){var t=this;"1"!==this.element.dataset.acTooltipInit&&(this.element.dataset.acTooltipInit="1",document.body.appendChild(this.tip),this.element.addEventListener("mouseenter",(function(){var e=document.body.getBoundingClientRect(),n=t.element.getBoundingClientRect();t.tip.style.left=n.left-e.left+t.element.offsetWidth/2+"px",t.tip.style.top=n.top-e.top+t.element.offsetHeight+"px",t.tip.classList.add("hover")})),this.element.addEventListener("mouseleave",(function(){t.tip.classList.remove("hover")})))},t}(),s=function(t){var e=document.createElement("div");return e.classList.add("ac-tooltip"),e.innerHTML=t,e}},function(t,e,n){"use strict";var o=function(){function t(t){t&&(this.el=t,this.dialog=t.querySelector(".ac-modal__dialog"),this.initEvents())}return t.prototype.initEvents=function(){var t=this,e=this;document.addEventListener("keydown",(function(e){var n=e.key;t.isOpen()&&"Escape"===n&&t.close()}));var n=this.el.querySelectorAll('[data-dismiss="modal"], .ac-modal__dialog__close');n.length>0&&n.forEach((function(t){t.addEventListener("click",(function(t){t.preventDefault(),e.close()}))})),this.el.addEventListener("click",(function(t){t.target.classList.contains("ac-modal")&&e.close()}))},t.prototype.isOpen=function(){return this.el.classList.contains("-active")},t.prototype.close=function(){this.onClose(),this.el.classList.remove("-active")},t.prototype.open=function(){var t=this;setTimeout((function(){t.onOpen(),t.el.removeAttribute("style"),t.el.classList.add("-active")}))},t.prototype.destroy=function(){this.el.remove()},t.prototype.onClose=function(){},t.prototype.onOpen=function(){},t}();e.a=o},function(t,e,n){"use strict";var o=n(2),i=function(){function t(){this.init()}return t.prototype.init=function(){Object(o.b)()},t}();e.a=i},function(t,e,n){var o=n(6),i=n(7),s=n(1);function r(t){if(!(this instanceof r))return new r(t);this._name=t||"nanobus",this._starListeners=[],this._listeners={}}t.exports=r,r.prototype.emit=function(t){s.ok("string"==typeof t||"symbol"==typeof t,"nanobus.emit: eventName should be type string or symbol");for(var e=[],n=1,o=arguments.length;n<o;n++)e.push(arguments[n]);var r=i(this._name+"('"+t.toString()+"')"),l=this._listeners[t];return l&&l.length>0&&this._emit(this._listeners[t],e),this._starListeners.length>0&&this._emit(this._starListeners,t,e,r.uuid),r(),this},r.prototype.on=r.prototype.addListener=function(t,e){return s.ok("string"==typeof t||"symbol"==typeof t,"nanobus.on: eventName should be type string or symbol"),s.equal(typeof e,"function","nanobus.on: listener should be type function"),"*"===t?this._starListeners.push(e):(this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e)),this},r.prototype.prependListener=function(t,e){return s.ok("string"==typeof t||"symbol"==typeof t,"nanobus.prependListener: eventName should be type string or symbol"),s.equal(typeof e,"function","nanobus.prependListener: listener should be type function"),"*"===t?this._starListeners.unshift(e):(this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].unshift(e)),this},r.prototype.once=function(t,e){s.ok("string"==typeof t||"symbol"==typeof t,"nanobus.once: eventName should be type string or symbol"),s.equal(typeof e,"function","nanobus.once: listener should be type function");var n=this;return this.on(t,(function o(){e.apply(n,arguments),n.removeListener(t,o)})),this},r.prototype.prependOnceListener=function(t,e){s.ok("string"==typeof t||"symbol"==typeof t,"nanobus.prependOnceListener: eventName should be type string or symbol"),s.equal(typeof e,"function","nanobus.prependOnceListener: listener should be type function");var n=this;return this.prependListener(t,(function o(){e.apply(n,arguments),n.removeListener(t,o)})),this},r.prototype.removeListener=function(t,e){return s.ok("string"==typeof t||"symbol"==typeof t,"nanobus.removeListener: eventName should be type string or symbol"),s.equal(typeof e,"function","nanobus.removeListener: listener should be type function"),"*"===t?(this._starListeners=this._starListeners.slice(),n(this._starListeners,e)):(void 0!==this._listeners[t]&&(this._listeners[t]=this._listeners[t].slice()),n(this._listeners[t],e));function n(t,e){if(t){var n=t.indexOf(e);return-1!==n?(o(t,n,1),!0):void 0}}},r.prototype.removeAllListeners=function(t){return t?"*"===t?this._starListeners=[]:this._listeners[t]=[]:(this._starListeners=[],this._listeners={}),this},r.prototype.listeners=function(t){var e="*"!==t?this._listeners[t]:this._starListeners,n=[];if(e)for(var o=e.length,i=0;i<o;i++)n.push(e[i]);return n},r.prototype._emit=function(t,e,n,o){if(void 0!==t&&0!==t.length){void 0===n&&(n=e,e=null),e&&(n=void 0!==o?[e].concat(n,o):[e].concat(n));for(var i=t.length,s=0;s<i;s++){var r=t[s];r.apply(r,n)}}}},function(t,e,n){"use strict";t.exports=function(t,e,n){var o,i=t.length;if(!(e>=i||0===n)){var s=i-(n=e+n>i?i-e:n);for(o=e;o<s;++o)t[o]=t[o+n];t.length=s}}},function(t,e,n){var o,i=n(8)(),s=n(1);r.disabled=!0;try{o=window.performance,r.disabled="true"===window.localStorage.DISABLE_NANOTIMING||!o.mark}catch(t){}function r(t){if(s.equal(typeof t,"string","nanotiming: name should be type string"),r.disabled)return l;var e=(1e4*o.now()).toFixed()%Number.MAX_SAFE_INTEGER,n="start-"+e+"-"+t;function a(s){var r="end-"+e+"-"+t;o.mark(r),i.push((function(){var i=null;try{var l=t+" ["+e+"]";o.measure(l,n,r),o.clearMarks(n),o.clearMarks(r)}catch(t){i=t}s&&s(i,t)}))}return o.mark(n),a.uuid=e,a}function l(t){t&&i.push((function(){t(new Error("nanotiming: performance API unavailable"))}))}t.exports=r},function(t,e,n){var o=n(1),i="undefined"!=typeof window;function s(t){this.hasWindow=t,this.hasIdle=this.hasWindow&&window.requestIdleCallback,this.method=this.hasIdle?window.requestIdleCallback.bind(window):this.setTimeout,this.scheduled=!1,this.queue=[]}s.prototype.push=function(t){o.equal(typeof t,"function","nanoscheduler.push: cb should be type function"),this.queue.push(t),this.schedule()},s.prototype.schedule=function(){if(!this.scheduled){this.scheduled=!0;var t=this;this.method((function(e){for(;t.queue.length&&e.timeRemaining()>0;)t.queue.shift()(e);t.scheduled=!1,t.queue.length&&t.schedule()}))}},s.prototype.setTimeout=function(t){setTimeout(t,0,{timeRemaining:function(){return 1}})},t.exports=function(){var t;return i?(window._nanoScheduler||(window._nanoScheduler=new s(!0)),t=window._nanoScheduler):t=new s,t}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var o=n(3),i=function(){function t(){this.modals={},this.number=0,this.defaults={modal:o.a},this.initGlobalEvents()}return t.prototype.register=function(t,e){return void 0===e&&(e=""),e||(e="m"+this.number),this.modals[e]=t,this.number++,t},t.prototype.get=function(t){return this.modals.hasOwnProperty(t)?this.modals[t]:null},t.prototype.open=function(t){this.get(t)&&this.get(t).open()},t.prototype.close=function(t){this.get(t)&&this.get(t).close()},t.prototype.closeAll=function(){for(var t in this.modals)this.close(t)},t.prototype.initGlobalEvents=function(){var t=this;document.addEventListener("click",(function(e){var n=e.target;n.dataset.acModal&&(e.preventDefault(),t.open(n.dataset.acModal))}))},t}(),s=n(5),r=function(){return window.AdminColumns||(window.AdminColumns=window.AdminColumns||{},AdminColumns.events=s(),AdminColumns.Modals=new i),window.AdminColumns}},,,,,,,,,function(t,e,n){"use strict";function o(t,e){e.parentNode.insertBefore(t,e.nextSibling)}n.r(e);var i=n(5),s=function(){function t(t){this.container=t,this.events=i(),this.init()}return t.prototype.init=function(){var t=this;this.container.addEventListener("update",(function(){t.refresh()}));var e=document.querySelectorAll(".tablenav.top .actions");e&&(o(this.container,e[e.length-1]),this.container.classList.add("-init"),this.container.dispatchEvent(new CustomEvent("update")))},t.prototype.refresh=function(){this.container.querySelectorAll(".ac-table-actions-buttons > a").forEach((function(t){t.classList.remove("last")}));var t=[].slice.call(this.container.querySelectorAll(".ac-table-actions-buttons > a"),0);t.reverse();for(var e=0;e<t.length;e++)if(t[e].offsetParent){t[e].classList.add("last");break}},t}(),r=function(){function t(){this.cells={}}return t.prototype.add=function(t,e){this.cells.hasOwnProperty(t)||(this.cells[t]={}),this.cells[t][e.getName()]=e},t.prototype.getByID=function(t){var e=[];if(!this.cells.hasOwnProperty(t.toString()))return e;var n=this.cells[t.toString()];return Object.keys(n).forEach((function(t){return e.push(n[t])})),e},t.prototype.getAll=function(){var t=this,e=[];return Object.keys(this.cells).forEach((function(n){var o=t.cells[n];Object.keys(o).forEach((function(t){return e.push(o[t])}))})),e},t.prototype.getByName=function(t){var e=this,n=[];return Object.keys(this.cells).forEach((function(o){var i=e.cells[o];Object.keys(i).forEach((function(e){t===e&&n.push(i[e])}))})),n},t.prototype.get=function(t,e){return this.cells.hasOwnProperty(t.toString())?this.cells[t][e]:null},t}(),l=function(){function t(t){this.table=t,this.columns={},this.init()}return t.prototype.init=function(){for(var t=this.table.querySelector("thead").querySelectorAll("th"),e=0;e<t.length;e++){var n=t[e].id;this.columns[t[e].id]={name:n,type:AC.column_types[n],label:this.sanitizeLabel(t[e])}}},t.prototype.getColumns=function(){return this.columns},t.prototype.getColumnsMap=function(){var t=new Map,e=this.getColumns();return Object.keys(e).forEach((function(n){t.set(n,e[n])})),t},t.prototype.getColumnNames=function(){return Object.keys(this.columns)},t.prototype.get=function(t){return this.columns.hasOwnProperty(t)?this.columns[t]:null},t.prototype.sanitizeLabel=function(t){var e=t.querySelector("a"),n=t.innerHTML;if(e){var o=e.getElementsByTagName("span");o.length>0&&(n=o[0].innerHTML)}return n},t}(),a=function(){function t(t,e,n){this.object_id=t,this.column_name=e,this.original_value=n.innerHTML,this.el=n}return t.prototype.getObjectID=function(){return this.object_id},t.prototype.getName=function(){return this.column_name},t.prototype.getElement=function(){return this.el},t.prototype.getRow=function(){return this.el.parentElement},t.prototype.getSettings=function(){return AdminColumns.Table.Columns.get(this.getName())},t.prototype.hasChanged=function(t){return this.original_value!==t},t.prototype.setValue=function(t){return this.original_value=t,this.el.innerHTML=t,this},t}(),u=function(){function t(t){this.Table=t}return t.prototype.getIDs=function(){var t=[],e=this.Table.getElement().querySelectorAll("tbody th.check-column input[type=checkbox]:checked");if(0===e.length)return t;for(var n=0;n<e.length;n++)t.push(parseInt(e[n].value));return t},t.prototype.getSelectedCells=function(t){var e=this,n=this.getIDs();if(0===n.length)return null;var o=[];return n.forEach((function(n){var i=e.Table.Cells.get(n,t);i&&o.push(i)})),o},t.prototype.getCount=function(){return this.getIDs().length},t.prototype.isAllSelected=function(){return!!this.Table.getElement().querySelector("thead #cb input:checked")},t}(),c=function(t){if(t.classList.contains("no-items"))return 0;var e=h(t.id);if(!e){var n=t.querySelector(".check-column input[type=checkbox]");n&&(e=h(n.id))}if(!e){var o=t.parentElement.querySelector(".edit a");if(o){var i=o.getAttribute("href");i&&(e=parseInt(function(t,e){t=t.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}("id",i)))}}return t.dataset.id=e.toString(),e},h=function(t){var e=t.split(/[_,\-]+/);return parseInt(e[e.length-1])},p={READY:"Table.Ready"},f=function(){function t(t){this.el=t,this.Columns=new l(t),this.Cells=new r,this.Actions=document.getElementById("ac-table-actions")?new s(document.getElementById("ac-table-actions")):null,this.Selection=new u(this),this._ids=[]}return t.prototype.getElement=function(){return this.el},t.prototype.init=function(){this.initTable(),this.addCellClasses(),document.dispatchEvent(new CustomEvent("AC_Table_Ready",{detail:{table:this}})),AdminColumns.events.emit(p.READY,{table:this})},t.prototype.addCellClasses=function(){var t=this;this.Columns.getColumnNames().forEach((function(e){var n=t.Columns.get(e).type;t.Cells.getByName(e).forEach((function(t){t.getElement().classList.add(n)}))}))},t.prototype.initTable=function(){for(var t=this.el.getElementsByTagName("tbody")[0].querySelectorAll("tr"),e=0;e<t.length;e++)this._ids.push(c(t[e])),this.updateRow(t[e])},t.prototype.updateRow=function(t){var e=c(t);t.dataset.id=e.toString(),this.setCellsForRow(t)},t.prototype.setCellsForRow=function(t){var e=this,n=c(t);this.Columns.getColumnNames().forEach((function(o){var i=o.replace(/\./g,"\\."),s=t.querySelector("td.column-"+i);if(s){var r=new a(n,o,s);e.Cells.add(n,r)}}))},t.prototype._getIDFromRow=function(t){return c(t)},t.prototype.getRowCellByName=function(t,e){return function(t,e){return t.querySelector("td.column-"+e)}(t,e)},t}(),d=n(4),m=function(){function t(e){this.columns=e,e.getColumnNames().forEach((function(n){var o=e.get(n),i=t.getInputByName(o.name);if(i&&0===i.parentElement.textContent.length){var s=document.createElement("span");s.innerHTML=o.label,i.parentElement.appendChild(s)}}))}return t.getInputByName=function(t){var e=document.querySelector("input[name='"+t+"-hide']");return e||!1},t}(),y=n(0),g=function(){function t(t){this.element=t,this.initEvents(),this.contentBox=this.element.parentElement.querySelector(".ac-toggle-box-contents"),this.contentBox||this.createContenBox()}return t.prototype.isAjax=function(){return 1===parseInt(this.element.dataset.ajaxPopulate)},t.prototype.isInited=function(){return this.element.dataset.toggleBoxInit},t.prototype.createContenBox=function(){var t=document.createElement("div");return t.classList.add("ac-toggle-box-contents"),o(t,this.element),this.contentBox=t,this.contentBox},t.prototype.initEvents=function(){var t=this;this.isInited()||(this.element.addEventListener("click",(function(e){e.preventDefault(),t.isAjax()&&!t.hasContent()&&t.manageAjaxValue(),t.toggleContentBox()})),this.element.dataset.toggleBoxInit="true")},t.prototype.hasContent=function(){return this.getContentBox().innerHTML.length>0},t.prototype.setContent=function(t){this.getContentBox().innerHTML=t},t.prototype.getContentBox=function(){return this.contentBox?this.contentBox:this.createContenBox()},t.prototype.setLabel=function(t){var e=this.element.dataset.label;t&&this.element.dataset.labelClose&&(e=this.element.dataset.labelClose),this.element.innerHTML=e+'<span class="spinner"></span>'},t.prototype.toggleContentBox=function(){this.getContentBox().classList.contains("-open")?(this.getContentBox().classList.remove("-open"),this.setLabel(!1)):(this.getContentBox().classList.add("-open"),this.setLabel(!0))},t.prototype.manageAjaxValue=function(){var t=this;this.element.classList.add("loading"),this.retrieveAjaxValue().done((function(e){t.setContent(e),y(t.element.parentElement).trigger("ajax_column_value_ready"),AdminColumns.Tooltips.init()})).always((function(){t.element.classList.remove("loading")}))},t.prototype.retrieveAjaxValue=function(){return y.ajax({url:ajaxurl,method:"POST",data:{action:"ac_get_column_value",list_screen:AC.list_screen,layout:AC.layout,column:this.element.dataset.column,pk:this.element.dataset.itemId,_ajax_nonce:AC.ajax_nonce}})},t}(),v=n(0),b=n.n(v),_=function(){document.querySelectorAll(".ac-show-more").forEach((function(t){new w(t)}))},w=function(){function t(t){this.element=t,this.initEvents()}return t.prototype.initEvents=function(){var t=this;this.isInited()||(this.getToggler()&&this.getToggler().addEventListener("click",(function(e){e.preventDefault(),e.stopPropagation(),t.toggle()})),this.element.dataset.showMoreInit="true")},t.prototype.getToggler=function(){return this.element.querySelector(".ac-show-more__toggle")},t.prototype.isInited=function(){return"true"===this.element.dataset.showMoreInit},t.prototype.toggle=function(){this.element.classList.contains("-on")?this.hide():this.show()},t.prototype.show=function(){this.element.classList.add("-on"),this.getToggler().innerHTML=this.getToggler().dataset.less},t.prototype.hide=function(){this.element.classList.remove("-on"),this.getToggler().innerHTML=this.getToggler().dataset.more},t}(),E=n(2),L=n(9),C=Object(L.a)();b()(document).ready((function(){var t=function(t){var e=document.querySelector(t);return e?"TABLE"===e.tagName?e:"TBODY"===e.tagName?e.closest("table"):e.querySelector("table.wp-list-table")?e.querySelector("table.wp-list-table"):null:null}(AC.table_id);t&&(C.Table=new f(t),C.Table.init(),C.ScreenOptionsColumns=new m(C.Table.Columns)),C.Tooltips=new d.a,document.querySelectorAll(".ac-toggle-box-link").forEach((function(t){new g(t)})),b()(".wp-list-table").on("updated","tr",(function(){C.Table.addCellClasses(),_()})),b()(".wp-list-table td").on("ACP_InlineEditing_After_SetValue",(function(){_()}))})),C.events.addListener(p.READY,(function(t){_(),document.querySelectorAll(".cpac_use_icons").forEach((function(t){t.parentElement.querySelectorAll(".row-actions a").forEach((function(t){new E.a(t,t.innerText)}))})),t.table.getElement().addEventListener("DOMNodeInserted",(function(t){var e=t.target;"TR"===e.tagName&&e.classList.contains("iedit")&&b()(e).trigger("updated",{id:c(e),row:e})}))})),window.ac_load_table=function(t){C.Table=new f(t)}}]);