ResourceLoader/JavaScript Deprecations
This page documents deprecated identifiers that will be removed from mediawiki eventually (see bug 33836) and their replacements as can be found in the "Replaced by" columns below. All replacements and some new modules are available as-is since 1.17. Please use the modern replacements for new code and rewrite old code immediately. If you encounter no replacement and believe there should be one, please Let us know!
Please note the current implementation in Git may differ from the latest stable release and what might eventually be included with mediawiki. Any code relying on details obtained from Git may break.
ajax.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
sajax_debug_mode | string |
Use $( '#mybox' ).load( '/wiki/Template:ResourceLoader_navigation #bodyContent' ); $.get( mw.config.get( 'wgScript' ), { title: 'ResourceLoader', action: 'raw' }, function( data ) { /* Call was successful do something with "data" */ } ); $.getJSON( mw.util.wikiScript( 'api' ), { format: 'json', action: 'query', titles: 'Main Page', prop: 'info' }, function( obj ) { /* API call was successful do something with obj */ } ); For more information see documentation for .load(), .get(), .getJSON() and the other jQuery Ajax functions. See also this guide from WikiProject User scripts, for an example of how to edit a wikipage using AJAX. |
sajax_request_type | string | |
sajax_debug | function | |
sajax_init_object | function | |
wfSupportsAjax | function | |
sajax_do_call | function |
$.get( mw.util.wikiScript(), { action: 'ajax', rs: 'SomeExtensionFunction', rsargs: [arg1, arg2, arg3] // becomes &rsargs[]=arg1&rsargs[]=arg2... } ); Note: These calls using action=ajax should be rewritten to use an API module |
ajaxwatch.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
wgAjaxWatch | object | mediawiki.action.watch.ajax.js (No public identifiers) |
block.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
considerChangingExpiryFocus | function | mediawiki.special.block.js (No public functions) |
updateBlockOptions | function |
changepassword.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
onNameChange | function | None/Removed |
onNameChangeHook | function |
edit.js[edit | edit source]
The toolbar interfaces will likely migrate into an extension. The default bundle would include the Extension:WikiEditor, which already has an advanced API that replaces all of this.
Identifier | Type | Replaced by |
---|---|---|
currentFocused | HTMLElement | (private/obsolete) |
addButton | function | mw.toolbar.addButton |
mwInsertEditButton | function | (private/obsolete) |
mwSetupToolbar | function | (private/obsolete) |
insertTags | function | mw.toolbar.insertTags |
scrollEditBox | function | (private/obsolete) |
mwEditButtons | Array | (private/obsolete) |
enhancedchanges.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
toggleVisibility | function | None/Removed |
history.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
historyRadios | function | mediawiki.action.history.js (No public functions) |
diffcheck | function | |
histrowinit | function |
htmlform.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
htmlforms | object | None/Removed |
IEFixes.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
doneIETransform | object | None of these should ever be used by anyone. :) |
doneIEAlphaFix | object | |
expandedURLs | object | |
hookit | function | |
fixalpha | function | |
relativeforfloats | function | |
setrelative | function | |
onbeforeprint | function | |
onafterprint | function |
metadata.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
attachMetadataToggle | function | No public functions |
mwsuggest.js[edit | edit source]
- As of September 2012 this is still a dependency for Extension:Vector's simpleSearch.
Identifier | Type | Replaced by |
---|---|---|
os_map | object |
mw.loader.using('jquery.ui.autocomplete', function () { $('#mw-search').autocomplete({ minLength: 2, source: function (request, response) { $.getJSON( mw.util.wikiScript('api'), { format: 'json', action: 'opensearch', search: request.term }, function (arr) { if (arr && arr.length > 1) { response(arr[1]); } else { response([]); } } ); } }); }); See documentation for more information. |
os_cache | object | |
os_cur_keypressed | number | |
os_keypressed_count | number | |
os_timer | object | |
os_mouse_pressed | boolean | |
os_mouse_num | number | |
os_mouse_moved | boolean | |
os_search_timeout | number | |
os_autoload_inputs | object | |
os_autoload_forms | object | |
os_is_stopped | boolean | |
os_max_lines_per_suggest | number | |
os_animation_steps | number | |
os_animation_min_step | number | |
os_animation_delay | number | |
os_container_max_width | number | |
os_animation_timer | object | |
os_use_datalist | boolean | |
os_Timer | function | |
os_Results | function | |
os_AnimationTimer | function | |
os_MWSuggestInit | function | |
os_initHandlers | function | |
os_hookEvent | function | |
os_eventKeyup | function | |
os_processKey | function | |
os_eventKeypress | function | |
os_eventKeydown | function | |
os_eventOnsubmit | function | |
os_hideResults | function | |
os_decodeValue | function | |
os_encodeQuery | function | |
os_updateResults | function | |
os_setupDatalist | function | |
os_getNamespaces | function | |
os_updateIfRelevant | function | |
os_delayedFetch | function | |
os_fetchResults | function | |
os_getTarget | function | |
os_isNumber | function | |
os_enableSuggestionsOn | function | |
os_disableSuggestionsOn | function | |
os_eventBlur | function | |
os_eventFocus | function | |
os_setupDiv | function | |
os_createResultTable | function | |
os_showResults | function | |
os_operaWidthFix | function | |
f_clientWidth | function | |
f_clientHeight | function | |
f_scrollLeft | function | |
f_scrollTop | function | |
f_filterResults | function | |
os_availableHeight | function | |
os_getElementPosition | function | |
os_createContainer | function | |
os_fitContainer | function | |
os_trimResultText | function | |
os_animateChangeWidth | function | |
os_changeHighlight | function | |
os_HighlightClass | function | |
os_updateSearchQuery | function | |
os_eventMouseover | function | |
os_getNumberSuffix | function | |
os_eventMousemove | function | |
os_eventMousedown | function | |
os_eventMouseup | function | |
os_createToggle | function | |
os_toggle | function |
prefs.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
tabbedprefs | function | mediawiki.special.preferences.js (No public functions) |
uncoversection | function | |
checkTimezone | function | |
timezoneSetup | function | |
fetchTimezone | function | |
guessTimezone | function | |
updateTimezoneSelection | function |
preview.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
doLivePreview | function | mediawiki.action.edit.preview.js (No public functions) |
protect.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
ProtectionForm | object |
rightclickedit.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
setupRightClickEdit | function | mediawiki.action.view.rightClickEdit.js (No public functions) |
addRightClickEditHandler | function |
search.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
mwSearchHeaderClick | function | mediawiki.special.search.js (No public functions) |
mwToggleSearchCheckboxes | function |
upload.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
wgUploadWarningObj | object | |
wgUploadLicenseObj | object | |
licenseSelectorCheck | function | |
wgUploadSetup | function | |
toggleUploadInputs | function | |
fillDestFilename | function | |
toggleFilenameFiller | function |
wikibits.js[edit | edit source]
Identifier | Type | Replaced by |
---|---|---|
clientPC | string | |
is_gecko | boolean | |
is_safari | boolean | |
is_safari_win | boolean | |
is_chrome | boolean | |
is_chrome_mac | boolean | |
is_ff2 | boolean | |
is_ff2_win | boolean | |
is_ff2_x11 | boolean | |
webkit_match | object | |
ff2_bugs | boolean |
» jQuery.support maybe? |
ie6_bugs | boolean | |
doneOnloadHook | boolean |
» jQuery Use jQuery( document ).ready( function( $ ) { /* your inline code to be executed after the page is loaded */ } ); // or: jQuery( document ).ready( LoadMyApp ); Or shorthand: jQuery( function( $ ) { /* your inline code to be executed after the page is loaded */ } ); // or: $( LoadMyApp ); |
onloadFuncts | object | |
addOnloadHook | function | |
runOnloadHook | function | |
killEvt | function |
» jQuery.Event: /** * @param e {jQuery.Event} Cross-browser compatible/normalized event object */ $( '#mw-fooBar' ).click( function( e ) { e.preventDefault(); /* do something else */ } ); |
loadedScripts | object | redundant |
importScript | function | These two functions are not quite deprecated yet, but are planned to be, once a suitable modern substitute is found. See bugzilla:25845 and bugzilla:27281
|
importStylesheet | function | |
importScriptURI | function |
Note: mediaWiki.loader only accepts absolute urls (starting with |
importStylesheetURI | function | |
appendCSS | function | » mediaWiki.util.addCSS |
addHandler | function |
» jQuery Events Using // Attach multiple events to an element and attach an anonymous function $( '#fooBar' ).on( 'mouseenter mouseleave', function() { alert( '#fooBar is moused!' ); } ); // Attach multiple events with different handlers to a single element $( '#fooBar' ).on( { click: function() { // do something on click }, mouseenter: function() { // do something on mouseenter } } ); // Attach a handler to the click events of an earlier defined DOM element $( myElement ).click( myFunction ); |
addClickHandler | function | |
removeHandler | function | |
hookEvent | function | |
mwEditButtons | object | deprecated |
mwCustomEditButtons | object |
» WikiEditor The new WikiEditor (which also works fine in Monobook, see here) has built-in function to customize the toolbar. For more info see Extension:WikiEditor/Toolbar customization. For examples to insert buttons using the native script see Extension:WikiEditor/Toolbar customization/Library. For a script to insert buttons using a simple syntax similar to the old way check out m:User:Krinkle/Scripts/insertVectorButtons#Description mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:Krinkle/insertVectorButtons.js' + '&action=raw&ctype=text/javascript' ); function kCustomMainInsertButton_config(){ // {{Welcome}} ~~~~ kCustomMainInsertButton( 'welcome', // Id '//commons.wikimedia.org/w/thumb.php?f=Nuvola_apps_edu_languages.svg&w=22', // File 'Welcome', // tooltip '{\{Welcome}\}\~\~\~\~', // Open tag '', // Close tag '' // sampleText ); // {{subst:Test2}} ~~~~ kCustomMainInsertButton( 'test2', // Id '//commons.wikimedia.org/w/thumb.php?f=Nuvola_apps_important.svg&w=22', // File 'Test2', // tooltip '{\{subst:test2|', // Open tag '}\}\~\~\~\~', // Close tag '' // sample text ); }
|
tooltipAccessKeyPrefix | string | mw.util.tooltipAccessKeyPrefix |
tooltipAccessKeyRegexp | object | mw.util.tooltipAccessKeyRegexp |
updateTooltipAccessKeys | function | mw.util.updateTooltipAccessKeys |
ta | object | MediaWiki:Accesskey-* and MediaWiki:Tooltip-*. |
akeytt | function | deprecated |
checkboxes | object | |
lastCheckbox | object | |
setupCheckboxShiftClick | function | |
addCheckboxClickHandlers | function | |
checkboxClickHandler | function | |
showTocToggle | function | |
toggleToc | function | |
ts_image_path | string | |
ts_image_up | string | |
ts_image_down | string | |
ts_image_none | string | |
ts_europeandate | boolean | |
ts_alternate_row_colors | boolean | |
ts_number_transform_table | object | |
ts_number_regex | object | |
sortables_init | function | |
ts_makeSortable | function | |
ts_getInnerText | function | |
ts_resortTable | function | |
ts_initTransformTable | function | |
ts_toLowerCase | function | |
ts_dateToSortKey | function | |
ts_parseFloat | function | |
ts_currencyToSortKey | function | |
ts_sort_generic | function | |
ts_alternate | function | |
changeText | function |
» jQuery Using // Set text of an earlier defined element $( myElement ).text( 'New text!' ); // Set text for multiple elements at once $( '.mw-userlink' ).text( 'Mr. Foobar' ); // Get the text of an element $( myElement ).text(); |
getInnerText | function | |
escapeQuotes | function | |
escapeQuotesHTML | function | |
addPortletLink | function | |
jsMsg | function | |
injectSpinner | function | jQuery(...).injectSpinner('some id'), from module "jquery.spinner" |
removeSpinner | function | jQuery.removeSpinner('some id'), from module "jquery.spinner" |
getElementsByClassName | function |
» jQuery Use the CSS Selector in jQuery to select elements by classname. Here examples for the three most common usecases of // Get everything with a classname $( '.myclass' ); // Get all of element X (ie. table) with a classname $( 'table.wikitable' ); // Get all of something within another element $( myDomElement ).find( '.myclass' ); $( myDomElement ).find( '> .myclass' ); // only direct children // Get all class-elements that are direct children of an element $( '#someElement .myclass' ); $( '#someElement > .myclass' ); // only direct children |
redirectToFragment | function |
ResourceLoader | |
---|---|
Documentation | Features · Vocabulary · Migration guide (users) · Migration guide (developers) · Developing with ResourceLoader · Default modules · Mobile support |
Project information | Status updates · Version 1 Design Specification (tasks) · Version 2 Design Specification (tasks / tests) · Requirements |
Other | JavaScript Deprecations |