From 66ff7025610ae596e8eb3dc03657f7b9cd10d00c Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Sun, 6 Oct 2013 22:09:33 +0200 Subject: [PATCH] mw.ViewPageTarget: Fix broken firstHeading transition Class ve-init-mw-viewPageTarget-pageTitle added various transition settings that were never used. Meanwhile, we're doing fadeTo which sets inline opacity css every X ms until the animation is finished. * Changed the inline jQuery animation to use css transitions instead. * Removed the inexistent and obsolete ms-transition declaration. * Removed ":visible" from selector query. This makes the selector more performant (since :visible is a proprietary Sizzle keyword) and it was obsolete anyway. The classes don't affect display none/hide, this is handled naturally by the browser now. Change-Id: Ibdfb442ff6c743ef16b514a7696796ee27821887 --- .../init/styles/ve.init.mw.ViewPageTarget.css | 14 ++++++++++++-- .../init/targets/ve.init.mw.ViewPageTarget.js | 11 ++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css index 88e8152798..d40c1c5c79 100644 --- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css +++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget.css @@ -7,12 +7,22 @@ /* VisualEditor */ -.ve-init-mw-viewPageTarget-pageTitle { +.ve-init-mw-viewPageTarget-transform { -webkit-transition: opacity 200ms ease-out; -moz-transition: opacity 200ms ease-out; - -ms-transition: opacity 200ms ease-out; -o-transition: opacity 200ms ease-out; transition: opacity 200ms ease-out; +} + +.ve-init-mw-viewPageTarget-transform-muted { + opacity: 0.6; +} + +.ve-init-mw-viewPageTarget-transform-hidden { + opacity: 0; +} + +.ve-init-mw-viewPageTarget-pageTitle { cursor: default; } diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js index 1ed3dad9f4..866d972cc8 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js @@ -1893,8 +1893,10 @@ ve.init.mw.ViewPageTarget.prototype.transformPageTitle = function () { * @method */ ve.init.mw.ViewPageTarget.prototype.mutePageTitle = function () { - $( '#firstHeading, #siteSub:visible' ).fadeTo( 'fast', 0.6 ); - $( '#contentSub:visible' ).fadeTo( 'fast', 0 ); + $( '#firstHeading, #siteSub' ) + .addClass( 've-init-mw-viewPageTarget-transform ve-init-mw-viewPageTarget-transform-muted' ); + $( '#contentSub' ) + .addClass( 've-init-mw-viewPageTarget-transform ve-init-mw-viewPageTarget-transform-hidden' ); }; /** @@ -1903,8 +1905,11 @@ ve.init.mw.ViewPageTarget.prototype.mutePageTitle = function () { * @method */ ve.init.mw.ViewPageTarget.prototype.restorePageTitle = function () { - $( '#firstHeading, #siteSub:visible, #contentSub:visible' ).fadeTo( 'fast', 1 ); + var $els = $( '#firstHeading, #siteSub, #contentSub' ) + .removeClass( 've-init-mw-viewPageTarget-transform-muted ve-init-mw-viewPageTarget-transform-hidden' ); + setTimeout( function () { + $els.removeClass( 've-init-mw-viewPageTarget-transform' ); $( '#firstHeading' ).removeClass( 've-init-mw-viewPageTarget-pageTitle' ); }, 1000 ); };