From a758d6ada167060a43f4abf68a2529987349abd6 Mon Sep 17 00:00:00 2001 From: Trevor Parscal Date: Sat, 4 Sep 2010 10:13:06 +0000 Subject: [PATCH] Removing remnants of merging mistakes. These files are way out of date and not in use. --- .../legacy/mediawiki.legacy.IEFixes.js | 141 --- .../mediawiki/legacy/mediawiki.legacy.ajax.js | 176 --- .../legacy/mediawiki.legacy.ajaxwatch.js | 136 -- .../legacy/mediawiki.legacy.block.js | 44 - .../legacy/mediawiki.legacy.changepassword.js | 29 - .../mediawiki/legacy/mediawiki.legacy.edit.js | 264 ---- .../mediawiki.legacy.enhancedchanges.js | 46 - .../legacy/mediawiki.legacy.history.js | 115 -- .../legacy/mediawiki.legacy.htmlform.js | 50 - .../legacy/mediawiki.legacy.metadata.js | 53 - .../legacy/mediawiki.legacy.mwsuggest.js | 1031 ---------------- .../legacy/mediawiki.legacy.prefs.js | 233 ---- .../legacy/mediawiki.legacy.preview.js | 121 -- .../legacy/mediawiki.legacy.protect.js | 346 ------ .../legacy/mediawiki.legacy.rightclickedit.js | 65 - .../legacy/mediawiki.legacy.search.js | 63 - .../legacy/mediawiki.legacy.upload.js | 333 ----- .../legacy/mediawiki.legacy.wikibits.js | 1090 ----------------- .../utilities/mediawiki.utilities.client.js | 185 --- .../mediawiki/views/mediawiki.views.diff.js | 30 - .../views/mediawiki.views.install.js | 100 -- resources/test/bar.css | 5 - resources/test/bar.js | 2 - resources/test/baz.css | 5 - resources/test/baz.js | 2 - resources/test/buz.css | 5 - resources/test/buz.js | 2 - resources/test/foo.css | 5 - resources/test/foo.js | 2 - resources/test/index.html | 21 - resources/test/loader.js | 6 - resources/test/test.css | 5 - resources/test/test.js | 2 - 33 files changed, 4713 deletions(-) delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.IEFixes.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.ajax.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.ajaxwatch.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.block.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.changepassword.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.edit.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.enhancedchanges.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.history.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.htmlform.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.metadata.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.mwsuggest.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.prefs.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.preview.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.protect.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.rightclickedit.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.search.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.upload.js delete mode 100644 resources/mediawiki/legacy/mediawiki.legacy.wikibits.js delete mode 100644 resources/mediawiki/utilities/mediawiki.utilities.client.js delete mode 100644 resources/mediawiki/views/mediawiki.views.diff.js delete mode 100644 resources/mediawiki/views/mediawiki.views.install.js delete mode 100644 resources/test/bar.css delete mode 100644 resources/test/bar.js delete mode 100644 resources/test/baz.css delete mode 100644 resources/test/baz.js delete mode 100644 resources/test/buz.css delete mode 100644 resources/test/buz.js delete mode 100644 resources/test/foo.css delete mode 100644 resources/test/foo.js delete mode 100644 resources/test/index.html delete mode 100644 resources/test/loader.js delete mode 100644 resources/test/test.css delete mode 100644 resources/test/test.js diff --git a/resources/mediawiki/legacy/mediawiki.legacy.IEFixes.js b/resources/mediawiki/legacy/mediawiki.legacy.IEFixes.js deleted file mode 100644 index 5c71e96baa..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.IEFixes.js +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/IEFixes.js - * - * Internet Explorer JavaScript fixes - */ - -( function( $, mw ) { - -/* Support */ - -/** - * Expand links for printing - */ -String.prototype.hasClass = function( classWanted ) { - var classArr = this.split(/\s/); - for ( var i = 0; i < classArr.length; i++ ) { - if ( classArr[i].toLowerCase() == classWanted.toLowerCase() ) { - return true; - } - } - return false; -} - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Global Variables */ - - 'isMSIE55': ( window.showModalDialog && window.clipboardData && window.createPopup ), - 'doneIETransform': null, - 'doneIEAlphaFix': null, - 'expandedURLs': null, - - /* Functions */ - - 'hookit': function() { - if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) { - doneIETransform = true; - relativeforfloats(); - fixalpha(); - } - }, - /** - * Fixes PNG alpha transparency - */ - function fixalpha( logoId ) { - // bg - if ( isMSIE55 && !doneIEAlphaFix ) { - var plogo = document.getElementById( logoId || 'p-logo' ); - if ( !plogo ) { - return; - } - var logoa = plogo.getElementsByTagName('a')[0]; - if ( !logoa ) { - return; - } - var bg = logoa.currentStyle.backgroundImage; - var imageUrl = bg.substring( 5, bg.length - 2 ); - doneIEAlphaFix = true; - if ( imageUrl.substr( imageUrl.length - 4 ).toLowerCase() == '.png' ) { - var logospan = logoa.appendChild( document.createElement( 'span' ) ); - logoa.style.backgroundImage = 'none'; - logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')'; - logospan.style.height = '100%'; - logospan.style.position = 'absolute'; - logospan.style.width = logoa.currentStyle.width; - logospan.style.cursor = 'hand'; - // Center image with hack for IE5.5 - if ( document.documentElement.dir == 'rtl' ) { - logospan.style.right = '50%'; - logospan.style.setExpression( 'marginRight', '"-" + (this.offsetWidth / 2) + "px"' ); - } else { - logospan.style.left = '50%'; - logospan.style.setExpression( 'marginLeft', '"-" + (this.offsetWidth / 2) + "px"' ); - } - logospan.style.top = '50%'; - logospan.style.setExpression( 'marginTop', '"-" + (this.offsetHeight / 2) + "px"' ); - var linkFix = logoa.appendChild( logoa.cloneNode() ); - linkFix.style.position = 'absolute'; - linkFix.style.height = '100%'; - linkFix.style.width = '100%'; - } - } - }, - /* - * Fixes IE6 disappering float bug - */ - 'relativeforfloats': function() { - var bc = document.getElementById( 'bodyContent' ); - if ( bc ) { - var tables = bc.getElementsByTagName( 'table' ); - var divs = bc.getElementsByTagName( 'div' ); - } - setrelative( tables ); - setrelative( divs ); - }, - 'setrelative': function ( nodes ) { - var i = 0; - while ( i < nodes.length ) { - if( ( ( nodes[i].style.float && nodes[i].style.float != ( 'none' ) || - ( nodes[i].align && nodes[i].align != ( 'none' ) ) ) && - ( !nodes[i].style.position || nodes[i].style.position != 'relative' ) ) ) - { - nodes[i].style.position = 'relative'; - } - i++; - } - }, - 'onbeforeprint': function() { - expandedURLs = []; - var contentEl = document.getElementById( 'content' ); - if ( contentEl ) { - var allLinks = contentEl.getElementsByTagName( 'a' ); - for ( var i = 0; i < allLinks.length; i++ ) { - if ( allLinks[i].className.hasClass( 'external' ) && !allLinks[i].className.hasClass( 'free' ) ) { - var expandedLink = document.createElement( 'span' ); - var expandedText = document.createTextNode( ' (' + allLinks[i].href + ')' ); - expandedLink.appendChild( expandedText ); - allLinks[i].parentNode.insertBefore( expandedLink, allLinks[i].nextSibling ); - expandedURLs[i] = expandedLink; - } - } - } - }, - 'onafterprint': function() { - for ( var i = 0; i < expandedURLs.length; i++ ) { - if ( expandedURLs[i] ) { - expandedURLs[i].removeNode( true ); - } - } - } -} ); - -/* Initialization */ - -$( document ).ready( function() { - mw.legacy.hookit(); -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.ajax.js b/resources/mediawiki/legacy/mediawiki.legacy.ajax.js deleted file mode 100644 index 6781f95555..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.ajax.js +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/ajax.js - * - * Original licensing information: - * Remote Scripting Library - * (c) Copyright 2005 ModernMethod, Inc. - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Global Variables */ - - 'sajax_debug_mode': false, - 'sajax_debug_mode': 'GET', - - /* Functions */ - - /** - * If sajax_debug_mode is true, this function outputs given the message into the element with id = sajax_debug; if no - * such element exists in the document, it is injected - * - * @param string text debug message to append to log - * @return boolean true when in debug mode, false when not - */ - 'sajax_debug': function( text ) { - if ( mw.legacy.sajax_debug_mode ) { - var $e = $( '#sajax_debug' ); - if ( !$e.length ) { - $e = $( '

' ).prependTo( $( 'body' ) ); - } - $e.append( $( '
' ).text( text ) ); - return true; - } - return false; - }, - /** - * Gets an XMLHttpRequest or equivilant ActiveXObject - * - * @reuturn mixed request object on success, boolean false on failure - */ - 'sajax_init_object': function() { - mw.legacy.sajax_debug( 'sajax_init_object() called..' ); - var request = false; - try { - // Try the 'new' style before ActiveX so we don't unnecessarily trigger warnings in IE 7 when the user's - // security settings are set to prompt about ActiveX usage - request = new XMLHttpRequest(); - } catch ( e ) { - try { - request = new ActiveXObject( 'Msxml2.XMLHTTP' ); - } catch ( e ) { - try { - request = new ActiveXObject( 'Microsoft.XMLHTTP' ); - } catch ( oc ) { - request = null; - } - } - } - if ( !request ) { - mw.legacy.sajax_debug( 'Could not create connection object.' ); - } - return request; - }, - /** - * Performs an ajax call to mediawiki. Calls are handeled by AjaxDispatcher.php - * - * @param string method name of the function to call. Must be registered in $wgAjaxExportList - * @param array arguments arguments to that function - * @param mixed target the target that will handle the result of the call. If this is a function, if will be called - * with the XMLHttpRequest as a parameter; if it's an input element, its value will be set to the resultText; if - * it's another type of element, its innerHTML will be set to the resultText. - * - * @example - * // This will call the doFoo function via MediaWiki's AjaxDispatcher, with (1, 2, 3) as the parameter list, - * // and will show the result in the element with id = showFoo - * sajax_do_call( 'doFoo', [1, 2, 3], document.getElementById( 'showFoo' ) ); - */ - 'sajax_do_call': function( method, arguments, target ) { - var post_data; - var uri = mw.legacy.wgServer + - ( ( mw.legacy.wgScript == null ) ? ( mw.legacy.wgScriptPath + '/index.php' ) : mw.legacy.wgScript ) + - '?action=ajax'; - if ( mw.legacy.sajax_request_type == 'GET' ) { - if ( uri.indexOf( '?' ) == -1 ) { - uri = uri + '?rs=' + encodeURIComponent( method ); - } else { - uri = uri + '&rs=' + encodeURIComponent( method ); - } - for ( var i = 0; i < arguments.length; i++ ) { - uri = uri + '&rsargs[]=' + encodeURIComponent( arguments[i] ); - } - post_data = null; - } else { - post_data = 'rs=' + encodeURIComponent( method ); - for ( var i = 0; i < arguments.length; i++ ) { - post_data = post_data + '&rsargs[]=' + encodeURIComponent( arguments[i] ); - } - } - var request = mw.legacy.sajax_init_object(); - if ( !request ) { - alert( 'AJAX not supported' ); - return false; - } - try { - request.open( mw.legacy.sajax_request_type, uri, true ); - } catch ( e ) { - if ( window.location.hostname == 'localhost' ) { - alert( - 'Your browser blocks XMLHttpRequest to \'localhost\', ' + - 'try using a real hostname for development/testing.' - ); - } - throw e; - } - if ( mw.legacy.sajax_request_type == 'POST' ) { - request.setRequestHeader( 'Method', 'POST ' + uri + ' HTTP/1.1' ); - request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); - } - request.setRequestHeader( 'Pragma', 'cache=yes' ); - request.setRequestHeader( 'Cache-Control', 'no-transform' ); - request.onreadystatechange = function() { - if ( request.readyState != 4 ) { - return; - } - mw.legacy.sajax_debug( - 'received (' + request.status + ' ' + request.statusText + ') ' + request.responseText - ); - if ( typeof( target ) == 'function' ) { - target( request ); - } else if ( typeof( target ) == 'object' ) { - $target = $( target ); - if ( $target.is( 'input' ) ) { - if ( request.status == 200 ) { - $target.val(); - } - } else { - if ( request.status == 200 ) { - $target.html( request.responseText ); - } else { - $target.html( - '
' + - 'Error: ' + request.status + ' ' + request.statusText + - ' (' + request.responseText + ')' + - '
' - ); - } - } - } else { - alert( 'Bad target for sajax_do_call: not a function or object: ' + target ); - } - return; - } - mw.legacy.sajax_debug( method + ' uri = ' + uri + ' / post = ' + post_data ); - request.send( post_data ); - mw.legacy.sajax_debug( method + ' waiting..' ); - delete x; - return true; - }, - /** - * Ajax compatibility test - * - * @return boolean whether the browser supports XMLHttpRequest - */ - 'wfSupportsAjax': function() { - var request = mw.legacy.sajax_init_object(); - var result = request ? true : false; - delete request; - return result; - } -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.ajaxwatch.js b/resources/mediawiki/legacy/mediawiki.legacy.ajaxwatch.js deleted file mode 100644 index 4cf0ef3193..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.ajaxwatch.js +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/ajaxwatch.js - * - * AJAX functionality for the watch/unwatch link - * - * @depends mw.legacy.jsMsg() from mw.legacy.wikibits.js - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Global Variables */ - - 'wgAjaxWatch': { - - /* Global Variables */ - - 'watchMsg': 'Watch', - 'unwatchMsg': 'Unwatch', - 'watchingMsg': 'Watching...', - 'unwatchingMsg': 'Unwatching...', - 'tooltip-ca-watchMsg': 'Add this page to your watchlist', - 'tooltip-ca-unwatchMsg': 'Remove this page from your watchlist', - - /* Functions */ - - /** - * Sets the text of the watch/unwatch link - * - * @param object link DOM node or jQuery selection of link to set text of - * @param string action message to use ('watch', 'unwatch', 'watching' or 'unwatching') - */ - 'setLinkText': function( link, action ) { - var $link = $( link ); - if ( action == 'watch' || action == 'unwatch' ) { - // save the accesskey from the title - var keyCommand = $link.attr( 'title' ).match( /\[.*?\]$/ ) ? - $link.attr( 'title' ).match( /\[.*?\]$/ )[0] : ''; - $link.attr( 'title', wgAjaxWatch['tooltip-ca-' + action + 'Msg'] + ' ' + keyCommand ); - } - if ( $link.data( 'icon' ) ) { - $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] ); - if ( action == 'watching' || action == 'unwatching' ) { - $link.addClass( 'loading' ); - } else { - $link.removeClass( 'loading' ); - } - } else { - $link.html( wgAjaxWatch[action+'Msg'] ); - } - }, - /** - * Processes responses from the server - * - * @param object response data from server - */ - 'processResult': function( response ) { - response = response.watch; - var $link = $(this); - // To ensure we set the same status for all watch links with the same target we trigger a custom event on - // *all* watch links. - if ( response.watched !== undefined ) { - wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'watch'] ); - } else if ( response.unwatched !== undefined ){ - wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'unwatch'] ); - } else { - // Either we got an error code or it just plain broke. - window.location.href = $link.attr( 'href' ); - return; - } - mw.legacy.jsMsg( response.message, 'watch' ); - // Bug 12395 - update the watch checkbox on edit pages when the page is watched or unwatched via the tab. - if ( response.watched !== undefined ) { - $j( '#wpWatchthis' ).attr( 'checked', '1' ); - } else { - $j( '#wpWatchthis' ).removeAttr( 'checked' ); - } - } - } ); -} ); - -/* Initialization */ - -$( document ).ready( function() { - var $links = $( '.mw-watchlink a, a.mw-watchlink' ); - // BC with older skins... - $links = $links - .add( $( '#ca-watch a, #ca-unwatch a, a#mw-unwatch-link1' ) ) - .add( $( 'a#mw-unwatch-link2, a#mw-watch-link2, a#mw-watch-link1' ) ); - // ...allowing people to add inline animated links is a little scary - $links = $links.filter( ':not( #bodyContent *, #content * )' ); - $links.each( function() { - var $link = $(this); - $link - .data( 'icon', $link.parent().hasClass( 'icon' ) ) - .data( 'action', $link.attr( 'href' ).match( /[\?\&]action=unwatch/i ) ? 'unwatch' : 'watch' ); - var title = $link.attr( 'href' ).match( /[\?\&]title=(.*?)&/i )[1]; - $link.data( 'target', decodeURIComponent( title ).replace( /_/g, ' ' ) ); - } ); - $links.click( function( event ) { - var $link = $(this); - if ( mw.legacy.wgAjaxWatch.supported === false || !mw.legacy.wgEnableWriteAPI || !mw.legacy.wfSupportsAjax() ) { - // Lazy initialization so we don't toss up ActiveX warnings on initial page load for IE 6 users with - // security settings. - mw.legacy.wgAjaxWatch.$links.unbind( 'click' ); - return true; - } - mw.legacy.wgAjaxWatch.setLinkText( $link, $link.data( 'action' ) + 'ing' ); - var url = mw.legacy.wgScriptPath + '/api' + mw.legacy.wgScriptExtension + '?action=watch&format=json&title=' - + encodeURIComponent( $link.data( 'target' ) ) + ( $link.data( 'action' ) == 'unwatch' ? '&unwatch' : '' ); - $.get( url, {}, mw.legacy.wgAjaxWatch.processResult, 'json' ); - return false; - } ); - // When a request returns, a custom event 'mw-ajaxwatch' is triggered on *all* watch links, so they can be updated - // if necessary - $links.bind( 'mw-ajaxwatch', function( event, target, action ) { - var $link = $(this); - var foo = $link.data( 'target' ); - if ( $link.data( 'target' ) == target ) { - var otheraction = action == 'watch' ? 'unwatch' : 'watch'; - $link.data( 'action', otheraction ); - wgAjaxWatch.setLinkText( $link, otheraction ); - $link.attr( 'href', $link.attr( 'href' ).replace( '/&action=' + action + '/', '&action=' + otheraction ) ); - if ( $link.parent().attr( 'id' ) == 'ca-' + action ){ - $link.parent().attr( 'id', 'ca-' + otheraction ); - } - } - return false; - } ); - mw.legacy.wgAjaxWatch.$links = $links; -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.block.js b/resources/mediawiki/legacy/mediawiki.legacy.block.js deleted file mode 100644 index a187111838..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.block.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/block.js - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Functions */ - - 'considerChangingExpiryFocus': function() { - var $expiry = $( '#wpBlockExpiry' ); - var $other = $( '#wpBlockOther' ); - if ( $expiry.length && $other.length ) { - if ( $expiry.val() == 'other' ) { - $other.css( 'display', '' ); - } else { - $other.css( 'display', 'none' ); - } - } - }, - 'updateBlockOptions': function() { - var $target = $( '#mw-bi-target' ); - if ( $target.length ) { - var address = $target.val(); - var isEmpty = address.match( /^\s*$/ ); - var isIp = address.match( /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?$/ ); - var isIpRange = isIp && address.match( /\/\d+$/ ); - $( '#wpAnonOnlyRow' ).css( 'display', !isIp && !isEmpty ? 'none' : '' ); - $( '#wpEnableAutoblockRow,#wpEnableHideUser' ).css( 'display', isIp && !isEmpty ? 'none' : '' ); - $( '#wpEnableWatchUser' ).css( 'display', isIpRange && !isEmpty ? 'none' : '' ); - } - } -} ); - -/* Initialization */ - -$( document ).ready( function() { - mw.legacy.considerChangingExpiryFocus(); -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.changepassword.js b/resources/mediawiki/legacy/mediawiki.legacy.changepassword.js deleted file mode 100644 index 6920eed2fd..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.changepassword.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/changepassword.js - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Functions */ - - 'onNameChange': function() { - var state = mw.legacy.wgUserName != $( '#wpName' ).val(); - $( '#wpPassword' ).attr( 'disabled', state ); - $( '#wpComment' ).attr( 'disabled', !state ); - }, - 'onNameChangeHook': function() { - $( '#wpName' ).blur( mw.legacy.onNameChange ); - } -} ); - -/* Initialization */ - -$( document ).ready( function() { - mw.legacy.onNameChangeHook(); -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.edit.js b/resources/mediawiki/legacy/mediawiki.legacy.edit.js deleted file mode 100644 index 4beb883772..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.edit.js +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/edit.js - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Global Variables */ - - 'currentFocused': null, - - /* Functions */ - - /** - * Generates the actual toolbar buttons with localized text we use it to avoid creating the toolbar - * where javascript is not enabled - */ - 'addButton': function( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId ) { - // Don't generate buttons for browsers which don't fully support it. - mw.legacy.mwEditButtons.push( { - 'imageId': imageId, - 'imageFile': imageFile, - 'speedTip': speedTip, - 'tagOpen': tagOpen, - 'tagClose': tagClose, - 'sampleText': sampleText - } ); - }, - /** - * Generates the actual toolbar buttons with localized text we use it to avoid creating the toolbar where JavaScript - * is not enabled - */ - 'mwInsertEditButton': function( parent, item ) { - var $image = $( '' ) - .attr( { - 'width': 23, - 'height': 22, - 'class': 'mw-toolbar-editbutton', - 'id': item.imageId ? item.imageId : null, - 'src': = item.imageFile, - 'border': 0, - 'alt': item.speedTip, - 'title': item.speedTip - } ) - .css( 'cursor', 'pointer' ) - .click( function() { - mw.legacy.insertTags( item.tagOpen, item.tagClose, item.sampleText ); - // Click tracking - if ( typeof $.trackAction != 'undefined' ) { - $.trackAction( 'oldedit.' + item.speedTip.replace( / /g, '-' ) ); - } - return false; - } ) - .appendTo( $( parent ) ); - return true; - }, - /** - * Sets up the toolbar - */ - 'mwSetupToolbar': function() { - var $toolbar = $( '#toolbar' ); - var $textbox = $( 'textarea' ).get( 0 ); - if ( !$toolbar.length || !$textbox.length ) { - return false; - } - // Only check for selection capability if the textarea is visible - errors will occur otherwise - just because - // the textarea is not visible, doesn't mean we shouldn't build out the toolbar though - it might have been - // replaced with some other kind of control - if ( - $textbox.is( ':visible' ) && - !( document.selection && document.selection.createRange ) && - textboxes[0].selectionStart === null - ) { - return false; - } - for ( var i = 0; i < mw.legacy.mwEditButtons.length; i++ ) { - mw.legacy.mwInsertEditButton( $toolbar, mw.legacy.mwEditButtons[i] ); - } - for ( var i = 0; i < mw.legacy.mwCustomEditButtons.length; i++ ) { - mw.legacy.mwInsertEditButton( $toolbar, mw.legacy.mwCustomEditButtons[i] ); - } - return true; - }, - /** - * Apply tagOpen/tagClose to selection in textarea, use sampleText instead of selection if there is none - */ - 'insertTags': function( tagOpen, tagClose, sampleText ) { - function checkSelectedText() { - if ( !selText ) { - selText = sampleText; - isSample = true; - } else if ( selText.charAt( selText.length - 1 ) == ' ' ) { // exclude ending space char - selText = selText.substring( 0, selText.length - 1 ); - tagClose += ' '; - } - } - var currentFocused = $( mw.legacy.currentFocused ); - if ( - typeof $.fn.textSelection != 'undefined' && - ( $currentFocused.name().toLowerCase() == 'iframe' || $currentFocused.attr( 'id' ) == 'wpTextbox1' ) - ) { - $j( '#wpTextbox1' ).textSelection( - 'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose } - ); - return; - } - var $textarea; - if ( $( 'form[name=editform]' ) { - $textarea = $currentFocused; - } else { - // Some alternate form? take the first one we can find - $textarea = $( 'textarea' ).get( 0 ); - } - var selText, isSample = false; - // Text selection implementation for IE and Opera - if ( document.selection && document.selection.createRange ) { - // Save window scroll position - if ( document.documentElement && document.documentElement.scrollTop ) { - var winScroll = document.documentElement.scrollTop - } else if ( document.body ) { - var winScroll = document.body.scrollTop; - } - // Get current selection - $textarea.focus(); - var range = document.selection.createRange(); - selText = range.text; - // Insert tags - checkSelectedText(); - range.text = tagOpen + selText + tagClose; - // Mark sample text as selected - if ( isSample && range.moveStart ) { - if ( window.opera ) { - tagClose = tagClose.replace( /\n/g,'' ); - } - range.moveStart( 'character', - tagClose.length - selText.length ); - range.moveEnd( 'character', - tagClose.length ); - } - range.select(); - // Restore window scroll position - if ( document.documentElement && document.documentElement.scrollTop ) { - document.documentElement.scrollTop = winScroll; - } else if ( document.body ) { - document.body.scrollTop = winScroll; - } - } - // Text selection implementation for Mozilla, Chrome and Safari - else if ( $textarea[0].selectionStart || $textarea[0].selectionStart == '0' ) { - // Save textarea scroll position - var textScroll = $textarea.scrollTop; - // Get current selection - $textarea.focus(); - var startPos = $textarea[0].selectionStart; - var endPos = $textarea[0].selectionEnd; - selText = $textarea.value.substring( startPos, endPos ); - // Insert tags - checkSelectedText(); - $textarea.val( - $textarea.val().substring( 0, startPos ) + - tagOpen + selText + tagClose + - $textarea.val().substring( endPos, $textarea.val().length ) - ); - // Set new selection - if ( isSample ) { - $textarea[0].selectionStart = startPos + tagOpen.length; - $textarea[0].selectionEnd = startPos + tagOpen.length + selText.length; - } else { - $textarea[0].selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; - $textarea[0].selectionEnd = $textarea[0].selectionStart; - } - // Restore textarea scroll position - $textarea[0].scrollTop = textScroll; - } - }, - /** - * Restore the edit box scroll state following a preview operation, - * and set up a form submission handler to remember this state - */ - 'scrollEditBox': function() { - var $textbox = $( '#wpTextbox1' ); - var $scrollTop = $( '#wpScrolltop' ); - var $editForm = $( '#editform' ); - if ( $editForm.length && $textbox.length && $scrollTop.length ) { - if ( scrollTop.val() ) { - $textbox.scrollTop = $scrollTop.val(); - } - $editForm.submit( function() { - $scrollTop.val( $textbox.scrollTop ); - } ); - } - } -} ); - -/* Initialization */ - -$( document ).ready( function() { - mw.legacy.scrollEditBox(); - mw.legacy.mwSetupToolbar(); - mw.legacy.currentFocused = $( '#wpTextbox1' ).get( 0 ); - // http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html focus does not bubble normally, but using a - // trick we can do event delegation on the focus event on all text inputs to make the toolbox usable on all of them - $( '#editform' ).focus( function() { - $(this).each( function( e ) { - var elm = e.target || e.srcElement; - if ( !elm ) { - return; - } - var tagName = elm.tagName.toLowerCase(); - var type = elm.type || ''; - if ( tagName !== 'textarea' && tagName !== 'input' ) { - return; - } - if ( tagName === 'input' && type.toLowerCase() !== 'text' ) { - return; - } - mw.legacy.currentFocused = elm; - } ); - } ); - // HACK: make currentFocused work with the usability iframe - with proper focus detection support (HTML 5!) this'll - // be much cleaner - var $iframe = $j( '.wikiEditor-ui-text iframe' ); - if ( $iframe.length > 0 ) { - $j( $iframe.get( 0 ).contentWindow.document ) - // For IE - .add( $iframe.get( 0 ).contentWindow.document.body ) - .focus( function() { mw.legacy.currentFocused = $iframe.get( 0 ); } ); - } - // Make sure edit summary does not exceed byte limit - var $summary = $( '#wpSummary' ); - if ( !$summary.length ) { - return; - } - // L must be capitalized in length - $summary.get( 0 ).maxLength = 250; - $summary.keypress( function( e ) { - // First check to see if this is actually a character key being pressed. Based on key-event info from - // http://unixpapa.com/js/key.html note === sign, if undefined, still could be a real key - if ( e.which === 0 || e.charCode === 0 || e.ctrlKey || e.altKey || e.metaKey ) { - // A special key (backspace, etc) so don't interefere. - return true; - } - // This basically figures out how many bytes a utf-16 string (which is what js sees) will take in utf-8 by - // replacing a 2 byte character with 2 *'s, etc, and counting that. Note, surogate (\uD800-\uDFFF) characters - // are counted as 2 bytes, since theres two of them and the actual character takes 4 bytes in utf-8 (2*2=4). - // Might not work perfectly in edge cases such as such as illegal sequences, but that should never happen. - len = summary.value - .replace(/[\u0080-\u07FF\uD800-\uDFFF]/g, '**') - .replace(/[\u0800-\uD7FF\uE000-\uFFFF]/g, '***') - .length; - // 247 as this doesn't count character about to be inserted. - if ( len > 247 ) { - if ( e.preventDefault ) { - e.preventDefault(); - } - // IE - e.returnValue = false; - return false; - } - } ); -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.enhancedchanges.js b/resources/mediawiki/legacy/mediawiki.legacy.enhancedchanges.js deleted file mode 100644 index 00a0053591..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.enhancedchanges.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/enhancedchanges.js - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Functions */ - - /** - * Switch an RC line between hidden/shown - * - * @param integer idNumber : the id number of the RC group - */ - 'toggleVisibility': function( idNumber ) { - var elements = [ - '#mw-rc-openarrow-' + idNumber, - '#mw-rc-closearrow-' + idNumber, - '#mw-rc-subentries-' + idNumber - ]; - $( elements.join( ',' ) ).toggleClass( 'mw-changeslist-hidden' ).toggleClass( 'mw-changeslist-expanded' ); - } -} ); - -/* Initialization */ - -$( document ).ready( function() { - /* - * Add the CSS to hide parts that should be collapsed - * - * We do this with JS so everything will be expanded by default - * if JS is disabled - */ - $( 'head' ).append( - '' - ); -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.history.js b/resources/mediawiki/legacy/mediawiki.legacy.history.js deleted file mode 100644 index c23533f0a3..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.history.js +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/history.js - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Functions */ - - 'historyRadios': function( parent ) { - var inputs = parent.getElementsByTagName('input'); - var radios = []; - for (var i = 0; i < inputs.length; i++) { - if (inputs[i].name == 'diff' || inputs[i].name == 'oldid') { - radios[radios.length] = inputs[i]; - } - } - return radios; - }, - /* - * Check selection and tweak visibility/class onclick - */ - 'diffcheck': function() { - var dli = false; // the li where the diff radio is checked - var oli = false; // the li where the oldid radio is checked - var hf = document.getElementById('pagehistory'); - if (!hf) { - return true; - } - var lis = hf.getElementsByTagName('li'); - for (var i=0;i Results object - 'os_map': {}, - // cached data, url -> json_text - 'os_cache': {}, - // global variables for suggest_keypress - 'os_cur_keypressed': 0, - 'os_keypressed_count': 0, - // type: Timer - 'os_timer': null, - // tie mousedown/up events - 'os_mouse_pressed': false, - 'os_mouse_num': -1, - // if true, the last change was made by mouse (and not keyboard) - 'os_mouse_moved': false, - // delay between keypress and suggestion (in ms) - 'os_search_timeout': 250, - // these pairs of inputs/forms will be autoloaded at startup - 'os_autoload_inputs': new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText'), - 'os_autoload_forms': new Array('searchform', 'searchform2', 'powersearch', 'search' ), - // if we stopped the service - 'os_is_stopped': false, - // max lines to show in suggest table - 'os_max_lines_per_suggest': 7, - // number of steps to animate expansion/contraction of container width - 'os_animation_steps': 6, - // num of pixels of smallest step - 'os_animation_min_step': 2, - // delay between steps (in ms) - 'os_animation_delay': 30, - // max width of container in percent of normal size (1 == 100%) - 'os_container_max_width': 2, - // currently active animation timer - 'os_animation_timer': null, - // is a new HTML5 element that allows you to manually supply - // suggestion lists and have them rendered according to the right platform - // conventions. However, the only shipping browser as of early 2010 is Opera, - // and that has a fatal problem: the suggestion lags behind what the user types - // by one keypress. (Reported as DSK-276870 to Opera's secret bug tracker.) - // The code here otherwise seems to work, though, so this can be flipped on - // (maybe with a UA check) when some browser has a better implementation. - // 'os_use_datalist': 'list' in document.createElement( 'input' ), - 'os_use_datalist': false, - - /* Functions */ - - /** - * Timeout timer class that will fetch the results - */ - 'os_Timer': function( id, r, query ) { - this.id = id; - this.r = r; - this.query = query; - }, - /** - * Property class for single search box - */ - 'os_Results': function( name, formname ) { - this.searchform = formname; // id of the searchform - this.searchbox = name; // id of the searchbox - this.container = name + 'Suggest'; // div that holds results - this.resultTable = name + 'Result'; // id base for the result table (+num = table row) - this.resultText = name + 'ResultText'; // id base for the spans within result tables (+num) - this.toggle = name + 'Toggle'; // div that has the toggle (enable/disable) link - this.query = null; // last processed query - this.results = null; // parsed titles - this.resultCount = 0; // number of results - this.original = null; // query that user entered - this.selected = -1; // which result is selected - this.containerCount = 0; // number of results visible in container - this.containerRow = 0; // height of result field in the container - this.containerTotal = 0; // total height of the container will all results - this.visible = false; // if container is visible - this.stayHidden = false; // don't try to show if lost focus - }, - /** - * Timer user to animate expansion/contraction of container width - */ - 'os_AnimationTimer': function( r, target ) { - this.r = r; - var current = document.getElementById(r.container).offsetWidth; - this.inc = Math.round( ( target - current ) / os_animation_steps ); - if( this.inc < os_animation_min_step && this.inc >=0 ) { - this.inc = os_animation_min_step; // minimal animation step - } - if( this.inc > -os_animation_min_step && this.inc < 0 ) { - this.inc = -os_animation_min_step; - } - this.target = target; - }, - - /* Intialization Functions */ - - /** - * Initialization, call upon page onload - */ - 'os_MWSuggestInit': function() { - for( i = 0; i < os_autoload_inputs.length; i++ ) { - var id = os_autoload_inputs[i]; - var form = os_autoload_forms[i]; - element = document.getElementById( id ); - if( element != null ) { - os_initHandlers( id, form, element ); - } - } - }, - /** - * Init Result objects and event handlers - */ - 'os_initHandlers': function( name, formname, element ) { - var r = new os_Results( name, formname ); - var formElement = document.getElementById( formname ); - if( !formElement ) { - // Older browsers (Opera 8) cannot get form elements - return; - } - // event handler - os_hookEvent( element, 'keyup', function( event ) { os_eventKeyup( event ); } ); - os_hookEvent( element, 'keydown', function( event ) { os_eventKeydown( event ); } ); - os_hookEvent( element, 'keypress', function( event ) { os_eventKeypress( event ); } ); - if ( !os_use_datalist ) { - // These are needed for the div hack to hide it if the user blurs. - os_hookEvent( element, 'blur', function( event ) { os_eventBlur( event ); } ); - os_hookEvent( element, 'focus', function( event ) { os_eventFocus( event ); } ); - // We don't want browser auto-suggestions interfering with our div, but - // autocomplete must be on for datalist to work (at least in Opera - // 10.10). - element.setAttribute( 'autocomplete', 'off' ); - } - // stopping handler - os_hookEvent( formElement, 'submit', function( event ) { return os_eventOnsubmit( event ); } ); - os_map[name] = r; - // toggle link - if( document.getElementById( r.toggle ) == null ) { - // TODO: disable this while we figure out a way for this to work in all browsers - /* if( name == 'searchInput' ) { - // special case: place above the main search box - var t = os_createToggle( r, 'os-suggest-toggle' ); - var searchBody = document.getElementById( 'searchBody' ); - var first = searchBody.parentNode.firstChild.nextSibling.appendChild(t); - } else { - // default: place below search box to the right - var t = os_createToggle( r, 'os-suggest-toggle-def' ); - var top = element.offsetTop + element.offsetHeight; - var left = element.offsetLeft + element.offsetWidth; - t.style.position = 'absolute'; - t.style.top = top + 'px'; - t.style.left = left + 'px'; - element.parentNode.appendChild( t ); - // only now width gets calculated, shift right - left -= t.offsetWidth; - t.style.left = left + 'px'; - t.style.visibility = 'visible'; - } */ - } - }, - 'os_hookEvent': function( element, hookName, hookFunct ) { - if ( element.addEventListener ) { - element.addEventListener( hookName, hookFunct, false ); - } else if ( window.attachEvent ) { - element.attachEvent( 'on' + hookName, hookFunct ); - } - }, - - /* Keyboard Event Functions */ - - /** - * Event handler that will fetch results on keyup - */ - 'os_eventKeyup': function( e ) { - var targ = os_getTarget( e ); - var r = os_map[targ.id]; - if( r == null ) { - return; // not our event - } - - // some browsers won't generate keypressed for arrow keys, catch it - if( os_keypressed_count == 0 ) { - os_processKey( r, os_cur_keypressed, targ ); - } - var query = targ.value; - os_fetchResults( r, query, os_search_timeout ); - }, - /** - * Catch arrows up/down and escape to hide the suggestions - */ - 'os_processKey': function( r, keypressed, targ ) { - if ( keypressed == 40 && !r.visible && os_timer == null ) { - // If the user hits the down arrow, fetch results immediately if none - // are already displayed. - r.query = ''; - os_fetchResults( r, targ.value, 0 ); - } - // Otherwise, if we're not using datalist, we need to handle scrolling and - // so on. - if ( os_use_datalist ) { - return; - } - if ( keypressed == 40 ) { // Arrow Down - if ( r.visible ) { - os_changeHighlight( r, r.selected, r.selected + 1, true ); - } - } else if ( keypressed == 38 ) { // Arrow Up - if ( r.visible ) { - os_changeHighlight( r, r.selected, r.selected - 1, true ); - } - } else if( keypressed == 27 ) { // Escape - document.getElementById( r.searchbox ).value = r.original; - r.query = r.original; - os_hideResults( r ); - } else if( r.query != document.getElementById( r.searchbox ).value ) { - // os_hideResults( r ); // don't show old suggestions - } - }, - /** - * When keys is held down use a timer to output regular events - */ - 'os_eventKeypress': function( e ) { - var targ = os_getTarget( e ); - var r = os_map[targ.id]; - if( r == null ) { - return; // not our event - } - - var keypressed = os_cur_keypressed; - - os_keypressed_count++; - os_processKey( r, keypressed, targ ); - }, - /** - * Catch the key code (Firefox bug) - */ - 'os_eventKeydown': function( e ) { - if ( !e ) { - e = window.event; - } - var targ = os_getTarget( e ); - var r = os_map[targ.id]; - if( r == null ) { - return; // not our event - } - - os_mouse_moved = false; - - os_cur_keypressed = ( e.keyCode == undefined ) ? e.which : e.keyCode; - os_keypressed_count = 0; - }, - /** - * When the form is submitted hide everything, cancel updates... - */ - 'os_eventOnsubmit': function( e ) { - var targ = os_getTarget( e ); - - os_is_stopped = true; - // kill timed requests - if( os_timer != null && os_timer.id != null ) { - clearTimeout( os_timer.id ); - os_timer = null; - } - // Hide all suggestions - for( i = 0; i < os_autoload_inputs.length; i++ ) { - var r = os_map[os_autoload_inputs[i]]; - if( r != null ) { - var b = document.getElementById( r.searchform ); - if( b != null && b == targ ) { - // set query value so the handler won't try to fetch additional results - r.query = document.getElementById( r.searchbox ).value; - } - os_hideResults( r ); - } - } - return true; - }, - /** - * Hide results from the user, either making the div visibility=hidden or detaching the datalist from the input. - */ - 'os_hideResults': function( r ) { - if ( os_use_datalist ) { - document.getElementById( r.searchbox ).setAttribute( 'list', '' ); - } else { - var c = document.getElementById( r.container ); - if ( c != null ) { - c.style.visibility = 'hidden'; - } - } - r.visible = false; - r.selected = -1; - }, - 'os_decodeValue': function( value ) { - if ( decodeURIComponent ) { - return decodeURIComponent( value ); - } - if( unescape ) { - return unescape( value ); - } - return null; - }, - 'os_encodeQuery': function( value ) { - if ( encodeURIComponent ) { - return encodeURIComponent( value ); - } - if( escape ) { - return escape( value ); - } - return null; - }, - /** - * Handles data from XMLHttpRequest, and updates the suggest results - */ - 'os_updateResults': function( r, query, text, cacheKey ) { - os_cache[cacheKey] = text; - r.query = query; - r.original = query; - if( text == '' ) { - r.results = null; - r.resultCount = 0; - os_hideResults( r ); - } else { - try { - var p = eval( '(' + text + ')' ); // simple json parse, could do a safer one - if( p.length < 2 || p[1].length == 0 ) { - r.results = null; - r.resultCount = 0; - os_hideResults( r ); - return; - } - if ( os_use_datalist ) { - os_setupDatalist( r, p[1] ); - } else { - os_setupDiv( r, p[1] ); - } - } catch( e ) { - // bad response from server or such - os_hideResults( r ); - os_cache[cacheKey] = null; - } - } - }, - /** - * Create and populate a . - * - * @param r os_Result object - * @param results Array of the new results to replace existing ones - */ - 'os_setupDatalist': function( r, results ) { - var s = document.getElementById( r.searchbox ); - var c = document.getElementById( r.container ); - if ( c == null ) { - c = document.createElement( 'datalist' ); - c.setAttribute( 'id', r.container ); - document.body.appendChild( c ); - } else { - c.innerHTML = ''; - } - s.setAttribute( 'list', r.container ); - - r.results = new Array(); - r.resultCount = results.length; - r.visible = true; - for ( i = 0; i < results.length; i++ ) { - var title = os_decodeValue( results[i] ); - var opt = document.createElement( 'option' ); - opt.value = title; - r.results[i] = title; - c.appendChild( opt ); - } - }, - /** - * Fetch namespaces from checkboxes or hidden fields in the search form, if none defined use wgSearchNamespaces - * global - */ - 'os_getNamespaces': function( r ) { - var namespaces = ''; - var elements = document.forms[r.searchform].elements; - for( i = 0; i < elements.length; i++ ) { - var name = elements[i].name; - if( typeof name != 'undefined' && name.length > 2 && name[0] == 'n' && - name[1] == 's' && ( - ( elements[i].type == 'checkbox' && elements[i].checked ) || - ( elements[i].type == 'hidden' && elements[i].value == '1' ) - ) - ) { - if( namespaces != '' ) { - namespaces += '|'; - } - namespaces += name.substring( 2 ); - } - } - if( namespaces == '' ) { - namespaces = wgSearchNamespaces.join('|'); - } - return namespaces; - }, - /** - * Update results if user hasn't already typed something else - */ - 'os_updateIfRelevant': function( r, query, text, cacheKey ) { - var t = document.getElementById( r.searchbox ); - if( t != null && t.value == query ) { // check if response is still relevant - os_updateResults( r, query, text, cacheKey ); - } - r.query = query; - }, - /** - * Fetch results after some timeout - */ - 'os_delayedFetch': function() { - if( os_timer == null ) { - return; - } - var r = os_timer.r; - var query = os_timer.query; - os_timer = null; - var path = wgMWSuggestTemplate.replace( '{namespaces}', os_getNamespaces( r ) ) - .replace( '{dbname}', wgDBname ) - .replace( '{searchTerms}', os_encodeQuery( query ) ); - // try to get from cache, if not fetch using ajax - var cached = os_cache[path]; - if( cached != null && cached != undefined ) { - os_updateIfRelevant( r, query, cached, path ); - } else { - var xmlhttp = sajax_init_object(); - if( xmlhttp ) { - try { - xmlhttp.open( 'GET', path, true ); - xmlhttp.onreadystatechange = function() { - if ( xmlhttp.readyState == 4 && typeof os_updateIfRelevant == 'function' ) { - os_updateIfRelevant( r, query, xmlhttp.responseText, path ); - } - }; - xmlhttp.send( null ); - } catch ( e ) { - if ( window.location.hostname == 'localhost' ) { - alert( 'Your browser blocks XMLHttpRequest to "localhost", try using a real hostname for development/testing.' ); - } - throw e; - } - } - } - }, - /** - * Init timed update via os_delayedUpdate() - */ - 'os_fetchResults': function( r, query, timeout ) { - if( query == '' ) { - r.query = ''; - os_hideResults( r ); - return; - } else if( query == r.query ) { - return; // no change - } - - os_is_stopped = false; // make sure we're running - - // cancel any pending fetches - if( os_timer != null && os_timer.id != null ) { - clearTimeout( os_timer.id ); - } - // schedule delayed fetching of results - if( timeout != 0 ) { - os_timer = new os_Timer( setTimeout( 'os_delayedFetch()', timeout ), r, query ); - } else { - os_timer = new os_Timer( null, r, query ); - os_delayedFetch(); // do it now! - } - }, - /** - * Find event target - */ - 'os_getTarget': function( e ) { - if ( !e ) { - e = window.event; - } - if ( e.target ) { - return e.target; - } else if ( e.srcElement ) { - return e.srcElement; - } else { - return null; - } - }, - /** - * Check if x is a valid integer - */ - 'os_isNumber': function( x ) { - if( x == '' || isNaN( x ) ) { - return false; - } - for( var i = 0; i < x.length; i++ ) { - var c = x.charAt( i ); - if( !( c >= '0' && c <= '9' ) ) { - return false; - } - } - return true; - }, - /** - * Call this to enable suggestions on input (id=inputId), on a form (name=formName) - */ - 'os_enableSuggestionsOn': function( inputId, formName ) { - os_initHandlers( inputId, formName, document.getElementById( inputId ) ); - }, - /** - * Call this to disable suggestios on input box (id=inputId) - */ - 'os_disableSuggestionsOn': function( inputId ) { - r = os_map[inputId]; - if( r != null ) { - // cancel/hide results - os_timer = null; - os_hideResults( r ); - // turn autocomplete on ! - document.getElementById( inputId ).setAttribute( 'autocomplete', 'on' ); - // remove descriptor - os_map[inputId] = null; - } - - // Remove the element from the os_autoload_* arrays - var index = os_autoload_inputs.indexOf( inputId ); - if ( index >= 0 ) { - os_autoload_inputs[index] = os_autoload_forms[index] = ''; - } - }, - - /* Div-only Functions */ - - /** - * Event: loss of focus of input box - */ - 'os_eventBlur': function( e ) { - var targ = os_getTarget( e ); - var r = os_map[targ.id]; - if( r == null ) { - return; // not our event - } - if( !os_mouse_pressed ) { - os_hideResults( r ); - // force canvas to stay hidden - r.stayHidden = true; - // cancel any pending fetches - if( os_timer != null && os_timer.id != null ) { - clearTimeout( os_timer.id ); - } - os_timer = null; - } - }, - /** - * Event: focus (catch only when stopped) - */ - 'os_eventFocus': function( e ) { - var targ = os_getTarget( e ); - var r = os_map[targ.id]; - if( r == null ) { - return; // not our event - } - r.stayHidden = false; - }, - /** - * Create and populate a
, for non--supporting browsers. - * - * @param r os_Result object - * @param results Array of the new results to replace existing ones - */ - 'os_setupDiv': function( r, results ) { - var c = document.getElementById( r.container ); - if ( c == null ) { - c = os_createContainer( r ); - } - c.innerHTML = os_createResultTable( r, results ); - // init container table sizes - var t = document.getElementById( r.resultTable ); - r.containerTotal = t.offsetHeight; - r.containerRow = t.offsetHeight / r.resultCount; - os_fitContainer( r ); - os_trimResultText( r ); - os_showResults( r ); - }, - /** - * Create the result table to be placed in the container div - */ - 'os_createResultTable': function( r, results ) { - var c = document.getElementById( r.container ); - var width = c.offsetWidth - os_operaWidthFix( c.offsetWidth ); - var html = ''; - r.results = new Array(); - r.resultCount = results.length; - for( i = 0; i < results.length; i++ ) { - var title = os_decodeValue( results[i] ); - r.results[i] = title; - html += ''; - } - html += '
' + title + '
'; - return html; - }, - /** - * Show results div - */ - 'os_showResults': function( r ) { - if( os_is_stopped ) { - return; - } - if( r.stayHidden ) { - return; - } - os_fitContainer( r ); - var c = document.getElementById( r.container ); - r.selected = -1; - if( c != null ) { - c.scrollTop = 0; - c.style.visibility = 'visible'; - r.visible = true; - } - }, - 'os_operaWidthFix': function( x ) { - // For browsers that don't understand overflow-x, estimate scrollbar width - if( typeof document.body.style.overflowX != 'string' ) { - return 30; - } - return 0; - }, - - /* Brower-dependent Functions */ - - 'f_clientWidth': function() { - return f_filterResults( - window.innerWidth ? window.innerWidth : 0, - document.documentElement ? document.documentElement.clientWidth : 0, - document.body ? document.body.clientWidth : 0 - ); - }, - 'f_clientHeight': function() { - return f_filterResults( - window.innerHeight ? window.innerHeight : 0, - document.documentElement ? document.documentElement.clientHeight : 0, - document.body ? document.body.clientHeight : 0 - ); - }, - 'f_scrollLeft': function() { - return f_filterResults( - window.pageXOffset ? window.pageXOffset : 0, - document.documentElement ? document.documentElement.scrollLeft : 0, - document.body ? document.body.scrollLeft : 0 - ); - }, - 'f_scrollTop': function() { - return f_filterResults( - window.pageYOffset ? window.pageYOffset : 0, - document.documentElement ? document.documentElement.scrollTop : 0, - document.body ? document.body.scrollTop : 0 - ); - }, - 'f_filterResults': function( n_win, n_docel, n_body ) { - var n_result = n_win ? n_win : 0; - if ( n_docel && ( !n_result || ( n_result > n_docel ) ) ) { - n_result = n_docel; - } - return n_body && ( !n_result || ( n_result > n_body ) ) ? n_body : n_result; - }, - /** - * Get the height available for the results container - */ - 'os_availableHeight': function( r ) { - var absTop = document.getElementById( r.container ).style.top; - var px = absTop.lastIndexOf( 'px' ); - if( px > 0 ) { - absTop = absTop.substring( 0, px ); - } - return f_clientHeight() - ( absTop - f_scrollTop() ); - }, - /** - * Get element absolute position {left,top} - */ - 'os_getElementPosition': function( elemID ) { - var offsetTrail = document.getElementById( elemID ); - var offsetLeft = 0; - var offsetTop = 0; - while ( offsetTrail ) { - offsetLeft += offsetTrail.offsetLeft; - offsetTop += offsetTrail.offsetTop; - offsetTrail = offsetTrail.offsetParent; - } - if ( navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined' ) { - offsetLeft += document.body.leftMargin; - offsetTop += document.body.topMargin; - } - return { left:offsetLeft, top:offsetTop }; - }, - /** - * Create the container div that will hold the suggested titles - */ - 'os_createContainer': function( r ) { - var c = document.createElement( 'div' ); - var s = document.getElementById( r.searchbox ); - var pos = os_getElementPosition( r.searchbox ); - var left = pos.left; - var top = pos.top + s.offsetHeight; - c.className = 'os-suggest'; - c.setAttribute( 'id', r.container ); - document.body.appendChild( c ); - - // dynamically generated style params - // IE workaround, cannot explicitely set "style" attribute - c = document.getElementById( r.container ); - c.style.top = top + 'px'; - c.style.left = left + 'px'; - c.style.width = s.offsetWidth + 'px'; - - // mouse event handlers - c.onmouseover = function( event ) { os_eventMouseover( r.searchbox, event ); }; - c.onmousemove = function( event ) { os_eventMousemove( r.searchbox, event ); }; - c.onmousedown = function( event ) { return os_eventMousedown( r.searchbox, event ); }; - c.onmouseup = function( event ) { os_eventMouseup( r.searchbox, event ); }; - return c; - }, - /** - * Change container height to fit to screen - */ - 'os_fitContainer': function( r ) { - var c = document.getElementById( r.container ); - var h = os_availableHeight( r ) - 20; - var inc = r.containerRow; - h = parseInt( h / inc ) * inc; - if( h < ( 2 * inc ) && r.resultCount > 1 ) { // min: two results - h = 2 * inc; - } - if( ( h / inc ) > os_max_lines_per_suggest ) { - h = inc * os_max_lines_per_suggest; - } - if( h < r.containerTotal ) { - c.style.height = h + 'px'; - r.containerCount = parseInt( Math.round( h / inc ) ); - } else { - c.style.height = r.containerTotal + 'px'; - r.containerCount = r.resultCount; - } - }, - /** - * If some entries are longer than the box, replace text with "..." - */ - 'os_trimResultText': function( r ) { - // find max width, first see if we could expand the container to fit it - var maxW = 0; - for( var i = 0; i < r.resultCount; i++ ) { - var e = document.getElementById( r.resultText + i ); - if( e.offsetWidth > maxW ) { - maxW = e.offsetWidth; - } - } - var w = document.getElementById( r.container ).offsetWidth; - var fix = 0; - if( r.containerCount < r.resultCount ) { - fix = 20; // give 20px for scrollbar - } else { - fix = os_operaWidthFix( w ); - } - if( fix < 4 ) { - fix = 4; // basic padding - } - maxW += fix; - - // resize container to fit more data if permitted - var normW = document.getElementById( r.searchbox ).offsetWidth; - var prop = maxW / normW; - if( prop > os_container_max_width ) { - prop = os_container_max_width; - } else if( prop < 1 ) { - prop = 1; - } - var newW = Math.round( normW * prop ); - if( w != newW ) { - w = newW; - if( os_animation_timer != null ) { - clearInterval( os_animation_timer.id ); - } - os_animation_timer = new os_AnimationTimer( r, w ); - os_animation_timer.id = setInterval( 'os_animateChangeWidth()', os_animation_delay ); - w -= fix; // this much is reserved - } - - // trim results - if( w < 10 ) { - return; - } - for( var i = 0; i < r.resultCount; i++ ) { - var e = document.getElementById( r.resultText + i ); - var replace = 1; - var lastW = e.offsetWidth + 1; - var iteration = 0; - var changedText = false; - while( e.offsetWidth > w && ( e.offsetWidth < lastW || iteration < 2 ) ) { - changedText = true; - lastW = e.offsetWidth; - var l = e.innerHTML; - e.innerHTML = l.substring( 0, l.length - replace ) + '...'; - iteration++; - replace = 4; // how many chars to replace - } - if( changedText ) { - // show hint for trimmed titles - document.getElementById( r.resultTable + i ).setAttribute( 'title', r.results[i] ); - } - } - }, - /** - * Invoked on timer to animate change in container width - */ - 'os_animateChangeWidth': function() { - var r = os_animation_timer.r; - var c = document.getElementById( r.container ); - var w = c.offsetWidth; - var normW = document.getElementById( r.searchbox ).offsetWidth; - var normL = os_getElementPosition( r.searchbox ).left; - var inc = os_animation_timer.inc; - var target = os_animation_timer.target; - var nw = w + inc; - if( ( inc > 0 && nw >= target ) || ( inc <= 0 && nw <= target ) ) { - // finished ! - c.style.width = target + 'px'; - clearInterval( os_animation_timer.id ); - os_animation_timer = null; - } else { - // in-progress - c.style.width = nw + 'px'; - if( document.documentElement.dir == 'rtl' ) { - c.style.left = ( normL + normW + ( target - nw ) - os_animation_timer.target - 1 ) + 'px'; - } - } - }, - /** - * Change the highlighted row (i.e. suggestion), from position cur to next - */ - 'os_changeHighlight': function( r, cur, next, updateSearchBox ) { - if ( next >= r.resultCount ) { - next = r.resultCount - 1; - } - if ( next < -1 ) { - next = -1; - } - r.selected = next; - if ( cur == next ) { - return; // nothing to do. - } - - if( cur >= 0 ) { - var curRow = document.getElementById( r.resultTable + cur ); - if( curRow != null ) { - curRow.className = 'os-suggest-result'; - } - } - var newText; - if( next >= 0 ) { - var nextRow = document.getElementById( r.resultTable + next ); - if( nextRow != null ) { - nextRow.className = os_HighlightClass(); - } - newText = r.results[next]; - } else { - newText = r.original; - } - - // adjust the scrollbar if any - if( r.containerCount < r.resultCount ) { - var c = document.getElementById( r.container ); - var vStart = c.scrollTop / r.containerRow; - var vEnd = vStart + r.containerCount; - if( next < vStart ) { - c.scrollTop = next * r.containerRow; - } else if( next >= vEnd ) { - c.scrollTop = ( next - r.containerCount + 1 ) * r.containerRow; - } - } - - // update the contents of the search box - if( updateSearchBox ) { - os_updateSearchQuery( r, newText ); - } - }, - 'os_HighlightClass': function() { - var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/); - if ( match ) { - var webKitVersion = parseInt( match[1] ); - if ( webKitVersion < 523 ) { - // CSS system highlight colors broken on old Safari - // https://bugs.webkit.org/show_bug.cgi?id=6129 - // Safari 3.0.4, 3.1 known ok - return 'os-suggest-result-hl-webkit'; - } - } - return 'os-suggest-result-hl'; - }, - 'os_updateSearchQuery': function( r, newText ) { - document.getElementById( r.searchbox ).value = newText; - r.query = newText; - }, - - /* Mouse Event Functions */ - - /** - * Mouse over the container - */ - 'os_eventMouseover': function( srcId, e ) { - var targ = os_getTarget( e ); - var r = os_map[srcId]; - if( r == null || !os_mouse_moved ) { - return; // not our event - } - var num = os_getNumberSuffix( targ.id ); - if( num >= 0 ) { - os_changeHighlight( r, r.selected, num, false ); - } - }, - /** - * Get row where the event occured (from its id) - */ - 'os_getNumberSuffix': function( id ) { - var num = id.substring( id.length - 2 ); - if( !( num.charAt( 0 ) >= '0' && num.charAt( 0 ) <= '9' ) ) { - num = num.substring( 1 ); - } - if( os_isNumber( num ) ) { - return parseInt( num ); - } else { - return -1; - } - }, - /** - * Save mouse move as last action - */ - 'os_eventMousemove': function( srcId, e ) { - os_mouse_moved = true; - }, - /** - * Mouse button held down, register possible click - */ - 'os_eventMousedown': function( srcId, e ) { - var targ = os_getTarget( e ); - var r = os_map[srcId]; - if( r == null ) { - return; // not our event - } - var num = os_getNumberSuffix( targ.id ); - - os_mouse_pressed = true; - if( num >= 0 ) { - os_mouse_num = num; - // os_updateSearchQuery( r, r.results[num] ); - } - // keep the focus on the search field - document.getElementById( r.searchbox ).focus(); - - return false; // prevents selection - }, - /** - * Mouse button released, check for click on some row - */ - 'os_eventMouseup': function( srcId, e ) { - var targ = os_getTarget( e ); - var r = os_map[srcId]; - if( r == null ) { - return; // not our event - } - var num = os_getNumberSuffix( targ.id ); - - if( num >= 0 && os_mouse_num == num ) { - os_updateSearchQuery( r, r.results[num] ); - os_hideResults( r ); - document.getElementById( r.searchform ).submit(); - } - os_mouse_pressed = false; - // keep the focus on the search field - document.getElementById( r.searchbox ).focus(); - }, - /** - * Return the span element that contains the toggle link (dead code?) - */ - 'os_createToggle': function( r, className ) { - var t = document.createElement( 'span' ); - t.className = className; - t.setAttribute( 'id', r.toggle ); - var link = document.createElement( 'a' ); - link.setAttribute( 'href', 'javascript:void(0);' ); - link.onclick = function() { os_toggle( r.searchbox, r.searchform ); }; - var msg = document.createTextNode( wgMWSuggestMessages[0] ); - link.appendChild( msg ); - t.appendChild( link ); - return t; - }, - /** - * Call when user clicks on some of the toggle links (dead code?) - */ - 'os_toggle': function( inputId, formName ) { - r = os_map[inputId]; - var msg = ''; - if( r == null ) { - os_enableSuggestionsOn( inputId, formName ); - r = os_map[inputId]; - msg = wgMWSuggestMessages[0]; - } else{ - os_disableSuggestionsOn( inputId, formName ); - msg = wgMWSuggestMessages[1]; - } - // change message - var link = document.getElementById( r.toggle ).firstChild; - link.replaceChild( document.createTextNode( msg ), link.firstChild ); - } -} ); - -/* Initialization */ - -$( document ).ready( function() { - mw.legacy.os_MWSuggestInit(); -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.prefs.js b/resources/mediawiki/legacy/mediawiki.legacy.prefs.js deleted file mode 100644 index 55d6e0d686..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.prefs.js +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/prefs.js - * - * Generate toc from prefs form, fold sections - * - * FIXME: Needs testing on IE/Mac and Safari - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Functions */ - - 'tabbedprefs': function() { - var prefform = document.getElementById( 'preferences' ); - if ( !prefform || !document.createElement ) { - return; - } - if ( prefform.nodeName.toLowerCase() == 'a' ) { - return; // Occasional IE problem - } - prefform.className = prefform.className + 'jsprefs'; - var sections = []; - var children = prefform.childNodes; - var seci = 0; - for ( var i = 0; i < children.length; i++ ) { - if ( children[i].nodeName.toLowerCase() == 'fieldset' ) { - children[i].id = 'prefsection-' + seci; - children[i].className = 'prefsection'; - if ( is_opera ) { - children[i].className = 'prefsection operaprefsection'; - } - var legends = children[i].getElementsByTagName('legend'); - sections[seci] = {}; - if ( legends[0] ) { - legends[0].className = 'mainLegend'; - } - if ( legends[0] && legends[0].firstChild.nodeValue ) { - sections[seci].text = legends[0].firstChild.nodeValue; - } else { - sections[seci].text = '# ' + seci; - } - sections[seci].secid = children[i].id; - seci++; - if ( sections.length != 1 ) { - children[i].style.display = 'none'; - } else { - var selectedid = children[i].id; - } - } - } - var toc = document.createElement( 'ul' ); - toc.id = 'preftoc'; - toc.selectedid = selectedid; - for ( i = 0; i < sections.length; i++ ) { - var li = document.createElement( 'li' ); - if ( i === 0 ) { - li.className = 'selected'; - } - var a = document.createElement( 'a' ); - a.href = '#' + sections[i].secid; - a.onmousedown = a.onclick = uncoversection; - a.appendChild( document.createTextNode( sections[i].text ) ); - a.secid = sections[i].secid; - li.appendChild( a ); - toc.appendChild( li ); - } - prefform.parentNode.insertBefore( toc, prefform.parentNode.childNodes[0] ); - document.getElementById( 'prefsubmit' ).id = 'prefcontrol'; - }, - 'uncoversection': function() { - var oldsecid = this.parentNode.parentNode.selectedid; - var newsec = document.getElementById( this.secid ); - if ( oldsecid != this.secid ) { - var ul = document.getElementById( 'preftoc' ); - document.getElementById( oldsecid ).style.display = 'none'; - newsec.style.display = 'block'; - ul.selectedid = this.secid; - var lis = ul.getElementsByTagName( 'li' ); - for ( var i = 0; i< lis.length; i++ ) { - lis[i].className = ''; - } - this.parentNode.className = 'selected'; - } - return false; - }, - /** - * Timezone stuff tz in format [+-]HHMM - */ - 'checkTimezone': function( tz, msg ) { - var localclock = new Date(); - // returns negative offset from GMT in minutes - var tzRaw = localclock.getTimezoneOffset(); - var tzHour = Math.floor( Math.abs( tzRaw ) / 60 ); - var tzMin = Math.abs( tzRaw ) % 60; - var tzString = ( ( tzRaw >= 0 ) ? '-' : '+' ) + ( ( tzHour < 10 ) ? '0' : '' ) + tzHour + ( ( tzMin < 10 ) ? '0' : '' ) + tzMin; - if ( tz != tzString ) { - var junk = msg.split('$1'); - document.write( junk[0] + 'UTC' + tzString + junk[1] ); - } - }, - 'timezoneSetup': function() { - var tzSelect = document.getElementById( 'mw-input-timecorrection' ); - var tzTextbox = document.getElementById( 'mw-input-timecorrection-other' ); - - if ( tzSelect && tzTextbox ) { - addHandler( tzSelect, 'change', function( e ) { updateTimezoneSelection( false ); } ); - addHandler( tzTextbox, 'blur', function( e ) { updateTimezoneSelection( true ); } ); - } - - updateTimezoneSelection( false ); - }, - /** - * Timezone stuff tz in format [-]HH:MM - won't yet work with non-even tzs - */ - 'fetchTimezone': function() { - // FIXME: work around Safari bug - var localclock = new Date(); - // returns negative offset from GMT in minutes - var tzRaw = localclock.getTimezoneOffset(); - var tzHour = Math.floor( Math.abs( tzRaw ) / 60 ); - var tzMin = Math.abs( tzRaw ) % 60; - var tzString = ( ( tzRaw >= 0 ) ? '-' : '' ) + ( ( tzHour < 10 ) ? '0' : '' ) + tzHour + - ':' + ( ( tzMin < 10 ) ? '0' : '' ) + tzMin; - return tzString; - }, - 'guessTimezone': function() { - var textbox = document.getElementById( 'mw-input-timecorrection-other' ); - var selector = document.getElementById( 'mw-input-timecorrection' ); - - selector.value = 'other'; - textbox.value = fetchTimezone(); - textbox.disabled = false; // The changed handler doesn't trip, obviously. - updateTimezoneSelection( true ); - }, - 'updateTimezoneSelection': function( force_offset ) { - var selector = document.getElementById( 'mw-input-timecorrection' ); - - if ( selector.value == 'guess' ) { - return guessTimezone(); - } - - var textbox = document.getElementById( 'mw-input-timecorrection-other' ); - var localtimeHolder = document.getElementById( 'wpLocalTime' ); - var servertime = document.getElementsByName( 'wpServerTime' )[0].value; - var minDiff = 0; - - // Compatibility code. - if ( !selector.value ) { - selector.value = selector.options[selector.selectedIndex].value; - } - - // Handle force_offset - if ( force_offset ) { - selector.value = 'other'; - } - - // Get min_diff - if ( selector.value == 'other' ) { - // Grab data from the textbox, parse it. - var diffArr = textbox.value.split(':'); - if ( diffArr.length == 1 ) { - // Specification is of the form [-]XX - minDiff = parseInt( diffArr[0], 10 ) * 60; - } else { - // Specification is of the form [-]XX:XX - minDiff = Math.abs( parseInt( diffArr[0], 10 ) ) * 60 + parseInt( diffArr[1], 10 ); - if ( parseInt( diffArr[0], 10 ) < 0 ) { - minDiff = -minDiff; - } - } - } else { - // Grab data from the selector value - var diffArr = selector.value.split('|'); - minDiff = parseInt( diffArr[1], 10 ); - } - - // Gracefully handle non-numbers. - if ( isNaN( minDiff ) ) { - minDiff = 0; - } - - // Determine local time from server time and minutes difference, for display. - var localTime = parseInt( servertime, 10 ) + minDiff; - - // Bring time within the [0,1440) range. - while ( localTime < 0 ) { - localTime += 1440; - } - while ( localTime >= 1440 ) { - localTime -= 1440; - } - - // Split to hour and minute - var hour = String( Math.floor( localTime / 60 ) ); - if ( hour.length < 2 ) { - hour = '0' + hour; - } - var min = String(localTime%60); - if ( min.length < 2 ) { - min = '0' + min; - } - changeText( localtimeHolder, hour + ':' + min ); - - // If the user selected from the drop-down, fill the offset field. - if ( selector.value != 'other' ) { - hour = String( Math.abs( Math.floor( minDiff / 60 ) ) ); - if ( hour.length < 2 ) { - hour = '0' + hour; - } - if ( minDiff < 0 ) { - hour = '-' + hour; - } - min = String(minDiff%60); - if ( min.length < 2 ) { - min = '0' + min; - } - textbox.value = hour + ':' + min; - } - } -} ); - -/* Initialization */ - -$( document ).ready( function() { - mw.legacy.timezoneSetup(); - mw.legacy.tabbedprefs(); -} ); - -} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki/legacy/mediawiki.legacy.preview.js b/resources/mediawiki/legacy/mediawiki.legacy.preview.js deleted file mode 100644 index 01b41ef73a..0000000000 --- a/resources/mediawiki/legacy/mediawiki.legacy.preview.js +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Legacy emulation for the now depricated skins/common/preview.js - * - * Inline ("Live") preview - */ - -( function( $, mw ) { - -/* Extension */ - -$.extend( true, mw.legacy, { - - /* Functions */ - - 'doLivePreview': function( e ) { - e.preventDefault(); - $j( mw ).trigger( 'LivePreviewPrepare' ); - var postData = $j('#editform').formToArray(); - postData.push( { 'name' : 'wpPreview', 'value' : '1' } ); - // Hide active diff, used templates, old preview if shown - var copyElements = ['#wikiPreview', '.templatesUsed', '.hiddencats', '#catlinks']; - var copySelector = copyElements.join(','); - $j.each( copyElements, function(k,v) { $j(v).fadeOut('fast'); } ); - // Display a loading graphic - var loadSpinner = $j('
'); - $j('#wikiPreview').before( loadSpinner ); - var page = $j('
'); - var target = $j('#editform').attr('action'); - if ( !target ) { - target = window.location.href; - } - page.load( target + ' ' + copySelector, postData, function() { - for ( var i=0; i