%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/dopla/www/wp-admin/js/
Upload File :
Create Path :
Current File : /home/dopla/www/wp-admin/js/theme-plugin-editor.min.js

window.wp||(window.wp={}),wp.themePluginEditor=function(i){"use strict";var t,s={l10n:{lintError:{singular:"",plural:""},saveAlert:"",saveError:""},codeEditor:{},instance:null,noticeElements:{},dirty:!1,lintErrors:[],init:function(e,t){s.form=e,t&&i.extend(s,t),s.noticeTemplate=wp.template("wp-file-editor-notice"),s.noticesContainer=s.form.find(".editor-notices"),s.submitButton=s.form.find(":input[name=submit]"),s.spinner=s.form.find(".submit .spinner"),s.form.on("submit",s.submit),s.textarea=s.form.find("#newcontent"),s.textarea.on("change",s.onChange),s.warning=i(".file-editor-warning"),s.docsLookUpButton=s.form.find("#docs-lookup"),s.docsLookUpList=s.form.find("#docs-list"),0<s.warning.length&&s.showWarning(),!1!==s.codeEditor&&_.defer(function(){s.initCodeEditor()}),i(s.initFileBrowser),i(window).on("beforeunload",function(){if(s.dirty)return s.l10n.saveAlert}),s.docsLookUpList.on("change",function(){""===i(this).val()?s.docsLookUpButton.prop("disabled",!0):s.docsLookUpButton.prop("disabled",!1)})},showWarning:function(){var e=s.warning.find(".file-editor-warning-message").text();i("#wpwrap").attr("aria-hidden","true"),i(document.body).addClass("modal-open").append(s.warning.detach()),s.warning.removeClass("hidden").find(".file-editor-warning-go-back").focus(),s.warningTabbables=s.warning.find("a, button"),s.warningTabbables.on("keydown",s.constrainTabbing),s.warning.on("click",".file-editor-warning-dismiss",s.dismissWarning),setTimeout(function(){wp.a11y.speak(wp.sanitize.stripTags(e.replace(/\s+/g," ")),"assertive")},1e3)},constrainTabbing:function(e){var t,i;9===e.which&&(t=s.warningTabbables.first()[0],(i=s.warningTabbables.last()[0])!==e.target||e.shiftKey?t===e.target&&e.shiftKey&&(i.focus(),e.preventDefault()):(t.focus(),e.preventDefault()))},dismissWarning:function(){wp.ajax.post("dismiss-wp-pointer",{pointer:s.themeOrPlugin+"_editor_notice"}),s.warning.remove(),i("#wpwrap").removeAttr("aria-hidden"),i("body").removeClass("modal-open")},onChange:function(){s.dirty=!0,s.removeNotice("file_saved")},submit:function(e){var t={};e.preventDefault(),i.each(s.form.serializeArray(),function(){t[this.name]=this.value}),s.instance&&(t.newcontent=s.instance.codemirror.getValue()),s.isSaving||(s.lintErrors.length?s.instance.codemirror.setCursor(s.lintErrors[0].from.line):(s.isSaving=!0,s.textarea.prop("readonly",!0),s.instance&&s.instance.codemirror.setOption("readOnly",!0),s.spinner.addClass("is-active"),e=wp.ajax.post("edit-theme-plugin-file",t),s.lastSaveNoticeCode&&s.removeNotice(s.lastSaveNoticeCode),e.done(function(e){s.lastSaveNoticeCode="file_saved",s.addNotice({code:s.lastSaveNoticeCode,type:"success",message:e.message,dismissible:!0}),s.dirty=!1}),e.fail(function(e){e=i.extend({code:"save_error",message:s.l10n.saveError},e,{type:"error",dismissible:!0});s.lastSaveNoticeCode=e.code,s.addNotice(e)}),e.always(function(){s.spinner.removeClass("is-active"),s.isSaving=!1,s.textarea.prop("readonly",!1),s.instance&&s.instance.codemirror.setOption("readOnly",!1)})))},addNotice:function(e){var t;if(!e.code)throw new Error("Missing code.");return s.removeNotice(e.code),(t=i(s.noticeTemplate(e))).hide(),t.find(".notice-dismiss").on("click",function(){s.removeNotice(e.code),e.onDismiss&&e.onDismiss(e)}),wp.a11y.speak(e.message),s.noticesContainer.append(t),t.slideDown("fast"),s.noticeElements[e.code]=t},removeNotice:function(e){return!!s.noticeElements[e]&&(s.noticeElements[e].slideUp("fast",function(){i(this).remove()}),delete s.noticeElements[e],!0)},initCodeEditor:function(){var e,t=i.extend({},s.codeEditor);t.onTabPrevious=function(){i("#templateside").find(":tabbable").last().focus()},t.onTabNext=function(){i("#template").find(":tabbable:not(.CodeMirror-code)").first().focus()},t.onChangeLintingErrors=function(e){0===(s.lintErrors=e).length&&s.submitButton.toggleClass("disabled",!1)},t.onUpdateErrorNotice=function(e){s.submitButton.toggleClass("disabled",0<e.length),0!==e.length?(e=1===e.length?s.l10n.lintError.singular.replace("%d","1"):s.l10n.lintError.plural.replace("%d",String(e.length)),s.addNotice({code:"lint_errors",type:"error",message:e,dismissible:!1}).find("input[type=checkbox]").on("click",function(){t.onChangeLintingErrors([]),s.removeNotice("lint_errors")})):s.removeNotice("lint_errors")},(e=wp.codeEditor.initialize(i("#newcontent"),t)).codemirror.on("change",s.onChange),i(e.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-labelledby":"theme-plugin-editor-label","aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),i("#theme-plugin-editor-label").on("click",function(){e.codemirror.focus()}),s.instance=e},initFileBrowser:function(){var e=i("#templateside");e.find('[role="group"]').parent().attr("aria-expanded",!1),e.find(".notice").parents("[aria-expanded]").attr("aria-expanded",!0),e.find('[role="tree"]').each(function(){new t(this).init()}),e.find(".current-file:first").each(function(){this.scrollIntoViewIfNeeded?this.scrollIntoViewIfNeeded():this.scrollIntoView(!1)})}},n=(e.prototype.init=function(){this.domNode.tabIndex=-1,this.domNode.getAttribute("role")||this.domNode.setAttribute("role","treeitem"),this.domNode.addEventListener("keydown",this.handleKeydown.bind(this)),this.domNode.addEventListener("click",this.handleClick.bind(this)),this.domNode.addEventListener("focus",this.handleFocus.bind(this)),this.domNode.addEventListener("blur",this.handleBlur.bind(this)),this.isExpandable?(this.domNode.firstElementChild.addEventListener("mouseover",this.handleMouseOver.bind(this)),this.domNode.firstElementChild.addEventListener("mouseout",this.handleMouseOut.bind(this))):(this.domNode.addEventListener("mouseover",this.handleMouseOver.bind(this)),this.domNode.addEventListener("mouseout",this.handleMouseOut.bind(this)))},e.prototype.isExpanded=function(){return!!this.isExpandable&&"true"===this.domNode.getAttribute("aria-expanded")},e.prototype.handleKeydown=function(e){e.currentTarget;var t=!1,i=e.key;function s(e){return 1===e.length&&e.match(/\S/)}function o(e){"*"==i?(e.tree.expandAllSiblingItems(e),t=!0):s(i)&&(e.tree.setFocusByFirstCharacter(e,i),t=!0)}if(this.stopDefaultClick=!1,!(e.altKey||e.ctrlKey||e.metaKey)){if(e.shift)e.keyCode==this.keyCode.SPACE||e.keyCode==this.keyCode.RETURN?(e.stopPropagation(),this.stopDefaultClick=!0):s(i)&&o(this);else switch(e.keyCode){case this.keyCode.SPACE:case this.keyCode.RETURN:this.isExpandable?(this.isExpanded()?this.tree.collapseTreeitem(this):this.tree.expandTreeitem(this),t=!0):(e.stopPropagation(),this.stopDefaultClick=!0);break;case this.keyCode.UP:this.tree.setFocusToPreviousItem(this),t=!0;break;case this.keyCode.DOWN:this.tree.setFocusToNextItem(this),t=!0;break;case this.keyCode.RIGHT:this.isExpandable&&(this.isExpanded()?this.tree.setFocusToNextItem(this):this.tree.expandTreeitem(this)),t=!0;break;case this.keyCode.LEFT:this.isExpandable&&this.isExpanded()?(this.tree.collapseTreeitem(this),t=!0):this.inGroup&&(this.tree.setFocusToParentItem(this),t=!0);break;case this.keyCode.HOME:this.tree.setFocusToFirstItem(),t=!0;break;case this.keyCode.END:this.tree.setFocusToLastItem(),t=!0;break;default:s(i)&&o(this)}t&&(e.stopPropagation(),e.preventDefault())}},e.prototype.handleClick=function(e){e.target!==this.domNode&&e.target!==this.domNode.firstElementChild||this.isExpandable&&(this.isExpanded()?this.tree.collapseTreeitem(this):this.tree.expandTreeitem(this),e.stopPropagation())},e.prototype.handleFocus=function(e){var t=this.domNode;(t=this.isExpandable?t.firstElementChild:t).classList.add("focus")},e.prototype.handleBlur=function(e){var t=this.domNode;(t=this.isExpandable?t.firstElementChild:t).classList.remove("focus")},e.prototype.handleMouseOver=function(e){e.currentTarget.classList.add("hover")},e.prototype.handleMouseOut=function(e){e.currentTarget.classList.remove("hover")},e);function e(e,t,i){if("object"==typeof e){e.tabIndex=-1,this.tree=t,this.groupTreeitem=i,this.domNode=e,this.label=e.textContent.trim(),this.stopDefaultClick=!1,e.getAttribute("aria-label")&&(this.label=e.getAttribute("aria-label").trim()),this.isExpandable=!1,this.isVisible=!1,this.inGroup=!1,i&&(this.inGroup=!0);for(var s=e.firstElementChild;s;){if("ul"==s.tagName.toLowerCase()){s.setAttribute("role","group"),this.isExpandable=!0;break}s=s.nextElementSibling}this.keyCode=Object.freeze({RETURN:13,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40})}}function o(e){"object"==typeof e&&(this.domNode=e,this.treeitems=[],this.firstChars=[],this.firstTreeitem=null,this.lastTreeitem=null)}return o.prototype.init=function(){this.domNode.getAttribute("role")||this.domNode.setAttribute("role","tree"),function e(t,i,s){for(var o=t.firstElementChild,r=s;o;)("li"===o.tagName.toLowerCase()&&"span"===o.firstElementChild.tagName.toLowerCase()||"a"===o.tagName.toLowerCase())&&((r=new n(o,i,s)).init(),i.treeitems.push(r),i.firstChars.push(r.label.substring(0,1).toLowerCase())),o.firstElementChild&&e(o,i,r),o=o.nextElementSibling}(this.domNode,this,!1),this.updateVisibleTreeitems(),this.firstTreeitem.domNode.tabIndex=0},o.prototype.setFocusToItem=function(e){for(var t=0;t<this.treeitems.length;t++){var i=this.treeitems[t];i===e?(i.domNode.tabIndex=0,i.domNode.focus()):i.domNode.tabIndex=-1}},o.prototype.setFocusToNextItem=function(e){for(var t=!1,i=this.treeitems.length-1;0<=i;i--){var s=this.treeitems[i];if(s===e)break;s.isVisible&&(t=s)}t&&this.setFocusToItem(t)},o.prototype.setFocusToPreviousItem=function(e){for(var t=!1,i=0;i<this.treeitems.length;i++){var s=this.treeitems[i];if(s===e)break;s.isVisible&&(t=s)}t&&this.setFocusToItem(t)},o.prototype.setFocusToParentItem=function(e){e.groupTreeitem&&this.setFocusToItem(e.groupTreeitem)},o.prototype.setFocusToFirstItem=function(){this.setFocusToItem(this.firstTreeitem)},o.prototype.setFocusToLastItem=function(){this.setFocusToItem(this.lastTreeitem)},o.prototype.expandTreeitem=function(e){e.isExpandable&&(e.domNode.setAttribute("aria-expanded",!0),this.updateVisibleTreeitems())},o.prototype.expandAllSiblingItems=function(e){for(var t=0;t<this.treeitems.length;t++){var i=this.treeitems[t];i.groupTreeitem===e.groupTreeitem&&i.isExpandable&&this.expandTreeitem(i)}},o.prototype.collapseTreeitem=function(e){var t=!1;(t=e.isExpanded()?e:e.groupTreeitem)&&(t.domNode.setAttribute("aria-expanded",!1),this.updateVisibleTreeitems(),this.setFocusToItem(t))},o.prototype.updateVisibleTreeitems=function(){this.firstTreeitem=this.treeitems[0];for(var e=0;e<this.treeitems.length;e++){var t=this.treeitems[e],i=t.domNode.parentNode;for(t.isVisible=!0;i&&i!==this.domNode;)"false"==i.getAttribute("aria-expanded")&&(t.isVisible=!1),i=i.parentNode;t.isVisible&&(this.lastTreeitem=t)}},o.prototype.setFocusByFirstCharacter=function(e,t){t=t.toLowerCase(),(e=this.treeitems.indexOf(e)+1)===this.treeitems.length&&(e=0),-1<(e=-1===(e=this.getIndexFirstChars(e,t))?this.getIndexFirstChars(0,t):e)&&this.setFocusToItem(this.treeitems[e])},o.prototype.getIndexFirstChars=function(e,t){for(var i=e;i<this.firstChars.length;i++)if(this.treeitems[i].isVisible&&t===this.firstChars[i])return i;return-1},t=o,s}(jQuery);

Zerion Mini Shell 1.0