WordPress.org

Make WordPress Core

Changeset 17703


Ignore:
Timestamp:
04/26/2011 07:20:56 AM (7 years ago)
Author:
azaozz
Message:

Don't hide the top bar when the cursor is over it, see #17136

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/js/wp-fullscreen.dev.js

    r17702 r17703  
    8080        setTimeout( function() {
    8181            api.block = false;
    82         }, 500 );
     82        }, 400 );
    8383
    8484        if ( api.timer )
     
    137137    }
    138138
     139    api._make_sticky = function() {
     140        $( document ).unbind( '.fullscreen' );
     141        clearTimeout( api.timer );
     142        api.timer = 0;
     143    }
     144
    139145    ps.subscribe( 'showToolbar', function() {
    140         api.fade.In( api.ui.topbar, 600 );
     146        api.fade.In( api.ui.topbar, 600, function(){ ps.publish('toolbarShown'); } );
    141147        $('#wp-fullscreen-body').addClass('wp-fullscreen-focus');
    142148    });
    143149
    144150    ps.subscribe( 'hideToolbar', function() {
    145         api.fade.Out( api.ui.topbar, 600 );
     151        api.fade.Out( api.ui.topbar, 600, function(){ ps.publish('toolbarHidden'); } );
    146152        $('#wp-fullscreen-body').removeClass('wp-fullscreen-focus');
     153        api.toolbarShown = false;
     154    });
     155
     156    ps.subscribe( 'toolbarShown', function() {
     157        api.topbarshown = true;
     158        if ( api.mouseisover )
     159            api._make_sticky();
     160    });
     161
     162    ps.subscribe( 'toolbarHidden', function() {
     163        $( document ).unbind( '.fullscreen2' )
     164            .bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 2500 ); } );
    147165    });
    148166
     
    150168        var title = $('#wp-fullscreen-title').val( $('#title').val() );
    151169        this.set_title_hint(title);
    152         $( document ).bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 3000 ); } );
     170        $( document ).bind( 'mousemove.fullscreen', function(e) { bounder( 'showToolbar', 'hideToolbar', 2500 ); } );
    153171    });
    154172
     
    220238
    221239        init: function() {
     240            var topbar = api.ui.topbar  = $('#fullscreen-topbar');
    222241            api.ui.element = $('#fullscreen-fader');
    223             api.ui.topbar  = $('#fullscreen-topbar');
    224242
    225243            if ( wptitlehint )
    226244                wptitlehint('wp-fullscreen-title');
     245
     246            topbar.mouseenter(function(e){
     247                api.mouseisover = true;
     248                if ( api.topbarshown )
     249                    api._make_sticky();
     250            }).mouseleave(function(e){
     251                api.mouseisover = false;
     252                $( document ).bind( 'mousemove.fullscreen2', function(e) { bounder( 'showToolbar', 'hideToolbar', 600 ); } );
     253            });
    227254        },
    228255
  • trunk/wp-admin/js/wp-fullscreen.js

    r17702 r17703  
    1 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);
     1var 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},400);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")}};a._make_sticky=function(){b(document).unbind(".fullscreen");clearTimeout(a.timer);a.timer=0};d.subscribe("showToolbar",function(){a.fade.In(a.ui.topbar,600,function(){d.publish("toolbarShown")});b("#wp-fullscreen-body").addClass("wp-fullscreen-focus")});d.subscribe("hideToolbar",function(){a.fade.Out(a.ui.topbar,600,function(){d.publish("toolbarHidden")});b("#wp-fullscreen-body").removeClass("wp-fullscreen-focus");a.toolbarShown=false});d.subscribe("toolbarShown",function(){a.topbarshown=true;if(a.mouseisover){a._make_sticky()}});d.subscribe("toolbarHidden",function(){b(document).unbind(".fullscreen2").bind("mousemove.fullscreen",function(f){c("showToolbar","hideToolbar",2500)})});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",2500)})});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(){var e=a.ui.topbar=b("#fullscreen-topbar");a.ui.element=b("#fullscreen-fader");if(wptitlehint){wptitlehint("wp-fullscreen-title")}e.mouseenter(function(f){a.mouseisover=true;if(a.topbarshown){a._make_sticky()}}).mouseleave(function(f){a.mouseisover=false;b(document).bind("mousemove.fullscreen2",function(g){c("showToolbar","hideToolbar",600)})})},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);
  • trunk/wp-includes/script-loader.php

    r17702 r17703  
    9595    $scripts->add_data( 'editor', 'group', 1 );
    9696   
    97     $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110425' );
     97    $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110425a' );
    9898    $scripts->add_data( 'wp-fullscreen', 'group', 1 );
    9999
Note: See TracChangeset for help on using the changeset viewer.