@@ -3,7 +3,7 @@ var _ = require( "underscore" ),
3
3
config = require ( "../config" ) ,
4
4
fs = require ( "fs" ) ,
5
5
http = require ( "http" ) ,
6
- logger = require ( "simple-log" ) . init ( "download.jqueryui.com" ) ;
6
+ logger = require ( "simple-log" ) . init ( "download.jqueryui.com" ) ,
7
7
path = require ( "path" ) ,
8
8
querystring = require ( "querystring" ) ,
9
9
release = require ( "./release" ) . all ( ) [ 0 ] ,
@@ -16,37 +16,37 @@ var colorVars = "bgColorActive bgColorContent bgColorDefault bgColorError bgColo
16
16
// Hard coded css image repeats - universal to all contexts, depending on on image is designed
17
17
function cssRepeat ( image ) {
18
18
// Most textures repeat x
19
- repeat = "repeat-x" ;
19
+ var repeat = "repeat-x" ;
20
20
// If tile pattern
21
21
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 ) {
22
22
repeat = "repeat" ;
23
23
}
24
24
return repeat ;
25
25
}
26
26
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
28
28
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" ) {
32
32
YPos = "top" ;
33
33
}
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" ) {
35
35
YPos = "bottom" ;
36
36
}
37
- else if ( image == "21_glow_ball.png" ) {
37
+ else if ( image === "21_glow_ball.png" ) {
38
38
YPos = "35%" ;
39
39
}
40
- else if ( image == "22_spotlight.png" ) {
40
+ else if ( image === "22_spotlight.png" ) {
41
41
YPos = "2%" ;
42
42
}
43
43
}
44
44
return YPos ;
45
45
}
46
46
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
48
48
function cssXPos ( image , context ) {
49
- XPos = "50%" ;
49
+ var XPos = "50%" ;
50
50
// No conditions yet, may need some for vertical slider patterns
51
51
return XPos ;
52
52
}
@@ -63,6 +63,10 @@ var iconDimension = [ "256", "240" ];
63
63
* ThemeRoller
64
64
*/
65
65
function ThemeRoller ( vars ) {
66
+ var found ,
67
+ opacityFix ,
68
+ self ,
69
+ themeGallery ;
66
70
if ( vars === false || vars === null ) {
67
71
this . isNull = true ;
68
72
this . vars = { } ;
@@ -80,8 +84,8 @@ function ThemeRoller( vars ) {
80
84
this . images = { } ;
81
85
82
86
// 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 + ")" ;
85
89
} ;
86
90
vars . opacityOverlayPerc = vars . opacityOverlay ;
87
91
vars . opacityShadowPerc = vars . opacityShadow ;
@@ -146,10 +150,10 @@ function ThemeRoller( vars ) {
146
150
147
151
if ( ! this . name ) {
148
152
// 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 ;
151
155
themeGallery . some ( function ( theme ) {
152
- var found = theme . isEqual ( self ) ;
156
+ found = theme . isEqual ( self ) ;
153
157
if ( found ) {
154
158
self . name = theme . name ;
155
159
}
@@ -168,7 +172,7 @@ function ThemeRoller( vars ) {
168
172
}
169
173
170
174
function expandColor ( color ) {
171
- if ( color . length == 3 ) {
175
+ if ( color . length === 3 ) {
172
176
return [ 0 , 0 , 1 , 1 , 2 , 2 ] . map ( function ( i ) {
173
177
return color [ i ] ;
174
178
} ) . join ( "" ) ;
@@ -178,7 +182,7 @@ function expandColor( color ) {
178
182
179
183
ThemeRoller . prototype = {
180
184
_setImage : function ( filename , url ) {
181
- if ( typeof this . images [ filename ] == "undefined" ) {
185
+ if ( typeof this . images [ filename ] === "undefined" ) {
182
186
this . images [ filename ] = url ;
183
187
}
184
188
} ,
@@ -200,7 +204,7 @@ ThemeRoller.prototype = {
200
204
} ,
201
205
202
206
_textureUrl : function ( color , file , opacity ) {
203
- if ( typeof textureDimensions [ file ] == "undefined" ) {
207
+ if ( typeof textureDimensions [ file ] === "undefined" ) {
204
208
throw new Error ( "No dimensions set for texture \"" + file + "\"" ) ;
205
209
}
206
210
var dimension , filename ;
@@ -243,15 +247,15 @@ ThemeRoller.prototype = {
243
247
host : config . imageGeneratorHost ,
244
248
path : [ config . imageGeneratorPath , self . images [ filename ] ] . join ( "/" )
245
249
} , function ( res ) {
246
- var buffer = [ ] ;
247
- var dataLen = 0 ;
250
+ var buffer = [ ] ,
251
+ dataLen = 0 ;
248
252
res . on ( "data" , function ( chunk ) {
249
253
buffer . push ( chunk ) ;
250
254
dataLen += chunk . length ;
251
255
} ) ;
252
256
res . on ( "end" , function ( ) {
253
- var i = 0 ;
254
- var data = new Buffer ( dataLen ) ;
257
+ var i = 0 ,
258
+ data = new Buffer ( dataLen ) ;
255
259
buffer . forEach ( function ( chunk ) {
256
260
chunk . copy ( data , i , 0 , chunk . length ) ;
257
261
i += chunk . length ;
@@ -286,7 +290,7 @@ ThemeRoller.prototype = {
286
290
isEqual : function ( theme ) {
287
291
var self = this ;
288
292
return Object . keys ( this . vars ) . every ( function ( key ) {
289
- return self . vars [ key ] == theme . vars [ key ] ;
293
+ return self . vars [ key ] === theme . vars [ key ] ;
290
294
} ) ;
291
295
}
292
296
} ;
0 commit comments