After training the PHPStorm code formatter.
See https://github.com/siebrand/MediaWiki-PHPStorm Issue remains with anonymous functions in JavaScript. Change-Id: I2b520f8df127452acf02deb659277a6465e6ca59
This commit is contained in:
@@ -32,6 +32,7 @@ class UniversalLanguageSelectorHooks {
|
||||
if ( $wgULSGeoService ) {
|
||||
$out->addModules( 'ext.uls.geoclient' );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,6 +49,7 @@ class UniversalLanguageSelectorHooks {
|
||||
'localBasePath' => __DIR__,
|
||||
'remoteExtPath' => 'UniversalLanguageSelector',
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,17 +59,21 @@ class UniversalLanguageSelectorHooks {
|
||||
*/
|
||||
static function addTrigger( array &$personal_urls, &$title ) {
|
||||
global $wgLang;
|
||||
$personal_urls = array( 'uls' => array(
|
||||
$personal_urls = array(
|
||||
'uls' => array(
|
||||
'text' => $wgLang->getLanguageName( $wgLang->getCode() ),
|
||||
'href' => '#',
|
||||
'class' => 'uls-trigger',
|
||||
'active' => true
|
||||
) ) + $personal_urls;
|
||||
)
|
||||
) + $personal_urls;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected static function isSupportedLanguage( $language ) {
|
||||
$supported = Language::fetchLanguageNames( null, 'mwfile' );
|
||||
|
||||
return isset( $supported[$language] );
|
||||
}
|
||||
|
||||
@@ -93,6 +99,7 @@ class UniversalLanguageSelectorHooks {
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -151,6 +158,7 @@ class UniversalLanguageSelectorHooks {
|
||||
public static function addConfig( &$vars ) {
|
||||
global $wgULSGeoService;
|
||||
$vars['wgULSGeoService'] = $wgULSGeoService;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -160,8 +168,11 @@ class UniversalLanguageSelectorHooks {
|
||||
* @return bool
|
||||
*/
|
||||
public static function addVariables( &$vars, OutputPage $out ) {
|
||||
$vars['wgULSLanguages'] = Language::fetchLanguageNames( $out->getLanguage()->getCode(), 'mwfile' );
|
||||
$vars['wgULSLanguages'] = Language::fetchLanguageNames(
|
||||
$out->getLanguage()->getCode(), 'mwfile'
|
||||
);
|
||||
$vars['wgULSAcceptLanguageList'] = array_keys( $out->getRequest()->getAcceptLang() );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ class ApiLanguageSearch extends ApiBase {
|
||||
'api.php?action=languagesearch&search=ഫി&typos=1',
|
||||
);
|
||||
}
|
||||
|
||||
public function getVersion() {
|
||||
return __CLASS__ . ': ' . ULS_VERSION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ class LanguageNameSearch {
|
||||
$results[$code] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
@@ -57,6 +58,7 @@ class LanguageNameSearch {
|
||||
if ( !isset( $buckets[$bucket] ) ) {
|
||||
$buckets[$bucket] = array();
|
||||
}
|
||||
|
||||
return $bucket;
|
||||
}
|
||||
|
||||
@@ -82,6 +84,7 @@ class LanguageNameSearch {
|
||||
if ( count( $values ) === $lookingFor ) {
|
||||
// Refer http://en.wikipedia.org/wiki/UTF-8#Description
|
||||
$number = ( $lookingFor === 3 ) ? ( ( $values[0] % 16 ) * 4096 ) + ( ( $values[1] % 64 ) * 64 ) + ( $values[2] % 64 ) : ( ( $values[0] % 32 ) * 64 ) + ( $values[1] % 64 );
|
||||
|
||||
return $number;
|
||||
}
|
||||
}
|
||||
@@ -120,7 +123,7 @@ class LanguageNameSearch {
|
||||
}
|
||||
$prevRow = $currentRow;
|
||||
}
|
||||
|
||||
return $prevRow[$length2];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ button.button.down {
|
||||
button.button:disabled,
|
||||
button.button.hover:disabled,
|
||||
button.button.disabled,
|
||||
button.button.disabled:hover
|
||||
{
|
||||
button.button.disabled:hover {
|
||||
background-color: #F0F0F0;
|
||||
background-image: -webkit-linear-gradient(top, #f0f0f0, #f0f0f0);
|
||||
background-image: -moz-linear-gradient(center top, #F0F0F0, #F0F0F0);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#uls-current-language-nav { /* @embed */
|
||||
background: url('../images/cog-16x16-ltr.png') no-repeat scroll right
|
||||
top transparent;
|
||||
background: url('../images/cog-16x16-ltr.png') no-repeat scroll right top transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -93,7 +92,6 @@
|
||||
border-left-color: #3366BB;
|
||||
}
|
||||
|
||||
|
||||
#languagesettings-panels div#settings-block {
|
||||
border-left: 1px solid #C9C9C9;
|
||||
padding-left: 10px;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
searchAPI: mw.util.wikiScript( 'api' ) + "?action=languagesearch"
|
||||
} );
|
||||
|
||||
|
||||
var currentLang = mw.config.get( 'wgUserLanguage' );
|
||||
mw.uls = mw.uls || {};
|
||||
mw.uls.previousLanguagesCookie = 'uls-previous-languages';
|
||||
@@ -65,9 +64,11 @@
|
||||
|
||||
mw.uls.getFrequentLanguageList = function () {
|
||||
var unique = [],
|
||||
list = [ mw.config.get( 'wgUserLanguage' ),
|
||||
list = [
|
||||
mw.config.get( 'wgUserLanguage' ),
|
||||
mw.config.get( 'wgContentLanguage' ),
|
||||
mw.uls.getBrowserLanguage() ]
|
||||
mw.uls.getBrowserLanguage()
|
||||
]
|
||||
.concat( mw.uls.getPreviousLanguages() )
|
||||
.concat( mw.uls.getAcceptLanguageList() );
|
||||
if ( window.GEO ) {
|
||||
@@ -136,7 +137,6 @@
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
if ( !previousLang ) {
|
||||
previousLanguages.push( currentLang );
|
||||
mw.uls.setPreviousLanguages( previousLanguages );
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
settingsMenu +
|
||||
settingsPanel +
|
||||
'</div>';
|
||||
var windowTemplate = '<div style="display: block;" id="language-settings-dialog" class="uls-menu">' +
|
||||
closeRow +
|
||||
panelsRow +
|
||||
'</div>';
|
||||
var windowTemplate = '<div style="display: block;" id="language-settings-dialog" class="uls-menu">'
|
||||
+ closeRow
|
||||
+ panelsRow
|
||||
+ '</div>';
|
||||
|
||||
var LanguageSettings = function ( element, options ) {
|
||||
this.$element = $( element );
|
||||
|
||||
@@ -82,59 +82,84 @@ test( "-- $.uls.data testing", function() {
|
||||
);
|
||||
|
||||
strictEqual( $.uls.data.script( 'ii' ), 'Yiii', 'Correct script of the Yi language was selected' );
|
||||
deepEqual( $.uls.data.regions( 'lzz' ), [ 'EU', 'ME' ], 'Correct regions of the Laz language were selected' );
|
||||
deepEqual( $.uls.data.regions( 'lzz' ), [
|
||||
'EU', 'ME'
|
||||
], 'Correct regions of the Laz language were selected' );
|
||||
strictEqual( $.uls.data.regions( 'no-such-language' ), 'UNKNOWN', "The region of an invalid language is 'UNKNOWN'" );
|
||||
|
||||
var allLanguagesByRegionAndScript = $.uls.data.allLanguagesByRegionAndScript();
|
||||
deepEqual( allLanguagesByRegionAndScript['4']['AS']['SouthEastAsian']['Bugi'], ['bug'], 'All languages in the Buginese script in Asia were selected' );
|
||||
deepEqual( allLanguagesByRegionAndScript['4']['AS']['SouthEastAsian']['Bugi'], [
|
||||
'bug'
|
||||
], 'All languages in the Buginese script in Asia were selected' );
|
||||
|
||||
deepEqual( $.uls.data.languagesInRegion( "PA" ),
|
||||
["ace", "bi", "ch", "en-gb", "en", "fj", "haw", "hif-latn", "hif", "ho", "jv",
|
||||
[
|
||||
"ace", "bi", "ch", "en-gb", "en", "fj", "haw", "hif-latn", "hif", "ho", "jv",
|
||||
"mh", "mi", "na", "niu", "pih", "pis", "pt", "rtm", "sm", "tet",
|
||||
"to", "tpi", "ty", "wls"],
|
||||
"to", "tpi", "ty", "wls"
|
||||
],
|
||||
"languages of region PA are selected correctly" );
|
||||
deepEqual( $.uls.data.languagesInRegions( ["AM", "WW"] ),
|
||||
[
|
||||
"akz", "arn", "aro", "ase", "avk", "ay", "cho", "chr", "chy", "cr-cans", "cr-latn", "cr",
|
||||
"en-ca", "en", "eo", "es-419", "es-formal", "es", "esu", "fr",
|
||||
"gcf", "gn", "guc", "haw", "ht", "ia", "ie", "ik", "ike-cans", "ike-latn", "io", "iu",
|
||||
"jam", "jbo", "kgp", "kl", "lad", "lfn", "mfe", "mic", "mus", "nah", "nl-informal", "nl", "nov", "nv",
|
||||
"pap", "pdc", "pdt", "ppl", "pt-br", "pt", "qu", "qug", "rap", "sei", "simple", "srn", "tokipona",
|
||||
"vo", "yi", "yrl", "yua"
|
||||
"akz", "arn", "aro", "ase", "avk", "ay", "cho", "chr", "chy", "cr-cans", "cr-latn",
|
||||
"cr", "en-ca", "en", "eo", "es-419", "es-formal", "es", "esu", "fr", "gcf", "gn",
|
||||
"guc", "haw", "ht", "ia", "ie", "ik", "ike-cans", "ike-latn", "io", "iu", "jam",
|
||||
"jbo", "kgp", "kl", "lad", "lfn", "mfe", "mic", "mus", "nah", "nl-informal", "nl",
|
||||
"nov", "nv", "pap", "pdc", "pdt", "ppl", "pt-br", "pt", "qu", "qug", "rap", "sei",
|
||||
"simple", "srn", "tokipona", "vo", "yi", "yrl", "yua"
|
||||
],
|
||||
"languages of regions AM and WW are selected correctly"
|
||||
);
|
||||
|
||||
deepEqual( $.uls.data.languagesInScript( 'Knda' ), ["kn", "tcy"], "languages in script Knda are selected correctly" );
|
||||
deepEqual( $.uls.data.languagesInScript( 'Knda' ), [
|
||||
"kn", "tcy"
|
||||
], "languages in script Knda are selected correctly" );
|
||||
deepEqual( $.uls.data.languagesInScripts( ['Geor', 'Armn'] ),
|
||||
["hy", "ka", "xmf"],
|
||||
"languages in scripts Geor and Armn are selected correctly"
|
||||
);
|
||||
|
||||
deepEqual( $.uls.data.regionsInGroup( 3 ), ["EU", "ME", "AF"], "regions in group 2 are selected correctly" );
|
||||
deepEqual( $.uls.data.regionsInGroup( 2 ), ["AM"], "regions in group 2 are selected correctly" );
|
||||
deepEqual( $.uls.data.regionsInGroup( 1 ), ["WW"], "regions in group 1 are selected correctly" );
|
||||
deepEqual( $.uls.data.regionsInGroup( 3 ), [
|
||||
"EU", "ME", "AF"
|
||||
], "regions in group 2 are selected correctly" );
|
||||
deepEqual( $.uls.data.regionsInGroup( 2 ), [
|
||||
"AM"
|
||||
], "regions in group 2 are selected correctly" );
|
||||
deepEqual( $.uls.data.regionsInGroup( 1 ), [
|
||||
"WW"
|
||||
], "regions in group 1 are selected correctly" );
|
||||
|
||||
var languagesByScriptInAM = $.uls.data.languagesByScriptInRegion( "AM" );
|
||||
deepEqual( languagesByScriptInAM['Cans'], ["cr-cans", "cr", "ike-cans", "iu"], "correct languages in Cans in AM selected" );
|
||||
deepEqual( languagesByScriptInAM['Cans'], [
|
||||
"cr-cans", "cr", "ike-cans", "iu"
|
||||
], "correct languages in Cans in AM selected" );
|
||||
|
||||
strictEqual( $.uls.data.autonym( 'pa' ), 'ਪੰਜਾਬੀ', 'Correct autonym of the Punjabi language was selected' );
|
||||
|
||||
var languagesByScriptGroupInEMEA = $.uls.data.languagesByScriptGroupInRegions( $.uls.data.regionsInGroup( 3 ) );
|
||||
deepEqual( languagesByScriptGroupInEMEA['WestCaucasian'], ['hy', 'ka', 'xmf'], 'Correct languages in WestCaucasian script group in EMEA selected' );
|
||||
deepEqual( languagesByScriptGroupInEMEA['WestCaucasian'], [
|
||||
'hy', 'ka', 'xmf'
|
||||
], 'Correct languages in WestCaucasian script group in EMEA selected' );
|
||||
|
||||
var allLanguagesByScriptGroup = $.uls.data.allLanguagesByScriptGroup();
|
||||
deepEqual( allLanguagesByScriptGroup['Greek'], ['el', 'grc', 'pnt', 'ruq-grek', 'tsd'], 'All languages in the Greek script found' );
|
||||
deepEqual( allLanguagesByScriptGroup['Greek'], [
|
||||
'el', 'grc', 'pnt', 'ruq-grek', 'tsd'
|
||||
], 'All languages in the Greek script found' );
|
||||
|
||||
deepEqual( $.uls.data.allRegions(), ["WW", "AM", "EU", "ME", "AF", "AS", "PA"], "All regions found" );
|
||||
deepEqual( $.uls.data.allRegions(), [
|
||||
"WW", "AM", "EU", "ME", "AF", "AS", "PA"
|
||||
], "All regions found" );
|
||||
|
||||
// autonyms: gn: avañe'ẽ, de: deutsch, hu: magyar, fi: suomi
|
||||
deepEqual( ['de', 'fi', 'gn', 'hu'].sort( $.uls.data.sortByAutonym ), ['gn', 'de', 'hu', 'fi'], 'Languages are correctly sorted by autonym' );
|
||||
deepEqual( ['de', 'fi', 'gn', 'hu'].sort( $.uls.data.sortByAutonym ), [
|
||||
'gn', 'de', 'hu', 'fi'
|
||||
], 'Languages are correctly sorted by autonym' );
|
||||
|
||||
strictEqual( $.uls.data.isRtl( "te" ), false, "Telugu language is not RTL" );
|
||||
strictEqual( $.uls.data.isRtl( "dv" ), true, "Divehi language is RTL" );
|
||||
|
||||
ok( $.inArray( "sah", $.uls.data.languagesInTerritory( "RU" ) ) > -1, "Sakha language is spoken in Russia" );
|
||||
ok( $.inArray( "sah", $.uls.data.languagesInTerritory( "RU" ) )
|
||||
> -1, "Sakha language is spoken in Russia" );
|
||||
} );
|
||||
|
||||
}() );
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
} );
|
||||
$fontSelector.trigger( 'change' );
|
||||
}
|
||||
|
||||
listFonts( fonts );
|
||||
$.each( languages, function ( lang, language ) {
|
||||
$langselector.append( $( "<option></option>" ).attr(
|
||||
@@ -110,7 +111,8 @@ select {
|
||||
</div>
|
||||
</div>
|
||||
<div contenteditable="true" id="webfonts-preview-area">The quick brown fox jumps over the
|
||||
lazy dog</div>
|
||||
lazy dog
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user