diff --git a/.jscsrc b/.jscsrc index c48c0596..1959eea8 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,4 +1,21 @@ { "preset": "wikimedia", - "requireCamelCaseOrUpperCaseIdentifiers": null + + "jsDoc": { + "checkAnnotations": { + "preset": "jsduck5", + "extra": { + "this": true, + "source": true, + "see": true + } + }, + "checkTypes": "strictNativeCase", + "checkParamNames": true, + "checkRedundantAccess": true, + "checkRedundantReturns": true, + "requireNewlineAfterDescription": true, + "requireParamTypes": true, + "requireReturnTypes": true + } } diff --git a/.jshintrc b/.jshintrc index 317d4e28..93a54e84 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,32 +1,25 @@ { - - "camelcase": false, - "curly": true, + // Enforcing + "bitwise": true, "eqeqeq": true, - "immed": true, - "latedef": true, - "newcap": true, + "freeze": true, + "latedef": "nofunc", + "futurehostile": true, "noarg": true, - "noempty": true, "nonew": true, - "quotmark": "single", - "trailing": true, "undef": true, "unused": true, - "bitwise": true, - "forin": false, - "regexp": false, - "strict": true, - "laxbreak": true, - "smarttabs": true, - "multistr": true, - "browser": true, - "onevar": true, + "strict": false, - "predef": [ - "mediaWiki", - "jQuery", - "QUnit" - ] + // Relaxing + + // Environment + "browser": true, + "jquery": true, + + "globals": { + "mediaWiki": false, + "QUnit": false + } } diff --git a/package.json b/package.json index 611c5850..a9b014e8 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ }, "devDependencies": { "grunt": "0.4.5", + "grunt-banana-checker": "0.4.0", "grunt-cli": "0.1.13", - "grunt-contrib-jshint": "0.11.3", - "grunt-jscs": "2.5.0", - "grunt-jsonlint": "1.0.7", - "grunt-banana-checker": "0.4.0" + "grunt-contrib-jshint": "1.0.0", + "grunt-jscs": "2.8.0", + "grunt-jsonlint": "1.0.7" } } diff --git a/resources/js/ext.uls.displaysettings.js b/resources/js/ext.uls.displaysettings.js index 555bfd1d..880050b7 100644 --- a/resources/js/ext.uls.displaysettings.js +++ b/resources/js/ext.uls.displaysettings.js @@ -20,80 +20,86 @@ ( function ( $, mw ) { 'use strict'; - var template = '
' + var template = '
' + - + '
' // Tab switcher buttons - + '
' - + '
' - + '' - + '' - + '
' - + '
' - + '
' + // Tab switcher buttons + '
' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '
' + - + '
' // Begin display language sub-panel + // Begin display language sub-panel + '
' + // "Display language", title above the buttons row - + '
' - + '
' - + '

' - + '
' - + '
' + '
' + + '
' + + '

' + + '
' + + '
' + // UI languages buttons row - + '
' - + '
' - + '

' - + '
' - + '
' + '
' + + '
' + + '

' + + '
' + + '
' + - + '
' // End display language section + // End display language section + '
' + - + '
' // Begin font settings section, hidden by default + // Begin font settings section, hidden by default + '
' + // "Font settings" title - + '
' - + '
' - + '

' - + '
' - + '
' + '
' + + '
' + + '

' + + '
' + + '
' + - + '
' + '
' + // Menus font selection dropdown with label - + '
' - + '
' - + '' - + '
' - + '' - + '
' + '
' + + '
' + + '' + + '
' + + '' + + '
' + // Content font selection dropdown with label - + '
' - + '
' - + '' - + '
' - + '' - + '
' + '
' + + '
' + + '' + + '
' + + '' + + '
' + - + '
' // End font selectors + // End font selectors + '
' + // Webfonts enabling checkbox with label - + '
' - + '
' - + '
' - + '' - + '' - + '
' - + '
' - + '
' + '
' + + '
' + + '
' + + '' + + '' + + '
' + + '
' + + '
' + - + '
'; // End font settings section + // End font settings section + '
'; function DisplaySettings( $parent ) { this.nameI18n = 'ext-uls-display-settings-title-short'; diff --git a/resources/js/ext.uls.ime.js b/resources/js/ext.uls.ime.js index 4c594881..8871346b 100644 --- a/resources/js/ext.uls.ime.js +++ b/resources/js/ext.uls.ime.js @@ -106,6 +106,30 @@ } }; + function imeNotification() { + var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ? + 'ext-uls-input-disable-notification-info-personal' : + 'ext-uls-input-disable-notification-info-interlanguage', + $notification = $( '
' ) + .addClass( 'uls-ime-notification-bubble' ) + .append( + $( '
' ) + .attr( 'data-i18n', 'ext-uls-input-disable-notification' ), + $( '
' ) + .addClass( 'link' ) + .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' ) + .on( 'click', function () { + $.ime.preferences.enable(); + $.ime.preferences.save( function () { + mw.ime.setup(); + } ); + } ), + $( '
' ).attr( 'data-i18n', notificationMsg ) + ); + + mw.notify( $notification.i18n() ); + } + // Add a 'more settings' link that takes to input settings of ULS customHelpLink = function () { var $disableInputToolsLink, $moreSettingsLink, @@ -297,28 +321,4 @@ } ); } }; - - function imeNotification() { - var notificationMsg = ( mw.config.get( 'wgULSPosition' ) === 'personal' ) ? - 'ext-uls-input-disable-notification-info-personal' : - 'ext-uls-input-disable-notification-info-interlanguage', - $notification = $( '
' ) - .addClass( 'uls-ime-notification-bubble' ) - .append( - $( '
' ) - .attr( 'data-i18n', 'ext-uls-input-disable-notification' ), - $( '
' ) - .addClass( 'link' ) - .attr( 'data-i18n', 'ext-uls-input-disable-notification-undo' ) - .on( 'click', function () { - $.ime.preferences.enable(); - $.ime.preferences.save( function () { - mw.ime.setup(); - } ); - } ), - $( '
' ).attr( 'data-i18n', notificationMsg ) - ); - - mw.notify( $notification.i18n() ); - } }( jQuery, mediaWiki ) ); diff --git a/resources/js/ext.uls.init.js b/resources/js/ext.uls.init.js index db29524b..40ef11fd 100644 --- a/resources/js/ext.uls.init.js +++ b/resources/js/ext.uls.init.js @@ -107,7 +107,9 @@ }; mw.uls.getCountryCode = function () { + // jscs:disable requireCamelCaseOrUpperCaseIdentifiers return window.Geo && ( window.Geo.country || window.Geo.country_code ); + // jscs:enable requireCamelCaseOrUpperCaseIdentifiers }; mw.uls.getAcceptLanguageList = function () { diff --git a/resources/js/ext.uls.inputsettings.js b/resources/js/ext.uls.inputsettings.js index 2a47444f..dd2a2980 100644 --- a/resources/js/ext.uls.inputsettings.js +++ b/resources/js/ext.uls.inputsettings.js @@ -20,40 +20,41 @@ ( function ( $, mw ) { 'use strict'; - var template = '
' - + '
' // Top "Display settings" title - + '
' - + '

' - + '
' - + '
' + var template = '
' + + // Top "Display settings" title + '
' + + '
' + + '

' + + '
' + + '
' + // "Language for ime", title above the buttons row - + '
' - + '
' - + '

' - + '
' - + '
' + '
' + + '
' + + '

' + + '
' + + '
' + // UI languages buttons row - + '
' - + '
' - + '
' + '
' + + '
' + + '
' + // Web IMEs enabling chechbox with label - + '
' - + '
' + '
' + + '
' + // "Input settings for language xyz" title - + '

' - + '
' - + '
' + '

' + + '
' + + '
' + // Disable IME system button - + '
' - + '
' - + '
' - + '' - + '
' - + '
'; + '
' + + '
' + + '
' + + '' + + '
' + + '
'; function InputSettings( $parent ) { this.nameI18n = 'ext-uls-input-settings-title-short';