Whitespace cleanup, remove deprecated methods

* Fixed many white space issues- mainly whitespace missing before
  function start paranthesis eg: function()
* Removed the deprecated live methods and replaced with on
* Added file documentation for ext.uls.geoclient

Change-Id: Ib2c8cfed1a6ff3859495e707680d5c19882a33e8
This commit is contained in:
Santhosh Thottingal
2012-09-07 16:43:53 +05:30
parent d29364989f
commit 5b3f7cc269
6 changed files with 85 additions and 63 deletions

View File

@@ -152,8 +152,7 @@
left: that.$parent.left,
top: that.$parent.top,
onReady: function ( uls ) {
var $back = $( '<a>' )
.prop( 'href', '#' )
var $back = $( '<a>' ).prop( 'href', '#' )
.prop( 'title', 'Back to display settings' )
.text( '← Back to display settings' ); // FIXME i18n
@@ -227,8 +226,7 @@
if ( fonts && fonts.length ) {
$.each( fonts, function ( key, font ) {
var $fontOption = $( "<option>" )
.attr( "value", font ).text( font );
var $fontOption = $( "<option>" ).attr( "value", font ).text( font );
$fontSelector.append( $fontOption );
$fontOption.attr( 'selected', savedFont === font );
} );
@@ -256,8 +254,7 @@
if ( fonts && fonts.length ) {
$.each( fonts, function ( key, font ) {
var $fontOption = $( "<option>" )
.attr( "value", font ).text( font );
var $fontOption = $( "<option>" ).attr( "value", font ).text( font );
$fontSelector.append( $fontOption );
$fontOption.attr( 'selected', savedFont === font );
} );
@@ -277,9 +274,10 @@
* Register general event listeners
*/
listen: function () {
var that = this,
$contentFontSelector = this.$template.find( "select#content-font-selector" ),
$uiFontSelector = this.$template.find( "select#ui-font-selector" );
var that = this;
var $contentFontSelector = this.$template
.find( "select#content-font-selector" ), $uiFontSelector = this.$template
.find( "select#ui-font-selector" );
// TODO all these repeated selectors can be placed in object constructor.
this.$template.find( 'button#uls-displaysettings-apply' ).on( 'click', function () {
@@ -361,4 +359,6 @@
$.fn.languagesettings.modules = $.extend( $.fn.languagesettings.modules, {
display: DisplaySettings
} );
}( jQuery, mediaWiki, window ) );

View File

@@ -1,3 +1,22 @@
/**
* ULS GeoIP client
*
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
* Niklas Laxström, Pau Giner, Santhosh Thottingal, Siebrand Mazeland and other
* contributors. See CREDITS for a list.
*
* UniversalLanguageSelector is dual licensed GPLv2 or later and MIT. You don't
* have to do anything special to choose one license or the other and you don't
* have to notify anyone which license you are using. You are free to use
* UniversalLanguageSelector in commercial projects as long as the copyright
* header is left intact. See files GPL-LICENSE and MIT-LICENSE for details.
*
* @file
* @ingroup Extensions
* @licence GNU General Public Licence 2.0 or later
* @licence MIT License
*/
( function( mw, $ ) {
"use strict";

View File

@@ -173,27 +173,27 @@
// to give the user a better chance to see it.
6000
);
$( '.tipsy' ).live( 'mouseout', function( e ) {
tipsyTimer = window.setTimeout( function() {
$ulsTrigger.tipsy('hide');
},
3000 // hide the link in 3 seconds
);
} );
// manually show the tooltip
$ulsTrigger.on( 'mouseover', function ( e ) {
$( this ).tipsy( 'show' );
// if the mouse is over the tooltip, do not hide
$( '.tipsy' ).live( 'mouseover', function( e ) {
$( '.tipsy' ).on( 'mouseover', function ( e ) {
window.clearTimeout( tipsyTimer );
} );
// manually show the tooltip
$ulsTrigger.bind( 'mouseover', function( e ) {
$( this ).tipsy( 'show' );
$( '.tipsy' ).on( 'mouseout', function ( e ) {
tipsyTimer = window.setTimeout( function () {
$ulsTrigger.tipsy( 'hide' );
}, 3000 // hide the link in 3 seconds
);
} );
} );
// hide the tooltip when clicked on uls trigger
$ulsTrigger.bind( 'click', function( e ) {
$ulsTrigger.on( 'click', function ( e ) {
$( this ).tipsy( 'hide' );
} );
// Event handler for links in the tooltip
$( 'a.uls-lang-link' ).live( 'click', function() {
$( 'a.uls-lang-link' ).on( 'click', function () {
mw.uls.changeLanguage( $( this ).attr( 'lang' ) );
} );
} );

View File

@@ -64,7 +64,8 @@
var that = this;
// Register all event listeners to the ULS language settings here.
that.$element.on( "click", $.proxy( that.show, that ) );
that.$window.find( 'span#languagesettings-close' ).on( "click", $.proxy( that.hide, that ) );
that.$window.find( 'languagesettings-close' )
.on( "click", $.proxy( that.hide, that ) );
},
render: function () {

View File

@@ -18,7 +18,7 @@
* @licence MIT License
*/
( function( $, mw ) {
( function ( $, mw, undefined ) {
"use strict";
var ULSPreferences = function ( group ) {
@@ -46,6 +46,7 @@
/**
* Set the preference
*
* @param {String} key
* @param value
*/
@@ -58,6 +59,7 @@
/**
* Get a preference value for the given preference name
*
* @param key
* @returns
*/