Skip to content

Commit d57c170

Browse files
committed
De-lint files. Fixes #43
1 parent 699e1a9 commit d57c170

File tree

4 files changed

+33
-29
lines changed

4 files changed

+33
-29
lines changed

download.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Frontend.prototype = {
4545
theme: function( params ) {
4646
var selectedTheme = themeGallery[ 0 ];
4747
if ( params.themeParams ) {
48-
selectedTheme = new ThemeRoller( querystring.parse( unescape( params.themeParams ) ) );
48+
selectedTheme = new ThemeRoller( querystring.parse( querystring.unescape( params.themeParams ) ) );
4949
}
5050
return jsonpTemplate({
5151
callback: params.callback,

lib/builder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ Builder.prototype = {
383383
var zip = archiver.createZip();
384384
zip.pipe( response );
385385
async.forEachSeries( build, function( file, next ) {
386-
if ( file.data == undefined ) {//null or undefined
386+
if ( file.data == null ) {//null or undefined
387387
throw new Error( "Builder: missing data of \"" + file.path + "\"" );
388388
}
389389
zip.addFile( file.data, { name: file.path }, next );

lib/themeroller.js

+28-24
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var _ = require( "underscore" ),
33
config = require( "../config" ),
44
fs = require( "fs" ),
55
http = require( "http" ),
6-
logger = require( "simple-log" ).init( "download.jqueryui.com" );
6+
logger = require( "simple-log" ).init( "download.jqueryui.com" ),
77
path = require( "path" ),
88
querystring = require( "querystring" ),
99
release = require( "./release" ).all()[ 0 ],
@@ -16,37 +16,37 @@ var colorVars = "bgColorActive bgColorContent bgColorDefault bgColorError bgColo
1616
// Hard coded css image repeats - universal to all contexts, depending on on image is designed
1717
function cssRepeat( image ) {
1818
// Most textures repeat x
19-
repeat = "repeat-x";
19+
var repeat = "repeat-x";
2020
// If tile pattern
2121
if ( "07_diagonals_small.png 07_diagonals_medium.png 08_diagonals_thick.png 09_dots_small.png 10_dots_medium.png 11_white_lines.png 13_diamond.png 14_loop.png 15_carbon_fiber.png 16_diagonal_maze.png 17_diamond_ripple.png 18_hexagon.png 19_layered_circles.png 18_hexagon.png 20_3D_boxes.png 23_fine_grain.png".split( " " ).indexOf( image ) >= 0 ) {
2222
repeat = "repeat";
2323
}
2424
return repeat;
2525
}
2626

27-
// Hard coded css Y image positioning - image is image filename, context accepts button or panel
27+
// Hard coded css Y image positioning - image is image filename, context accepts button or panel
2828
function cssYPos( image, context ){
29-
YPos = "50%";
30-
if( context == "panel" ){
31-
if( image == "03_highlight_soft.png" || image == "04_highlight_hard.png" || image == "12_gloss_wave.png" ){
29+
var YPos = "50%";
30+
if( context === "panel" ){
31+
if( image === "03_highlight_soft.png" || image === "04_highlight_hard.png" || image === "12_gloss_wave.png" ){
3232
YPos = "top";
3333
}
34-
else if( image == "05_inset_soft.png" || image == "06_inset_hard.png" ){
34+
else if( image === "05_inset_soft.png" || image === "06_inset_hard.png" ){
3535
YPos = "bottom";
3636
}
37-
else if( image == "21_glow_ball.png" ){
37+
else if( image === "21_glow_ball.png" ){
3838
YPos = "35%";
3939
}
40-
else if( image == "22_spotlight.png" ){
40+
else if( image === "22_spotlight.png" ){
4141
YPos = "2%";
4242
}
4343
}
4444
return YPos;
4545
}
4646

47-
// Hard coded css X image positioning - image is image filename, context accepts button or panel
47+
// Hard coded css X image positioning - image is image filename, context accepts button or panel
4848
function cssXPos( image, context ){
49-
XPos = "50%";
49+
var XPos = "50%";
5050
// No conditions yet, may need some for vertical slider patterns
5151
return XPos;
5252
}
@@ -63,6 +63,10 @@ var iconDimension = [ "256", "240" ];
6363
* ThemeRoller
6464
*/
6565
function ThemeRoller( vars ) {
66+
var found,
67+
opacityFix,
68+
self,
69+
themeGallery;
6670
if ( vars === false || vars === null ) {
6771
this.isNull = true;
6872
this.vars = {};
@@ -80,8 +84,8 @@ function ThemeRoller( vars ) {
8084
this.images = {};
8185

8286
// Opacity fix (w3c + IE)
83-
var opacityFix = function( opacity ) {
84-
return ( /* w3c */ ( opacity == "100" || opacity == "0" ) ? opacity : parseFloat( "." + opacity, 10 ).toString().replace( /^0/, "" ) ) + /* IE */ ";filter:Alpha(Opacity=" + opacity + ")";
87+
opacityFix = function( opacity ) {
88+
return ( /* w3c */ ( opacity === "100" || opacity === "0" ) ? opacity : parseFloat( "." + opacity, 10 ).toString().replace( /^0/, "" ) ) + /* IE */ ";filter:Alpha(Opacity=" + opacity + ")";
8589
};
8690
vars.opacityOverlayPerc = vars.opacityOverlay;
8791
vars.opacityShadowPerc = vars.opacityShadow;
@@ -146,10 +150,10 @@ function ThemeRoller( vars ) {
146150

147151
if ( !this.name ) {
148152
// Pick name based on theme gallery vs. our vars
149-
var themeGallery = require( "./themeroller.themegallery" ),
150-
self = this;
153+
themeGallery = require( "./themeroller.themegallery" );
154+
self = this;
151155
themeGallery.some(function( theme ) {
152-
var found = theme.isEqual( self );
156+
found = theme.isEqual( self );
153157
if ( found ) {
154158
self.name = theme.name;
155159
}
@@ -168,7 +172,7 @@ function ThemeRoller( vars ) {
168172
}
169173

170174
function expandColor( color ) {
171-
if ( color.length == 3 ) {
175+
if ( color.length === 3 ) {
172176
return [ 0, 0, 1, 1, 2, 2 ].map(function( i ) {
173177
return color[i];
174178
}).join( "" );
@@ -178,7 +182,7 @@ function expandColor( color ) {
178182

179183
ThemeRoller.prototype = {
180184
_setImage: function( filename, url ) {
181-
if ( typeof this.images[ filename ] == "undefined" ) {
185+
if ( typeof this.images[ filename ] === "undefined" ) {
182186
this.images[ filename ] = url;
183187
}
184188
},
@@ -200,7 +204,7 @@ ThemeRoller.prototype = {
200204
},
201205

202206
_textureUrl: function( color, file, opacity ) {
203-
if ( typeof textureDimensions[ file ] == "undefined" ) {
207+
if ( typeof textureDimensions[ file ] === "undefined" ) {
204208
throw new Error( "No dimensions set for texture \"" + file + "\"" );
205209
}
206210
var dimension, filename;
@@ -243,15 +247,15 @@ ThemeRoller.prototype = {
243247
host: config.imageGeneratorHost,
244248
path: [ config.imageGeneratorPath, self.images[ filename ] ].join( "/" )
245249
}, function( res ) {
246-
var buffer = [];
247-
var dataLen = 0;
250+
var buffer = [],
251+
dataLen = 0;
248252
res.on( "data", function ( chunk ) {
249253
buffer.push( chunk );
250254
dataLen += chunk.length;
251255
});
252256
res.on( "end", function () {
253-
var i = 0;
254-
var data = new Buffer( dataLen );
257+
var i = 0,
258+
data = new Buffer( dataLen );
255259
buffer.forEach(function ( chunk ) {
256260
chunk.copy( data, i, 0, chunk.length );
257261
i += chunk.length;
@@ -286,7 +290,7 @@ ThemeRoller.prototype = {
286290
isEqual: function( theme ) {
287291
var self = this;
288292
return Object.keys( this.vars ).every(function( key ) {
289-
return self.vars[ key ] == theme.vars[ key ];
293+
return self.vars[ key ] === theme.vars[ key ];
290294
});
291295
}
292296
};

themeroller.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Handlebars.registerHelper( "textureOptions", function( select, panel ) {
2525
}
2626
// tall panel element (content, overlay, shadow, etc), don't allow glass texture
2727
if ( panel === "true" ) {
28-
if( texture.file != "02_glass.png" ) {
28+
if( texture.file !== "02_glass.png" ) {
2929
optSet += "<option value=\"" + texture.file + "\"" + selected + " data-texturewidth=\"" + texturedims[0] + "\" data-textureheight=\"" + texturedims[1] + "\">" + name + "</option>";
3030
}
3131
} else {
@@ -36,7 +36,7 @@ Handlebars.registerHelper( "textureOptions", function( select, panel ) {
3636
});
3737

3838
Handlebars.registerHelper( "themeParams", function( serializedVars ) {
39-
return serializedVars.length > 0 ? "?themeParams=" + escape( serializedVars ) : "";
39+
return serializedVars.length > 0 ? "?themeParams=" + querystring.escape( serializedVars ) : "";
4040
});
4141

4242
var appinterfaceTemplate = Handlebars.compile( fs.readFileSync( __dirname + "/template/themeroller/appinterface.html", "utf8" ) ),
@@ -91,7 +91,7 @@ Frontend.prototype = {
9191
},
9292

9393
rollYourOwn: function( params ) {
94-
var theme = new ThemeRoller( querystring.parse( unescape( params.themeParams ) ) );
94+
var theme = new ThemeRoller( querystring.parse( querystring.unescape( params.themeParams ) ) );
9595
return jsonpTemplate({
9696
callback: params.callback,
9797
data: JSON.stringify( rollyourownTemplate( theme ) )

0 commit comments

Comments
 (0)