author | newuser |
Mon, 19 Apr 2010 15:00:57 -0700 | |
changeset 306 | 42f09aa2b24a |
parent 303 | a619b3ef3095 |
permissions | -rw-r--r-- |
303
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1 |
(function(){ |
37
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
2 |
/* |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
3 |
* jQuery 1.2.6 - New Wave Javascript |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
4 |
* |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
5 |
* Copyright (c) 2008 John Resig (jquery.com) |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
6 |
* Dual licensed under the MIT (MIT-LICENSE.txt) |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
7 |
* and GPL (GPL-LICENSE.txt) licenses. |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
8 |
* |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
9 |
* $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $ |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
10 |
* $Rev: 5685 $ |
641b65b14318
Added WRT previewer, Mozilla Xulrunner, and Mozilla XP Com. Integrated Xulrunner browser into WRT Previewer.
tasneems@symbian.org
parents:
diff
changeset
|
11 |
*/ |
303
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
12 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
13 |
// Map over jQuery in case of overwrite |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
14 |
var _jQuery = window.jQuery, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
15 |
// Map over the $ in case of overwrite |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
16 |
_$ = window.$; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
17 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
18 |
var jQuery = window.jQuery = window.$ = function( selector, context ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
19 |
// The jQuery object is actually just the init constructor 'enhanced' |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
20 |
return new jQuery.fn.init( selector, context ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
21 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
22 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
23 |
// A simple way to check for HTML strings or ID strings |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
24 |
// (both of which we optimize for) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
25 |
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
26 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
27 |
// Is it a simple selector |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
28 |
isSimple = /^.[^:#\[\.]*$/, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
29 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
30 |
// Will speed up references to undefined, and allows munging its name. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
31 |
undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
32 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
33 |
jQuery.fn = jQuery.prototype = { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
34 |
init: function( selector, context ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
35 |
// Make sure that a selection was provided |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
36 |
selector = selector || document; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
37 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
38 |
// Handle $(DOMElement) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
39 |
if ( selector.nodeType ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
40 |
this[0] = selector; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
41 |
this.length = 1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
42 |
return this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
43 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
44 |
// Handle HTML strings |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
45 |
if ( typeof selector == "string" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
46 |
// Are we dealing with HTML string or an ID? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
47 |
var match = quickExpr.exec( selector ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
48 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
49 |
// Verify a match, and that no context was specified for #id |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
50 |
if ( match && (match[1] || !context) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
51 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
52 |
// HANDLE: $(html) -> $(array) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
53 |
if ( match[1] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
54 |
selector = jQuery.clean( [ match[1] ], context ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
55 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
56 |
// HANDLE: $("#id") |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
57 |
else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
58 |
var elem = document.getElementById( match[3] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
59 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
60 |
// Make sure an element was located |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
61 |
if ( elem ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
62 |
// Handle the case where IE and Opera return items |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
63 |
// by name instead of ID |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
64 |
if ( elem.id != match[3] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
65 |
return jQuery().find( selector ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
66 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
67 |
// Otherwise, we inject the element directly into the jQuery object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
68 |
return jQuery( elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
69 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
70 |
selector = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
71 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
72 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
73 |
// HANDLE: $(expr, [context]) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
74 |
// (which is just equivalent to: $(content).find(expr) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
75 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
76 |
return jQuery( context ).find( selector ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
77 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
78 |
// HANDLE: $(function) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
79 |
// Shortcut for document ready |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
80 |
} else if ( jQuery.isFunction( selector ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
81 |
return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
82 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
83 |
return this.setArray(jQuery.makeArray(selector)); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
84 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
85 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
86 |
// The current version of jQuery being used |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
87 |
jquery: "1.2.6", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
88 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
89 |
// The number of elements contained in the matched element set |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
90 |
size: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
91 |
return this.length; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
92 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
93 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
94 |
// The number of elements contained in the matched element set |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
95 |
length: 0, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
96 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
97 |
// Get the Nth element in the matched element set OR |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
98 |
// Get the whole matched element set as a clean array |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
99 |
get: function( num ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
100 |
return num == undefined ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
101 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
102 |
// Return a 'clean' array |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
103 |
jQuery.makeArray( this ) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
104 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
105 |
// Return just the object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
106 |
this[ num ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
107 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
108 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
109 |
// Take an array of elements and push it onto the stack |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
110 |
// (returning the new matched element set) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
111 |
pushStack: function( elems ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
112 |
// Build a new jQuery matched element set |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
113 |
var ret = jQuery( elems ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
114 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
115 |
// Add the old object onto the stack (as a reference) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
116 |
ret.prevObject = this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
117 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
118 |
// Return the newly-formed element set |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
119 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
120 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
121 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
122 |
// Force the current matched set of elements to become |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
123 |
// the specified array of elements (destroying the stack in the process) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
124 |
// You should use pushStack() in order to do this, but maintain the stack |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
125 |
setArray: function( elems ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
126 |
// Resetting the length to 0, then using the native Array push |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
127 |
// is a super-fast way to populate an object with array-like properties |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
128 |
this.length = 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
129 |
Array.prototype.push.apply( this, elems ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
130 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
131 |
return this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
132 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
133 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
134 |
// Execute a callback for every element in the matched set. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
135 |
// (You can seed the arguments with an array of args, but this is |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
136 |
// only used internally.) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
137 |
each: function( callback, args ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
138 |
return jQuery.each( this, callback, args ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
139 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
140 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
141 |
// Determine the position of an element within |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
142 |
// the matched set of elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
143 |
index: function( elem ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
144 |
var ret = -1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
145 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
146 |
// Locate the position of the desired element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
147 |
return jQuery.inArray( |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
148 |
// If it receives a jQuery object, the first element is used |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
149 |
elem && elem.jquery ? elem[0] : elem |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
150 |
, this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
151 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
152 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
153 |
attr: function( name, value, type ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
154 |
var options = name; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
155 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
156 |
// Look for the case where we're accessing a style value |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
157 |
if ( name.constructor == String ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
158 |
if ( value === undefined ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
159 |
return this[0] && jQuery[ type || "attr" ]( this[0], name ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
160 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
161 |
else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
162 |
options = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
163 |
options[ name ] = value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
164 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
165 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
166 |
// Check to see if we're setting style values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
167 |
return this.each(function(i){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
168 |
// Set all the styles |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
169 |
for ( name in options ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
170 |
jQuery.attr( |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
171 |
type ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
172 |
this.style : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
173 |
this, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
174 |
name, jQuery.prop( this, options[ name ], type, i, name ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
175 |
); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
176 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
177 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
178 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
179 |
css: function( key, value ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
180 |
// ignore negative width and height values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
181 |
if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
182 |
value = undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
183 |
return this.attr( key, value, "curCSS" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
184 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
185 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
186 |
text: function( text ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
187 |
if ( typeof text != "object" && text != null ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
188 |
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
189 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
190 |
var ret = ""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
191 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
192 |
jQuery.each( text || this, function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
193 |
jQuery.each( this.childNodes, function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
194 |
if ( this.nodeType != 8 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
195 |
ret += this.nodeType != 1 ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
196 |
this.nodeValue : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
197 |
jQuery.fn.text( [ this ] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
198 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
199 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
200 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
201 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
202 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
203 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
204 |
wrapAll: function( html ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
205 |
if ( this[0] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
206 |
// The elements to wrap the target around |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
207 |
jQuery( html, this[0].ownerDocument ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
208 |
.clone() |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
209 |
.insertBefore( this[0] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
210 |
.map(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
211 |
var elem = this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
212 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
213 |
while ( elem.firstChild ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
214 |
elem = elem.firstChild; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
215 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
216 |
return elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
217 |
}) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
218 |
.append(this); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
219 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
220 |
return this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
221 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
222 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
223 |
wrapInner: function( html ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
224 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
225 |
jQuery( this ).contents().wrapAll( html ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
226 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
227 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
228 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
229 |
wrap: function( html ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
230 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
231 |
jQuery( this ).wrapAll( html ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
232 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
233 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
234 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
235 |
append: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
236 |
return this.domManip(arguments, true, false, function(elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
237 |
if (this.nodeType == 1) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
238 |
this.appendChild( elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
239 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
240 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
241 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
242 |
prepend: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
243 |
return this.domManip(arguments, true, true, function(elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
244 |
if (this.nodeType == 1) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
245 |
this.insertBefore( elem, this.firstChild ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
246 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
247 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
248 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
249 |
before: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
250 |
return this.domManip(arguments, false, false, function(elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
251 |
this.parentNode.insertBefore( elem, this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
252 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
253 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
254 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
255 |
after: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
256 |
return this.domManip(arguments, false, true, function(elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
257 |
this.parentNode.insertBefore( elem, this.nextSibling ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
258 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
259 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
260 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
261 |
end: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
262 |
return this.prevObject || jQuery( [] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
263 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
264 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
265 |
find: function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
266 |
var elems = jQuery.map(this, function(elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
267 |
return jQuery.find( selector, elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
268 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
269 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
270 |
return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
271 |
jQuery.unique( elems ) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
272 |
elems ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
273 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
274 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
275 |
clone: function( events ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
276 |
// Do the clone |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
277 |
var ret = this.map(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
278 |
if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
279 |
// IE copies events bound via attachEvent when |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
280 |
// using cloneNode. Calling detachEvent on the |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
281 |
// clone will also remove the events from the orignal |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
282 |
// In order to get around this, we use innerHTML. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
283 |
// Unfortunately, this means some modifications to |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
284 |
// attributes in IE that are actually only stored |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
285 |
// as properties will not be copied (such as the |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
286 |
// the name attribute on an input). |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
287 |
var clone = this.cloneNode(true), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
288 |
container = document.createElement("div"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
289 |
container.appendChild(clone); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
290 |
return jQuery.clean([container.innerHTML])[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
291 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
292 |
return this.cloneNode(true); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
293 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
294 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
295 |
// Need to set the expando to null on the cloned set if it exists |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
296 |
// removeData doesn't work here, IE removes it from the original as well |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
297 |
// this is primarily for IE but the data expando shouldn't be copied over in any browser |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
298 |
var clone = ret.find("*").andSelf().each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
299 |
if ( this[ expando ] != undefined ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
300 |
this[ expando ] = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
301 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
302 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
303 |
// Copy the events from the original to the clone |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
304 |
if ( events === true ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
305 |
this.find("*").andSelf().each(function(i){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
306 |
if (this.nodeType == 3) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
307 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
308 |
var events = jQuery.data( this, "events" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
309 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
310 |
for ( var type in events ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
311 |
for ( var handler in events[ type ] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
312 |
jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
313 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
314 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
315 |
// Return the cloned set |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
316 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
317 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
318 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
319 |
filter: function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
320 |
return this.pushStack( |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
321 |
jQuery.isFunction( selector ) && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
322 |
jQuery.grep(this, function(elem, i){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
323 |
return selector.call( elem, i ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
324 |
}) || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
325 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
326 |
jQuery.multiFilter( selector, this ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
327 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
328 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
329 |
not: function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
330 |
if ( selector.constructor == String ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
331 |
// test special case where just one selector is passed in |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
332 |
if ( isSimple.test( selector ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
333 |
return this.pushStack( jQuery.multiFilter( selector, this, true ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
334 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
335 |
selector = jQuery.multiFilter( selector, this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
336 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
337 |
var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
338 |
return this.filter(function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
339 |
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
340 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
341 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
342 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
343 |
add: function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
344 |
return this.pushStack( jQuery.unique( jQuery.merge( |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
345 |
this.get(), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
346 |
typeof selector == 'string' ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
347 |
jQuery( selector ) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
348 |
jQuery.makeArray( selector ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
349 |
))); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
350 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
351 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
352 |
is: function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
353 |
return !!selector && jQuery.multiFilter( selector, this ).length > 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
354 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
355 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
356 |
hasClass: function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
357 |
return this.is( "." + selector ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
358 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
359 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
360 |
val: function( value ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
361 |
if ( value == undefined ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
362 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
363 |
if ( this.length ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
364 |
var elem = this[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
365 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
366 |
// We need to handle select boxes special |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
367 |
if ( jQuery.nodeName( elem, "select" ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
368 |
var index = elem.selectedIndex, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
369 |
values = [], |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
370 |
options = elem.options, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
371 |
one = elem.type == "select-one"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
372 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
373 |
// Nothing was selected |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
374 |
if ( index < 0 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
375 |
return null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
376 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
377 |
// Loop through all the selected options |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
378 |
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
379 |
var option = options[ i ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
380 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
381 |
if ( option.selected ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
382 |
// Get the specifc value for the option |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
383 |
value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
384 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
385 |
// We don't need an array for one selects |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
386 |
if ( one ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
387 |
return value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
388 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
389 |
// Multi-Selects return an array |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
390 |
values.push( value ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
391 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
392 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
393 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
394 |
return values; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
395 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
396 |
// Everything else, we just grab the value |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
397 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
398 |
return (this[0].value || "").replace(/\r/g, ""); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
399 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
400 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
401 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
402 |
return undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
403 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
404 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
405 |
if( value.constructor == Number ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
406 |
value += ''; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
407 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
408 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
409 |
if ( this.nodeType != 1 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
410 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
411 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
412 |
if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
413 |
this.checked = (jQuery.inArray(this.value, value) >= 0 || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
414 |
jQuery.inArray(this.name, value) >= 0); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
415 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
416 |
else if ( jQuery.nodeName( this, "select" ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
417 |
var values = jQuery.makeArray(value); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
418 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
419 |
jQuery( "option", this ).each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
420 |
this.selected = (jQuery.inArray( this.value, values ) >= 0 || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
421 |
jQuery.inArray( this.text, values ) >= 0); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
422 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
423 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
424 |
if ( !values.length ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
425 |
this.selectedIndex = -1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
426 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
427 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
428 |
this.value = value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
429 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
430 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
431 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
432 |
html: function( value ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
433 |
return value == undefined ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
434 |
(this[0] ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
435 |
this[0].innerHTML : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
436 |
null) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
437 |
this.empty().append( value ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
438 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
439 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
440 |
replaceWith: function( value ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
441 |
return this.after( value ).remove(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
442 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
443 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
444 |
eq: function( i ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
445 |
return this.slice( i, i + 1 ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
446 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
447 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
448 |
slice: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
449 |
return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
450 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
451 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
452 |
map: function( callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
453 |
return this.pushStack( jQuery.map(this, function(elem, i){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
454 |
return callback.call( elem, i, elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
455 |
})); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
456 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
457 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
458 |
andSelf: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
459 |
return this.add( this.prevObject ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
460 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
461 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
462 |
data: function( key, value ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
463 |
var parts = key.split("."); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
464 |
parts[1] = parts[1] ? "." + parts[1] : ""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
465 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
466 |
if ( value === undefined ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
467 |
var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
468 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
469 |
if ( data === undefined && this.length ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
470 |
data = jQuery.data( this[0], key ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
471 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
472 |
return data === undefined && parts[1] ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
473 |
this.data( parts[0] ) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
474 |
data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
475 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
476 |
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
477 |
jQuery.data( this, key, value ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
478 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
479 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
480 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
481 |
removeData: function( key ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
482 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
483 |
jQuery.removeData( this, key ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
484 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
485 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
486 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
487 |
domManip: function( args, table, reverse, callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
488 |
var clone = this.length > 1, elems; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
489 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
490 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
491 |
if ( !elems ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
492 |
elems = jQuery.clean( args, this.ownerDocument ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
493 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
494 |
if ( reverse ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
495 |
elems.reverse(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
496 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
497 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
498 |
var obj = this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
499 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
500 |
if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
501 |
obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
502 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
503 |
var scripts = jQuery( [] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
504 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
505 |
jQuery.each(elems, function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
506 |
var elem = clone ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
507 |
jQuery( this ).clone( true )[0] : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
508 |
this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
509 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
510 |
// execute all scripts after the elements have been injected |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
511 |
if ( jQuery.nodeName( elem, "script" ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
512 |
scripts = scripts.add( elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
513 |
else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
514 |
// Remove any inner scripts for later evaluation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
515 |
if ( elem.nodeType == 1 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
516 |
scripts = scripts.add( jQuery( "script", elem ).remove() ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
517 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
518 |
// Inject the elements into the document |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
519 |
callback.call( obj, elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
520 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
521 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
522 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
523 |
scripts.each( evalScript ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
524 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
525 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
526 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
527 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
528 |
// Give the init function the jQuery prototype for later instantiation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
529 |
jQuery.fn.init.prototype = jQuery.fn; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
530 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
531 |
function evalScript( i, elem ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
532 |
if ( elem.src ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
533 |
jQuery.ajax({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
534 |
url: elem.src, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
535 |
async: false, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
536 |
dataType: "script" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
537 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
538 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
539 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
540 |
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
541 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
542 |
if ( elem.parentNode ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
543 |
elem.parentNode.removeChild( elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
544 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
545 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
546 |
function now(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
547 |
return +new Date; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
548 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
549 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
550 |
jQuery.extend = jQuery.fn.extend = function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
551 |
// copy reference to target object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
552 |
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
553 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
554 |
// Handle a deep copy situation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
555 |
if ( target.constructor == Boolean ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
556 |
deep = target; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
557 |
target = arguments[1] || {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
558 |
// skip the boolean and the target |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
559 |
i = 2; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
560 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
561 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
562 |
// Handle case when target is a string or something (possible in deep copy) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
563 |
if ( typeof target != "object" && typeof target != "function" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
564 |
target = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
565 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
566 |
// extend jQuery itself if only one argument is passed |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
567 |
if ( length == i ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
568 |
target = this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
569 |
--i; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
570 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
571 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
572 |
for ( ; i < length; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
573 |
// Only deal with non-null/undefined values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
574 |
if ( (options = arguments[ i ]) != null ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
575 |
// Extend the base object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
576 |
for ( var name in options ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
577 |
var src = target[ name ], copy = options[ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
578 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
579 |
// Prevent never-ending loop |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
580 |
if ( target === copy ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
581 |
continue; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
582 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
583 |
// Recurse if we're merging object values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
584 |
if ( deep && copy && typeof copy == "object" && !copy.nodeType ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
585 |
target[ name ] = jQuery.extend( deep, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
586 |
// Never move original objects, clone them |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
587 |
src || ( copy.length != null ? [ ] : { } ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
588 |
, copy ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
589 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
590 |
// Don't bring in undefined values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
591 |
else if ( copy !== undefined ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
592 |
target[ name ] = copy; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
593 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
594 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
595 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
596 |
// Return the modified object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
597 |
return target; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
598 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
599 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
600 |
var expando = "jQuery" + now(), uuid = 0, windowData = {}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
601 |
// exclude the following css properties to add px |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
602 |
exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
603 |
// cache defaultView |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
604 |
defaultView = document.defaultView || {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
605 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
606 |
jQuery.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
607 |
noConflict: function( deep ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
608 |
window.$ = _$; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
609 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
610 |
if ( deep ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
611 |
window.jQuery = _jQuery; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
612 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
613 |
return jQuery; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
614 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
615 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
616 |
// See test/unit/core.js for details concerning this function. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
617 |
isFunction: function( fn ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
618 |
return !!fn && typeof fn != "string" && !fn.nodeName && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
619 |
fn.constructor != Array && /^[\s[]?function/.test( fn + "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
620 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
621 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
622 |
// check if an element is in a (or is an) XML document |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
623 |
isXMLDoc: function( elem ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
624 |
return elem.documentElement && !elem.body || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
625 |
elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
626 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
627 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
628 |
// Evalulates a script in a global context |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
629 |
globalEval: function( data ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
630 |
data = jQuery.trim( data ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
631 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
632 |
if ( data ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
633 |
// Inspired by code by Andrea Giammarchi |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
634 |
// http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
635 |
var head = document.getElementsByTagName("head")[0] || document.documentElement, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
636 |
script = document.createElement("script"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
637 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
638 |
script.type = "text/javascript"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
639 |
if ( jQuery.browser.msie ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
640 |
script.text = data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
641 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
642 |
script.appendChild( document.createTextNode( data ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
643 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
644 |
// Use insertBefore instead of appendChild to circumvent an IE6 bug. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
645 |
// This arises when a base node is used (#2709). |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
646 |
head.insertBefore( script, head.firstChild ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
647 |
head.removeChild( script ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
648 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
649 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
650 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
651 |
nodeName: function( elem, name ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
652 |
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
653 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
654 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
655 |
cache: {}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
656 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
657 |
data: function( elem, name, data ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
658 |
elem = elem == window ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
659 |
windowData : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
660 |
elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
661 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
662 |
var id = elem[ expando ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
663 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
664 |
// Compute a unique ID for the element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
665 |
if ( !id ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
666 |
id = elem[ expando ] = ++uuid; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
667 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
668 |
// Only generate the data cache if we're |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
669 |
// trying to access or manipulate it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
670 |
if ( name && !jQuery.cache[ id ] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
671 |
jQuery.cache[ id ] = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
672 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
673 |
// Prevent overriding the named cache with undefined values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
674 |
if ( data !== undefined ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
675 |
jQuery.cache[ id ][ name ] = data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
676 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
677 |
// Return the named cache data, or the ID for the element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
678 |
return name ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
679 |
jQuery.cache[ id ][ name ] : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
680 |
id; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
681 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
682 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
683 |
removeData: function( elem, name ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
684 |
elem = elem == window ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
685 |
windowData : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
686 |
elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
687 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
688 |
var id = elem[ expando ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
689 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
690 |
// If we want to remove a specific section of the element's data |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
691 |
if ( name ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
692 |
if ( jQuery.cache[ id ] ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
693 |
// Remove the section of cache data |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
694 |
delete jQuery.cache[ id ][ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
695 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
696 |
// If we've removed all the data, remove the element's cache |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
697 |
name = ""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
698 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
699 |
for ( name in jQuery.cache[ id ] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
700 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
701 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
702 |
if ( !name ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
703 |
jQuery.removeData( elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
704 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
705 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
706 |
// Otherwise, we want to remove all of the element's data |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
707 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
708 |
// Clean up the element expando |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
709 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
710 |
delete elem[ expando ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
711 |
} catch(e){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
712 |
// IE has trouble directly removing the expando |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
713 |
// but it's ok with using removeAttribute |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
714 |
if ( elem.removeAttribute ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
715 |
elem.removeAttribute( expando ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
716 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
717 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
718 |
// Completely remove the data cache |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
719 |
delete jQuery.cache[ id ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
720 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
721 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
722 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
723 |
// args is for internal usage only |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
724 |
each: function( object, callback, args ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
725 |
var name, i = 0, length = object.length; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
726 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
727 |
if ( args ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
728 |
if ( length == undefined ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
729 |
for ( name in object ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
730 |
if ( callback.apply( object[ name ], args ) === false ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
731 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
732 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
733 |
for ( ; i < length; ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
734 |
if ( callback.apply( object[ i++ ], args ) === false ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
735 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
736 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
737 |
// A special, fast, case for the most common use of each |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
738 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
739 |
if ( length == undefined ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
740 |
for ( name in object ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
741 |
if ( callback.call( object[ name ], name, object[ name ] ) === false ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
742 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
743 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
744 |
for ( var value = object[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
745 |
i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
746 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
747 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
748 |
return object; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
749 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
750 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
751 |
prop: function( elem, value, type, i, name ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
752 |
// Handle executable functions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
753 |
if ( jQuery.isFunction( value ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
754 |
value = value.call( elem, i ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
755 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
756 |
// Handle passing in a number to a CSS property |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
757 |
return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
758 |
value + "px" : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
759 |
value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
760 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
761 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
762 |
className: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
763 |
// internal only, use addClass("class") |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
764 |
add: function( elem, classNames ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
765 |
jQuery.each((classNames || "").split(/\s+/), function(i, className){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
766 |
if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
767 |
elem.className += (elem.className ? " " : "") + className; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
768 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
769 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
770 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
771 |
// internal only, use removeClass("class") |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
772 |
remove: function( elem, classNames ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
773 |
if (elem.nodeType == 1) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
774 |
elem.className = classNames != undefined ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
775 |
jQuery.grep(elem.className.split(/\s+/), function(className){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
776 |
return !jQuery.className.has( classNames, className ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
777 |
}).join(" ") : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
778 |
""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
779 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
780 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
781 |
// internal only, use hasClass("class") |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
782 |
has: function( elem, className ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
783 |
return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
784 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
785 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
786 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
787 |
// A method for quickly swapping in/out CSS properties to get correct calculations |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
788 |
swap: function( elem, options, callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
789 |
var old = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
790 |
// Remember the old values, and insert the new ones |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
791 |
for ( var name in options ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
792 |
old[ name ] = elem.style[ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
793 |
elem.style[ name ] = options[ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
794 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
795 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
796 |
callback.call( elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
797 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
798 |
// Revert the old values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
799 |
for ( var name in options ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
800 |
elem.style[ name ] = old[ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
801 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
802 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
803 |
css: function( elem, name, force ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
804 |
if ( name == "width" || name == "height" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
805 |
var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
806 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
807 |
function getWH() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
808 |
val = name == "width" ? elem.offsetWidth : elem.offsetHeight; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
809 |
var padding = 0, border = 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
810 |
jQuery.each( which, function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
811 |
padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
812 |
border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
813 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
814 |
val -= Math.round(padding + border); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
815 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
816 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
817 |
if ( jQuery(elem).is(":visible") ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
818 |
getWH(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
819 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
820 |
jQuery.swap( elem, props, getWH ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
821 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
822 |
return Math.max(0, val); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
823 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
824 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
825 |
return jQuery.curCSS( elem, name, force ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
826 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
827 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
828 |
curCSS: function( elem, name, force ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
829 |
var ret, style = elem.style; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
830 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
831 |
// A helper method for determining if an element's values are broken |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
832 |
function color( elem ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
833 |
if ( !jQuery.browser.safari ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
834 |
return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
835 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
836 |
// defaultView is cached |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
837 |
var ret = defaultView.getComputedStyle( elem, null ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
838 |
return !ret || ret.getPropertyValue("color") == ""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
839 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
840 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
841 |
// We need to handle opacity special in IE |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
842 |
if ( name == "opacity" && jQuery.browser.msie ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
843 |
ret = jQuery.attr( style, "opacity" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
844 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
845 |
return ret == "" ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
846 |
"1" : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
847 |
ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
848 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
849 |
// Opera sometimes will give the wrong display answer, this fixes it, see #2037 |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
850 |
if ( jQuery.browser.opera && name == "display" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
851 |
var save = style.outline; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
852 |
style.outline = "0 solid black"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
853 |
style.outline = save; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
854 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
855 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
856 |
// Make sure we're using the right name for getting the float value |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
857 |
if ( name.match( /float/i ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
858 |
name = styleFloat; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
859 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
860 |
if ( !force && style && style[ name ] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
861 |
ret = style[ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
862 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
863 |
else if ( defaultView.getComputedStyle ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
864 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
865 |
// Only "float" is needed here |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
866 |
if ( name.match( /float/i ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
867 |
name = "float"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
868 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
869 |
name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
870 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
871 |
var computedStyle = defaultView.getComputedStyle( elem, null ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
872 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
873 |
if ( computedStyle && !color( elem ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
874 |
ret = computedStyle.getPropertyValue( name ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
875 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
876 |
// If the element isn't reporting its values properly in Safari |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
877 |
// then some display: none elements are involved |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
878 |
else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
879 |
var swap = [], stack = [], a = elem, i = 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
880 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
881 |
// Locate all of the parent display: none elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
882 |
for ( ; a && color(a); a = a.parentNode ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
883 |
stack.unshift(a); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
884 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
885 |
// Go through and make them visible, but in reverse |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
886 |
// (It would be better if we knew the exact display type that they had) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
887 |
for ( ; i < stack.length; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
888 |
if ( color( stack[ i ] ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
889 |
swap[ i ] = stack[ i ].style.display; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
890 |
stack[ i ].style.display = "block"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
891 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
892 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
893 |
// Since we flip the display style, we have to handle that |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
894 |
// one special, otherwise get the value |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
895 |
ret = name == "display" && swap[ stack.length - 1 ] != null ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
896 |
"none" : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
897 |
( computedStyle && computedStyle.getPropertyValue( name ) ) || ""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
898 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
899 |
// Finally, revert the display styles back |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
900 |
for ( i = 0; i < swap.length; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
901 |
if ( swap[ i ] != null ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
902 |
stack[ i ].style.display = swap[ i ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
903 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
904 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
905 |
// We should always get a number back from opacity |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
906 |
if ( name == "opacity" && ret == "" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
907 |
ret = "1"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
908 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
909 |
} else if ( elem.currentStyle ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
910 |
var camelCase = name.replace(/\-(\w)/g, function(all, letter){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
911 |
return letter.toUpperCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
912 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
913 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
914 |
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
915 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
916 |
// From the awesome hack by Dean Edwards |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
917 |
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
918 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
919 |
// If we're not dealing with a regular pixel number |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
920 |
// but a number that has a weird ending, we need to convert it to pixels |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
921 |
if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
922 |
// Remember the original values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
923 |
var left = style.left, rsLeft = elem.runtimeStyle.left; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
924 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
925 |
// Put in the new values to get a computed value out |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
926 |
elem.runtimeStyle.left = elem.currentStyle.left; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
927 |
style.left = ret || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
928 |
ret = style.pixelLeft + "px"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
929 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
930 |
// Revert the changed values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
931 |
style.left = left; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
932 |
elem.runtimeStyle.left = rsLeft; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
933 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
934 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
935 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
936 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
937 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
938 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
939 |
clean: function( elems, context ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
940 |
var ret = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
941 |
context = context || document; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
942 |
// !context.createElement fails in IE with an error but returns typeof 'object' |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
943 |
if (typeof context.createElement == 'undefined') |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
944 |
context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
945 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
946 |
jQuery.each(elems, function(i, elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
947 |
if ( !elem ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
948 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
949 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
950 |
if ( elem.constructor == Number ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
951 |
elem += ''; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
952 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
953 |
// Convert html string into DOM nodes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
954 |
if ( typeof elem == "string" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
955 |
// Fix "XHTML"-style tags in all browsers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
956 |
elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
957 |
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
958 |
all : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
959 |
front + "></" + tag + ">"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
960 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
961 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
962 |
// Trim whitespace, otherwise indexOf won't work as expected |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
963 |
var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
964 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
965 |
var wrap = |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
966 |
// option or optgroup |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
967 |
!tags.indexOf("<opt") && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
968 |
[ 1, "<select multiple='multiple'>", "</select>" ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
969 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
970 |
!tags.indexOf("<leg") && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
971 |
[ 1, "<fieldset>", "</fieldset>" ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
972 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
973 |
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
974 |
[ 1, "<table>", "</table>" ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
975 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
976 |
!tags.indexOf("<tr") && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
977 |
[ 2, "<table><tbody>", "</tbody></table>" ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
978 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
979 |
// <thead> matched above |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
980 |
(!tags.indexOf("<td") || !tags.indexOf("<th")) && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
981 |
[ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
982 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
983 |
!tags.indexOf("<col") && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
984 |
[ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
985 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
986 |
// IE can't serialize <link> and <script> tags normally |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
987 |
jQuery.browser.msie && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
988 |
[ 1, "div<div>", "</div>" ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
989 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
990 |
[ 0, "", "" ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
991 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
992 |
// Go to html and back, then peel off extra wrappers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
993 |
div.innerHTML = wrap[1] + elem + wrap[2]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
994 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
995 |
// Move to the right depth |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
996 |
while ( wrap[0]-- ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
997 |
div = div.lastChild; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
998 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
999 |
// Remove IE's autoinserted <tbody> from table fragments |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1000 |
if ( jQuery.browser.msie ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1001 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1002 |
// String was a <table>, *may* have spurious <tbody> |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1003 |
var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1004 |
div.firstChild && div.firstChild.childNodes : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1005 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1006 |
// String was a bare <thead> or <tfoot> |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1007 |
wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1008 |
div.childNodes : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1009 |
[]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1010 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1011 |
for ( var j = tbody.length - 1; j >= 0 ; --j ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1012 |
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1013 |
tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1014 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1015 |
// IE completely kills leading whitespace when innerHTML is used |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1016 |
if ( /^\s/.test( elem ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1017 |
div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1018 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1019 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1020 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1021 |
elem = jQuery.makeArray( div.childNodes ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1022 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1023 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1024 |
if ( elem.length === 0 && (!jQuery.nodeName( elem, "form" ) && !jQuery.nodeName( elem, "select" )) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1025 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1026 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1027 |
if ( elem[0] == undefined || jQuery.nodeName( elem, "form" ) || elem.options ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1028 |
ret.push( elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1029 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1030 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1031 |
ret = jQuery.merge( ret, elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1032 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1033 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1034 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1035 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1036 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1037 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1038 |
attr: function( elem, name, value ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1039 |
// don't set attributes on text and comment nodes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1040 |
if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1041 |
return undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1042 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1043 |
var notxml = !jQuery.isXMLDoc( elem ), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1044 |
// Whether we are setting (or getting) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1045 |
set = value !== undefined, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1046 |
msie = jQuery.browser.msie; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1047 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1048 |
// Try to normalize/fix the name |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1049 |
name = notxml && jQuery.props[ name ] || name; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1050 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1051 |
// Only do all the following if this is a node (faster for style) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1052 |
// IE elem.getAttribute passes even for style |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1053 |
if ( elem.tagName ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1054 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1055 |
// These attributes require special treatment |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1056 |
var special = /href|src|style/.test( name ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1057 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1058 |
// Safari mis-reports the default selected property of a hidden option |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1059 |
// Accessing the parent's selectedIndex property fixes it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1060 |
if ( name == "selected" && jQuery.browser.safari ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1061 |
elem.parentNode.selectedIndex; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1062 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1063 |
// If applicable, access the attribute via the DOM 0 way |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1064 |
if ( name in elem && notxml && !special ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1065 |
if ( set ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1066 |
// We can't allow the type property to be changed (since it causes problems in IE) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1067 |
if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1068 |
throw "type property can't be changed"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1069 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1070 |
elem[ name ] = value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1071 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1072 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1073 |
// browsers index elements by id/name on forms, give priority to attributes. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1074 |
if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1075 |
return elem.getAttributeNode( name ).nodeValue; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1076 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1077 |
return elem[ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1078 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1079 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1080 |
if ( msie && notxml && name == "style" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1081 |
return jQuery.attr( elem.style, "cssText", value ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1082 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1083 |
if ( set ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1084 |
// convert the value to a string (all browsers do this but IE) see #1070 |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1085 |
elem.setAttribute( name, "" + value ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1086 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1087 |
var attr = msie && notxml && special |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1088 |
// Some attributes require a special call on IE |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1089 |
? elem.getAttribute( name, 2 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1090 |
: elem.getAttribute( name ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1091 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1092 |
// Non-existent attributes return null, we normalize to undefined |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1093 |
return attr === null ? undefined : attr; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1094 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1095 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1096 |
// elem is actually elem.style ... set the style |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1097 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1098 |
// IE uses filters for opacity |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1099 |
if ( msie && name == "opacity" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1100 |
if ( set ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1101 |
// IE has trouble with opacity if it does not have layout |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1102 |
// Force it by setting the zoom level |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1103 |
elem.zoom = 1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1104 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1105 |
// Set the alpha filter to set the opacity |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1106 |
elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1107 |
(parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1108 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1109 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1110 |
return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1111 |
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1112 |
""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1113 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1114 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1115 |
name = name.replace(/-([a-z])/ig, function(all, letter){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1116 |
return letter.toUpperCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1117 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1118 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1119 |
if ( set ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1120 |
elem[ name ] = value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1121 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1122 |
return elem[ name ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1123 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1124 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1125 |
trim: function( text ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1126 |
return (text || "").replace( /^\s+|\s+$/g, "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1127 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1128 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1129 |
makeArray: function( array ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1130 |
var ret = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1131 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1132 |
if( array != null ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1133 |
var i = array.length; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1134 |
//the window, strings and functions also have 'length' |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1135 |
if( i == null || array.split || array.setInterval || array.call ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1136 |
ret[0] = array; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1137 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1138 |
while( i ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1139 |
ret[--i] = array[i]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1140 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1141 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1142 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1143 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1144 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1145 |
inArray: function( elem, array ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1146 |
for ( var i = 0, length = array.length; i < length; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1147 |
// Use === because on IE, window == document |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1148 |
if ( array[ i ] === elem ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1149 |
return i; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1150 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1151 |
return -1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1152 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1153 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1154 |
merge: function( first, second ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1155 |
// We have to loop this way because IE & Opera overwrite the length |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1156 |
// expando of getElementsByTagName |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1157 |
var i = 0, elem, pos = first.length; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1158 |
// Also, we need to make sure that the correct elements are being returned |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1159 |
// (IE returns comment nodes in a '*' query) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1160 |
if ( jQuery.browser.msie ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1161 |
while ( elem = second[ i++ ] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1162 |
if ( elem.nodeType != 8 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1163 |
first[ pos++ ] = elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1164 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1165 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1166 |
while ( elem = second[ i++ ] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1167 |
first[ pos++ ] = elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1168 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1169 |
return first; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1170 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1171 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1172 |
unique: function( array ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1173 |
var ret = [], done = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1174 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1175 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1176 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1177 |
for ( var i = 0, length = array.length; i < length; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1178 |
var id = jQuery.data( array[ i ] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1179 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1180 |
if ( !done[ id ] ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1181 |
done[ id ] = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1182 |
ret.push( array[ i ] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1183 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1184 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1185 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1186 |
} catch( e ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1187 |
ret = array; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1188 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1189 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1190 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1191 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1192 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1193 |
grep: function( elems, callback, inv ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1194 |
var ret = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1195 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1196 |
// Go through the array, only saving the items |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1197 |
// that pass the validator function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1198 |
for ( var i = 0, length = elems.length; i < length; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1199 |
if ( !inv != !callback( elems[ i ], i ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1200 |
ret.push( elems[ i ] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1201 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1202 |
return ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1203 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1204 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1205 |
map: function( elems, callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1206 |
var ret = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1207 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1208 |
// Go through the array, translating each of the items to their |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1209 |
// new value (or values). |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1210 |
for ( var i = 0, length = elems.length; i < length; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1211 |
var value = callback( elems[ i ], i ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1212 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1213 |
if ( value != null ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1214 |
ret[ ret.length ] = value; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1215 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1216 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1217 |
return ret.concat.apply( [], ret ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1218 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1219 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1220 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1221 |
var userAgent = navigator.userAgent.toLowerCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1222 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1223 |
// Figure out what browser is being used |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1224 |
jQuery.browser = { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1225 |
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1226 |
safari: /webkit/.test( userAgent ), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1227 |
opera: /opera/.test( userAgent ), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1228 |
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1229 |
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1230 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1231 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1232 |
var styleFloat = jQuery.browser.msie ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1233 |
"styleFloat" : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1234 |
"cssFloat"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1235 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1236 |
jQuery.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1237 |
// Check to see if the W3C box model is being used |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1238 |
boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1239 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1240 |
props: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1241 |
"for": "htmlFor", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1242 |
"class": "className", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1243 |
"float": styleFloat, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1244 |
cssFloat: styleFloat, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1245 |
styleFloat: styleFloat, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1246 |
readonly: "readOnly", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1247 |
maxlength: "maxLength", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1248 |
cellspacing: "cellSpacing" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1249 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1250 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1251 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1252 |
jQuery.each({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1253 |
parent: function(elem){return elem.parentNode;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1254 |
parents: function(elem){return jQuery.dir(elem,"parentNode");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1255 |
next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1256 |
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1257 |
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1258 |
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1259 |
siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1260 |
children: function(elem){return jQuery.sibling(elem.firstChild);}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1261 |
contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1262 |
}, function(name, fn){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1263 |
jQuery.fn[ name ] = function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1264 |
var ret = jQuery.map( this, fn ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1265 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1266 |
if ( selector && typeof selector == "string" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1267 |
ret = jQuery.multiFilter( selector, ret ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1268 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1269 |
return this.pushStack( jQuery.unique( ret ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1270 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1271 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1272 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1273 |
jQuery.each({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1274 |
appendTo: "append", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1275 |
prependTo: "prepend", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1276 |
insertBefore: "before", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1277 |
insertAfter: "after", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1278 |
replaceAll: "replaceWith" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1279 |
}, function(name, original){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1280 |
jQuery.fn[ name ] = function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1281 |
var args = arguments; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1282 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1283 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1284 |
for ( var i = 0, length = args.length; i < length; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1285 |
jQuery( args[ i ] )[ original ]( this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1286 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1287 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1288 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1289 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1290 |
jQuery.each({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1291 |
removeAttr: function( name ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1292 |
jQuery.attr( this, name, "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1293 |
if (this.nodeType == 1) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1294 |
this.removeAttribute( name ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1295 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1296 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1297 |
addClass: function( classNames ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1298 |
jQuery.className.add( this, classNames ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1299 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1300 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1301 |
removeClass: function( classNames ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1302 |
jQuery.className.remove( this, classNames ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1303 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1304 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1305 |
toggleClass: function( classNames ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1306 |
jQuery.className[ jQuery.className.has( this, classNames ) ? "remove" : "add" ]( this, classNames ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1307 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1308 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1309 |
remove: function( selector ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1310 |
if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1311 |
// Prevent memory leaks |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1312 |
jQuery( "*", this ).add(this).each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1313 |
jQuery.event.remove(this); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1314 |
jQuery.removeData(this); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1315 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1316 |
if (this.parentNode) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1317 |
this.parentNode.removeChild( this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1318 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1319 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1320 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1321 |
empty: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1322 |
// Remove element nodes and prevent memory leaks |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1323 |
jQuery( ">*", this ).remove(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1324 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1325 |
// Remove any remaining nodes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1326 |
while ( this.firstChild ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1327 |
this.removeChild( this.firstChild ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1328 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1329 |
}, function(name, fn){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1330 |
jQuery.fn[ name ] = function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1331 |
return this.each( fn, arguments ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1332 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1333 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1334 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1335 |
jQuery.each([ "Height", "Width" ], function(i, name){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1336 |
var type = name.toLowerCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1337 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1338 |
jQuery.fn[ type ] = function( size ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1339 |
// Get window width or height |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1340 |
return this[0] == window ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1341 |
// Opera reports document.body.client[Width/Height] properly in both quirks and standards |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1342 |
jQuery.browser.opera && document.body[ "client" + name ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1343 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1344 |
// Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1345 |
jQuery.browser.safari && window[ "inner" + name ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1346 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1347 |
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1348 |
document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1349 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1350 |
// Get document width or height |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1351 |
this[0] == document ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1352 |
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1353 |
Math.max( |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1354 |
Math.max(document.body["scroll" + name], document.documentElement["scroll" + name]), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1355 |
Math.max(document.body["offset" + name], document.documentElement["offset" + name]) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1356 |
) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1357 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1358 |
// Get or set width or height on the element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1359 |
size == undefined ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1360 |
// Get width or height on the element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1361 |
(this.length ? jQuery.css( this[0], type ) : null) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1362 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1363 |
// Set the width or height on the element (default to pixels if value is unitless) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1364 |
this.css( type, size.constructor == String ? size : size + "px" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1365 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1366 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1367 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1368 |
// Helper function used by the dimensions and offset modules |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1369 |
function num(elem, prop) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1370 |
return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1371 |
}var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1372 |
"(?:[\\w*_-]|\\\\.)" : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1373 |
"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1374 |
quickChild = new RegExp("^>\\s*(" + chars + "+)"), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1375 |
quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1376 |
quickClass = new RegExp("^([#.]?)(" + chars + "*)"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1377 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1378 |
jQuery.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1379 |
expr: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1380 |
"": function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1381 |
"#": function(a,i,m){return a.getAttribute("id")==m[2];}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1382 |
":": { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1383 |
// Position Checks |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1384 |
lt: function(a,i,m){return i<m[3]-0;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1385 |
gt: function(a,i,m){return i>m[3]-0;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1386 |
nth: function(a,i,m){return m[3]-0==i;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1387 |
eq: function(a,i,m){return m[3]-0==i;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1388 |
first: function(a,i){return i==0;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1389 |
last: function(a,i,m,r){return i==r.length-1;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1390 |
even: function(a,i){return i%2==0;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1391 |
odd: function(a,i){return i%2;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1392 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1393 |
// Child Checks |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1394 |
"first-child": function(a){return a.parentNode.getElementsByTagName("*")[0]==a;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1395 |
"last-child": function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1396 |
"only-child": function(a){return !jQuery.nth(a.parentNode.lastChild,2,"previousSibling");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1397 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1398 |
// Parent Checks |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1399 |
parent: function(a){return a.firstChild;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1400 |
empty: function(a){return !a.firstChild;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1401 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1402 |
// Text Check |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1403 |
contains: function(a,i,m){return (a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1404 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1405 |
// Visibility |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1406 |
visible: function(a){return "hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1407 |
hidden: function(a){return "hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1408 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1409 |
// Form attributes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1410 |
enabled: function(a){return !a.disabled;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1411 |
disabled: function(a){return a.disabled;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1412 |
checked: function(a){return a.checked;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1413 |
selected: function(a){return a.selected||jQuery.attr(a,"selected");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1414 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1415 |
// Form elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1416 |
text: function(a){return "text"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1417 |
radio: function(a){return "radio"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1418 |
checkbox: function(a){return "checkbox"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1419 |
file: function(a){return "file"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1420 |
password: function(a){return "password"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1421 |
submit: function(a){return "submit"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1422 |
image: function(a){return "image"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1423 |
reset: function(a){return "reset"==a.type;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1424 |
button: function(a){return "button"==a.type||jQuery.nodeName(a,"button");}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1425 |
input: function(a){return /input|select|textarea|button/i.test(a.nodeName);}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1426 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1427 |
// :has() |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1428 |
has: function(a,i,m){return jQuery.find(m[3],a).length;}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1429 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1430 |
// :header |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1431 |
header: function(a){return /h\d/i.test(a.nodeName);}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1432 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1433 |
// :animated |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1434 |
animated: function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1435 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1436 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1437 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1438 |
// The regular expressions that power the parsing engine |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1439 |
parse: [ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1440 |
// Match: [@value='test'], [@foo] |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1441 |
/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1442 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1443 |
// Match: :contains('foo') |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1444 |
/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1445 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1446 |
// Match: :even, :last-child, #id, .class |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1447 |
new RegExp("^([:.#]*)(" + chars + "+)") |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1448 |
], |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1449 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1450 |
multiFilter: function( expr, elems, not ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1451 |
var old, cur = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1452 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1453 |
while ( expr && expr != old ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1454 |
old = expr; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1455 |
var f = jQuery.filter( expr, elems, not ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1456 |
expr = f.t.replace(/^\s*,\s*/, "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1457 |
cur = not ? elems = f.r : jQuery.merge( cur, f.r ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1458 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1459 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1460 |
return cur; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1461 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1462 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1463 |
find: function( t, context ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1464 |
// Quickly handle non-string expressions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1465 |
if ( typeof t != "string" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1466 |
return [ t ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1467 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1468 |
// check to make sure context is a DOM element or a document |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1469 |
if ( context && context.nodeType != 1 && context.nodeType != 9) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1470 |
return [ ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1471 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1472 |
// Set the correct context (if none is provided) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1473 |
context = context || document; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1474 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1475 |
// Initialize the search |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1476 |
var ret = [context], done = [], last, nodeName; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1477 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1478 |
// Continue while a selector expression exists, and while |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1479 |
// we're no longer looping upon ourselves |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1480 |
while ( t && last != t ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1481 |
var r = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1482 |
last = t; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1483 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1484 |
t = jQuery.trim(t); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1485 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1486 |
var foundToken = false, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1487 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1488 |
// An attempt at speeding up child selectors that |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1489 |
// point to a specific element tag |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1490 |
re = quickChild, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1491 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1492 |
m = re.exec(t); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1493 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1494 |
if ( m ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1495 |
nodeName = m[1].toUpperCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1496 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1497 |
// Perform our own iteration and filter |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1498 |
for ( var i = 0; ret[i]; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1499 |
for ( var c = ret[i].firstChild; c; c = c.nextSibling ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1500 |
if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1501 |
r.push( c ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1502 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1503 |
ret = r; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1504 |
t = t.replace( re, "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1505 |
if ( t.indexOf(" ") == 0 ) continue; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1506 |
foundToken = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1507 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1508 |
re = /^([>+~])\s*(\w*)/i; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1509 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1510 |
if ( (m = re.exec(t)) != null ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1511 |
r = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1512 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1513 |
var merge = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1514 |
nodeName = m[2].toUpperCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1515 |
m = m[1]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1516 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1517 |
for ( var j = 0, rl = ret.length; j < rl; j++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1518 |
var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1519 |
for ( ; n; n = n.nextSibling ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1520 |
if ( n.nodeType == 1 ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1521 |
var id = jQuery.data(n); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1522 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1523 |
if ( m == "~" && merge[id] ) break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1524 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1525 |
if (!nodeName || n.nodeName.toUpperCase() == nodeName ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1526 |
if ( m == "~" ) merge[id] = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1527 |
r.push( n ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1528 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1529 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1530 |
if ( m == "+" ) break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1531 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1532 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1533 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1534 |
ret = r; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1535 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1536 |
// And remove the token |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1537 |
t = jQuery.trim( t.replace( re, "" ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1538 |
foundToken = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1539 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1540 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1541 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1542 |
// See if there's still an expression, and that we haven't already |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1543 |
// matched a token |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1544 |
if ( t && !foundToken ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1545 |
// Handle multiple expressions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1546 |
if ( !t.indexOf(",") ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1547 |
// Clean the result set |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1548 |
if ( context == ret[0] ) ret.shift(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1549 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1550 |
// Merge the result sets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1551 |
done = jQuery.merge( done, ret ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1552 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1553 |
// Reset the context |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1554 |
r = ret = [context]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1555 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1556 |
// Touch up the selector string |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1557 |
t = " " + t.substr(1,t.length); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1558 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1559 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1560 |
// Optimize for the case nodeName#idName |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1561 |
var re2 = quickID; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1562 |
var m = re2.exec(t); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1563 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1564 |
// Re-organize the results, so that they're consistent |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1565 |
if ( m ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1566 |
m = [ 0, m[2], m[3], m[1] ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1567 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1568 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1569 |
// Otherwise, do a traditional filter check for |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1570 |
// ID, class, and element selectors |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1571 |
re2 = quickClass; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1572 |
m = re2.exec(t); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1573 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1574 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1575 |
m[2] = m[2].replace(/\\/g, ""); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1576 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1577 |
var elem = ret[ret.length-1]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1578 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1579 |
// Try to do a global search by ID, where we can |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1580 |
if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1581 |
// Optimization for HTML document case |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1582 |
var oid = elem.getElementById(m[2]); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1583 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1584 |
// Do a quick check for the existence of the actual ID attribute |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1585 |
// to avoid selecting by the name attribute in IE |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1586 |
// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1587 |
if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1588 |
oid = jQuery('[@id="'+m[2]+'"]', elem)[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1589 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1590 |
// Do a quick check for node name (where applicable) so |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1591 |
// that div#foo searches will be really fast |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1592 |
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1593 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1594 |
// We need to find all descendant elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1595 |
for ( var i = 0; ret[i]; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1596 |
// Grab the tag name being searched for |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1597 |
var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1598 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1599 |
// Handle IE7 being really dumb about <object>s |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1600 |
if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1601 |
tag = "param"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1602 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1603 |
r = jQuery.merge( r, ret[i].getElementsByTagName( tag )); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1604 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1605 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1606 |
// It's faster to filter by class and be done with it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1607 |
if ( m[1] == "." ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1608 |
r = jQuery.classFilter( r, m[2] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1609 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1610 |
// Same with ID filtering |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1611 |
if ( m[1] == "#" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1612 |
var tmp = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1613 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1614 |
// Try to find the element with the ID |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1615 |
for ( var i = 0; r[i]; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1616 |
if ( r[i].getAttribute("id") == m[2] ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1617 |
tmp = [ r[i] ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1618 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1619 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1620 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1621 |
r = tmp; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1622 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1623 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1624 |
ret = r; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1625 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1626 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1627 |
t = t.replace( re2, "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1628 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1629 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1630 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1631 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1632 |
// If a selector string still exists |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1633 |
if ( t ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1634 |
// Attempt to filter it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1635 |
var val = jQuery.filter(t,r); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1636 |
ret = r = val.r; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1637 |
t = jQuery.trim(val.t); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1638 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1639 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1640 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1641 |
// An error occurred with the selector; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1642 |
// just return an empty set instead |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1643 |
if ( t ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1644 |
ret = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1645 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1646 |
// Remove the root context |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1647 |
if ( ret && context == ret[0] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1648 |
ret.shift(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1649 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1650 |
// And combine the results |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1651 |
done = jQuery.merge( done, ret ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1652 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1653 |
return done; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1654 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1655 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1656 |
classFilter: function(r,m,not){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1657 |
m = " " + m + " "; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1658 |
var tmp = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1659 |
for ( var i = 0; r[i]; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1660 |
var pass = (" " + r[i].className + " ").indexOf( m ) >= 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1661 |
if ( !not && pass || not && !pass ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1662 |
tmp.push( r[i] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1663 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1664 |
return tmp; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1665 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1666 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1667 |
filter: function(t,r,not) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1668 |
var last; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1669 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1670 |
// Look for common filter expressions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1671 |
while ( t && t != last ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1672 |
last = t; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1673 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1674 |
var p = jQuery.parse, m; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1675 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1676 |
for ( var i = 0; p[i]; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1677 |
m = p[i].exec( t ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1678 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1679 |
if ( m ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1680 |
// Remove what we just matched |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1681 |
t = t.substring( m[0].length ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1682 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1683 |
m[2] = m[2].replace(/\\/g, ""); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1684 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1685 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1686 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1687 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1688 |
if ( !m ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1689 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1690 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1691 |
// :not() is a special case that can be optimized by |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1692 |
// keeping it out of the expression list |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1693 |
if ( m[1] == ":" && m[2] == "not" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1694 |
// optimize if only one selector found (most common case) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1695 |
r = isSimple.test( m[3] ) ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1696 |
jQuery.filter(m[3], r, true).r : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1697 |
jQuery( r ).not( m[3] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1698 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1699 |
// We can get a big speed boost by filtering by class here |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1700 |
else if ( m[1] == "." ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1701 |
r = jQuery.classFilter(r, m[2], not); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1702 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1703 |
else if ( m[1] == "[" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1704 |
var tmp = [], type = m[3]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1705 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1706 |
for ( var i = 0, rl = r.length; i < rl; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1707 |
var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1708 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1709 |
if ( z == null || /href|src|selected/.test(m[2]) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1710 |
z = jQuery.attr(a,m[2]) || ''; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1711 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1712 |
if ( (type == "" && !!z || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1713 |
type == "=" && z == m[5] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1714 |
type == "!=" && z != m[5] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1715 |
type == "^=" && z && !z.indexOf(m[5]) || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1716 |
type == "$=" && z.substr(z.length - m[5].length) == m[5] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1717 |
(type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1718 |
tmp.push( a ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1719 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1720 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1721 |
r = tmp; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1722 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1723 |
// We can get a speed boost by handling nth-child here |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1724 |
} else if ( m[1] == ":" && m[2] == "nth-child" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1725 |
var merge = {}, tmp = [], |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1726 |
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1727 |
test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1728 |
m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1729 |
!/\D/.test(m[3]) && "0n+" + m[3] || m[3]), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1730 |
// calculate the numbers (first)n+(last) including if they are negative |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1731 |
first = (test[1] + (test[2] || 1)) - 0, last = test[3] - 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1732 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1733 |
// loop through all the elements left in the jQuery object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1734 |
for ( var i = 0, rl = r.length; i < rl; i++ ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1735 |
var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1736 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1737 |
if ( !merge[id] ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1738 |
var c = 1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1739 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1740 |
for ( var n = parentNode.firstChild; n; n = n.nextSibling ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1741 |
if ( n.nodeType == 1 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1742 |
n.nodeIndex = c++; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1743 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1744 |
merge[id] = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1745 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1746 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1747 |
var add = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1748 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1749 |
if ( first == 0 ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1750 |
if ( node.nodeIndex == last ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1751 |
add = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1752 |
} else if ( (node.nodeIndex - last) % first == 0 && (node.nodeIndex - last) / first >= 0 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1753 |
add = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1754 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1755 |
if ( add ^ not ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1756 |
tmp.push( node ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1757 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1758 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1759 |
r = tmp; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1760 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1761 |
// Otherwise, find the expression to execute |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1762 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1763 |
var fn = jQuery.expr[ m[1] ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1764 |
if ( typeof fn == "object" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1765 |
fn = fn[ m[2] ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1766 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1767 |
if ( typeof fn == "string" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1768 |
fn = eval("false||function(a,i){return " + fn + ";}"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1769 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1770 |
// Execute it against the current filter |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1771 |
r = jQuery.grep( r, function(elem, i){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1772 |
return fn(elem, i, m, r); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1773 |
}, not ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1774 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1775 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1776 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1777 |
// Return an array of filtered elements (r) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1778 |
// and the modified expression string (t) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1779 |
return { r: r, t: t }; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1780 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1781 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1782 |
dir: function( elem, dir ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1783 |
var matched = [], |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1784 |
cur = elem[dir]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1785 |
while ( cur && cur != document ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1786 |
if ( cur.nodeType == 1 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1787 |
matched.push( cur ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1788 |
cur = cur[dir]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1789 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1790 |
return matched; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1791 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1792 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1793 |
nth: function(cur,result,dir,elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1794 |
result = result || 1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1795 |
var num = 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1796 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1797 |
for ( ; cur; cur = cur[dir] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1798 |
if ( cur.nodeType == 1 && ++num == result ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1799 |
break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1800 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1801 |
return cur; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1802 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1803 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1804 |
sibling: function( n, elem ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1805 |
var r = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1806 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1807 |
for ( ; n; n = n.nextSibling ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1808 |
if ( n.nodeType == 1 && n != elem ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1809 |
r.push( n ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1810 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1811 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1812 |
return r; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1813 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1814 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1815 |
/* |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1816 |
* A number of helper functions used for managing events. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1817 |
* Many of the ideas behind this code orignated from |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1818 |
* Dean Edwards' addEvent library. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1819 |
*/ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1820 |
jQuery.event = { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1821 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1822 |
// Bind an event to an element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1823 |
// Original by Dean Edwards |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1824 |
add: function(elem, types, handler, data) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1825 |
if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1826 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1827 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1828 |
// For whatever reason, IE has trouble passing the window object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1829 |
// around, causing it to be cloned in the process |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1830 |
if ( jQuery.browser.msie && elem.setInterval ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1831 |
elem = window; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1832 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1833 |
// Make sure that the function being executed has a unique ID |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1834 |
if ( !handler.guid ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1835 |
handler.guid = this.guid++; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1836 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1837 |
// if data is passed, bind to handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1838 |
if( data != undefined ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1839 |
// Create temporary function pointer to original handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1840 |
var fn = handler; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1841 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1842 |
// Create unique handler function, wrapped around original handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1843 |
handler = this.proxy( fn, function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1844 |
// Pass arguments and context to original handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1845 |
return fn.apply(this, arguments); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1846 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1847 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1848 |
// Store data in unique handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1849 |
handler.data = data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1850 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1851 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1852 |
// Init the element's event structure |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1853 |
var events = jQuery.data(elem, "events") || jQuery.data(elem, "events", {}), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1854 |
handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1855 |
// Handle the second event of a trigger and when |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1856 |
// an event is called after a page has unloaded |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1857 |
if ( typeof jQuery != "undefined" && !jQuery.event.triggered ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1858 |
return jQuery.event.handle.apply(arguments.callee.elem, arguments); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1859 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1860 |
// Add elem as a property of the handle function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1861 |
// This is to prevent a memory leak with non-native |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1862 |
// event in IE. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1863 |
handle.elem = elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1864 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1865 |
// Handle multiple events separated by a space |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1866 |
// jQuery(...).bind("mouseover mouseout", fn); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1867 |
jQuery.each(types.split(/\s+/), function(index, type) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1868 |
// Namespaced event handlers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1869 |
var parts = type.split("."); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1870 |
type = parts[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1871 |
handler.type = parts[1]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1872 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1873 |
// Get the current list of functions bound to this event |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1874 |
var handlers = events[type]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1875 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1876 |
// Init the event handler queue |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1877 |
if (!handlers) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1878 |
handlers = events[type] = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1879 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1880 |
// Check for a special event handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1881 |
// Only use addEventListener/attachEvent if the special |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1882 |
// events handler returns false |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1883 |
if ( !jQuery.event.special[type] || jQuery.event.special[type].setup.call(elem) === false ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1884 |
// Bind the global event handler to the element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1885 |
if (elem.addEventListener) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1886 |
elem.addEventListener(type, handle, false); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1887 |
else if (elem.attachEvent) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1888 |
elem.attachEvent("on" + type, handle); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1889 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1890 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1891 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1892 |
// Add the function to the element's handler list |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1893 |
handlers[handler.guid] = handler; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1894 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1895 |
// Keep track of which events have been used, for global triggering |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1896 |
jQuery.event.global[type] = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1897 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1898 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1899 |
// Nullify elem to prevent memory leaks in IE |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1900 |
elem = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1901 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1902 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1903 |
guid: 1, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1904 |
global: {}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1905 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1906 |
// Detach an event or set of events from an element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1907 |
remove: function(elem, types, handler) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1908 |
// don't do events on text and comment nodes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1909 |
if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1910 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1911 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1912 |
var events = jQuery.data(elem, "events"), ret, index; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1913 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1914 |
if ( events ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1915 |
// Unbind all events for the element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1916 |
if ( types == undefined || (typeof types == "string" && types.charAt(0) == ".") ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1917 |
for ( var type in events ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1918 |
this.remove( elem, type + (types || "") ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1919 |
else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1920 |
// types is actually an event object here |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1921 |
if ( types.type ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1922 |
handler = types.handler; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1923 |
types = types.type; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1924 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1925 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1926 |
// Handle multiple events seperated by a space |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1927 |
// jQuery(...).unbind("mouseover mouseout", fn); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1928 |
jQuery.each(types.split(/\s+/), function(index, type){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1929 |
// Namespaced event handlers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1930 |
var parts = type.split("."); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1931 |
type = parts[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1932 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1933 |
if ( events[type] ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1934 |
// remove the given handler for the given type |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1935 |
if ( handler ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1936 |
delete events[type][handler.guid]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1937 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1938 |
// remove all handlers for the given type |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1939 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1940 |
for ( handler in events[type] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1941 |
// Handle the removal of namespaced events |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1942 |
if ( !parts[1] || events[type][handler].type == parts[1] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1943 |
delete events[type][handler]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1944 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1945 |
// remove generic event handler if no more handlers exist |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1946 |
for ( ret in events[type] ) break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1947 |
if ( !ret ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1948 |
if ( !jQuery.event.special[type] || jQuery.event.special[type].teardown.call(elem) === false ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1949 |
if (elem.removeEventListener) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1950 |
elem.removeEventListener(type, jQuery.data(elem, "handle"), false); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1951 |
else if (elem.detachEvent) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1952 |
elem.detachEvent("on" + type, jQuery.data(elem, "handle")); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1953 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1954 |
ret = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1955 |
delete events[type]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1956 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1957 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1958 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1959 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1960 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1961 |
// Remove the expando if it's no longer used |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1962 |
for ( ret in events ) break; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1963 |
if ( !ret ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1964 |
var handle = jQuery.data( elem, "handle" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1965 |
if ( handle ) handle.elem = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1966 |
jQuery.removeData( elem, "events" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1967 |
jQuery.removeData( elem, "handle" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1968 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1969 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1970 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1971 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1972 |
trigger: function(type, data, elem, donative, extra) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1973 |
// Clone the incoming data, if any |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1974 |
data = jQuery.makeArray(data); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1975 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1976 |
if ( type.indexOf("!") >= 0 ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1977 |
type = type.slice(0, -1); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1978 |
var exclusive = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1979 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1980 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1981 |
// Handle a global trigger |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1982 |
if ( !elem ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1983 |
// Only trigger if we've ever bound an event for it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1984 |
if ( this.global[type] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1985 |
jQuery("*").add([window, document]).trigger(type, data); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1986 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1987 |
// Handle triggering a single element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1988 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1989 |
// don't do events on text and comment nodes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1990 |
if ( elem.nodeType == 3 || elem.nodeType == 8 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1991 |
return undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1992 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1993 |
var val, ret, fn = jQuery.isFunction( elem[ type ] || null ), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1994 |
// Check to see if we need to provide a fake event, or not |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1995 |
event = !data[0] || !data[0].preventDefault; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1996 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1997 |
// Pass along a fake event |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1998 |
if ( event ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
1999 |
data.unshift({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2000 |
type: type, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2001 |
target: elem, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2002 |
preventDefault: function(){}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2003 |
stopPropagation: function(){}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2004 |
timeStamp: now() |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2005 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2006 |
data[0][expando] = true; // no need to fix fake event |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2007 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2008 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2009 |
// Enforce the right trigger type |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2010 |
data[0].type = type; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2011 |
if ( exclusive ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2012 |
data[0].exclusive = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2013 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2014 |
// Trigger the event, it is assumed that "handle" is a function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2015 |
var handle = jQuery.data(elem, "handle"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2016 |
if ( handle ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2017 |
val = handle.apply( elem, data ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2018 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2019 |
// Handle triggering native .onfoo handlers (and on links since we don't call .click() for links) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2020 |
if ( (!fn || (jQuery.nodeName(elem, 'a') && type == "click")) && elem["on"+type] && elem["on"+type].apply( elem, data ) === false ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2021 |
val = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2022 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2023 |
// Extra functions don't get the custom event object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2024 |
if ( event ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2025 |
data.shift(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2026 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2027 |
// Handle triggering of extra function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2028 |
if ( extra && jQuery.isFunction( extra ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2029 |
// call the extra function and tack the current return value on the end for possible inspection |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2030 |
ret = extra.apply( elem, val == null ? data : data.concat( val ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2031 |
// if anything is returned, give it precedence and have it overwrite the previous value |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2032 |
if (ret !== undefined) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2033 |
val = ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2034 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2035 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2036 |
// Trigger the native events (except for clicks on links) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2037 |
if ( fn && donative !== false && val !== false && !(jQuery.nodeName(elem, 'a') && type == "click") ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2038 |
this.triggered = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2039 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2040 |
elem[ type ](); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2041 |
// prevent IE from throwing an error for some hidden elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2042 |
} catch (e) {} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2043 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2044 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2045 |
this.triggered = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2046 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2047 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2048 |
return val; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2049 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2050 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2051 |
handle: function(event) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2052 |
// returned undefined or false |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2053 |
var val, ret, namespace, all, handlers; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2054 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2055 |
event = arguments[0] = jQuery.event.fix( event || window.event ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2056 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2057 |
// Namespaced event handlers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2058 |
namespace = event.type.split("."); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2059 |
event.type = namespace[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2060 |
namespace = namespace[1]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2061 |
// Cache this now, all = true means, any handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2062 |
all = !namespace && !event.exclusive; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2063 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2064 |
handlers = ( jQuery.data(this, "events") || {} )[event.type]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2065 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2066 |
for ( var j in handlers ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2067 |
var handler = handlers[j]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2068 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2069 |
// Filter the functions by class |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2070 |
if ( all || handler.type == namespace ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2071 |
// Pass in a reference to the handler function itself |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2072 |
// So that we can later remove it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2073 |
event.handler = handler; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2074 |
event.data = handler.data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2075 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2076 |
ret = handler.apply( this, arguments ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2077 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2078 |
if ( val !== false ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2079 |
val = ret; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2080 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2081 |
if ( ret === false ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2082 |
event.preventDefault(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2083 |
event.stopPropagation(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2084 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2085 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2086 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2087 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2088 |
return val; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2089 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2090 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2091 |
fix: function(event) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2092 |
if ( event[expando] == true ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2093 |
return event; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2094 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2095 |
// store a copy of the original event object |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2096 |
// and "clone" to set read-only properties |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2097 |
var originalEvent = event; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2098 |
event = { originalEvent: originalEvent }; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2099 |
var props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" "); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2100 |
for ( var i=props.length; i; i-- ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2101 |
event[ props[i] ] = originalEvent[ props[i] ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2102 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2103 |
// Mark it as fixed |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2104 |
event[expando] = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2105 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2106 |
// add preventDefault and stopPropagation since |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2107 |
// they will not work on the clone |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2108 |
event.preventDefault = function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2109 |
// if preventDefault exists run it on the original event |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2110 |
if (originalEvent.preventDefault) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2111 |
originalEvent.preventDefault(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2112 |
// otherwise set the returnValue property of the original event to false (IE) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2113 |
originalEvent.returnValue = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2114 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2115 |
event.stopPropagation = function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2116 |
// if stopPropagation exists run it on the original event |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2117 |
if (originalEvent.stopPropagation) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2118 |
originalEvent.stopPropagation(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2119 |
// otherwise set the cancelBubble property of the original event to true (IE) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2120 |
originalEvent.cancelBubble = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2121 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2122 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2123 |
// Fix timeStamp |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2124 |
event.timeStamp = event.timeStamp || now(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2125 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2126 |
// Fix target property, if necessary |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2127 |
if ( !event.target ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2128 |
event.target = event.srcElement || document; // Fixes #1925 where srcElement might not be defined either |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2129 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2130 |
// check if target is a textnode (safari) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2131 |
if ( event.target.nodeType == 3 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2132 |
event.target = event.target.parentNode; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2133 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2134 |
// Add relatedTarget, if necessary |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2135 |
if ( !event.relatedTarget && event.fromElement ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2136 |
event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2137 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2138 |
// Calculate pageX/Y if missing and clientX/Y available |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2139 |
if ( event.pageX == null && event.clientX != null ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2140 |
var doc = document.documentElement, body = document.body; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2141 |
event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc.clientLeft || 0); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2142 |
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc.clientTop || 0); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2143 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2144 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2145 |
// Add which for key events |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2146 |
if ( !event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2147 |
event.which = event.charCode || event.keyCode; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2148 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2149 |
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2150 |
if ( !event.metaKey && event.ctrlKey ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2151 |
event.metaKey = event.ctrlKey; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2152 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2153 |
// Add which for click: 1 == left; 2 == middle; 3 == right |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2154 |
// Note: button is not normalized, so don't use it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2155 |
if ( !event.which && event.button ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2156 |
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2157 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2158 |
return event; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2159 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2160 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2161 |
proxy: function( fn, proxy ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2162 |
// Set the guid of unique handler to the same of original handler, so it can be removed |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2163 |
proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2164 |
// So proxy can be declared as an argument |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2165 |
return proxy; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2166 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2167 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2168 |
special: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2169 |
ready: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2170 |
setup: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2171 |
// Make sure the ready event is setup |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2172 |
bindReady(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2173 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2174 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2175 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2176 |
teardown: function() { return; } |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2177 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2178 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2179 |
mouseenter: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2180 |
setup: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2181 |
if ( jQuery.browser.msie ) return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2182 |
jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2183 |
return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2184 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2185 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2186 |
teardown: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2187 |
if ( jQuery.browser.msie ) return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2188 |
jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2189 |
return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2190 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2191 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2192 |
handler: function(event) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2193 |
// If we actually just moused on to a sub-element, ignore it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2194 |
if ( withinElement(event, this) ) return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2195 |
// Execute the right handlers by setting the event type to mouseenter |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2196 |
event.type = "mouseenter"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2197 |
return jQuery.event.handle.apply(this, arguments); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2198 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2199 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2200 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2201 |
mouseleave: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2202 |
setup: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2203 |
if ( jQuery.browser.msie ) return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2204 |
jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2205 |
return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2206 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2207 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2208 |
teardown: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2209 |
if ( jQuery.browser.msie ) return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2210 |
jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2211 |
return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2212 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2213 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2214 |
handler: function(event) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2215 |
// If we actually just moused on to a sub-element, ignore it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2216 |
if ( withinElement(event, this) ) return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2217 |
// Execute the right handlers by setting the event type to mouseleave |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2218 |
event.type = "mouseleave"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2219 |
return jQuery.event.handle.apply(this, arguments); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2220 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2221 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2222 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2223 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2224 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2225 |
jQuery.fn.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2226 |
bind: function( type, data, fn ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2227 |
return type == "unload" ? this.one(type, data, fn) : this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2228 |
jQuery.event.add( this, type, fn || data, fn && data ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2229 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2230 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2231 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2232 |
one: function( type, data, fn ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2233 |
var one = jQuery.event.proxy( fn || data, function(event) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2234 |
jQuery(this).unbind(event, one); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2235 |
return (fn || data).apply( this, arguments ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2236 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2237 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2238 |
jQuery.event.add( this, type, one, fn && data); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2239 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2240 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2241 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2242 |
unbind: function( type, fn ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2243 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2244 |
jQuery.event.remove( this, type, fn ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2245 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2246 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2247 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2248 |
trigger: function( type, data, fn ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2249 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2250 |
jQuery.event.trigger( type, data, this, true, fn ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2251 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2252 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2253 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2254 |
triggerHandler: function( type, data, fn ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2255 |
return this[0] && jQuery.event.trigger( type, data, this[0], false, fn ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2256 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2257 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2258 |
toggle: function( fn ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2259 |
// Save reference to arguments for access in closure |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2260 |
var args = arguments, i = 1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2261 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2262 |
// link all the functions, so any of them can unbind this click handler |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2263 |
while( i < args.length ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2264 |
jQuery.event.proxy( fn, args[i++] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2265 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2266 |
return this.click( jQuery.event.proxy( fn, function(event) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2267 |
// Figure out which function to execute |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2268 |
this.lastToggle = ( this.lastToggle || 0 ) % i; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2269 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2270 |
// Make sure that clicks stop |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2271 |
event.preventDefault(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2272 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2273 |
// and execute the function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2274 |
return args[ this.lastToggle++ ].apply( this, arguments ) || false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2275 |
})); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2276 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2277 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2278 |
hover: function(fnOver, fnOut) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2279 |
return this.bind('mouseenter', fnOver).bind('mouseleave', fnOut); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2280 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2281 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2282 |
ready: function(fn) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2283 |
// Attach the listeners |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2284 |
bindReady(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2285 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2286 |
// If the DOM is already ready |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2287 |
if ( jQuery.isReady ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2288 |
// Execute the function immediately |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2289 |
fn.call( document, jQuery ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2290 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2291 |
// Otherwise, remember the function for later |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2292 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2293 |
// Add the function to the wait list |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2294 |
jQuery.readyList.push( function() { return fn.call(this, jQuery); } ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2295 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2296 |
return this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2297 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2298 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2299 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2300 |
jQuery.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2301 |
isReady: false, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2302 |
readyList: [], |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2303 |
// Handle when the DOM is ready |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2304 |
ready: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2305 |
// Make sure that the DOM is not already loaded |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2306 |
if ( !jQuery.isReady ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2307 |
// Remember that the DOM is ready |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2308 |
jQuery.isReady = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2309 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2310 |
// If there are functions bound, to execute |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2311 |
if ( jQuery.readyList ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2312 |
// Execute all of them |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2313 |
jQuery.each( jQuery.readyList, function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2314 |
this.call( document ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2315 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2316 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2317 |
// Reset the list of functions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2318 |
jQuery.readyList = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2319 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2320 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2321 |
// Trigger any bound ready events |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2322 |
jQuery(document).triggerHandler("ready"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2323 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2324 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2325 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2326 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2327 |
var readyBound = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2328 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2329 |
function bindReady(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2330 |
if ( readyBound ) return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2331 |
readyBound = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2332 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2333 |
// Mozilla, Opera (see further below for it) and webkit nightlies currently support this event |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2334 |
if ( document.addEventListener && !jQuery.browser.opera) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2335 |
// Use the handy event callback |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2336 |
document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2337 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2338 |
// If IE is used and is not in a frame |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2339 |
// Continually check to see if the document is ready |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2340 |
if ( jQuery.browser.msie && window == top ) (function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2341 |
if (jQuery.isReady) return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2342 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2343 |
// If IE is used, use the trick by Diego Perini |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2344 |
// http://javascript.nwbox.com/IEContentLoaded/ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2345 |
document.documentElement.doScroll("left"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2346 |
} catch( error ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2347 |
setTimeout( arguments.callee, 0 ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2348 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2349 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2350 |
// and execute any waiting functions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2351 |
jQuery.ready(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2352 |
})(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2353 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2354 |
if ( jQuery.browser.opera ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2355 |
document.addEventListener( "DOMContentLoaded", function () { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2356 |
if (jQuery.isReady) return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2357 |
for (var i = 0; i < document.styleSheets.length; i++) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2358 |
if (document.styleSheets[i].disabled) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2359 |
setTimeout( arguments.callee, 0 ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2360 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2361 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2362 |
// and execute any waiting functions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2363 |
jQuery.ready(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2364 |
}, false); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2365 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2366 |
if ( jQuery.browser.safari ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2367 |
var numStyles; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2368 |
(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2369 |
if (jQuery.isReady) return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2370 |
if ( document.readyState != "loaded" && document.readyState != "complete" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2371 |
setTimeout( arguments.callee, 0 ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2372 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2373 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2374 |
if ( numStyles === undefined ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2375 |
numStyles = jQuery("style, link[rel=stylesheet]").length; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2376 |
if ( document.styleSheets.length != numStyles ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2377 |
setTimeout( arguments.callee, 0 ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2378 |
return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2379 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2380 |
// and execute any waiting functions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2381 |
jQuery.ready(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2382 |
})(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2383 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2384 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2385 |
// A fallback to window.onload, that will always work |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2386 |
jQuery.event.add( window, "load", jQuery.ready ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2387 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2388 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2389 |
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2390 |
"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2391 |
"submit,keydown,keypress,keyup,error").split(","), function(i, name){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2392 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2393 |
// Handle event binding |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2394 |
jQuery.fn[name] = function(fn){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2395 |
return fn ? this.bind(name, fn) : this.trigger(name); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2396 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2397 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2398 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2399 |
// Checks if an event happened on an element within another element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2400 |
// Used in jQuery.event.special.mouseenter and mouseleave handlers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2401 |
var withinElement = function(event, elem) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2402 |
// Check if mouse(over|out) are still within the same parent element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2403 |
var parent = event.relatedTarget; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2404 |
// Traverse up the tree |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2405 |
while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; } |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2406 |
// Return true if we actually just moused on to a sub-element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2407 |
return parent == elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2408 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2409 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2410 |
// Prevent memory leaks in IE |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2411 |
// And prevent errors on refresh with events like mouseover in other browsers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2412 |
// Window isn't included so as not to unbind existing unload events |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2413 |
jQuery(window).bind("unload", function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2414 |
jQuery("*").add(document).unbind(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2415 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2416 |
jQuery.fn.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2417 |
// Keep a copy of the old load |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2418 |
_load: jQuery.fn.load, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2419 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2420 |
load: function( url, params, callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2421 |
if ( typeof url != 'string' ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2422 |
return this._load( url ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2423 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2424 |
var off = url.indexOf(" "); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2425 |
if ( off >= 0 ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2426 |
var selector = url.slice(off, url.length); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2427 |
url = url.slice(0, off); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2428 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2429 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2430 |
callback = callback || function(){}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2431 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2432 |
// Default to a GET request |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2433 |
var type = "GET"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2434 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2435 |
// If the second parameter was provided |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2436 |
if ( params ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2437 |
// If it's a function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2438 |
if ( jQuery.isFunction( params ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2439 |
// We assume that it's the callback |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2440 |
callback = params; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2441 |
params = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2442 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2443 |
// Otherwise, build a param string |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2444 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2445 |
params = jQuery.param( params ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2446 |
type = "POST"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2447 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2448 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2449 |
var self = this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2450 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2451 |
// Request the remote document |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2452 |
jQuery.ajax({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2453 |
url: url, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2454 |
type: type, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2455 |
dataType: "html", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2456 |
data: params, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2457 |
complete: function(res, status){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2458 |
// If successful, inject the HTML into all the matched elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2459 |
if ( status == "success" || status == "notmodified" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2460 |
// See if a selector was specified |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2461 |
self.html( selector ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2462 |
// Create a dummy div to hold the results |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2463 |
jQuery("<div/>") |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2464 |
// inject the contents of the document in, removing the scripts |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2465 |
// to avoid any 'Permission Denied' errors in IE |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2466 |
.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2467 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2468 |
// Locate the specified elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2469 |
.find(selector) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2470 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2471 |
// If not, just inject the full result |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2472 |
res.responseText ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2473 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2474 |
self.each( callback, [res.responseText, status, res] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2475 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2476 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2477 |
return this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2478 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2479 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2480 |
serialize: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2481 |
return jQuery.param(this.serializeArray()); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2482 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2483 |
serializeArray: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2484 |
return this.map(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2485 |
return jQuery.nodeName(this, "form") ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2486 |
jQuery.makeArray(this.elements) : this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2487 |
}) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2488 |
.filter(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2489 |
return this.name && !this.disabled && |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2490 |
(this.checked || /select|textarea/i.test(this.nodeName) || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2491 |
/text|hidden|password/i.test(this.type)); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2492 |
}) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2493 |
.map(function(i, elem){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2494 |
var val = jQuery(this).val(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2495 |
return val == null ? null : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2496 |
val.constructor == Array ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2497 |
jQuery.map( val, function(val, i){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2498 |
return {name: elem.name, value: val}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2499 |
}) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2500 |
{name: elem.name, value: val}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2501 |
}).get(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2502 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2503 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2504 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2505 |
// Attach a bunch of functions for handling common AJAX events |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2506 |
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2507 |
jQuery.fn[o] = function(f){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2508 |
return this.bind(o, f); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2509 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2510 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2511 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2512 |
var jsc = now(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2513 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2514 |
jQuery.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2515 |
get: function( url, data, callback, type ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2516 |
// shift arguments if data argument was ommited |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2517 |
if ( jQuery.isFunction( data ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2518 |
callback = data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2519 |
data = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2520 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2521 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2522 |
return jQuery.ajax({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2523 |
type: "GET", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2524 |
url: url, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2525 |
data: data, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2526 |
success: callback, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2527 |
dataType: type |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2528 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2529 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2530 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2531 |
getScript: function( url, callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2532 |
return jQuery.get(url, null, callback, "script"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2533 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2534 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2535 |
getJSON: function( url, data, callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2536 |
return jQuery.get(url, data, callback, "json"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2537 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2538 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2539 |
post: function( url, data, callback, type ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2540 |
if ( jQuery.isFunction( data ) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2541 |
callback = data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2542 |
data = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2543 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2544 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2545 |
return jQuery.ajax({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2546 |
type: "POST", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2547 |
url: url, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2548 |
data: data, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2549 |
success: callback, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2550 |
dataType: type |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2551 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2552 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2553 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2554 |
ajaxSetup: function( settings ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2555 |
jQuery.extend( jQuery.ajaxSettings, settings ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2556 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2557 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2558 |
ajaxSettings: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2559 |
url: location.href, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2560 |
global: true, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2561 |
type: "GET", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2562 |
timeout: 0, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2563 |
contentType: "application/x-www-form-urlencoded", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2564 |
processData: true, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2565 |
async: true, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2566 |
data: null, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2567 |
username: null, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2568 |
password: null, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2569 |
accepts: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2570 |
xml: "application/xml, text/xml", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2571 |
html: "text/html", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2572 |
script: "text/javascript, application/javascript", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2573 |
json: "application/json, text/javascript", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2574 |
text: "text/plain", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2575 |
_default: "*/*" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2576 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2577 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2578 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2579 |
// Last-Modified header cache for next request |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2580 |
lastModified: {}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2581 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2582 |
ajax: function( s ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2583 |
// Extend the settings, but re-extend 's' so that it can be |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2584 |
// checked again later (in the test suite, specifically) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2585 |
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s)); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2586 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2587 |
var jsonp, jsre = /=\?(&|$)/g, status, data, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2588 |
type = s.type.toUpperCase(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2589 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2590 |
// convert data if not already a string |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2591 |
if ( s.data && s.processData && typeof s.data != "string" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2592 |
s.data = jQuery.param(s.data); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2593 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2594 |
// Handle JSONP Parameter Callbacks |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2595 |
if ( s.dataType == "jsonp" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2596 |
if ( type == "GET" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2597 |
if ( !s.url.match(jsre) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2598 |
s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2599 |
} else if ( !s.data || !s.data.match(jsre) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2600 |
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2601 |
s.dataType = "json"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2602 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2603 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2604 |
// Build temporary JSONP function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2605 |
if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2606 |
jsonp = "jsonp" + jsc++; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2607 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2608 |
// Replace the =? sequence both in the query string and the data |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2609 |
if ( s.data ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2610 |
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2611 |
s.url = s.url.replace(jsre, "=" + jsonp + "$1"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2612 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2613 |
// We need to make sure |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2614 |
// that a JSONP style response is executed properly |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2615 |
s.dataType = "script"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2616 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2617 |
// Handle JSONP-style loading |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2618 |
window[ jsonp ] = function(tmp){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2619 |
data = tmp; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2620 |
success(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2621 |
complete(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2622 |
// Garbage collect |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2623 |
window[ jsonp ] = undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2624 |
try{ delete window[ jsonp ]; } catch(e){} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2625 |
if ( head ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2626 |
head.removeChild( script ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2627 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2628 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2629 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2630 |
if ( s.dataType == "script" && s.cache == null ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2631 |
s.cache = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2632 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2633 |
if ( s.cache === false && type == "GET" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2634 |
var ts = now(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2635 |
// try replacing _= if it is there |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2636 |
var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2637 |
// if nothing was replaced, add timestamp to the end |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2638 |
s.url = ret + ((ret == s.url) ? (s.url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2639 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2640 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2641 |
// If data is available, append data to url for get requests |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2642 |
if ( s.data && type == "GET" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2643 |
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2644 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2645 |
// IE likes to send both get and post data, prevent this |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2646 |
s.data = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2647 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2648 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2649 |
// Watch for a new set of requests |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2650 |
if ( s.global && ! jQuery.active++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2651 |
jQuery.event.trigger( "ajaxStart" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2652 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2653 |
// Matches an absolute URL, and saves the domain |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2654 |
var remote = /^(?:\w+:)?\/\/([^\/?#]+)/; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2655 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2656 |
// If we're requesting a remote document |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2657 |
// and trying to load JSON or Script with a GET |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2658 |
if ( s.dataType == "script" && type == "GET" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2659 |
&& remote.test(s.url) && remote.exec(s.url)[1] != location.host ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2660 |
var head = document.getElementsByTagName("head")[0]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2661 |
var script = document.createElement("script"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2662 |
script.src = s.url; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2663 |
if (s.scriptCharset) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2664 |
script.charset = s.scriptCharset; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2665 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2666 |
// Handle Script loading |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2667 |
if ( !jsonp ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2668 |
var done = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2669 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2670 |
// Attach handlers for all browsers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2671 |
script.onload = script.onreadystatechange = function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2672 |
if ( !done && (!this.readyState || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2673 |
this.readyState == "loaded" || this.readyState == "complete") ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2674 |
done = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2675 |
success(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2676 |
complete(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2677 |
head.removeChild( script ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2678 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2679 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2680 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2681 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2682 |
head.appendChild(script); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2683 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2684 |
// We handle everything using the script element injection |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2685 |
return undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2686 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2687 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2688 |
var requestDone = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2689 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2690 |
// Create the request object; Microsoft failed to properly |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2691 |
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2692 |
var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2693 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2694 |
// Open the socket |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2695 |
// Passing null username, generates a login popup on Opera (#2865) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2696 |
if( s.username ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2697 |
xhr.open(type, s.url, s.async, s.username, s.password); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2698 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2699 |
xhr.open(type, s.url, s.async); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2700 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2701 |
// Need an extra try/catch for cross domain requests in Firefox 3 |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2702 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2703 |
// Set the correct header, if data is being sent |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2704 |
if ( s.data ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2705 |
xhr.setRequestHeader("Content-Type", s.contentType); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2706 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2707 |
// Set the If-Modified-Since header, if ifModified mode. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2708 |
if ( s.ifModified ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2709 |
xhr.setRequestHeader("If-Modified-Since", |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2710 |
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2711 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2712 |
// Set header so the called script knows that it's an XMLHttpRequest |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2713 |
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2714 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2715 |
// Set the Accepts header for the server, depending on the dataType |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2716 |
xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2717 |
s.accepts[ s.dataType ] + ", */*" : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2718 |
s.accepts._default ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2719 |
} catch(e){} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2720 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2721 |
// Allow custom headers/mimetypes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2722 |
if ( s.beforeSend && s.beforeSend(xhr, s) === false ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2723 |
// cleanup active request counter |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2724 |
s.global && jQuery.active--; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2725 |
// close opended socket |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2726 |
xhr.abort(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2727 |
return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2728 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2729 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2730 |
if ( s.global ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2731 |
jQuery.event.trigger("ajaxSend", [xhr, s]); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2732 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2733 |
// Wait for a response to come back |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2734 |
var onreadystatechange = function(isTimeout){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2735 |
// The transfer is complete and the data is available, or the request timed out |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2736 |
if ( !requestDone && xhr && (xhr.readyState == 4 || isTimeout == "timeout") ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2737 |
requestDone = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2738 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2739 |
// clear poll interval |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2740 |
if (ival) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2741 |
clearInterval(ival); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2742 |
ival = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2743 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2744 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2745 |
status = isTimeout == "timeout" && "timeout" || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2746 |
!jQuery.httpSuccess( xhr ) && "error" || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2747 |
s.ifModified && jQuery.httpNotModified( xhr, s.url ) && "notmodified" || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2748 |
"success"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2749 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2750 |
if ( status == "success" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2751 |
// Watch for, and catch, XML document parse errors |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2752 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2753 |
// process the data (runs the xml through httpData regardless of callback) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2754 |
data = jQuery.httpData( xhr, s.dataType, s.dataFilter ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2755 |
} catch(e) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2756 |
status = "parsererror"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2757 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2758 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2759 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2760 |
// Make sure that the request was successful or notmodified |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2761 |
if ( status == "success" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2762 |
// Cache Last-Modified header, if ifModified mode. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2763 |
var modRes; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2764 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2765 |
modRes = xhr.getResponseHeader("Last-Modified"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2766 |
} catch(e) {} // swallow exception thrown by FF if header is not available |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2767 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2768 |
if ( s.ifModified && modRes ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2769 |
jQuery.lastModified[s.url] = modRes; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2770 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2771 |
// JSONP handles its own success callback |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2772 |
if ( !jsonp ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2773 |
success(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2774 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2775 |
jQuery.handleError(s, xhr, status); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2776 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2777 |
// Fire the complete handlers |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2778 |
complete(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2779 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2780 |
// Stop memory leaks |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2781 |
if ( s.async ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2782 |
xhr = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2783 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2784 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2785 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2786 |
if ( s.async ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2787 |
// don't attach the handler to the request, just poll it instead |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2788 |
var ival = setInterval(onreadystatechange, 13); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2789 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2790 |
// Timeout checker |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2791 |
if ( s.timeout > 0 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2792 |
setTimeout(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2793 |
// Check to see if the request is still happening |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2794 |
if ( xhr ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2795 |
// Cancel the request |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2796 |
xhr.abort(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2797 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2798 |
if( !requestDone ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2799 |
onreadystatechange( "timeout" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2800 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2801 |
}, s.timeout); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2802 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2803 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2804 |
// Send the data |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2805 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2806 |
xhr.send(s.data); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2807 |
} catch(e) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2808 |
jQuery.handleError(s, xhr, null, e); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2809 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2810 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2811 |
// firefox 1.5 doesn't fire statechange for sync requests |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2812 |
if ( !s.async ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2813 |
onreadystatechange(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2814 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2815 |
function success(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2816 |
// If a local callback was specified, fire it and pass it the data |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2817 |
if ( s.success ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2818 |
s.success( data, status ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2819 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2820 |
// Fire the global callback |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2821 |
if ( s.global ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2822 |
jQuery.event.trigger( "ajaxSuccess", [xhr, s] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2823 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2824 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2825 |
function complete(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2826 |
// Process result |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2827 |
if ( s.complete ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2828 |
s.complete(xhr, status); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2829 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2830 |
// The request was completed |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2831 |
if ( s.global ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2832 |
jQuery.event.trigger( "ajaxComplete", [xhr, s] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2833 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2834 |
// Handle the global AJAX counter |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2835 |
if ( s.global && ! --jQuery.active ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2836 |
jQuery.event.trigger( "ajaxStop" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2837 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2838 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2839 |
// return XMLHttpRequest to allow aborting the request etc. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2840 |
return xhr; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2841 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2842 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2843 |
handleError: function( s, xhr, status, e ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2844 |
// If a local callback was specified, fire it |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2845 |
if ( s.error ) s.error( xhr, status, e ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2846 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2847 |
// Fire the global callback |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2848 |
if ( s.global ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2849 |
jQuery.event.trigger( "ajaxError", [xhr, s, e] ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2850 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2851 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2852 |
// Counter for holding the number of active queries |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2853 |
active: 0, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2854 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2855 |
// Determines if an XMLHttpRequest was successful or not |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2856 |
httpSuccess: function( xhr ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2857 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2858 |
// IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2859 |
return !xhr.status && location.protocol == "file:" || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2860 |
( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2861 |
jQuery.browser.safari && xhr.status == undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2862 |
} catch(e){} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2863 |
return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2864 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2865 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2866 |
// Determines if an XMLHttpRequest returns NotModified |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2867 |
httpNotModified: function( xhr, url ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2868 |
try { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2869 |
var xhrRes = xhr.getResponseHeader("Last-Modified"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2870 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2871 |
// Firefox always returns 200. check Last-Modified date |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2872 |
return xhr.status == 304 || xhrRes == jQuery.lastModified[url] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2873 |
jQuery.browser.safari && xhr.status == undefined; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2874 |
} catch(e){} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2875 |
return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2876 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2877 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2878 |
httpData: function( xhr, type, filter ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2879 |
var ct = xhr.getResponseHeader("content-type"), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2880 |
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2881 |
data = xml ? xhr.responseXML : xhr.responseText; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2882 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2883 |
if ( xml && data.documentElement.tagName == "parsererror" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2884 |
throw "parsererror"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2885 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2886 |
// Allow a pre-filtering function to sanitize the response |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2887 |
if( filter ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2888 |
data = filter( data, type ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2889 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2890 |
// If the type is "script", eval it in global context |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2891 |
if ( type == "script" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2892 |
jQuery.globalEval( data ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2893 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2894 |
// Get the JavaScript object, if JSON is used. |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2895 |
if ( type == "json" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2896 |
data = eval("(" + data + ")"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2897 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2898 |
return data; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2899 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2900 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2901 |
// Serialize an array of form elements or a set of |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2902 |
// key/values into a query string |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2903 |
param: function( a ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2904 |
var s = []; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2905 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2906 |
// If an array was passed in, assume that it is an array |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2907 |
// of form elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2908 |
if ( a.constructor == Array || a.jquery ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2909 |
// Serialize the form elements |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2910 |
jQuery.each( a, function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2911 |
s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2912 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2913 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2914 |
// Otherwise, assume that it's an object of key/value pairs |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2915 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2916 |
// Serialize the key/values |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2917 |
for ( var j in a ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2918 |
// If the value is an array then the key names need to be repeated |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2919 |
if ( a[j] && a[j].constructor == Array ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2920 |
jQuery.each( a[j], function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2921 |
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2922 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2923 |
else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2924 |
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( jQuery.isFunction(a[j]) ? a[j]() : a[j] ) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2925 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2926 |
// Return the resulting serialization |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2927 |
return s.join("&").replace(/%20/g, "+"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2928 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2929 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2930 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2931 |
jQuery.fn.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2932 |
show: function(speed,callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2933 |
return speed ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2934 |
this.animate({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2935 |
height: "show", width: "show", opacity: "show" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2936 |
}, speed, callback) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2937 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2938 |
this.filter(":hidden").each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2939 |
this.style.display = this.oldblock || ""; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2940 |
if ( jQuery.css(this,"display") == "none" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2941 |
var elem = jQuery("<" + this.tagName + " />").appendTo("body"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2942 |
this.style.display = elem.css("display"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2943 |
// handle an edge condition where css is - div { display:none; } or similar |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2944 |
if (this.style.display == "none") |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2945 |
this.style.display = "block"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2946 |
elem.remove(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2947 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2948 |
}).end(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2949 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2950 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2951 |
hide: function(speed,callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2952 |
return speed ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2953 |
this.animate({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2954 |
height: "hide", width: "hide", opacity: "hide" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2955 |
}, speed, callback) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2956 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2957 |
this.filter(":visible").each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2958 |
this.oldblock = this.oldblock || jQuery.css(this,"display"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2959 |
this.style.display = "none"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2960 |
}).end(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2961 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2962 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2963 |
// Save the old toggle function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2964 |
_toggle: jQuery.fn.toggle, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2965 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2966 |
toggle: function( fn, fn2 ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2967 |
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2968 |
this._toggle.apply( this, arguments ) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2969 |
fn ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2970 |
this.animate({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2971 |
height: "toggle", width: "toggle", opacity: "toggle" |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2972 |
}, fn, fn2) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2973 |
this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2974 |
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2975 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2976 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2977 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2978 |
slideDown: function(speed,callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2979 |
return this.animate({height: "show"}, speed, callback); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2980 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2981 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2982 |
slideUp: function(speed,callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2983 |
return this.animate({height: "hide"}, speed, callback); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2984 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2985 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2986 |
slideToggle: function(speed, callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2987 |
return this.animate({height: "toggle"}, speed, callback); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2988 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2989 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2990 |
fadeIn: function(speed, callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2991 |
return this.animate({opacity: "show"}, speed, callback); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2992 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2993 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2994 |
fadeOut: function(speed, callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2995 |
return this.animate({opacity: "hide"}, speed, callback); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2996 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2997 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2998 |
fadeTo: function(speed,to,callback){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
2999 |
return this.animate({opacity: to}, speed, callback); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3000 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3001 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3002 |
animate: function( prop, speed, easing, callback ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3003 |
var optall = jQuery.speed(speed, easing, callback); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3004 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3005 |
return this[ optall.queue === false ? "each" : "queue" ](function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3006 |
if ( this.nodeType != 1) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3007 |
return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3008 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3009 |
var opt = jQuery.extend({}, optall), p, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3010 |
hidden = jQuery(this).is(":hidden"), self = this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3011 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3012 |
for ( p in prop ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3013 |
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3014 |
return opt.complete.call(this); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3015 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3016 |
if ( p == "height" || p == "width" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3017 |
// Store display property |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3018 |
opt.display = jQuery.css(this, "display"); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3019 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3020 |
// Make sure that nothing sneaks out |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3021 |
opt.overflow = this.style.overflow; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3022 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3023 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3024 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3025 |
if ( opt.overflow != null ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3026 |
this.style.overflow = "hidden"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3027 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3028 |
opt.curAnim = jQuery.extend({}, prop); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3029 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3030 |
jQuery.each( prop, function(name, val){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3031 |
var e = new jQuery.fx( self, opt, name ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3032 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3033 |
if ( /toggle|show|hide/.test(val) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3034 |
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3035 |
else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3036 |
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3037 |
start = e.cur(true) || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3038 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3039 |
if ( parts ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3040 |
var end = parseFloat(parts[2]), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3041 |
unit = parts[3] || "px"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3042 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3043 |
// We need to compute starting value |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3044 |
if ( unit != "px" ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3045 |
self.style[ name ] = (end || 1) + unit; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3046 |
start = ((end || 1) / e.cur(true)) * start; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3047 |
self.style[ name ] = start + unit; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3048 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3049 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3050 |
// If a +=/-= token was provided, we're doing a relative animation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3051 |
if ( parts[1] ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3052 |
end = ((parts[1] == "-=" ? -1 : 1) * end) + start; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3053 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3054 |
e.custom( start, end, unit ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3055 |
} else |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3056 |
e.custom( start, val, "" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3057 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3058 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3059 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3060 |
// For JS strict compliance |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3061 |
return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3062 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3063 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3064 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3065 |
queue: function(type, fn){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3066 |
if ( jQuery.isFunction(type) || ( type && type.constructor == Array )) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3067 |
fn = type; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3068 |
type = "fx"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3069 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3070 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3071 |
if ( !type || (typeof type == "string" && !fn) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3072 |
return queue( this[0], type ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3073 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3074 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3075 |
if ( fn.constructor == Array ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3076 |
queue(this, type, fn); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3077 |
else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3078 |
queue(this, type).push( fn ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3079 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3080 |
if ( queue(this, type).length == 1 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3081 |
fn.call(this); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3082 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3083 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3084 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3085 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3086 |
stop: function(clearQueue, gotoEnd){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3087 |
var timers = jQuery.timers; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3088 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3089 |
if (clearQueue) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3090 |
this.queue([]); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3091 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3092 |
this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3093 |
// go in reverse order so anything added to the queue during the loop is ignored |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3094 |
for ( var i = timers.length - 1; i >= 0; i-- ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3095 |
if ( timers[i].elem == this ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3096 |
if (gotoEnd) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3097 |
// force the next step to be the last |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3098 |
timers[i](true); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3099 |
timers.splice(i, 1); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3100 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3101 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3102 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3103 |
// start the next in the queue if the last step wasn't forced |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3104 |
if (!gotoEnd) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3105 |
this.dequeue(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3106 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3107 |
return this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3108 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3109 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3110 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3111 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3112 |
var queue = function( elem, type, array ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3113 |
if ( elem ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3114 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3115 |
type = type || "fx"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3116 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3117 |
var q = jQuery.data( elem, type + "queue" ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3118 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3119 |
if ( !q || array ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3120 |
q = jQuery.data( elem, type + "queue", jQuery.makeArray(array) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3121 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3122 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3123 |
return q; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3124 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3125 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3126 |
jQuery.fn.dequeue = function(type){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3127 |
type = type || "fx"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3128 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3129 |
return this.each(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3130 |
var q = queue(this, type); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3131 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3132 |
q.shift(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3133 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3134 |
if ( q.length ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3135 |
q[0].call( this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3136 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3137 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3138 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3139 |
jQuery.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3140 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3141 |
speed: function(speed, easing, fn) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3142 |
var opt = speed && speed.constructor == Object ? speed : { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3143 |
complete: fn || !fn && easing || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3144 |
jQuery.isFunction( speed ) && speed, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3145 |
duration: speed, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3146 |
easing: fn && easing || easing && easing.constructor != Function && easing |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3147 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3148 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3149 |
opt.duration = (opt.duration && opt.duration.constructor == Number ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3150 |
opt.duration : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3151 |
jQuery.fx.speeds[opt.duration]) || jQuery.fx.speeds.def; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3152 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3153 |
// Queueing |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3154 |
opt.old = opt.complete; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3155 |
opt.complete = function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3156 |
if ( opt.queue !== false ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3157 |
jQuery(this).dequeue(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3158 |
if ( jQuery.isFunction( opt.old ) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3159 |
opt.old.call( this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3160 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3161 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3162 |
return opt; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3163 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3164 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3165 |
easing: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3166 |
linear: function( p, n, firstNum, diff ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3167 |
return firstNum + diff * p; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3168 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3169 |
swing: function( p, n, firstNum, diff ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3170 |
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3171 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3172 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3173 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3174 |
timers: [], |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3175 |
timerId: null, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3176 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3177 |
fx: function( elem, options, prop ){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3178 |
this.options = options; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3179 |
this.elem = elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3180 |
this.prop = prop; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3181 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3182 |
if ( !options.orig ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3183 |
options.orig = {}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3184 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3185 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3186 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3187 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3188 |
jQuery.fx.prototype = { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3189 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3190 |
// Simple function for setting a style value |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3191 |
update: function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3192 |
if ( this.options.step ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3193 |
this.options.step.call( this.elem, this.now, this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3194 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3195 |
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3196 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3197 |
// Set display property to block for height/width animations |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3198 |
if ( this.prop == "height" || this.prop == "width" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3199 |
this.elem.style.display = "block"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3200 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3201 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3202 |
// Get the current size |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3203 |
cur: function(force){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3204 |
if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3205 |
return this.elem[ this.prop ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3206 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3207 |
var r = parseFloat(jQuery.css(this.elem, this.prop, force)); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3208 |
return r && r > -10000 ? r : parseFloat(jQuery.curCSS(this.elem, this.prop)) || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3209 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3210 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3211 |
// Start an animation from one number to another |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3212 |
custom: function(from, to, unit){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3213 |
this.startTime = now(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3214 |
this.start = from; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3215 |
this.end = to; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3216 |
this.unit = unit || this.unit || "px"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3217 |
this.now = this.start; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3218 |
this.pos = this.state = 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3219 |
this.update(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3220 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3221 |
var self = this; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3222 |
function t(gotoEnd){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3223 |
return self.step(gotoEnd); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3224 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3225 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3226 |
t.elem = this.elem; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3227 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3228 |
jQuery.timers.push(t); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3229 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3230 |
if ( jQuery.timerId == null ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3231 |
jQuery.timerId = setInterval(function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3232 |
var timers = jQuery.timers; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3233 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3234 |
for ( var i = 0; i < timers.length; i++ ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3235 |
if ( !timers[i]() ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3236 |
timers.splice(i--, 1); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3237 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3238 |
if ( !timers.length ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3239 |
clearInterval( jQuery.timerId ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3240 |
jQuery.timerId = null; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3241 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3242 |
}, 13); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3243 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3244 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3245 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3246 |
// Simple 'show' function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3247 |
show: function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3248 |
// Remember where we started, so that we can go back to it later |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3249 |
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3250 |
this.options.show = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3251 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3252 |
// Begin the animation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3253 |
this.custom(0, this.cur()); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3254 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3255 |
// Make sure that we start at a small width/height to avoid any |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3256 |
// flash of content |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3257 |
if ( this.prop == "width" || this.prop == "height" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3258 |
this.elem.style[this.prop] = "1px"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3259 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3260 |
// Start by showing the element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3261 |
jQuery(this.elem).show(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3262 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3263 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3264 |
// Simple 'hide' function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3265 |
hide: function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3266 |
// Remember where we started, so that we can go back to it later |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3267 |
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3268 |
this.options.hide = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3269 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3270 |
// Begin the animation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3271 |
this.custom(this.cur(), 0); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3272 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3273 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3274 |
// Each step of an animation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3275 |
step: function(gotoEnd){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3276 |
var t = now(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3277 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3278 |
if ( gotoEnd || t > this.options.duration + this.startTime ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3279 |
this.now = this.end; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3280 |
this.pos = this.state = 1; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3281 |
this.update(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3282 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3283 |
this.options.curAnim[ this.prop ] = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3284 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3285 |
var done = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3286 |
for ( var i in this.options.curAnim ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3287 |
if ( this.options.curAnim[i] !== true ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3288 |
done = false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3289 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3290 |
if ( done ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3291 |
if ( this.options.display != null ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3292 |
// Reset the overflow |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3293 |
this.elem.style.overflow = this.options.overflow; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3294 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3295 |
// Reset the display |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3296 |
this.elem.style.display = this.options.display; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3297 |
if ( jQuery.css(this.elem, "display") == "none" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3298 |
this.elem.style.display = "block"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3299 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3300 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3301 |
// Hide the element if the "hide" operation was done |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3302 |
if ( this.options.hide ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3303 |
this.elem.style.display = "none"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3304 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3305 |
// Reset the properties, if the item has been hidden or shown |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3306 |
if ( this.options.hide || this.options.show ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3307 |
for ( var p in this.options.curAnim ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3308 |
jQuery.attr(this.elem.style, p, this.options.orig[p]); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3309 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3310 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3311 |
if ( done ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3312 |
// Execute the complete function |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3313 |
this.options.complete.call( this.elem ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3314 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3315 |
return false; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3316 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3317 |
var n = t - this.startTime; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3318 |
this.state = n / this.options.duration; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3319 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3320 |
// Perform the easing function, defaults to swing |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3321 |
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3322 |
this.now = this.start + ((this.end - this.start) * this.pos); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3323 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3324 |
// Perform the next step of the animation |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3325 |
this.update(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3326 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3327 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3328 |
return true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3329 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3330 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3331 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3332 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3333 |
jQuery.extend( jQuery.fx, { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3334 |
speeds:{ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3335 |
slow: 600, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3336 |
fast: 200, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3337 |
// Default speed |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3338 |
def: 400 |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3339 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3340 |
step: { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3341 |
scrollLeft: function(fx){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3342 |
fx.elem.scrollLeft = fx.now; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3343 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3344 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3345 |
scrollTop: function(fx){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3346 |
fx.elem.scrollTop = fx.now; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3347 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3348 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3349 |
opacity: function(fx){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3350 |
jQuery.attr(fx.elem.style, "opacity", fx.now); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3351 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3352 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3353 |
_default: function(fx){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3354 |
fx.elem.style[ fx.prop ] = fx.now + fx.unit; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3355 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3356 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3357 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3358 |
// The Offset Method |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3359 |
// Originally By Brandon Aaron, part of the Dimension Plugin |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3360 |
// http://jquery.com/plugins/project/dimensions |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3361 |
jQuery.fn.offset = function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3362 |
var left = 0, top = 0, elem = this[0], results; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3363 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3364 |
if ( elem ) with ( jQuery.browser ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3365 |
var parent = elem.parentNode, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3366 |
offsetChild = elem, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3367 |
offsetParent = elem.offsetParent, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3368 |
doc = elem.ownerDocument, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3369 |
safari2 = safari && parseInt(version) < 522 && !/adobeair/i.test(userAgent), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3370 |
css = jQuery.curCSS, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3371 |
fixed = css(elem, "position") == "fixed"; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3372 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3373 |
// Use getBoundingClientRect if available |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3374 |
if ( elem.getBoundingClientRect ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3375 |
var box = elem.getBoundingClientRect(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3376 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3377 |
// Add the document scroll offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3378 |
add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3379 |
box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3380 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3381 |
// IE adds the HTML element's border, by default it is medium which is 2px |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3382 |
// IE 6 and 7 quirks mode the border width is overwritable by the following css html { border: 0; } |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3383 |
// IE 7 standards mode, the border is always 2px |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3384 |
// This border/offset is typically represented by the clientLeft and clientTop properties |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3385 |
// However, in IE6 and 7 quirks mode the clientLeft and clientTop properties are not updated when overwriting it via CSS |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3386 |
// Therefore this method will be off by 2px in IE while in quirksmode |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3387 |
add( -doc.documentElement.clientLeft, -doc.documentElement.clientTop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3388 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3389 |
// Otherwise loop through the offsetParents and parentNodes |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3390 |
} else { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3391 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3392 |
// Initial element offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3393 |
add( elem.offsetLeft, elem.offsetTop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3394 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3395 |
// Get parent offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3396 |
while ( offsetParent ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3397 |
// Add offsetParent offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3398 |
add( offsetParent.offsetLeft, offsetParent.offsetTop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3399 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3400 |
// Mozilla and Safari > 2 does not include the border on offset parents |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3401 |
// However Mozilla adds the border for table or table cells |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3402 |
if ( mozilla && !/^t(able|d|h)$/i.test(offsetParent.tagName) || safari && !safari2 ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3403 |
border( offsetParent ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3404 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3405 |
// Add the document scroll offsets if position is fixed on any offsetParent |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3406 |
if ( !fixed && css(offsetParent, "position") == "fixed" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3407 |
fixed = true; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3408 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3409 |
// Set offsetChild to previous offsetParent unless it is the body element |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3410 |
offsetChild = /^body$/i.test(offsetParent.tagName) ? offsetChild : offsetParent; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3411 |
// Get next offsetParent |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3412 |
offsetParent = offsetParent.offsetParent; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3413 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3414 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3415 |
// Get parent scroll offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3416 |
while ( parent && parent.tagName && !/^body|html$/i.test(parent.tagName) ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3417 |
// Remove parent scroll UNLESS that parent is inline or a table to work around Opera inline/table scrollLeft/Top bug |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3418 |
if ( !/^inline|table.*$/i.test(css(parent, "display")) ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3419 |
// Subtract parent scroll offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3420 |
add( -parent.scrollLeft, -parent.scrollTop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3421 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3422 |
// Mozilla does not add the border for a parent that has overflow != visible |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3423 |
if ( mozilla && css(parent, "overflow") != "visible" ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3424 |
border( parent ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3425 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3426 |
// Get next parent |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3427 |
parent = parent.parentNode; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3428 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3429 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3430 |
// Safari <= 2 doubles body offsets with a fixed position element/offsetParent or absolutely positioned offsetChild |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3431 |
// Mozilla doubles body offsets with a non-absolutely positioned offsetChild |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3432 |
if ( (safari2 && (fixed || css(offsetChild, "position") == "absolute")) || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3433 |
(mozilla && css(offsetChild, "position") != "absolute") ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3434 |
add( -doc.body.offsetLeft, -doc.body.offsetTop ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3435 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3436 |
// Add the document scroll offsets if position is fixed |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3437 |
if ( fixed ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3438 |
add(Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3439 |
Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3440 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3441 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3442 |
// Return an object with top and left properties |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3443 |
results = { top: top, left: left }; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3444 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3445 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3446 |
function border(elem) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3447 |
add( jQuery.curCSS(elem, "borderLeftWidth", true), jQuery.curCSS(elem, "borderTopWidth", true) ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3448 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3449 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3450 |
function add(l, t) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3451 |
left += parseInt(l, 10) || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3452 |
top += parseInt(t, 10) || 0; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3453 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3454 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3455 |
return results; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3456 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3457 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3458 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3459 |
jQuery.fn.extend({ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3460 |
position: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3461 |
var left = 0, top = 0, results; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3462 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3463 |
if ( this[0] ) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3464 |
// Get *real* offsetParent |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3465 |
var offsetParent = this.offsetParent(), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3466 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3467 |
// Get correct offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3468 |
offset = this.offset(), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3469 |
parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3470 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3471 |
// Subtract element margins |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3472 |
// note: when an element has margin: auto the offsetLeft and marginLeft |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3473 |
// are the same in Safari causing offset.left to incorrectly be 0 |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3474 |
offset.top -= num( this, 'marginTop' ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3475 |
offset.left -= num( this, 'marginLeft' ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3476 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3477 |
// Add offsetParent borders |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3478 |
parentOffset.top += num( offsetParent, 'borderTopWidth' ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3479 |
parentOffset.left += num( offsetParent, 'borderLeftWidth' ); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3480 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3481 |
// Subtract the two offsets |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3482 |
results = { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3483 |
top: offset.top - parentOffset.top, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3484 |
left: offset.left - parentOffset.left |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3485 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3486 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3487 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3488 |
return results; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3489 |
}, |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3490 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3491 |
offsetParent: function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3492 |
var offsetParent = this[0].offsetParent; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3493 |
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, 'position') == 'static') ) |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3494 |
offsetParent = offsetParent.offsetParent; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3495 |
return jQuery(offsetParent); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3496 |
} |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3497 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3498 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3499 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3500 |
// Create scrollLeft and scrollTop methods |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3501 |
jQuery.each( ['Left', 'Top'], function(i, name) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3502 |
var method = 'scroll' + name; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3503 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3504 |
jQuery.fn[ method ] = function(val) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3505 |
if (!this[0]) return; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3506 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3507 |
return val != undefined ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3508 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3509 |
// Set the scroll offset |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3510 |
this.each(function() { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3511 |
this == window || this == document ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3512 |
window.scrollTo( |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3513 |
!i ? val : jQuery(window).scrollLeft(), |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3514 |
i ? val : jQuery(window).scrollTop() |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3515 |
) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3516 |
this[ method ] = val; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3517 |
}) : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3518 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3519 |
// Return the scroll offset |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3520 |
this[0] == window || this[0] == document ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3521 |
self[ i ? 'pageYOffset' : 'pageXOffset' ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3522 |
jQuery.boxModel && document.documentElement[ method ] || |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3523 |
document.body[ method ] : |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3524 |
this[0][ method ]; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3525 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3526 |
}); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3527 |
// Create innerHeight, innerWidth, outerHeight and outerWidth methods |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3528 |
jQuery.each([ "Height", "Width" ], function(i, name){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3529 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3530 |
var tl = i ? "Left" : "Top", // top or left |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3531 |
br = i ? "Right" : "Bottom"; // bottom or right |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3532 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3533 |
// innerHeight and innerWidth |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3534 |
jQuery.fn["inner" + name] = function(){ |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3535 |
return this[ name.toLowerCase() ]() + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3536 |
num(this, "padding" + tl) + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3537 |
num(this, "padding" + br); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3538 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3539 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3540 |
// outerHeight and outerWidth |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3541 |
jQuery.fn["outer" + name] = function(margin) { |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3542 |
return this["inner" + name]() + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3543 |
num(this, "border" + tl + "Width") + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3544 |
num(this, "border" + br + "Width") + |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3545 |
(margin ? |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3546 |
num(this, "margin" + tl) + num(this, "margin" + br) : 0); |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3547 |
}; |
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3548 |
|
a619b3ef3095
Bug 2482 - Store previewer user information in workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
273
diff
changeset
|
3549 |
});})(); |