r102787 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102786‎ | r102787 | r102788 >
Date:14:54, 11 November 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
make JSLint more happy; or rather less sad...
Modified paths:
  • /trunk/extensions/Survey/resources/ext.survey.tag.js (modified) (history)
  • /trunk/extensions/Survey/resources/jquery.survey.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/resources/ext.survey.tag.js
@@ -11,7 +11,7 @@
1212 function getCookieName( options ) {
1313 return ( typeof options.id !== 'undefined' ) ?
1414 'survey-id-' + options.id
15 - : 'survey-name-' + options.name
 15+ : 'survey-name-' + options.name;
1616 }
1717
1818 function getCookie( options ) {
@@ -42,13 +42,13 @@
4343 var cookie = getCookie( options );
4444
4545 if ( cookie !== 'done' ) {
46 - if ( ( options.pages === 0 || parseInt( cookie ) >= options.pages ) ) {
 46+ if ( ( options.pages === 0 || parseInt( cookie, 10 ) >= options.pages ) ) {
4747 $tag.mwSurvey( options );
4848 setCookie( options, 'done' );
4949 }
5050 else if ( options.pages !== 0 ) {
51 - var nr = parseInt( getCookie( options ) );
52 - setCookie( options, ( isNaN( nr ) ? 0 : nr ) + 1 )
 51+ var nr = parseInt( getCookie( options ), 10 );
 52+ setCookie( options, ( isNaN( nr ) ? 0 : nr ) + 1 );
5353 }
5454 }
5555 }
@@ -65,8 +65,8 @@
6666 var options = {
6767 'ratio': typeof ratioAttr === 'undefined' ? 1 : parseFloat( ratioAttr ) / 100,
6868 'cookie': $tag.attr( 'survey-data-cookie' ) !== 'no',
69 - 'expiry': typeof expiryAttr === 'undefined' ? 60 * 60 * 24 * 30 : parseInt( expiryAttr ),
70 - 'pages': typeof pagesAttr === 'undefined' ? 0 : parseInt( pagesAttr )
 69+ 'expiry': typeof expiryAttr === 'undefined' ? 60 * 60 * 24 * 30 : parseInt( expiryAttr, 10 ),
 70+ 'pages': typeof pagesAttr === 'undefined' ? 0 : parseInt( pagesAttr, 10 )
7171 };
7272
7373 if ( $tag.attr( 'survey-data-id' ) ) {
Index: trunk/extensions/Survey/resources/jquery.survey.js
@@ -297,7 +297,7 @@
298298 'requireEnabled': $this.attr( 'survey-data-require-enabled' ) !== '0'
299299 },
300300 function( surveyData ) {
301 - if ( 0 in surveyData ) {
 301+ if ( surveyData.hasOwnProperty( 0 ) ) {
302302 _this.initSurvey( surveyData[0] );
303303 }
304304 else {

Status & tagging log