2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
|
/*! This file is auto-generated */
|
||
|
window.wp=window.wp||{},function(g,u){u.editor=u.editor||{},window.switchEditors=new function(){var h,b,t={};function e(){!h&&window.tinymce&&(h=window.tinymce,(b=h.$)(document).on("click",function(e){e=b(e.target);e.hasClass("wp-switch-editor")&&n(e.attr("data-wp-editor-id"),e.hasClass("switch-tmce")?"tmce":"html")}))}function v(e){e=b(".mce-toolbar-grp",e.getContainer())[0],e=e&&e.clientHeight;return e&&10<e&&e<200?parseInt(e,10):30}function n(e,t){t=t||"toggle";var n,i,r,a,o,c,p,s,d,l,g=h.get(e=e||"content"),u=b("#wp-"+e+"-wrap"),w=b("#"+e),m=w[0];if("tmce"===(t="toggle"===t?g&&!g.isHidden()?"html":"tmce":t)||"tinymce"===t){if(g&&!g.isHidden())return!1;void 0!==window.QTags&&window.QTags.closeAllTags(e);var f=parseInt(m.style.height,10)||0;(g?g.getParam("wp_keep_scroll_position"):window.tinyMCEPreInit.mceInit[e]&&window.tinyMCEPreInit.mceInit[e].wp_keep_scroll_position)&&(a=w)&&a.length&&(a=a[0],c=function(e,t){var n=t.cursorStart,t=t.cursorEnd,i=x(e,n);i&&(n=-1!==["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"].indexOf(i.tagType)?i.ltPos:i.gtPos);i=x(e,t);i&&(t=i.gtPos);i=E(e,n);i&&!i.showAsPlainText&&(n=i.urlAtStartOfContent?i.endIndex:i.startIndex);i=E(e,t);i&&!i.showAsPlainText&&(t=i.urlAtEndOfContent?i.startIndex:i.endIndex);return{cursorStart:n,cursorEnd:t}}(a.value,{cursorStart:a.selectionStart,cursorEnd:a.selectionEnd}),o=c.cursorStart,c=c.cursorEnd,d=o!==c?"range":"single",p=null,s=y(b,"").attr("data-mce-type","bookmark"),"range"==d&&(d=a.value.slice(o,c),l=s.clone().addClass("mce_SELRES_end"),p=[d,l[0].outerHTML].join("")),a.value=[a.value.slice(0,o),s.clone().addClass("mce_SELRES_start")[0].outerHTML,p,a.value.slice(c)].join("")),g?(g.show(),!h.Env.iOS&&f&&50<(f=f-v(g)+14)&&f<5e3&&g.theme.resizeTo(null,f),g.getParam("wp_keep_scroll_position")&&S(g)):h.init(window.tinyMCEPreInit.mceInit[e]),u.removeClass("html-active").addClass("tmce-active"),w.attr("aria-hidden",!0),window.setUserSetting("editor","tinymce")}else if("html"===t){if(g&&g.isHidden())return!1;g?(h.Env.iOS||(f=(d=g.iframeElement)?parseInt(d.style.height,10):0)&&50<(f=f+v(g)-14)&&f<5e3&&(m.style.height=f+"px"),l=null,g.getParam("wp_keep_scroll_position")&&(l=function(e){var t,n,i,r,a,o,c,p=e.getWin().getSelection();if(p&&!(p.rangeCount<1))return c="SELRES_"+Math.random(),o=y(e.$,c),a=o.clone().addClass("mce_SELRES_start"),o=o.clone().addClass("mce_SELRES_end"),r=p.getRangeAt(0),t=r.startContainer,n=r.startOffset,i=r.cloneRange(),0<e.$(t).parents(".mce-offscreen-selection").length?(t=e.$("[data-mce-selected]")[0],a.attr("data-mce-object-selection","true"),o.attr("data-mce-object-selection","true"),e.$(t).before(a[0]),e.$(t).after(o[0])):(i.collapse(!1),i.insertNode(o[0]),i.setStart(t,n),i.collapse(!0),i.insertNode(a[0]),r.setStartAfter(a[0]),r.setEndBefore(o[0]),p.removeAllRanges(),p.addRange(r)),e.on("GetContent",_),t=$(e.getContent()),e.off("GetContent",_),a.remove(),o.remove(),n=new RegExp('<span[^>]*\\s*class="mce_SELRES_start"[^>]+>\\s*'+c+"[^<]*<\\/span>(\\s*)"),i=new RegExp('(\\s*)<span[^>]*\\s*class="mce_SELRES_end"[^>]+>\\s*'+c+"[^<]*<\\/span>"),p=t.match(n),r=t.match(i),p?(e=p.index,a=p[0].length,o=null,r&&(-1!==p[0].indexOf("data-mce-object-selection")&&(a-=p[1].length),c=r.index,-1!==r[0].indexOf("data-mce-object-selection")&&(c-=r[1].length),o=c-a),{start:e,end:o}):null}(g)),g.hide(),l&&(o=g,(s=l)&&(n=o.getElement(),i=s.start,r=s.end||s.start,n.focus&&setTimeout(function(){n.setSelectionRange(i,r),n.blur&&n.blur(),n.focus()},100)))):w.css({display:"",visibility:""}),u.removeClass("tmce-active").addClass("html-active"),w.attr("aria-hidden",!1),window.setUserSetting("editor","html")}}function x(e,t){var n,i=e.lastIndexOf("<",t-1);return(e.lastIndexOf(">",t)<i||">"===e.substr(t,1))&&(e=(t=e.substr(i)).match(/<\s*(\/)?(\w+|\!-{2}.*-{2})/))?(n=e[2],{ltPos:i,gtPos:i+t.indexOf(">")+1,tagType:n,isClosingTag:!!e[1]}):null}function E(e,t){for(var n=function(e){var t,n=function(e){var t=e.match(/\[+([\w_-])+/g),n=[];if(t)for(var i=0;i<t.length;i++){var r=t[i].replace(/^\[+/g,"");
|