Nikerabbit has uploaded a new change for review. https://gerrit.wikimedia.org/r/234559
Change subject: Remove code supporting MediaWiki 1.23 ...................................................................... Remove code supporting MediaWiki 1.23 Change-Id: I7a8c33d2c341e38d4a117fbaea8961983f281bdf --- M Autoload.php M Resources.php D Translate.MyLanguage.alias.php M Translate.php D resources/js/jquery.ui.position.js D specials/SpecialMyLanguage.php 6 files changed, 1 insertion(+), 903 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate refs/changes/59/234559/1 diff --git a/Autoload.php b/Autoload.php index 5df83a4..7e25277 100644 --- a/Autoload.php +++ b/Autoload.php @@ -43,7 +43,6 @@ $al['SpecialMagic'] = "$dir/specials/SpecialMagic.php"; $al['SpecialManageGroups'] = "$dir/specials/SpecialManageGroups.php"; $al['SpecialMessageGroupStats'] = "$dir/specials/SpecialMessageGroupStats.php"; -$al['SpecialMyLanguage'] = "$dir/specials/SpecialMyLanguage.php"; $al['SpecialPageMigration'] = "$dir/specials/SpecialPageMigration.php"; $al['SpecialPagePreparation'] = "$dir/specials/SpecialPagePreparation.php"; $al['SpecialSearchTranslations'] = "$dir/specials/SpecialSearchTranslations.php"; diff --git a/Resources.php b/Resources.php index ba7089e..09a8714 100644 --- a/Resources.php +++ b/Resources.php @@ -125,7 +125,7 @@ 'ext.translate.statsbar', 'mediawiki.jqueryMsg', 'ext.translate.loader', - 'jquery.ui.position.custom', + 'jquery.ui.position', ), 'messages' => array( 'translate-msggroupselector-projects', @@ -525,12 +525,6 @@ $wgResourceModules['jquery.textchange'] = array( 'scripts' => 'resources/js/jquery.textchange.js', -) + $resourcePaths; - -// Use different name to not conflict with core. -// MediaWiki <= 1.23 has 1.8.x, which is too old for us. -$wgResourceModules['jquery.ui.position.custom'] = array( - 'scripts' => 'resources/js/jquery.ui.position.js', ) + $resourcePaths; $wgHooks['ResourceLoaderTestModules'][] = diff --git a/Translate.MyLanguage.alias.php b/Translate.MyLanguage.alias.php deleted file mode 100644 index c767c95..0000000 --- a/Translate.MyLanguage.alias.php +++ /dev/null @@ -1,309 +0,0 @@ -<?php -/** - * Aliases for the Special:MyLanguage of Translate extension. - * This is a backwards compatibility file that separates the translations - * in the extension from the translations of the same page's name - * in core MediaWiki. For more information see the following bug: - * https://phabricator.wikimedia.org/T71461 - * - * @file - * @license GPL-2.0+ - */ -// @codingStandardsIgnoreFile - -$specialPageAliases = array(); - -/** English (English) */ -$specialPageAliases['en'] = array( - 'MyLanguage' => array( 'MyLanguage' ), -); - -/** Afrikaans (Afrikaans) */ -$specialPageAliases['af'] = array( - 'MyLanguage' => array( 'MyTaal' ), -); - -/** Arabic (العربية) */ -$specialPageAliases['ar'] = array( - 'MyLanguage' => array( 'لغتي' ), -); - -/** Aramaic (ܐܪܡܝܐ) */ -$specialPageAliases['arc'] = array( - 'MyLanguage' => array( 'ܠܫܢܐ_ܕܝܠܝ' ), -); - -/** Egyptian Spoken Arabic (مصرى) */ -$specialPageAliases['arz'] = array( - 'MyLanguage' => array( 'اللغة_بتاعتى' ), -); - -/** Assamese (অসমীয়া) */ -$specialPageAliases['as'] = array( - 'MyLanguage' => array( 'মোৰ_ভাষা' ), -); - -/** Banjar (Bahasa Banjar) */ -$specialPageAliases['bjn'] = array( - 'MyLanguage' => array( 'Bahasa_ulun' ), -); - -/** Breton (brezhoneg) */ -$specialPageAliases['br'] = array( - 'MyLanguage' => array( 'MaYezh' ), -); - -/** буряад (буряад) */ -$specialPageAliases['bxr'] = array( - 'MyLanguage' => array( 'Минии_хэлэн' ), -); - -/** Min Dong Chinese (Mìng-dĕ̤ng-ngṳ̄) */ -$specialPageAliases['cdo'] = array( - 'MyLanguage' => array( '我其語言' ), -); - -/** Chechen (нохчийн) */ -$specialPageAliases['ce'] = array( - 'MyLanguage' => array( 'Сан_мотт' ), -); - -/** German (Deutsch) */ -$specialPageAliases['de'] = array( - 'MyLanguage' => array( 'Meine_Sprache' ), -); - -/** Zazaki (Zazaki) */ -$specialPageAliases['diq'] = array( - 'MyLanguage' => array( 'ZıwaneMe' ), -); - -/** Greek (Ελληνικά) */ -$specialPageAliases['el'] = array( - 'MyLanguage' => array( 'ΗΓλώσσαΜου' ), -); - -/** Esperanto (Esperanto) */ -$specialPageAliases['eo'] = array( - 'MyLanguage' => array( 'Mia_lingvo' ), -); - -/** Spanish (español) */ -$specialPageAliases['es'] = array( - 'MyLanguage' => array( 'MiIdioma', 'Mi_idioma' ), -); - -/** Persian (فارسی) */ -$specialPageAliases['fa'] = array( - 'MyLanguage' => array( 'زبانهای_من' ), -); - -/** Finnish (suomi) */ -$specialPageAliases['fi'] = array( - 'MyLanguage' => array( 'Oma_kieli' ), -); - -/** French (français) */ -$specialPageAliases['fr'] = array( - 'MyLanguage' => array( 'MaLangue', 'Ma_langue' ), -); - -/** Swiss German (Alemannisch) */ -$specialPageAliases['gsw'] = array( - 'MyLanguage' => array( 'Myyni_Sprooch' ), -); - -/** Hebrew (עברית) */ -$specialPageAliases['he'] = array( - 'MyLanguage' => array( 'השפה_שלי' ), -); - -/** Upper Sorbian (hornjoserbsce) */ -$specialPageAliases['hsb'] = array( - 'MyLanguage' => array( 'Moja_rěč' ), -); - -/** Haitian (Kreyòl ayisyen) */ -$specialPageAliases['ht'] = array( - 'MyLanguage' => array( 'LangMwen' ), -); - -/** Interlingua (interlingua) */ -$specialPageAliases['ia'] = array( - 'MyLanguage' => array( 'Mi_lingua' ), -); - -/** Indonesian (Bahasa Indonesia) */ -$specialPageAliases['id'] = array( - 'MyLanguage' => array( 'Bahasa_saya' ), -); - -/** Italian (italiano) */ -$specialPageAliases['it'] = array( - 'MyLanguage' => array( 'MiaLingua' ), -); - -/** Japanese (日本語) */ -$specialPageAliases['ja'] = array( - 'MyLanguage' => array( '自分の言語' ), -); - -/** Georgian (ქართული) */ -$specialPageAliases['ka'] = array( - 'MyLanguage' => array( 'ჩემი_ენა' ), -); - -/** Khmer (ភាសាខ្មែរ) */ -$specialPageAliases['km'] = array( - 'MyLanguage' => array( 'ភាសារបស់ខ្ញុំ' ), -); - -/** Korean (한국어) */ -$specialPageAliases['ko'] = array( - 'MyLanguage' => array( '내언어' ), -); - -/** Karachay-Balkar (къарачай-малкъар) */ -$specialPageAliases['krc'] = array( - 'MyLanguage' => array( 'Мени_тилим' ), -); - -/** Kurdish (Latin script) (Kurdî (latînî)) */ -$specialPageAliases['ku-latn'] = array( - 'MyLanguage' => array( 'Zimanê_Min' ), -); - -/** Cornish (kernowek) */ -$specialPageAliases['kw'] = array( - 'MyLanguage' => array( 'OwYeth' ), -); - -/** Luxembourgish (Lëtzebuergesch) */ -$specialPageAliases['lb'] = array( - 'MyLanguage' => array( 'Meng_Sprooch' ), -); - -/** Macedonian (македонски) */ -$specialPageAliases['mk'] = array( - 'MyLanguage' => array( 'МојЈазик' ), -); - -/** Malayalam (മലയാളം) */ -$specialPageAliases['ml'] = array( - 'MyLanguage' => array( 'എന്റെഭാഷ' ), -); - -/** Marathi (मराठी) */ -$specialPageAliases['mr'] = array( - 'MyLanguage' => array( 'माझीभाषा' ), -); - -/** Erzya (эрзянь) */ -$specialPageAliases['myv'] = array( - 'MyLanguage' => array( 'Келем' ), -); - -/** Norwegian Bokmål (norsk bokmål) */ -$specialPageAliases['nb'] = array( - 'MyLanguage' => array( 'Mitt_språk' ), -); - -/** Low Saxon (Netherlands) (Nedersaksies) */ -$specialPageAliases['nds-nl'] = array( - 'MyLanguage' => array( 'Mien_taal' ), -); - -/** Dutch (Nederlands) */ -$specialPageAliases['nl'] = array( - 'MyLanguage' => array( 'MijnTaal' ), -); - -/** Norwegian Nynorsk (norsk nynorsk) */ -$specialPageAliases['nn'] = array( - 'MyLanguage' => array( 'Språket_mitt' ), -); - -/** Punjabi (ਪੰਜਾਬੀ) */ -$specialPageAliases['pa'] = array( - 'MyLanguage' => array( 'ਮੇਰੀ_ਭਾਸ਼ਾ', 'ਮੇਰੀ_ਬੋਲੀ' ), -); - -/** Polish (polski) */ -$specialPageAliases['pl'] = array( - 'MyLanguage' => array( 'Mój_język' ), -); - -/** Quechua (Runa Simi) */ -$specialPageAliases['qu'] = array( - 'MyLanguage' => array( 'Rimayniy' ), -); - -/** Russian (русский) */ -$specialPageAliases['ru'] = array( - 'MyLanguage' => array( 'Мой_язык' ), -); - -/** Sicilian (sicilianu) */ -$specialPageAliases['scn'] = array( - 'MyLanguage' => array( 'MiaLingua' ), -); - -/** Serbian (Cyrillic script) (српски (ћирилица)) */ -$specialPageAliases['sr-ec'] = array( - 'MyLanguage' => array( 'Мој_језик' ), -); - -/** Swedish (svenska) */ -$specialPageAliases['sv'] = array( - 'MyLanguage' => array( 'Mitt_språk' ), -); - -/** Thai (ไทย) */ -$specialPageAliases['th'] = array( - 'MyLanguage' => array( 'ภาษาของฉัน' ), -); - -/** толышә зывон (толышә зывон) */ -$specialPageAliases['tly'] = array( - 'MyLanguage' => array( 'Чымы_зывон' ), -); - -/** Turkish (Türkçe) */ -$specialPageAliases['tr'] = array( - 'MyLanguage' => array( 'Dilim', 'BenimDilim' ), -); - -/** Tatar (Cyrillic script) (татарча) */ -$specialPageAliases['tt-cyrl'] = array( - 'MyLanguage' => array( 'Телем' ), -); - -/** Tuvinian (тыва дыл) */ -$specialPageAliases['tyv'] = array( - 'MyLanguage' => array( 'Дылым' ), -); - -/** Ukrainian (українська) */ -$specialPageAliases['uk'] = array( - 'MyLanguage' => array( 'Моя_мова' ), -); - -/** Vietnamese (Tiếng Việt) */ -$specialPageAliases['vi'] = array( - 'MyLanguage' => array( 'Ngôn_ngữ_tôi' ), -); - -/** Cantonese (粵語) */ -$specialPageAliases['yue'] = array( - 'MyLanguage' => array( '我個話' ), -); - -/** Simplified Chinese (中文(简体)) */ -$specialPageAliases['zh-hans'] = array( - 'MyLanguage' => array( '我的语言' ), -); - -/** Traditional Chinese (中文(繁體)) */ -$specialPageAliases['zh-hant'] = array( - 'MyLanguage' => array( '我的語言' ), -); diff --git a/Translate.php b/Translate.php index 06b206e..2ddfd0b 100644 --- a/Translate.php +++ b/Translate.php @@ -57,15 +57,6 @@ $wgMessagesDirs['TranslateApi'] = __DIR__ . "/i18n/api"; $wgExtensionMessagesFiles['TranslateAlias'] = "$dir/Translate.alias.php"; $wgExtensionMessagesFiles['TranslateMagic'] = "$dir/Translate.i18n.magic.php"; -// Backwards compatibility: -// If Special:MyLanguage is not in core, load translations of its name -// from the Translate extension's code. -// See https://phabricator.wikimedia.org/T71461 -// Can be removed when MW 1.23 is no longer supported -if ( !isset( $wgAutoloadLocalClasses['SpecialMyLanguage'] ) ) { - $wgExtensionMessagesFiles['TranslateMyLanguageAlias'] = - "$dir/Translate.MyLanguage.alias.php"; -} // Register initialization code $wgExtensionFunctions[] = 'TranslateHooks::setupTranslate'; @@ -86,7 +77,6 @@ $wgSpecialPages['ImportTranslations'] = 'SpecialImportTranslations'; $wgSpecialPages['ManageMessageGroups'] = 'SpecialManageGroups'; $wgSpecialPages['SupportedLanguages'] = 'SpecialSupportedLanguages'; -$wgSpecialPages['MyLanguage'] = 'SpecialMyLanguage'; $wgSpecialPages['AggregateGroups'] = 'SpecialAggregateGroups'; $wgSpecialPages['SearchTranslations'] = 'SpecialSearchTranslations'; $wgSpecialPages['ManageTranslatorSandbox'] = 'SpecialManageTranslatorSandbox'; diff --git a/resources/js/jquery.ui.position.js b/resources/js/jquery.ui.position.js deleted file mode 100644 index 1a88c35..0000000 --- a/resources/js/jquery.ui.position.js +++ /dev/null @@ -1,498 +0,0 @@ -/*! - * jQuery UI Position 1.10.3 - * http://jqueryui.com - * - * Copyright 2013 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/position/ - * @codingStandardsIgnoreFile External lib. - */ -(function( $, undefined ) { - -$.ui = $.ui || {}; - -var cachedScrollbarWidth, - max = Math.max, - abs = Math.abs, - round = Math.round, - rhorizontal = /left|center|right/, - rvertical = /top|center|bottom/, - roffset = /[\+\-]\d+(\.[\d]+)?%?/, - rposition = /^\w+/, - rpercent = /%$/, - _position = $.fn.position; - -function getOffsets( offsets, width, height ) { - return [ - parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), - parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) - ]; -} - -function parseCss( element, property ) { - return parseInt( $.css( element, property ), 10 ) || 0; -} - -function getDimensions( elem ) { - var raw = elem[0]; - if ( raw.nodeType === 9 ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: 0, left: 0 } - }; - } - if ( $.isWindow( raw ) ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: elem.scrollTop(), left: elem.scrollLeft() } - }; - } - if ( raw.preventDefault ) { - return { - width: 0, - height: 0, - offset: { top: raw.pageY, left: raw.pageX } - }; - } - return { - width: elem.outerWidth(), - height: elem.outerHeight(), - offset: elem.offset() - }; -} - -$.position = { - scrollbarWidth: function() { - if ( cachedScrollbarWidth !== undefined ) { - return cachedScrollbarWidth; - } - var w1, w2, - div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), - innerDiv = div.children()[0]; - - $( "body" ).append( div ); - w1 = innerDiv.offsetWidth; - div.css( "overflow", "scroll" ); - - w2 = innerDiv.offsetWidth; - - if ( w1 === w2 ) { - w2 = div[0].clientWidth; - } - - div.remove(); - - return (cachedScrollbarWidth = w1 - w2); - }, - getScrollInfo: function( within ) { - var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ), - overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ), - hasOverflowX = overflowX === "scroll" || - ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), - hasOverflowY = overflowY === "scroll" || - ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); - return { - width: hasOverflowY ? $.position.scrollbarWidth() : 0, - height: hasOverflowX ? $.position.scrollbarWidth() : 0 - }; - }, - getWithinInfo: function( element ) { - var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[0] ); - return { - element: withinElement, - isWindow: isWindow, - offset: withinElement.offset() || { left: 0, top: 0 }, - scrollLeft: withinElement.scrollLeft(), - scrollTop: withinElement.scrollTop(), - width: isWindow ? withinElement.width() : withinElement.outerWidth(), - height: isWindow ? withinElement.height() : withinElement.outerHeight() - }; - } -}; - -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } - - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); - - var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, - target = $( options.of ), - within = $.position.getWithinInfo( options.within ), - scrollInfo = $.position.getScrollInfo( within ), - collision = ( options.collision || "flip" ).split( " " ), - offsets = {}; - - dimensions = getDimensions( target ); - if ( target[0].preventDefault ) { - // force left top to allow flipping - options.at = "left top"; - } - targetWidth = dimensions.width; - targetHeight = dimensions.height; - targetOffset = dimensions.offset; - // clone to reuse original targetOffset later - basePosition = $.extend( {}, targetOffset ); - - // force my and at to have valid horizontal and vertical positions - // if a value is missing or invalid, it will be converted to center - $.each( [ "my", "at" ], function() { - var pos = ( options[ this ] || "" ).split( " " ), - horizontalOffset, - verticalOffset; - - if ( pos.length === 1) { - pos = rhorizontal.test( pos[ 0 ] ) ? - pos.concat( [ "center" ] ) : - rvertical.test( pos[ 0 ] ) ? - [ "center" ].concat( pos ) : - [ "center", "center" ]; - } - pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; - pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; - - // calculate offsets - horizontalOffset = roffset.exec( pos[ 0 ] ); - verticalOffset = roffset.exec( pos[ 1 ] ); - offsets[ this ] = [ - horizontalOffset ? horizontalOffset[ 0 ] : 0, - verticalOffset ? verticalOffset[ 0 ] : 0 - ]; - - // reduce to just the positions without the offsets - options[ this ] = [ - rposition.exec( pos[ 0 ] )[ 0 ], - rposition.exec( pos[ 1 ] )[ 0 ] - ]; - }); - - // normalize collision option - if ( collision.length === 1 ) { - collision[ 1 ] = collision[ 0 ]; - } - - if ( options.at[ 0 ] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[ 0 ] === "center" ) { - basePosition.left += targetWidth / 2; - } - - if ( options.at[ 1 ] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[ 1 ] === "center" ) { - basePosition.top += targetHeight / 2; - } - - atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); - basePosition.left += atOffset[ 0 ]; - basePosition.top += atOffset[ 1 ]; - - return this.each(function() { - var collisionPosition, using, - elem = $( this ), - elemWidth = elem.outerWidth(), - elemHeight = elem.outerHeight(), - marginLeft = parseCss( this, "marginLeft" ), - marginTop = parseCss( this, "marginTop" ), - collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, - collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, - position = $.extend( {}, basePosition ), - myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); - - if ( options.my[ 0 ] === "right" ) { - position.left -= elemWidth; - } else if ( options.my[ 0 ] === "center" ) { - position.left -= elemWidth / 2; - } - - if ( options.my[ 1 ] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[ 1 ] === "center" ) { - position.top -= elemHeight / 2; - } - - position.left += myOffset[ 0 ]; - position.top += myOffset[ 1 ]; - - // if the browser doesn't support fractions, then round for consistent results - if ( !$.support.offsetFractions ) { - position.left = round( position.left ); - position.top = round( position.top ); - } - - collisionPosition = { - marginLeft: marginLeft, - marginTop: marginTop - }; - - $.each( [ "left", "top" ], function( i, dir ) { - if ( $.ui.position[ collision[ i ] ] ) { - $.ui.position[ collision[ i ] ][ dir ]( position, { - targetWidth: targetWidth, - targetHeight: targetHeight, - elemWidth: elemWidth, - elemHeight: elemHeight, - collisionPosition: collisionPosition, - collisionWidth: collisionWidth, - collisionHeight: collisionHeight, - offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], - my: options.my, - at: options.at, - within: within, - elem : elem - }); - } - }); - - if ( options.using ) { - // adds feedback as second argument to using callback, if present - using = function( props ) { - var left = targetOffset.left - position.left, - right = left + targetWidth - elemWidth, - top = targetOffset.top - position.top, - bottom = top + targetHeight - elemHeight, - feedback = { - target: { - element: target, - left: targetOffset.left, - top: targetOffset.top, - width: targetWidth, - height: targetHeight - }, - element: { - element: elem, - left: position.left, - top: position.top, - width: elemWidth, - height: elemHeight - }, - horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", - vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" - }; - if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { - feedback.horizontal = "center"; - } - if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { - feedback.vertical = "middle"; - } - if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { - feedback.important = "horizontal"; - } else { - feedback.important = "vertical"; - } - options.using.call( this, props, feedback ); - }; - } - - elem.offset( $.extend( position, { using: using } ) ); - }); -}; - -$.ui.position = { - fit: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, - outerWidth = within.width, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = withinOffset - collisionPosLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, - newOverRight; - - // element is wider than within - if ( data.collisionWidth > outerWidth ) { - // element is initially over the left side of within - if ( overLeft > 0 && overRight <= 0 ) { - newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; - position.left += overLeft - newOverRight; - // element is initially over right side of within - } else if ( overRight > 0 && overLeft <= 0 ) { - position.left = withinOffset; - // element is initially over both left and right sides of within - } else { - if ( overLeft > overRight ) { - position.left = withinOffset + outerWidth - data.collisionWidth; - } else { - position.left = withinOffset; - } - } - // too far left -> align with left edge - } else if ( overLeft > 0 ) { - position.left += overLeft; - // too far right -> align with right edge - } else if ( overRight > 0 ) { - position.left -= overRight; - // adjust based on position and margin - } else { - position.left = max( position.left - collisionPosLeft, position.left ); - } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollTop : within.offset.top, - outerHeight = data.within.height, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = withinOffset - collisionPosTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, - newOverBottom; - - // element is taller than within - if ( data.collisionHeight > outerHeight ) { - // element is initially over the top of within - if ( overTop > 0 && overBottom <= 0 ) { - newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; - position.top += overTop - newOverBottom; - // element is initially over bottom of within - } else if ( overBottom > 0 && overTop <= 0 ) { - position.top = withinOffset; - // element is initially over both top and bottom of within - } else { - if ( overTop > overBottom ) { - position.top = withinOffset + outerHeight - data.collisionHeight; - } else { - position.top = withinOffset; - } - } - // too far up -> align with top - } else if ( overTop > 0 ) { - position.top += overTop; - // too far down -> align with bottom edge - } else if ( overBottom > 0 ) { - position.top -= overBottom; - // adjust based on position and margin - } else { - position.top = max( position.top - collisionPosTop, position.top ); - } - } - }, - flip: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.offset.left + within.scrollLeft, - outerWidth = within.width, - offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = collisionPosLeft - offsetLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, - myOffset = data.my[ 0 ] === "left" ? - -data.elemWidth : - data.my[ 0 ] === "right" ? - data.elemWidth : - 0, - atOffset = data.at[ 0 ] === "left" ? - data.targetWidth : - data.at[ 0 ] === "right" ? - -data.targetWidth : - 0, - offset = -2 * data.offset[ 0 ], - newOverRight, - newOverLeft; - - if ( overLeft < 0 ) { - newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; - if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { - position.left += myOffset + atOffset + offset; - } - } - else if ( overRight > 0 ) { - newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; - if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { - position.left += myOffset + atOffset + offset; - } - } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.offset.top + within.scrollTop, - outerHeight = within.height, - offsetTop = within.isWindow ? within.scrollTop : within.offset.top, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = collisionPosTop - offsetTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, - top = data.my[ 1 ] === "top", - myOffset = top ? - -data.elemHeight : - data.my[ 1 ] === "bottom" ? - data.elemHeight : - 0, - atOffset = data.at[ 1 ] === "top" ? - data.targetHeight : - data.at[ 1 ] === "bottom" ? - -data.targetHeight : - 0, - offset = -2 * data.offset[ 1 ], - newOverTop, - newOverBottom; - if ( overTop < 0 ) { - newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; - if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { - position.top += myOffset + atOffset + offset; - } - } - else if ( overBottom > 0 ) { - newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; - if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { - position.top += myOffset + atOffset + offset; - } - } - } - }, - flipfit: { - left: function() { - $.ui.position.flip.left.apply( this, arguments ); - $.ui.position.fit.left.apply( this, arguments ); - }, - top: function() { - $.ui.position.flip.top.apply( this, arguments ); - $.ui.position.fit.top.apply( this, arguments ); - } - } -}; - -// fraction support test -(function () { - var testElement, testElementParent, testElementStyle, offsetLeft, i, - body = document.getElementsByTagName( "body" )[ 0 ], - div = document.createElement( "div" ); - - //Create a "fake body" for testing based on method used in jQuery.support - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0, - background: "none" - }; - if ( body ) { - $.extend( testElementStyle, { - position: "absolute", - left: "-1000px", - top: "-1000px" - }); - } - for ( i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || document.documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); - - div.style.cssText = "position: absolute; left: 10.7432222px;"; - - offsetLeft = $( div ).offset().left; - $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11; - - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); -})(); - -}( jQuery ) ); diff --git a/specials/SpecialMyLanguage.php b/specials/SpecialMyLanguage.php deleted file mode 100644 index 1d10085..0000000 --- a/specials/SpecialMyLanguage.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/** - * Contains logic for special page Special:MyLanguage - * - * @file - * @author Niklas Laxström - * @author Siebrand Mazeland - * @license GPL-2.0+ - */ - -# BC for MW < 1.24 -/** - * Unlisted special page just to redirect the user to the translated version of - * a page, if it exists. - * - * Usage: [[Special:MyLanguage/Page name|link text]] - * - * @ingroup SpecialPage TranslateSpecialPage - */ -class SpecialMyLanguage extends SpecialPage { - public function __construct() { - parent::__construct( 'MyLanguage' ); - } - - public function isListed() { - return false; - } - - /// Only takes arguments from $par - public function execute( $par ) { - $title = $this->findTitle( $par ); - // Go to the main page if given invalid title. - if ( !$title ) { - $title = Title::newMainPage(); - } - - $this->getOutput()->redirect( $title->getLocalURL() ); - } - - /** - * Assuming the user's interface language is fi. Given input Page, it - * returns Page/fi if it exists, otherwise Page. Given input Page/de, - * it returns Page/fi if it exists, otherwise Page/de if it exists, - * otherwise Page. - * @param $par - * @return Title|null - */ - protected function findTitle( $par ) { - global $wgLanguageCode; - // base = title without language code suffix - // provided = the title as it was given - $base = $provided = Title::newFromText( $par ); - - if ( strpos( $par, '/' ) !== false ) { - $pos = strrpos( $par, '/' ); - $basepage = substr( $par, 0, $pos ); - $code = substr( $par, $pos + 1 ); - $codes = Language::fetchLanguageNames(); - if ( isset( $codes[$code] ) ) { - $base = Title::newFromText( $basepage ); - } - } - - if ( !$base ) { - return null; - } - - $uiCode = $this->getLanguage()->getCode(); - $proposed = Title::newFromText( $base->getPrefixedText() . "/$uiCode" ); - if ( $uiCode !== $wgLanguageCode && $proposed && $proposed->exists() ) { - return $proposed; - } elseif ( $provided && $provided->exists() ) { - return $provided; - } else { - return $base; - } - } -} -- To view, visit https://gerrit.wikimedia.org/r/234559 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7a8c33d2c341e38d4a117fbaea8961983f281bdf Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Translate Gerrit-Branch: master Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits