Update upstream jquery.uls to 10777bb
* Don't show region headings in narrow mode.
* Remove the map.
GitHub link: 10777bb25e
Change-Id: I4fcfba5a6ef46d0bda34331c6ea111cdedd157a7
This commit is contained in:
@@ -28,34 +28,9 @@
|
||||
template = '<div class="grid uls-menu"> \
|
||||
<div class="row"> \
|
||||
<span id="uls-close" class="uls-icon-close"></span> \
|
||||
</div> \
|
||||
<div class="row"> \
|
||||
<div class="uls-title-region seven columns">\
|
||||
<h1 data-i18n="uls-select-language" class="uls-title">Select Language</h1>\
|
||||
</div>\
|
||||
<div class="five columns uls-map-block" id="uls-map-block">\
|
||||
<div class="row">\
|
||||
<div data-regiongroup="1" id="uls-region-1" class="three columns uls-region uls-region-1">\
|
||||
<a data-i18n="uls-region-WW">Worldwide</a>\
|
||||
</div>\
|
||||
<div class="nine columns">\
|
||||
<div class="row uls-worldmap">\
|
||||
<div data-regiongroup="2" id="uls-region-2" class="four columns uls-region">\
|
||||
<a data-i18n="uls-region-AM">America</a>\
|
||||
</div>\
|
||||
<div data-regiongroup="3" id="uls-region-3" class="four columns uls-region">\
|
||||
<a><span data-i18n="uls-region-EU">Europe</span><br>\
|
||||
<span data-i18n="uls-region-ME">Middle East</span><br>\
|
||||
<span data-i18n="uls-region-AF">Africa</span></a>\
|
||||
</div>\
|
||||
<div data-regiongroup="4" id="uls-region-4" class="four columns uls-region">\
|
||||
<a><span data-i18n="uls-region-AS">Asia</span><br>\
|
||||
<span data-i18n="uls-region-PA">Pacific</span></a>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div id="search" class="row uls-search"> \
|
||||
<div class="one column">\
|
||||
@@ -88,9 +63,9 @@
|
||||
this.languages = this.options.languages;
|
||||
|
||||
for ( var code in this.languages ) {
|
||||
if ( $.uls.data.languages[code] === undefined ) {
|
||||
if ( $.uls.data.languages[ code ] === undefined ) {
|
||||
// Language is unknown to ULS.
|
||||
delete this.languages[code];
|
||||
delete this.languages[ code ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +75,6 @@
|
||||
this.initialized = false;
|
||||
|
||||
this.$languageFilter = this.$menu.find( '#uls-languagefilter' );
|
||||
this.$regionFilters = this.$menu.find( '.uls-region' );
|
||||
this.$resultsView = this.$menu.find( 'div.uls-language-list' );
|
||||
|
||||
this.render();
|
||||
@@ -147,7 +121,7 @@
|
||||
var pos;
|
||||
|
||||
pos = $.extend( {}, this.$element.offset(), {
|
||||
height: this.$element[0].offsetHeight
|
||||
height: this.$element[ 0 ].offsetHeight
|
||||
} );
|
||||
|
||||
return {
|
||||
@@ -166,7 +140,7 @@
|
||||
narrow: 'uls-narrow'
|
||||
};
|
||||
|
||||
this.$menu.addClass( widthClasses[this.options.menuWidth] );
|
||||
this.$menu.addClass( widthClasses[this.getMenuWidth()] );
|
||||
this.$menu.css( this.position() );
|
||||
|
||||
if ( this.options.compact ) {
|
||||
@@ -176,11 +150,6 @@
|
||||
if ( !this.initialized ) {
|
||||
$( 'body' ).prepend( this.$menu );
|
||||
this.i18n();
|
||||
|
||||
// Initialize with a full search.
|
||||
// This happens on first time click of uls trigger.
|
||||
this.defaultSearch();
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
@@ -205,12 +174,6 @@
|
||||
}
|
||||
},
|
||||
|
||||
defaultSearch: function () {
|
||||
this.$resultsView.lcd( 'empty' );
|
||||
|
||||
this.$regionFilters.regionselector( 'show' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide the ULS window
|
||||
*/
|
||||
@@ -231,7 +194,6 @@
|
||||
* Callback for no results found context.
|
||||
*/
|
||||
noresults: function () {
|
||||
$( '.regionselector' ).removeClass( 'active' );
|
||||
this.$resultsView.lcd( 'noResults' );
|
||||
},
|
||||
|
||||
@@ -239,10 +201,10 @@
|
||||
* callback for results found context.
|
||||
*/
|
||||
success: function () {
|
||||
$( '.regionselector' ).removeClass( 'active' );
|
||||
this.$resultsView.show();
|
||||
},
|
||||
|
||||
/**
|
||||
/**
|
||||
* Bind the UI elements with their event listeners
|
||||
*/
|
||||
@@ -259,10 +221,6 @@
|
||||
// Register all event listeners to the ULS here.
|
||||
this.$element.on( 'click', $.proxy( this.click, this ) );
|
||||
|
||||
this.$languageFilter.on( 'searchclear.uls', $.proxy( this.defaultSearch, this ) );
|
||||
this.$languageFilter.on( 'noresults.uls', $.proxy( this.noresults, this ) );
|
||||
this.$languageFilter.on( 'resultsfound.uls', $.proxy( this.success, this ) );
|
||||
|
||||
// Close when clicking on the close button
|
||||
this.$menu.find( '#uls-close' ).on( 'click', $.proxy( this.cancel, this ) );
|
||||
// Don't do anything if pressing on empty space in the ULS
|
||||
@@ -280,7 +238,7 @@
|
||||
|
||||
lcd = this.$resultsView.lcd( {
|
||||
languages: this.languages,
|
||||
columns: columnsOptions[this.options.menuWidth],
|
||||
columns: columnsOptions[ this.getMenuWidth() ],
|
||||
quickList: this.options.quickList,
|
||||
clickhandler: $.proxy( this.select, this ),
|
||||
source: this.$languageFilter,
|
||||
@@ -296,7 +254,7 @@
|
||||
} );
|
||||
|
||||
// Create region selectors, one per region
|
||||
this.$menu.find( '.uls-region, .uls-region-link' ).regionselector( {
|
||||
this.regionFilter = new $.uls.RegionSelector( {
|
||||
$target: lcd,
|
||||
languages: this.languages,
|
||||
success: function ( regionfilter ) {
|
||||
@@ -316,6 +274,10 @@
|
||||
}
|
||||
} );
|
||||
|
||||
this.$languageFilter.on( 'searchclear.uls', $.proxy( this.regionFilter.show, this.regionFilter ) );
|
||||
this.$languageFilter.on( 'noresults.uls', $.proxy( this.noresults, this ) );
|
||||
this.$languageFilter.on( 'resultsfound.uls', $.proxy( this.success, this ) );
|
||||
|
||||
$( 'html' ).click( $.proxy( this.cancel, this ) );
|
||||
},
|
||||
|
||||
@@ -382,12 +344,36 @@
|
||||
|
||||
if ( !isSupported ) {
|
||||
this.$element.setAttribute( eventName, 'return;' );
|
||||
isSupported = typeof this.$element[eventName] === 'function';
|
||||
isSupported = typeof this.$element[ eventName ] === 'function';
|
||||
}
|
||||
|
||||
return isSupported;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the panel menu width parameter
|
||||
* @return string
|
||||
*/
|
||||
getMenuWidth: function () {
|
||||
var languagesCount;
|
||||
|
||||
if ( this.options.menuWidth ) {
|
||||
return this.options.menuWidth;
|
||||
}
|
||||
|
||||
languagesCount = Object.keys( this.options.languages ).length;
|
||||
|
||||
if ( languagesCount < 12 ) {
|
||||
return 'narrow';
|
||||
}
|
||||
|
||||
if ( languagesCount < 100 ) {
|
||||
return 'medium';
|
||||
}
|
||||
|
||||
return 'wide';
|
||||
},
|
||||
|
||||
isMobile: function () {
|
||||
return navigator.userAgent.match( /(iPhone|iPod|iPad|Android|BlackBerry)/ );
|
||||
}
|
||||
@@ -407,7 +393,7 @@
|
||||
}
|
||||
|
||||
if ( typeof option === 'string' ) {
|
||||
data[option]();
|
||||
data[ option ]();
|
||||
}
|
||||
} );
|
||||
};
|
||||
@@ -418,7 +404,9 @@
|
||||
languages: $.uls.data.getAutonyms(), // Languages to be used for ULS, default is all languages
|
||||
quickList: null, // Array of language codes or function that returns such
|
||||
compact: false, // Show ULS in compact mode
|
||||
menuWidth: 'wide', // The options are wide (4 columns), medium (2 columns), and narrow (1 column)
|
||||
// The options are wide (4 columns), medium (2 columns), and narrow (1 column).
|
||||
// If not specified, it will be set automatically.
|
||||
menuWidth: null,
|
||||
showRegions: [ 'WW', 'AM', 'EU', 'ME', 'AF', 'AS', 'PA' ],
|
||||
languageDecorator: null // Callback function to be called when a language link is prepared - for custom decoration.
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user