From 090e191b23a9c89261e9bd9cb1c0c400b5123727 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Sun, 24 Oct 2010 19:32:11 +0000 Subject: [PATCH] added support for standard, cologneblue, nostalgia in mw.util.addPortletLink + updated the test suite --- resources/mediawiki/mediawiki.util.js | 126 +++++++++++++--------- resources/mediawiki/mediawiki.utiltest.js | 34 ++++-- 2 files changed, 100 insertions(+), 60 deletions(-) diff --git a/resources/mediawiki/mediawiki.util.js b/resources/mediawiki/mediawiki.util.js index 28025c0b9d..f7a67742c2 100644 --- a/resources/mediawiki/mediawiki.util.js +++ b/resources/mediawiki/mediawiki.util.js @@ -12,7 +12,6 @@ if (this.initialised === false) { this.initialised = true; - // Set tooltipAccessKeyPrefix if (is_opera) { this.tooltipAccessKeyPrefix = 'shift-esc-'; @@ -52,7 +51,18 @@ // Any initialisation after the DOM is ready $(function () { + + // Enable CheckboxShiftClick $('input[type=checkbox]:not(.noshiftselect)').enableCheckboxShiftClick(); + + // Fill bodyContant var + if ($('#bodyContent').length) { + mw.util.$content = $('#bodyContent'); + } else if ($('#article').length) { + mw.util.$content = $('#article'); + } else { + mw.util.$content = $('#content'); + } }); @@ -200,6 +210,10 @@ } }); }, + + // jQuery object that refers to the page-content element + // Populated by init() + '$content' : null, /** @@ -223,60 +237,74 @@ * @param String accesskey accesskey to activate this link (one character, try to avoid conflicts. Use $('[accesskey=x').get() in the console to see if 'x' is already used. * @param mixed nextnode DOM node or jQuery-selector of the item that the new item should be added before, should be another item in the same list will be ignored if not the so * - * @return Node the DOM node of the new item (a LI element) or null + * @return Node the DOM node of the new item (a LI element, or A element for older skins) or null */ 'addPortletLink' : function (portlet, href, text, id, tooltip, accesskey, nextnode) { - var $portlet = $('#' + portlet); - if ($portlet.length === 0) { - return null; - } - var $ul = $portlet.find('ul').eq(0); - if ($ul.length === 0) { - if ($portlet.find('div').length === 0) { - $portlet.append('