Skip to content

Commit 588f781

Browse files
committed
Move bunch of javascript variables from global scope to local scope in magnifier.js file.
1 parent 6acfd6a commit 588f781

File tree

1 file changed

+71
-72
lines changed

1 file changed

+71
-72
lines changed

lib/web/magnifier/magnifier.js

Lines changed: 71 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -24,78 +24,77 @@
2424
$thumb,
2525
that = this,
2626
largeWrapper = options.largeWrapper || '.magnifier-preview',
27-
$magnifierPreview = $(largeWrapper);
28-
29-
curThumb = null,
30-
magnifierOptions = {
31-
x: 0,
32-
y: 0,
33-
w: 0,
34-
h: 0,
35-
lensW: 0,
36-
lensH: 0,
37-
lensBgX: 0,
38-
lensBgY: 0,
39-
largeW: 0,
40-
largeH: 0,
41-
largeL: 0,
42-
largeT: 0,
43-
zoom: 2,
44-
zoomMin: 1.1,
45-
zoomMax: 5,
46-
mode: 'outside',
47-
eventType: 'click',
48-
status: 0,
49-
zoomAttached: false,
50-
zoomable: customUserOptions.zoomable !== undefined ?
51-
customUserOptions.zoomable
52-
: false,
53-
onthumbenter: customUserOptions.onthumbenter !== undefined ?
54-
customUserOptions.onthumbenter
55-
: null,
56-
onthumbmove: customUserOptions.onthumbmove !== undefined ?
57-
customUserOptions.onthumbmove
58-
: null,
59-
onthumbleave: customUserOptions.onthumbleave !== undefined ?
60-
customUserOptions.onthumbleave
61-
: null,
62-
onzoom: customUserOptions.onzoom !== undefined ?
63-
customUserOptions.onzoom
64-
: null
65-
},
66-
pos = {
67-
t: 0,
68-
l: 0,
69-
x: 0,
70-
y: 0
71-
},
72-
gId = 0,
73-
status = 0,
74-
curIdx = '',
75-
curLens = null,
76-
curLarge = null,
77-
lensbg = customUserOptions.bg !== undefined ?
78-
customUserOptions.lensbg
79-
: true,
80-
gZoom = customUserOptions.zoom !== undefined ?
81-
customUserOptions.zoom
82-
: magnifierOptions.zoom,
83-
gZoomMin = customUserOptions.zoomMin !== undefined ?
84-
customUserOptions.zoomMin
85-
: magnifierOptions.zoomMin,
86-
gZoomMax = customUserOptions.zoomMax !== undefined ?
87-
customUserOptions.zoomMax
88-
: magnifierOptions.zoomMax,
89-
gMode = customUserOptions.mode || magnifierOptions.mode,
90-
gEventType = customUserOptions.eventType || magnifierOptions.eventType,
91-
data = {},
92-
inBounds = false,
93-
isOverThumb = false,
94-
rate = 1,
95-
paddingX = 0,
96-
paddingY = 0,
97-
enabled = true,
98-
showWrapper = true;
27+
$magnifierPreview = $(largeWrapper),
28+
curThumb = null,
29+
magnifierOptions = {
30+
x: 0,
31+
y: 0,
32+
w: 0,
33+
h: 0,
34+
lensW: 0,
35+
lensH: 0,
36+
lensBgX: 0,
37+
lensBgY: 0,
38+
largeW: 0,
39+
largeH: 0,
40+
largeL: 0,
41+
largeT: 0,
42+
zoom: 2,
43+
zoomMin: 1.1,
44+
zoomMax: 5,
45+
mode: 'outside',
46+
eventType: 'click',
47+
status: 0,
48+
zoomAttached: false,
49+
zoomable: customUserOptions.zoomable !== undefined ?
50+
customUserOptions.zoomable
51+
: false,
52+
onthumbenter: customUserOptions.onthumbenter !== undefined ?
53+
customUserOptions.onthumbenter
54+
: null,
55+
onthumbmove: customUserOptions.onthumbmove !== undefined ?
56+
customUserOptions.onthumbmove
57+
: null,
58+
onthumbleave: customUserOptions.onthumbleave !== undefined ?
59+
customUserOptions.onthumbleave
60+
: null,
61+
onzoom: customUserOptions.onzoom !== undefined ?
62+
customUserOptions.onzoom
63+
: null
64+
},
65+
pos = {
66+
t: 0,
67+
l: 0,
68+
x: 0,
69+
y: 0
70+
},
71+
gId = 0,
72+
status = 0,
73+
curIdx = '',
74+
curLens = null,
75+
curLarge = null,
76+
lensbg = customUserOptions.bg !== undefined ?
77+
customUserOptions.lensbg
78+
: true,
79+
gZoom = customUserOptions.zoom !== undefined ?
80+
customUserOptions.zoom
81+
: magnifierOptions.zoom,
82+
gZoomMin = customUserOptions.zoomMin !== undefined ?
83+
customUserOptions.zoomMin
84+
: magnifierOptions.zoomMin,
85+
gZoomMax = customUserOptions.zoomMax !== undefined ?
86+
customUserOptions.zoomMax
87+
: magnifierOptions.zoomMax,
88+
gMode = customUserOptions.mode || magnifierOptions.mode,
89+
gEventType = customUserOptions.eventType || magnifierOptions.eventType,
90+
data = {},
91+
inBounds = false,
92+
isOverThumb = false,
93+
rate = 1,
94+
paddingX = 0,
95+
paddingY = 0,
96+
enabled = true,
97+
showWrapper = true;
9998

10099
var MagnifyCls = {
101100
magnifyHidden: 'magnify-hidden',

0 commit comments

Comments
 (0)