aboutsummaryrefslogtreecommitdiffstats
path: root/resources/mediawiki/mediawiki.util.js
Commit message (Collapse)AuthorAgeFilesLines
* Split /resources into /resources/lib and /resources/srcJames D. Forrester2014-04-071-601/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, MediaWiki has a mess of resources, some but not all of which are upstream libraries. This means that occasionally people will attempt to make local modifications of the libraries by accident, or deliberately but do not flag it, making dependency management a challenge (and fixing upstream-related bugs a headache). Instead, we now split the /resources directory into a /resources/lib directory for those items which are used purely as intact upstream libraries, and a /resources/src directroy for those which are either local libraries written for MediaWiki and mastered here, or downstream forks of upstream libraries which require particular care and attention when being upgraded. Also, some incidental files which are not to be loaded as part of a module have been moved to better locations. Upstream libaries * jquery resources/jquery/jquery.js * jquery.appear resources/jquery/jquery.appear.js * jquery.async resources/jquery/jquery.async.js * jquery.chosen resources/jquery.chosen/* * jquery.cookie resources/jquery/jquery.cookie.js * jquery.form resources/jquery/jquery.form.js * jquery.fullscreen.js resources/jquery/jquery.fullscreen.js * jquery.hoverIntent resources/jquery/jquery.hoverIntent.js * jquery.json resources/jquery/jquery.json.js * jquery.mockjax resources/jquery/jquery.mockjax.js * jquery.qunit resources/jquery/jquery.qunit.css resources/jquery/jquery.qunit.js * jquery.jStorage resources/jquery/jquery.jStorage.js * jquery.throttle-debounce resources/jquery/jquery.ba-throttle-debounce.js * jquery.validate resources/jquery/jquery.validate.js * jquery.xmldom resources/jquery/jquery.xmldom.js * moment resources/moment/* * OOjs resource/oojs/* * OOjs UI resources/oojs-ui/* * jquery.ui.* resources/jquery.ui/* resources/jquery.ui/themes/default moved to resources/lib/jquery.ui/themes/ resources/jquery.ui/themes/vector moved to resources/src/jquery.ui-themes/ * jquery.effects.* resources/jquery.effects/* * sinon resources/sinonjs/* Upstream libraries forked for MediaWiki * jquery.color resources/jquery/jquery.color.js * jquery.tipsy resources/jquery.tipsy/* Local libraries * jquery.arrowSteps resources/jquery/jquery.arrowSteps.css resources/jquery/jquery.arrowSteps.js resources/jquery/images/jquery.arrowSteps.divider-ltr.png resources/jquery/images/jquery.arrowSteps.divider-rtl.png resources/jquery/images/jquery.arrowSteps.head-ltr.png resources/jquery/images/jquery.arrowSteps.head-rtl.png resources/jquery/images/jquery.arrowSteps.tail-ltr.png resources/jquery/images/jquery.arrowSteps.tail-rtl.png * jquery.autoEllipsis resources/jquery/jquery.autoEllipsis.js * jquery.badge resources/jquery/jquery.badge.css resources/jquery/jquery.badge.js * jquery.byteLength resources/jquery/jquery.byteLength.js * jquery.byteLimit resources/jquery/jquery.byteLimit.js * jquery.checkboxShiftClick resources/jquery/jquery.checkboxShiftClick.js * jquery.client resources/jquery/jquery.client.js * jquery.colorUtil resources/jquery/jquery.colorUtil.js * jquery.delayedBind resources/jquery/jquery.delayedBind.js * jquery.expandableField resources/jquery/jquery.expandableField.js * jquery.farbtastic resources/jquery/jquery.farbtastic.css resources/jquery/jquery.farbtastic.js resources/jquery/images/marker.png resources/jquery/images/mask.png resources/jquery/images/wheel.png * jquery.footHovzer resources/jquery/jquery.footHovzer.css resources/jquery/jquery.footHovzer.js * jquery.getAttrs resources/jquery/jquery.getAttrs.js * jquery.hidpi resources/jquery/jquery.hidpi.js * jquery.highlightText resources/jquery/jquery.highlightText.js * jquery.localize resources/jquery/jquery.localize.js * jquery.makeCollapsible resources/jquery/jquery.makeCollapsible.css resources/jquery/jquery.makeCollapsible.js * jquery.mw-jump resources/jquery/jquery.mw-jump.js * jquery.mwExtension resources/jquery/jquery.mwExtension.js * jquery.placeholder resources/jquery/jquery.placeholder.js * jquery.spinner resources/jquery/jquery.spinner.css resources/jquery/jquery.spinner.js resources/jquery/images/spinner-large.gif resources/jquery/images/spinner.gif * jquery.suggestions resources/jquery/jquery.suggestions.css resources/jquery/jquery.suggestions.js * jquery.tabIndex resources/jquery/jquery.tabIndex.js * jquery.tablesorter resources/jquery/jquery.tablesorter.css resources/jquery/jquery.tablesorter.js resources/jquery/images/sort_both.gif resources/jquery/images/sort_down.gif resources/jquery/images/sort_none.gif resources/jquery/images/sort_up.gif * jquery.textSelection resources/jquery/jquery.textSelection.js * jquery.qunit.completenessTest resources/jquery/jquery.qunit.completenessTest.js * mediawiki resources/mediawiki/mediawiki.js resources/mediawiki/mediawiki.log.js * mediawiki.api resources/mediawiki.api/mediawiki.api.js * mediawiki.api.category resources/mediawiki.api/mediawiki.api.category.js * mediawiki.api.edit resources/mediawiki.api/mediawiki.api.edit.js * mediawiki.api.login resources/mediawiki.api/mediawiki.api.login.js * mediawiki.api.parse resources/mediawiki.api/mediawiki.api.parse.js * mediawiki.api.watch resources/mediawiki.api/mediawiki.api.watch.js * mediawiki.debug resources/mediawiki/mediawiki.debug.js resources/mediawiki/mediawiki.debug.less resources/mediawiki/mediawiki.debug.profile.css resources/mediawiki/mediawiki.debug.profile.js * mediawiki.debug.init resources/mediawiki/mediawiki.debug.init.js * mediawiki.feedback resources/mediawiki/mediawiki.feedback.css resources/mediawiki/mediawiki.feedback.js resources/mediawiki/mediawiki.feedback.spinner.gif * mediawiki.hidpi resources/mediawiki/mediawiki.hidpi.js * mediawiki.hlist resources/mediawiki/mediawiki.hlist.css resources/mediawiki/mediawiki.hlist.js * mediawiki.htmlform resources/mediawiki/mediawiki.htmlform.js * mediawiki.icon resources/mediawiki/mediawiki.icon.less resources/mediawiki/images/arrow-collapsed-ltr.png resources/mediawiki/images/arrow-collapsed-ltr.svg resources/mediawiki/images/arrow-collapsed-rtl.png resources/mediawiki/images/arrow-collapsed-rtl.svg resources/mediawiki/images/arrow-expanded.png resources/mediawiki/images/arrow-expanded.svg * mediawiki.inspect resources/mediawiki/mediawiki.inspect.js * mediawiki.notification resources/mediawiki/mediawiki.notification.css resources/mediawiki/mediawiki.notification.hideForPrint.css resources/mediawiki/mediawiki.notification.js * mediawiki.notify resources/mediawiki/mediawiki.notify.js * mediawiki.searchSuggest resources/mediawiki/mediawiki.searchSuggest.css resources/mediawiki/mediawiki.searchSuggest.js * mediawiki.Title resources/mediawiki/mediawiki.Title.js * mediawiki.toc resources/mediawiki/mediawiki.toc.js * mediawiki.Uri resources/mediawiki/mediawiki.Uri.js * mediawiki.user resources/mediawiki/mediawiki.user.js * mediawiki.util resources/mediawiki/mediawiki.util.js * mediawiki.action.edit resources/mediawiki.action/mediawiki.action.edit.js * mediawiki.action.edit.styles resources/mediawiki.action/mediawiki.action.edit.styles.css * mediawiki.action.edit.collapsibleFooter resources/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css resources/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js * mediawiki.action.edit.preview resources/mediawiki.action/mediawiki.action.edit.preview.js * mediawiki.action.history resources/mediawiki.action/mediawiki.action.history.js * mediawiki.action.history.diff resources/mediawiki.action/mediawiki.action.history.diff.css * mediawiki.action.view.dblClickEdit resources/mediawiki.action/mediawiki.action.view.dblClickEdit.js * mediawiki.action.view.metadata resources/mediawiki.action/mediawiki.action.view.metadata.js * mediawiki.action.view.postEdit resources/mediawiki.action/mediawiki.action.view.postEdit.css resources/mediawiki.action/mediawiki.action.view.postEdit.js resources/mediawiki.action/images/green-checkmark.png * mediawiki.action.view.redirectToFragment resources/mediawiki.action/mediawiki.action.view.redirectToFragment.js * mediawiki.action.view.rightClickEdit resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js * mediawiki.action.edit.editWarning resources/mediawiki.action/mediawiki.action.edit.editWarning.js * mediawiki.action.watch.ajax No files associated with this resource. * mediawiki.language resources/mediawiki.language/mediawiki.language.js resources/mediawiki.language/mediawiki.language.numbers.js resources/mediawiki.language/languages/bs.js resources/mediawiki.language/languages/dsb.js resources/mediawiki.language/languages/fi.js resources/mediawiki.language/languages/ga.js resources/mediawiki.language/languages/he.js resources/mediawiki.language/languages/hsb.js resources/mediawiki.language/languages/hu.js resources/mediawiki.language/languages/hy.js resources/mediawiki.language/languages/la.js resources/mediawiki.language/languages/os.js resources/mediawiki.language/languages/ru.js resources/mediawiki.language/languages/sl.js resources/mediawiki.language/languages/uk.js * mediawiki.cldr resources/mediawiki.language/mediawiki.cldr.js * mediawiki.libs.pluralruleparser Possibly should be moved to /lib resources/mediawiki.libs/CLDRPluralRuleParser.js * mediawiki.language.init resources/mediawiki.language/mediawiki.language.init.js * mediawiki.jqueryMsg resources/mediawiki/mediawiki.jqueryMsg.js resources/mediawiki/mediawiki.jqueryMsg.peg * mediawiki.language.months resources/mediawiki.language/mediawiki.language.months.js * mediawiki.libs.jpegmeta resources/mediawiki.libs/mediawiki.libs.jpegmeta.js * mediawiki.page.gallery resources/mediawiki.page/mediawiki.page.gallery.js * mediawiki.page.ready resources/mediawiki.page/mediawiki.page.ready.js * mediawiki.page.startup resources/mediawiki.page/mediawiki.page.startup.js * mediawiki.page.patrol.ajax resources/mediawiki.page/mediawiki.page.patrol.ajax.js * mediawiki.page.watch.ajax resources/mediawiki.page/mediawiki.page.watch.ajax.js * mediawiki.page.image.pagination resources/mediawiki.page/mediawiki.page.image.pagination.js * mediawiki.special resources/mediawiki.special/mediawiki.special.css resources/mediawiki.special/mediawiki.special.js * mediawiki.special.block resources/mediawiki.special/mediawiki.special.block.css resources/mediawiki.special/mediawiki.special.block.js * mediawiki.special.changeemail resources/mediawiki.special/mediawiki.special.changeemail.css resources/mediawiki.special/mediawiki.special.changeemail.js * mediawiki.special.changeslist resources/mediawiki.special/mediawiki.special.changeslist.css * mediawiki.special.changeslist.legend resources/mediawiki.special/mediawiki.special.changeslist.legend.css * mediawiki.special.changeslist.legend.js resources/mediawiki.special/mediawiki.special.changeslist.legend.js * mediawiki.special.changeslist.enhanced resources/mediawiki.special/mediawiki.special.changeslist.enhanced.css * mediawiki.special.movePage resources/mediawiki.special/mediawiki.special.movePage.js * mediawiki.special.pagesWithProp resources/mediawiki.special/mediawiki.special.pagesWithProp.css * mediawiki.special.preferences resources/mediawiki.special/mediawiki.special.preferences.css resources/mediawiki.special/mediawiki.special.preferences.js * mediawiki.special.recentchanges resources/mediawiki.special/mediawiki.special.recentchanges.js * mediawiki.special.search resources/mediawiki.special/mediawiki.special.search.css resources/mediawiki.special/mediawiki.special.search.js * mediawiki.special.undelete resources/mediawiki.special/mediawiki.special.undelete.js * mediawiki.special.upload resources/mediawiki.special/mediawiki.special.upload.js * mediawiki.special.userlogin.common.styles resources/mediawiki.special/mediawiki.special.userlogin.common.css resources/mediawiki.special/images/icon-lock.png * mediawiki.special.userlogin.signup.styles resources/mediawiki.special/mediawiki.special.userlogin.signup.css resources/mediawiki.special/images/icon-edits.png resources/mediawiki.special/images/icon-pages.png resources/mediawiki.special/images/icon-contributors.png * mediawiki.special.userlogin.login.styles resources/mediawiki.special/mediawiki.special.userlogin.login.css resources/mediawiki.special/images/glyph-people-large.png * mediawiki.special.userlogin.common.js resources/mediawiki.special/mediawiki.special.userlogin.common.js * mediawiki.special.userlogin.signup.js resources/mediawiki.special/mediawiki.special.userlogin.signup.js * mediawiki.special.javaScriptTest resources/mediawiki.special/mediawiki.special.javaScriptTest.js * mediawiki.special.version resources/mediawiki.special/mediawiki.special.version.css * mediawiki.ui resources/mediawiki.ui/default.less resources/mediawiki.ui/vector.less resources/mediawiki.ui/components/utilities.less resources/mediawiki.ui/components/default/forms.less resources/mediawiki.ui/components/vector/containers.less resources/mediawiki.ui/components/vector/forms.less resources/mediawiki.ui/mixins/effects.less resources/mediawiki.ui/mixins/forms.less resources/mediawiki.ui/mixins/type.less resources/mediawiki.ui/mixins/utilities.less resources/mediawiki.ui/settings/colors.less resources/mediawiki.ui/settings/typography.less resources/mediawiki.ui/styleguide.md * mediawiki.ui.button resources/mediawiki.ui/components/default/buttons.less resources/mediawiki.ui/components/vector/buttons.less Legacy modules, untouched: * mediawiki.legacy.ajax * mediawiki.legacy.commonPrint * mediawiki.legacy.config * mediawiki.legacy.protect * mediawiki.legacy.shared * mediawiki.legacy.oldshared * mediawiki.legacy.upload * mediawiki.legacy.wikibits Miscellaneous files moved elsewhere * A currently-failing (unused?) script attempting to build some kss style documentation. Previously in the root of the resources directory, now moved to a new folder, /docs/kss. Makefile README.txt package.json scripts/nodecheck.sh styleguide-template/index.html styleguide-template/public/kss.less styleguide-template/public/less.js * ResourceLoader startup JS code was also moved to /src resources/startup.js * mediawiki.mixins, hard-coded to be loaded by ResourceLoader, also moved to /src resources/mediawiki.less/mediawiki.mixins.animation.less resources/mediawiki.less/mediawiki.mixins.less resources/mediawiki.less/mediawiki.mixins.rotation.less * jquery.cycle.all.js appears not to be refered to (?!): (added in 2f1f0abc6b) resources/jquery/jquery.cycle.all.js Change-Id: Id5ead1453412e763bdb3763084e43694517088fd
* mediawiki.util: Init tooltipAccessKeyPrefix immediately instead of on domreadyFomafix2014-04-061-49/+55
| | | Change-Id: I60e30e1d029d29b713b229bf2b0313e92a59f120
* mediawiki.util: Fix jsduck syntax and minor clean upTimo Tijhof2014-03-261-7/+10
| | | | | | | | | | | | | * Fix indentation of @param comment to not trigger <pre> context. * Clean up descriptions. * Apply coding conventions - Function call one one line, or one line per argument. Avoid arbitrary splitting mid-line when purely for the sake of line length. * Combine string concatenation in one expression instead of adding twice. Change-Id: Id9f2a7cef1c8bf1c01584fbb293d0605fc91337e
* Merge "mediawiki.util: Don't hardcode selectors in updateTooltipAccessKeys ↵jenkins-bot2014-02-061-7/+18
|\ | | | | | | if possible"
| * mediawiki.util: Don't hardcode selectors in updateTooltipAccessKeys if possibleBartosz Dziewoński2014-01-301-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're running on a browser where we can do this efficiently, just find all elements that have accesskeys using document.querySelectorAll. We can't use jQuery's polyfill for the selector since looping over all elements on page load might be too slow. Otherwise (IE<=7, Firefox<=3), just as it was done previously, go through some elements likely to have accesskeys and update only them. Unfortunately this will not fully work for custom skins with different HTML structures, but you can't have everything. Also added 'button' to the selector used in this case. Bug: 58255 Change-Id: I3306ac4b2d32a5f0f6567e6aab176ecd6682062f
* | Move toctoggle from mediawiki.util.js to separate file mediawiki.toc.jsFomafix2014-01-241-50/+7
|/ | | | | | | | | | | | * New file mediawiki.toc.js without global function. * Keep minimal function mediaWiki.util.toggleToc() for compatibility. * Mark mediaWiki.util.toggleToc() as deprecated. * Adapt mediawiki.util.test.js. * Add new file mediawiki.toc.test.js. * Solves bug 60030 and allow multiple toc. Bug: 60030 Change-Id: I3ca2acb70db98d00e3f1bd2227091bd32d8e18a5
* Merge "(Bug 60030) Use $content of the hook for toc hiding"jenkins-bot2014-01-231-4/+4
|\
| * (Bug 60030) Use $content of the hook for toc hidingFomafix2014-01-141-4/+4
| | | | | | | | Change-Id: Ia1d0a5c4b23459a7da58803fbf886b562eea7f37
* | Clean up whitespace in various javascript filesFomafix2014-01-221-6/+6
|/ | | | Change-Id: I62fe370493b269618a0277ea06ed6ad22b97616a
* mediawiki.Title: Add 'params' parameter to #getUrlBartosz Dziewoński2013-11-161-2/+2
| | | | | | Same as the parameter to mw.util.getUrl(). Also prettify the docs there. Change-Id: I94489e7d526d69126f3e90b7f41e2ec0430f7f66
* mw.util.addPortletLink: Check length before access array indexumherirrender2013-11-131-1/+1
| | | | | | | | | | | This avoids "TypeError: Cannot read property 'parentNode' of undefined", when the given nextNode is a jQuery object without elements. Adding a test for this case and for the case of unknown id, which internally results in a empty jQuery object. Bug: 56770 Change-Id: I56de9e6bc15449e294b538743baf0f0c1cc0abb1
* Let mw.util.addCSS also return a CSSStyleSheet in IE8umherirrender2013-11-081-1/+1
| | | | | | The IE8 has a 'styleSheet' attribute instead of a 'sheet' attribute Change-Id: I83fc602a43cae7d2d9be32ea6fef84bc5129dbb9
* Rename mw.util.wikiGetlink to getUrlBartosz Dziewoński2013-11-071-1/+8
| | | | | | | | | | | | Old name still works, but is deprecated. The new one has the nice property of being the same as a function defined on mw.Title which does the same thing. Replaced all occurences throughout the codebase. Bug: 55764 Change-Id: I8704a6620ece44d374e199c05464b8a553e12e74
* mediawiki.util: Use 'wikipage.content' hook for TOC hidingFomafix2013-10-221-17/+20
| | | | | Bug: 54437 Change-Id: I82f441111bf3d6018b569dc728a3c152b721db7d
* Merge "mediawiki.util: Detect Iceweasel for accesskeys"jenkins-bot2013-09-151-2/+3
|\
| * mediawiki.util: Detect Iceweasel for accesskeysBartosz Dziewoński2013-09-151-2/+3
| | | | | | | | | | Bug: 54015 Change-Id: I105f22756c5df32aef2e4581f5f0d8e3db059dfc
* | Adding support for query string params to mw.util.wikiGetlinkkaldari2013-09-111-2/+9
|/ | | | | | | | | | This will enable us to easily migrate MobileFrontend from using M.pageApi.getPageUrl (mobile custom version) to mw.util.wikiGetlink. Includes a unit test. Change-Id: I5224a0910a822f1c3b1b34f505dbcdf879052b39
* mediawiki.util: Optimise logic in addPortletLinkTimo Tijhof2013-08-021-20/+18
| | | | | | | | | | | | | | | | | Optimised to no longer: * boolean cast "nextnode" twice. * assert nextnode.jquery when we know it is a jQuery object. > !!$( Node ).jquery * assert nextnode.length when we know it has only 1 element. > $( Node ).length === 1 * execute $ul.find( selector ) twice for the CSS selector case. * check for .length in some places and do an ignorant eq(0) in other cases (thus ignoring the case if there are multiple elements). Tests still pass :-) Change-Id: Ibc86c2dc33a8a3ba378138525c2523ba69bca8f1
* mediawiki.util: Fix addPortletLink to allow jQuery objectsMark Holmquist2013-08-021-3/+9
| | | | | | | The docs already say jQuery is a supported type for nextnode, it just wasn't yet checking for it in the function. Change-Id: I0bdc7dacd24aac720b70c6fc0ca3154ceccd0ebb
* Move firing of "wikipage.content" mw.hook out of mediawiki.utilTimo Tijhof2013-07-221-2/+0
| | | | | | | | | | | | | | * Update "wikipage.content" arguments to really pass the content and not the entire body wrapper (no longer mw.util.$content). * Move the firing of "wikipage.content" from mediawiki.util to mediawiiki.page.startup. It didnt really belong in mediawiki.util, and now that we're no longer passing it mw.util.$content they're no longer related in either direction. Bug: 30713 Change-Id: I56d6491527547f898e239b531c98e903863f8999
* wikibits: Wrap jsMsg in mw.log.deprecateTimo Tijhof2013-05-291-1/+1
| | | | | | | | No release notes since it was already deprecated (in 1.17 to mw.util.jsMessage and in 1.20 to mediawiki.notify, though we don't fallback to that directly since it is not compatible). Change-Id: I359c94929e58363d5b38f410a60b456111bb0897
* Improve doc for mw.util.getParamValueMatthew Flaschen2013-05-201-1/+1
| | | | Change-Id: I4f008617c278a30eb43d21c942e1ab06a6db1c0a
* mw.hook: Implement callback frameworkTimo Tijhof2013-05-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | We have various interface components that are extended, enhanced or manipulated in some other way by extensions, gadgets and even in core itself. This framework helps streamlining the timing of when these other code paths fire their plugins (instead of using document-ready, which can and should be limited to firing only once). Features like navigating to other wiki pages, previewing an edit and editing itself – without a refresh – can then retrigger these hooks accordingly to ensure everything still works as expected. For the server side this has been possible already, but for the client side we've been limited to running only once on the original page load. Further documentation and examples are in the code documentation. Bug: 23580 Bug: 30713 Change-Id: Ic73a3efe53d6fb731e7f1e531d5f51530cd7e4fe
* mediawiki.util: Fix roundtripping of tooltip in portlet linksTimo Tijhof2013-04-221-9/+26
| | | | | | | | | | | | | | | | | | | In 558985f72a ctrl-option- for Chrome on Mac was added, but it didn't add "option-" to the regex. Since then the tooltip in Chrome on Mac (and later when we started referring to option instead of alt on all Mac browsers) was never detected by this regex, sometimes resulting in double tooltips (when adding) or outdated tooltips (when updating). Now we always look for an accesskey hint in the tooltip and strip it it's there. Also fixed a bug where an undefined error can occur if accesskey is given but tooltip not (the method unconditinally appended text to the tooltip varible which might be undefined causing a tooltip like "undefined[a]"). Change-Id: I0bde1a228983c58b20cad0c09a8e5efe8225ea23
* remove references to removed skins from mediawiki.util.jsMatmaRex2013-04-061-69/+56
| | | | | | Dead code removal. Followup to Ia6d73c2d. Change-Id: Ic43462d6775af682626e43a1bdfab3f8077f0101
* Use American English spelling for behaviorSiebrand Mazeland2013-03-041-1/+1
| | | | | | Spotted in ipbreason-dropdown by Shirayuki. Change-Id: I576ed4bc0abe5ab980aaee3fb9f9e4b43087311f
* Initial JSDuck implementationTimo Tijhof2013-02-231-101/+92
| | | | | | | | | | | | | | | | | | | | | | | * Adding configuration files for jsduck. * Fixing our previously undocumented code documentation to comply with jsduck specifications .. for the following modules: - mediawiki - mediawiki.Title - mediawiki.util - mediawiki.notification - mediawiki.api (and plugins thereof) - jquery.localize I've choose these to show as many different examples for different types of modules and methods that we encounter in our code base. Hopefully with this as a start it will be easy for other people to extend the documentation for most (if not, all) other modules we have in MediaWiki core. Change-Id: Ieb8c5d2d2cb4672f1d6abc3f865c6fb1470d8feb
* (bug 43382) Alt+shortcut key does not work in Chrome/LinuxSanthosh Thottingal2012-12-241-7/+4
| | | | | | | | | | For chrome in linux, the shortcut keys given are ALT+[KEY]. This works, but fails for keys like E, F, D etc. ALT+E or ALT+F opens the settings menu, ALT+D highlights URL. To make it work always with all keys , it should be presented as ALT+SHIF+[KEY] as done for Windows. Change-Id: I87a9d498ac99d381c31c94b03d6cc72fa265e839
* Merge changes I4ac3bc14,I470acb8bDemon2012-11-111-1/+0
|\ | | | | | | | | | | * changes: make addPortletLink work with CologneBlue (bug 18338) WAI-ARIA landmark roles in most used skins
| * make addPortletLink work with CologneBlueMatmaRex2012-11-041-1/+0
| | | | | | | | | | | | | | | | To achieve this: * remove the special-casing in mw.util * use standard portlet ids to make existing scripts work Change-Id: I4ac3bc143fc235f700144244b0ad5b1f681ae5b5
* | Lint: Go-go-gadget jshint! Passing entire JS code base (again).Timo Tijhof2012-11-101-10/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were still some files not passing jshint, and for files that did, we managed to screw 'em up again. Added more explicit settings in .jshintrc to avoid relying on a kind of default somewhere. There are too many default-factors: closest(.jshintrc), ~/.jshintrc, IDE/editor, node-jshint.. Added node_modules/ and extensions/ to .jshintignore. Previously "$ jshint ." would recurse over all kinds of unrelated code. Extensions should have their own jshint dotfiles. When linting from Jenkins this won't be a problem as those will be ran per repo (so when linting core it will skip extensions and when in an extension dir, the core dotfiles don't apply as they'll be out of scope). Some of our modules are really messy and should be refactored to be less spaghetti-ish and have more descriptive variable names and more manageable function-level complexity. But for this commit, I'm keeping it as much as-is as possible, because its hard/large enough to review as it is. A few errors are cited below to give an impression of the kind of warnings I addressed (for cases where the diff isn't so obvious): * jquery.hidpi.js: line 110, col 15, Empty block. * mediawiki.jqueryMsg.js: line 34, col 17, Too many var statements. * mediawiki.jqueryMsg.js: line 145, col 33, Strings must use singlequote. * mediawiki.action.edit.js: line 74, col 73, 'selectText' is defined but never used. * startup.js: line 19, col 22, 'isCompatible' is defined but never used. * jquery.byteLength.test.js: line 26, col 9, Identifier 'U_00A2' is not in camel case. * jquery.localize.test.js: line 63, col 29, 'attrs' is defined but never used. * mediawiki.cldr.test.js: line 72, col 27, 'mw' is not defined. * mediawiki.jscompat.test.js: line 6, col 17, Strings must use singlequote. * mediawiki.api.parse.test.js: line 9, col 17, Strings must use singlequote. * mediawiki.api.parse.test.js: line 7, col 15, 'mw' is not defined. * mediawiki.api.parse.test.js: line 14, col 24, '$' is not defined. * mediawiki.api.test.js: line 43, col 28, 'data' is defined but never used. Other fixes: * Add closures fix implied global errors ($, mw and more), and prevents local variables from becoming globals. * Avoid jQ magic map arg etc. (per code conventions). * Fix incorrect usage of jQuery methods (prop instead of attr, prop false instead of removeProp, ..). * Unquote keys in object literals for consistency, and enforce single quotes (no magic quotes in javascript, as much as we might think "\n" and '/n' are really exactly the same). Chose single quotes over double quotes since that's what most code already had and what conventions seemed to prefer (both the old generic ones and the new per-lang ones since 2011/2012). * Enforce camelCase variable names with jshint per code conventions. * $foo.on('x', fn).trigger('x') -> $foo.on('x', fn); fn() (No event simulation overhead, unless intended of course) * Incorrect indentation (ignore whitespace in the diff!). * Avoid proprietary selectors like ':first' when .eq(0) afterwards is just as possible (significantly faster in jQuery due to mostly avoiding the Sizzle engine and going native in modern browsers). * When at it, convert deprecated jQuery methods to new ones. Mostly just .delegate(sel, type, fn) -> .on(type, sel, fn). * Addressed whitespace here and there. Interesting: * mediawiki.js: local function "compare" wasn't used anymore (hasn't been in a while!) removed per jshint warning. * mediawiki.special.recentchanges.js: Was a mess, only a few lines of code, rewritten. Pfew, let's hope it's the last one before we lint from Jenkins! Change-Id: I23ad60a1d804c542d9b91454aaa20ce7be4ff289
* getParamValue defaults to current page only if url undefinedOri Livneh2012-10-191-1/+3
| | | | | | | | | | | | | | | The danger of using || here is apparent if you consider the following case: mw.util.getParamValue( 'action', document.referrer ); If document.referrer is the empty string (as it often is), getParamValue will look up the 'action' parameter in the current URL, which is surely unintended. The solution is to use the default value if and only if the url parameter is undefined. Change-Id: Ifd949f890d2f974dacc40e549c820c434ce57f53
* [mw.notification] Introduce a full fledged notification system into core ↵Daniel Friesen2012-09-021-70/+8
| | | | | | | | | | | | | | | | | replacing jsMessage. - Support for multiple messages instead of just one is included. - Persistent messages are also supported. - Tagged message replacement is supported so that only one message of a type will show up at once. - A light flood protection is included to stop all the notifications from disappearing at once. - Watchlist uses it's own tag now. - Legacy jsMessage messages still replace each other by using a tag: 'legacy' option - #mw-js-message was an old id used for something with a completely different style. So rather than re-using it that id is being dropped. Skins can now style the new notifications. - Core is no longer using messageBox and no extension uses it so instead of making a compatibility layer for it that module is just being dropped. This is a follow up to I41c70d78. Change-Id: I2b3d9cbce6d1514d754b4403ec878d89ea6af29d
* Fix up the preferred way to specify mw.util.$contentDaniel Friesen2012-08-301-19/+43
| | | | | | | | | - Setting a .mw-body class is the preferred way for $content to be defined - You can set an extra .mw-body-primary if you use multiple .mw-body classes or for some legacy reasons .mw-body is at a different depth than the content area - No extensions appear to be using util.$content in a way that would imply they want the body text rather than the overall content area - Anyone that actually needs the body text can use #mw-content-text. Change-Id: Ic7b756f139047e4100fcab8f63a968d45ca2b2fe
* (bug 36329) Fix accesskey tooltip for Firefox 14 on MacMinh Nguyễn2012-08-301-1/+5
| | | | | | Should use "ctrl-option-" prefix Change-Id: I87463fc6043fb17cab70956f65fd9da3cdd7477d
* Make wfScript()/mw.util.wikiScript() respect $wgScript/$wgLoadScriptCatrope2012-08-211-2/+9
| | | | | | | | | | | | | | | | | | | | mw.util.wikiScript() and mw.util.wikiScript( 'index' ) now return the value of $wgScript rather than building the path to index.php manually; the latter is incorrect if $wgScript is customized. Similarly, mw.util.wikiScript( 'load' ) now uses $wgLoadScript. Same for wfScript(), wfScript( 'index' ) and wfScript( 'load' ) The qunit tests already had a test case for wgScript, but wgScript was set in a way that didn't trigger the bug. Changed it to use customized wgScript and wgLoadScript values and added test cases for 'index' and 'load' This fixes bug 39103 (wfScript/mw.util.wikiScript do not respect custom $wgScript/$wgLoadScript) as well as bug 39102 ("Entry points" on Special:Version do not respect custom $wgScript/$wgLoadScript) Change-Id: I5c9e82849e314dc7a87f8ae91150cc412b4011cf
* Clean up mw.util.jsMessageTimo Tijhof2012-08-121-3/+2
| | | | | | | | | | | | * Re-use hideMessage() * Actually set messageBoxEvents to true so that the one-time setup is only set up once. * Optimize hex colors ({6}->{3}). While at it, also ran it for the rest of the file. * Follows-up I41c70d78 Change-Id: I1863b62003edc825fdefe53d02c2d22e36409234
* jsMessage: Redesign in Vector/Monobook as bubble with auto-hideTrevor Parscal2012-08-111-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A bit like the "Growl" notifications on Mac. The message will auto-hide in all skins, which is especially useful with VisualEditor because you it does most things through ajax which means that a msg in there could be visible for way longer than it should be with no way of hiding it. By being designed as a floating bubble instead of a static positioned element in regular document flow it also prevents the page flow from being interrupted and moved down a bit. Again that was especially annoying in VisualEditor because jsMessage forced itself between the tab bar and the editor toolbar, which were meant to be against each other. Auto-hiding is disabled while the mouse if hovering the message. The timer starts again when the mouse is no longer on it. Also: * cleaned up some whitespace issues in vector.js * Removed jshintignore for skins/common Removed whitelisting of 'mw' global skins/common may not be prefect, but at least this way it gives warnings inside the code when writing/editing something, which is still useful. It helped to catch that 'mw' was used from the global scope. Change-Id: I41c70d78c8ed8aeb91a598dc4a7b26dfad8d8f6c
* Kranitor #2: Pass JSHint on resources/mediawiki/*Timo Tijhof2012-08-091-3/+3
| | | | | | | | | | | | | | | | | | | * .jshintrc - Update properties to reflect our conventions more * Re-pass resources/jquery/* * Pass resources/mediawiki/* - Trailing whitespace - Whitelist the one usage of document.write with a local /*jshint evil:true */ in the function that we allow to use it. - Get rid of dangling _ in var names and undescriptive instances of '_this'. - More code conventions * Add a few documentation comments while at it Change-Id: Ic4f2b5d473a440667a40e4d5f12f40877386b02f
* (bug 35082) addPortletLink incorrectly adds to mutiple <ul> tagsTimo Tijhof2012-07-021-5/+6
| | | | | | | | | | | | * cleaned up tags <ul> creation (no need to create it and then find() it. Might as well grab a hold of it before insertion). * Fixed bug by adding ".eq( 0 )" * Added unit test for it (which fails without the fix in mediawiki.util.js) Change-Id: I51e9053292f03c1b833db0df2fb1b40f1eaf8b1a
* Remove useless test in getParamValue function of mediawiki.util.jsvlakoff2012-06-091-1/+1
| | | | | | | | Regarding that regexp, when it matches, the result ("m" variable) is forcibly an array of length 2, m[1] being a defined string (which may be an empty string). Change-Id: If40c4bc209719f0f54742d6e3eb6a11b99b57370
* added since tag to wikiScript after I wasted a minute finding when it was ↵jeroendedauw2012-05-211-0/+1
| | | | | | added - joy! Change-Id: Idc4dd1353cdbfed31ad86446b59043bffa4ba225
* Follows-up r113214: span ternary operator over multiple lines for readabilityKrinkle2012-03-071-9/+11
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/113268
* [mw.util.tooltipAccessKeyPrefix] alt-shift for Chrome on WindowsKrinkle2012-03-071-3/+11
| | | | | | | | * Fixes: -- (bug 29753) mw.util.tooltipAccessKeyPrefix should be alt-shift for Chrome on Windows Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/113214
* [mw.loader] Refactor addInlineCSS's logic, fixing various bugsKrinkle2012-02-241-13/+14
| | | | | | | | | | | | | * Using mw.util.addCSS as base to instance of bug 33305 automatically * Expose as mw.loader.addStyleTag * Re-use the code in mw.util.addCSS * Drop the "text > Cdata > element > jQuery object > innerHTML", in favor of setting cssText or appending a text node (html escapement isn't a problem when working with text nodes directly). * Appending this way also works in IE, no need for the dispose/re-create style-tag logic in the try-catch(). * Follows-up r110988 (fixme) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/112370
* [mw.util] bug fix and minor clean upKrinkle2012-02-231-6/+6
| | | | | | | | | * Fixes bug 34603 (Patch by Rainer <Rainer@Rillke.eu>) and other instances of the same bug -- Use 'util' instead of 'this' to allow re-usage of the method in a different context * Use ternary operator instead of the default operator in mw.util.wikiGetlink to check it for type instead of thruthy-ness (so that falsy-values such as '' work, and thruthy non-string values such as objects fail). Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/112170
* [mediawiki.util] minor code cleanupKrinkle2012-01-221-51/+53
| | | | | | | | | * Remove distance between variable assignment and usage in mw.util.ini * Change awkwardly indention from extended var statement into separate flush-left assignments and a simple var statement. * whitespace etc. (ignore whitespace with -x-uw or on ViewVC diff) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/109717
* [mediawiki.action.watch.ajax.js] Rewrite using mw.Api and fixes bug 27146Krinkle2011-12-271-4/+4
| | | | | | | | | | | | | | | | | | | | * Use mw.Api and new it's new .watch() as of r107350 * No longer get title from url, use wgPageName instead * No longer simple queryParam check for action in url, now supports wgActionPaths as well. * Simplification and speed up (less back and forth between functions and jQuery-ism). Previously it had $(..) with several .add() calls. Now doing one call. * Uses mw.util.tooltipAccessKeyRegexp instead of local regex * Uses jQuery.fn.text instead of jQuery.fn.html for link text message * Should fix bug 27146 (previously a failed attempt in r82498) * Previousy worked on in r88527, r88511, r78150, r78147 * minor whitespace/comment fix in mediawiki.util.js/mediawiki.page.startup.js Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/107354
* typo; follows-up r107289Krinkle2011-12-251-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/107291
* [Core JS] Clean up and optimization mediawiki.utilKrinkle2011-12-251-59/+43
| | | | | | | | | | | | | * partial rewrite of updateTooltipAccessKeys, much shorter and a bit faster -- Remove self-calling logic, totally unnecessary here -- removing the .each() loop, using .attr()'s callback function instead * directly calling util.toggleToc instead of triggering a click event * strict comparison * unquoted keys * substitute single-use variable Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/107289