Update jquery.uls from upstream

Upstream: https://github.com/wikimedia/jquery.uls
Changes:
* Reduce data size of uls language data a bit by using unescaped unicode
* Move the autonym font to example instead of making part of jquery.uls
* Use attr and prop consistently in jquery.uls.lcd.js
* Remove unnecessary object instance from jquery.uls.lcd.js
* Avoid 'recalculate style' by changing classes conditionally while
scrolling the language list
* Remove non-existing "-ms-linear-gradient"
* Localisation updates

Change-Id: I10b8658e29c03b136b4475c4c69ace33e5628a98
This commit is contained in:
Santhosh Thottingal
2013-11-01 15:01:51 +05:30
committed by Nikerabbit
parent 1114384c19
commit c197309810
4 changed files with 24 additions and 27 deletions

View File

@@ -196,7 +196,6 @@ div.uls-region {
background: -webkit-gradient(linear, left top, left bottom, from(#F0F0F0), to(#FBFBFB)); background: -webkit-gradient(linear, left top, left bottom, from(#F0F0F0), to(#FBFBFB));
background: -webkit-linear-gradient(top, #F0F0F0, #FBFBFB); background: -webkit-linear-gradient(top, #F0F0F0, #FBFBFB);
background: -moz-linear-gradient(top, #F0F0F0, #FBFBFB); background: -moz-linear-gradient(top, #F0F0F0, #FBFBFB);
background: -ms-linear-gradient(top, #F0F0F0, #FBFBFB);
background: -o-linear-gradient(top, #F0F0F0, #FBFBFB); background: -o-linear-gradient(top, #F0F0F0, #FBFBFB);
background: linear-gradient(#F0F0F0, #FBFBFB); background: linear-gradient(#F0F0F0, #FBFBFB);
border-top-color: #AAA; border-top-color: #AAA;
@@ -256,16 +255,3 @@ div.uls-region {
.uls-menu .search-input-block { .uls-menu .search-input-block {
position: relative; position: relative;
} }
@font-face {
font-family: 'Autonym';
src: url('font/Autonym.eot');
src: local('Autonym'),
url('font/Autonym.woff') format('woff'),
url('font/Autonym.ttf') format('truetype');
font-style: normal;
}
.autonym {
font-family: 'Autonym', sans-serif;
}

View File

@@ -1,13 +1,22 @@
{ {
"@metadata": { "@metadata": {
"authors": [ "authors": [
"Aquilax",
"DCLXVI" "DCLXVI"
] ]
}, },
"uls-select-language": "\u0418\u0437\u0431\u0438\u0440\u0430\u043d\u0435 \u043d\u0430 \u0435\u0437\u0438\u043a", "uls-select-language": "\u0418\u0437\u0431\u043e\u0440 \u043d\u0430 \u0435\u0437\u0438\u043a",
"uls-region-WW": "\u0421\u0432\u0435\u0442\u043e\u0432\u043d\u0438",
"uls-region-SP": "\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u043d\u0438",
"uls-region-AM": "\u0410\u043c\u0435\u0440\u0438\u043a\u0430", "uls-region-AM": "\u0410\u043c\u0435\u0440\u0438\u043a\u0430",
"uls-region-AF": "\u0410\u0444\u0440\u0438\u043a\u0430", "uls-region-AF": "\u0410\u0444\u0440\u0438\u043a\u0430",
"uls-region-EU": "\u0415\u0432\u0440\u043e\u043f\u0430", "uls-region-EU": "\u0415\u0432\u0440\u043e\u043f\u0430",
"uls-region-AS": "\u0410\u0437\u0438\u044f", "uls-region-AS": "\u0410\u0437\u0438\u044f",
"uls-no-results-found": "\u041d\u0435 \u0431\u044f\u0445\u0430 \u043e\u0442\u043a\u0440\u0438\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u0442\u0430\u0442\u0438" "uls-region-ME": "\u0411\u043b\u0438\u0437\u043a\u0438\u044f \u0438\u0437\u0442\u043e\u043a",
"uls-region-PA": "\u0422\u0438\u0445\u0438\u044f \u043e\u043a\u0435\u0430\u043d",
"uls-no-results-found": "\u041d\u0435 \u0431\u044f\u0445\u0430 \u043e\u0442\u043a\u0440\u0438\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u0442\u0430\u0442\u0438",
"uls-common-languages": "\u0427\u0435\u0441\u0442\u043e \u0441\u0440\u0435\u0449\u0430\u043d\u0438 \u0435\u0437\u0438\u0446\u0438",
"uls-no-results-suggestion-title": "\u041c\u043e\u0436\u0435\u0442\u0435 \u0434\u0430 \u0441\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0432\u0430\u0442\u0435 \u043e\u0442:",
"uls-search-help": "\u041c\u043e\u0436\u0435\u0442\u0435 \u0434\u0430 \u0442\u044a\u0440\u0441\u0438\u0442\u0435 \u043f\u043e \u0438\u043c\u0435 \u043d\u0430 \u0435\u0437\u0438\u043a, \u0438\u043c\u0435 \u043d\u0430 \u0441\u043a\u0440\u0438\u043f\u0442, ISO \u043a\u043e\u0434\u0430 \u043d\u0430 \u0435\u0437\u0438\u043a \u0438\u043b\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0430 \u0440\u0430\u0437\u0433\u043b\u0435\u0436\u0434\u0430\u0442\u0435 \u043f\u043e \u0440\u0435\u0433\u0438\u043e\u043d\u0438:",
"uls-search-placeholder": "\u0422\u044a\u0440\u0441\u0435\u043d\u0435 \u043d\u0430 \u0435\u0437\u0438\u043a"
} }

File diff suppressed because one or more lines are too long

View File

@@ -77,8 +77,7 @@
*/ */
addToRegion: function ( langCode, region ) { addToRegion: function ( langCode, region ) {
var i, regionCode, $li, $column, lastLanguage, lastScriptGroup, currentScriptGroup, var i, regionCode, $li, $column, lastLanguage, lastScriptGroup, currentScriptGroup,
lcd = this, language = this.options.languages[langCode],
language = lcd.options.languages[langCode],
langName = $.uls.data.getAutonym( langCode ) || language || langCode, langName = $.uls.data.getAutonym( langCode ) || language || langCode,
regions = []; regions = [];
@@ -103,11 +102,11 @@
dir: $.uls.data.getDir( langCode ) dir: $.uls.data.getDir( langCode )
} ) } )
.append( .append(
$( '<a>' ).prop( 'title', language ).html( langName ) $( '<a>' ).attr( 'title', language ).text( langName )
); );
// Append the element to the column in the list // Append the element to the column in the list
$column = lcd.getColumn( regionCode ); $column = this.getColumn( regionCode );
lastLanguage = $column.find( 'li:last' ).data( 'code' ); lastLanguage = $column.find( 'li:last' ).data( 'code' );
if ( lastLanguage ) { if ( lastLanguage ) {
@@ -117,7 +116,7 @@
if ( lastScriptGroup !== currentScriptGroup ) { if ( lastScriptGroup !== currentScriptGroup ) {
if ( $column.find( 'li' ).length > 2 ) { if ( $column.find( 'li' ).length > 2 ) {
// If column already has 2 or more languages, add a new column // If column already has 2 or more languages, add a new column
$column = lcd.getColumn( regionCode, true ); $column = this.getColumn( regionCode, true );
} }
} }
} }
@@ -176,7 +175,7 @@
}; };
$.each( $.uls.data.regiongroups, function ( regionCode ) { $.each( $.uls.data.regiongroups, function ( regionCode ) {
$section = $( '<div>' ).addClass( 'twelve columns uls-lcd-region-section' ).prop( 'id', regionCode ); $section = $( '<div>' ).addClass( 'twelve columns uls-lcd-region-section' ).attr( 'id', regionCode );
$sectionTitle = $( '<h3>' ) $sectionTitle = $( '<h3>' )
.attr( 'data-i18n', 'uls-region-' + regionCode ) .attr( 'data-i18n', 'uls-region-' + regionCode )
@@ -214,7 +213,7 @@
quickList = quickList.slice( 0, 16 ); quickList = quickList.slice( 0, 16 );
quickList.sort( $.uls.data.sortByAutonym ); quickList.sort( $.uls.data.sortByAutonym );
$quickListSection = $( '<div>' ).addClass( 'twelve columns uls-lcd-region-section' ).prop( 'id', 'uls-lcd-quicklist' ); $quickListSection = $( '<div>' ).addClass( 'twelve columns uls-lcd-region-section' ).attr( 'id', 'uls-lcd-quicklist' );
$quickListSectionTitle = $( '<h3>' ) $quickListSectionTitle = $( '<h3>' )
.attr( 'data-i18n', 'uls-common-languages' ) .attr( 'data-i18n', 'uls-common-languages' )
.addClass( 'eleven columns uls-lcd-region-section uls-lcd-region-title offset-by-one' ) .addClass( 'eleven columns uls-lcd-region-section uls-lcd-region-title offset-by-one' )
@@ -235,7 +234,7 @@
dir: $.uls.data.getDir( langCode ) dir: $.uls.data.getDir( langCode )
} ) } )
.append( .append(
$( '<a>' ).prop( 'title', language ).html( langName ) $( '<a>' ).attr( 'title', language ).text( langName )
); );
$column.append( $li ); $column.append( $li );
} }
@@ -302,9 +301,12 @@
} }
} ); } );
// highlight the region visible while scrolling in the map.
inview = $.uls.data.regiongroups[inviewRegion]; inview = $.uls.data.regiongroups[inviewRegion];
if ( !$( '#uls-region-' + inview ).hasClass( 'active' ) ) {
$( '.regionselector' ).removeClass( 'active' ); $( '.regionselector' ).removeClass( 'active' );
$( '#uls-region-' + inview ).addClass( 'active' ); $( '#uls-region-' + inview ).addClass( 'active' );
}
} ); } );
} }
}; };