From 8d31bf8c071cbb4d4dbfefd21494e9e70f395956 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Mon, 8 Oct 2012 00:13:34 +0200 Subject: [PATCH] Updated util functions names after refactoring jquery.uls.js is just updated from GitHub. Change-Id: I506ab810d7136ba5d96dfdd469394a843110f8de --- lib/jquery.uls/jquery.uls.js | 31 ++++++++++++++----------- resources/js/ext.uls.displaysettings.js | 6 ++--- resources/js/ext.uls.init.js | 8 +++++-- tests/webfonts.html | 4 ++-- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/lib/jquery.uls/jquery.uls.js b/lib/jquery.uls/jquery.uls.js index d7df3145..dba46938 100644 --- a/lib/jquery.uls/jquery.uls.js +++ b/lib/jquery.uls/jquery.uls.js @@ -728,37 +728,42 @@ }, listen: function () { - var that = this; + var lcd = this; + if ( this.options.clickhandler ) { this.$element.on( 'click', 'div.row li', function() { - that.options.clickhandler.call( this, $( this ).data( 'code' ) ); + lcd.options.clickhandler.call( this, $( this ).data( 'code' ) ); } ); } // The region section need to be in sync with the map filter. - that.$element.scroll( function () { - var scrollTop = $( this ).position().top; - var scrollBottom = $( this ).height(); - if ( this.offsetHeight + this.scrollTop >= this.scrollHeight/2 ) { - that.$element.trigger( 'scrollend' ); + lcd.$element.scroll( function () { + var $ulsLanguageList = $( this ), + scrollTop = $ulsLanguageList.position().top, + scrollBottom = $ulsLanguageList.height(); + + if ( this.offsetHeight + this.scrollTop >= this.scrollHeight / 2 ) { + lcd.$element.trigger( 'scrollend' ); } + // The region section need to be in sync with the map filter. var inviewRegion = 'WW'; - that.$element.find( 'div.uls-lcd-region-section' ).each( function () { - var top = $( this ).position().top; - var height = $( this ).height(); + lcd.$element.find( 'div.uls-lcd-region-section' ).each( function () { + var $lcdRegionSection = $( this ), + top = $lcdRegionSection.position().top, + height = $lcdRegionSection.height(); + if ( top < scrollTop && height > scrollBottom ) { - inviewRegion = $( this ).attr( 'id' ); + inviewRegion = $lcdRegionSection.attr( 'id' ); return true; } } ); + var inview = $.uls.data.regiongroups[inviewRegion]; $( '.regionselector' ).removeClass( 'active' ); $( '#uls-region-' + inview ).addClass( 'active' ); } ); - } - }; $.fn.lcd = function( option ) { diff --git a/resources/js/ext.uls.displaysettings.js b/resources/js/ext.uls.displaysettings.js index d4be4c66..cc8ac175 100644 --- a/resources/js/ext.uls.displaysettings.js +++ b/resources/js/ext.uls.displaysettings.js @@ -129,7 +129,7 @@ var language = languages[i]; var $button = $( '