jenkins-bot has submitted this change and it was merged. Change subject: RL: Fixed tooltips and minor RL tweaks ......................................................................
RL: Fixed tooltips and minor RL tweaks * Fixed a coding error where mw.using was called instead of mw.loader.using * Removed RL module 'adds' of non existing modules * Did little refactoring with file names to unify strucutre PatchSet 2: * Implemented comments by mglaser Change-Id: I345bf35a189df1e7f7287e89c14db20f8aa82935 --- M includes/CoreHooks.php M resources/Resources.php A resources/bluespice/bluespice.tooltip.js D resources/bluespice/bs.tools.js 4 files changed, 36 insertions(+), 26 deletions(-) Approvals: Mglaser: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/CoreHooks.php b/includes/CoreHooks.php index 43f4e2e..929987f 100755 --- a/includes/CoreHooks.php +++ b/includes/CoreHooks.php @@ -76,9 +76,8 @@ "/BlueSpiceFoundation/resources/icomoon/icomoon.icons.ie7.js\"></script>\n<![endif]-->\n" ); - $out->addModuleScripts( 'ext.bluespice.scripts' ); + $out->addModules( 'ext.bluespice' ); $out->addModuleStyles( 'ext.bluespice.styles' ); - $out->addModuleMessages( 'ext.bluespice.messages' ); $out->addModuleStyles( 'ext.bluespice.compat.vector.styles' ); $wgFavicon = BsConfig::get( 'MW::FaviconPath' ); diff --git a/resources/Resources.php b/resources/Resources.php index a0adf91..853f52c 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -7,20 +7,19 @@ $aResourceModuleTemplate = array( 'localBasePath' => $IP . '/extensions/BlueSpiceFoundation/resources', 'remoteExtPath' => 'BlueSpiceFoundation/resources', - 'group' => 'ext.bluespice', 'targets' => array( 'mobile', 'desktop' ) ); $wgResourceModules['ext.bluespice'] = array( 'scripts' => array( - 'bluespice/bs.tools.js', 'bluespice/bluespice.js', 'bluespice/bluespice.extensionManager.js', 'bluespice/bluespice.util.js', 'bluespice/bluespice.wikiText.js', 'bluespice/bluespice.string.js', 'bluespice/bluespice.xhr.js', - 'bluespice/bluespice.ping.js' + 'bluespice/bluespice.ping.js', + 'bluespice/bluespice.tooltip.js' ), 'messages' => array( 'largefileserver', diff --git a/resources/bluespice/bluespice.tooltip.js b/resources/bluespice/bluespice.tooltip.js new file mode 100644 index 0000000..2d94396 --- /dev/null +++ b/resources/bluespice/bluespice.tooltip.js @@ -0,0 +1,33 @@ +(function( mw, $, bs, d, undefined ){ + + //We only want the code to run (and therefore the resources to be loaded) + //when a user actually hovers an appropriate element! + $(d).on( 'mouseover', '.bs-tooltip-link', function(){ + var conf = { + target: this, + title: $(this).data('bs-tt-title') || ' ', + html: $(this).data('bs-tt-html') || '', + contentEl: $(this).data('bs-tt-target') || document, + anchor: $(this).data('bs-tt-anchor') || 'top', + autoHide: $(this).data('bs-tt-autohide') || false, + maxHeight: $(this).data('bs-tt-maxheight'), + minWidth: $(this).data('bs-tt-maxheight') || 100, + overflowX: 'auto', + overflowY: 'auto' + }; + + var me = this; + //Make sure there is only one instance of the tooltip build from the data + //attributes of this particular element. Otherwise everytime a user hovers + //the element a new tooltip instance (with all the associated DOM elements) + //would be created. + if( !me.bsToolTip ) { + mw.loader.using( 'ext.bluespice.extjs' ).done(function() { + me.bsToolTip = Ext.create( 'Ext.tip.ToolTip', conf ); + me.bsToolTip.show(); //We need to show the tooltip manually at + //the time we create it, because Ext.tip.Tooltip does not + //recognize the mouseover event it got created in. + }); + } + }); +})( mediaWiki, jQuery, blueSpice, document ); diff --git a/resources/bluespice/bs.tools.js b/resources/bluespice/bs.tools.js deleted file mode 100644 index bc17c7f..0000000 --- a/resources/bluespice/bs.tools.js +++ /dev/null @@ -1,21 +0,0 @@ -$(function(){ - $('.bs-tooltip-link').each(function(){ - - var conf = { - target: this, - title: $(this).data('bs-tt-title') || ' ', - html: $(this).data('bs-tt-html') || '', - contentEl: $(this).data('bs-tt-target') || document, - anchor: $(this).data('bs-tt-anchor') || 'top', - autoHide: $(this).data('bs-tt-autohide') || false, - maxHeight: $(this).data('bs-tt-maxheight'), - minWidth: $(this).data('bs-tt-maxheight') || 100, - overflowX: 'auto', - overflowY: 'auto' - }; - - mw.using( 'ext.bluespice.extjs' ).done(function() { - Ext.create( 'Ext.tip.ToolTip', conf ); - }); - }); -}); \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/251504 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I345bf35a189df1e7f7287e89c14db20f8aa82935 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation Gerrit-Branch: master Gerrit-Owner: Robert Vogel <vo...@hallowelt.biz> Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz> Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits