From: Trevor Parscal Date: Sat, 4 Sep 2010 09:01:22 +0000 (+0000) Subject: Delete resources/mw directory, seems to be a remnant of a botched merge X-Git-Tag: 1.31.0-rc.0~35167 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=bf6b7d2e767b074fce13a54f1320f6bcf493d084;p=lhc%2Fweb%2Fwiklou.git Delete resources/mw directory, seems to be a remnant of a botched merge --- diff --git a/resources/mw/mw.diff.js b/resources/mw/mw.diff.js deleted file mode 100644 index a87530263f..0000000000 --- a/resources/mw/mw.diff.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Diff tweaks (used to be diff.js) - * - * Ported by: Trevor Parscal - */ - -( function( $ ) { - -/* Initialization */ - -$( document ).ready( function() { - /* - * Workaround for overflow bug in Mozilla 1.1 and earlier, where scrolling
s in cells collapse their - * height to a single line. - * - * Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've tried with overflow-x disable the scrolling - * all the way until Mozilla 1.8 / FF 1.5 and break Opera as well. - * - * So... we check for reaaaally old Gecko and hack in an alternate rule to let the wide cells spill instead of - * scrolling them. Not ideal as it won't work if JS is disabled, of course. - */ - if ( window.navigator && window.navigator.product == 'Gecko' && window.navigator.productSub < '20021130' ) { - document.styleSheets[document.styleSheets.length - 1].insertRule( - 'table.diff td div { overflow: visible; }', - document.styleSheets[document.styleSheets.length - 1].cssRules.length - ); - } -} ); - -} )( jQuery ); \ No newline at end of file diff --git a/resources/mw/mw.installer.js b/resources/mw/mw.installer.js deleted file mode 100644 index 28a1bec2f5..0000000000 --- a/resources/mw/mw.installer.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Installer configuration (used to be config.js) - * - * Ported by: Trevor Parscal - */ - -( function( $ ) { - -/* Initialization */ - -$( document ).ready( function() { - // Show/hide code for help text - $( '.config-show-help a' ).click( function() { - $(this).parent().siblings( '.config-help-message' ).show( 'slow' ); - $(this).parent().siblings( '.config-hide-help' ).show(); - $(this).parent().hide(); - return false; - } ); - $( '.config-hide-help a' ).click( function() { - $(this).parent().siblings( '.config-help-message' ).hide( 'slow' ); - $(this).parent().siblings( '.config-show-help' ).show(); - $(this).parent().hide(); - return false; - } ); - // Show/hide code for DB-specific options - // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here? - $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) ).hide(); } ); - $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show(); - $( '.dbRadio' ).click( function() { - var $checked = $( '.dbRadio:checked' ); - var $wrapper = $( '#' + $checked.attr( 'rel' ) ); - if ( !$wrapper.is( ':visible' ) ) { - $( '.dbWrapper' ).hide( 'slow' ); - $wrapper.show( 'slow' ); - } - } ); - // Scroll to the bottom of upgrade log - $( "#config-update-log" ).each( function() { this.scrollTop = this.scrollHeight; } ); - // Show/hide Creative Commons thingy - $( '.licenseRadio' ).click( function() { - var $wrapper = $( '#config-cc-wrapper' ); - if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) { - $wrapper.show( 'slow' ); - } else { - $wrapper.hide( 'slow' ); - } - } ); - // Show/hide random stuff (email, upload) - $( '.showHideRadio' ).click( function() { - var $wrapper = $( '#' + $(this).attr( 'rel' ) ); - if ( $(this).is( ':checked' ) ) { - $wrapper.show( 'slow' ); - } else { - $wrapper.hide( 'slow' ); - } - } ); - $( '.hideShowRadio' ).click( function() { - var $wrapper = $( '#' + $(this).attr( 'rel' ) ); - if ( $(this).is( ':checked' ) ) { - $wrapper.hide( 'slow' ); - } else { - $wrapper.show( 'slow' ); - } - } ); - // Enable/disable "other" textboxes - $( '.enableForOther' ).click( function() { - var $textbox = $( '#' + $(this).attr( 'rel' ) ); - if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly - $textbox.removeAttr( 'disabled' ); - } else { - $textbox.attr( 'disabled', 'disabled' ); - } - } ); - // Synchronize radio button label for sitename with textbox - $label = $( 'label[for=config__NamespaceType_site-name]' ); - labelText = $label.text(); - $label.text( labelText.replace( '$1', '' ) ); - $( '#config_wgSitename' ).bind( 'keyup change', syncText ).each( syncText ); - function syncText() { - var value = $(this).val() - .replace( /[\[\]\{\}|#<>%+? ]/g, '_' ) - .replace( /&/, '&' ) - .replace( /__+/g, '_' ) - .replace( /^_+/, '' ) - .replace( /_+$/, '' ); - value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 ); - $label.text( labelText.replace( '$1', value ) ); - } - // Show/Hide memcached servers when needed - $( "input[name$='config_wgMainCacheType']" ).change( function() { - var $memc = $( "#config-memcachewrapper" ); - if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() == 'memcached' ) { - $memc.show( 'slow' ); - } else { - $memc.hide( 'slow' ); - } - } ); -} ); - -} )( jQuery ); diff --git a/resources/mw/mw.js b/resources/mw/mw.js deleted file mode 100644 index 1070ecd4b4..0000000000 --- a/resources/mw/mw.js +++ /dev/null @@ -1,751 +0,0 @@ -/* - * JavaScript Backwards Compatibility - */ - -// Make calling .indexOf() on an array work on older browsers -if ( typeof Array.prototype.indexOf === 'undefined' ) { - Array.prototype.indexOf = function( needle ) { - for ( var i = 0; i < this.length; i++ ) { - if ( this[i] === needle ) { - return i; - } - } - return -1; - }; -} - -/* - * Core MediaWiki JavaScript Library - */ -( function() { - - /* Constants */ - - // This will not change until we are 100% ready to turn off legacy globals - const LEGACY_GLOBALS = true; - - /* Members */ - - this.legacy = LEGACY_GLOBALS ? window : {}; - - /* Methods */ - - /** - * Log a string msg to the console - * - * All mw.log statements will be removed on minification so lots of mw.log calls will not impact performance in non-debug - * mode. This is done using simple regular expressions, so the input of this function needs to not contain things like a - * self-executing closure. In the case that the browser does not have a console available, one is created by appending a - *
element to the bottom of the body and then appending a
element to that for each message. In the case that - * the browser does have a console available - * - * @author Michael Dale , Trevor Parscal - * @param {String} string String to output to console - */ - this.log = function( string ) { - // Allow log messages to use a configured prefix - if ( mw.config.exists( 'mw.log.prefix' ) ) { - string = mw.config.get( 'mw.log.prefix' ) + string; - } - // Try to use an existing console - if ( typeof window.console !== 'undefined' && typeof window.console.log == 'function' ) { - window.console.log( string ); - } else { - // Show a log box for console-less browsers - var $log = $( '#mw_log_console' ); - if ( !$log.length ) { - $log = $( '
' ) - .css( { - 'position': 'absolute', - 'overflow': 'auto', - 'z-index': 500, - 'bottom': '0px', - 'left': '0px', - 'right': '0px', - 'height': '150px', - 'background-color': 'white', - 'border-top': 'solid 1px #DDDDDD' - } ) - .appendTo( $( 'body' ) ); - } - if ( $log.length ) { - $log.append( - $( '
' + string + '
' ) - .css( { - 'border-bottom': 'solid 1px #DDDDDD', - 'font-size': 'small', - 'font-family': 'monospace', - 'padding': '0.125em 0.25em' - } ) - ); - } - } - }; - /* - * An object which allows single and multiple existence, setting and getting on a list of key / value pairs - */ - this.config = new ( function() { - - /* Private Members */ - - var that = this; - // List of configuration values - in legacy mode these configurations were ALL in the global space - var values = LEGACY_GLOBALS ? window : {}; - - /* Public Methods */ - - /** - * Sets one or multiple configuration values using a key and a value or an object of keys and values - */ - this.set = function( keys, value ) { - if ( typeof keys === 'object' ) { - for ( var key in keys ) { - values[key] = keys[key]; - } - } else if ( typeof keys === 'string' && typeof value !== 'undefined' ) { - values[keys] = value; - } - }; - /** - * Gets one or multiple configuration values using a key and an optional fallback or an array of keys - */ - this.get = function( keys, fallback ) { - if ( typeof keys === 'object' ) { - var result = {}; - for ( var k = 0; k < keys.length; k++ ) { - if ( typeof values[keys[k]] !== 'undefined' ) { - result[keys[k]] = values[keys[k]]; - } - } - return result; - } else if ( typeof values[keys] === 'undefined' ) { - return typeof fallback !== 'undefined' ? fallback : null; - } else { - return values[keys]; - } - }; - /** - * Checks if one or multiple configuration fields exist - */ - this.exists = function( keys ) { - if ( typeof keys === 'object' ) { - for ( var k = 0; k < keys.length; k++ ) { - if ( !( keys[k] in values ) ) { - return false; - } - } - return true; - } else { - return keys in values; - } - }; - } )(); - /* - * Localization system - */ - this.msg = new ( function() { - - /* Private Members */ - - var that = this; - // List of localized messages - var messages = {}; - - /* Public Methods */ - - this.set = function( keys, value ) { - if ( typeof keys === 'object' ) { - for ( var key in keys ) { - messages[key] = keys[key]; - } - } else if ( typeof keys === 'string' && typeof value !== 'undefined' ) { - messages[keys] = value; - } - }; - this.get = function( key, args ) { - if ( !( key in messages ) ) { - return '<' + key + '>'; - } - var msg = messages[key]; - if ( typeof args == 'object' || typeof args == 'array' ) { - for ( var argKey in args ) { - msg = msg.replace( '\$' + ( parseInt( argKey ) + 1 ), args[argKey] ); - } - } else if ( typeof args == 'string' || typeof args == 'number' ) { - msg = msg.replace( '$1', args ); - } - return msg; - }; - } )(); - /* - * Client-side module loader which integrates with the MediaWiki ResourceLoader - */ - this.loader = new ( function() { - - /* Private Members */ - - var that = this; - var server = 'load.php'; - /* - * Mapping of registered modules - * - * Format: - * { - * 'moduleName': { - * 'needs': ['required module', 'required module', ...], - * 'state': 'registered, loading, loaded, or ready', - * 'script': function() {}, - * 'style': 'css code string', - * 'localization': { 'key': 'value' } - * } - * } - */ - var registry = {}; - // List of callbacks waiting on dependent modules to be loaded so they can be executed - var queue = []; - // Until document ready, load requests will be collected in a batch queue - var batch = []; - // True after document ready occurs - var ready = false; - - /* Private Methods */ - - /** - * Gets a list of modules names that a module needs in their proper dependency order - * - * @param string module name - * @return - * @throws Error if circular reference is detected - */ - function needs( module ) { - if ( !( module in registry ) ) { - // Undefined modules have no needs - return []; - } - var resolved = []; - var unresolved = []; - if ( arguments.length === 3 ) { - // Use arguemnts on inner call - resolved = arguments[1]; - unresolved = arguments[2]; - } - unresolved[unresolved.length] = module; - for ( n in registry[module].needs ) { - if ( resolved.indexOf( registry[module].needs[n] ) === -1 ) { - if ( unresolved.indexOf( registry[module].needs[n] ) !== -1 ) { - throw new Error( - 'Circular reference detected: ' + module + ' -> ' + registry[module].needs[n] - ); - } - needs( registry[module].needs[n], resolved, unresolved ); - } - } - resolved[resolved.length] = module; - unresolved.slice( unresolved.indexOf( module ), 1 ); - if ( arguments.length === 1 ) { - // Return resolved list on outer call - return resolved; - } - }; - /** - * Narrows a list of module names down to those matching a specific state. Possible states are 'undefined', - * 'registered', 'loading', 'loaded', or 'ready' - * - * @param mixed string or array of strings of module states to filter by - * @param array list of module names to filter (optional, all modules will be used by default) - * @return array list of filtered module names - */ - function filter( states, modules ) { - var list = []; - if ( typeof modules === 'undefined' ) { - modules = []; - for ( module in registry ) { - modules[modules.length] = module; - } - } - for ( var s in states ) { - for ( var m in modules ) { - if ( - ( states[s] == 'undefined' && typeof registry[modules[m]] === 'undefined' ) || - ( typeof registry[modules[m]] === 'object' && registry[modules[m]].state === states[s] ) - ) { - list[list.length] = modules[m]; - } - } - } - return list; - } - /** - * Executes a loaded module, making it ready to use - * - * @param string module name to execute - */ - function execute( module ) { - if ( typeof registry[module] === 'undefined' ) { - throw new Error( 'module has not been registered: ' + module ); - } - switch ( registry[module].state ) { - case 'registered': - throw new Error( 'module has not completed loading: ' + module ); - break; - case 'loading': - throw new Error( 'module has not completed loading: ' + module ); - break; - case 'ready': - throw new Error( 'module has already been loaded: ' + module ); - break; - } - // Add style sheet to document - if ( typeof registry[module].style === 'string' && registry[module].style.length ) { - $( 'head' ).append( '' ); - } - // Add localizations to message system - if ( typeof registry[module].localization === 'object' ) { - mw.msg.set( registry[module].localization ); - } - // Execute script - try { - registry[module].script(); - } catch( e ) { - mw.log( 'Exception thrown by ' + module + ': ' + e.message ); - } - // Change state - registry[module].state = 'ready'; - - // Execute all modules which were waiting for this to be ready - for ( r in registry ) { - if ( registry[r].state == 'loaded' ) { - if ( filter( ['ready'], registry[r].needs ).length == registry[r].needs.length ) { - execute( r ); - } - } - } - } - /** - * Adds a callback and it's needs to the queue - * - * @param array list of module names the callback needs to be ready before being executed - * @param function callback to execute when needs are met - */ - function request( needs, callback ) { - queue[queue.length] = { 'needs': filter( ['undefined', 'registered'], needs ), 'callback': callback }; - } - - /* Public Methods */ - - /** - * Processes the queue, loading and executing when things when ready. - */ - this.work = function() { - // Appends a list of modules to the batch - function append( modules ) { - for ( m in modules ) { - // Prevent requesting modules which are loading, loaded or ready - if ( modules[m] in registry && registry[modules[m]].state == 'registered' ) { - // Since the batch can live between calls to work until document ready, we need to make sure - // we aren't making a duplicate entry - if ( batch.indexOf( modules[m] ) == -1 ) { - batch[batch.length] = modules[m]; - registry[modules[m]].state = 'loading'; - } - } - } - } - // Fill batch with modules that need to be loaded - for ( var q in queue ) { - append( queue[q].needs ); - for ( n in queue[q].needs ) { - append( needs( queue[q].needs[n] ) ); - } - } - // After document ready, handle the batch - if ( ready && batch.length ) { - // Always order modules alphabetically to help reduce cache misses for otherwise identical content - batch.sort(); - - var base = $.extend( {}, - // Pass configuration values through the URL - mw.config.get( [ 'user', 'skin', 'space', 'view', 'language' ] ), - // Ensure request comes back in the proper mode (debug or not) - { 'debug': typeof mw.debug !== 'undefined' ? '1' : '0' } - ); - var requests = []; - if ( base.debug == '1' ) { - for ( b in batch ) { - requests[requests.length] = $.extend( { 'modules': batch[b] }, base ); - } - } else { - requests[requests.length] = $.extend( { 'modules': batch.join( '|' ) }, base ); - } - // It may be more performant to do this with an Ajax call, but that's limited to same-domain, so we - // can either auto-detect (if there really is any benefit) or just use this method, which is safe - setTimeout( function() { - // Clear the batch - this MUST happen before we append the script element to the body or it's - // possible that the script will be locally cached, instantly load, and work the batch again, - // all before we've cleared it causing each request to include modules which are already loaded - batch = []; - var html = ''; - for ( r in requests ) { - // Build out the HTML - var src = mw.util.buildUrlString( { - 'path': mw.config.get( 'wgScriptPath' ) + '/load.php', - 'query': requests[r] - } ); - html += ''; - } - // Append script to head - $( 'head' ).append( html ); - }, 0 ) - } - }; - /** - * Registers a module, letting the system know about it and it's dependencies. loader.js files contain calls - * to this function. - */ - this.register = function( name, needs ) { - // Validate input - if ( typeof name !== 'string' ) { - throw new Error( 'name must be a string, not a ' + typeof name ); - } - if ( typeof registry[name] !== 'undefined' ) { - throw new Error( 'module already implemeneted: ' + name ); - } - // List the module as registered - registry[name] = { 'state': 'registered', 'needs': [] }; - // Allow needs to be given as a function which returns a string or array - if ( typeof needs === 'function' ) { - needs = needs(); - } - if ( typeof needs === 'string' ) { - // Allow needs to be given as a single module name - registry[name].needs = [needs]; - } else if ( typeof needs === 'object' ) { - // Allow needs to be given as an array of module names - registry[name].needs = needs; - } - }; - /** - * Implements a module, giving the system a course of action to take upon loading. Results of a request for - * one or more modules contain calls to this function. - */ - this.implement = function( name, script, style, localization ) { - // Automaically register module - if ( typeof registry[name] === 'undefined' ) { - that.register( name, needs ); - } - // Validate input - if ( typeof script !== 'function' ) { - throw new Error( 'script must be a function, not a ' + typeof script ); - } - if ( typeof style !== 'undefined' && typeof style !== 'string' ) { - throw new Error( 'style must be a string, not a ' + typeof style ); - } - if ( typeof localization !== 'undefined' && typeof localization !== 'object' ) { - throw new Error( 'localization must be an object, not a ' + typeof localization ); - } - if ( typeof registry[name] !== 'undefined' && typeof registry[name].script !== 'undefined' ) { - throw new Error( 'module already implemeneted: ' + name ); - } - // Mark module as loaded - registry[name].state = 'loaded'; - // Attach components - registry[name].script = script; - if ( typeof style === 'string' ) { - registry[name].style = style; - } - if ( typeof localization === 'object' ) { - registry[name].localization = localization; - } - // Execute or queue callback - if ( filter( ['ready'], registry[name].needs ).length == registry[name].needs.length ) { - execute( name ); - } else { - request( registry[name].needs, function() { execute( name ); } ); - } - }; - /** - * Executes a function as soon as one or more required modules are ready - * - * @param mixed string or array of strings of modules names the callback needs to be ready before executing - * @param function callback to execute when all needs are met - */ - this.using = function( needs, callback ) { - // Validate input - if ( typeof needs !== 'object' && typeof needs !== 'string' ) { - throw new Error( 'needs must be a string or an array, not a ' + typeof needs ) - } - if ( typeof callback !== 'function' ) { - throw new Error( 'callback must be a function, not a ' + typeof callback ) - } - if ( typeof needs === 'string' ) { - needs = [needs]; - } - // Execute or queue callback - if ( filter( ['ready'], needs ).length == needs.length ) { - callback(); - } else { - request( needs, callback ); - } - }; - - /* Event Bindings */ - - $( document ).ready( function() { - ready = true; - that.work(); - } ); - } )(); - /** - * General purpose utilities - */ - this.util = new ( function() { - - /* Private Members */ - - var that = this; - // Decoded user agent string cache - var client = null; - - /* Public Methods */ - - /** - * Builds a url string from an object containing any of the following components: - * - * Component Example - * scheme "http" - * server "www.domain.com" - * path "path/to/my/file.html" - * query "this=thåt" or { 'this': 'thåt' } - * fragment "place_on_the_page" - * - * Results in: "http://www.domain.com/path/to/my/file.html?this=th%C3%A5t#place_on_the_page" - * - * All arguments to this function are assumed to be URL-encoded already, except for the - * query parameter if provided in object form. - */ - this.buildUrlString = function( components ) { - var url = ''; - if ( typeof components.scheme === 'string' ) { - url += components.scheme + '://'; - } - if ( typeof components.server === 'string' ) { - url += components.server + '/'; - } - if ( typeof components.path === 'string' ) { - url += components.path; - } - if ( typeof components.query === 'string' ) { - url += '?' + components.query; - } else if ( typeof components.query === 'object' ) { - url += '?' + that.buildQueryString( components.query ); - } - if ( typeof components.fragment === 'string' ) { - url += '#' + components.fragment; - } - return url; - }; - /** - * RFC 3986 compliant URI component encoder - with identical behavior as PHP's urlencode function. Note: PHP's - * urlencode function prior to version 5.3 also escapes tildes, this does not. The naming here is not the same - * as PHP because PHP can't decide out to name things (underscores sometimes?), much less set a reasonable - * precedence for how things should be named in other environments. We use camelCase and action-subject here. - */ - this.encodeUrlComponent = function( string ) { - return encodeURIComponent( new String( string ) ) - .replace(/!/g, '%21') - .replace(/'/g, '%27') - .replace(/\(/g, '%28') - .replace(/\)/g, '%29') - .replace(/\*/g, '%2A') - .replace(/%20/g, '+'); - }; - /** - * Builds a query string from an object with key and values - */ - this.buildQueryString = function( parameters ) { - if ( typeof parameters === 'object' ) { - var parts = []; - for ( var p in parameters ) { - parts[parts.length] = that.encodeUrlComponent( p ) + '=' + that.encodeUrlComponent( parameters[p] ); - } - return parts.join( '&' ); - } - return ''; - }; - /** - * Returns an object containing information about the browser - * - * The resulting client object will be in the following format: - * { - * 'name': 'firefox', - * 'layout': 'gecko', - * 'os': 'linux' - * 'version': '3.5.1', - * 'versionBase': '3', - * 'versionNumber': 3.5, - * } - */ - this.client = function() { - // Use the cached version if possible - if ( client === null ) { - - /* Configuration */ - - // Name of browsers or layout engines we don't recognize - var uk = 'unknown'; - // Generic version digit - var x = 'x'; - // Strings found in user agent strings that need to be conformed - var wildUserAgents = [ 'Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3']; - // Translations for conforming user agent strings - var userAgentTranslations = [ - // Tons of browsers lie about being something they are not - [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''], - // Chrome lives in the shadow of Safari still - ['Chrome Safari', 'Chrome'], - // KHTML is the layout engine not the browser - LIES! - ['KHTML', 'Konqueror'], - // Firefox nightly builds - ['Minefield', 'Firefox'], - // This helps keep differnt versions consistent - ['Navigator', 'Netscape'], - // This prevents version extraction issues, otherwise translation would happen later - ['PLAYSTATION 3', 'PS3'], - ]; - // Strings which precede a version number in a user agent string - combined and used as match 1 in - // version detectection - var versionPrefixes = [ - 'camino', 'chrome', 'firefox', 'netscape', 'netscape6', 'opera', 'version', 'konqueror', 'lynx', - 'msie', 'safari', 'ps3' - ]; - // Used as matches 2, 3 and 4 in version extraction - 3 is used as actual version number - var versionSuffix = '(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\\)|\s|$)'; - // Names of known browsers - var browserNames = [ - 'camino', 'chrome', 'firefox', 'netscape', 'konqueror', 'lynx', 'msie', 'opera', 'safari', 'ipod', - 'iphone', 'blackberry', 'ps3' - ]; - // Tanslations for conforming browser names - var browserTranslations = []; - // Names of known layout engines - var layoutNames = ['gecko', 'konqueror', 'msie', 'opera', 'webkit']; - // Translations for conforming layout names - var layoutTranslations = [['konqueror', 'khtml'], ['msie', 'trident'], ['opera', 'presto']]; - // Names of known operating systems - var osNames = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone']; - // Translations for conforming operating system names - var osTranslations = [['sunos', 'solaris']]; - - /* Methods */ - - // Performs multiple replacements on a string - function translate( source, translations ) { - for ( var i = 0; i < translations.length; i++ ) { - source = source.replace( translations[i][0], translations[i][1] ); - } - return source; - }; - - /* Pre-processing */ - - var userAgent = navigator.userAgent, match, browser = uk, layout = uk, os = uk, version = x; - if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( userAgent ) ) { - // Takes a userAgent string and translates given text into something we can more easily work with - userAgent = translate( userAgent, userAgentTranslations ); - } - // Everything will be in lowercase from now on - userAgent = userAgent.toLowerCase(); - - /* Extraction */ - - if ( match = new RegExp( '(' + browserNames.join( '|' ) + ')' ).exec( userAgent ) ) { - browser = translate( match[1], browserTranslations ); - } - if ( match = new RegExp( '(' + layoutNames.join( '|' ) + ')' ).exec( userAgent ) ) { - layout = translate( match[1], layoutTranslations ); - } - if ( match = new RegExp( '(' + osNames.join( '|' ) + ')' ).exec( navigator.platform.toLowerCase() ) ) { - var os = translate( match[1], osTranslations ); - } - if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( userAgent ) ) { - version = match[3]; - } - - /* Edge Cases -- did I mention about how user agent string lie? */ - - // Decode Safari's crazy 400+ version numbers - if ( name.match( /safari/ ) && version > 400 ) { - version = '2.0'; - } - // Expose Opera 10's lies about being Opera 9.8 - if ( name === 'opera' && version >= 9.8) { - version = userAgent.match( /version\/([0-9\.]*)/i )[1] || 10; - } - - /* Caching */ - - client = { - 'browser': browser, - 'layout': layout, - 'os': os, - 'version': version, - 'versionBase': ( version !== x ? new String( version ).substr( 0, 1 ) : x ), - 'versionNumber': ( parseFloat( version, 10 ) || 0.0 ) - }; - } - return client; - }; - /** - * Checks the current browser against a support map object to determine if the browser has been black-listed or - * not. If the browser was not configured specifically it is assumed to work. It is assumed that the body - * element is classified as either "ltr" or "rtl". If neither is set, "ltr" is assumed. - * - * A browser map is in the following format: - * { - * 'ltr': { - * // Multiple rules with configurable operators - * 'msie': [['>=', 7], ['!=', 9]], - * // Blocked entirely - * 'iphone': false - * }, - * 'rtl': { - * // Test against a string - * 'msie': [['!==', '8.1.2.3']], - * // RTL rules do not fall through to LTR rules, you must explicity set each of them - * 'iphone': false - * } - * } - * - * @param map Object of browser support map - * - * @return Boolean true if browser known or assumed to be supported, false if blacklisted - */ - this.testClient = function( map ) { - var client = this.client(); - // Check over each browser condition to determine if we are running in a compatible client - var browser = map[$( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][client.browser]; - if ( typeof browser !== 'object' ) { - // Unknown, so we assume it's working - return true; - } - for ( var condition in browser ) { - var op = browser[condition][0]; - var val = browser[condition][1]; - if ( val === false ) { - return false; - } else if ( typeof val == 'string' ) { - if ( !( eval( 'client.version' + op + '"' + val + '"' ) ) ) { - return false; - } - } else if ( typeof val == 'number' ) { - if ( !( eval( 'client.versionNumber' + op + val ) ) ) { - return false; - } - } - } - return true; - }; - } )(); - // Attach to window - window.mw = $.extend( 'mw' in window ? window.mw : {}, this ); -} )(); \ No newline at end of file diff --git a/resources/mw/mw.legacy.IEFixes.js b/resources/mw/mw.legacy.IEFixes.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.ajax.js b/resources/mw/mw.legacy.ajax.js deleted file mode 100644 index a4f29fd9e2..0000000000 --- a/resources/mw/mw.legacy.ajax.js +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Legacy emulation for the now depricated ajax.js - * - * Original licensing information: - * remote scripting library - * (c) copyright 2005 modernmethod, inc - * - * Ported by: Trevor Parscal - */ - -( function( $ ) { - -$.extend( 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 ); \ No newline at end of file diff --git a/resources/mw/mw.legacy.ajaxwatch.js b/resources/mw/mw.legacy.ajaxwatch.js deleted file mode 100644 index eafdd4e43b..0000000000 --- a/resources/mw/mw.legacy.ajaxwatch.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Legacy emulation for the now depricated ajaxwatch.js - * - * Ported by: Trevor Parscal - * - * Animate watch/unwatch links to use asynchronous API requests to watch pages, rather than clicking on links - * - * Warning: Uses mw.legacy.jsMsg() from mw.legacy.wikibits.js - */ - -( function( $ ) { - -if ( typeof mw.legacy.wgAjaxWatch === "undefined" || !mw.legacy.wgAjaxWatch ) { - $.extend( mw.legacy, { - 'wgAjaxWatch': { - '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' - } - } ); -} -$.extend( mw.legacy.wgAjaxWatch, { - 'setLinkText': function( $link, action ) { - 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'] ); - } - }, - '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 ); \ No newline at end of file diff --git a/resources/mw/mw.legacy.block.js b/resources/mw/mw.legacy.block.js deleted file mode 100644 index 83594f3a93..0000000000 --- a/resources/mw/mw.legacy.block.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Legacy emulation for the now depricated block.js - * - * Ported by: Trevor Parscal - */ - -( function( $ ) { - -$.extend( mw.legacy, { - '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 ); \ No newline at end of file diff --git a/resources/mw/mw.legacy.changepassword.js b/resources/mw/mw.legacy.changepassword.js deleted file mode 100644 index 8989449579..0000000000 --- a/resources/mw/mw.legacy.changepassword.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Legacy emulation for the now depricated changepassword.js - * - * Ported by: Trevor Parscal - */ - -( function( $ ) { - -$.extend( mw.legacy, { - '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 ); \ No newline at end of file diff --git a/resources/mw/mw.legacy.edit.js b/resources/mw/mw.legacy.edit.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.enhancedchanges.js b/resources/mw/mw.legacy.enhancedchanges.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.history.js b/resources/mw/mw.legacy.history.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.htmlform.js b/resources/mw/mw.legacy.htmlform.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.metadata.js b/resources/mw/mw.legacy.metadata.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.mwsuggest.js b/resources/mw/mw.legacy.mwsuggest.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.prefs.js b/resources/mw/mw.legacy.prefs.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.preview.js b/resources/mw/mw.legacy.preview.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.protect.js b/resources/mw/mw.legacy.protect.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.rightclickedit.js b/resources/mw/mw.legacy.rightclickedit.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.search.js b/resources/mw/mw.legacy.search.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.upload.js b/resources/mw/mw.legacy.upload.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/resources/mw/mw.legacy.wikibits.js b/resources/mw/mw.legacy.wikibits.js deleted file mode 100644 index e69de29bb2..0000000000