This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | // VERSION: 2.3 LAST UPDATE: 11.07.2013 |
||
2 | /* |
||
3 | * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php |
||
4 | * |
||
5 | * Made by Wilq32, [email protected], Wroclaw, Poland, 01.2009 |
||
6 | * Website: http://jqueryrotate.com |
||
7 | */ |
||
8 | |||
9 | (function($) { |
||
10 | var supportedCSS,supportedCSSOrigin, styles=document.getElementsByTagName("head")[0].style,toCheck="transformProperty WebkitTransform OTransform msTransform MozTransform".split(" "); |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
11 | for (var a = 0; a < toCheck.length; a++) if (styles[toCheck[a]] !== undefined) { supportedCSS = toCheck[a]; } |
||
0 ignored issues
–
show
|
|||
12 | if (supportedCSS) { |
||
13 | supportedCSSOrigin = supportedCSS.replace(/[tT]ransform/,"TransformOrigin"); |
||
14 | if (supportedCSSOrigin[0] == "T") supportedCSSOrigin[0] = "t"; |
||
0 ignored issues
–
show
|
|||
15 | } |
||
16 | |||
17 | // Bad eval to preven google closure to remove it from code o_O |
||
18 | eval('IE = "v"=="\v"'); |
||
0 ignored issues
–
show
|
|||
19 | |||
20 | jQuery.fn.extend({ |
||
21 | rotate:function(parameters) |
||
22 | { |
||
23 | if (this.length===0||typeof parameters=="undefined") return; |
||
0 ignored issues
–
show
|
|||
24 | if (typeof parameters=="number") parameters={angle:parameters}; |
||
0 ignored issues
–
show
|
|||
25 | var returned=[]; |
||
26 | for (var i=0,i0=this.length;i<i0;i++) |
||
27 | { |
||
28 | var element=this.get(i); |
||
29 | if (!element.Wilq32 || !element.Wilq32.PhotoEffect) { |
||
30 | |||
31 | var paramClone = $.extend(true, {}, parameters); |
||
32 | var newRotObject = new Wilq32.PhotoEffect(element,paramClone)._rootObj; |
||
0 ignored issues
–
show
|
|||
33 | |||
34 | returned.push($(newRotObject)); |
||
35 | } |
||
36 | else { |
||
37 | element.Wilq32.PhotoEffect._handleRotation(parameters); |
||
38 | } |
||
39 | } |
||
40 | return returned; |
||
41 | }, |
||
42 | getRotateAngle: function(){ |
||
43 | var ret = [0]; |
||
44 | for (var i=0,i0=this.length;i<i0;i++) |
||
45 | { |
||
46 | var element=this.get(i); |
||
47 | if (element.Wilq32 && element.Wilq32.PhotoEffect) { |
||
48 | ret[i] = element.Wilq32.PhotoEffect._angle; |
||
49 | } |
||
50 | } |
||
51 | return ret; |
||
52 | }, |
||
53 | stopRotate: function(){ |
||
54 | for (var i=0,i0=this.length;i<i0;i++) |
||
55 | { |
||
56 | var element=this.get(i); |
||
57 | if (element.Wilq32 && element.Wilq32.PhotoEffect) { |
||
58 | clearTimeout(element.Wilq32.PhotoEffect._timer); |
||
59 | } |
||
60 | } |
||
61 | } |
||
62 | }); |
||
63 | |||
64 | // Library agnostic interface |
||
65 | |||
66 | Wilq32=window.Wilq32||{}; |
||
0 ignored issues
–
show
|
|||
67 | Wilq32.PhotoEffect=(function(){ |
||
0 ignored issues
–
show
|
|||
68 | |||
69 | if (supportedCSS) { |
||
70 | return function(img,parameters){ |
||
71 | img.Wilq32 = { |
||
72 | PhotoEffect: this |
||
73 | }; |
||
74 | |||
75 | this._img = this._rootObj = this._eventObj = img; |
||
76 | this._handleRotation(parameters); |
||
77 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
78 | } else { |
||
79 | return function(img,parameters) { |
||
80 | this._img = img; |
||
81 | this._onLoadDelegate = [parameters]; |
||
82 | |||
83 | this._rootObj=document.createElement('span'); |
||
84 | this._rootObj.style.display="inline-block"; |
||
85 | this._rootObj.Wilq32 = |
||
86 | { |
||
87 | PhotoEffect: this |
||
88 | }; |
||
89 | img.parentNode.insertBefore(this._rootObj,img); |
||
90 | |||
91 | if (img.complete) { |
||
92 | this._Loader(); |
||
93 | } else { |
||
94 | var self=this; |
||
95 | // TODO: Remove jQuery dependency |
||
96 | jQuery(this._img).bind("load", function(){ self._Loader(); }); |
||
97 | } |
||
98 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
99 | } |
||
100 | })(); |
||
101 | |||
102 | Wilq32.PhotoEffect.prototype = { |
||
0 ignored issues
–
show
|
|||
103 | _setupParameters : function (parameters){ |
||
104 | this._parameters = this._parameters || {}; |
||
105 | if (typeof this._angle !== "number") { this._angle = 0 ; } |
||
106 | if (typeof parameters.angle==="number") { this._angle = parameters.angle; } |
||
107 | this._parameters.animateTo = (typeof parameters.animateTo === "number") ? (parameters.animateTo) : (this._angle); |
||
0 ignored issues
–
show
|
|||
108 | |||
109 | this._parameters.step = parameters.step || this._parameters.step || null; |
||
110 | this._parameters.easing = parameters.easing || this._parameters.easing || this._defaultEasing; |
||
111 | this._parameters.duration = 'duration' in parameters ? parameters.duration : parameters.duration || this._parameters.duration || 1000; |
||
0 ignored issues
–
show
|
|||
112 | this._parameters.callback = parameters.callback || this._parameters.callback || this._emptyFunction; |
||
113 | this._parameters.center = parameters.center || this._parameters.center || ["50%","50%"]; |
||
114 | if (typeof this._parameters.center[0] == "string") { |
||
0 ignored issues
–
show
|
|||
115 | this._rotationCenterX = (parseInt(this._parameters.center[0],10) / 100) * this._imgWidth * this._aspectW; |
||
116 | } else { |
||
117 | this._rotationCenterX = this._parameters.center[0]; |
||
118 | } |
||
119 | if (typeof this._parameters.center[1] == "string") { |
||
0 ignored issues
–
show
|
|||
120 | this._rotationCenterY = (parseInt(this._parameters.center[1],10) / 100) * this._imgHeight * this._aspectH; |
||
121 | } else { |
||
122 | this._rotationCenterY = this._parameters.center[1]; |
||
123 | } |
||
124 | |||
125 | if (parameters.bind && parameters.bind != this._parameters.bind) { this._BindEvents(parameters.bind); } |
||
0 ignored issues
–
show
|
|||
126 | }, |
||
127 | _emptyFunction: function(){}, |
||
128 | _defaultEasing: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b }, |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
129 | _handleRotation : function(parameters, dontcheck){ |
||
130 | if (!supportedCSS && !this._img.complete && !dontcheck) { |
||
131 | this._onLoadDelegate.push(parameters); |
||
132 | return; |
||
133 | } |
||
134 | this._setupParameters(parameters); |
||
135 | if (this._angle==this._parameters.animateTo) { |
||
0 ignored issues
–
show
|
|||
136 | this._rotate(this._angle); |
||
137 | } |
||
138 | else { |
||
139 | this._animateStart(); |
||
140 | } |
||
141 | }, |
||
142 | |||
143 | _BindEvents:function(events){ |
||
144 | if (events && this._eventObj) |
||
145 | { |
||
146 | // Unbinding previous Events |
||
147 | if (this._parameters.bind){ |
||
148 | var oldEvents = this._parameters.bind; |
||
149 | for (var a in oldEvents) if (oldEvents.hasOwnProperty(a)) |
||
0 ignored issues
–
show
|
|||
150 | // TODO: Remove jQuery dependency |
||
151 | jQuery(this._eventObj).unbind(a,oldEvents[a]); |
||
0 ignored issues
–
show
|
|||
152 | } |
||
153 | |||
154 | this._parameters.bind = events; |
||
155 | for (var a in events) if (events.hasOwnProperty(a)) |
||
0 ignored issues
–
show
|
|||
156 | // TODO: Remove jQuery dependency |
||
157 | jQuery(this._eventObj).bind(a,events[a]); |
||
0 ignored issues
–
show
|
|||
158 | } |
||
159 | }, |
||
160 | |||
161 | _Loader:(function() |
||
162 | { |
||
163 | if (IE) |
||
164 | return function() { |
||
0 ignored issues
–
show
|
|||
165 | var width=this._img.width; |
||
166 | var height=this._img.height; |
||
167 | this._imgWidth = width; |
||
168 | this._imgHeight = height; |
||
169 | this._img.parentNode.removeChild(this._img); |
||
170 | |||
171 | this._vimage = this.createVMLNode('image'); |
||
172 | this._vimage.src=this._img.src; |
||
173 | this._vimage.style.height=height+"px"; |
||
174 | this._vimage.style.width=width+"px"; |
||
175 | this._vimage.style.position="absolute"; // FIXES IE PROBLEM - its only rendered if its on absolute position! |
||
176 | this._vimage.style.top = "0px"; |
||
177 | this._vimage.style.left = "0px"; |
||
178 | this._aspectW = this._aspectH = 1; |
||
179 | |||
180 | /* Group minifying a small 1px precision problem when rotating object */ |
||
181 | this._container = this.createVMLNode('group'); |
||
182 | this._container.style.width=width; |
||
183 | this._container.style.height=height; |
||
184 | this._container.style.position="absolute"; |
||
185 | this._container.style.top="0px"; |
||
186 | this._container.style.left="0px"; |
||
187 | this._container.setAttribute('coordsize',width-1+','+(height-1)); // This -1, -1 trying to fix ugly problem with small displacement on IE |
||
0 ignored issues
–
show
|
|||
188 | this._container.appendChild(this._vimage); |
||
189 | |||
190 | this._rootObj.appendChild(this._container); |
||
191 | this._rootObj.style.position="relative"; // FIXES IE PROBLEM |
||
192 | this._rootObj.style.width=width+"px"; |
||
193 | this._rootObj.style.height=height+"px"; |
||
194 | this._rootObj.setAttribute('id',this._img.getAttribute('id')); |
||
195 | this._rootObj.className=this._img.className; |
||
196 | this._eventObj = this._rootObj; |
||
197 | var parameters; |
||
198 | while (parameters = this._onLoadDelegate.shift()) { |
||
0 ignored issues
–
show
Are you sure that this assignment is correct, and you did not intend to make a comparison?
Even if this assignment is intended here, we recommend to make this explicit in order to make your code more readable and your intention clear: 1. Assignment invar x;
if (x = 0) { // Very likely a bug.
var b = 1;
}
// Instead
var x;
if (x === 0) {
var b = 1;
}
2. Assignment infuncton setHeight(node, height) {
do {
node.height = height;
} while (node = node.parentNode);
}
// Instead you could use
function setHeight(node, height) {
do {
node.height = height;
} while ((node = node.parentNode) !== null);
}
3. Uninitialized loop variablevar i = 0, sum;
for (i < 10; i += 1) {
sum += i;
}
// Instead
var i = 0, sum;
for (i = 0; i < 10; i += 1) {
sum += i;
}
![]() |
|||
199 | this._handleRotation(parameters, true); |
||
200 | } |
||
201 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
202 | else return function () { |
||
0 ignored issues
–
show
|
|||
203 | this._rootObj.setAttribute('id',this._img.getAttribute('id')); |
||
204 | this._rootObj.className=this._img.className; |
||
205 | |||
206 | this._imgWidth=this._img.naturalWidth; |
||
207 | this._imgHeight=this._img.naturalHeight; |
||
208 | var _widthMax=Math.sqrt((this._imgHeight)*(this._imgHeight) + (this._imgWidth) * (this._imgWidth)); |
||
209 | this._width = _widthMax * 3; |
||
210 | this._height = _widthMax * 3; |
||
211 | |||
212 | this._aspectW = this._img.offsetWidth/this._img.naturalWidth; |
||
213 | this._aspectH = this._img.offsetHeight/this._img.naturalHeight; |
||
214 | |||
215 | this._img.parentNode.removeChild(this._img); |
||
216 | |||
217 | |||
218 | this._canvas=document.createElement('canvas'); |
||
219 | this._canvas.setAttribute('width',this._width); |
||
220 | this._canvas.style.position="relative"; |
||
221 | this._canvas.style.left = -this._img.height * this._aspectW + "px"; |
||
222 | this._canvas.style.top = -this._img.width * this._aspectH + "px"; |
||
223 | this._canvas.Wilq32 = this._rootObj.Wilq32; |
||
224 | |||
225 | this._rootObj.appendChild(this._canvas); |
||
226 | this._rootObj.style.width=this._img.width*this._aspectW+"px"; |
||
227 | this._rootObj.style.height=this._img.height*this._aspectH+"px"; |
||
228 | this._eventObj = this._canvas; |
||
229 | |||
230 | this._cnv=this._canvas.getContext('2d'); |
||
231 | var parameters; |
||
232 | while (parameters = this._onLoadDelegate.shift()) { |
||
0 ignored issues
–
show
Are you sure that this assignment is correct, and you did not intend to make a comparison?
Even if this assignment is intended here, we recommend to make this explicit in order to make your code more readable and your intention clear: 1. Assignment invar x;
if (x = 0) { // Very likely a bug.
var b = 1;
}
// Instead
var x;
if (x === 0) {
var b = 1;
}
2. Assignment infuncton setHeight(node, height) {
do {
node.height = height;
} while (node = node.parentNode);
}
// Instead you could use
function setHeight(node, height) {
do {
node.height = height;
} while ((node = node.parentNode) !== null);
}
3. Uninitialized loop variablevar i = 0, sum;
for (i < 10; i += 1) {
sum += i;
}
// Instead
var i = 0, sum;
for (i = 0; i < 10; i += 1) {
sum += i;
}
![]() |
|||
233 | this._handleRotation(parameters, true); |
||
234 | } |
||
235 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
236 | })(), |
||
237 | |||
238 | _animateStart:function() |
||
239 | { |
||
240 | if (this._timer) { |
||
241 | clearTimeout(this._timer); |
||
242 | } |
||
243 | this._animateStartTime = +new Date; |
||
0 ignored issues
–
show
|
|||
244 | this._animateStartAngle = this._angle; |
||
245 | this._animate(); |
||
246 | }, |
||
247 | _animate:function() |
||
248 | { |
||
249 | var actualTime = +new Date; |
||
0 ignored issues
–
show
|
|||
250 | var checkEnd = actualTime - this._animateStartTime > this._parameters.duration; |
||
251 | |||
252 | // TODO: Bug for animatedGif for static rotation ? (to test) |
||
253 | if (checkEnd && !this._parameters.animatedGif) |
||
254 | { |
||
255 | clearTimeout(this._timer); |
||
256 | } |
||
257 | else |
||
258 | { |
||
259 | if (this._canvas||this._vimage||this._img) { |
||
260 | var angle = this._parameters.easing(0, actualTime - this._animateStartTime, this._animateStartAngle, this._parameters.animateTo - this._animateStartAngle, this._parameters.duration); |
||
0 ignored issues
–
show
|
|||
261 | this._rotate((~~(angle*10))/10); |
||
262 | } |
||
263 | if (this._parameters.step) { |
||
264 | this._parameters.step(this._angle); |
||
265 | } |
||
266 | var self = this; |
||
267 | this._timer = setTimeout(function() |
||
268 | { |
||
269 | self._animate.call(self); |
||
270 | }, 10); |
||
271 | } |
||
272 | |||
273 | // To fix Bug that prevents using recursive function in callback I moved this function to back |
||
274 | if (this._parameters.callback && checkEnd){ |
||
275 | this._angle = this._parameters.animateTo; |
||
276 | this._rotate(this._angle); |
||
277 | this._parameters.callback.call(this._rootObj); |
||
278 | } |
||
279 | }, |
||
280 | |||
281 | _rotate : (function() |
||
282 | { |
||
283 | var rad = Math.PI/180; |
||
284 | if (IE) |
||
285 | return function(angle) |
||
0 ignored issues
–
show
|
|||
286 | { |
||
287 | this._angle = angle; |
||
288 | this._container.style.rotation=(angle%360)+"deg"; |
||
289 | this._vimage.style.top = -(this._rotationCenterY - this._imgHeight/2) + "px"; |
||
290 | this._vimage.style.left = -(this._rotationCenterX - this._imgWidth/2) + "px"; |
||
291 | this._container.style.top = this._rotationCenterY - this._imgHeight/2 + "px"; |
||
292 | this._container.style.left = this._rotationCenterX - this._imgWidth/2 + "px"; |
||
293 | |||
294 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
295 | else if (supportedCSS) |
||
296 | return function(angle){ |
||
0 ignored issues
–
show
|
|||
297 | this._angle = angle; |
||
298 | this._img.style[supportedCSS]="rotate("+(angle%360)+"deg)"; |
||
299 | this._img.style[supportedCSSOrigin]=this._parameters.center.join(" "); |
||
300 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
301 | else |
||
302 | return function(angle) |
||
0 ignored issues
–
show
|
|||
303 | { |
||
304 | this._angle = angle; |
||
305 | angle=(angle%360)* rad; |
||
306 | // clear canvas |
||
307 | this._canvas.width = this._width;//+this._widthAdd; |
||
308 | this._canvas.height = this._height;//+this._heightAdd; |
||
309 | |||
310 | // REMEMBER: all drawings are read from backwards.. so first function is translate, then rotate, then translate, translate.. |
||
0 ignored issues
–
show
|
|||
311 | this._cnv.translate(this._imgWidth*this._aspectW,this._imgHeight*this._aspectH); // at least center image on screen |
||
0 ignored issues
–
show
|
|||
312 | this._cnv.translate(this._rotationCenterX,this._rotationCenterY); // we move image back to its orginal |
||
0 ignored issues
–
show
|
|||
313 | this._cnv.rotate(angle); // rotate image |
||
314 | this._cnv.translate(-this._rotationCenterX,-this._rotationCenterY); // move image to its center, so we can rotate around its center |
||
0 ignored issues
–
show
|
|||
315 | this._cnv.scale(this._aspectW,this._aspectH); // SCALE - if needed ;) |
||
316 | this._cnv.drawImage(this._img, 0, 0); // First - we draw image |
||
317 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
318 | |||
319 | })() |
||
320 | } |
||
0 ignored issues
–
show
There should be a semicolon.
Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers. Further Readings: ![]() |
|||
321 | |||
322 | if (IE) |
||
323 | { |
||
324 | Wilq32.PhotoEffect.prototype.createVMLNode=(function(){ |
||
0 ignored issues
–
show
There were too many errors found in this file; checking aborted after 95%.
If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue. Further Reading: ![]() |
|||
325 | document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)"); |
||
326 | try { |
||
327 | !document.namespaces.rvml && document.namespaces.add("rvml", "urn:schemas-microsoft-com:vml"); |
||
0 ignored issues
–
show
Did you forget to assign or call a function?
This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function: function someFunction(x) {
(x > 0) ? callFoo() : callBar();
}
// JSHint expects you to assign the result to a variable:
function someFunction(x) {
var rs = (x > 0) ? callFoo() : callBar();
}
// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
if (x > 0) {
callFoo();
} else {
callBar();
}
}
![]() |
|||
328 | return function (tagName) { |
||
329 | return document.createElement('<rvml:' + tagName + ' class="rvml">'); |
||
330 | }; |
||
331 | } catch (e) { |
||
332 | return function (tagName) { |
||
333 | return document.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">'); |
||
334 | }; |
||
335 | } |
||
336 | })(); |
||
337 | } |
||
338 | |||
339 | })(jQuery); |