DFW: remove unneeded JS global, fix screen flash in WebKit, props koopersmith, see #17136
git-svn-id: http://svn.automattic.com/wordpress/trunk@17702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
57134c64b7
commit
a5f2b7d50c
|
@ -1,7 +1,9 @@
|
|||
/**
|
||||
* PubSub -- A lightweight publish/subscribe implementation. Private use only!
|
||||
*/
|
||||
var PubSub = function() {
|
||||
var PubSub, fullscreen, wptitlehint;
|
||||
|
||||
PubSub = function() {
|
||||
this.topics = {};
|
||||
};
|
||||
|
||||
|
@ -50,8 +52,6 @@ PubSub.prototype.publish = function( topic, args ) {
|
|||
};
|
||||
|
||||
// Distraction Free Writing (wp-fullscreen) access the API globally using the fullscreen variable.
|
||||
var fullscreen, wp_fullscreen_enabled = false;
|
||||
|
||||
(function($){
|
||||
var api, ps, bounder;
|
||||
|
||||
|
@ -76,7 +76,7 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
return;
|
||||
|
||||
api.block = true;
|
||||
|
||||
|
||||
setTimeout( function() {
|
||||
api.block = false;
|
||||
}, 500 );
|
||||
|
@ -137,12 +137,12 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
}
|
||||
|
||||
ps.subscribe( 'showToolbar', function() {
|
||||
api.fade.fadein( api.ui.topbar, 600 );
|
||||
api.fade.In( api.ui.topbar, 600 );
|
||||
$('#wp-fullscreen-body').addClass('wp-fullscreen-focus');
|
||||
});
|
||||
|
||||
ps.subscribe( 'hideToolbar', function() {
|
||||
api.fade.fadeout( api.ui.topbar, 600 );
|
||||
api.fade.Out( api.ui.topbar, 600 );
|
||||
$('#wp-fullscreen-body').removeClass('wp-fullscreen-focus');
|
||||
});
|
||||
|
||||
|
@ -173,11 +173,11 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
});
|
||||
|
||||
ps.subscribe( 'shown', function() {
|
||||
api.visible = wp_fullscreen_enabled = true;
|
||||
api.visible = true;
|
||||
});
|
||||
|
||||
ps.subscribe( 'hidden', function() {
|
||||
api.visible = wp_fullscreen_enabled = false;
|
||||
api.visible = false;
|
||||
$('#wp_mce_fullscreen').removeAttr('style');
|
||||
tinyMCE.execCommand('wpFullScreenClose');
|
||||
});
|
||||
|
@ -222,7 +222,7 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
api.ui.element = $('#fullscreen-fader');
|
||||
api.ui.topbar = $('#fullscreen-topbar');
|
||||
|
||||
if ( 'undefined' != wptitlehint )
|
||||
if ( wptitlehint )
|
||||
wptitlehint('wp-fullscreen-title');
|
||||
},
|
||||
|
||||
|
@ -230,11 +230,11 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
if ( before )
|
||||
ps.publish( before );
|
||||
|
||||
api.fade.fadein( api.ui.element, 600, function() {
|
||||
api.fade.In( api.ui.element, 600, function() {
|
||||
if ( during )
|
||||
ps.publish( during );
|
||||
|
||||
api.fade.fadeout( api.ui.element, 600, function() {
|
||||
api.fade.Out( api.ui.element, 600, function() {
|
||||
if ( after )
|
||||
ps.publish( after );
|
||||
})
|
||||
|
@ -248,7 +248,7 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
// Sensitivity to allow browsers to render the blank element before animating.
|
||||
sensitivity: 100,
|
||||
|
||||
fadein: function( element, speed, callback ) {
|
||||
In: function( element, speed, callback ) {
|
||||
|
||||
callback = callback || $.noop;
|
||||
speed = speed || 400;
|
||||
|
@ -260,10 +260,10 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
}
|
||||
|
||||
element.show();
|
||||
setTimeout( function() { element.addClass( 'fade-trigger' ); }, this.sensitivity );
|
||||
element.one( this.transitionend, function() {
|
||||
callback();
|
||||
});
|
||||
setTimeout( function() { element.addClass( 'fade-trigger' ); }, this.sensitivity );
|
||||
} else {
|
||||
element.css( 'opacity', 1 ).fadeIn( speed, callback );
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
return element;
|
||||
},
|
||||
|
||||
fadeout: function( element, speed, callback ) {
|
||||
Out: function( element, speed, callback ) {
|
||||
|
||||
callback = callback || $.noop;
|
||||
speed = speed || 400;
|
||||
|
@ -280,7 +280,6 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
return element;
|
||||
|
||||
if ( api.fade.transitions ) {
|
||||
element.removeClass( 'fade-trigger' );
|
||||
element.one( api.fade.transitionend, function() {
|
||||
if ( element.hasClass('fade-trigger') )
|
||||
return;
|
||||
|
@ -288,6 +287,7 @@ var fullscreen, wp_fullscreen_enabled = false;
|
|||
element.hide();
|
||||
callback();
|
||||
});
|
||||
setTimeout( function() { element.removeClass( 'fade-trigger' ); }, this.sensitivity );
|
||||
} else {
|
||||
element.fadeOut( speed, callback );
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
var PubSub=function(){this.topics={}};PubSub.prototype.subscribe=function(a,b){if(!this.topics[a]){this.topics[a]=[]}this.topics[a].push(b);return b};PubSub.prototype.unsubscribe=function(b,e){var c,a,d=this.topics[b];if(!d){return e||[]}if(e){for(c=0,a=d.length;c<a;c++){if(e==d[c]){d.splice(c,1)}}return e}else{this.topics[b]=[];return d}};PubSub.prototype.publish=function(c,b){var d,a,e=this.topics[c];if(!e){return}b=b||[];for(d=0,a=e.length;d<a;d++){e[d].apply(null,b)}};var fullscreen,wp_fullscreen_enabled=false;(function(b){var a,d,c;fullscreen=a={};d=a.pubsub=new PubSub();a.timer=0;a.block=false;c=function(h,g,f){f=f||1250;if(a.block){return}a.block=true;setTimeout(function(){a.block=false},500);if(a.timer){clearTimeout(a.timer)}else{d.publish(h)}function e(){d.publish(g);a.timer=0}a.timer=setTimeout(e,f)};a.on=function(){if(!a.ui.element){a.ui.init()}if(!a.visible){a.ui.fade("show","showing","shown")}};a.off=function(){if(a.ui.element&&a.visible){a.ui.fade("hide","hiding","hidden")}};a.save=function(){b("#title").val(b("#wp-fullscreen-title").val());tinyMCE.execCommand("wpFullScreenSaveContent");b("#hiddenaction").val("wp-fullscreen-save-post");b.post(ajaxurl,b("form#post").serialize(),function(e){if(e.message){b("#wp-fullscreen-saved").html(e.message)}if(e.last_edited){b("#wp-fullscreen-last-edit").html(e.last_edited)}},"json")};set_title_hint=function(e){if(!e.val().length){e.siblings("label").css("visibility","")}else{e.siblings("label").css("visibility","hidden")}};d.subscribe("showToolbar",function(){a.fade.fadein(a.ui.topbar,600);b("#wp-fullscreen-body").addClass("wp-fullscreen-focus")});d.subscribe("hideToolbar",function(){a.fade.fadeout(a.ui.topbar,600);b("#wp-fullscreen-body").removeClass("wp-fullscreen-focus")});d.subscribe("show",function(){var e=b("#wp-fullscreen-title").val(b("#title").val());this.set_title_hint(e);b(document).bind("mousemove.fullscreen",function(f){c("showToolbar","hideToolbar",3000)})});d.subscribe("hide",function(){var e=b("#title").val(b("#wp-fullscreen-title").val());this.set_title_hint(e);tinyMCE.execCommand("wpFullScreenSave");b(document).unbind(".fullscreen")});d.subscribe("showing",function(){b("#wp-fullscreen-body").show();b(document.body).addClass("fullscreen-active");c("showToolbar","hideToolbar",3000);b("#wp-fullscreen-last-edit").html(b("#last-edit").html())});d.subscribe("hiding",function(){b("#wp-fullscreen-body").hide();b(document.body).removeClass("fullscreen-active");b("#last-edit").html(b("#wp-fullscreen-last-edit").html())});d.subscribe("shown",function(){a.visible=wp_fullscreen_enabled=true});d.subscribe("hidden",function(){a.visible=wp_fullscreen_enabled=false;b("#wp_mce_fullscreen").removeAttr("style");tinyMCE.execCommand("wpFullScreenClose")});a.b=function(){tinyMCE.execCommand("Bold")};a.i=function(){tinyMCE.execCommand("Italic")};a.ul=function(){tinyMCE.execCommand("InsertUnorderedList")};a.ol=function(){tinyMCE.execCommand("InsertOrderedList")};a.link=function(){tinyMCE.execCommand("WP_Link")};a.unlink=function(){tinyMCE.execCommand("unlink")};a.ui={init:function(){a.ui.element=b("#fullscreen-fader");a.ui.topbar=b("#fullscreen-topbar");if("undefined"!=wptitlehint){wptitlehint("wp-fullscreen-title")}},fade:function(f,e,g){if(f){d.publish(f)}a.fade.fadein(a.ui.element,600,function(){if(e){d.publish(e)}a.fade.fadeout(a.ui.element,600,function(){if(g){d.publish(g)}})})}};a.fade={transitionend:"transitionend webkitTransitionEnd oTransitionEnd",sensitivity:100,fadein:function(e,f,g){g=g||b.noop;f=f||400;if(a.fade.transitions){if(e.is(":visible")){e.addClass("fade-trigger");return e}e.show();setTimeout(function(){e.addClass("fade-trigger")},this.sensitivity);e.one(this.transitionend,function(){g()})}else{e.css("opacity",1).fadeIn(f,g)}return e},fadeout:function(e,f,g){g=g||b.noop;f=f||400;if(!e.is(":visible")){return e}if(a.fade.transitions){e.removeClass("fade-trigger");e.one(a.fade.transitionend,function(){if(e.hasClass("fade-trigger")){return}e.hide();g()})}else{e.fadeOut(f,g)}return e},transitions:(function(){var e=document.documentElement.style;return(typeof(e.WebkitTransition)=="string"||typeof(e.MozTransition)=="string"||typeof(e.OTransition)=="string"||typeof(e.transition)=="string")})()}})(jQuery);
|
||||
var PubSub,fullscreen,wptitlehint;PubSub=function(){this.topics={}};PubSub.prototype.subscribe=function(a,b){if(!this.topics[a]){this.topics[a]=[]}this.topics[a].push(b);return b};PubSub.prototype.unsubscribe=function(b,e){var c,a,d=this.topics[b];if(!d){return e||[]}if(e){for(c=0,a=d.length;c<a;c++){if(e==d[c]){d.splice(c,1)}}return e}else{this.topics[b]=[];return d}};PubSub.prototype.publish=function(c,b){var d,a,e=this.topics[c];if(!e){return}b=b||[];for(d=0,a=e.length;d<a;d++){e[d].apply(null,b)}};(function(b){var a,d,c;fullscreen=a={};d=a.pubsub=new PubSub();a.timer=0;a.block=false;c=function(h,g,f){f=f||1250;if(a.block){return}a.block=true;setTimeout(function(){a.block=false},500);if(a.timer){clearTimeout(a.timer)}else{d.publish(h)}function e(){d.publish(g);a.timer=0}a.timer=setTimeout(e,f)};a.on=function(){if(!a.ui.element){a.ui.init()}if(!a.visible){a.ui.fade("show","showing","shown")}};a.off=function(){if(a.ui.element&&a.visible){a.ui.fade("hide","hiding","hidden")}};a.save=function(){b("#title").val(b("#wp-fullscreen-title").val());tinyMCE.execCommand("wpFullScreenSaveContent");b("#hiddenaction").val("wp-fullscreen-save-post");b.post(ajaxurl,b("form#post").serialize(),function(e){if(e.message){b("#wp-fullscreen-saved").html(e.message)}if(e.last_edited){b("#wp-fullscreen-last-edit").html(e.last_edited)}},"json")};set_title_hint=function(e){if(!e.val().length){e.siblings("label").css("visibility","")}else{e.siblings("label").css("visibility","hidden")}};d.subscribe("showToolbar",function(){a.fade.In(a.ui.topbar,600);b("#wp-fullscreen-body").addClass("wp-fullscreen-focus")});d.subscribe("hideToolbar",function(){a.fade.Out(a.ui.topbar,600);b("#wp-fullscreen-body").removeClass("wp-fullscreen-focus")});d.subscribe("show",function(){var e=b("#wp-fullscreen-title").val(b("#title").val());this.set_title_hint(e);b(document).bind("mousemove.fullscreen",function(f){c("showToolbar","hideToolbar",3000)})});d.subscribe("hide",function(){var e=b("#title").val(b("#wp-fullscreen-title").val());this.set_title_hint(e);tinyMCE.execCommand("wpFullScreenSave");b(document).unbind(".fullscreen")});d.subscribe("showing",function(){b("#wp-fullscreen-body").show();b(document.body).addClass("fullscreen-active");c("showToolbar","hideToolbar",3000);b("#wp-fullscreen-last-edit").html(b("#last-edit").html())});d.subscribe("hiding",function(){b("#wp-fullscreen-body").hide();b(document.body).removeClass("fullscreen-active");b("#last-edit").html(b("#wp-fullscreen-last-edit").html())});d.subscribe("shown",function(){a.visible=true});d.subscribe("hidden",function(){a.visible=false;b("#wp_mce_fullscreen").removeAttr("style");tinyMCE.execCommand("wpFullScreenClose")});a.b=function(){tinyMCE.execCommand("Bold")};a.i=function(){tinyMCE.execCommand("Italic")};a.ul=function(){tinyMCE.execCommand("InsertUnorderedList")};a.ol=function(){tinyMCE.execCommand("InsertOrderedList")};a.link=function(){tinyMCE.execCommand("WP_Link")};a.unlink=function(){tinyMCE.execCommand("unlink")};a.ui={init:function(){a.ui.element=b("#fullscreen-fader");a.ui.topbar=b("#fullscreen-topbar");if(wptitlehint){wptitlehint("wp-fullscreen-title")}},fade:function(f,e,g){if(f){d.publish(f)}a.fade.In(a.ui.element,600,function(){if(e){d.publish(e)}a.fade.Out(a.ui.element,600,function(){if(g){d.publish(g)}})})}};a.fade={transitionend:"transitionend webkitTransitionEnd oTransitionEnd",sensitivity:100,In:function(e,f,g){g=g||b.noop;f=f||400;if(a.fade.transitions){if(e.is(":visible")){e.addClass("fade-trigger");return e}e.show();e.one(this.transitionend,function(){g()});setTimeout(function(){e.addClass("fade-trigger")},this.sensitivity)}else{e.css("opacity",1).fadeIn(f,g)}return e},Out:function(e,f,g){g=g||b.noop;f=f||400;if(!e.is(":visible")){return e}if(a.fade.transitions){e.one(a.fade.transitionend,function(){if(e.hasClass("fade-trigger")){return}e.hide();g()});setTimeout(function(){e.removeClass("fade-trigger")},this.sensitivity)}else{e.fadeOut(f,g)}return e},transitions:(function(){var e=document.documentElement.style;return(typeof(e.WebkitTransition)=="string"||typeof(e.MozTransition)=="string"||typeof(e.OTransition)=="string"||typeof(e.transition)=="string")})()}})(jQuery);
|
|
@ -1,4 +1,4 @@
|
|||
var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true, blockSave = false, wp_fullscreen_enabled;
|
||||
var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true, blockSave = false, fullscreen;
|
||||
|
||||
jQuery(document).ready( function($) {
|
||||
var dotabkey = true;
|
||||
|
@ -34,7 +34,7 @@ jQuery(document).ready( function($) {
|
|||
if ( mce.isDirty() )
|
||||
return autosaveL10n.saveAlert;
|
||||
} else {
|
||||
if ( wp_fullscreen_enabled ) {
|
||||
if ( fullscreen && fullscreen.visible ) {
|
||||
title = $('#wp-fullscreen-title').val();
|
||||
content = $("#wp_mce_fullscreen").val();
|
||||
} else {
|
||||
|
@ -165,7 +165,7 @@ function autosave_update_slug(post_id) {
|
|||
jQuery.post( ajaxurl, {
|
||||
action: 'sample-permalink',
|
||||
post_id: post_id,
|
||||
new_title: wp_fullscreen_enabled ? jQuery('#wp-fullscreen-title').val() : jQuery('#title').val(),
|
||||
new_title: fullscreen && fullscreen.visible ? jQuery('#wp-fullscreen-title').val() : jQuery('#title').val(),
|
||||
samplepermalinknonce: jQuery('#samplepermalinknonce').val()
|
||||
},
|
||||
function(data) {
|
||||
|
@ -245,7 +245,7 @@ autosave = function() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( wp_fullscreen_enabled ) {
|
||||
if ( fullscreen && fullscreen.visible ) {
|
||||
post_data["post_title"] = jQuery('#wp-fullscreen-title').val();
|
||||
post_data["content"] = jQuery("#wp_mce_fullscreen").val();
|
||||
} else {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -94,7 +94,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110411' );
|
||||
$scripts->add_data( 'editor', 'group', 1 );
|
||||
|
||||
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110424' );
|
||||
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110425' );
|
||||
$scripts->add_data( 'wp-fullscreen', 'group', 1 );
|
||||
|
||||
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');
|
||||
|
@ -107,7 +107,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
|
||||
) );
|
||||
|
||||
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20110424' );
|
||||
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20110425' );
|
||||
$scripts->add_data( 'autosave', 'group', 1 );
|
||||
|
||||
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20101222' );
|
||||
|
|
Loading…
Reference in New Issue