Update test files

- Updated versions and order of checkers.
- Some consistency updates in Gruntfile.js.
- Updates to make jscs pass.

Change-Id: I7ed93596ff383dc713bd17af2da0472be934d59d
This commit is contained in:
Siebrand Mazeland
2016-02-15 08:41:22 +01:00
committed by Nikerabbit
parent faa5c06bda
commit 6a2b2e0bba
19 changed files with 137 additions and 73 deletions

View File

@@ -1,3 +1,4 @@
{ {
"preset": "wikimedia" "preset": "wikimedia",
"requireCamelCaseOrUpperCaseIdentifiers": null
} }

View File

@@ -1,6 +1,6 @@
{ {
"camelcase": true, "camelcase": false,
"curly": true, "curly": true,
"eqeqeq": true, "eqeqeq": true,
"immed": true, "immed": true,

View File

@@ -1,10 +1,11 @@
/*jshint node:true */ /*jshint node:true */
module.exports = function ( grunt ) { module.exports = function ( grunt ) {
'use strict'; 'use strict';
grunt.loadNpmTasks( 'grunt-contrib-jshint' ); grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-jscs' ); grunt.loadNpmTasks( 'grunt-jscs' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.initConfig( { grunt.initConfig( {
jshint: { jshint: {
@@ -12,20 +13,23 @@ module.exports = function ( grunt ) {
jshintrc: true jshintrc: true
}, },
all: [ all: [
'*.js' '**/*.js',
'!lib/**',
'!node_modules/**',
'!resources/js/ext.uls.webfonts.repository.js'
] ]
}, },
jscs: { jscs: {
src: '<%= jshint.all %>' src: '<%= jshint.all %>'
}, },
banana: {
all: 'i18n/'
},
jsonlint: { jsonlint: {
all: [ all: [
'**/*.json', '**/*.json',
'!node_modules/**' '!node_modules/**'
] ]
},
banana: {
all: 'i18n'
} }
} ); } );

View File

@@ -7,8 +7,8 @@
"grunt": "0.4.5", "grunt": "0.4.5",
"grunt-cli": "0.1.13", "grunt-cli": "0.1.13",
"grunt-contrib-jshint": "0.11.3", "grunt-contrib-jshint": "0.11.3",
"grunt-jscs": "2.1.0", "grunt-jscs": "2.5.0",
"grunt-banana-checker": "0.4.0", "grunt-jsonlint": "1.0.7",
"grunt-jsonlint": "1.0.7" "grunt-banana-checker": "0.4.0"
} }
} }

View File

@@ -1,4 +1,4 @@
/** /*!
* Compact the interlanguage links in the sidebar * Compact the interlanguage links in the sidebar
* *
* Copyright (C) 2012-2014 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012-2014 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -22,6 +22,7 @@
/** /**
* For the given array, remove duplicates * For the given array, remove duplicates
*
* @param {Array} originalArray * @param {Array} originalArray
* @return {Array} de-duplicated array * @return {Array} de-duplicated array
*/ */
@@ -114,6 +115,7 @@
}, },
/** /**
* Language selection handler * Language selection handler
*
* @param {string} language language code * @param {string} language language code
*/ */
onSelect: function ( language ) { onSelect: function ( language ) {
@@ -152,6 +154,7 @@
/** /**
* Get the compacted interlanguage list as associative array * Get the compacted interlanguage list as associative array
*
* @return {Object} * @return {Object}
*/ */
getCompactList: function () { getCompactList: function () {
@@ -174,6 +177,7 @@
/** /**
* Compact a given array of languages * Compact a given array of languages
*
* @param {Array} languages * @param {Array} languages
* @return {Array} Compacted array * @return {Array} Compacted array
*/ */
@@ -210,6 +214,7 @@
* Filter the language list by previous languages. * Filter the language list by previous languages.
* Not all previous languages will be present in interlanguage links, * Not all previous languages will be present in interlanguage links,
* so we are filtering them. * so we are filtering them.
*
* @return {Array} List of language codes supported by the article * @return {Array} List of language codes supported by the article
*/ */
filterByPreviousLanguages: function ( languages ) { filterByPreviousLanguages: function ( languages ) {
@@ -223,6 +228,7 @@
/** /**
* Filter the language list by common languages. * Filter the language list by common languages.
* Common languages are the most probable languages predicted by ULS. * Common languages are the most probable languages predicted by ULS.
*
* @return {Array} List of language codes supported by the article * @return {Array} List of language codes supported by the article
*/ */
filterByCommonLanguages: function ( languages ) { filterByCommonLanguages: function ( languages ) {
@@ -236,6 +242,7 @@
/** /**
* Filter the language list by Translate's assistant languages. * Filter the language list by Translate's assistant languages.
* Where available, they're languages deemed useful by the user. * Where available, they're languages deemed useful by the user.
*
* @return {Array} List of those language codes which are supported by article * @return {Array} List of those language codes which are supported by article
*/ */
filterByAssistantLanguages: function ( languages ) { filterByAssistantLanguages: function ( languages ) {
@@ -253,6 +260,7 @@
/** /**
* Find out the existing languages supported * Find out the existing languages supported
* by the article and fetch their href. * by the article and fetch their href.
*
* @return {Object} List of existing language codes and their hrefs * @return {Object} List of existing language codes and their hrefs
*/ */
getInterlanguageList: function () { getInterlanguageList: function () {
@@ -303,6 +311,7 @@
/** /**
* Show a language from the interlanguage list * Show a language from the interlanguage list
*
* @param {string} language * @param {string} language
*/ */
showLanguage: function ( language ) { showLanguage: function ( language ) {
@@ -312,6 +321,7 @@
/** /**
* CompactInterlanguageList Plugin * CompactInterlanguageList Plugin
*
* @param {Object} [option] * @param {Object} [option]
*/ */
$.fn.compactInterlanguageList = function ( option ) { $.fn.compactInterlanguageList = function ( option ) {

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS-based display settings panel * ULS-based display settings panel
* *
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
@@ -359,7 +360,8 @@
/** /**
* Preview the settings panel in the given language * Preview the settings panel in the given language
* @param {String} language Language code *
* @param {string} language Language code
*/ */
preview: function ( language ) { preview: function ( language ) {
var displaySettings = this; var displaySettings = this;
@@ -378,7 +380,8 @@
/** /**
* Get previous languages * Get previous languages
* @returns {Array} *
* @return {Array}
*/ */
frequentLanguageList: function () { frequentLanguageList: function () {
return mw.uls.getFrequentLanguageList(); return mw.uls.getFrequentLanguageList();
@@ -386,7 +389,8 @@
/** /**
* Get the current user interface language. * Get the current user interface language.
* @returns String Current UI language *
* @return {string} Current UI language
*/ */
getUILanguage: function () { getUILanguage: function () {
return mw.config.get( 'wgUserLanguage' ); return mw.config.get( 'wgUserLanguage' );
@@ -394,7 +398,8 @@
/** /**
* Get the current content language. * Get the current content language.
* @returns String Current content language *
* @return {string} Current content language
*/ */
getContentLanguage: function () { getContentLanguage: function () {
return mw.config.get( 'wgContentLanguage' ); return mw.config.get( 'wgContentLanguage' );
@@ -403,7 +408,7 @@
/** /**
* Prepare a font selector section with a label and a selector element. * Prepare a font selector section with a label and a selector element.
* *
* @param target String 'ui' or 'content' * @param {string} target 'ui' or 'content'
*/ */
prepareFontSelector: function ( target ) { prepareFontSelector: function ( target ) {
var language, fonts, $fontSelector, savedFont, var language, fonts, $fontSelector, savedFont,

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS Event logger * ULS Event logger
* *
* Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,14 +16,15 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
/** /**
* ULS Event logger * ULS Event logger
* See https://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector
* *
* @since 2013.08 * @since 2013.08
* @see https://meta.wikimedia.org/wiki/Schema:UniversalLanguageSelector
*/ */
function ULSEventLogger() { function ULSEventLogger() {
this.logEventQueue = $.Callbacks( 'memory once' ); this.logEventQueue = $.Callbacks( 'memory once' );
@@ -49,7 +50,7 @@
* Local wrapper for 'mw.eventLog.logEvent' * Local wrapper for 'mw.eventLog.logEvent'
* *
* @param {Object} event Event action and optional fields * @param {Object} event Event action and optional fields
* @param {String} schema The schema; 'UniversalLanguageSelector' is the default * @param {string} schema The schema; 'UniversalLanguageSelector' is the default
* @return {jQuery.Promise} jQuery Promise object for the logging call * @return {jQuery.Promise} jQuery Promise object for the logging call
*/ */
log: function ( event, schema ) { log: function ( event, schema ) {
@@ -95,6 +96,7 @@
/** /**
* Log language settings open * Log language settings open
*
* @param {string} context Where it was opened from * @param {string} context Where it was opened from
*/ */
ulsSettingsOpen: function ( context ) { ulsSettingsOpen: function ( context ) {
@@ -106,6 +108,7 @@
/** /**
* Log language revert * Log language revert
*
* @param {jQuery.Deferred} deferred * @param {jQuery.Deferred} deferred
*/ */
ulsLanguageRevert: function ( deferred ) { ulsLanguageRevert: function ( deferred ) {
@@ -114,6 +117,7 @@
/** /**
* Log IME disabling * Log IME disabling
*
* @param {string} context Where the setting was changed. * @param {string} context Where the setting was changed.
*/ */
disableIME: function ( context ) { disableIME: function ( context ) {
@@ -122,6 +126,7 @@
/** /**
* Log IME enabling * Log IME enabling
*
* @param {string} context Where the setting was changed. * @param {string} context Where the setting was changed.
*/ */
enableIME: function ( context ) { enableIME: function ( context ) {
@@ -130,6 +135,7 @@
/** /**
* Log IME change * Log IME change
*
* @param {string} inputMethod * @param {string} inputMethod
*/ */
changeIME: function ( inputMethod ) { changeIME: function ( inputMethod ) {
@@ -141,6 +147,7 @@
/** /**
* Log login link click in display settings. * Log login link click in display settings.
*
* @param {jQuery.Deferred} deferred * @param {jQuery.Deferred} deferred
*/ */
loginClick: function ( deferred ) { loginClick: function ( deferred ) {
@@ -215,6 +222,7 @@
/** /**
* Log webfonts disabling * Log webfonts disabling
*
* @param {string} context Where the setting was changed. * @param {string} context Where the setting was changed.
*/ */
disableWebfonts: function ( context ) { disableWebfonts: function ( context ) {
@@ -223,6 +231,7 @@
/** /**
* Log webfonts enabling * Log webfonts enabling
*
* @param {string} context Where the setting was changed. * @param {string} context Where the setting was changed.
*/ */
enableWebfonts: function ( context ) { enableWebfonts: function ( context ) {
@@ -231,6 +240,7 @@
/** /**
* Log search strings which produce no search results. * Log search strings which produce no search results.
*
* @param {jQuery.event} event The orignal event * @param {jQuery.event} event The orignal event
* @param {string} context The query string * @param {string} context The query string
*/ */

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS GeoIP client * ULS GeoIP client
* *
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,17 +16,18 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
var currentProto, httpOnly, settings,
service = mw.config.get( 'wgULSGeoService' );
mw.uls = mw.uls || {}; mw.uls = mw.uls || {};
mw.uls.setGeo = function ( data ) { mw.uls.setGeo = function ( data ) {
window.Geo = data; window.Geo = data;
}; };
var currentProto, httpOnly, settings,
service = mw.config.get( 'wgULSGeoService' );
// Call the service only if defined, and if the current // Call the service only if defined, and if the current
// protocol is https, only if the service is not configured // protocol is https, only if the service is not configured
// with http:// as the protocol // with http:// as the protocol

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS i18n preparation using jquery.i18n library * ULS i18n preparation using jquery.i18n library
* *
* Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
@@ -37,6 +38,7 @@
* Load localization messags for a locale to the jquery.i18n * Load localization messags for a locale to the jquery.i18n
* messagestore. * messagestore.
* Also called by RL module ResourceLoaderULSJsonMessageModule * Also called by RL module ResourceLoaderULSJsonMessageModule
*
* @param {string} locale the language code * @param {string} locale the language code
* @param {Object} [messages] * @param {Object} [messages]
* @return {jQuery.Promise} * @return {jQuery.Promise}

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS - jQuery IME integration * ULS - jQuery IME integration
* *
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
@@ -208,6 +209,7 @@
/** /**
* Loads necessary dependencies, checks input for validity and * Loads necessary dependencies, checks input for validity and
* adds the ime menu for elements that should have it. * adds the ime menu for elements that should have it.
*
* @param {jquery.Element} $input * @param {jquery.Element} $input
* @since 2013.11 * @since 2013.11
*/ */
@@ -244,6 +246,7 @@
/** /**
* Just adds ime menu to any input element. * Just adds ime menu to any input element.
*
* @param {jquery.Element} $input * @param {jquery.Element} $input
* @since 2013.11 * @since 2013.11
*/ */

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS startup script - MediaWiki specific customization for jquery.uls * ULS startup script - MediaWiki specific customization for jquery.uls
* *
* Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
@@ -61,6 +62,7 @@
/** /**
* Change the language of wiki using API or set cookie and reload the page * Change the language of wiki using API or set cookie and reload the page
*
* @param {string} language Language code. * @param {string} language Language code.
*/ */
mw.uls.changeLanguage = function ( language ) { mw.uls.changeLanguage = function ( language ) {
@@ -147,7 +149,6 @@
return ( window.navigator.language || window.navigator.userLanguage || '' ).split( '-' )[ 0 ]; return ( window.navigator.language || window.navigator.userLanguage || '' ).split( '-' )[ 0 ];
}; };
/*jshint camelcase:false*/
mw.uls.getCountryCode = function () { mw.uls.getCountryCode = function () {
return window.Geo && ( window.Geo.country || window.Geo.country_code ); return window.Geo && ( window.Geo.country || window.Geo.country_code );
}; };
@@ -165,7 +166,7 @@
* and finally, the languages of countryCode taken from the CLDR, * and finally, the languages of countryCode taken from the CLDR,
* taken by default from the user's geolocation. * taken by default from the user's geolocation.
* *
* @param {String} [countryCode] Uppercase country code. * @param {string} [countryCode] Uppercase country code.
* @return {Array} List of language codes without duplicates. * @return {Array} List of language codes without duplicates.
*/ */
mw.uls.getFrequentLanguageList = function ( countryCode ) { mw.uls.getFrequentLanguageList = function ( countryCode ) {
@@ -218,11 +219,12 @@
/** /**
* Checks whether the browser is supported. * Checks whether the browser is supported.
* Browser support policy: http://www.mediawiki.org/wiki/Browser_support#Grade_A * Browser support policy: http://www.mediawiki.org/wiki/Browser_support#Grade_A
* @return boolean *
* @return {boolean}
*/ */
function isBrowserSupported() { function isBrowserSupported() {
var blacklist = { var blacklist = {
'msie': [ msie: [
[ '<=', 7 ] [ '<=', 7 ]
] ]
}; };

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS-based ime settings panel * ULS-based ime settings panel
* *
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
@@ -346,12 +347,16 @@
); );
}, },
onVisible: function () { onVisible: function () {
var $parent;
if ( !inputSettings.$parent.$window.hasClass( 'callout' ) ) { if ( !inputSettings.$parent.$window.hasClass( 'callout' ) ) {
// callout menus will have position rules. others use // callout menus will have position rules. others use
// default position // default position
return; return;
} }
var $parent = $( '#language-settings-dialog' );
$parent = $( '#language-settings-dialog' );
// Re-position the element according to the window that called it // Re-position the element according to the window that called it
if ( parseInt( $parent.css( 'left' ), 10 ) ) { if ( parseInt( $parent.css( 'left' ), 10 ) ) {
this.$menu.css( 'left', $parent.css( 'left' ) ); this.$menu.css( 'left', $parent.css( 'left' ) );
@@ -402,7 +407,8 @@
/** /**
* Get previous languages * Get previous languages
* @returns {Array} *
* @return {Array}
*/ */
frequentLanguageList: function () { frequentLanguageList: function () {
return mw.uls.getFrequentLanguageList(); return mw.uls.getFrequentLanguageList();
@@ -410,7 +416,8 @@
/** /**
* Get the current user interface language. * Get the current user interface language.
* @returns String Current UI language *
* @return {string} Current UI language
*/ */
getInterfaceLanguage: function () { getInterfaceLanguage: function () {
return mw.config.get( 'wgUserLanguage' ); return mw.config.get( 'wgUserLanguage' );
@@ -418,7 +425,8 @@
/** /**
* Get the current content language. * Get the current content language.
* @returns String Current content language *
* @return {string} Current content language
*/ */
getContentLanguage: function () { getContentLanguage: function () {
return mw.config.get( 'wgContentLanguage' ); return mw.config.get( 'wgContentLanguage' );

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS interface integration logic * ULS interface integration logic
* *
* Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012-2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,11 +16,13 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
/** /**
* Construct the display settings link * Construct the display settings link
*
* @return {jQuery} * @return {jQuery}
*/ */
function displaySettings() { function displaySettings() {
@@ -40,7 +42,8 @@
/** /**
* Construct the input settings link * Construct the input settings link
* @returns {jQuery} *
* @return {jQuery}
*/ */
function inputSettings() { function inputSettings() {
var $inputSettingsTitle, inputSettingsText, $inputSettings; var $inputSettingsTitle, inputSettingsText, $inputSettings;
@@ -59,6 +62,7 @@
/** /**
* Add display settings link to the settings bar in ULS * Add display settings link to the settings bar in ULS
*
* @param {Object} uls The ULS object * @param {Object} uls The ULS object
*/ */
function addDisplaySettings( uls ) { function addDisplaySettings( uls ) {
@@ -97,6 +101,7 @@
/** /**
* Add input settings link to the settings bar in ULS * Add input settings link to the settings bar in ULS
*
* @param {Object} uls The ULS object * @param {Object} uls The ULS object
*/ */
function addInputSettings( uls ) { function addInputSettings( uls ) {
@@ -127,6 +132,7 @@
/** /**
* Helper function to make the uls triggers accessible with the keyboard. * Helper function to make the uls triggers accessible with the keyboard.
*
* @param {jQuery} $target One or more jQuery elements. * @param {jQuery} $target One or more jQuery elements.
* @since 2013.07 * @since 2013.07
*/ */
@@ -165,6 +171,7 @@
/** /**
* Gets the name of the previously active language * Gets the name of the previously active language
*
* @param {string} code Language code of previously selected language. * @param {string} code Language code of previously selected language.
* @return {jQuery.Promise} * @return {jQuery.Promise}
*/ */

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS-based language settings dialog for MediaWiki. * ULS-based language settings dialog for MediaWiki.
* *
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
@@ -113,6 +114,7 @@
/** /**
* Initialize the module. * Initialize the module.
* Render the link and settings area for a language setting module. * Render the link and settings area for a language setting module.
*
* @param {string} moduleName Name of the setting module * @param {string} moduleName Name of the setting module
* @param {boolean} active boolean Make this module active and show by default * @param {boolean} active boolean Make this module active and show by default
*/ */
@@ -237,6 +239,7 @@
* Busy mode means displaying a progress cursor, * Busy mode means displaying a progress cursor,
* and showing the 'apply' button as disabled and with * and showing the 'apply' button as disabled and with
* a different label. * a different label.
*
* @param {boolean} busy set true to put the panel in busy mode, * @param {boolean} busy set true to put the panel in busy mode,
* false to unset the busy mode. * false to unset the busy mode.
*/ */

View File

@@ -1,4 +1,4 @@
/** /*!
* jquery.uls defaults for MediaWiki. * jquery.uls defaults for MediaWiki.
* *
* Copyright (C) 2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS preferences system for MediaWiki. * ULS preferences system for MediaWiki.
* Local storage for anonymous users, preferences for logged in users. * Local storage for anonymous users, preferences for logged in users.
* *
@@ -17,6 +17,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
@@ -50,7 +51,7 @@
/* /*
* Returns the value of the given key * Returns the value of the given key
* @param {string} key * @param {string} key
* @retun {Object} value of the key * @return {Object} value of the key
*/ */
get: function ( key ) { get: function ( key ) {
var data; var data;
@@ -97,10 +98,12 @@
* Initialize * Initialize
*/ */
init: function () { init: function () {
var options;
if ( this.isAnon ) { if ( this.isAnon ) {
this.preferences = preferenceStore().get( this.preferenceName ); this.preferences = preferenceStore().get( this.preferenceName );
} else { } else {
var options = mw.user.options.get( this.preferenceName ); options = mw.user.options.get( this.preferenceName );
if ( !options ) { if ( !options ) {
options = '{}'; options = '{}';
} }
@@ -118,8 +121,8 @@
/** /**
* Set the preference * Set the preference
* *
* @param {String} key * @param {string} key
* @param value * @param {mixed} value
*/ */
set: function ( key, value ) { set: function ( key, value ) {
this.preferences[ key ] = value; this.preferences[ key ] = value;
@@ -128,7 +131,7 @@
/** /**
* Get a preference value for the given preference name * Get a preference value for the given preference name
* *
* @param key * @param {string} key
*/ */
get: function ( key ) { get: function ( key ) {
return this.preferences[ key ]; return this.preferences[ key ];
@@ -137,7 +140,7 @@
/** /**
* Save the preferences * Save the preferences
* *
* @param callback * @param {Function} callback
*/ */
save: function ( callback ) { save: function ( callback ) {
var ulsPreferences = this; var ulsPreferences = this;

View File

@@ -1,4 +1,4 @@
/** /*!
* ULS-Webfonts integration * ULS-Webfonts integration
* *
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,8 +16,10 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';
var ulsPreferences, var ulsPreferences,
// Text to prepend the sample text. 0D00 is an unassigned unicode point. // Text to prepend the sample text. 0D00 is an unassigned unicode point.
tofuSalt = '\u0D00', tofuSalt = '\u0D00',
@@ -135,7 +137,7 @@
* *
* @param {Object} repository * @param {Object} repository
* @param {string} language * @param {string} language
* @param {array} classes * @param {Array} classes
*/ */
fontSelector: function ( repository, language, classes ) { fontSelector: function ( repository, language, classes ) {
var font, autonym, defaultFont; var font, autonym, defaultFont;

View File

@@ -1,4 +1,4 @@
/** /*!
* MobileFrontend compatible ULS-Webfonts integration * MobileFrontend compatible ULS-Webfonts integration
* *
* Copyright (C) 2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2013 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -16,6 +16,7 @@
* @licence GNU General Public Licence 2.0 or later * @licence GNU General Public Licence 2.0 or later
* @licence MIT License * @licence MIT License
*/ */
( function ( $, mw ) { ( function ( $, mw ) {
'use strict'; 'use strict';

View File

@@ -1,4 +1,4 @@
/** /*!
* QUnit tests for ULS. * QUnit tests for ULS.
* *
* Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris, * Copyright (C) 2012 Alolita Sharma, Amir Aharoni, Arun Ganesh, Brandon Harris,
@@ -38,15 +38,16 @@
} ); } );
QUnit.test( 'User preferences', function ( assert ) { QUnit.test( 'User preferences', function ( assert ) {
var prefName, prefs, prefsToSave, readPrefs;
QUnit.expect( 2 ); QUnit.expect( 2 );
// 'gofanim' means "fonts" in Hebrew. // 'gofanim' means "fonts" in Hebrew.
// Here it's used as a meaningless word, to test // Here it's used as a meaningless word, to test
// the preferences without changing anything useful. // the preferences without changing anything useful.
var prefName = 'gofanim', prefName = 'gofanim';
prefs = mw.uls.preferences(), prefs = mw.uls.preferences();
prefsToSave = {}, prefsToSave = {};
readPrefs;
prefsToSave[ prefName ] = { prefsToSave[ prefName ] = {
fonts: { fonts: {