Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/67640
Change subject: Hide sidebar while using the translation tool ...................................................................... Hide sidebar while using the translation tool Bug: 45836 Change-Id: I5019569f395e1e8211ae6cc9f6a3a4019076be2b --- M Resources.php A resources/css/ext.translate.navitoggle.css A resources/js/ext.translate.navitoggle.js 3 files changed, 119 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/40/67640/1 diff --git a/Resources.php b/Resources.php index 980a3fa..70ee5a7 100644 --- a/Resources.php +++ b/Resources.php @@ -225,6 +225,15 @@ 'position' => 'top', ) + $resourcePaths; +$wgResourceModules['ext.translate.navitoggle'] = array( + 'skinScripts' => array( + 'vector' => 'resources/js/ext.translate.navitoggle.js', + ), + 'skinStyles' => array( + 'vector' => 'resources/css/ext.translate.navitoggle.css', + ), +) + $resourcePaths; + $wgResourceModules['ext.translate.quickedit'] = array( 'scripts' => 'resources/js/ext.translate.quickedit.js', 'styles' => 'resources/css/ext.translate.quickedit.css', @@ -317,6 +326,7 @@ 'ext.translate.base', 'ext.translate.groupselector', 'ext.translate.messagetable', + 'ext.translate.navitoggle', 'ext.translate.workflowselector', 'ext.uls.init', ), diff --git a/resources/css/ext.translate.navitoggle.css b/resources/css/ext.translate.navitoggle.css new file mode 100644 index 0000000..d30d73c --- /dev/null +++ b/resources/css/ext.translate.navitoggle.css @@ -0,0 +1,62 @@ +/** + * Introduces a toggle icon than can be used to hide navigation menu in vector + * @author Niklas Laxström + * @license GPL2+ + */ + +.tux-navitoggle { + height: 40px; + width: 20px; + position: absolute; + top: 0px; +} + +.tux-navitoggle { + /* @embed */ + background: url('../images/expand-rtl.png') no-repeat scroll right center transparent; + background-image: -webkit-linear-gradient(transparent, transparent), url(../images/expand-rtl.png); + background-image: linear-gradient(transparent, transparent), url(../images/expand-rtl.png); +} + +.tux-navi-collapsed .tux-navitoggle { + /* @embed */ + background: url('../images/expand-ltr.png') no-repeat scroll right center transparent; + background-image: -webkit-linear-gradient(transparent, transparent), url(../images/expand-ltr.png); + background-image: linear-gradient(transparent, transparent), url(../images/expand-ltr.png); +} + +.tux-navi-collapsed #mw-panel { + display: none; +} + +.tux-navi-collapsed #content { + margin-left: 0; +} + +.tux-navi-collapsed #left-navigation { + left: 0; +} + +.tux-navi-collapsed .tux-navitoggle { + left: 40px !important; +} + +.tux-navi-minilogo { + display: none; + position: absolute; + top: 0; + left: 0; +} + +.tux-navi-collapsed .tux-navi-minilogo { + display: block; +} + +.tux-navi-minilogo a { + width: 40px; + height: 40px; + background-size: 30px; + display: block; + background-repeat: no-repeat; + background-position: center center; +} diff --git a/resources/js/ext.translate.navitoggle.js b/resources/js/ext.translate.navitoggle.js new file mode 100644 index 0000000..7441f74 --- /dev/null +++ b/resources/js/ext.translate.navitoggle.js @@ -0,0 +1,47 @@ +/** + * Introduces a toggle icon than can be used to hide navigation menu in vector + * @author Niklas Laxström + * @license GPL2+ + */ +(function( mw, $ ) { + 'use strict'; + + var delay = ( function () { + var timer = 0; + + return function ( callback, milliseconds ) { + clearTimeout( timer ); + timer = setTimeout( callback, milliseconds ); + }; + } () ); + + $( document ).ready( function () { + var $miniLogo, $toggle, rtl, delim, + $body = $( 'body' ); + + rtl = $body.hasClass( 'rtl' ); + delim = rtl ? + $( "#mw-head-base" ).css( 'margin-right' ) : + $( "#mw-head-base" ).css( 'margin-left' ); + + $miniLogo = $( '#p-logo' ) + .clone() + .removeAttr( 'id' ) + .addClass( 'tux-navi-minilogo' ); + + $toggle = $( '<div>' ) + .addClass( 'tux-navitoggle' ) + .css( rtl ? 'right' : 'left' , delim ) + .click( function () { + $body.toggleClass( 'tux-navi-collapsed' ); + // Allow for animations etc to go + delay( function () { + $( window ).trigger( 'resize' ); + $( window ).trigger( 'scroll' ); + }, 250 ); + } ); + + $( 'body' ).append( $miniLogo, $toggle ); + + } ); +}( mediaWiki, jQuery )) -- To view, visit https://gerrit.wikimedia.org/r/67640 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5019569f395e1e8211ae6cc9f6a3a4019076be2b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits