WordPress/wp-admin/js/wp-fullscreen.min.js
Andrew Ozz 855889f7aa TinyMCE 4.0.12, first run.
- Removes wp-tinymce-schema.js and mark-loaded.js, no longer needed.
- Removes the inlinepopups and most of the wpdialogs plugins; wpdialog.js is moved to wp-includes/js.
- Adds charmap, compat3x, image, link and textcolor plugins, previously contained in /themes/advanced.
- Updates the wordpress, wpeditimage, wpfullscreen, wpgallery and wplink plugins.
- Updates DFW, wp-admin/js/wp-fullscreen.js.
See #24067.
Built from https://develop.svn.wordpress.org/trunk@26876


git-svn-id: http://core.svn.wordpress.org/trunk@26759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-28 23:53:15 +00:00

1 line
8.2 KiB
JavaScript

!function(a,b){function c(){m.removeClass("wp-dfw-show-ui"),uiShown=!1}function d(b){g.$dfwWrap.parents().each(function(c,d){var e,f=a(d);return b?(d.style.position&&f.data("wp-dfw-css-position",d.style.position),f.css("position","static")):(e=f.data("wp-dfw-css-position"),e=e||"",f.css("position",e)),"BODY"===d.nodeName?!1:void 0})}var e,f,g,h,i,j,k=0,l="transitionend webkitTransitionEnd",m=a(document.body),n=a(document);j=function(){this.topics={},this.subscribe=function(a,b){return this.topics[a]||(this.topics[a]=[]),this.topics[a].push(b),b},this.unsubscribe=function(a,b){var c,d,e=this.topics[a];if(!e)return b||[];if(b){for(c=0,d=e.length;d>c;c++)b==e[c]&&e.splice(c,1);return b}return this.topics[a]=[],e},this.publish=function(a,b){var c,d,e,f=this.topics[a];if(f){for(b=b||[],c=0,d=f.length;d>c;c++)e=f[c].apply(null,b)===!1||e;return!e}}},e={},f=e.pubsub=new j,g=e.settings={visible:!1,mode:"tinymce",id:"",title_id:"",timer:0,toolbar_shown:!1},h=e.toggleUI=function(a){clearTimeout(i),m.hasClass("wp-dfw-show-ui")||m.addClass("wp-dfw-show-ui"),"hide"===a&&(i=setTimeout(c,2e3))},e.on=function(){var c,d,f;if(!g.visible){if(g.$fullscreenFader||e.ui.init(),"object"==typeof b.wp_fullscreen_settings&&a.extend(g,b.wp_fullscreen_settings),c=g.id||b.wpActiveEditor,!c){if(!g.hasTinymce)return;c=tinymce.activeEditor.id}g.id=c,d=g.$dfwWrap=a("#wp-"+c+"-wrap"),d.length&&(g.$dfwTextarea=a("#"+c),g.$editorContainer=d.find(".wp-editor-container"),k=n.scrollTop(),g.hasTinymce&&(g.editor=tinymce.get(c)),g.editor&&!g.editor.isHidden()?(g.origHeight=a("#"+c+"_ifr").height(),g.mode="tinymce"):(g.origHeight=g.$dfwTextarea.height(),g.mode="html"),f="undefined"==typeof b.adminpage||"post-php"!==b.adminpage&&"post-new-php"!==b.adminpage?c+"-title":"title",g.$dfwTitle=a("#"+f),g.$dfwTitle.length||(g.$dfwTitle=null),e.ui.fade("show","showing","shown"))}},e.off=function(){g.visible&&e.ui.fade("hide","hiding","hidden")},e.switchmode=function(a){var b=g.mode;return a&&g.visible&&g.hasTinymce&&"undefined"!=typeof switchEditors?b==a?b:("tinymce"!==a||g.editor||(g.editor=tinymce.get(g.id),!g.editor&&"undefined"!=typeof tinyMCEPreInit&&tinyMCEPreInit.mceInit&&tinyMCEPreInit.mceInit[g.id]&&(tinyMCEPreInit.mceInit[g.id].wp_fullscreen=!0)),g.mode=a,switchEditors.go(g.id,a),e.refreshButtons(!0),"html"===a&&setTimeout(e.resizeTextarea,200),a):b},e.save=function(){var c=a("#hiddenaction"),d=c.val(),e=a("#wp-fullscreen-save .spinner"),f=a("#wp-fullscreen-save .wp-fullscreen-saved-message");$errorMessage=a("#wp-fullscreen-save .wp-fullscreen-error-message"),e.show(),$errorMessage.hide(),c.val("wp-fullscreen-save-post"),g.editor&&!g.editor.isHidden()&&g.editor.save(),a.ajax({url:b.ajaxurl,type:"post",data:a("form#post").serialize(),dataType:"json"}).done(function(b){e.hide(),b&&b.success?(f.show(),setTimeout(function(){f.fadeOut(300)},3e3),b.data&&b.data.last_edited&&a("#wp-fullscreen-save input").attr("title",b.data.last_edited)):$errorMessage.show()}).fail(function(){e.hide(),$errorMessage.show()}),c.val(d)},e.dfwWidth=function(b,c){var d;return b?(c?d=b:(d=g.$editorContainer.width(),d+=b),200>d||d>1200||(g.$editorContainer.width(d),g.$dfwTitle&&g.$dfwTitle.width(d-16),setUserSetting("dfw_width",d)),void 0):(d=a("#wp-fullscreen-body").data("theme-width")||800,g.$editorContainer.width(d),g.$dfwTitle&&g.$dfwTitle.width(d-16),deleteUserSetting("dfw_width"),void 0)},f.subscribe("show",function(){var b=a("#last-edit").text();b&&a("#wp-fullscreen-save input").attr("title",b)}),f.subscribe("showing",function(){m.addClass("wp-fullscreen-active"),g.$dfwWrap.addClass("wp-fullscreen-wrap"),g.$editorContainer.append(a("#wp-fullscreen-status")),g.$dfwTitle&&(g.$dfwTitle.after('<span id="wp-fullscreen-title-placeholder">'),g.$dfwWrap.prepend(g.$dfwTitle.addClass("wp-fullscreen-title"))),e.refreshButtons(),d(!0),a("#wpadminbar").hide(),h("hide"),e.bind_resize(),g.editor&&g.editor.execCommand("wpFullScreenOn"),e.dfwWidth(a("#wp-fullscreen-body").data("dfw-width")||800,!0),scrollTo(0,0)}),f.subscribe("shown",function(){g.visible=!0,g.editor&&!g.editor.isHidden()?g.editor.execCommand("wpAutoResize"):e.resizeTextarea("force")}),f.subscribe("hide",function(){n.unbind(".fullscreen"),g.$dfwTextarea.unbind(".wp-dfw-resize")}),f.subscribe("hiding",function(){m.removeClass("wp-fullscreen-active"),a("#wp-fullscreen-body").append(a("#wp-fullscreen-status")),g.$dfwTitle&&a("#wp-fullscreen-title-placeholder").before(g.$dfwTitle.removeClass("wp-fullscreen-title")).remove(),g.$dfwWrap.removeClass("wp-fullscreen-wrap"),g.$editorContainer.css("width",""),g.$dfwTextarea.add("#"+g.id+"_ifr").height(g.origHeight),g.editor&&g.editor.execCommand("wpFullScreenOff"),d(!1),b.scrollTo(0,k),a("#wpadminbar").show()}),f.subscribe("hidden",function(){g.visible=!1}),e.refreshButtons=function(b){"html"===g.mode?(a("#wp-fullscreen-mode-bar").removeClass("wp-tmce-mode").addClass("wp-html-mode"),b?a("#wp-fullscreen-button-bar").fadeOut(150,function(){a(this).addClass("wp-html-mode").fadeIn(150)}):a("#wp-fullscreen-button-bar").addClass("wp-html-mode")):"tinymce"===g.mode&&(a("#wp-fullscreen-mode-bar").removeClass("wp-html-mode").addClass("wp-tmce-mode"),b?a("#wp-fullscreen-button-bar").fadeOut(150,function(){a(this).removeClass("wp-html-mode").fadeIn(150)}):a("#wp-fullscreen-button-bar").removeClass("wp-html-mode"))},e.ui={init:function(){var c;g.toolbar=c=a("#fullscreen-topbar"),g.$fullscreenFader=a("#fullscreen-fader"),g.hasTinymce="undefined"!=typeof tinymce,g.hasTinymce||a("#wp-fullscreen-mode-bar").hide(),n.keyup(function(b){var c,d,f=b.keyCode||b.charCode;g.visible&&(c=navigator.platform&&-1!==navigator.platform.indexOf("Mac")?b.ctrlKey:b.altKey,27==f&&(d={event:b,what:"dfw",cb:fullscreen.off,condition:function(){return a("#TB_window").is(":visible")||a(".wp-dialog").is(":visible")?!1:!0}},a(document).triggerHandler("wp_CloseOnEscape",[d])||fullscreen.off()),!c||61!=f&&107!=f&&187!=f||(e.dfwWidth(25),b.preventDefault()),!c||45!=f&&109!=f&&189!=f||(e.dfwWidth(-25),b.preventDefault()),c&&48==f&&(e.dfwWidth(0),b.preventDefault()))}),c.on("mouseenter",function(){h("show")}).on("mouseleave",function(){h("hide")}),a("#wp-fullscreen-buttons").on("click.wp-fullscreen",function(a){var c=a.target.id&&a.target.id.substr(6);if(g.editor&&"tinymce"===g.mode)switch(c){case"bold":g.editor.execCommand("Bold");break;case"italic":g.editor.execCommand("Italic");break;case"bullist":g.editor.execCommand("InsertUnorderedList");break;case"numlist":g.editor.execCommand("InsertOrderedList");break;case"link":g.editor.execCommand("WP_Link");break;case"unlink":g.editor.execCommand("unlink");break;case"image":g.editor.execCommand("mceImage");break;case"help":g.editor.execCommand("WP_Help");break;case"blockquote":g.editor.execCommand("mceBlockQuote")}else"link"===c&&b.wpLink&&b.wpLink.open();"wp-media-library"===c&&"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(g.id)})},fade:function(a,b,c){g.$fullscreenFader||e.ui.init(),(!a||f.publish(a))&&e.fade.In(g.$fullscreenFader,200,function(){b&&f.publish(b),e.fade.Out(g.$fullscreenFader,200,function(){c&&f.publish(c)})})}},e.fade={sensitivity:100,In:function(b,c,d,f){if(d=d||a.noop,c=c||400,f=f||!1,e.fade.transitions){if(b.is(":visible"))return b.addClass("fade-trigger"),b;b.show(),b.first().one(l,function(){d()}),setTimeout(function(){b.addClass("fade-trigger")},this.sensitivity)}else f&&b.stop(),b.css("opacity",1),b.first().fadeIn(c,d),b.length>1&&b.not(":first").fadeIn(c);return b},Out:function(b,c,d,f){return d=d||a.noop,c=c||400,f=f||!1,b.is(":visible")?(e.fade.transitions?(b.first().one(l,function(){b.hasClass("fade-trigger")||(b.hide(),d())}),setTimeout(function(){b.removeClass("fade-trigger")},this.sensitivity)):(f&&b.stop(),b.first().fadeOut(c,d),b.length>1&&b.not(":first").fadeOut(c)),b):b},transitions:function(){var a=document.documentElement.style;return"string"==typeof a.WebkitTransition||"string"==typeof a.MozTransition||"string"==typeof a.OTransition||"string"==typeof a.transition}()},e.bind_resize=function(){g.$dfwTextarea.on("keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize",function(a){e.resizeTextarea(a)})},e.resizeTextarea=function(){var a=g.$dfwTextarea[0];a.scrollHeight>a.clientHeight&&(a.style.height=a.scrollHeight+50+"px")},b.wp=b.wp||{},b.wp.editor=b.wp.editor||{},b.wp.editor.fullscreen=e}(jQuery,window);