author | Mahlon E. Smith <mahlon@martini.nu> |
Mon, 09 Feb 2015 09:20:01 -0800 | |
changeset 0 | 52d30e6014a0 |
permissions | -rw-r--r-- |
0
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1 |
/*! |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2 |
* jQuery JavaScript Library v2.1.1 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3 |
* http://jquery.com/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5 |
* Includes Sizzle.js |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6 |
* http://sizzlejs.com/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8 |
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9 |
* Released under the MIT license |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
10 |
* http://jquery.org/license |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
11 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
12 |
* Date: 2014-05-01T17:11Z |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
13 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
14 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
15 |
(function( global, factory ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
16 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
17 |
if ( typeof module === "object" && typeof module.exports === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
18 |
// For CommonJS and CommonJS-like environments where a proper window is present, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
19 |
// execute the factory and get jQuery |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
20 |
// For environments that do not inherently posses a window with a document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
21 |
// (such as Node.js), expose a jQuery-making factory as module.exports |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
22 |
// This accentuates the need for the creation of a real window |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
23 |
// e.g. var jQuery = require("jquery")(window); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
24 |
// See ticket #14549 for more info |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
25 |
module.exports = global.document ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
26 |
factory( global, true ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
27 |
function( w ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
28 |
if ( !w.document ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
29 |
throw new Error( "jQuery requires a window with a document" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
30 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
31 |
return factory( w ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
32 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
33 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
34 |
factory( global ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
35 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
36 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
37 |
// Pass this if window is not defined yet |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
38 |
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
39 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
40 |
// Can't do this because several apps including ASP.NET trace |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
41 |
// the stack via arguments.caller.callee and Firefox dies if |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
42 |
// you try to trace through "use strict" call chains. (#13335) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
43 |
// Support: Firefox 18+ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
44 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
45 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
46 |
var arr = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
47 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
48 |
var slice = arr.slice; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
49 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
50 |
var concat = arr.concat; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
51 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
52 |
var push = arr.push; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
53 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
54 |
var indexOf = arr.indexOf; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
55 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
56 |
var class2type = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
57 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
58 |
var toString = class2type.toString; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
59 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
60 |
var hasOwn = class2type.hasOwnProperty; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
61 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
62 |
var support = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
63 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
64 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
65 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
66 |
var |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
67 |
// Use the correct document accordingly with window argument (sandbox) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
68 |
document = window.document, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
69 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
70 |
version = "2.1.1", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
71 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
72 |
// Define a local copy of jQuery |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
73 |
jQuery = function( selector, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
74 |
// The jQuery object is actually just the init constructor 'enhanced' |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
75 |
// Need init if jQuery is called (just allow error to be thrown if not included) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
76 |
return new jQuery.fn.init( selector, context ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
77 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
78 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
79 |
// Support: Android<4.1 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
80 |
// Make sure we trim BOM and NBSP |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
81 |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
82 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
83 |
// Matches dashed string for camelizing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
84 |
rmsPrefix = /^-ms-/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
85 |
rdashAlpha = /-([\da-z])/gi, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
86 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
87 |
// Used by jQuery.camelCase as callback to replace() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
88 |
fcamelCase = function( all, letter ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
89 |
return letter.toUpperCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
90 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
91 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
92 |
jQuery.fn = jQuery.prototype = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
93 |
// The current version of jQuery being used |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
94 |
jquery: version, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
95 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
96 |
constructor: jQuery, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
97 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
98 |
// Start with an empty selector |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
99 |
selector: "", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
100 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
101 |
// The default length of a jQuery object is 0 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
102 |
length: 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
103 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
104 |
toArray: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
105 |
return slice.call( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
106 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
107 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
108 |
// Get the Nth element in the matched element set OR |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
109 |
// Get the whole matched element set as a clean array |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
110 |
get: function( num ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
111 |
return num != null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
112 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
113 |
// Return just the one element from the set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
114 |
( num < 0 ? this[ num + this.length ] : this[ num ] ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
115 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
116 |
// Return all the elements in a clean array |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
117 |
slice.call( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
118 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
119 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
120 |
// Take an array of elements and push it onto the stack |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
121 |
// (returning the new matched element set) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
122 |
pushStack: function( elems ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
123 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
124 |
// Build a new jQuery matched element set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
125 |
var ret = jQuery.merge( this.constructor(), elems ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
126 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
127 |
// Add the old object onto the stack (as a reference) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
128 |
ret.prevObject = this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
129 |
ret.context = this.context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
130 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
131 |
// Return the newly-formed element set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
132 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
133 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
134 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
135 |
// Execute a callback for every element in the matched set. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
136 |
// (You can seed the arguments with an array of args, but this is |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
137 |
// only used internally.) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
138 |
each: function( callback, args ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
139 |
return jQuery.each( this, callback, args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
140 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
141 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
142 |
map: function( callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
143 |
return this.pushStack( jQuery.map(this, function( elem, i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
144 |
return callback.call( elem, i, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
145 |
})); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
146 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
147 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
148 |
slice: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
149 |
return this.pushStack( slice.apply( this, arguments ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
150 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
151 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
152 |
first: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
153 |
return this.eq( 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
154 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
155 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
156 |
last: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
157 |
return this.eq( -1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
158 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
159 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
160 |
eq: function( i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
161 |
var len = this.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
162 |
j = +i + ( i < 0 ? len : 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
163 |
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
164 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
165 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
166 |
end: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
167 |
return this.prevObject || this.constructor(null); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
168 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
169 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
170 |
// For internal use only. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
171 |
// Behaves like an Array's method, not like a jQuery method. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
172 |
push: push, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
173 |
sort: arr.sort, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
174 |
splice: arr.splice |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
175 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
176 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
177 |
jQuery.extend = jQuery.fn.extend = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
178 |
var options, name, src, copy, copyIsArray, clone, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
179 |
target = arguments[0] || {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
180 |
i = 1, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
181 |
length = arguments.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
182 |
deep = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
183 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
184 |
// Handle a deep copy situation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
185 |
if ( typeof target === "boolean" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
186 |
deep = target; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
187 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
188 |
// skip the boolean and the target |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
189 |
target = arguments[ i ] || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
190 |
i++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
191 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
192 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
193 |
// Handle case when target is a string or something (possible in deep copy) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
194 |
if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
195 |
target = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
196 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
197 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
198 |
// extend jQuery itself if only one argument is passed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
199 |
if ( i === length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
200 |
target = this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
201 |
i--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
202 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
203 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
204 |
for ( ; i < length; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
205 |
// Only deal with non-null/undefined values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
206 |
if ( (options = arguments[ i ]) != null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
207 |
// Extend the base object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
208 |
for ( name in options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
209 |
src = target[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
210 |
copy = options[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
211 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
212 |
// Prevent never-ending loop |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
213 |
if ( target === copy ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
214 |
continue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
215 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
216 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
217 |
// Recurse if we're merging plain objects or arrays |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
218 |
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
219 |
if ( copyIsArray ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
220 |
copyIsArray = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
221 |
clone = src && jQuery.isArray(src) ? src : []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
222 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
223 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
224 |
clone = src && jQuery.isPlainObject(src) ? src : {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
225 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
226 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
227 |
// Never move original objects, clone them |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
228 |
target[ name ] = jQuery.extend( deep, clone, copy ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
229 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
230 |
// Don't bring in undefined values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
231 |
} else if ( copy !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
232 |
target[ name ] = copy; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
233 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
234 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
235 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
236 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
237 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
238 |
// Return the modified object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
239 |
return target; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
240 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
241 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
242 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
243 |
// Unique for each copy of jQuery on the page |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
244 |
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
245 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
246 |
// Assume jQuery is ready without the ready module |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
247 |
isReady: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
248 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
249 |
error: function( msg ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
250 |
throw new Error( msg ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
251 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
252 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
253 |
noop: function() {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
254 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
255 |
// See test/unit/core.js for details concerning isFunction. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
256 |
// Since version 1.3, DOM methods and functions like alert |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
257 |
// aren't supported. They return false on IE (#2968). |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
258 |
isFunction: function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
259 |
return jQuery.type(obj) === "function"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
260 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
261 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
262 |
isArray: Array.isArray, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
263 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
264 |
isWindow: function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
265 |
return obj != null && obj === obj.window; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
266 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
267 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
268 |
isNumeric: function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
269 |
// parseFloat NaNs numeric-cast false positives (null|true|false|"") |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
270 |
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
271 |
// subtraction forces infinities to NaN |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
272 |
return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
273 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
274 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
275 |
isPlainObject: function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
276 |
// Not plain objects: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
277 |
// - Any object or value whose internal [[Class]] property is not "[object Object]" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
278 |
// - DOM nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
279 |
// - window |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
280 |
if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
281 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
282 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
283 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
284 |
if ( obj.constructor && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
285 |
!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
286 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
287 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
288 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
289 |
// If the function hasn't returned already, we're confident that |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
290 |
// |obj| is a plain object, created by {} or constructed with new Object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
291 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
292 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
293 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
294 |
isEmptyObject: function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
295 |
var name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
296 |
for ( name in obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
297 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
298 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
299 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
300 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
301 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
302 |
type: function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
303 |
if ( obj == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
304 |
return obj + ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
305 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
306 |
// Support: Android < 4.0, iOS < 6 (functionish RegExp) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
307 |
return typeof obj === "object" || typeof obj === "function" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
308 |
class2type[ toString.call(obj) ] || "object" : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
309 |
typeof obj; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
310 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
311 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
312 |
// Evaluates a script in a global context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
313 |
globalEval: function( code ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
314 |
var script, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
315 |
indirect = eval; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
316 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
317 |
code = jQuery.trim( code ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
318 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
319 |
if ( code ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
320 |
// If the code includes a valid, prologue position |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
321 |
// strict mode pragma, execute code by injecting a |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
322 |
// script tag into the document. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
323 |
if ( code.indexOf("use strict") === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
324 |
script = document.createElement("script"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
325 |
script.text = code; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
326 |
document.head.appendChild( script ).parentNode.removeChild( script ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
327 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
328 |
// Otherwise, avoid the DOM node creation, insertion |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
329 |
// and removal by using an indirect global eval |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
330 |
indirect( code ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
331 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
332 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
333 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
334 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
335 |
// Convert dashed to camelCase; used by the css and data modules |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
336 |
// Microsoft forgot to hump their vendor prefix (#9572) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
337 |
camelCase: function( string ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
338 |
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
339 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
340 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
341 |
nodeName: function( elem, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
342 |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
343 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
344 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
345 |
// args is for internal usage only |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
346 |
each: function( obj, callback, args ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
347 |
var value, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
348 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
349 |
length = obj.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
350 |
isArray = isArraylike( obj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
351 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
352 |
if ( args ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
353 |
if ( isArray ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
354 |
for ( ; i < length; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
355 |
value = callback.apply( obj[ i ], args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
356 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
357 |
if ( value === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
358 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
359 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
360 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
361 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
362 |
for ( i in obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
363 |
value = callback.apply( obj[ i ], args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
364 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
365 |
if ( value === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
366 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
367 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
368 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
369 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
370 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
371 |
// A special, fast, case for the most common use of each |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
372 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
373 |
if ( isArray ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
374 |
for ( ; i < length; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
375 |
value = callback.call( obj[ i ], i, obj[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
376 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
377 |
if ( value === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
378 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
379 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
380 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
381 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
382 |
for ( i in obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
383 |
value = callback.call( obj[ i ], i, obj[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
384 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
385 |
if ( value === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
386 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
387 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
388 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
389 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
390 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
391 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
392 |
return obj; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
393 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
394 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
395 |
// Support: Android<4.1 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
396 |
trim: function( text ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
397 |
return text == null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
398 |
"" : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
399 |
( text + "" ).replace( rtrim, "" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
400 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
401 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
402 |
// results is for internal usage only |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
403 |
makeArray: function( arr, results ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
404 |
var ret = results || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
405 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
406 |
if ( arr != null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
407 |
if ( isArraylike( Object(arr) ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
408 |
jQuery.merge( ret, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
409 |
typeof arr === "string" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
410 |
[ arr ] : arr |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
411 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
412 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
413 |
push.call( ret, arr ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
414 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
415 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
416 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
417 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
418 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
419 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
420 |
inArray: function( elem, arr, i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
421 |
return arr == null ? -1 : indexOf.call( arr, elem, i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
422 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
423 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
424 |
merge: function( first, second ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
425 |
var len = +second.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
426 |
j = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
427 |
i = first.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
428 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
429 |
for ( ; j < len; j++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
430 |
first[ i++ ] = second[ j ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
431 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
432 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
433 |
first.length = i; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
434 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
435 |
return first; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
436 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
437 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
438 |
grep: function( elems, callback, invert ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
439 |
var callbackInverse, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
440 |
matches = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
441 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
442 |
length = elems.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
443 |
callbackExpect = !invert; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
444 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
445 |
// Go through the array, only saving the items |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
446 |
// that pass the validator function |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
447 |
for ( ; i < length; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
448 |
callbackInverse = !callback( elems[ i ], i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
449 |
if ( callbackInverse !== callbackExpect ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
450 |
matches.push( elems[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
451 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
452 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
453 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
454 |
return matches; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
455 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
456 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
457 |
// arg is for internal usage only |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
458 |
map: function( elems, callback, arg ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
459 |
var value, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
460 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
461 |
length = elems.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
462 |
isArray = isArraylike( elems ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
463 |
ret = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
464 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
465 |
// Go through the array, translating each of the items to their new values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
466 |
if ( isArray ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
467 |
for ( ; i < length; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
468 |
value = callback( elems[ i ], i, arg ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
469 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
470 |
if ( value != null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
471 |
ret.push( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
472 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
473 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
474 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
475 |
// Go through every key on the object, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
476 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
477 |
for ( i in elems ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
478 |
value = callback( elems[ i ], i, arg ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
479 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
480 |
if ( value != null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
481 |
ret.push( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
482 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
483 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
484 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
485 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
486 |
// Flatten any nested arrays |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
487 |
return concat.apply( [], ret ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
488 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
489 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
490 |
// A global GUID counter for objects |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
491 |
guid: 1, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
492 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
493 |
// Bind a function to a context, optionally partially applying any |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
494 |
// arguments. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
495 |
proxy: function( fn, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
496 |
var tmp, args, proxy; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
497 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
498 |
if ( typeof context === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
499 |
tmp = fn[ context ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
500 |
context = fn; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
501 |
fn = tmp; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
502 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
503 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
504 |
// Quick check to determine if target is callable, in the spec |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
505 |
// this throws a TypeError, but we will just return undefined. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
506 |
if ( !jQuery.isFunction( fn ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
507 |
return undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
508 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
509 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
510 |
// Simulated bind |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
511 |
args = slice.call( arguments, 2 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
512 |
proxy = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
513 |
return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
514 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
515 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
516 |
// Set the guid of unique handler to the same of original handler, so it can be removed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
517 |
proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
518 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
519 |
return proxy; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
520 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
521 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
522 |
now: Date.now, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
523 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
524 |
// jQuery.support is not used in Core but other projects attach their |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
525 |
// properties to it so it needs to exist. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
526 |
support: support |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
527 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
528 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
529 |
// Populate the class2type map |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
530 |
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
531 |
class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
532 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
533 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
534 |
function isArraylike( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
535 |
var length = obj.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
536 |
type = jQuery.type( obj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
537 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
538 |
if ( type === "function" || jQuery.isWindow( obj ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
539 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
540 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
541 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
542 |
if ( obj.nodeType === 1 && length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
543 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
544 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
545 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
546 |
return type === "array" || length === 0 || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
547 |
typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
548 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
549 |
var Sizzle = |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
550 |
/*! |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
551 |
* Sizzle CSS Selector Engine v1.10.19 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
552 |
* http://sizzlejs.com/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
553 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
554 |
* Copyright 2013 jQuery Foundation, Inc. and other contributors |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
555 |
* Released under the MIT license |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
556 |
* http://jquery.org/license |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
557 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
558 |
* Date: 2014-04-18 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
559 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
560 |
(function( window ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
561 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
562 |
var i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
563 |
support, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
564 |
Expr, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
565 |
getText, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
566 |
isXML, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
567 |
tokenize, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
568 |
compile, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
569 |
select, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
570 |
outermostContext, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
571 |
sortInput, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
572 |
hasDuplicate, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
573 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
574 |
// Local document vars |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
575 |
setDocument, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
576 |
document, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
577 |
docElem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
578 |
documentIsHTML, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
579 |
rbuggyQSA, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
580 |
rbuggyMatches, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
581 |
matches, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
582 |
contains, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
583 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
584 |
// Instance-specific data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
585 |
expando = "sizzle" + -(new Date()), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
586 |
preferredDoc = window.document, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
587 |
dirruns = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
588 |
done = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
589 |
classCache = createCache(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
590 |
tokenCache = createCache(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
591 |
compilerCache = createCache(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
592 |
sortOrder = function( a, b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
593 |
if ( a === b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
594 |
hasDuplicate = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
595 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
596 |
return 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
597 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
598 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
599 |
// General-purpose constants |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
600 |
strundefined = typeof undefined, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
601 |
MAX_NEGATIVE = 1 << 31, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
602 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
603 |
// Instance methods |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
604 |
hasOwn = ({}).hasOwnProperty, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
605 |
arr = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
606 |
pop = arr.pop, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
607 |
push_native = arr.push, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
608 |
push = arr.push, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
609 |
slice = arr.slice, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
610 |
// Use a stripped-down indexOf if we can't use a native one |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
611 |
indexOf = arr.indexOf || function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
612 |
var i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
613 |
len = this.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
614 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
615 |
if ( this[i] === elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
616 |
return i; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
617 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
618 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
619 |
return -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
620 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
621 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
622 |
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
623 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
624 |
// Regular expressions |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
625 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
626 |
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
627 |
whitespace = "[\\x20\\t\\r\\n\\f]", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
628 |
// http://www.w3.org/TR/css3-syntax/#characters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
629 |
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
630 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
631 |
// Loosely modeled on CSS identifier characters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
632 |
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
633 |
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
634 |
identifier = characterEncoding.replace( "w", "w#" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
635 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
636 |
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
637 |
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
638 |
// Operator (capture 2) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
639 |
"*([*^$|!~]?=)" + whitespace + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
640 |
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
641 |
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
642 |
"*\\]", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
643 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
644 |
pseudos = ":(" + characterEncoding + ")(?:\\((" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
645 |
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
646 |
// 1. quoted (capture 3; capture 4 or capture 5) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
647 |
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
648 |
// 2. simple (capture 6) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
649 |
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
650 |
// 3. anything else (capture 2) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
651 |
".*" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
652 |
")\\)|)", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
653 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
654 |
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
655 |
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
656 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
657 |
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
658 |
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
659 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
660 |
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
661 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
662 |
rpseudo = new RegExp( pseudos ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
663 |
ridentifier = new RegExp( "^" + identifier + "$" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
664 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
665 |
matchExpr = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
666 |
"ID": new RegExp( "^#(" + characterEncoding + ")" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
667 |
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
668 |
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
669 |
"ATTR": new RegExp( "^" + attributes ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
670 |
"PSEUDO": new RegExp( "^" + pseudos ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
671 |
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
672 |
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
673 |
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
674 |
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
675 |
// For use in libraries implementing .is() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
676 |
// We use this for POS matching in `select` |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
677 |
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
678 |
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
679 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
680 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
681 |
rinputs = /^(?:input|select|textarea|button)$/i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
682 |
rheader = /^h\d$/i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
683 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
684 |
rnative = /^[^{]+\{\s*\[native \w/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
685 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
686 |
// Easily-parseable/retrievable ID or TAG or CLASS selectors |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
687 |
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
688 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
689 |
rsibling = /[+~]/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
690 |
rescape = /'|\\/g, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
691 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
692 |
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
693 |
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
694 |
funescape = function( _, escaped, escapedWhitespace ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
695 |
var high = "0x" + escaped - 0x10000; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
696 |
// NaN means non-codepoint |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
697 |
// Support: Firefox<24 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
698 |
// Workaround erroneous numeric interpretation of +"0x" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
699 |
return high !== high || escapedWhitespace ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
700 |
escaped : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
701 |
high < 0 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
702 |
// BMP codepoint |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
703 |
String.fromCharCode( high + 0x10000 ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
704 |
// Supplemental Plane codepoint (surrogate pair) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
705 |
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
706 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
707 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
708 |
// Optimize for push.apply( _, NodeList ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
709 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
710 |
push.apply( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
711 |
(arr = slice.call( preferredDoc.childNodes )), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
712 |
preferredDoc.childNodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
713 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
714 |
// Support: Android<4.0 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
715 |
// Detect silently failing push.apply |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
716 |
arr[ preferredDoc.childNodes.length ].nodeType; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
717 |
} catch ( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
718 |
push = { apply: arr.length ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
719 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
720 |
// Leverage slice if possible |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
721 |
function( target, els ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
722 |
push_native.apply( target, slice.call(els) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
723 |
} : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
724 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
725 |
// Support: IE<9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
726 |
// Otherwise append directly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
727 |
function( target, els ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
728 |
var j = target.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
729 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
730 |
// Can't trust NodeList.length |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
731 |
while ( (target[j++] = els[i++]) ) {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
732 |
target.length = j - 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
733 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
734 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
735 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
736 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
737 |
function Sizzle( selector, context, results, seed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
738 |
var match, elem, m, nodeType, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
739 |
// QSA vars |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
740 |
i, groups, old, nid, newContext, newSelector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
741 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
742 |
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
743 |
setDocument( context ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
744 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
745 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
746 |
context = context || document; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
747 |
results = results || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
748 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
749 |
if ( !selector || typeof selector !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
750 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
751 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
752 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
753 |
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
754 |
return []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
755 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
756 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
757 |
if ( documentIsHTML && !seed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
758 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
759 |
// Shortcuts |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
760 |
if ( (match = rquickExpr.exec( selector )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
761 |
// Speed-up: Sizzle("#ID") |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
762 |
if ( (m = match[1]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
763 |
if ( nodeType === 9 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
764 |
elem = context.getElementById( m ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
765 |
// Check parentNode to catch when Blackberry 4.6 returns |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
766 |
// nodes that are no longer in the document (jQuery #6963) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
767 |
if ( elem && elem.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
768 |
// Handle the case where IE, Opera, and Webkit return items |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
769 |
// by name instead of ID |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
770 |
if ( elem.id === m ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
771 |
results.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
772 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
773 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
774 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
775 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
776 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
777 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
778 |
// Context is not a document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
779 |
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
780 |
contains( context, elem ) && elem.id === m ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
781 |
results.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
782 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
783 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
784 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
785 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
786 |
// Speed-up: Sizzle("TAG") |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
787 |
} else if ( match[2] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
788 |
push.apply( results, context.getElementsByTagName( selector ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
789 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
790 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
791 |
// Speed-up: Sizzle(".CLASS") |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
792 |
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
793 |
push.apply( results, context.getElementsByClassName( m ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
794 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
795 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
796 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
797 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
798 |
// QSA path |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
799 |
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
800 |
nid = old = expando; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
801 |
newContext = context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
802 |
newSelector = nodeType === 9 && selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
803 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
804 |
// qSA works strangely on Element-rooted queries |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
805 |
// We can work around this by specifying an extra ID on the root |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
806 |
// and working up from there (Thanks to Andrew Dupont for the technique) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
807 |
// IE 8 doesn't work on object elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
808 |
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
809 |
groups = tokenize( selector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
810 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
811 |
if ( (old = context.getAttribute("id")) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
812 |
nid = old.replace( rescape, "\\$&" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
813 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
814 |
context.setAttribute( "id", nid ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
815 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
816 |
nid = "[id='" + nid + "'] "; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
817 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
818 |
i = groups.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
819 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
820 |
groups[i] = nid + toSelector( groups[i] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
821 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
822 |
newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
823 |
newSelector = groups.join(","); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
824 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
825 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
826 |
if ( newSelector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
827 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
828 |
push.apply( results, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
829 |
newContext.querySelectorAll( newSelector ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
830 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
831 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
832 |
} catch(qsaError) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
833 |
} finally { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
834 |
if ( !old ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
835 |
context.removeAttribute("id"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
836 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
837 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
838 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
839 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
840 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
841 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
842 |
// All others |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
843 |
return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
844 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
845 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
846 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
847 |
* Create key-value caches of limited size |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
848 |
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
849 |
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
850 |
* deleting the oldest entry |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
851 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
852 |
function createCache() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
853 |
var keys = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
854 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
855 |
function cache( key, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
856 |
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
857 |
if ( keys.push( key + " " ) > Expr.cacheLength ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
858 |
// Only keep the most recent entries |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
859 |
delete cache[ keys.shift() ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
860 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
861 |
return (cache[ key + " " ] = value); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
862 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
863 |
return cache; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
864 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
865 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
866 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
867 |
* Mark a function for special use by Sizzle |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
868 |
* @param {Function} fn The function to mark |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
869 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
870 |
function markFunction( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
871 |
fn[ expando ] = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
872 |
return fn; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
873 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
874 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
875 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
876 |
* Support testing using an element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
877 |
* @param {Function} fn Passed the created div and expects a boolean result |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
878 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
879 |
function assert( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
880 |
var div = document.createElement("div"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
881 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
882 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
883 |
return !!fn( div ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
884 |
} catch (e) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
885 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
886 |
} finally { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
887 |
// Remove from its parent by default |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
888 |
if ( div.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
889 |
div.parentNode.removeChild( div ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
890 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
891 |
// release memory in IE |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
892 |
div = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
893 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
894 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
895 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
896 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
897 |
* Adds the same handler for all of the specified attrs |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
898 |
* @param {String} attrs Pipe-separated list of attributes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
899 |
* @param {Function} handler The method that will be applied |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
900 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
901 |
function addHandle( attrs, handler ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
902 |
var arr = attrs.split("|"), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
903 |
i = attrs.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
904 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
905 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
906 |
Expr.attrHandle[ arr[i] ] = handler; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
907 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
908 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
909 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
910 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
911 |
* Checks document order of two siblings |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
912 |
* @param {Element} a |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
913 |
* @param {Element} b |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
914 |
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
915 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
916 |
function siblingCheck( a, b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
917 |
var cur = b && a, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
918 |
diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
919 |
( ~b.sourceIndex || MAX_NEGATIVE ) - |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
920 |
( ~a.sourceIndex || MAX_NEGATIVE ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
921 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
922 |
// Use IE sourceIndex if available on both nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
923 |
if ( diff ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
924 |
return diff; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
925 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
926 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
927 |
// Check if b follows a |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
928 |
if ( cur ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
929 |
while ( (cur = cur.nextSibling) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
930 |
if ( cur === b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
931 |
return -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
932 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
933 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
934 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
935 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
936 |
return a ? 1 : -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
937 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
938 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
939 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
940 |
* Returns a function to use in pseudos for input types |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
941 |
* @param {String} type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
942 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
943 |
function createInputPseudo( type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
944 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
945 |
var name = elem.nodeName.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
946 |
return name === "input" && elem.type === type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
947 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
948 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
949 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
950 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
951 |
* Returns a function to use in pseudos for buttons |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
952 |
* @param {String} type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
953 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
954 |
function createButtonPseudo( type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
955 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
956 |
var name = elem.nodeName.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
957 |
return (name === "input" || name === "button") && elem.type === type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
958 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
959 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
960 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
961 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
962 |
* Returns a function to use in pseudos for positionals |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
963 |
* @param {Function} fn |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
964 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
965 |
function createPositionalPseudo( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
966 |
return markFunction(function( argument ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
967 |
argument = +argument; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
968 |
return markFunction(function( seed, matches ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
969 |
var j, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
970 |
matchIndexes = fn( [], seed.length, argument ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
971 |
i = matchIndexes.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
972 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
973 |
// Match elements found at the specified indexes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
974 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
975 |
if ( seed[ (j = matchIndexes[i]) ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
976 |
seed[j] = !(matches[j] = seed[j]); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
977 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
978 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
979 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
980 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
981 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
982 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
983 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
984 |
* Checks a node for validity as a Sizzle context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
985 |
* @param {Element|Object=} context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
986 |
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
987 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
988 |
function testContext( context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
989 |
return context && typeof context.getElementsByTagName !== strundefined && context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
990 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
991 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
992 |
// Expose support vars for convenience |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
993 |
support = Sizzle.support = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
994 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
995 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
996 |
* Detects XML nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
997 |
* @param {Element|Object} elem An element or a document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
998 |
* @returns {Boolean} True iff elem is a non-HTML XML node |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
999 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1000 |
isXML = Sizzle.isXML = function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1001 |
// documentElement is verified for cases where it doesn't yet exist |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1002 |
// (such as loading iframes in IE - #4833) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1003 |
var documentElement = elem && (elem.ownerDocument || elem).documentElement; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1004 |
return documentElement ? documentElement.nodeName !== "HTML" : false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1005 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1006 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1007 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1008 |
* Sets document-related variables once based on the current document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1009 |
* @param {Element|Object} [doc] An element or document object to use to set the document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1010 |
* @returns {Object} Returns the current document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1011 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1012 |
setDocument = Sizzle.setDocument = function( node ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1013 |
var hasCompare, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1014 |
doc = node ? node.ownerDocument || node : preferredDoc, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1015 |
parent = doc.defaultView; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1016 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1017 |
// If no document and documentElement is available, return |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1018 |
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1019 |
return document; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1020 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1021 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1022 |
// Set our document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1023 |
document = doc; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1024 |
docElem = doc.documentElement; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1025 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1026 |
// Support tests |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1027 |
documentIsHTML = !isXML( doc ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1028 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1029 |
// Support: IE>8 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1030 |
// If iframe document is assigned to "document" variable and if iframe has been reloaded, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1031 |
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1032 |
// IE6-8 do not support the defaultView property so parent will be undefined |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1033 |
if ( parent && parent !== parent.top ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1034 |
// IE11 does not have attachEvent, so all must suffer |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1035 |
if ( parent.addEventListener ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1036 |
parent.addEventListener( "unload", function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1037 |
setDocument(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1038 |
}, false ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1039 |
} else if ( parent.attachEvent ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1040 |
parent.attachEvent( "onunload", function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1041 |
setDocument(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1042 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1043 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1044 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1045 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1046 |
/* Attributes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1047 |
---------------------------------------------------------------------- */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1048 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1049 |
// Support: IE<8 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1050 |
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1051 |
support.attributes = assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1052 |
div.className = "i"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1053 |
return !div.getAttribute("className"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1054 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1055 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1056 |
/* getElement(s)By* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1057 |
---------------------------------------------------------------------- */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1058 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1059 |
// Check if getElementsByTagName("*") returns only elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1060 |
support.getElementsByTagName = assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1061 |
div.appendChild( doc.createComment("") ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1062 |
return !div.getElementsByTagName("*").length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1063 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1064 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1065 |
// Check if getElementsByClassName can be trusted |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1066 |
support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1067 |
div.innerHTML = "<div class='a'></div><div class='a i'></div>"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1068 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1069 |
// Support: Safari<4 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1070 |
// Catch class over-caching |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1071 |
div.firstChild.className = "i"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1072 |
// Support: Opera<10 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1073 |
// Catch gEBCN failure to find non-leading classes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1074 |
return div.getElementsByClassName("i").length === 2; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1075 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1076 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1077 |
// Support: IE<10 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1078 |
// Check if getElementById returns elements by name |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1079 |
// The broken getElementById methods don't pick up programatically-set names, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1080 |
// so use a roundabout getElementsByName test |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1081 |
support.getById = assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1082 |
docElem.appendChild( div ).id = expando; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1083 |
return !doc.getElementsByName || !doc.getElementsByName( expando ).length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1084 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1085 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1086 |
// ID find and filter |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1087 |
if ( support.getById ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1088 |
Expr.find["ID"] = function( id, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1089 |
if ( typeof context.getElementById !== strundefined && documentIsHTML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1090 |
var m = context.getElementById( id ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1091 |
// Check parentNode to catch when Blackberry 4.6 returns |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1092 |
// nodes that are no longer in the document #6963 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1093 |
return m && m.parentNode ? [ m ] : []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1094 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1095 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1096 |
Expr.filter["ID"] = function( id ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1097 |
var attrId = id.replace( runescape, funescape ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1098 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1099 |
return elem.getAttribute("id") === attrId; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1100 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1101 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1102 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1103 |
// Support: IE6/7 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1104 |
// getElementById is not reliable as a find shortcut |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1105 |
delete Expr.find["ID"]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1106 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1107 |
Expr.filter["ID"] = function( id ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1108 |
var attrId = id.replace( runescape, funescape ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1109 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1110 |
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1111 |
return node && node.value === attrId; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1112 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1113 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1114 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1115 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1116 |
// Tag |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1117 |
Expr.find["TAG"] = support.getElementsByTagName ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1118 |
function( tag, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1119 |
if ( typeof context.getElementsByTagName !== strundefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1120 |
return context.getElementsByTagName( tag ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1121 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1122 |
} : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1123 |
function( tag, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1124 |
var elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1125 |
tmp = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1126 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1127 |
results = context.getElementsByTagName( tag ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1128 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1129 |
// Filter out possible comments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1130 |
if ( tag === "*" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1131 |
while ( (elem = results[i++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1132 |
if ( elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1133 |
tmp.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1134 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1135 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1136 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1137 |
return tmp; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1138 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1139 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1140 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1141 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1142 |
// Class |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1143 |
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1144 |
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1145 |
return context.getElementsByClassName( className ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1146 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1147 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1148 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1149 |
/* QSA/matchesSelector |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1150 |
---------------------------------------------------------------------- */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1151 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1152 |
// QSA and matchesSelector support |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1153 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1154 |
// matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1155 |
rbuggyMatches = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1156 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1157 |
// qSa(:focus) reports false when true (Chrome 21) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1158 |
// We allow this because of a bug in IE8/9 that throws an error |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1159 |
// whenever `document.activeElement` is accessed on an iframe |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1160 |
// So, we allow :focus to pass through QSA all the time to avoid the IE error |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1161 |
// See http://bugs.jquery.com/ticket/13378 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1162 |
rbuggyQSA = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1163 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1164 |
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1165 |
// Build QSA regex |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1166 |
// Regex strategy adopted from Diego Perini |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1167 |
assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1168 |
// Select is set to empty string on purpose |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1169 |
// This is to test IE's treatment of not explicitly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1170 |
// setting a boolean content attribute, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1171 |
// since its presence should be enough |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1172 |
// http://bugs.jquery.com/ticket/12359 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1173 |
div.innerHTML = "<select msallowclip=''><option selected=''></option></select>"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1174 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1175 |
// Support: IE8, Opera 11-12.16 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1176 |
// Nothing should be selected when empty strings follow ^= or $= or *= |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1177 |
// The test attribute must be unknown in Opera but "safe" for WinRT |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1178 |
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1179 |
if ( div.querySelectorAll("[msallowclip^='']").length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1180 |
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1181 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1182 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1183 |
// Support: IE8 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1184 |
// Boolean attributes and "value" are not treated correctly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1185 |
if ( !div.querySelectorAll("[selected]").length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1186 |
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1187 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1188 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1189 |
// Webkit/Opera - :checked should return selected option elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1190 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1191 |
// IE8 throws error here and will not see later tests |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1192 |
if ( !div.querySelectorAll(":checked").length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1193 |
rbuggyQSA.push(":checked"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1194 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1195 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1196 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1197 |
assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1198 |
// Support: Windows 8 Native Apps |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1199 |
// The type and name attributes are restricted during .innerHTML assignment |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1200 |
var input = doc.createElement("input"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1201 |
input.setAttribute( "type", "hidden" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1202 |
div.appendChild( input ).setAttribute( "name", "D" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1203 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1204 |
// Support: IE8 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1205 |
// Enforce case-sensitivity of name attribute |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1206 |
if ( div.querySelectorAll("[name=d]").length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1207 |
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1208 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1209 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1210 |
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1211 |
// IE8 throws error here and will not see later tests |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1212 |
if ( !div.querySelectorAll(":enabled").length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1213 |
rbuggyQSA.push( ":enabled", ":disabled" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1214 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1215 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1216 |
// Opera 10-11 does not throw on post-comma invalid pseudos |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1217 |
div.querySelectorAll("*,:x"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1218 |
rbuggyQSA.push(",.*:"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1219 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1220 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1221 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1222 |
if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1223 |
docElem.webkitMatchesSelector || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1224 |
docElem.mozMatchesSelector || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1225 |
docElem.oMatchesSelector || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1226 |
docElem.msMatchesSelector) )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1227 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1228 |
assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1229 |
// Check to see if it's possible to do matchesSelector |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1230 |
// on a disconnected node (IE 9) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1231 |
support.disconnectedMatch = matches.call( div, "div" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1232 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1233 |
// This should fail with an exception |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1234 |
// Gecko does not error, returns false instead |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1235 |
matches.call( div, "[s!='']:x" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1236 |
rbuggyMatches.push( "!=", pseudos ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1237 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1238 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1239 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1240 |
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1241 |
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1242 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1243 |
/* Contains |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1244 |
---------------------------------------------------------------------- */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1245 |
hasCompare = rnative.test( docElem.compareDocumentPosition ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1246 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1247 |
// Element contains another |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1248 |
// Purposefully does not implement inclusive descendent |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1249 |
// As in, an element does not contain itself |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1250 |
contains = hasCompare || rnative.test( docElem.contains ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1251 |
function( a, b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1252 |
var adown = a.nodeType === 9 ? a.documentElement : a, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1253 |
bup = b && b.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1254 |
return a === bup || !!( bup && bup.nodeType === 1 && ( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1255 |
adown.contains ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1256 |
adown.contains( bup ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1257 |
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1258 |
)); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1259 |
} : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1260 |
function( a, b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1261 |
if ( b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1262 |
while ( (b = b.parentNode) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1263 |
if ( b === a ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1264 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1265 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1266 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1267 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1268 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1269 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1270 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1271 |
/* Sorting |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1272 |
---------------------------------------------------------------------- */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1273 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1274 |
// Document order sorting |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1275 |
sortOrder = hasCompare ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1276 |
function( a, b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1277 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1278 |
// Flag for duplicate removal |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1279 |
if ( a === b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1280 |
hasDuplicate = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1281 |
return 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1282 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1283 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1284 |
// Sort on method existence if only one input has compareDocumentPosition |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1285 |
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1286 |
if ( compare ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1287 |
return compare; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1288 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1289 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1290 |
// Calculate position if both inputs belong to the same document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1291 |
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1292 |
a.compareDocumentPosition( b ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1293 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1294 |
// Otherwise we know they are disconnected |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1295 |
1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1296 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1297 |
// Disconnected nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1298 |
if ( compare & 1 || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1299 |
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1300 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1301 |
// Choose the first element that is related to our preferred document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1302 |
if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1303 |
return -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1304 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1305 |
if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1306 |
return 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1307 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1308 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1309 |
// Maintain original order |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1310 |
return sortInput ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1311 |
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1312 |
0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1313 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1314 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1315 |
return compare & 4 ? -1 : 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1316 |
} : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1317 |
function( a, b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1318 |
// Exit early if the nodes are identical |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1319 |
if ( a === b ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1320 |
hasDuplicate = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1321 |
return 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1322 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1323 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1324 |
var cur, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1325 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1326 |
aup = a.parentNode, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1327 |
bup = b.parentNode, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1328 |
ap = [ a ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1329 |
bp = [ b ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1330 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1331 |
// Parentless nodes are either documents or disconnected |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1332 |
if ( !aup || !bup ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1333 |
return a === doc ? -1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1334 |
b === doc ? 1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1335 |
aup ? -1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1336 |
bup ? 1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1337 |
sortInput ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1338 |
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1339 |
0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1340 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1341 |
// If the nodes are siblings, we can do a quick check |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1342 |
} else if ( aup === bup ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1343 |
return siblingCheck( a, b ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1344 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1345 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1346 |
// Otherwise we need full lists of their ancestors for comparison |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1347 |
cur = a; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1348 |
while ( (cur = cur.parentNode) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1349 |
ap.unshift( cur ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1350 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1351 |
cur = b; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1352 |
while ( (cur = cur.parentNode) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1353 |
bp.unshift( cur ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1354 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1355 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1356 |
// Walk down the tree looking for a discrepancy |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1357 |
while ( ap[i] === bp[i] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1358 |
i++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1359 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1360 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1361 |
return i ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1362 |
// Do a sibling check if the nodes have a common ancestor |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1363 |
siblingCheck( ap[i], bp[i] ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1364 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1365 |
// Otherwise nodes in our document sort first |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1366 |
ap[i] === preferredDoc ? -1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1367 |
bp[i] === preferredDoc ? 1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1368 |
0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1369 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1370 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1371 |
return doc; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1372 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1373 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1374 |
Sizzle.matches = function( expr, elements ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1375 |
return Sizzle( expr, null, null, elements ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1376 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1377 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1378 |
Sizzle.matchesSelector = function( elem, expr ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1379 |
// Set document vars if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1380 |
if ( ( elem.ownerDocument || elem ) !== document ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1381 |
setDocument( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1382 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1383 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1384 |
// Make sure that attribute selectors are quoted |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1385 |
expr = expr.replace( rattributeQuotes, "='$1']" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1386 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1387 |
if ( support.matchesSelector && documentIsHTML && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1388 |
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1389 |
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1390 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1391 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1392 |
var ret = matches.call( elem, expr ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1393 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1394 |
// IE 9's matchesSelector returns false on disconnected nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1395 |
if ( ret || support.disconnectedMatch || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1396 |
// As well, disconnected nodes are said to be in a document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1397 |
// fragment in IE 9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1398 |
elem.document && elem.document.nodeType !== 11 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1399 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1400 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1401 |
} catch(e) {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1402 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1403 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1404 |
return Sizzle( expr, document, null, [ elem ] ).length > 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1405 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1406 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1407 |
Sizzle.contains = function( context, elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1408 |
// Set document vars if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1409 |
if ( ( context.ownerDocument || context ) !== document ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1410 |
setDocument( context ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1411 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1412 |
return contains( context, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1413 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1414 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1415 |
Sizzle.attr = function( elem, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1416 |
// Set document vars if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1417 |
if ( ( elem.ownerDocument || elem ) !== document ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1418 |
setDocument( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1419 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1420 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1421 |
var fn = Expr.attrHandle[ name.toLowerCase() ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1422 |
// Don't get fooled by Object.prototype properties (jQuery #13807) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1423 |
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1424 |
fn( elem, name, !documentIsHTML ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1425 |
undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1426 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1427 |
return val !== undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1428 |
val : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1429 |
support.attributes || !documentIsHTML ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1430 |
elem.getAttribute( name ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1431 |
(val = elem.getAttributeNode(name)) && val.specified ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1432 |
val.value : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1433 |
null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1434 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1435 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1436 |
Sizzle.error = function( msg ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1437 |
throw new Error( "Syntax error, unrecognized expression: " + msg ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1438 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1439 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1440 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1441 |
* Document sorting and removing duplicates |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1442 |
* @param {ArrayLike} results |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1443 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1444 |
Sizzle.uniqueSort = function( results ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1445 |
var elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1446 |
duplicates = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1447 |
j = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1448 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1449 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1450 |
// Unless we *know* we can detect duplicates, assume their presence |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1451 |
hasDuplicate = !support.detectDuplicates; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1452 |
sortInput = !support.sortStable && results.slice( 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1453 |
results.sort( sortOrder ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1454 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1455 |
if ( hasDuplicate ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1456 |
while ( (elem = results[i++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1457 |
if ( elem === results[ i ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1458 |
j = duplicates.push( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1459 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1460 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1461 |
while ( j-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1462 |
results.splice( duplicates[ j ], 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1463 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1464 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1465 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1466 |
// Clear input after sorting to release objects |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1467 |
// See https://github.com/jquery/sizzle/pull/225 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1468 |
sortInput = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1469 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1470 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1471 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1472 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1473 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1474 |
* Utility function for retrieving the text value of an array of DOM nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1475 |
* @param {Array|Element} elem |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1476 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1477 |
getText = Sizzle.getText = function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1478 |
var node, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1479 |
ret = "", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1480 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1481 |
nodeType = elem.nodeType; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1482 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1483 |
if ( !nodeType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1484 |
// If no nodeType, this is expected to be an array |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1485 |
while ( (node = elem[i++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1486 |
// Do not traverse comment nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1487 |
ret += getText( node ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1488 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1489 |
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1490 |
// Use textContent for elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1491 |
// innerText usage removed for consistency of new lines (jQuery #11153) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1492 |
if ( typeof elem.textContent === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1493 |
return elem.textContent; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1494 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1495 |
// Traverse its children |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1496 |
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1497 |
ret += getText( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1498 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1499 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1500 |
} else if ( nodeType === 3 || nodeType === 4 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1501 |
return elem.nodeValue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1502 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1503 |
// Do not include comment or processing instruction nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1504 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1505 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1506 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1507 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1508 |
Expr = Sizzle.selectors = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1509 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1510 |
// Can be adjusted by the user |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1511 |
cacheLength: 50, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1512 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1513 |
createPseudo: markFunction, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1514 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1515 |
match: matchExpr, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1516 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1517 |
attrHandle: {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1518 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1519 |
find: {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1520 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1521 |
relative: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1522 |
">": { dir: "parentNode", first: true }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1523 |
" ": { dir: "parentNode" }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1524 |
"+": { dir: "previousSibling", first: true }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1525 |
"~": { dir: "previousSibling" } |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1526 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1527 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1528 |
preFilter: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1529 |
"ATTR": function( match ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1530 |
match[1] = match[1].replace( runescape, funescape ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1531 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1532 |
// Move the given value to match[3] whether quoted or unquoted |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1533 |
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1534 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1535 |
if ( match[2] === "~=" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1536 |
match[3] = " " + match[3] + " "; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1537 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1538 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1539 |
return match.slice( 0, 4 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1540 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1541 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1542 |
"CHILD": function( match ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1543 |
/* matches from matchExpr["CHILD"] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1544 |
1 type (only|nth|...) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1545 |
2 what (child|of-type) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1546 |
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1547 |
4 xn-component of xn+y argument ([+-]?\d*n|) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1548 |
5 sign of xn-component |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1549 |
6 x of xn-component |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1550 |
7 sign of y-component |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1551 |
8 y of y-component |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1552 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1553 |
match[1] = match[1].toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1554 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1555 |
if ( match[1].slice( 0, 3 ) === "nth" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1556 |
// nth-* requires argument |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1557 |
if ( !match[3] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1558 |
Sizzle.error( match[0] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1559 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1560 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1561 |
// numeric x and y parameters for Expr.filter.CHILD |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1562 |
// remember that false/true cast respectively to 0/1 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1563 |
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1564 |
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1565 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1566 |
// other types prohibit arguments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1567 |
} else if ( match[3] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1568 |
Sizzle.error( match[0] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1569 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1570 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1571 |
return match; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1572 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1573 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1574 |
"PSEUDO": function( match ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1575 |
var excess, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1576 |
unquoted = !match[6] && match[2]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1577 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1578 |
if ( matchExpr["CHILD"].test( match[0] ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1579 |
return null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1580 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1581 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1582 |
// Accept quoted arguments as-is |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1583 |
if ( match[3] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1584 |
match[2] = match[4] || match[5] || ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1585 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1586 |
// Strip excess characters from unquoted arguments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1587 |
} else if ( unquoted && rpseudo.test( unquoted ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1588 |
// Get excess from tokenize (recursively) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1589 |
(excess = tokenize( unquoted, true )) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1590 |
// advance to the next closing parenthesis |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1591 |
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1592 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1593 |
// excess is a negative index |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1594 |
match[0] = match[0].slice( 0, excess ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1595 |
match[2] = unquoted.slice( 0, excess ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1596 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1597 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1598 |
// Return only captures needed by the pseudo filter method (type and argument) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1599 |
return match.slice( 0, 3 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1600 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1601 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1602 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1603 |
filter: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1604 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1605 |
"TAG": function( nodeNameSelector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1606 |
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1607 |
return nodeNameSelector === "*" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1608 |
function() { return true; } : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1609 |
function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1610 |
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1611 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1612 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1613 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1614 |
"CLASS": function( className ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1615 |
var pattern = classCache[ className + " " ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1616 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1617 |
return pattern || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1618 |
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1619 |
classCache( className, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1620 |
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1621 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1622 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1623 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1624 |
"ATTR": function( name, operator, check ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1625 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1626 |
var result = Sizzle.attr( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1627 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1628 |
if ( result == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1629 |
return operator === "!="; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1630 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1631 |
if ( !operator ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1632 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1633 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1634 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1635 |
result += ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1636 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1637 |
return operator === "=" ? result === check : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1638 |
operator === "!=" ? result !== check : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1639 |
operator === "^=" ? check && result.indexOf( check ) === 0 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1640 |
operator === "*=" ? check && result.indexOf( check ) > -1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1641 |
operator === "$=" ? check && result.slice( -check.length ) === check : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1642 |
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1643 |
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1644 |
false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1645 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1646 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1647 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1648 |
"CHILD": function( type, what, argument, first, last ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1649 |
var simple = type.slice( 0, 3 ) !== "nth", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1650 |
forward = type.slice( -4 ) !== "last", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1651 |
ofType = what === "of-type"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1652 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1653 |
return first === 1 && last === 0 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1654 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1655 |
// Shortcut for :nth-*(n) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1656 |
function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1657 |
return !!elem.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1658 |
} : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1659 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1660 |
function( elem, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1661 |
var cache, outerCache, node, diff, nodeIndex, start, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1662 |
dir = simple !== forward ? "nextSibling" : "previousSibling", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1663 |
parent = elem.parentNode, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1664 |
name = ofType && elem.nodeName.toLowerCase(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1665 |
useCache = !xml && !ofType; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1666 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1667 |
if ( parent ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1668 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1669 |
// :(first|last|only)-(child|of-type) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1670 |
if ( simple ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1671 |
while ( dir ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1672 |
node = elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1673 |
while ( (node = node[ dir ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1674 |
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1675 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1676 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1677 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1678 |
// Reverse direction for :only-* (if we haven't yet done so) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1679 |
start = dir = type === "only" && !start && "nextSibling"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1680 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1681 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1682 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1683 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1684 |
start = [ forward ? parent.firstChild : parent.lastChild ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1685 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1686 |
// non-xml :nth-child(...) stores cache data on `parent` |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1687 |
if ( forward && useCache ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1688 |
// Seek `elem` from a previously-cached index |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1689 |
outerCache = parent[ expando ] || (parent[ expando ] = {}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1690 |
cache = outerCache[ type ] || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1691 |
nodeIndex = cache[0] === dirruns && cache[1]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1692 |
diff = cache[0] === dirruns && cache[2]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1693 |
node = nodeIndex && parent.childNodes[ nodeIndex ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1694 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1695 |
while ( (node = ++nodeIndex && node && node[ dir ] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1696 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1697 |
// Fallback to seeking `elem` from the start |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1698 |
(diff = nodeIndex = 0) || start.pop()) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1699 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1700 |
// When found, cache indexes on `parent` and break |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1701 |
if ( node.nodeType === 1 && ++diff && node === elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1702 |
outerCache[ type ] = [ dirruns, nodeIndex, diff ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1703 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1704 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1705 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1706 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1707 |
// Use previously-cached element index if available |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1708 |
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1709 |
diff = cache[1]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1710 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1711 |
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1712 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1713 |
// Use the same loop as above to seek `elem` from the start |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1714 |
while ( (node = ++nodeIndex && node && node[ dir ] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1715 |
(diff = nodeIndex = 0) || start.pop()) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1716 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1717 |
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1718 |
// Cache the index of each encountered element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1719 |
if ( useCache ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1720 |
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1721 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1722 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1723 |
if ( node === elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1724 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1725 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1726 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1727 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1728 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1729 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1730 |
// Incorporate the offset, then check against cycle size |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1731 |
diff -= last; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1732 |
return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1733 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1734 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1735 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1736 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1737 |
"PSEUDO": function( pseudo, argument ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1738 |
// pseudo-class names are case-insensitive |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1739 |
// http://www.w3.org/TR/selectors/#pseudo-classes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1740 |
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1741 |
// Remember that setFilters inherits from pseudos |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1742 |
var args, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1743 |
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1744 |
Sizzle.error( "unsupported pseudo: " + pseudo ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1745 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1746 |
// The user may use createPseudo to indicate that |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1747 |
// arguments are needed to create the filter function |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1748 |
// just as Sizzle does |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1749 |
if ( fn[ expando ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1750 |
return fn( argument ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1751 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1752 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1753 |
// But maintain support for old signatures |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1754 |
if ( fn.length > 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1755 |
args = [ pseudo, pseudo, "", argument ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1756 |
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1757 |
markFunction(function( seed, matches ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1758 |
var idx, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1759 |
matched = fn( seed, argument ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1760 |
i = matched.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1761 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1762 |
idx = indexOf.call( seed, matched[i] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1763 |
seed[ idx ] = !( matches[ idx ] = matched[i] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1764 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1765 |
}) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1766 |
function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1767 |
return fn( elem, 0, args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1768 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1769 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1770 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1771 |
return fn; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1772 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1773 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1774 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1775 |
pseudos: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1776 |
// Potentially complex pseudos |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1777 |
"not": markFunction(function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1778 |
// Trim the selector passed to compile |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1779 |
// to avoid treating leading and trailing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1780 |
// spaces as combinators |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1781 |
var input = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1782 |
results = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1783 |
matcher = compile( selector.replace( rtrim, "$1" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1784 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1785 |
return matcher[ expando ] ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1786 |
markFunction(function( seed, matches, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1787 |
var elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1788 |
unmatched = matcher( seed, null, xml, [] ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1789 |
i = seed.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1790 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1791 |
// Match elements unmatched by `matcher` |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1792 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1793 |
if ( (elem = unmatched[i]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1794 |
seed[i] = !(matches[i] = elem); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1795 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1796 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1797 |
}) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1798 |
function( elem, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1799 |
input[0] = elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1800 |
matcher( input, null, xml, results ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1801 |
return !results.pop(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1802 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1803 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1804 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1805 |
"has": markFunction(function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1806 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1807 |
return Sizzle( selector, elem ).length > 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1808 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1809 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1810 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1811 |
"contains": markFunction(function( text ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1812 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1813 |
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1814 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1815 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1816 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1817 |
// "Whether an element is represented by a :lang() selector |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1818 |
// is based solely on the element's language value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1819 |
// being equal to the identifier C, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1820 |
// or beginning with the identifier C immediately followed by "-". |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1821 |
// The matching of C against the element's language value is performed case-insensitively. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1822 |
// The identifier C does not have to be a valid language name." |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1823 |
// http://www.w3.org/TR/selectors/#lang-pseudo |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1824 |
"lang": markFunction( function( lang ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1825 |
// lang value must be a valid identifier |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1826 |
if ( !ridentifier.test(lang || "") ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1827 |
Sizzle.error( "unsupported lang: " + lang ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1828 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1829 |
lang = lang.replace( runescape, funescape ).toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1830 |
return function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1831 |
var elemLang; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1832 |
do { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1833 |
if ( (elemLang = documentIsHTML ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1834 |
elem.lang : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1835 |
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1836 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1837 |
elemLang = elemLang.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1838 |
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1839 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1840 |
} while ( (elem = elem.parentNode) && elem.nodeType === 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1841 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1842 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1843 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1844 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1845 |
// Miscellaneous |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1846 |
"target": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1847 |
var hash = window.location && window.location.hash; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1848 |
return hash && hash.slice( 1 ) === elem.id; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1849 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1850 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1851 |
"root": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1852 |
return elem === docElem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1853 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1854 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1855 |
"focus": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1856 |
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1857 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1858 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1859 |
// Boolean properties |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1860 |
"enabled": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1861 |
return elem.disabled === false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1862 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1863 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1864 |
"disabled": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1865 |
return elem.disabled === true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1866 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1867 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1868 |
"checked": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1869 |
// In CSS3, :checked should return both checked and selected elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1870 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1871 |
var nodeName = elem.nodeName.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1872 |
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1873 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1874 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1875 |
"selected": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1876 |
// Accessing this property makes selected-by-default |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1877 |
// options in Safari work properly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1878 |
if ( elem.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1879 |
elem.parentNode.selectedIndex; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1880 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1881 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1882 |
return elem.selected === true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1883 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1884 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1885 |
// Contents |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1886 |
"empty": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1887 |
// http://www.w3.org/TR/selectors/#empty-pseudo |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1888 |
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1889 |
// but not by others (comment: 8; processing instruction: 7; etc.) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1890 |
// nodeType < 6 works because attributes (2) do not appear as children |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1891 |
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1892 |
if ( elem.nodeType < 6 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1893 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1894 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1895 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1896 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1897 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1898 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1899 |
"parent": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1900 |
return !Expr.pseudos["empty"]( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1901 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1902 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1903 |
// Element/input types |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1904 |
"header": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1905 |
return rheader.test( elem.nodeName ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1906 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1907 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1908 |
"input": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1909 |
return rinputs.test( elem.nodeName ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1910 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1911 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1912 |
"button": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1913 |
var name = elem.nodeName.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1914 |
return name === "input" && elem.type === "button" || name === "button"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1915 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1916 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1917 |
"text": function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1918 |
var attr; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1919 |
return elem.nodeName.toLowerCase() === "input" && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1920 |
elem.type === "text" && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1921 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1922 |
// Support: IE<8 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1923 |
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1924 |
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1925 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1926 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1927 |
// Position-in-collection |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1928 |
"first": createPositionalPseudo(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1929 |
return [ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1930 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1931 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1932 |
"last": createPositionalPseudo(function( matchIndexes, length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1933 |
return [ length - 1 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1934 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1935 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1936 |
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1937 |
return [ argument < 0 ? argument + length : argument ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1938 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1939 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1940 |
"even": createPositionalPseudo(function( matchIndexes, length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1941 |
var i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1942 |
for ( ; i < length; i += 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1943 |
matchIndexes.push( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1944 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1945 |
return matchIndexes; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1946 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1947 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1948 |
"odd": createPositionalPseudo(function( matchIndexes, length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1949 |
var i = 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1950 |
for ( ; i < length; i += 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1951 |
matchIndexes.push( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1952 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1953 |
return matchIndexes; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1954 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1955 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1956 |
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1957 |
var i = argument < 0 ? argument + length : argument; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1958 |
for ( ; --i >= 0; ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1959 |
matchIndexes.push( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1960 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1961 |
return matchIndexes; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1962 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1963 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1964 |
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1965 |
var i = argument < 0 ? argument + length : argument; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1966 |
for ( ; ++i < length; ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1967 |
matchIndexes.push( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1968 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1969 |
return matchIndexes; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1970 |
}) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1971 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1972 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1973 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1974 |
Expr.pseudos["nth"] = Expr.pseudos["eq"]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1975 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1976 |
// Add button/input type pseudos |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1977 |
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1978 |
Expr.pseudos[ i ] = createInputPseudo( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1979 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1980 |
for ( i in { submit: true, reset: true } ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1981 |
Expr.pseudos[ i ] = createButtonPseudo( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1982 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1983 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1984 |
// Easy API for creating new setFilters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1985 |
function setFilters() {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1986 |
setFilters.prototype = Expr.filters = Expr.pseudos; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1987 |
Expr.setFilters = new setFilters(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1988 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1989 |
tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1990 |
var matched, match, tokens, type, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1991 |
soFar, groups, preFilters, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1992 |
cached = tokenCache[ selector + " " ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1993 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1994 |
if ( cached ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1995 |
return parseOnly ? 0 : cached.slice( 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1996 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1997 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1998 |
soFar = selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
1999 |
groups = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2000 |
preFilters = Expr.preFilter; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2001 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2002 |
while ( soFar ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2003 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2004 |
// Comma and first run |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2005 |
if ( !matched || (match = rcomma.exec( soFar )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2006 |
if ( match ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2007 |
// Don't consume trailing commas as valid |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2008 |
soFar = soFar.slice( match[0].length ) || soFar; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2009 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2010 |
groups.push( (tokens = []) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2011 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2012 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2013 |
matched = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2014 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2015 |
// Combinators |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2016 |
if ( (match = rcombinators.exec( soFar )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2017 |
matched = match.shift(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2018 |
tokens.push({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2019 |
value: matched, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2020 |
// Cast descendant combinators to space |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2021 |
type: match[0].replace( rtrim, " " ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2022 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2023 |
soFar = soFar.slice( matched.length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2024 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2025 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2026 |
// Filters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2027 |
for ( type in Expr.filter ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2028 |
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2029 |
(match = preFilters[ type ]( match ))) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2030 |
matched = match.shift(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2031 |
tokens.push({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2032 |
value: matched, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2033 |
type: type, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2034 |
matches: match |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2035 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2036 |
soFar = soFar.slice( matched.length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2037 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2038 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2039 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2040 |
if ( !matched ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2041 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2042 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2043 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2044 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2045 |
// Return the length of the invalid excess |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2046 |
// if we're just parsing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2047 |
// Otherwise, throw an error or return tokens |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2048 |
return parseOnly ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2049 |
soFar.length : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2050 |
soFar ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2051 |
Sizzle.error( selector ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2052 |
// Cache the tokens |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2053 |
tokenCache( selector, groups ).slice( 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2054 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2055 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2056 |
function toSelector( tokens ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2057 |
var i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2058 |
len = tokens.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2059 |
selector = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2060 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2061 |
selector += tokens[i].value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2062 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2063 |
return selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2064 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2065 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2066 |
function addCombinator( matcher, combinator, base ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2067 |
var dir = combinator.dir, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2068 |
checkNonElements = base && dir === "parentNode", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2069 |
doneName = done++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2070 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2071 |
return combinator.first ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2072 |
// Check against closest ancestor/preceding element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2073 |
function( elem, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2074 |
while ( (elem = elem[ dir ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2075 |
if ( elem.nodeType === 1 || checkNonElements ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2076 |
return matcher( elem, context, xml ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2077 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2078 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2079 |
} : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2080 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2081 |
// Check against all ancestor/preceding elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2082 |
function( elem, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2083 |
var oldCache, outerCache, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2084 |
newCache = [ dirruns, doneName ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2085 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2086 |
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2087 |
if ( xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2088 |
while ( (elem = elem[ dir ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2089 |
if ( elem.nodeType === 1 || checkNonElements ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2090 |
if ( matcher( elem, context, xml ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2091 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2092 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2093 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2094 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2095 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2096 |
while ( (elem = elem[ dir ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2097 |
if ( elem.nodeType === 1 || checkNonElements ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2098 |
outerCache = elem[ expando ] || (elem[ expando ] = {}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2099 |
if ( (oldCache = outerCache[ dir ]) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2100 |
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2101 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2102 |
// Assign to newCache so results back-propagate to previous elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2103 |
return (newCache[ 2 ] = oldCache[ 2 ]); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2104 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2105 |
// Reuse newcache so results back-propagate to previous elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2106 |
outerCache[ dir ] = newCache; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2107 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2108 |
// A match means we're done; a fail means we have to keep checking |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2109 |
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2110 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2111 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2112 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2113 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2114 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2115 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2116 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2117 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2118 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2119 |
function elementMatcher( matchers ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2120 |
return matchers.length > 1 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2121 |
function( elem, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2122 |
var i = matchers.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2123 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2124 |
if ( !matchers[i]( elem, context, xml ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2125 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2126 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2127 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2128 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2129 |
} : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2130 |
matchers[0]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2131 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2132 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2133 |
function multipleContexts( selector, contexts, results ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2134 |
var i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2135 |
len = contexts.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2136 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2137 |
Sizzle( selector, contexts[i], results ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2138 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2139 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2140 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2141 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2142 |
function condense( unmatched, map, filter, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2143 |
var elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2144 |
newUnmatched = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2145 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2146 |
len = unmatched.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2147 |
mapped = map != null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2148 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2149 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2150 |
if ( (elem = unmatched[i]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2151 |
if ( !filter || filter( elem, context, xml ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2152 |
newUnmatched.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2153 |
if ( mapped ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2154 |
map.push( i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2155 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2156 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2157 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2158 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2159 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2160 |
return newUnmatched; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2161 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2162 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2163 |
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2164 |
if ( postFilter && !postFilter[ expando ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2165 |
postFilter = setMatcher( postFilter ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2166 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2167 |
if ( postFinder && !postFinder[ expando ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2168 |
postFinder = setMatcher( postFinder, postSelector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2169 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2170 |
return markFunction(function( seed, results, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2171 |
var temp, i, elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2172 |
preMap = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2173 |
postMap = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2174 |
preexisting = results.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2175 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2176 |
// Get initial elements from seed or context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2177 |
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2178 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2179 |
// Prefilter to get matcher input, preserving a map for seed-results synchronization |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2180 |
matcherIn = preFilter && ( seed || !selector ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2181 |
condense( elems, preMap, preFilter, context, xml ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2182 |
elems, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2183 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2184 |
matcherOut = matcher ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2185 |
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2186 |
postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2187 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2188 |
// ...intermediate processing is necessary |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2189 |
[] : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2190 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2191 |
// ...otherwise use results directly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2192 |
results : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2193 |
matcherIn; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2194 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2195 |
// Find primary matches |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2196 |
if ( matcher ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2197 |
matcher( matcherIn, matcherOut, context, xml ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2198 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2199 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2200 |
// Apply postFilter |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2201 |
if ( postFilter ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2202 |
temp = condense( matcherOut, postMap ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2203 |
postFilter( temp, [], context, xml ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2204 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2205 |
// Un-match failing elements by moving them back to matcherIn |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2206 |
i = temp.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2207 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2208 |
if ( (elem = temp[i]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2209 |
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2210 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2211 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2212 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2213 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2214 |
if ( seed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2215 |
if ( postFinder || preFilter ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2216 |
if ( postFinder ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2217 |
// Get the final matcherOut by condensing this intermediate into postFinder contexts |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2218 |
temp = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2219 |
i = matcherOut.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2220 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2221 |
if ( (elem = matcherOut[i]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2222 |
// Restore matcherIn since elem is not yet a final match |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2223 |
temp.push( (matcherIn[i] = elem) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2224 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2225 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2226 |
postFinder( null, (matcherOut = []), temp, xml ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2227 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2228 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2229 |
// Move matched elements from seed to results to keep them synchronized |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2230 |
i = matcherOut.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2231 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2232 |
if ( (elem = matcherOut[i]) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2233 |
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2234 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2235 |
seed[temp] = !(results[temp] = elem); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2236 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2237 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2238 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2239 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2240 |
// Add elements to results, through postFinder if defined |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2241 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2242 |
matcherOut = condense( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2243 |
matcherOut === results ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2244 |
matcherOut.splice( preexisting, matcherOut.length ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2245 |
matcherOut |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2246 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2247 |
if ( postFinder ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2248 |
postFinder( null, results, matcherOut, xml ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2249 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2250 |
push.apply( results, matcherOut ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2251 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2252 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2253 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2254 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2255 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2256 |
function matcherFromTokens( tokens ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2257 |
var checkContext, matcher, j, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2258 |
len = tokens.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2259 |
leadingRelative = Expr.relative[ tokens[0].type ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2260 |
implicitRelative = leadingRelative || Expr.relative[" "], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2261 |
i = leadingRelative ? 1 : 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2262 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2263 |
// The foundational matcher ensures that elements are reachable from top-level context(s) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2264 |
matchContext = addCombinator( function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2265 |
return elem === checkContext; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2266 |
}, implicitRelative, true ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2267 |
matchAnyContext = addCombinator( function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2268 |
return indexOf.call( checkContext, elem ) > -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2269 |
}, implicitRelative, true ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2270 |
matchers = [ function( elem, context, xml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2271 |
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2272 |
(checkContext = context).nodeType ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2273 |
matchContext( elem, context, xml ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2274 |
matchAnyContext( elem, context, xml ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2275 |
} ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2276 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2277 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2278 |
if ( (matcher = Expr.relative[ tokens[i].type ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2279 |
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2280 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2281 |
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2282 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2283 |
// Return special upon seeing a positional matcher |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2284 |
if ( matcher[ expando ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2285 |
// Find the next relative operator (if any) for proper handling |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2286 |
j = ++i; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2287 |
for ( ; j < len; j++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2288 |
if ( Expr.relative[ tokens[j].type ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2289 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2290 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2291 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2292 |
return setMatcher( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2293 |
i > 1 && elementMatcher( matchers ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2294 |
i > 1 && toSelector( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2295 |
// If the preceding token was a descendant combinator, insert an implicit any-element `*` |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2296 |
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2297 |
).replace( rtrim, "$1" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2298 |
matcher, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2299 |
i < j && matcherFromTokens( tokens.slice( i, j ) ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2300 |
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2301 |
j < len && toSelector( tokens ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2302 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2303 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2304 |
matchers.push( matcher ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2305 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2306 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2307 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2308 |
return elementMatcher( matchers ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2309 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2310 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2311 |
function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2312 |
var bySet = setMatchers.length > 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2313 |
byElement = elementMatchers.length > 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2314 |
superMatcher = function( seed, context, xml, results, outermost ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2315 |
var elem, j, matcher, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2316 |
matchedCount = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2317 |
i = "0", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2318 |
unmatched = seed && [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2319 |
setMatched = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2320 |
contextBackup = outermostContext, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2321 |
// We must always have either seed elements or outermost context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2322 |
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2323 |
// Use integer dirruns iff this is the outermost matcher |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2324 |
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2325 |
len = elems.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2326 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2327 |
if ( outermost ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2328 |
outermostContext = context !== document && context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2329 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2330 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2331 |
// Add elements passing elementMatchers directly to results |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2332 |
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2333 |
// Support: IE<9, Safari |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2334 |
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2335 |
for ( ; i !== len && (elem = elems[i]) != null; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2336 |
if ( byElement && elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2337 |
j = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2338 |
while ( (matcher = elementMatchers[j++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2339 |
if ( matcher( elem, context, xml ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2340 |
results.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2341 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2342 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2343 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2344 |
if ( outermost ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2345 |
dirruns = dirrunsUnique; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2346 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2347 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2348 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2349 |
// Track unmatched elements for set filters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2350 |
if ( bySet ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2351 |
// They will have gone through all possible matchers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2352 |
if ( (elem = !matcher && elem) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2353 |
matchedCount--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2354 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2355 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2356 |
// Lengthen the array for every element, matched or not |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2357 |
if ( seed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2358 |
unmatched.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2359 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2360 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2361 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2362 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2363 |
// Apply set filters to unmatched elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2364 |
matchedCount += i; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2365 |
if ( bySet && i !== matchedCount ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2366 |
j = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2367 |
while ( (matcher = setMatchers[j++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2368 |
matcher( unmatched, setMatched, context, xml ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2369 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2370 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2371 |
if ( seed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2372 |
// Reintegrate element matches to eliminate the need for sorting |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2373 |
if ( matchedCount > 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2374 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2375 |
if ( !(unmatched[i] || setMatched[i]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2376 |
setMatched[i] = pop.call( results ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2377 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2378 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2379 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2380 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2381 |
// Discard index placeholder values to get only actual matches |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2382 |
setMatched = condense( setMatched ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2383 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2384 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2385 |
// Add matches to results |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2386 |
push.apply( results, setMatched ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2387 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2388 |
// Seedless set matches succeeding multiple successful matchers stipulate sorting |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2389 |
if ( outermost && !seed && setMatched.length > 0 && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2390 |
( matchedCount + setMatchers.length ) > 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2391 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2392 |
Sizzle.uniqueSort( results ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2393 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2394 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2395 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2396 |
// Override manipulation of globals by nested matchers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2397 |
if ( outermost ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2398 |
dirruns = dirrunsUnique; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2399 |
outermostContext = contextBackup; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2400 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2401 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2402 |
return unmatched; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2403 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2404 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2405 |
return bySet ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2406 |
markFunction( superMatcher ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2407 |
superMatcher; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2408 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2409 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2410 |
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2411 |
var i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2412 |
setMatchers = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2413 |
elementMatchers = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2414 |
cached = compilerCache[ selector + " " ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2415 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2416 |
if ( !cached ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2417 |
// Generate a function of recursive functions that can be used to check each element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2418 |
if ( !match ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2419 |
match = tokenize( selector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2420 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2421 |
i = match.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2422 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2423 |
cached = matcherFromTokens( match[i] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2424 |
if ( cached[ expando ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2425 |
setMatchers.push( cached ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2426 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2427 |
elementMatchers.push( cached ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2428 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2429 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2430 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2431 |
// Cache the compiled function |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2432 |
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2433 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2434 |
// Save selector and tokenization |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2435 |
cached.selector = selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2436 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2437 |
return cached; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2438 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2439 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2440 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2441 |
* A low-level selection function that works with Sizzle's compiled |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2442 |
* selector functions |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2443 |
* @param {String|Function} selector A selector or a pre-compiled |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2444 |
* selector function built with Sizzle.compile |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2445 |
* @param {Element} context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2446 |
* @param {Array} [results] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2447 |
* @param {Array} [seed] A set of elements to match against |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2448 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2449 |
select = Sizzle.select = function( selector, context, results, seed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2450 |
var i, tokens, token, type, find, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2451 |
compiled = typeof selector === "function" && selector, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2452 |
match = !seed && tokenize( (selector = compiled.selector || selector) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2453 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2454 |
results = results || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2455 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2456 |
// Try to minimize operations if there is no seed and only one group |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2457 |
if ( match.length === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2458 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2459 |
// Take a shortcut and set the context if the root selector is an ID |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2460 |
tokens = match[0] = match[0].slice( 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2461 |
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2462 |
support.getById && context.nodeType === 9 && documentIsHTML && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2463 |
Expr.relative[ tokens[1].type ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2464 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2465 |
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2466 |
if ( !context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2467 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2468 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2469 |
// Precompiled matchers will still verify ancestry, so step up a level |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2470 |
} else if ( compiled ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2471 |
context = context.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2472 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2473 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2474 |
selector = selector.slice( tokens.shift().value.length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2475 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2476 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2477 |
// Fetch a seed set for right-to-left matching |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2478 |
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2479 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2480 |
token = tokens[i]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2481 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2482 |
// Abort if we hit a combinator |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2483 |
if ( Expr.relative[ (type = token.type) ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2484 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2485 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2486 |
if ( (find = Expr.find[ type ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2487 |
// Search, expanding context for leading sibling combinators |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2488 |
if ( (seed = find( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2489 |
token.matches[0].replace( runescape, funescape ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2490 |
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2491 |
)) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2492 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2493 |
// If seed is empty or no tokens remain, we can return early |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2494 |
tokens.splice( i, 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2495 |
selector = seed.length && toSelector( tokens ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2496 |
if ( !selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2497 |
push.apply( results, seed ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2498 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2499 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2500 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2501 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2502 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2503 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2504 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2505 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2506 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2507 |
// Compile and execute a filtering function if one is not provided |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2508 |
// Provide `match` to avoid retokenization if we modified the selector above |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2509 |
( compiled || compile( selector, match ) )( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2510 |
seed, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2511 |
context, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2512 |
!documentIsHTML, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2513 |
results, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2514 |
rsibling.test( selector ) && testContext( context.parentNode ) || context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2515 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2516 |
return results; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2517 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2518 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2519 |
// One-time assignments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2520 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2521 |
// Sort stability |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2522 |
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2523 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2524 |
// Support: Chrome<14 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2525 |
// Always assume duplicates if they aren't passed to the comparison function |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2526 |
support.detectDuplicates = !!hasDuplicate; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2527 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2528 |
// Initialize against the default document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2529 |
setDocument(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2530 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2531 |
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2532 |
// Detached nodes confoundingly follow *each other* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2533 |
support.sortDetached = assert(function( div1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2534 |
// Should return 1, but returns 4 (following) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2535 |
return div1.compareDocumentPosition( document.createElement("div") ) & 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2536 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2537 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2538 |
// Support: IE<8 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2539 |
// Prevent attribute/property "interpolation" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2540 |
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2541 |
if ( !assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2542 |
div.innerHTML = "<a href='#'></a>"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2543 |
return div.firstChild.getAttribute("href") === "#" ; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2544 |
}) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2545 |
addHandle( "type|href|height|width", function( elem, name, isXML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2546 |
if ( !isXML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2547 |
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2548 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2549 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2550 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2551 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2552 |
// Support: IE<9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2553 |
// Use defaultValue in place of getAttribute("value") |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2554 |
if ( !support.attributes || !assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2555 |
div.innerHTML = "<input/>"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2556 |
div.firstChild.setAttribute( "value", "" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2557 |
return div.firstChild.getAttribute( "value" ) === ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2558 |
}) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2559 |
addHandle( "value", function( elem, name, isXML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2560 |
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2561 |
return elem.defaultValue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2562 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2563 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2564 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2565 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2566 |
// Support: IE<9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2567 |
// Use getAttributeNode to fetch booleans when getAttribute lies |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2568 |
if ( !assert(function( div ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2569 |
return div.getAttribute("disabled") == null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2570 |
}) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2571 |
addHandle( booleans, function( elem, name, isXML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2572 |
var val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2573 |
if ( !isXML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2574 |
return elem[ name ] === true ? name.toLowerCase() : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2575 |
(val = elem.getAttributeNode( name )) && val.specified ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2576 |
val.value : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2577 |
null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2578 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2579 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2580 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2581 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2582 |
return Sizzle; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2583 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2584 |
})( window ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2585 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2586 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2587 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2588 |
jQuery.find = Sizzle; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2589 |
jQuery.expr = Sizzle.selectors; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2590 |
jQuery.expr[":"] = jQuery.expr.pseudos; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2591 |
jQuery.unique = Sizzle.uniqueSort; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2592 |
jQuery.text = Sizzle.getText; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2593 |
jQuery.isXMLDoc = Sizzle.isXML; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2594 |
jQuery.contains = Sizzle.contains; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2595 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2596 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2597 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2598 |
var rneedsContext = jQuery.expr.match.needsContext; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2599 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2600 |
var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2601 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2602 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2603 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2604 |
var risSimple = /^.[^:#\[\.,]*$/; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2605 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2606 |
// Implement the identical functionality for filter and not |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2607 |
function winnow( elements, qualifier, not ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2608 |
if ( jQuery.isFunction( qualifier ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2609 |
return jQuery.grep( elements, function( elem, i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2610 |
/* jshint -W018 */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2611 |
return !!qualifier.call( elem, i, elem ) !== not; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2612 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2613 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2614 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2615 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2616 |
if ( qualifier.nodeType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2617 |
return jQuery.grep( elements, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2618 |
return ( elem === qualifier ) !== not; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2619 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2620 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2621 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2622 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2623 |
if ( typeof qualifier === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2624 |
if ( risSimple.test( qualifier ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2625 |
return jQuery.filter( qualifier, elements, not ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2626 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2627 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2628 |
qualifier = jQuery.filter( qualifier, elements ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2629 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2630 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2631 |
return jQuery.grep( elements, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2632 |
return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2633 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2634 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2635 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2636 |
jQuery.filter = function( expr, elems, not ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2637 |
var elem = elems[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2638 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2639 |
if ( not ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2640 |
expr = ":not(" + expr + ")"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2641 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2642 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2643 |
return elems.length === 1 && elem.nodeType === 1 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2644 |
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2645 |
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2646 |
return elem.nodeType === 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2647 |
})); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2648 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2649 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2650 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2651 |
find: function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2652 |
var i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2653 |
len = this.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2654 |
ret = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2655 |
self = this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2656 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2657 |
if ( typeof selector !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2658 |
return this.pushStack( jQuery( selector ).filter(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2659 |
for ( i = 0; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2660 |
if ( jQuery.contains( self[ i ], this ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2661 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2662 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2663 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2664 |
}) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2665 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2666 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2667 |
for ( i = 0; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2668 |
jQuery.find( selector, self[ i ], ret ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2669 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2670 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2671 |
// Needed because $( selector, context ) becomes $( context ).find( selector ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2672 |
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2673 |
ret.selector = this.selector ? this.selector + " " + selector : selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2674 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2675 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2676 |
filter: function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2677 |
return this.pushStack( winnow(this, selector || [], false) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2678 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2679 |
not: function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2680 |
return this.pushStack( winnow(this, selector || [], true) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2681 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2682 |
is: function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2683 |
return !!winnow( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2684 |
this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2685 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2686 |
// If this is a positional/relative selector, check membership in the returned set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2687 |
// so $("p:first").is("p:last") won't return true for a doc with two "p". |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2688 |
typeof selector === "string" && rneedsContext.test( selector ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2689 |
jQuery( selector ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2690 |
selector || [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2691 |
false |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2692 |
).length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2693 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2694 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2695 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2696 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2697 |
// Initialize a jQuery object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2698 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2699 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2700 |
// A central reference to the root jQuery(document) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2701 |
var rootjQuery, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2702 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2703 |
// A simple way to check for HTML strings |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2704 |
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2705 |
// Strict HTML recognition (#11290: must start with <) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2706 |
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2707 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2708 |
init = jQuery.fn.init = function( selector, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2709 |
var match, elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2710 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2711 |
// HANDLE: $(""), $(null), $(undefined), $(false) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2712 |
if ( !selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2713 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2714 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2715 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2716 |
// Handle HTML strings |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2717 |
if ( typeof selector === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2718 |
if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2719 |
// Assume that strings that start and end with <> are HTML and skip the regex check |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2720 |
match = [ null, selector, null ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2721 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2722 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2723 |
match = rquickExpr.exec( selector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2724 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2725 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2726 |
// Match html or make sure no context is specified for #id |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2727 |
if ( match && (match[1] || !context) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2728 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2729 |
// HANDLE: $(html) -> $(array) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2730 |
if ( match[1] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2731 |
context = context instanceof jQuery ? context[0] : context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2732 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2733 |
// scripts is true for back-compat |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2734 |
// Intentionally let the error be thrown if parseHTML is not present |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2735 |
jQuery.merge( this, jQuery.parseHTML( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2736 |
match[1], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2737 |
context && context.nodeType ? context.ownerDocument || context : document, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2738 |
true |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2739 |
) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2740 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2741 |
// HANDLE: $(html, props) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2742 |
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2743 |
for ( match in context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2744 |
// Properties of context are called as methods if possible |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2745 |
if ( jQuery.isFunction( this[ match ] ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2746 |
this[ match ]( context[ match ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2747 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2748 |
// ...and otherwise set as attributes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2749 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2750 |
this.attr( match, context[ match ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2751 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2752 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2753 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2754 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2755 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2756 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2757 |
// HANDLE: $(#id) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2758 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2759 |
elem = document.getElementById( match[2] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2760 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2761 |
// Check parentNode to catch when Blackberry 4.6 returns |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2762 |
// nodes that are no longer in the document #6963 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2763 |
if ( elem && elem.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2764 |
// Inject the element directly into the jQuery object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2765 |
this.length = 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2766 |
this[0] = elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2767 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2768 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2769 |
this.context = document; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2770 |
this.selector = selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2771 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2772 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2773 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2774 |
// HANDLE: $(expr, $(...)) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2775 |
} else if ( !context || context.jquery ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2776 |
return ( context || rootjQuery ).find( selector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2777 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2778 |
// HANDLE: $(expr, context) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2779 |
// (which is just equivalent to: $(context).find(expr) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2780 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2781 |
return this.constructor( context ).find( selector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2782 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2783 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2784 |
// HANDLE: $(DOMElement) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2785 |
} else if ( selector.nodeType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2786 |
this.context = this[0] = selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2787 |
this.length = 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2788 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2789 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2790 |
// HANDLE: $(function) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2791 |
// Shortcut for document ready |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2792 |
} else if ( jQuery.isFunction( selector ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2793 |
return typeof rootjQuery.ready !== "undefined" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2794 |
rootjQuery.ready( selector ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2795 |
// Execute immediately if ready is not present |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2796 |
selector( jQuery ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2797 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2798 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2799 |
if ( selector.selector !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2800 |
this.selector = selector.selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2801 |
this.context = selector.context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2802 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2803 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2804 |
return jQuery.makeArray( selector, this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2805 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2806 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2807 |
// Give the init function the jQuery prototype for later instantiation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2808 |
init.prototype = jQuery.fn; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2809 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2810 |
// Initialize central reference |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2811 |
rootjQuery = jQuery( document ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2812 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2813 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2814 |
var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2815 |
// methods guaranteed to produce a unique set when starting from a unique set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2816 |
guaranteedUnique = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2817 |
children: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2818 |
contents: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2819 |
next: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2820 |
prev: true |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2821 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2822 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2823 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2824 |
dir: function( elem, dir, until ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2825 |
var matched = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2826 |
truncate = until !== undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2827 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2828 |
while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2829 |
if ( elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2830 |
if ( truncate && jQuery( elem ).is( until ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2831 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2832 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2833 |
matched.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2834 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2835 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2836 |
return matched; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2837 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2838 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2839 |
sibling: function( n, elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2840 |
var matched = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2841 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2842 |
for ( ; n; n = n.nextSibling ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2843 |
if ( n.nodeType === 1 && n !== elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2844 |
matched.push( n ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2845 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2846 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2847 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2848 |
return matched; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2849 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2850 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2851 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2852 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2853 |
has: function( target ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2854 |
var targets = jQuery( target, this ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2855 |
l = targets.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2856 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2857 |
return this.filter(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2858 |
var i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2859 |
for ( ; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2860 |
if ( jQuery.contains( this, targets[i] ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2861 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2862 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2863 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2864 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2865 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2866 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2867 |
closest: function( selectors, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2868 |
var cur, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2869 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2870 |
l = this.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2871 |
matched = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2872 |
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2873 |
jQuery( selectors, context || this.context ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2874 |
0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2875 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2876 |
for ( ; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2877 |
for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2878 |
// Always skip document fragments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2879 |
if ( cur.nodeType < 11 && (pos ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2880 |
pos.index(cur) > -1 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2881 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2882 |
// Don't pass non-elements to Sizzle |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2883 |
cur.nodeType === 1 && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2884 |
jQuery.find.matchesSelector(cur, selectors)) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2885 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2886 |
matched.push( cur ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2887 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2888 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2889 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2890 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2891 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2892 |
return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2893 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2894 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2895 |
// Determine the position of an element within |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2896 |
// the matched set of elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2897 |
index: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2898 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2899 |
// No argument, return index in parent |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2900 |
if ( !elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2901 |
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2902 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2903 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2904 |
// index in selector |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2905 |
if ( typeof elem === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2906 |
return indexOf.call( jQuery( elem ), this[ 0 ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2907 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2908 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2909 |
// Locate the position of the desired element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2910 |
return indexOf.call( this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2911 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2912 |
// If it receives a jQuery object, the first element is used |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2913 |
elem.jquery ? elem[ 0 ] : elem |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2914 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2915 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2916 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2917 |
add: function( selector, context ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2918 |
return this.pushStack( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2919 |
jQuery.unique( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2920 |
jQuery.merge( this.get(), jQuery( selector, context ) ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2921 |
) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2922 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2923 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2924 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2925 |
addBack: function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2926 |
return this.add( selector == null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2927 |
this.prevObject : this.prevObject.filter(selector) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2928 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2929 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2930 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2931 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2932 |
function sibling( cur, dir ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2933 |
while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2934 |
return cur; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2935 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2936 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2937 |
jQuery.each({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2938 |
parent: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2939 |
var parent = elem.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2940 |
return parent && parent.nodeType !== 11 ? parent : null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2941 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2942 |
parents: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2943 |
return jQuery.dir( elem, "parentNode" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2944 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2945 |
parentsUntil: function( elem, i, until ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2946 |
return jQuery.dir( elem, "parentNode", until ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2947 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2948 |
next: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2949 |
return sibling( elem, "nextSibling" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2950 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2951 |
prev: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2952 |
return sibling( elem, "previousSibling" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2953 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2954 |
nextAll: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2955 |
return jQuery.dir( elem, "nextSibling" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2956 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2957 |
prevAll: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2958 |
return jQuery.dir( elem, "previousSibling" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2959 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2960 |
nextUntil: function( elem, i, until ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2961 |
return jQuery.dir( elem, "nextSibling", until ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2962 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2963 |
prevUntil: function( elem, i, until ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2964 |
return jQuery.dir( elem, "previousSibling", until ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2965 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2966 |
siblings: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2967 |
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2968 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2969 |
children: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2970 |
return jQuery.sibling( elem.firstChild ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2971 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2972 |
contents: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2973 |
return elem.contentDocument || jQuery.merge( [], elem.childNodes ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2974 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2975 |
}, function( name, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2976 |
jQuery.fn[ name ] = function( until, selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2977 |
var matched = jQuery.map( this, fn, until ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2978 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2979 |
if ( name.slice( -5 ) !== "Until" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2980 |
selector = until; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2981 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2982 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2983 |
if ( selector && typeof selector === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2984 |
matched = jQuery.filter( selector, matched ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2985 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2986 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2987 |
if ( this.length > 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2988 |
// Remove duplicates |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2989 |
if ( !guaranteedUnique[ name ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2990 |
jQuery.unique( matched ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2991 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2992 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2993 |
// Reverse order for parents* and prev-derivatives |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2994 |
if ( rparentsprev.test( name ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2995 |
matched.reverse(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2996 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2997 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2998 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
2999 |
return this.pushStack( matched ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3000 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3001 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3002 |
var rnotwhite = (/\S+/g); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3003 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3004 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3005 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3006 |
// String to Object options format cache |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3007 |
var optionsCache = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3008 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3009 |
// Convert String-formatted options into Object-formatted ones and store in cache |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3010 |
function createOptions( options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3011 |
var object = optionsCache[ options ] = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3012 |
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3013 |
object[ flag ] = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3014 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3015 |
return object; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3016 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3017 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3018 |
/* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3019 |
* Create a callback list using the following parameters: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3020 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3021 |
* options: an optional list of space-separated options that will change how |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3022 |
* the callback list behaves or a more traditional option object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3023 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3024 |
* By default a callback list will act like an event callback list and can be |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3025 |
* "fired" multiple times. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3026 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3027 |
* Possible options: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3028 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3029 |
* once: will ensure the callback list can only be fired once (like a Deferred) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3030 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3031 |
* memory: will keep track of previous values and will call any callback added |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3032 |
* after the list has been fired right away with the latest "memorized" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3033 |
* values (like a Deferred) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3034 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3035 |
* unique: will ensure a callback can only be added once (no duplicate in the list) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3036 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3037 |
* stopOnFalse: interrupt callings when a callback returns false |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3038 |
* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3039 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3040 |
jQuery.Callbacks = function( options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3041 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3042 |
// Convert options from String-formatted to Object-formatted if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3043 |
// (we check in cache first) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3044 |
options = typeof options === "string" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3045 |
( optionsCache[ options ] || createOptions( options ) ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3046 |
jQuery.extend( {}, options ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3047 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3048 |
var // Last fire value (for non-forgettable lists) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3049 |
memory, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3050 |
// Flag to know if list was already fired |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3051 |
fired, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3052 |
// Flag to know if list is currently firing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3053 |
firing, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3054 |
// First callback to fire (used internally by add and fireWith) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3055 |
firingStart, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3056 |
// End of the loop when firing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3057 |
firingLength, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3058 |
// Index of currently firing callback (modified by remove if needed) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3059 |
firingIndex, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3060 |
// Actual callback list |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3061 |
list = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3062 |
// Stack of fire calls for repeatable lists |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3063 |
stack = !options.once && [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3064 |
// Fire callbacks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3065 |
fire = function( data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3066 |
memory = options.memory && data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3067 |
fired = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3068 |
firingIndex = firingStart || 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3069 |
firingStart = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3070 |
firingLength = list.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3071 |
firing = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3072 |
for ( ; list && firingIndex < firingLength; firingIndex++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3073 |
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3074 |
memory = false; // To prevent further calls using add |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3075 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3076 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3077 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3078 |
firing = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3079 |
if ( list ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3080 |
if ( stack ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3081 |
if ( stack.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3082 |
fire( stack.shift() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3083 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3084 |
} else if ( memory ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3085 |
list = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3086 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3087 |
self.disable(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3088 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3089 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3090 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3091 |
// Actual Callbacks object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3092 |
self = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3093 |
// Add a callback or a collection of callbacks to the list |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3094 |
add: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3095 |
if ( list ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3096 |
// First, we save the current length |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3097 |
var start = list.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3098 |
(function add( args ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3099 |
jQuery.each( args, function( _, arg ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3100 |
var type = jQuery.type( arg ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3101 |
if ( type === "function" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3102 |
if ( !options.unique || !self.has( arg ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3103 |
list.push( arg ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3104 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3105 |
} else if ( arg && arg.length && type !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3106 |
// Inspect recursively |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3107 |
add( arg ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3108 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3109 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3110 |
})( arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3111 |
// Do we need to add the callbacks to the |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3112 |
// current firing batch? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3113 |
if ( firing ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3114 |
firingLength = list.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3115 |
// With memory, if we're not firing then |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3116 |
// we should call right away |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3117 |
} else if ( memory ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3118 |
firingStart = start; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3119 |
fire( memory ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3120 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3121 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3122 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3123 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3124 |
// Remove a callback from the list |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3125 |
remove: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3126 |
if ( list ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3127 |
jQuery.each( arguments, function( _, arg ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3128 |
var index; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3129 |
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3130 |
list.splice( index, 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3131 |
// Handle firing indexes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3132 |
if ( firing ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3133 |
if ( index <= firingLength ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3134 |
firingLength--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3135 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3136 |
if ( index <= firingIndex ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3137 |
firingIndex--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3138 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3139 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3140 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3141 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3142 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3143 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3144 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3145 |
// Check if a given callback is in the list. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3146 |
// If no argument is given, return whether or not list has callbacks attached. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3147 |
has: function( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3148 |
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3149 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3150 |
// Remove all callbacks from the list |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3151 |
empty: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3152 |
list = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3153 |
firingLength = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3154 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3155 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3156 |
// Have the list do nothing anymore |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3157 |
disable: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3158 |
list = stack = memory = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3159 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3160 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3161 |
// Is it disabled? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3162 |
disabled: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3163 |
return !list; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3164 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3165 |
// Lock the list in its current state |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3166 |
lock: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3167 |
stack = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3168 |
if ( !memory ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3169 |
self.disable(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3170 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3171 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3172 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3173 |
// Is it locked? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3174 |
locked: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3175 |
return !stack; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3176 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3177 |
// Call all callbacks with the given context and arguments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3178 |
fireWith: function( context, args ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3179 |
if ( list && ( !fired || stack ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3180 |
args = args || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3181 |
args = [ context, args.slice ? args.slice() : args ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3182 |
if ( firing ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3183 |
stack.push( args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3184 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3185 |
fire( args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3186 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3187 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3188 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3189 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3190 |
// Call all the callbacks with the given arguments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3191 |
fire: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3192 |
self.fireWith( this, arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3193 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3194 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3195 |
// To know if the callbacks have already been called at least once |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3196 |
fired: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3197 |
return !!fired; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3198 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3199 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3200 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3201 |
return self; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3202 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3203 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3204 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3205 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3206 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3207 |
Deferred: function( func ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3208 |
var tuples = [ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3209 |
// action, add listener, listener list, final state |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3210 |
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3211 |
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3212 |
[ "notify", "progress", jQuery.Callbacks("memory") ] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3213 |
], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3214 |
state = "pending", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3215 |
promise = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3216 |
state: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3217 |
return state; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3218 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3219 |
always: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3220 |
deferred.done( arguments ).fail( arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3221 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3222 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3223 |
then: function( /* fnDone, fnFail, fnProgress */ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3224 |
var fns = arguments; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3225 |
return jQuery.Deferred(function( newDefer ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3226 |
jQuery.each( tuples, function( i, tuple ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3227 |
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3228 |
// deferred[ done | fail | progress ] for forwarding actions to newDefer |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3229 |
deferred[ tuple[1] ](function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3230 |
var returned = fn && fn.apply( this, arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3231 |
if ( returned && jQuery.isFunction( returned.promise ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3232 |
returned.promise() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3233 |
.done( newDefer.resolve ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3234 |
.fail( newDefer.reject ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3235 |
.progress( newDefer.notify ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3236 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3237 |
newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3238 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3239 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3240 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3241 |
fns = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3242 |
}).promise(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3243 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3244 |
// Get a promise for this deferred |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3245 |
// If obj is provided, the promise aspect is added to the object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3246 |
promise: function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3247 |
return obj != null ? jQuery.extend( obj, promise ) : promise; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3248 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3249 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3250 |
deferred = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3251 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3252 |
// Keep pipe for back-compat |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3253 |
promise.pipe = promise.then; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3254 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3255 |
// Add list-specific methods |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3256 |
jQuery.each( tuples, function( i, tuple ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3257 |
var list = tuple[ 2 ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3258 |
stateString = tuple[ 3 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3259 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3260 |
// promise[ done | fail | progress ] = list.add |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3261 |
promise[ tuple[1] ] = list.add; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3262 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3263 |
// Handle state |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3264 |
if ( stateString ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3265 |
list.add(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3266 |
// state = [ resolved | rejected ] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3267 |
state = stateString; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3268 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3269 |
// [ reject_list | resolve_list ].disable; progress_list.lock |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3270 |
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3271 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3272 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3273 |
// deferred[ resolve | reject | notify ] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3274 |
deferred[ tuple[0] ] = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3275 |
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3276 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3277 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3278 |
deferred[ tuple[0] + "With" ] = list.fireWith; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3279 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3280 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3281 |
// Make the deferred a promise |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3282 |
promise.promise( deferred ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3283 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3284 |
// Call given func if any |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3285 |
if ( func ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3286 |
func.call( deferred, deferred ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3287 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3288 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3289 |
// All done! |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3290 |
return deferred; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3291 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3292 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3293 |
// Deferred helper |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3294 |
when: function( subordinate /* , ..., subordinateN */ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3295 |
var i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3296 |
resolveValues = slice.call( arguments ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3297 |
length = resolveValues.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3298 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3299 |
// the count of uncompleted subordinates |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3300 |
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3301 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3302 |
// the master Deferred. If resolveValues consist of only a single Deferred, just use that. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3303 |
deferred = remaining === 1 ? subordinate : jQuery.Deferred(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3304 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3305 |
// Update function for both resolve and progress values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3306 |
updateFunc = function( i, contexts, values ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3307 |
return function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3308 |
contexts[ i ] = this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3309 |
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3310 |
if ( values === progressValues ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3311 |
deferred.notifyWith( contexts, values ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3312 |
} else if ( !( --remaining ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3313 |
deferred.resolveWith( contexts, values ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3314 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3315 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3316 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3317 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3318 |
progressValues, progressContexts, resolveContexts; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3319 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3320 |
// add listeners to Deferred subordinates; treat others as resolved |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3321 |
if ( length > 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3322 |
progressValues = new Array( length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3323 |
progressContexts = new Array( length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3324 |
resolveContexts = new Array( length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3325 |
for ( ; i < length; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3326 |
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3327 |
resolveValues[ i ].promise() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3328 |
.done( updateFunc( i, resolveContexts, resolveValues ) ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3329 |
.fail( deferred.reject ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3330 |
.progress( updateFunc( i, progressContexts, progressValues ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3331 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3332 |
--remaining; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3333 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3334 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3335 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3336 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3337 |
// if we're not waiting on anything, resolve the master |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3338 |
if ( !remaining ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3339 |
deferred.resolveWith( resolveContexts, resolveValues ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3340 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3341 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3342 |
return deferred.promise(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3343 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3344 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3345 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3346 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3347 |
// The deferred used on DOM ready |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3348 |
var readyList; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3349 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3350 |
jQuery.fn.ready = function( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3351 |
// Add the callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3352 |
jQuery.ready.promise().done( fn ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3353 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3354 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3355 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3356 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3357 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3358 |
// Is the DOM ready to be used? Set to true once it occurs. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3359 |
isReady: false, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3360 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3361 |
// A counter to track how many items to wait for before |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3362 |
// the ready event fires. See #6781 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3363 |
readyWait: 1, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3364 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3365 |
// Hold (or release) the ready event |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3366 |
holdReady: function( hold ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3367 |
if ( hold ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3368 |
jQuery.readyWait++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3369 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3370 |
jQuery.ready( true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3371 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3372 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3373 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3374 |
// Handle when the DOM is ready |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3375 |
ready: function( wait ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3376 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3377 |
// Abort if there are pending holds or we're already ready |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3378 |
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3379 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3380 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3381 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3382 |
// Remember that the DOM is ready |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3383 |
jQuery.isReady = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3384 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3385 |
// If a normal DOM Ready event fired, decrement, and wait if need be |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3386 |
if ( wait !== true && --jQuery.readyWait > 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3387 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3388 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3389 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3390 |
// If there are functions bound, to execute |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3391 |
readyList.resolveWith( document, [ jQuery ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3392 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3393 |
// Trigger any bound ready events |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3394 |
if ( jQuery.fn.triggerHandler ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3395 |
jQuery( document ).triggerHandler( "ready" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3396 |
jQuery( document ).off( "ready" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3397 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3398 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3399 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3400 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3401 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3402 |
* The ready event handler and self cleanup method |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3403 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3404 |
function completed() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3405 |
document.removeEventListener( "DOMContentLoaded", completed, false ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3406 |
window.removeEventListener( "load", completed, false ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3407 |
jQuery.ready(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3408 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3409 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3410 |
jQuery.ready.promise = function( obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3411 |
if ( !readyList ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3412 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3413 |
readyList = jQuery.Deferred(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3414 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3415 |
// Catch cases where $(document).ready() is called after the browser event has already occurred. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3416 |
// we once tried to use readyState "interactive" here, but it caused issues like the one |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3417 |
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3418 |
if ( document.readyState === "complete" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3419 |
// Handle it asynchronously to allow scripts the opportunity to delay ready |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3420 |
setTimeout( jQuery.ready ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3421 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3422 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3423 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3424 |
// Use the handy event callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3425 |
document.addEventListener( "DOMContentLoaded", completed, false ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3426 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3427 |
// A fallback to window.onload, that will always work |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3428 |
window.addEventListener( "load", completed, false ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3429 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3430 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3431 |
return readyList.promise( obj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3432 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3433 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3434 |
// Kick off the DOM ready check even if the user does not |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3435 |
jQuery.ready.promise(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3436 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3437 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3438 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3439 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3440 |
// Multifunctional method to get and set values of a collection |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3441 |
// The value/s can optionally be executed if it's a function |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3442 |
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3443 |
var i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3444 |
len = elems.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3445 |
bulk = key == null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3446 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3447 |
// Sets many values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3448 |
if ( jQuery.type( key ) === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3449 |
chainable = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3450 |
for ( i in key ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3451 |
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3452 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3453 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3454 |
// Sets one value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3455 |
} else if ( value !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3456 |
chainable = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3457 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3458 |
if ( !jQuery.isFunction( value ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3459 |
raw = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3460 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3461 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3462 |
if ( bulk ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3463 |
// Bulk operations run against the entire set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3464 |
if ( raw ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3465 |
fn.call( elems, value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3466 |
fn = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3467 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3468 |
// ...except when executing function values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3469 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3470 |
bulk = fn; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3471 |
fn = function( elem, key, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3472 |
return bulk.call( jQuery( elem ), value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3473 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3474 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3475 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3476 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3477 |
if ( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3478 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3479 |
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3480 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3481 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3482 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3483 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3484 |
return chainable ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3485 |
elems : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3486 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3487 |
// Gets |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3488 |
bulk ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3489 |
fn.call( elems ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3490 |
len ? fn( elems[0], key ) : emptyGet; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3491 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3492 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3493 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3494 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3495 |
* Determines whether an object can have data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3496 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3497 |
jQuery.acceptData = function( owner ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3498 |
// Accepts only: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3499 |
// - Node |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3500 |
// - Node.ELEMENT_NODE |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3501 |
// - Node.DOCUMENT_NODE |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3502 |
// - Object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3503 |
// - Any |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3504 |
/* jshint -W018 */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3505 |
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3506 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3507 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3508 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3509 |
function Data() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3510 |
// Support: Android < 4, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3511 |
// Old WebKit does not have Object.preventExtensions/freeze method, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3512 |
// return new empty object instead with no [[set]] accessor |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3513 |
Object.defineProperty( this.cache = {}, 0, { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3514 |
get: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3515 |
return {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3516 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3517 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3518 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3519 |
this.expando = jQuery.expando + Math.random(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3520 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3521 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3522 |
Data.uid = 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3523 |
Data.accepts = jQuery.acceptData; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3524 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3525 |
Data.prototype = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3526 |
key: function( owner ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3527 |
// We can accept data for non-element nodes in modern browsers, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3528 |
// but we should not, see #8335. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3529 |
// Always return the key for a frozen object. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3530 |
if ( !Data.accepts( owner ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3531 |
return 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3532 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3533 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3534 |
var descriptor = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3535 |
// Check if the owner object already has a cache key |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3536 |
unlock = owner[ this.expando ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3537 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3538 |
// If not, create one |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3539 |
if ( !unlock ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3540 |
unlock = Data.uid++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3541 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3542 |
// Secure it in a non-enumerable, non-writable property |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3543 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3544 |
descriptor[ this.expando ] = { value: unlock }; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3545 |
Object.defineProperties( owner, descriptor ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3546 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3547 |
// Support: Android < 4 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3548 |
// Fallback to a less secure definition |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3549 |
} catch ( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3550 |
descriptor[ this.expando ] = unlock; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3551 |
jQuery.extend( owner, descriptor ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3552 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3553 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3554 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3555 |
// Ensure the cache object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3556 |
if ( !this.cache[ unlock ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3557 |
this.cache[ unlock ] = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3558 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3559 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3560 |
return unlock; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3561 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3562 |
set: function( owner, data, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3563 |
var prop, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3564 |
// There may be an unlock assigned to this node, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3565 |
// if there is no entry for this "owner", create one inline |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3566 |
// and set the unlock as though an owner entry had always existed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3567 |
unlock = this.key( owner ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3568 |
cache = this.cache[ unlock ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3569 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3570 |
// Handle: [ owner, key, value ] args |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3571 |
if ( typeof data === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3572 |
cache[ data ] = value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3573 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3574 |
// Handle: [ owner, { properties } ] args |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3575 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3576 |
// Fresh assignments by object are shallow copied |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3577 |
if ( jQuery.isEmptyObject( cache ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3578 |
jQuery.extend( this.cache[ unlock ], data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3579 |
// Otherwise, copy the properties one-by-one to the cache object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3580 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3581 |
for ( prop in data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3582 |
cache[ prop ] = data[ prop ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3583 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3584 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3585 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3586 |
return cache; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3587 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3588 |
get: function( owner, key ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3589 |
// Either a valid cache is found, or will be created. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3590 |
// New caches will be created and the unlock returned, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3591 |
// allowing direct access to the newly created |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3592 |
// empty data object. A valid owner object must be provided. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3593 |
var cache = this.cache[ this.key( owner ) ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3594 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3595 |
return key === undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3596 |
cache : cache[ key ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3597 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3598 |
access: function( owner, key, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3599 |
var stored; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3600 |
// In cases where either: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3601 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3602 |
// 1. No key was specified |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3603 |
// 2. A string key was specified, but no value provided |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3604 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3605 |
// Take the "read" path and allow the get method to determine |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3606 |
// which value to return, respectively either: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3607 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3608 |
// 1. The entire cache object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3609 |
// 2. The data stored at the key |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3610 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3611 |
if ( key === undefined || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3612 |
((key && typeof key === "string") && value === undefined) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3613 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3614 |
stored = this.get( owner, key ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3615 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3616 |
return stored !== undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3617 |
stored : this.get( owner, jQuery.camelCase(key) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3618 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3619 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3620 |
// [*]When the key is not a string, or both a key and value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3621 |
// are specified, set or extend (existing objects) with either: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3622 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3623 |
// 1. An object of properties |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3624 |
// 2. A key and value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3625 |
// |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3626 |
this.set( owner, key, value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3627 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3628 |
// Since the "set" path can have two possible entry points |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3629 |
// return the expected data based on which path was taken[*] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3630 |
return value !== undefined ? value : key; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3631 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3632 |
remove: function( owner, key ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3633 |
var i, name, camel, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3634 |
unlock = this.key( owner ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3635 |
cache = this.cache[ unlock ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3636 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3637 |
if ( key === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3638 |
this.cache[ unlock ] = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3639 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3640 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3641 |
// Support array or space separated string of keys |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3642 |
if ( jQuery.isArray( key ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3643 |
// If "name" is an array of keys... |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3644 |
// When data is initially created, via ("key", "val") signature, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3645 |
// keys will be converted to camelCase. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3646 |
// Since there is no way to tell _how_ a key was added, remove |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3647 |
// both plain key and camelCase key. #12786 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3648 |
// This will only penalize the array argument path. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3649 |
name = key.concat( key.map( jQuery.camelCase ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3650 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3651 |
camel = jQuery.camelCase( key ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3652 |
// Try the string as a key before any manipulation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3653 |
if ( key in cache ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3654 |
name = [ key, camel ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3655 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3656 |
// If a key with the spaces exists, use it. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3657 |
// Otherwise, create an array by matching non-whitespace |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3658 |
name = camel; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3659 |
name = name in cache ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3660 |
[ name ] : ( name.match( rnotwhite ) || [] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3661 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3662 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3663 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3664 |
i = name.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3665 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3666 |
delete cache[ name[ i ] ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3667 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3668 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3669 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3670 |
hasData: function( owner ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3671 |
return !jQuery.isEmptyObject( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3672 |
this.cache[ owner[ this.expando ] ] || {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3673 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3674 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3675 |
discard: function( owner ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3676 |
if ( owner[ this.expando ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3677 |
delete this.cache[ owner[ this.expando ] ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3678 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3679 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3680 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3681 |
var data_priv = new Data(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3682 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3683 |
var data_user = new Data(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3684 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3685 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3686 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3687 |
/* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3688 |
Implementation Summary |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3689 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3690 |
1. Enforce API surface and semantic compatibility with 1.9.x branch |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3691 |
2. Improve the module's maintainability by reducing the storage |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3692 |
paths to a single mechanism. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3693 |
3. Use the same single mechanism to support "private" and "user" data. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3694 |
4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3695 |
5. Avoid exposing implementation details on user objects (eg. expando properties) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3696 |
6. Provide a clear path for implementation upgrade to WeakMap in 2014 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3697 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3698 |
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3699 |
rmultiDash = /([A-Z])/g; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3700 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3701 |
function dataAttr( elem, key, data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3702 |
var name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3703 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3704 |
// If nothing was found internally, try to fetch any |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3705 |
// data from the HTML5 data-* attribute |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3706 |
if ( data === undefined && elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3707 |
name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3708 |
data = elem.getAttribute( name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3709 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3710 |
if ( typeof data === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3711 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3712 |
data = data === "true" ? true : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3713 |
data === "false" ? false : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3714 |
data === "null" ? null : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3715 |
// Only convert to a number if it doesn't change the string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3716 |
+data + "" === data ? +data : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3717 |
rbrace.test( data ) ? jQuery.parseJSON( data ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3718 |
data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3719 |
} catch( e ) {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3720 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3721 |
// Make sure we set the data so it isn't changed later |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3722 |
data_user.set( elem, key, data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3723 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3724 |
data = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3725 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3726 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3727 |
return data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3728 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3729 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3730 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3731 |
hasData: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3732 |
return data_user.hasData( elem ) || data_priv.hasData( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3733 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3734 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3735 |
data: function( elem, name, data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3736 |
return data_user.access( elem, name, data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3737 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3738 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3739 |
removeData: function( elem, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3740 |
data_user.remove( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3741 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3742 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3743 |
// TODO: Now that all calls to _data and _removeData have been replaced |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3744 |
// with direct calls to data_priv methods, these can be deprecated. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3745 |
_data: function( elem, name, data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3746 |
return data_priv.access( elem, name, data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3747 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3748 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3749 |
_removeData: function( elem, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3750 |
data_priv.remove( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3751 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3752 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3753 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3754 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3755 |
data: function( key, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3756 |
var i, name, data, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3757 |
elem = this[ 0 ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3758 |
attrs = elem && elem.attributes; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3759 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3760 |
// Gets all values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3761 |
if ( key === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3762 |
if ( this.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3763 |
data = data_user.get( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3764 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3765 |
if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3766 |
i = attrs.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3767 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3768 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3769 |
// Support: IE11+ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3770 |
// The attrs elements can be null (#14894) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3771 |
if ( attrs[ i ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3772 |
name = attrs[ i ].name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3773 |
if ( name.indexOf( "data-" ) === 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3774 |
name = jQuery.camelCase( name.slice(5) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3775 |
dataAttr( elem, name, data[ name ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3776 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3777 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3778 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3779 |
data_priv.set( elem, "hasDataAttrs", true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3780 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3781 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3782 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3783 |
return data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3784 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3785 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3786 |
// Sets multiple values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3787 |
if ( typeof key === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3788 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3789 |
data_user.set( this, key ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3790 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3791 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3792 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3793 |
return access( this, function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3794 |
var data, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3795 |
camelKey = jQuery.camelCase( key ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3796 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3797 |
// The calling jQuery object (element matches) is not empty |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3798 |
// (and therefore has an element appears at this[ 0 ]) and the |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3799 |
// `value` parameter was not undefined. An empty jQuery object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3800 |
// will result in `undefined` for elem = this[ 0 ] which will |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3801 |
// throw an exception if an attempt to read a data cache is made. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3802 |
if ( elem && value === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3803 |
// Attempt to get data from the cache |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3804 |
// with the key as-is |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3805 |
data = data_user.get( elem, key ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3806 |
if ( data !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3807 |
return data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3808 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3809 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3810 |
// Attempt to get data from the cache |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3811 |
// with the key camelized |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3812 |
data = data_user.get( elem, camelKey ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3813 |
if ( data !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3814 |
return data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3815 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3816 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3817 |
// Attempt to "discover" the data in |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3818 |
// HTML5 custom data-* attrs |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3819 |
data = dataAttr( elem, camelKey, undefined ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3820 |
if ( data !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3821 |
return data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3822 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3823 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3824 |
// We tried really hard, but the data doesn't exist. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3825 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3826 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3827 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3828 |
// Set the data... |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3829 |
this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3830 |
// First, attempt to store a copy or reference of any |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3831 |
// data that might've been store with a camelCased key. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3832 |
var data = data_user.get( this, camelKey ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3833 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3834 |
// For HTML5 data-* attribute interop, we have to |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3835 |
// store property names with dashes in a camelCase form. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3836 |
// This might not apply to all properties...* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3837 |
data_user.set( this, camelKey, value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3838 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3839 |
// *... In the case of properties that might _actually_ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3840 |
// have dashes, we need to also store a copy of that |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3841 |
// unchanged property. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3842 |
if ( key.indexOf("-") !== -1 && data !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3843 |
data_user.set( this, key, value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3844 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3845 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3846 |
}, null, value, arguments.length > 1, null, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3847 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3848 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3849 |
removeData: function( key ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3850 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3851 |
data_user.remove( this, key ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3852 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3853 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3854 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3855 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3856 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3857 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3858 |
queue: function( elem, type, data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3859 |
var queue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3860 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3861 |
if ( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3862 |
type = ( type || "fx" ) + "queue"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3863 |
queue = data_priv.get( elem, type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3864 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3865 |
// Speed up dequeue by getting out quickly if this is just a lookup |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3866 |
if ( data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3867 |
if ( !queue || jQuery.isArray( data ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3868 |
queue = data_priv.access( elem, type, jQuery.makeArray(data) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3869 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3870 |
queue.push( data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3871 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3872 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3873 |
return queue || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3874 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3875 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3876 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3877 |
dequeue: function( elem, type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3878 |
type = type || "fx"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3879 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3880 |
var queue = jQuery.queue( elem, type ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3881 |
startLength = queue.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3882 |
fn = queue.shift(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3883 |
hooks = jQuery._queueHooks( elem, type ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3884 |
next = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3885 |
jQuery.dequeue( elem, type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3886 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3887 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3888 |
// If the fx queue is dequeued, always remove the progress sentinel |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3889 |
if ( fn === "inprogress" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3890 |
fn = queue.shift(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3891 |
startLength--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3892 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3893 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3894 |
if ( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3895 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3896 |
// Add a progress sentinel to prevent the fx queue from being |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3897 |
// automatically dequeued |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3898 |
if ( type === "fx" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3899 |
queue.unshift( "inprogress" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3900 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3901 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3902 |
// clear up the last queue stop function |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3903 |
delete hooks.stop; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3904 |
fn.call( elem, next, hooks ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3905 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3906 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3907 |
if ( !startLength && hooks ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3908 |
hooks.empty.fire(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3909 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3910 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3911 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3912 |
// not intended for public consumption - generates a queueHooks object, or returns the current one |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3913 |
_queueHooks: function( elem, type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3914 |
var key = type + "queueHooks"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3915 |
return data_priv.get( elem, key ) || data_priv.access( elem, key, { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3916 |
empty: jQuery.Callbacks("once memory").add(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3917 |
data_priv.remove( elem, [ type + "queue", key ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3918 |
}) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3919 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3920 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3921 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3922 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3923 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3924 |
queue: function( type, data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3925 |
var setter = 2; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3926 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3927 |
if ( typeof type !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3928 |
data = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3929 |
type = "fx"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3930 |
setter--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3931 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3932 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3933 |
if ( arguments.length < setter ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3934 |
return jQuery.queue( this[0], type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3935 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3936 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3937 |
return data === undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3938 |
this : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3939 |
this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3940 |
var queue = jQuery.queue( this, type, data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3941 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3942 |
// ensure a hooks for this queue |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3943 |
jQuery._queueHooks( this, type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3944 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3945 |
if ( type === "fx" && queue[0] !== "inprogress" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3946 |
jQuery.dequeue( this, type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3947 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3948 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3949 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3950 |
dequeue: function( type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3951 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3952 |
jQuery.dequeue( this, type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3953 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3954 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3955 |
clearQueue: function( type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3956 |
return this.queue( type || "fx", [] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3957 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3958 |
// Get a promise resolved when queues of a certain type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3959 |
// are emptied (fx is the type by default) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3960 |
promise: function( type, obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3961 |
var tmp, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3962 |
count = 1, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3963 |
defer = jQuery.Deferred(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3964 |
elements = this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3965 |
i = this.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3966 |
resolve = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3967 |
if ( !( --count ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3968 |
defer.resolveWith( elements, [ elements ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3969 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3970 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3971 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3972 |
if ( typeof type !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3973 |
obj = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3974 |
type = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3975 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3976 |
type = type || "fx"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3977 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3978 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3979 |
tmp = data_priv.get( elements[ i ], type + "queueHooks" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3980 |
if ( tmp && tmp.empty ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3981 |
count++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3982 |
tmp.empty.add( resolve ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3983 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3984 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3985 |
resolve(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3986 |
return defer.promise( obj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3987 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3988 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3989 |
var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3990 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3991 |
var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3992 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3993 |
var isHidden = function( elem, el ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3994 |
// isHidden might be called from jQuery#filter function; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3995 |
// in that case, element will be second argument |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3996 |
elem = el || elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3997 |
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3998 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
3999 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4000 |
var rcheckableType = (/^(?:checkbox|radio)$/i); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4001 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4002 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4003 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4004 |
(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4005 |
var fragment = document.createDocumentFragment(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4006 |
div = fragment.appendChild( document.createElement( "div" ) ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4007 |
input = document.createElement( "input" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4008 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4009 |
// #11217 - WebKit loses check when the name is after the checked attribute |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4010 |
// Support: Windows Web Apps (WWA) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4011 |
// `name` and `type` need .setAttribute for WWA |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4012 |
input.setAttribute( "type", "radio" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4013 |
input.setAttribute( "checked", "checked" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4014 |
input.setAttribute( "name", "t" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4015 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4016 |
div.appendChild( input ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4017 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4018 |
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4019 |
// old WebKit doesn't clone checked state correctly in fragments |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4020 |
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4021 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4022 |
// Make sure textarea (and checkbox) defaultValue is properly cloned |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4023 |
// Support: IE9-IE11+ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4024 |
div.innerHTML = "<textarea>x</textarea>"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4025 |
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4026 |
})(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4027 |
var strundefined = typeof undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4028 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4029 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4030 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4031 |
support.focusinBubbles = "onfocusin" in window; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4032 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4033 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4034 |
var |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4035 |
rkeyEvent = /^key/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4036 |
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4037 |
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4038 |
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4039 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4040 |
function returnTrue() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4041 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4042 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4043 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4044 |
function returnFalse() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4045 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4046 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4047 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4048 |
function safeActiveElement() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4049 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4050 |
return document.activeElement; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4051 |
} catch ( err ) { } |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4052 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4053 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4054 |
/* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4055 |
* Helper functions for managing events -- not part of the public interface. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4056 |
* Props to Dean Edwards' addEvent library for many of the ideas. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4057 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4058 |
jQuery.event = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4059 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4060 |
global: {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4061 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4062 |
add: function( elem, types, handler, data, selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4063 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4064 |
var handleObjIn, eventHandle, tmp, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4065 |
events, t, handleObj, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4066 |
special, handlers, type, namespaces, origType, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4067 |
elemData = data_priv.get( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4068 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4069 |
// Don't attach events to noData or text/comment nodes (but allow plain objects) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4070 |
if ( !elemData ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4071 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4072 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4073 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4074 |
// Caller can pass in an object of custom data in lieu of the handler |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4075 |
if ( handler.handler ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4076 |
handleObjIn = handler; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4077 |
handler = handleObjIn.handler; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4078 |
selector = handleObjIn.selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4079 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4080 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4081 |
// Make sure that the handler has a unique ID, used to find/remove it later |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4082 |
if ( !handler.guid ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4083 |
handler.guid = jQuery.guid++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4084 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4085 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4086 |
// Init the element's event structure and main handler, if this is the first |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4087 |
if ( !(events = elemData.events) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4088 |
events = elemData.events = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4089 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4090 |
if ( !(eventHandle = elemData.handle) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4091 |
eventHandle = elemData.handle = function( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4092 |
// Discard the second event of a jQuery.event.trigger() and |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4093 |
// when an event is called after a page has unloaded |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4094 |
return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4095 |
jQuery.event.dispatch.apply( elem, arguments ) : undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4096 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4097 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4098 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4099 |
// Handle multiple events separated by a space |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4100 |
types = ( types || "" ).match( rnotwhite ) || [ "" ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4101 |
t = types.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4102 |
while ( t-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4103 |
tmp = rtypenamespace.exec( types[t] ) || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4104 |
type = origType = tmp[1]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4105 |
namespaces = ( tmp[2] || "" ).split( "." ).sort(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4106 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4107 |
// There *must* be a type, no attaching namespace-only handlers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4108 |
if ( !type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4109 |
continue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4110 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4111 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4112 |
// If event changes its type, use the special event handlers for the changed type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4113 |
special = jQuery.event.special[ type ] || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4114 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4115 |
// If selector defined, determine special event api type, otherwise given type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4116 |
type = ( selector ? special.delegateType : special.bindType ) || type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4117 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4118 |
// Update special based on newly reset type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4119 |
special = jQuery.event.special[ type ] || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4120 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4121 |
// handleObj is passed to all event handlers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4122 |
handleObj = jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4123 |
type: type, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4124 |
origType: origType, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4125 |
data: data, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4126 |
handler: handler, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4127 |
guid: handler.guid, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4128 |
selector: selector, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4129 |
needsContext: selector && jQuery.expr.match.needsContext.test( selector ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4130 |
namespace: namespaces.join(".") |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4131 |
}, handleObjIn ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4132 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4133 |
// Init the event handler queue if we're the first |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4134 |
if ( !(handlers = events[ type ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4135 |
handlers = events[ type ] = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4136 |
handlers.delegateCount = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4137 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4138 |
// Only use addEventListener if the special events handler returns false |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4139 |
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4140 |
if ( elem.addEventListener ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4141 |
elem.addEventListener( type, eventHandle, false ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4142 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4143 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4144 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4145 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4146 |
if ( special.add ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4147 |
special.add.call( elem, handleObj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4148 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4149 |
if ( !handleObj.handler.guid ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4150 |
handleObj.handler.guid = handler.guid; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4151 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4152 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4153 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4154 |
// Add to the element's handler list, delegates in front |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4155 |
if ( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4156 |
handlers.splice( handlers.delegateCount++, 0, handleObj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4157 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4158 |
handlers.push( handleObj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4159 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4160 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4161 |
// Keep track of which events have ever been used, for event optimization |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4162 |
jQuery.event.global[ type ] = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4163 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4164 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4165 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4166 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4167 |
// Detach an event or set of events from an element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4168 |
remove: function( elem, types, handler, selector, mappedTypes ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4169 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4170 |
var j, origCount, tmp, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4171 |
events, t, handleObj, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4172 |
special, handlers, type, namespaces, origType, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4173 |
elemData = data_priv.hasData( elem ) && data_priv.get( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4174 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4175 |
if ( !elemData || !(events = elemData.events) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4176 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4177 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4178 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4179 |
// Once for each type.namespace in types; type may be omitted |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4180 |
types = ( types || "" ).match( rnotwhite ) || [ "" ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4181 |
t = types.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4182 |
while ( t-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4183 |
tmp = rtypenamespace.exec( types[t] ) || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4184 |
type = origType = tmp[1]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4185 |
namespaces = ( tmp[2] || "" ).split( "." ).sort(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4186 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4187 |
// Unbind all events (on this namespace, if provided) for the element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4188 |
if ( !type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4189 |
for ( type in events ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4190 |
jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4191 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4192 |
continue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4193 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4194 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4195 |
special = jQuery.event.special[ type ] || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4196 |
type = ( selector ? special.delegateType : special.bindType ) || type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4197 |
handlers = events[ type ] || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4198 |
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4199 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4200 |
// Remove matching events |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4201 |
origCount = j = handlers.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4202 |
while ( j-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4203 |
handleObj = handlers[ j ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4204 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4205 |
if ( ( mappedTypes || origType === handleObj.origType ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4206 |
( !handler || handler.guid === handleObj.guid ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4207 |
( !tmp || tmp.test( handleObj.namespace ) ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4208 |
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4209 |
handlers.splice( j, 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4210 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4211 |
if ( handleObj.selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4212 |
handlers.delegateCount--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4213 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4214 |
if ( special.remove ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4215 |
special.remove.call( elem, handleObj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4216 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4217 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4218 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4219 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4220 |
// Remove generic event handler if we removed something and no more handlers exist |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4221 |
// (avoids potential for endless recursion during removal of special event handlers) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4222 |
if ( origCount && !handlers.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4223 |
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4224 |
jQuery.removeEvent( elem, type, elemData.handle ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4225 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4226 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4227 |
delete events[ type ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4228 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4229 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4230 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4231 |
// Remove the expando if it's no longer used |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4232 |
if ( jQuery.isEmptyObject( events ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4233 |
delete elemData.handle; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4234 |
data_priv.remove( elem, "events" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4235 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4236 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4237 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4238 |
trigger: function( event, data, elem, onlyHandlers ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4239 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4240 |
var i, cur, tmp, bubbleType, ontype, handle, special, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4241 |
eventPath = [ elem || document ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4242 |
type = hasOwn.call( event, "type" ) ? event.type : event, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4243 |
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4244 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4245 |
cur = tmp = elem = elem || document; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4246 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4247 |
// Don't do events on text and comment nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4248 |
if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4249 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4250 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4251 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4252 |
// focus/blur morphs to focusin/out; ensure we're not firing them right now |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4253 |
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4254 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4255 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4256 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4257 |
if ( type.indexOf(".") >= 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4258 |
// Namespaced trigger; create a regexp to match event type in handle() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4259 |
namespaces = type.split("."); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4260 |
type = namespaces.shift(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4261 |
namespaces.sort(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4262 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4263 |
ontype = type.indexOf(":") < 0 && "on" + type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4264 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4265 |
// Caller can pass in a jQuery.Event object, Object, or just an event type string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4266 |
event = event[ jQuery.expando ] ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4267 |
event : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4268 |
new jQuery.Event( type, typeof event === "object" && event ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4269 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4270 |
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4271 |
event.isTrigger = onlyHandlers ? 2 : 3; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4272 |
event.namespace = namespaces.join("."); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4273 |
event.namespace_re = event.namespace ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4274 |
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4275 |
null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4276 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4277 |
// Clean up the event in case it is being reused |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4278 |
event.result = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4279 |
if ( !event.target ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4280 |
event.target = elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4281 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4282 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4283 |
// Clone any incoming data and prepend the event, creating the handler arg list |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4284 |
data = data == null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4285 |
[ event ] : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4286 |
jQuery.makeArray( data, [ event ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4287 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4288 |
// Allow special events to draw outside the lines |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4289 |
special = jQuery.event.special[ type ] || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4290 |
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4291 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4292 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4293 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4294 |
// Determine event propagation path in advance, per W3C events spec (#9951) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4295 |
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4296 |
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4297 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4298 |
bubbleType = special.delegateType || type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4299 |
if ( !rfocusMorph.test( bubbleType + type ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4300 |
cur = cur.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4301 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4302 |
for ( ; cur; cur = cur.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4303 |
eventPath.push( cur ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4304 |
tmp = cur; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4305 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4306 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4307 |
// Only add window if we got to document (e.g., not plain obj or detached DOM) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4308 |
if ( tmp === (elem.ownerDocument || document) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4309 |
eventPath.push( tmp.defaultView || tmp.parentWindow || window ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4310 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4311 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4312 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4313 |
// Fire handlers on the event path |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4314 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4315 |
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4316 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4317 |
event.type = i > 1 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4318 |
bubbleType : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4319 |
special.bindType || type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4320 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4321 |
// jQuery handler |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4322 |
handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4323 |
if ( handle ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4324 |
handle.apply( cur, data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4325 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4326 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4327 |
// Native handler |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4328 |
handle = ontype && cur[ ontype ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4329 |
if ( handle && handle.apply && jQuery.acceptData( cur ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4330 |
event.result = handle.apply( cur, data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4331 |
if ( event.result === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4332 |
event.preventDefault(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4333 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4334 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4335 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4336 |
event.type = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4337 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4338 |
// If nobody prevented the default action, do it now |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4339 |
if ( !onlyHandlers && !event.isDefaultPrevented() ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4340 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4341 |
if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4342 |
jQuery.acceptData( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4343 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4344 |
// Call a native DOM method on the target with the same name name as the event. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4345 |
// Don't do default actions on window, that's where global variables be (#6170) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4346 |
if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4347 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4348 |
// Don't re-trigger an onFOO event when we call its FOO() method |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4349 |
tmp = elem[ ontype ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4350 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4351 |
if ( tmp ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4352 |
elem[ ontype ] = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4353 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4354 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4355 |
// Prevent re-triggering of the same event, since we already bubbled it above |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4356 |
jQuery.event.triggered = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4357 |
elem[ type ](); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4358 |
jQuery.event.triggered = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4359 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4360 |
if ( tmp ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4361 |
elem[ ontype ] = tmp; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4362 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4363 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4364 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4365 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4366 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4367 |
return event.result; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4368 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4369 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4370 |
dispatch: function( event ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4371 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4372 |
// Make a writable jQuery.Event from the native event object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4373 |
event = jQuery.event.fix( event ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4374 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4375 |
var i, j, ret, matched, handleObj, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4376 |
handlerQueue = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4377 |
args = slice.call( arguments ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4378 |
handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4379 |
special = jQuery.event.special[ event.type ] || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4380 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4381 |
// Use the fix-ed jQuery.Event rather than the (read-only) native event |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4382 |
args[0] = event; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4383 |
event.delegateTarget = this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4384 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4385 |
// Call the preDispatch hook for the mapped type, and let it bail if desired |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4386 |
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4387 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4388 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4389 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4390 |
// Determine handlers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4391 |
handlerQueue = jQuery.event.handlers.call( this, event, handlers ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4392 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4393 |
// Run delegates first; they may want to stop propagation beneath us |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4394 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4395 |
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4396 |
event.currentTarget = matched.elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4397 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4398 |
j = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4399 |
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4400 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4401 |
// Triggered event must either 1) have no namespace, or |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4402 |
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4403 |
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4404 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4405 |
event.handleObj = handleObj; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4406 |
event.data = handleObj.data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4407 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4408 |
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4409 |
.apply( matched.elem, args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4410 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4411 |
if ( ret !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4412 |
if ( (event.result = ret) === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4413 |
event.preventDefault(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4414 |
event.stopPropagation(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4415 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4416 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4417 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4418 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4419 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4420 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4421 |
// Call the postDispatch hook for the mapped type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4422 |
if ( special.postDispatch ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4423 |
special.postDispatch.call( this, event ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4424 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4425 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4426 |
return event.result; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4427 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4428 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4429 |
handlers: function( event, handlers ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4430 |
var i, matches, sel, handleObj, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4431 |
handlerQueue = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4432 |
delegateCount = handlers.delegateCount, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4433 |
cur = event.target; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4434 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4435 |
// Find delegate handlers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4436 |
// Black-hole SVG <use> instance trees (#13180) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4437 |
// Avoid non-left-click bubbling in Firefox (#3861) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4438 |
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4439 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4440 |
for ( ; cur !== this; cur = cur.parentNode || this ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4441 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4442 |
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4443 |
if ( cur.disabled !== true || event.type !== "click" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4444 |
matches = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4445 |
for ( i = 0; i < delegateCount; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4446 |
handleObj = handlers[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4447 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4448 |
// Don't conflict with Object.prototype properties (#13203) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4449 |
sel = handleObj.selector + " "; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4450 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4451 |
if ( matches[ sel ] === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4452 |
matches[ sel ] = handleObj.needsContext ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4453 |
jQuery( sel, this ).index( cur ) >= 0 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4454 |
jQuery.find( sel, this, null, [ cur ] ).length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4455 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4456 |
if ( matches[ sel ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4457 |
matches.push( handleObj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4458 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4459 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4460 |
if ( matches.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4461 |
handlerQueue.push({ elem: cur, handlers: matches }); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4462 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4463 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4464 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4465 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4466 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4467 |
// Add the remaining (directly-bound) handlers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4468 |
if ( delegateCount < handlers.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4469 |
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4470 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4471 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4472 |
return handlerQueue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4473 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4474 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4475 |
// Includes some event props shared by KeyEvent and MouseEvent |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4476 |
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4477 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4478 |
fixHooks: {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4479 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4480 |
keyHooks: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4481 |
props: "char charCode key keyCode".split(" "), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4482 |
filter: function( event, original ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4483 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4484 |
// Add which for key events |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4485 |
if ( event.which == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4486 |
event.which = original.charCode != null ? original.charCode : original.keyCode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4487 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4488 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4489 |
return event; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4490 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4491 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4492 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4493 |
mouseHooks: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4494 |
props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4495 |
filter: function( event, original ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4496 |
var eventDoc, doc, body, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4497 |
button = original.button; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4498 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4499 |
// Calculate pageX/Y if missing and clientX/Y available |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4500 |
if ( event.pageX == null && original.clientX != null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4501 |
eventDoc = event.target.ownerDocument || document; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4502 |
doc = eventDoc.documentElement; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4503 |
body = eventDoc.body; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4504 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4505 |
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4506 |
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4507 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4508 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4509 |
// Add which for click: 1 === left; 2 === middle; 3 === right |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4510 |
// Note: button is not normalized, so don't use it |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4511 |
if ( !event.which && button !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4512 |
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4513 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4514 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4515 |
return event; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4516 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4517 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4518 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4519 |
fix: function( event ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4520 |
if ( event[ jQuery.expando ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4521 |
return event; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4522 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4523 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4524 |
// Create a writable copy of the event object and normalize some properties |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4525 |
var i, prop, copy, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4526 |
type = event.type, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4527 |
originalEvent = event, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4528 |
fixHook = this.fixHooks[ type ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4529 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4530 |
if ( !fixHook ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4531 |
this.fixHooks[ type ] = fixHook = |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4532 |
rmouseEvent.test( type ) ? this.mouseHooks : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4533 |
rkeyEvent.test( type ) ? this.keyHooks : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4534 |
{}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4535 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4536 |
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4537 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4538 |
event = new jQuery.Event( originalEvent ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4539 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4540 |
i = copy.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4541 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4542 |
prop = copy[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4543 |
event[ prop ] = originalEvent[ prop ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4544 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4545 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4546 |
// Support: Cordova 2.5 (WebKit) (#13255) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4547 |
// All events should have a target; Cordova deviceready doesn't |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4548 |
if ( !event.target ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4549 |
event.target = document; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4550 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4551 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4552 |
// Support: Safari 6.0+, Chrome < 28 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4553 |
// Target should not be a text node (#504, #13143) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4554 |
if ( event.target.nodeType === 3 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4555 |
event.target = event.target.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4556 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4557 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4558 |
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4559 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4560 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4561 |
special: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4562 |
load: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4563 |
// Prevent triggered image.load events from bubbling to window.load |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4564 |
noBubble: true |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4565 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4566 |
focus: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4567 |
// Fire native event if possible so blur/focus sequence is correct |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4568 |
trigger: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4569 |
if ( this !== safeActiveElement() && this.focus ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4570 |
this.focus(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4571 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4572 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4573 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4574 |
delegateType: "focusin" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4575 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4576 |
blur: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4577 |
trigger: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4578 |
if ( this === safeActiveElement() && this.blur ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4579 |
this.blur(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4580 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4581 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4582 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4583 |
delegateType: "focusout" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4584 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4585 |
click: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4586 |
// For checkbox, fire native event so checked state will be right |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4587 |
trigger: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4588 |
if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4589 |
this.click(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4590 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4591 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4592 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4593 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4594 |
// For cross-browser consistency, don't fire native .click() on links |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4595 |
_default: function( event ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4596 |
return jQuery.nodeName( event.target, "a" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4597 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4598 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4599 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4600 |
beforeunload: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4601 |
postDispatch: function( event ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4602 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4603 |
// Support: Firefox 20+ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4604 |
// Firefox doesn't alert if the returnValue field is not set. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4605 |
if ( event.result !== undefined && event.originalEvent ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4606 |
event.originalEvent.returnValue = event.result; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4607 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4608 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4609 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4610 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4611 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4612 |
simulate: function( type, elem, event, bubble ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4613 |
// Piggyback on a donor event to simulate a different one. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4614 |
// Fake originalEvent to avoid donor's stopPropagation, but if the |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4615 |
// simulated event prevents default then we do the same on the donor. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4616 |
var e = jQuery.extend( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4617 |
new jQuery.Event(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4618 |
event, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4619 |
{ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4620 |
type: type, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4621 |
isSimulated: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4622 |
originalEvent: {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4623 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4624 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4625 |
if ( bubble ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4626 |
jQuery.event.trigger( e, null, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4627 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4628 |
jQuery.event.dispatch.call( elem, e ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4629 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4630 |
if ( e.isDefaultPrevented() ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4631 |
event.preventDefault(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4632 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4633 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4634 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4635 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4636 |
jQuery.removeEvent = function( elem, type, handle ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4637 |
if ( elem.removeEventListener ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4638 |
elem.removeEventListener( type, handle, false ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4639 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4640 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4641 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4642 |
jQuery.Event = function( src, props ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4643 |
// Allow instantiation without the 'new' keyword |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4644 |
if ( !(this instanceof jQuery.Event) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4645 |
return new jQuery.Event( src, props ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4646 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4647 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4648 |
// Event object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4649 |
if ( src && src.type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4650 |
this.originalEvent = src; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4651 |
this.type = src.type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4652 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4653 |
// Events bubbling up the document may have been marked as prevented |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4654 |
// by a handler lower down the tree; reflect the correct value. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4655 |
this.isDefaultPrevented = src.defaultPrevented || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4656 |
src.defaultPrevented === undefined && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4657 |
// Support: Android < 4.0 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4658 |
src.returnValue === false ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4659 |
returnTrue : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4660 |
returnFalse; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4661 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4662 |
// Event type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4663 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4664 |
this.type = src; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4665 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4666 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4667 |
// Put explicitly provided properties onto the event object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4668 |
if ( props ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4669 |
jQuery.extend( this, props ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4670 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4671 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4672 |
// Create a timestamp if incoming event doesn't have one |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4673 |
this.timeStamp = src && src.timeStamp || jQuery.now(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4674 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4675 |
// Mark it as fixed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4676 |
this[ jQuery.expando ] = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4677 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4678 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4679 |
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4680 |
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4681 |
jQuery.Event.prototype = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4682 |
isDefaultPrevented: returnFalse, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4683 |
isPropagationStopped: returnFalse, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4684 |
isImmediatePropagationStopped: returnFalse, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4685 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4686 |
preventDefault: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4687 |
var e = this.originalEvent; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4688 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4689 |
this.isDefaultPrevented = returnTrue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4690 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4691 |
if ( e && e.preventDefault ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4692 |
e.preventDefault(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4693 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4694 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4695 |
stopPropagation: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4696 |
var e = this.originalEvent; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4697 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4698 |
this.isPropagationStopped = returnTrue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4699 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4700 |
if ( e && e.stopPropagation ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4701 |
e.stopPropagation(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4702 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4703 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4704 |
stopImmediatePropagation: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4705 |
var e = this.originalEvent; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4706 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4707 |
this.isImmediatePropagationStopped = returnTrue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4708 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4709 |
if ( e && e.stopImmediatePropagation ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4710 |
e.stopImmediatePropagation(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4711 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4712 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4713 |
this.stopPropagation(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4714 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4715 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4716 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4717 |
// Create mouseenter/leave events using mouseover/out and event-time checks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4718 |
// Support: Chrome 15+ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4719 |
jQuery.each({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4720 |
mouseenter: "mouseover", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4721 |
mouseleave: "mouseout", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4722 |
pointerenter: "pointerover", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4723 |
pointerleave: "pointerout" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4724 |
}, function( orig, fix ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4725 |
jQuery.event.special[ orig ] = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4726 |
delegateType: fix, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4727 |
bindType: fix, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4728 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4729 |
handle: function( event ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4730 |
var ret, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4731 |
target = this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4732 |
related = event.relatedTarget, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4733 |
handleObj = event.handleObj; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4734 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4735 |
// For mousenter/leave call the handler if related is outside the target. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4736 |
// NB: No relatedTarget if the mouse left/entered the browser window |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4737 |
if ( !related || (related !== target && !jQuery.contains( target, related )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4738 |
event.type = handleObj.origType; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4739 |
ret = handleObj.handler.apply( this, arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4740 |
event.type = fix; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4741 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4742 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4743 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4744 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4745 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4746 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4747 |
// Create "bubbling" focus and blur events |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4748 |
// Support: Firefox, Chrome, Safari |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4749 |
if ( !support.focusinBubbles ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4750 |
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4751 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4752 |
// Attach a single capturing handler on the document while someone wants focusin/focusout |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4753 |
var handler = function( event ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4754 |
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4755 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4756 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4757 |
jQuery.event.special[ fix ] = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4758 |
setup: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4759 |
var doc = this.ownerDocument || this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4760 |
attaches = data_priv.access( doc, fix ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4761 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4762 |
if ( !attaches ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4763 |
doc.addEventListener( orig, handler, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4764 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4765 |
data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4766 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4767 |
teardown: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4768 |
var doc = this.ownerDocument || this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4769 |
attaches = data_priv.access( doc, fix ) - 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4770 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4771 |
if ( !attaches ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4772 |
doc.removeEventListener( orig, handler, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4773 |
data_priv.remove( doc, fix ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4774 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4775 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4776 |
data_priv.access( doc, fix, attaches ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4777 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4778 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4779 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4780 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4781 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4782 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4783 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4784 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4785 |
on: function( types, selector, data, fn, /*INTERNAL*/ one ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4786 |
var origFn, type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4787 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4788 |
// Types can be a map of types/handlers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4789 |
if ( typeof types === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4790 |
// ( types-Object, selector, data ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4791 |
if ( typeof selector !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4792 |
// ( types-Object, data ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4793 |
data = data || selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4794 |
selector = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4795 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4796 |
for ( type in types ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4797 |
this.on( type, selector, data, types[ type ], one ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4798 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4799 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4800 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4801 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4802 |
if ( data == null && fn == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4803 |
// ( types, fn ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4804 |
fn = selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4805 |
data = selector = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4806 |
} else if ( fn == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4807 |
if ( typeof selector === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4808 |
// ( types, selector, fn ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4809 |
fn = data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4810 |
data = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4811 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4812 |
// ( types, data, fn ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4813 |
fn = data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4814 |
data = selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4815 |
selector = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4816 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4817 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4818 |
if ( fn === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4819 |
fn = returnFalse; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4820 |
} else if ( !fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4821 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4822 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4823 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4824 |
if ( one === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4825 |
origFn = fn; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4826 |
fn = function( event ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4827 |
// Can use an empty set, since event contains the info |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4828 |
jQuery().off( event ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4829 |
return origFn.apply( this, arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4830 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4831 |
// Use same guid so caller can remove using origFn |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4832 |
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4833 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4834 |
return this.each( function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4835 |
jQuery.event.add( this, types, fn, data, selector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4836 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4837 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4838 |
one: function( types, selector, data, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4839 |
return this.on( types, selector, data, fn, 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4840 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4841 |
off: function( types, selector, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4842 |
var handleObj, type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4843 |
if ( types && types.preventDefault && types.handleObj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4844 |
// ( event ) dispatched jQuery.Event |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4845 |
handleObj = types.handleObj; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4846 |
jQuery( types.delegateTarget ).off( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4847 |
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4848 |
handleObj.selector, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4849 |
handleObj.handler |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4850 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4851 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4852 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4853 |
if ( typeof types === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4854 |
// ( types-object [, selector] ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4855 |
for ( type in types ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4856 |
this.off( type, selector, types[ type ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4857 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4858 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4859 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4860 |
if ( selector === false || typeof selector === "function" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4861 |
// ( types [, fn] ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4862 |
fn = selector; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4863 |
selector = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4864 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4865 |
if ( fn === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4866 |
fn = returnFalse; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4867 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4868 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4869 |
jQuery.event.remove( this, types, fn, selector ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4870 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4871 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4872 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4873 |
trigger: function( type, data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4874 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4875 |
jQuery.event.trigger( type, data, this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4876 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4877 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4878 |
triggerHandler: function( type, data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4879 |
var elem = this[0]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4880 |
if ( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4881 |
return jQuery.event.trigger( type, data, elem, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4882 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4883 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4884 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4885 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4886 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4887 |
var |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4888 |
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4889 |
rtagName = /<([\w:]+)/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4890 |
rhtml = /<|&#?\w+;/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4891 |
rnoInnerhtml = /<(?:script|style|link)/i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4892 |
// checked="checked" or checked |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4893 |
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4894 |
rscriptType = /^$|\/(?:java|ecma)script/i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4895 |
rscriptTypeMasked = /^true\/(.*)/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4896 |
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4897 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4898 |
// We have to close these tags to support XHTML (#13200) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4899 |
wrapMap = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4900 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4901 |
// Support: IE 9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4902 |
option: [ 1, "<select multiple='multiple'>", "</select>" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4903 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4904 |
thead: [ 1, "<table>", "</table>" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4905 |
col: [ 2, "<table><colgroup>", "</colgroup></table>" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4906 |
tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4907 |
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4908 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4909 |
_default: [ 0, "", "" ] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4910 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4911 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4912 |
// Support: IE 9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4913 |
wrapMap.optgroup = wrapMap.option; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4914 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4915 |
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4916 |
wrapMap.th = wrapMap.td; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4917 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4918 |
// Support: 1.x compatibility |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4919 |
// Manipulating tables requires a tbody |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4920 |
function manipulationTarget( elem, content ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4921 |
return jQuery.nodeName( elem, "table" ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4922 |
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4923 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4924 |
elem.getElementsByTagName("tbody")[0] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4925 |
elem.appendChild( elem.ownerDocument.createElement("tbody") ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4926 |
elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4927 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4928 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4929 |
// Replace/restore the type attribute of script elements for safe DOM manipulation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4930 |
function disableScript( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4931 |
elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4932 |
return elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4933 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4934 |
function restoreScript( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4935 |
var match = rscriptTypeMasked.exec( elem.type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4936 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4937 |
if ( match ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4938 |
elem.type = match[ 1 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4939 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4940 |
elem.removeAttribute("type"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4941 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4942 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4943 |
return elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4944 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4945 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4946 |
// Mark scripts as having already been evaluated |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4947 |
function setGlobalEval( elems, refElements ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4948 |
var i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4949 |
l = elems.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4950 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4951 |
for ( ; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4952 |
data_priv.set( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4953 |
elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4954 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4955 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4956 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4957 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4958 |
function cloneCopyEvent( src, dest ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4959 |
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4960 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4961 |
if ( dest.nodeType !== 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4962 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4963 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4964 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4965 |
// 1. Copy private data: events, handlers, etc. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4966 |
if ( data_priv.hasData( src ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4967 |
pdataOld = data_priv.access( src ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4968 |
pdataCur = data_priv.set( dest, pdataOld ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4969 |
events = pdataOld.events; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4970 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4971 |
if ( events ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4972 |
delete pdataCur.handle; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4973 |
pdataCur.events = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4974 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4975 |
for ( type in events ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4976 |
for ( i = 0, l = events[ type ].length; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4977 |
jQuery.event.add( dest, type, events[ type ][ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4978 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4979 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4980 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4981 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4982 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4983 |
// 2. Copy user data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4984 |
if ( data_user.hasData( src ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4985 |
udataOld = data_user.access( src ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4986 |
udataCur = jQuery.extend( {}, udataOld ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4987 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4988 |
data_user.set( dest, udataCur ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4989 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4990 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4991 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4992 |
function getAll( context, tag ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4993 |
var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4994 |
context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4995 |
[]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4996 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4997 |
return tag === undefined || tag && jQuery.nodeName( context, tag ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4998 |
jQuery.merge( [ context ], ret ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
4999 |
ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5000 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5001 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5002 |
// Support: IE >= 9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5003 |
function fixInput( src, dest ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5004 |
var nodeName = dest.nodeName.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5005 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5006 |
// Fails to persist the checked state of a cloned checkbox or radio button. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5007 |
if ( nodeName === "input" && rcheckableType.test( src.type ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5008 |
dest.checked = src.checked; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5009 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5010 |
// Fails to return the selected option to the default selected state when cloning options |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5011 |
} else if ( nodeName === "input" || nodeName === "textarea" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5012 |
dest.defaultValue = src.defaultValue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5013 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5014 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5015 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5016 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5017 |
clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5018 |
var i, l, srcElements, destElements, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5019 |
clone = elem.cloneNode( true ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5020 |
inPage = jQuery.contains( elem.ownerDocument, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5021 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5022 |
// Support: IE >= 9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5023 |
// Fix Cloning issues |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5024 |
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5025 |
!jQuery.isXMLDoc( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5026 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5027 |
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5028 |
destElements = getAll( clone ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5029 |
srcElements = getAll( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5030 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5031 |
for ( i = 0, l = srcElements.length; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5032 |
fixInput( srcElements[ i ], destElements[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5033 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5034 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5035 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5036 |
// Copy the events from the original to the clone |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5037 |
if ( dataAndEvents ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5038 |
if ( deepDataAndEvents ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5039 |
srcElements = srcElements || getAll( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5040 |
destElements = destElements || getAll( clone ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5041 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5042 |
for ( i = 0, l = srcElements.length; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5043 |
cloneCopyEvent( srcElements[ i ], destElements[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5044 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5045 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5046 |
cloneCopyEvent( elem, clone ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5047 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5048 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5049 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5050 |
// Preserve script evaluation history |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5051 |
destElements = getAll( clone, "script" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5052 |
if ( destElements.length > 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5053 |
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5054 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5055 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5056 |
// Return the cloned set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5057 |
return clone; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5058 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5059 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5060 |
buildFragment: function( elems, context, scripts, selection ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5061 |
var elem, tmp, tag, wrap, contains, j, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5062 |
fragment = context.createDocumentFragment(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5063 |
nodes = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5064 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5065 |
l = elems.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5066 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5067 |
for ( ; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5068 |
elem = elems[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5069 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5070 |
if ( elem || elem === 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5071 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5072 |
// Add nodes directly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5073 |
if ( jQuery.type( elem ) === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5074 |
// Support: QtWebKit |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5075 |
// jQuery.merge because push.apply(_, arraylike) throws |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5076 |
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5077 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5078 |
// Convert non-html into a text node |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5079 |
} else if ( !rhtml.test( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5080 |
nodes.push( context.createTextNode( elem ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5081 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5082 |
// Convert html into DOM nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5083 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5084 |
tmp = tmp || fragment.appendChild( context.createElement("div") ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5085 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5086 |
// Deserialize a standard representation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5087 |
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5088 |
wrap = wrapMap[ tag ] || wrapMap._default; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5089 |
tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5090 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5091 |
// Descend through wrappers to the right content |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5092 |
j = wrap[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5093 |
while ( j-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5094 |
tmp = tmp.lastChild; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5095 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5096 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5097 |
// Support: QtWebKit |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5098 |
// jQuery.merge because push.apply(_, arraylike) throws |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5099 |
jQuery.merge( nodes, tmp.childNodes ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5100 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5101 |
// Remember the top-level container |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5102 |
tmp = fragment.firstChild; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5103 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5104 |
// Fixes #12346 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5105 |
// Support: Webkit, IE |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5106 |
tmp.textContent = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5107 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5108 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5109 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5110 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5111 |
// Remove wrapper from fragment |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5112 |
fragment.textContent = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5113 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5114 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5115 |
while ( (elem = nodes[ i++ ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5116 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5117 |
// #4087 - If origin and destination elements are the same, and this is |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5118 |
// that element, do not do anything |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5119 |
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5120 |
continue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5121 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5122 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5123 |
contains = jQuery.contains( elem.ownerDocument, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5124 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5125 |
// Append to fragment |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5126 |
tmp = getAll( fragment.appendChild( elem ), "script" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5127 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5128 |
// Preserve script evaluation history |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5129 |
if ( contains ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5130 |
setGlobalEval( tmp ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5131 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5132 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5133 |
// Capture executables |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5134 |
if ( scripts ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5135 |
j = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5136 |
while ( (elem = tmp[ j++ ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5137 |
if ( rscriptType.test( elem.type || "" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5138 |
scripts.push( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5139 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5140 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5141 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5142 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5143 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5144 |
return fragment; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5145 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5146 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5147 |
cleanData: function( elems ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5148 |
var data, elem, type, key, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5149 |
special = jQuery.event.special, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5150 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5151 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5152 |
for ( ; (elem = elems[ i ]) !== undefined; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5153 |
if ( jQuery.acceptData( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5154 |
key = elem[ data_priv.expando ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5155 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5156 |
if ( key && (data = data_priv.cache[ key ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5157 |
if ( data.events ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5158 |
for ( type in data.events ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5159 |
if ( special[ type ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5160 |
jQuery.event.remove( elem, type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5161 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5162 |
// This is a shortcut to avoid jQuery.event.remove's overhead |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5163 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5164 |
jQuery.removeEvent( elem, type, data.handle ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5165 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5166 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5167 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5168 |
if ( data_priv.cache[ key ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5169 |
// Discard any remaining `private` data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5170 |
delete data_priv.cache[ key ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5171 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5172 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5173 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5174 |
// Discard any remaining `user` data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5175 |
delete data_user.cache[ elem[ data_user.expando ] ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5176 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5177 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5178 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5179 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5180 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5181 |
text: function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5182 |
return access( this, function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5183 |
return value === undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5184 |
jQuery.text( this ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5185 |
this.empty().each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5186 |
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5187 |
this.textContent = value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5188 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5189 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5190 |
}, null, value, arguments.length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5191 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5192 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5193 |
append: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5194 |
return this.domManip( arguments, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5195 |
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5196 |
var target = manipulationTarget( this, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5197 |
target.appendChild( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5198 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5199 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5200 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5201 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5202 |
prepend: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5203 |
return this.domManip( arguments, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5204 |
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5205 |
var target = manipulationTarget( this, elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5206 |
target.insertBefore( elem, target.firstChild ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5207 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5208 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5209 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5210 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5211 |
before: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5212 |
return this.domManip( arguments, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5213 |
if ( this.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5214 |
this.parentNode.insertBefore( elem, this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5215 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5216 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5217 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5218 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5219 |
after: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5220 |
return this.domManip( arguments, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5221 |
if ( this.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5222 |
this.parentNode.insertBefore( elem, this.nextSibling ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5223 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5224 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5225 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5226 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5227 |
remove: function( selector, keepData /* Internal Use Only */ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5228 |
var elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5229 |
elems = selector ? jQuery.filter( selector, this ) : this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5230 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5231 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5232 |
for ( ; (elem = elems[i]) != null; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5233 |
if ( !keepData && elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5234 |
jQuery.cleanData( getAll( elem ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5235 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5236 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5237 |
if ( elem.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5238 |
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5239 |
setGlobalEval( getAll( elem, "script" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5240 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5241 |
elem.parentNode.removeChild( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5242 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5243 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5244 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5245 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5246 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5247 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5248 |
empty: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5249 |
var elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5250 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5251 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5252 |
for ( ; (elem = this[i]) != null; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5253 |
if ( elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5254 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5255 |
// Prevent memory leaks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5256 |
jQuery.cleanData( getAll( elem, false ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5257 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5258 |
// Remove any remaining nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5259 |
elem.textContent = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5260 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5261 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5262 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5263 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5264 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5265 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5266 |
clone: function( dataAndEvents, deepDataAndEvents ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5267 |
dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5268 |
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5269 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5270 |
return this.map(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5271 |
return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5272 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5273 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5274 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5275 |
html: function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5276 |
return access( this, function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5277 |
var elem = this[ 0 ] || {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5278 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5279 |
l = this.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5280 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5281 |
if ( value === undefined && elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5282 |
return elem.innerHTML; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5283 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5284 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5285 |
// See if we can take a shortcut and just use innerHTML |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5286 |
if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5287 |
!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5288 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5289 |
value = value.replace( rxhtmlTag, "<$1></$2>" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5290 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5291 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5292 |
for ( ; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5293 |
elem = this[ i ] || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5294 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5295 |
// Remove element nodes and prevent memory leaks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5296 |
if ( elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5297 |
jQuery.cleanData( getAll( elem, false ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5298 |
elem.innerHTML = value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5299 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5300 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5301 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5302 |
elem = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5303 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5304 |
// If using innerHTML throws an exception, use the fallback method |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5305 |
} catch( e ) {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5306 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5307 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5308 |
if ( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5309 |
this.empty().append( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5310 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5311 |
}, null, value, arguments.length ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5312 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5313 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5314 |
replaceWith: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5315 |
var arg = arguments[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5316 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5317 |
// Make the changes, replacing each context element with the new content |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5318 |
this.domManip( arguments, function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5319 |
arg = this.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5320 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5321 |
jQuery.cleanData( getAll( this ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5322 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5323 |
if ( arg ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5324 |
arg.replaceChild( elem, this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5325 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5326 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5327 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5328 |
// Force removal if there was no new content (e.g., from empty arguments) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5329 |
return arg && (arg.length || arg.nodeType) ? this : this.remove(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5330 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5331 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5332 |
detach: function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5333 |
return this.remove( selector, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5334 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5335 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5336 |
domManip: function( args, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5337 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5338 |
// Flatten any nested arrays |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5339 |
args = concat.apply( [], args ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5340 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5341 |
var fragment, first, scripts, hasScripts, node, doc, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5342 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5343 |
l = this.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5344 |
set = this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5345 |
iNoClone = l - 1, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5346 |
value = args[ 0 ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5347 |
isFunction = jQuery.isFunction( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5348 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5349 |
// We can't cloneNode fragments that contain checked, in WebKit |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5350 |
if ( isFunction || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5351 |
( l > 1 && typeof value === "string" && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5352 |
!support.checkClone && rchecked.test( value ) ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5353 |
return this.each(function( index ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5354 |
var self = set.eq( index ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5355 |
if ( isFunction ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5356 |
args[ 0 ] = value.call( this, index, self.html() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5357 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5358 |
self.domManip( args, callback ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5359 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5360 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5361 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5362 |
if ( l ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5363 |
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5364 |
first = fragment.firstChild; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5365 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5366 |
if ( fragment.childNodes.length === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5367 |
fragment = first; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5368 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5369 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5370 |
if ( first ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5371 |
scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5372 |
hasScripts = scripts.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5373 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5374 |
// Use the original fragment for the last item instead of the first because it can end up |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5375 |
// being emptied incorrectly in certain situations (#8070). |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5376 |
for ( ; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5377 |
node = fragment; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5378 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5379 |
if ( i !== iNoClone ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5380 |
node = jQuery.clone( node, true, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5381 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5382 |
// Keep references to cloned scripts for later restoration |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5383 |
if ( hasScripts ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5384 |
// Support: QtWebKit |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5385 |
// jQuery.merge because push.apply(_, arraylike) throws |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5386 |
jQuery.merge( scripts, getAll( node, "script" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5387 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5388 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5389 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5390 |
callback.call( this[ i ], node, i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5391 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5392 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5393 |
if ( hasScripts ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5394 |
doc = scripts[ scripts.length - 1 ].ownerDocument; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5395 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5396 |
// Reenable scripts |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5397 |
jQuery.map( scripts, restoreScript ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5398 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5399 |
// Evaluate executable scripts on first document insertion |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5400 |
for ( i = 0; i < hasScripts; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5401 |
node = scripts[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5402 |
if ( rscriptType.test( node.type || "" ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5403 |
!data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5404 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5405 |
if ( node.src ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5406 |
// Optional AJAX dependency, but won't run scripts if not present |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5407 |
if ( jQuery._evalUrl ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5408 |
jQuery._evalUrl( node.src ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5409 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5410 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5411 |
jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5412 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5413 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5414 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5415 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5416 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5417 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5418 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5419 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5420 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5421 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5422 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5423 |
jQuery.each({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5424 |
appendTo: "append", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5425 |
prependTo: "prepend", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5426 |
insertBefore: "before", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5427 |
insertAfter: "after", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5428 |
replaceAll: "replaceWith" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5429 |
}, function( name, original ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5430 |
jQuery.fn[ name ] = function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5431 |
var elems, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5432 |
ret = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5433 |
insert = jQuery( selector ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5434 |
last = insert.length - 1, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5435 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5436 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5437 |
for ( ; i <= last; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5438 |
elems = i === last ? this : this.clone( true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5439 |
jQuery( insert[ i ] )[ original ]( elems ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5440 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5441 |
// Support: QtWebKit |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5442 |
// .get() because push.apply(_, arraylike) throws |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5443 |
push.apply( ret, elems.get() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5444 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5445 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5446 |
return this.pushStack( ret ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5447 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5448 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5449 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5450 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5451 |
var iframe, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5452 |
elemdisplay = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5453 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5454 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5455 |
* Retrieve the actual display of a element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5456 |
* @param {String} name nodeName of the element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5457 |
* @param {Object} doc Document object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5458 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5459 |
// Called only from within defaultDisplay |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5460 |
function actualDisplay( name, doc ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5461 |
var style, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5462 |
elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5463 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5464 |
// getDefaultComputedStyle might be reliably used only on attached element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5465 |
display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5466 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5467 |
// Use of this method is a temporary fix (more like optmization) until something better comes along, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5468 |
// since it was removed from specification and supported only in FF |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5469 |
style.display : jQuery.css( elem[ 0 ], "display" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5470 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5471 |
// We don't have any data stored on the element, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5472 |
// so use "detach" method as fast way to get rid of the element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5473 |
elem.detach(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5474 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5475 |
return display; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5476 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5477 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5478 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5479 |
* Try to determine the default display value of an element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5480 |
* @param {String} nodeName |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5481 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5482 |
function defaultDisplay( nodeName ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5483 |
var doc = document, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5484 |
display = elemdisplay[ nodeName ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5485 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5486 |
if ( !display ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5487 |
display = actualDisplay( nodeName, doc ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5488 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5489 |
// If the simple way fails, read from inside an iframe |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5490 |
if ( display === "none" || !display ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5491 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5492 |
// Use the already-created iframe if possible |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5493 |
iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5494 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5495 |
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5496 |
doc = iframe[ 0 ].contentDocument; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5497 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5498 |
// Support: IE |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5499 |
doc.write(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5500 |
doc.close(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5501 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5502 |
display = actualDisplay( nodeName, doc ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5503 |
iframe.detach(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5504 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5505 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5506 |
// Store the correct default display |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5507 |
elemdisplay[ nodeName ] = display; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5508 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5509 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5510 |
return display; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5511 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5512 |
var rmargin = (/^margin/); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5513 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5514 |
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5515 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5516 |
var getStyles = function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5517 |
return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5518 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5519 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5520 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5521 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5522 |
function curCSS( elem, name, computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5523 |
var width, minWidth, maxWidth, ret, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5524 |
style = elem.style; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5525 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5526 |
computed = computed || getStyles( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5527 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5528 |
// Support: IE9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5529 |
// getPropertyValue is only needed for .css('filter') in IE9, see #12537 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5530 |
if ( computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5531 |
ret = computed.getPropertyValue( name ) || computed[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5532 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5533 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5534 |
if ( computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5535 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5536 |
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5537 |
ret = jQuery.style( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5538 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5539 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5540 |
// Support: iOS < 6 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5541 |
// A tribute to the "awesome hack by Dean Edwards" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5542 |
// iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5543 |
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5544 |
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5545 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5546 |
// Remember the original values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5547 |
width = style.width; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5548 |
minWidth = style.minWidth; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5549 |
maxWidth = style.maxWidth; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5550 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5551 |
// Put in the new values to get a computed value out |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5552 |
style.minWidth = style.maxWidth = style.width = ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5553 |
ret = computed.width; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5554 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5555 |
// Revert the changed values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5556 |
style.width = width; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5557 |
style.minWidth = minWidth; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5558 |
style.maxWidth = maxWidth; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5559 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5560 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5561 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5562 |
return ret !== undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5563 |
// Support: IE |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5564 |
// IE returns zIndex value as an integer. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5565 |
ret + "" : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5566 |
ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5567 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5568 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5569 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5570 |
function addGetHookIf( conditionFn, hookFn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5571 |
// Define the hook, we'll check on the first run if it's really needed. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5572 |
return { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5573 |
get: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5574 |
if ( conditionFn() ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5575 |
// Hook not needed (or it's not possible to use it due to missing dependency), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5576 |
// remove it. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5577 |
// Since there are no other hooks for marginRight, remove the whole object. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5578 |
delete this.get; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5579 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5580 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5581 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5582 |
// Hook needed; redefine it so that the support test is not executed again. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5583 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5584 |
return (this.get = hookFn).apply( this, arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5585 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5586 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5587 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5588 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5589 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5590 |
(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5591 |
var pixelPositionVal, boxSizingReliableVal, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5592 |
docElem = document.documentElement, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5593 |
container = document.createElement( "div" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5594 |
div = document.createElement( "div" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5595 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5596 |
if ( !div.style ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5597 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5598 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5599 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5600 |
div.style.backgroundClip = "content-box"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5601 |
div.cloneNode( true ).style.backgroundClip = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5602 |
support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5603 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5604 |
container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5605 |
"position:absolute"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5606 |
container.appendChild( div ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5607 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5608 |
// Executing both pixelPosition & boxSizingReliable tests require only one layout |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5609 |
// so they're executed at the same time to save the second computation. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5610 |
function computePixelPositionAndBoxSizingReliable() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5611 |
div.style.cssText = |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5612 |
// Support: Firefox<29, Android 2.3 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5613 |
// Vendor-prefix box-sizing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5614 |
"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5615 |
"box-sizing:border-box;display:block;margin-top:1%;top:1%;" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5616 |
"border:1px;padding:1px;width:4px;position:absolute"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5617 |
div.innerHTML = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5618 |
docElem.appendChild( container ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5619 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5620 |
var divStyle = window.getComputedStyle( div, null ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5621 |
pixelPositionVal = divStyle.top !== "1%"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5622 |
boxSizingReliableVal = divStyle.width === "4px"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5623 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5624 |
docElem.removeChild( container ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5625 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5626 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5627 |
// Support: node.js jsdom |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5628 |
// Don't assume that getComputedStyle is a property of the global object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5629 |
if ( window.getComputedStyle ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5630 |
jQuery.extend( support, { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5631 |
pixelPosition: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5632 |
// This test is executed only once but we still do memoizing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5633 |
// since we can use the boxSizingReliable pre-computing. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5634 |
// No need to check if the test was already performed, though. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5635 |
computePixelPositionAndBoxSizingReliable(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5636 |
return pixelPositionVal; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5637 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5638 |
boxSizingReliable: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5639 |
if ( boxSizingReliableVal == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5640 |
computePixelPositionAndBoxSizingReliable(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5641 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5642 |
return boxSizingReliableVal; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5643 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5644 |
reliableMarginRight: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5645 |
// Support: Android 2.3 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5646 |
// Check if div with explicit width and no margin-right incorrectly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5647 |
// gets computed margin-right based on width of container. (#3333) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5648 |
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5649 |
// This support function is only executed once so no memoizing is needed. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5650 |
var ret, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5651 |
marginDiv = div.appendChild( document.createElement( "div" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5652 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5653 |
// Reset CSS: box-sizing; display; margin; border; padding |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5654 |
marginDiv.style.cssText = div.style.cssText = |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5655 |
// Support: Firefox<29, Android 2.3 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5656 |
// Vendor-prefix box-sizing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5657 |
"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5658 |
"box-sizing:content-box;display:block;margin:0;border:0;padding:0"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5659 |
marginDiv.style.marginRight = marginDiv.style.width = "0"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5660 |
div.style.width = "1px"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5661 |
docElem.appendChild( container ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5662 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5663 |
ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5664 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5665 |
docElem.removeChild( container ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5666 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5667 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5668 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5669 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5670 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5671 |
})(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5672 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5673 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5674 |
// A method for quickly swapping in/out CSS properties to get correct calculations. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5675 |
jQuery.swap = function( elem, options, callback, args ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5676 |
var ret, name, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5677 |
old = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5678 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5679 |
// Remember the old values, and insert the new ones |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5680 |
for ( name in options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5681 |
old[ name ] = elem.style[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5682 |
elem.style[ name ] = options[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5683 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5684 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5685 |
ret = callback.apply( elem, args || [] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5686 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5687 |
// Revert the old values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5688 |
for ( name in options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5689 |
elem.style[ name ] = old[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5690 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5691 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5692 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5693 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5694 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5695 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5696 |
var |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5697 |
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5698 |
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5699 |
rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5700 |
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5701 |
rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5702 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5703 |
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5704 |
cssNormalTransform = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5705 |
letterSpacing: "0", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5706 |
fontWeight: "400" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5707 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5708 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5709 |
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5710 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5711 |
// return a css property mapped to a potentially vendor prefixed property |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5712 |
function vendorPropName( style, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5713 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5714 |
// shortcut for names that are not vendor prefixed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5715 |
if ( name in style ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5716 |
return name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5717 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5718 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5719 |
// check for vendor prefixed names |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5720 |
var capName = name[0].toUpperCase() + name.slice(1), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5721 |
origName = name, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5722 |
i = cssPrefixes.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5723 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5724 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5725 |
name = cssPrefixes[ i ] + capName; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5726 |
if ( name in style ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5727 |
return name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5728 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5729 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5730 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5731 |
return origName; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5732 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5733 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5734 |
function setPositiveNumber( elem, value, subtract ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5735 |
var matches = rnumsplit.exec( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5736 |
return matches ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5737 |
// Guard against undefined "subtract", e.g., when used as in cssHooks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5738 |
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5739 |
value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5740 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5741 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5742 |
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5743 |
var i = extra === ( isBorderBox ? "border" : "content" ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5744 |
// If we already have the right measurement, avoid augmentation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5745 |
4 : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5746 |
// Otherwise initialize for horizontal or vertical properties |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5747 |
name === "width" ? 1 : 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5748 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5749 |
val = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5750 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5751 |
for ( ; i < 4; i += 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5752 |
// both box models exclude margin, so add it if we want it |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5753 |
if ( extra === "margin" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5754 |
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5755 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5756 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5757 |
if ( isBorderBox ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5758 |
// border-box includes padding, so remove it if we want content |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5759 |
if ( extra === "content" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5760 |
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5761 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5762 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5763 |
// at this point, extra isn't border nor margin, so remove border |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5764 |
if ( extra !== "margin" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5765 |
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5766 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5767 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5768 |
// at this point, extra isn't content, so add padding |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5769 |
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5770 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5771 |
// at this point, extra isn't content nor padding, so add border |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5772 |
if ( extra !== "padding" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5773 |
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5774 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5775 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5776 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5777 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5778 |
return val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5779 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5780 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5781 |
function getWidthOrHeight( elem, name, extra ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5782 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5783 |
// Start with offset property, which is equivalent to the border-box value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5784 |
var valueIsBorderBox = true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5785 |
val = name === "width" ? elem.offsetWidth : elem.offsetHeight, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5786 |
styles = getStyles( elem ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5787 |
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5788 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5789 |
// some non-html elements return undefined for offsetWidth, so check for null/undefined |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5790 |
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5791 |
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5792 |
if ( val <= 0 || val == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5793 |
// Fall back to computed then uncomputed css if necessary |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5794 |
val = curCSS( elem, name, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5795 |
if ( val < 0 || val == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5796 |
val = elem.style[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5797 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5798 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5799 |
// Computed unit is not pixels. Stop here and return. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5800 |
if ( rnumnonpx.test(val) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5801 |
return val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5802 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5803 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5804 |
// we need the check for style in case a browser which returns unreliable values |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5805 |
// for getComputedStyle silently falls back to the reliable elem.style |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5806 |
valueIsBorderBox = isBorderBox && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5807 |
( support.boxSizingReliable() || val === elem.style[ name ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5808 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5809 |
// Normalize "", auto, and prepare for extra |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5810 |
val = parseFloat( val ) || 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5811 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5812 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5813 |
// use the active box-sizing model to add/subtract irrelevant styles |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5814 |
return ( val + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5815 |
augmentWidthOrHeight( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5816 |
elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5817 |
name, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5818 |
extra || ( isBorderBox ? "border" : "content" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5819 |
valueIsBorderBox, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5820 |
styles |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5821 |
) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5822 |
) + "px"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5823 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5824 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5825 |
function showHide( elements, show ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5826 |
var display, elem, hidden, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5827 |
values = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5828 |
index = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5829 |
length = elements.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5830 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5831 |
for ( ; index < length; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5832 |
elem = elements[ index ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5833 |
if ( !elem.style ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5834 |
continue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5835 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5836 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5837 |
values[ index ] = data_priv.get( elem, "olddisplay" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5838 |
display = elem.style.display; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5839 |
if ( show ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5840 |
// Reset the inline display of this element to learn if it is |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5841 |
// being hidden by cascaded rules or not |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5842 |
if ( !values[ index ] && display === "none" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5843 |
elem.style.display = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5844 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5845 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5846 |
// Set elements which have been overridden with display: none |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5847 |
// in a stylesheet to whatever the default browser style is |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5848 |
// for such an element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5849 |
if ( elem.style.display === "" && isHidden( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5850 |
values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5851 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5852 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5853 |
hidden = isHidden( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5854 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5855 |
if ( display !== "none" || !hidden ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5856 |
data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5857 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5858 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5859 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5860 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5861 |
// Set the display of most of the elements in a second loop |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5862 |
// to avoid the constant reflow |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5863 |
for ( index = 0; index < length; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5864 |
elem = elements[ index ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5865 |
if ( !elem.style ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5866 |
continue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5867 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5868 |
if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5869 |
elem.style.display = show ? values[ index ] || "" : "none"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5870 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5871 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5872 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5873 |
return elements; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5874 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5875 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5876 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5877 |
// Add in style property hooks for overriding the default |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5878 |
// behavior of getting and setting a style property |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5879 |
cssHooks: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5880 |
opacity: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5881 |
get: function( elem, computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5882 |
if ( computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5883 |
// We should always get a number back from opacity |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5884 |
var ret = curCSS( elem, "opacity" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5885 |
return ret === "" ? "1" : ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5886 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5887 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5888 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5889 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5890 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5891 |
// Don't automatically add "px" to these possibly-unitless properties |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5892 |
cssNumber: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5893 |
"columnCount": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5894 |
"fillOpacity": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5895 |
"flexGrow": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5896 |
"flexShrink": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5897 |
"fontWeight": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5898 |
"lineHeight": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5899 |
"opacity": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5900 |
"order": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5901 |
"orphans": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5902 |
"widows": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5903 |
"zIndex": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5904 |
"zoom": true |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5905 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5906 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5907 |
// Add in properties whose names you wish to fix before |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5908 |
// setting or getting the value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5909 |
cssProps: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5910 |
// normalize float css property |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5911 |
"float": "cssFloat" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5912 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5913 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5914 |
// Get and set the style property on a DOM Node |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5915 |
style: function( elem, name, value, extra ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5916 |
// Don't set styles on text and comment nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5917 |
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5918 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5919 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5920 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5921 |
// Make sure that we're working with the right name |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5922 |
var ret, type, hooks, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5923 |
origName = jQuery.camelCase( name ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5924 |
style = elem.style; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5925 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5926 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5927 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5928 |
// gets hook for the prefixed version |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5929 |
// followed by the unprefixed version |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5930 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5931 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5932 |
// Check if we're setting a value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5933 |
if ( value !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5934 |
type = typeof value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5935 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5936 |
// convert relative number strings (+= or -=) to relative numbers. #7345 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5937 |
if ( type === "string" && (ret = rrelNum.exec( value )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5938 |
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5939 |
// Fixes bug #9237 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5940 |
type = "number"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5941 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5942 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5943 |
// Make sure that null and NaN values aren't set. See: #7116 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5944 |
if ( value == null || value !== value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5945 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5946 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5947 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5948 |
// If a number was passed in, add 'px' to the (except for certain CSS properties) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5949 |
if ( type === "number" && !jQuery.cssNumber[ origName ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5950 |
value += "px"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5951 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5952 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5953 |
// Fixes #8908, it can be done more correctly by specifying setters in cssHooks, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5954 |
// but it would mean to define eight (for every problematic property) identical functions |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5955 |
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5956 |
style[ name ] = "inherit"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5957 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5958 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5959 |
// If a hook was provided, use that value, otherwise just set the specified value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5960 |
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5961 |
style[ name ] = value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5962 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5963 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5964 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5965 |
// If a hook was provided get the non-computed value from there |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5966 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5967 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5968 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5969 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5970 |
// Otherwise just get the value from the style object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5971 |
return style[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5972 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5973 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5974 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5975 |
css: function( elem, name, extra, styles ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5976 |
var val, num, hooks, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5977 |
origName = jQuery.camelCase( name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5978 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5979 |
// Make sure that we're working with the right name |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5980 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5981 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5982 |
// gets hook for the prefixed version |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5983 |
// followed by the unprefixed version |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5984 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5985 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5986 |
// If a hook was provided get the computed value from there |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5987 |
if ( hooks && "get" in hooks ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5988 |
val = hooks.get( elem, true, extra ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5989 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5990 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5991 |
// Otherwise, if a way to get the computed value exists, use that |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5992 |
if ( val === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5993 |
val = curCSS( elem, name, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5994 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5995 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5996 |
//convert "normal" to computed value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5997 |
if ( val === "normal" && name in cssNormalTransform ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5998 |
val = cssNormalTransform[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
5999 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6000 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6001 |
// Return, converting to number if forced or a qualifier was provided and val looks numeric |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6002 |
if ( extra === "" || extra ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6003 |
num = parseFloat( val ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6004 |
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6005 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6006 |
return val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6007 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6008 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6009 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6010 |
jQuery.each([ "height", "width" ], function( i, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6011 |
jQuery.cssHooks[ name ] = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6012 |
get: function( elem, computed, extra ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6013 |
if ( computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6014 |
// certain elements can have dimension info if we invisibly show them |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6015 |
// however, it must have a current display style that would benefit from this |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6016 |
return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6017 |
jQuery.swap( elem, cssShow, function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6018 |
return getWidthOrHeight( elem, name, extra ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6019 |
}) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6020 |
getWidthOrHeight( elem, name, extra ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6021 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6022 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6023 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6024 |
set: function( elem, value, extra ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6025 |
var styles = extra && getStyles( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6026 |
return setPositiveNumber( elem, value, extra ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6027 |
augmentWidthOrHeight( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6028 |
elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6029 |
name, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6030 |
extra, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6031 |
jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6032 |
styles |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6033 |
) : 0 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6034 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6035 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6036 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6037 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6038 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6039 |
// Support: Android 2.3 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6040 |
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6041 |
function( elem, computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6042 |
if ( computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6043 |
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6044 |
// Work around by temporarily setting element display to inline-block |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6045 |
return jQuery.swap( elem, { "display": "inline-block" }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6046 |
curCSS, [ elem, "marginRight" ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6047 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6048 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6049 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6050 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6051 |
// These hooks are used by animate to expand properties |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6052 |
jQuery.each({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6053 |
margin: "", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6054 |
padding: "", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6055 |
border: "Width" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6056 |
}, function( prefix, suffix ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6057 |
jQuery.cssHooks[ prefix + suffix ] = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6058 |
expand: function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6059 |
var i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6060 |
expanded = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6061 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6062 |
// assumes a single number if not a string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6063 |
parts = typeof value === "string" ? value.split(" ") : [ value ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6064 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6065 |
for ( ; i < 4; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6066 |
expanded[ prefix + cssExpand[ i ] + suffix ] = |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6067 |
parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6068 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6069 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6070 |
return expanded; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6071 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6072 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6073 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6074 |
if ( !rmargin.test( prefix ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6075 |
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6076 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6077 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6078 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6079 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6080 |
css: function( name, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6081 |
return access( this, function( elem, name, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6082 |
var styles, len, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6083 |
map = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6084 |
i = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6085 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6086 |
if ( jQuery.isArray( name ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6087 |
styles = getStyles( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6088 |
len = name.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6089 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6090 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6091 |
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6092 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6093 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6094 |
return map; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6095 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6096 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6097 |
return value !== undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6098 |
jQuery.style( elem, name, value ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6099 |
jQuery.css( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6100 |
}, name, value, arguments.length > 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6101 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6102 |
show: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6103 |
return showHide( this, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6104 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6105 |
hide: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6106 |
return showHide( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6107 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6108 |
toggle: function( state ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6109 |
if ( typeof state === "boolean" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6110 |
return state ? this.show() : this.hide(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6111 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6112 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6113 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6114 |
if ( isHidden( this ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6115 |
jQuery( this ).show(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6116 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6117 |
jQuery( this ).hide(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6118 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6119 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6120 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6121 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6122 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6123 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6124 |
function Tween( elem, options, prop, end, easing ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6125 |
return new Tween.prototype.init( elem, options, prop, end, easing ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6126 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6127 |
jQuery.Tween = Tween; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6128 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6129 |
Tween.prototype = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6130 |
constructor: Tween, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6131 |
init: function( elem, options, prop, end, easing, unit ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6132 |
this.elem = elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6133 |
this.prop = prop; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6134 |
this.easing = easing || "swing"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6135 |
this.options = options; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6136 |
this.start = this.now = this.cur(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6137 |
this.end = end; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6138 |
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6139 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6140 |
cur: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6141 |
var hooks = Tween.propHooks[ this.prop ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6142 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6143 |
return hooks && hooks.get ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6144 |
hooks.get( this ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6145 |
Tween.propHooks._default.get( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6146 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6147 |
run: function( percent ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6148 |
var eased, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6149 |
hooks = Tween.propHooks[ this.prop ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6150 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6151 |
if ( this.options.duration ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6152 |
this.pos = eased = jQuery.easing[ this.easing ]( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6153 |
percent, this.options.duration * percent, 0, 1, this.options.duration |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6154 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6155 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6156 |
this.pos = eased = percent; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6157 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6158 |
this.now = ( this.end - this.start ) * eased + this.start; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6159 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6160 |
if ( this.options.step ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6161 |
this.options.step.call( this.elem, this.now, this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6162 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6163 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6164 |
if ( hooks && hooks.set ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6165 |
hooks.set( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6166 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6167 |
Tween.propHooks._default.set( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6168 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6169 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6170 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6171 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6172 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6173 |
Tween.prototype.init.prototype = Tween.prototype; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6174 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6175 |
Tween.propHooks = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6176 |
_default: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6177 |
get: function( tween ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6178 |
var result; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6179 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6180 |
if ( tween.elem[ tween.prop ] != null && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6181 |
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6182 |
return tween.elem[ tween.prop ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6183 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6184 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6185 |
// passing an empty string as a 3rd parameter to .css will automatically |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6186 |
// attempt a parseFloat and fallback to a string if the parse fails |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6187 |
// so, simple values such as "10px" are parsed to Float. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6188 |
// complex values such as "rotate(1rad)" are returned as is. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6189 |
result = jQuery.css( tween.elem, tween.prop, "" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6190 |
// Empty strings, null, undefined and "auto" are converted to 0. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6191 |
return !result || result === "auto" ? 0 : result; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6192 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6193 |
set: function( tween ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6194 |
// use step hook for back compat - use cssHook if its there - use .style if its |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6195 |
// available and use plain properties where available |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6196 |
if ( jQuery.fx.step[ tween.prop ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6197 |
jQuery.fx.step[ tween.prop ]( tween ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6198 |
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6199 |
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6200 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6201 |
tween.elem[ tween.prop ] = tween.now; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6202 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6203 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6204 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6205 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6206 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6207 |
// Support: IE9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6208 |
// Panic based approach to setting things on disconnected nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6209 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6210 |
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6211 |
set: function( tween ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6212 |
if ( tween.elem.nodeType && tween.elem.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6213 |
tween.elem[ tween.prop ] = tween.now; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6214 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6215 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6216 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6217 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6218 |
jQuery.easing = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6219 |
linear: function( p ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6220 |
return p; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6221 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6222 |
swing: function( p ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6223 |
return 0.5 - Math.cos( p * Math.PI ) / 2; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6224 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6225 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6226 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6227 |
jQuery.fx = Tween.prototype.init; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6228 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6229 |
// Back Compat <1.8 extension point |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6230 |
jQuery.fx.step = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6231 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6232 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6233 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6234 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6235 |
var |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6236 |
fxNow, timerId, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6237 |
rfxtypes = /^(?:toggle|show|hide)$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6238 |
rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6239 |
rrun = /queueHooks$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6240 |
animationPrefilters = [ defaultPrefilter ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6241 |
tweeners = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6242 |
"*": [ function( prop, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6243 |
var tween = this.createTween( prop, value ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6244 |
target = tween.cur(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6245 |
parts = rfxnum.exec( value ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6246 |
unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6247 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6248 |
// Starting value computation is required for potential unit mismatches |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6249 |
start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6250 |
rfxnum.exec( jQuery.css( tween.elem, prop ) ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6251 |
scale = 1, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6252 |
maxIterations = 20; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6253 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6254 |
if ( start && start[ 3 ] !== unit ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6255 |
// Trust units reported by jQuery.css |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6256 |
unit = unit || start[ 3 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6257 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6258 |
// Make sure we update the tween properties later on |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6259 |
parts = parts || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6260 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6261 |
// Iteratively approximate from a nonzero starting point |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6262 |
start = +target || 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6263 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6264 |
do { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6265 |
// If previous iteration zeroed out, double until we get *something* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6266 |
// Use a string for doubling factor so we don't accidentally see scale as unchanged below |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6267 |
scale = scale || ".5"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6268 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6269 |
// Adjust and apply |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6270 |
start = start / scale; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6271 |
jQuery.style( tween.elem, prop, start + unit ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6272 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6273 |
// Update scale, tolerating zero or NaN from tween.cur() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6274 |
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6275 |
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6276 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6277 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6278 |
// Update tween properties |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6279 |
if ( parts ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6280 |
start = tween.start = +start || +target || 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6281 |
tween.unit = unit; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6282 |
// If a +=/-= token was provided, we're doing a relative animation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6283 |
tween.end = parts[ 1 ] ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6284 |
start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6285 |
+parts[ 2 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6286 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6287 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6288 |
return tween; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6289 |
} ] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6290 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6291 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6292 |
// Animations created synchronously will run synchronously |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6293 |
function createFxNow() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6294 |
setTimeout(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6295 |
fxNow = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6296 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6297 |
return ( fxNow = jQuery.now() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6298 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6299 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6300 |
// Generate parameters to create a standard animation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6301 |
function genFx( type, includeWidth ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6302 |
var which, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6303 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6304 |
attrs = { height: type }; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6305 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6306 |
// if we include width, step value is 1 to do all cssExpand values, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6307 |
// if we don't include width, step value is 2 to skip over Left and Right |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6308 |
includeWidth = includeWidth ? 1 : 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6309 |
for ( ; i < 4 ; i += 2 - includeWidth ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6310 |
which = cssExpand[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6311 |
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6312 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6313 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6314 |
if ( includeWidth ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6315 |
attrs.opacity = attrs.width = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6316 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6317 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6318 |
return attrs; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6319 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6320 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6321 |
function createTween( value, prop, animation ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6322 |
var tween, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6323 |
collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6324 |
index = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6325 |
length = collection.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6326 |
for ( ; index < length; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6327 |
if ( (tween = collection[ index ].call( animation, prop, value )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6328 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6329 |
// we're done with this property |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6330 |
return tween; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6331 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6332 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6333 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6334 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6335 |
function defaultPrefilter( elem, props, opts ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6336 |
/* jshint validthis: true */ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6337 |
var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6338 |
anim = this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6339 |
orig = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6340 |
style = elem.style, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6341 |
hidden = elem.nodeType && isHidden( elem ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6342 |
dataShow = data_priv.get( elem, "fxshow" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6343 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6344 |
// handle queue: false promises |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6345 |
if ( !opts.queue ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6346 |
hooks = jQuery._queueHooks( elem, "fx" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6347 |
if ( hooks.unqueued == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6348 |
hooks.unqueued = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6349 |
oldfire = hooks.empty.fire; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6350 |
hooks.empty.fire = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6351 |
if ( !hooks.unqueued ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6352 |
oldfire(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6353 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6354 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6355 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6356 |
hooks.unqueued++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6357 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6358 |
anim.always(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6359 |
// doing this makes sure that the complete handler will be called |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6360 |
// before this completes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6361 |
anim.always(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6362 |
hooks.unqueued--; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6363 |
if ( !jQuery.queue( elem, "fx" ).length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6364 |
hooks.empty.fire(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6365 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6366 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6367 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6368 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6369 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6370 |
// height/width overflow pass |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6371 |
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6372 |
// Make sure that nothing sneaks out |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6373 |
// Record all 3 overflow attributes because IE9-10 do not |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6374 |
// change the overflow attribute when overflowX and |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6375 |
// overflowY are set to the same value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6376 |
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6377 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6378 |
// Set display property to inline-block for height/width |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6379 |
// animations on inline elements that are having width/height animated |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6380 |
display = jQuery.css( elem, "display" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6381 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6382 |
// Test default display if display is currently "none" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6383 |
checkDisplay = display === "none" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6384 |
data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6385 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6386 |
if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6387 |
style.display = "inline-block"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6388 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6389 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6390 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6391 |
if ( opts.overflow ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6392 |
style.overflow = "hidden"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6393 |
anim.always(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6394 |
style.overflow = opts.overflow[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6395 |
style.overflowX = opts.overflow[ 1 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6396 |
style.overflowY = opts.overflow[ 2 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6397 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6398 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6399 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6400 |
// show/hide pass |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6401 |
for ( prop in props ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6402 |
value = props[ prop ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6403 |
if ( rfxtypes.exec( value ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6404 |
delete props[ prop ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6405 |
toggle = toggle || value === "toggle"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6406 |
if ( value === ( hidden ? "hide" : "show" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6407 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6408 |
// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6409 |
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6410 |
hidden = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6411 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6412 |
continue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6413 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6414 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6415 |
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6416 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6417 |
// Any non-fx value stops us from restoring the original display value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6418 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6419 |
display = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6420 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6421 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6422 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6423 |
if ( !jQuery.isEmptyObject( orig ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6424 |
if ( dataShow ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6425 |
if ( "hidden" in dataShow ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6426 |
hidden = dataShow.hidden; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6427 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6428 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6429 |
dataShow = data_priv.access( elem, "fxshow", {} ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6430 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6431 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6432 |
// store state if its toggle - enables .stop().toggle() to "reverse" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6433 |
if ( toggle ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6434 |
dataShow.hidden = !hidden; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6435 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6436 |
if ( hidden ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6437 |
jQuery( elem ).show(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6438 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6439 |
anim.done(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6440 |
jQuery( elem ).hide(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6441 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6442 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6443 |
anim.done(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6444 |
var prop; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6445 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6446 |
data_priv.remove( elem, "fxshow" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6447 |
for ( prop in orig ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6448 |
jQuery.style( elem, prop, orig[ prop ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6449 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6450 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6451 |
for ( prop in orig ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6452 |
tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6453 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6454 |
if ( !( prop in dataShow ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6455 |
dataShow[ prop ] = tween.start; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6456 |
if ( hidden ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6457 |
tween.end = tween.start; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6458 |
tween.start = prop === "width" || prop === "height" ? 1 : 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6459 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6460 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6461 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6462 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6463 |
// If this is a noop like .hide().hide(), restore an overwritten display value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6464 |
} else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6465 |
style.display = display; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6466 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6467 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6468 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6469 |
function propFilter( props, specialEasing ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6470 |
var index, name, easing, value, hooks; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6471 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6472 |
// camelCase, specialEasing and expand cssHook pass |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6473 |
for ( index in props ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6474 |
name = jQuery.camelCase( index ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6475 |
easing = specialEasing[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6476 |
value = props[ index ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6477 |
if ( jQuery.isArray( value ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6478 |
easing = value[ 1 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6479 |
value = props[ index ] = value[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6480 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6481 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6482 |
if ( index !== name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6483 |
props[ name ] = value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6484 |
delete props[ index ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6485 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6486 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6487 |
hooks = jQuery.cssHooks[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6488 |
if ( hooks && "expand" in hooks ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6489 |
value = hooks.expand( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6490 |
delete props[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6491 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6492 |
// not quite $.extend, this wont overwrite keys already present. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6493 |
// also - reusing 'index' from above because we have the correct "name" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6494 |
for ( index in value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6495 |
if ( !( index in props ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6496 |
props[ index ] = value[ index ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6497 |
specialEasing[ index ] = easing; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6498 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6499 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6500 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6501 |
specialEasing[ name ] = easing; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6502 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6503 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6504 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6505 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6506 |
function Animation( elem, properties, options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6507 |
var result, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6508 |
stopped, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6509 |
index = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6510 |
length = animationPrefilters.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6511 |
deferred = jQuery.Deferred().always( function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6512 |
// don't match elem in the :animated selector |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6513 |
delete tick.elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6514 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6515 |
tick = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6516 |
if ( stopped ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6517 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6518 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6519 |
var currentTime = fxNow || createFxNow(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6520 |
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6521 |
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6522 |
temp = remaining / animation.duration || 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6523 |
percent = 1 - temp, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6524 |
index = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6525 |
length = animation.tweens.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6526 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6527 |
for ( ; index < length ; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6528 |
animation.tweens[ index ].run( percent ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6529 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6530 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6531 |
deferred.notifyWith( elem, [ animation, percent, remaining ]); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6532 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6533 |
if ( percent < 1 && length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6534 |
return remaining; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6535 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6536 |
deferred.resolveWith( elem, [ animation ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6537 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6538 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6539 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6540 |
animation = deferred.promise({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6541 |
elem: elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6542 |
props: jQuery.extend( {}, properties ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6543 |
opts: jQuery.extend( true, { specialEasing: {} }, options ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6544 |
originalProperties: properties, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6545 |
originalOptions: options, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6546 |
startTime: fxNow || createFxNow(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6547 |
duration: options.duration, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6548 |
tweens: [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6549 |
createTween: function( prop, end ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6550 |
var tween = jQuery.Tween( elem, animation.opts, prop, end, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6551 |
animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6552 |
animation.tweens.push( tween ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6553 |
return tween; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6554 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6555 |
stop: function( gotoEnd ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6556 |
var index = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6557 |
// if we are going to the end, we want to run all the tweens |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6558 |
// otherwise we skip this part |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6559 |
length = gotoEnd ? animation.tweens.length : 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6560 |
if ( stopped ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6561 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6562 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6563 |
stopped = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6564 |
for ( ; index < length ; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6565 |
animation.tweens[ index ].run( 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6566 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6567 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6568 |
// resolve when we played the last frame |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6569 |
// otherwise, reject |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6570 |
if ( gotoEnd ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6571 |
deferred.resolveWith( elem, [ animation, gotoEnd ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6572 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6573 |
deferred.rejectWith( elem, [ animation, gotoEnd ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6574 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6575 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6576 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6577 |
}), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6578 |
props = animation.props; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6579 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6580 |
propFilter( props, animation.opts.specialEasing ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6581 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6582 |
for ( ; index < length ; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6583 |
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6584 |
if ( result ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6585 |
return result; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6586 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6587 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6588 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6589 |
jQuery.map( props, createTween, animation ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6590 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6591 |
if ( jQuery.isFunction( animation.opts.start ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6592 |
animation.opts.start.call( elem, animation ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6593 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6594 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6595 |
jQuery.fx.timer( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6596 |
jQuery.extend( tick, { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6597 |
elem: elem, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6598 |
anim: animation, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6599 |
queue: animation.opts.queue |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6600 |
}) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6601 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6602 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6603 |
// attach callbacks from options |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6604 |
return animation.progress( animation.opts.progress ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6605 |
.done( animation.opts.done, animation.opts.complete ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6606 |
.fail( animation.opts.fail ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6607 |
.always( animation.opts.always ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6608 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6609 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6610 |
jQuery.Animation = jQuery.extend( Animation, { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6611 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6612 |
tweener: function( props, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6613 |
if ( jQuery.isFunction( props ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6614 |
callback = props; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6615 |
props = [ "*" ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6616 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6617 |
props = props.split(" "); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6618 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6619 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6620 |
var prop, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6621 |
index = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6622 |
length = props.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6623 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6624 |
for ( ; index < length ; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6625 |
prop = props[ index ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6626 |
tweeners[ prop ] = tweeners[ prop ] || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6627 |
tweeners[ prop ].unshift( callback ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6628 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6629 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6630 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6631 |
prefilter: function( callback, prepend ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6632 |
if ( prepend ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6633 |
animationPrefilters.unshift( callback ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6634 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6635 |
animationPrefilters.push( callback ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6636 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6637 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6638 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6639 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6640 |
jQuery.speed = function( speed, easing, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6641 |
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6642 |
complete: fn || !fn && easing || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6643 |
jQuery.isFunction( speed ) && speed, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6644 |
duration: speed, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6645 |
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6646 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6647 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6648 |
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6649 |
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6650 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6651 |
// normalize opt.queue - true/undefined/null -> "fx" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6652 |
if ( opt.queue == null || opt.queue === true ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6653 |
opt.queue = "fx"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6654 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6655 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6656 |
// Queueing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6657 |
opt.old = opt.complete; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6658 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6659 |
opt.complete = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6660 |
if ( jQuery.isFunction( opt.old ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6661 |
opt.old.call( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6662 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6663 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6664 |
if ( opt.queue ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6665 |
jQuery.dequeue( this, opt.queue ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6666 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6667 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6668 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6669 |
return opt; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6670 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6671 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6672 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6673 |
fadeTo: function( speed, to, easing, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6674 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6675 |
// show any hidden elements after setting opacity to 0 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6676 |
return this.filter( isHidden ).css( "opacity", 0 ).show() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6677 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6678 |
// animate to the value specified |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6679 |
.end().animate({ opacity: to }, speed, easing, callback ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6680 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6681 |
animate: function( prop, speed, easing, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6682 |
var empty = jQuery.isEmptyObject( prop ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6683 |
optall = jQuery.speed( speed, easing, callback ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6684 |
doAnimation = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6685 |
// Operate on a copy of prop so per-property easing won't be lost |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6686 |
var anim = Animation( this, jQuery.extend( {}, prop ), optall ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6687 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6688 |
// Empty animations, or finishing resolves immediately |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6689 |
if ( empty || data_priv.get( this, "finish" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6690 |
anim.stop( true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6691 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6692 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6693 |
doAnimation.finish = doAnimation; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6694 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6695 |
return empty || optall.queue === false ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6696 |
this.each( doAnimation ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6697 |
this.queue( optall.queue, doAnimation ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6698 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6699 |
stop: function( type, clearQueue, gotoEnd ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6700 |
var stopQueue = function( hooks ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6701 |
var stop = hooks.stop; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6702 |
delete hooks.stop; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6703 |
stop( gotoEnd ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6704 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6705 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6706 |
if ( typeof type !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6707 |
gotoEnd = clearQueue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6708 |
clearQueue = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6709 |
type = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6710 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6711 |
if ( clearQueue && type !== false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6712 |
this.queue( type || "fx", [] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6713 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6714 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6715 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6716 |
var dequeue = true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6717 |
index = type != null && type + "queueHooks", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6718 |
timers = jQuery.timers, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6719 |
data = data_priv.get( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6720 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6721 |
if ( index ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6722 |
if ( data[ index ] && data[ index ].stop ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6723 |
stopQueue( data[ index ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6724 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6725 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6726 |
for ( index in data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6727 |
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6728 |
stopQueue( data[ index ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6729 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6730 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6731 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6732 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6733 |
for ( index = timers.length; index--; ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6734 |
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6735 |
timers[ index ].anim.stop( gotoEnd ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6736 |
dequeue = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6737 |
timers.splice( index, 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6738 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6739 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6740 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6741 |
// start the next in the queue if the last step wasn't forced |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6742 |
// timers currently will call their complete callbacks, which will dequeue |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6743 |
// but only if they were gotoEnd |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6744 |
if ( dequeue || !gotoEnd ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6745 |
jQuery.dequeue( this, type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6746 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6747 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6748 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6749 |
finish: function( type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6750 |
if ( type !== false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6751 |
type = type || "fx"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6752 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6753 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6754 |
var index, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6755 |
data = data_priv.get( this ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6756 |
queue = data[ type + "queue" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6757 |
hooks = data[ type + "queueHooks" ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6758 |
timers = jQuery.timers, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6759 |
length = queue ? queue.length : 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6760 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6761 |
// enable finishing flag on private data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6762 |
data.finish = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6763 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6764 |
// empty the queue first |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6765 |
jQuery.queue( this, type, [] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6766 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6767 |
if ( hooks && hooks.stop ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6768 |
hooks.stop.call( this, true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6769 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6770 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6771 |
// look for any active animations, and finish them |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6772 |
for ( index = timers.length; index--; ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6773 |
if ( timers[ index ].elem === this && timers[ index ].queue === type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6774 |
timers[ index ].anim.stop( true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6775 |
timers.splice( index, 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6776 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6777 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6778 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6779 |
// look for any animations in the old queue and finish them |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6780 |
for ( index = 0; index < length; index++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6781 |
if ( queue[ index ] && queue[ index ].finish ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6782 |
queue[ index ].finish.call( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6783 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6784 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6785 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6786 |
// turn off finishing flag |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6787 |
delete data.finish; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6788 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6789 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6790 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6791 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6792 |
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6793 |
var cssFn = jQuery.fn[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6794 |
jQuery.fn[ name ] = function( speed, easing, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6795 |
return speed == null || typeof speed === "boolean" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6796 |
cssFn.apply( this, arguments ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6797 |
this.animate( genFx( name, true ), speed, easing, callback ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6798 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6799 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6800 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6801 |
// Generate shortcuts for custom animations |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6802 |
jQuery.each({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6803 |
slideDown: genFx("show"), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6804 |
slideUp: genFx("hide"), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6805 |
slideToggle: genFx("toggle"), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6806 |
fadeIn: { opacity: "show" }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6807 |
fadeOut: { opacity: "hide" }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6808 |
fadeToggle: { opacity: "toggle" } |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6809 |
}, function( name, props ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6810 |
jQuery.fn[ name ] = function( speed, easing, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6811 |
return this.animate( props, speed, easing, callback ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6812 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6813 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6814 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6815 |
jQuery.timers = []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6816 |
jQuery.fx.tick = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6817 |
var timer, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6818 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6819 |
timers = jQuery.timers; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6820 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6821 |
fxNow = jQuery.now(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6822 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6823 |
for ( ; i < timers.length; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6824 |
timer = timers[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6825 |
// Checks the timer has not already been removed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6826 |
if ( !timer() && timers[ i ] === timer ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6827 |
timers.splice( i--, 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6828 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6829 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6830 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6831 |
if ( !timers.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6832 |
jQuery.fx.stop(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6833 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6834 |
fxNow = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6835 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6836 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6837 |
jQuery.fx.timer = function( timer ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6838 |
jQuery.timers.push( timer ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6839 |
if ( timer() ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6840 |
jQuery.fx.start(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6841 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6842 |
jQuery.timers.pop(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6843 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6844 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6845 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6846 |
jQuery.fx.interval = 13; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6847 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6848 |
jQuery.fx.start = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6849 |
if ( !timerId ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6850 |
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6851 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6852 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6853 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6854 |
jQuery.fx.stop = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6855 |
clearInterval( timerId ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6856 |
timerId = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6857 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6858 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6859 |
jQuery.fx.speeds = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6860 |
slow: 600, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6861 |
fast: 200, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6862 |
// Default speed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6863 |
_default: 400 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6864 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6865 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6866 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6867 |
// Based off of the plugin by Clint Helfers, with permission. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6868 |
// http://blindsignals.com/index.php/2009/07/jquery-delay/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6869 |
jQuery.fn.delay = function( time, type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6870 |
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6871 |
type = type || "fx"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6872 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6873 |
return this.queue( type, function( next, hooks ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6874 |
var timeout = setTimeout( next, time ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6875 |
hooks.stop = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6876 |
clearTimeout( timeout ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6877 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6878 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6879 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6880 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6881 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6882 |
(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6883 |
var input = document.createElement( "input" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6884 |
select = document.createElement( "select" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6885 |
opt = select.appendChild( document.createElement( "option" ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6886 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6887 |
input.type = "checkbox"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6888 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6889 |
// Support: iOS 5.1, Android 4.x, Android 2.3 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6890 |
// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6891 |
support.checkOn = input.value !== ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6892 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6893 |
// Must access the parent to make an option select properly |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6894 |
// Support: IE9, IE10 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6895 |
support.optSelected = opt.selected; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6896 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6897 |
// Make sure that the options inside disabled selects aren't marked as disabled |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6898 |
// (WebKit marks them as disabled) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6899 |
select.disabled = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6900 |
support.optDisabled = !opt.disabled; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6901 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6902 |
// Check if an input maintains its value after becoming a radio |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6903 |
// Support: IE9, IE10 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6904 |
input = document.createElement( "input" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6905 |
input.value = "t"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6906 |
input.type = "radio"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6907 |
support.radioValue = input.value === "t"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6908 |
})(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6909 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6910 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6911 |
var nodeHook, boolHook, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6912 |
attrHandle = jQuery.expr.attrHandle; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6913 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6914 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6915 |
attr: function( name, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6916 |
return access( this, jQuery.attr, name, value, arguments.length > 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6917 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6918 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6919 |
removeAttr: function( name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6920 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6921 |
jQuery.removeAttr( this, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6922 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6923 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6924 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6925 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6926 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6927 |
attr: function( elem, name, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6928 |
var hooks, ret, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6929 |
nType = elem.nodeType; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6930 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6931 |
// don't get/set attributes on text, comment and attribute nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6932 |
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6933 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6934 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6935 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6936 |
// Fallback to prop when attributes are not supported |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6937 |
if ( typeof elem.getAttribute === strundefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6938 |
return jQuery.prop( elem, name, value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6939 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6940 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6941 |
// All attributes are lowercase |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6942 |
// Grab necessary hook if one is defined |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6943 |
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6944 |
name = name.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6945 |
hooks = jQuery.attrHooks[ name ] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6946 |
( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6947 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6948 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6949 |
if ( value !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6950 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6951 |
if ( value === null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6952 |
jQuery.removeAttr( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6953 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6954 |
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6955 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6956 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6957 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6958 |
elem.setAttribute( name, value + "" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6959 |
return value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6960 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6961 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6962 |
} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6963 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6964 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6965 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6966 |
ret = jQuery.find.attr( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6967 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6968 |
// Non-existent attributes return null, we normalize to undefined |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6969 |
return ret == null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6970 |
undefined : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6971 |
ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6972 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6973 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6974 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6975 |
removeAttr: function( elem, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6976 |
var name, propName, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6977 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6978 |
attrNames = value && value.match( rnotwhite ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6979 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6980 |
if ( attrNames && elem.nodeType === 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6981 |
while ( (name = attrNames[i++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6982 |
propName = jQuery.propFix[ name ] || name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6983 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6984 |
// Boolean attributes get special treatment (#10870) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6985 |
if ( jQuery.expr.match.bool.test( name ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6986 |
// Set corresponding property to false |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6987 |
elem[ propName ] = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6988 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6989 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6990 |
elem.removeAttribute( name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6991 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6992 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6993 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6994 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6995 |
attrHooks: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6996 |
type: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6997 |
set: function( elem, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6998 |
if ( !support.radioValue && value === "radio" && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
6999 |
jQuery.nodeName( elem, "input" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7000 |
// Setting the type on a radio button after the value resets the value in IE6-9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7001 |
// Reset value to default in case type is set after value during creation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7002 |
var val = elem.value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7003 |
elem.setAttribute( "type", value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7004 |
if ( val ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7005 |
elem.value = val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7006 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7007 |
return value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7008 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7009 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7010 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7011 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7012 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7013 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7014 |
// Hooks for boolean attributes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7015 |
boolHook = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7016 |
set: function( elem, value, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7017 |
if ( value === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7018 |
// Remove boolean attributes when set to false |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7019 |
jQuery.removeAttr( elem, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7020 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7021 |
elem.setAttribute( name, name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7022 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7023 |
return name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7024 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7025 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7026 |
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7027 |
var getter = attrHandle[ name ] || jQuery.find.attr; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7028 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7029 |
attrHandle[ name ] = function( elem, name, isXML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7030 |
var ret, handle; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7031 |
if ( !isXML ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7032 |
// Avoid an infinite loop by temporarily removing this function from the getter |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7033 |
handle = attrHandle[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7034 |
attrHandle[ name ] = ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7035 |
ret = getter( elem, name, isXML ) != null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7036 |
name.toLowerCase() : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7037 |
null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7038 |
attrHandle[ name ] = handle; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7039 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7040 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7041 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7042 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7043 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7044 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7045 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7046 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7047 |
var rfocusable = /^(?:input|select|textarea|button)$/i; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7048 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7049 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7050 |
prop: function( name, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7051 |
return access( this, jQuery.prop, name, value, arguments.length > 1 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7052 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7053 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7054 |
removeProp: function( name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7055 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7056 |
delete this[ jQuery.propFix[ name ] || name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7057 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7058 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7059 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7060 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7061 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7062 |
propFix: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7063 |
"for": "htmlFor", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7064 |
"class": "className" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7065 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7066 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7067 |
prop: function( elem, name, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7068 |
var ret, hooks, notxml, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7069 |
nType = elem.nodeType; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7070 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7071 |
// don't get/set properties on text, comment and attribute nodes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7072 |
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7073 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7074 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7075 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7076 |
notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7077 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7078 |
if ( notxml ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7079 |
// Fix name and attach hooks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7080 |
name = jQuery.propFix[ name ] || name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7081 |
hooks = jQuery.propHooks[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7082 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7083 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7084 |
if ( value !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7085 |
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7086 |
ret : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7087 |
( elem[ name ] = value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7088 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7089 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7090 |
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7091 |
ret : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7092 |
elem[ name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7093 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7094 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7095 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7096 |
propHooks: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7097 |
tabIndex: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7098 |
get: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7099 |
return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7100 |
elem.tabIndex : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7101 |
-1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7102 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7103 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7104 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7105 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7106 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7107 |
// Support: IE9+ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7108 |
// Selectedness for an option in an optgroup can be inaccurate |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7109 |
if ( !support.optSelected ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7110 |
jQuery.propHooks.selected = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7111 |
get: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7112 |
var parent = elem.parentNode; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7113 |
if ( parent && parent.parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7114 |
parent.parentNode.selectedIndex; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7115 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7116 |
return null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7117 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7118 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7119 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7120 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7121 |
jQuery.each([ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7122 |
"tabIndex", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7123 |
"readOnly", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7124 |
"maxLength", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7125 |
"cellSpacing", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7126 |
"cellPadding", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7127 |
"rowSpan", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7128 |
"colSpan", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7129 |
"useMap", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7130 |
"frameBorder", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7131 |
"contentEditable" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7132 |
], function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7133 |
jQuery.propFix[ this.toLowerCase() ] = this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7134 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7135 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7136 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7137 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7138 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7139 |
var rclass = /[\t\r\n\f]/g; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7140 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7141 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7142 |
addClass: function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7143 |
var classes, elem, cur, clazz, j, finalValue, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7144 |
proceed = typeof value === "string" && value, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7145 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7146 |
len = this.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7147 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7148 |
if ( jQuery.isFunction( value ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7149 |
return this.each(function( j ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7150 |
jQuery( this ).addClass( value.call( this, j, this.className ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7151 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7152 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7153 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7154 |
if ( proceed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7155 |
// The disjunction here is for better compressibility (see removeClass) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7156 |
classes = ( value || "" ).match( rnotwhite ) || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7157 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7158 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7159 |
elem = this[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7160 |
cur = elem.nodeType === 1 && ( elem.className ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7161 |
( " " + elem.className + " " ).replace( rclass, " " ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7162 |
" " |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7163 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7164 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7165 |
if ( cur ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7166 |
j = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7167 |
while ( (clazz = classes[j++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7168 |
if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7169 |
cur += clazz + " "; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7170 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7171 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7172 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7173 |
// only assign if different to avoid unneeded rendering. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7174 |
finalValue = jQuery.trim( cur ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7175 |
if ( elem.className !== finalValue ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7176 |
elem.className = finalValue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7177 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7178 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7179 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7180 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7181 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7182 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7183 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7184 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7185 |
removeClass: function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7186 |
var classes, elem, cur, clazz, j, finalValue, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7187 |
proceed = arguments.length === 0 || typeof value === "string" && value, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7188 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7189 |
len = this.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7190 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7191 |
if ( jQuery.isFunction( value ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7192 |
return this.each(function( j ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7193 |
jQuery( this ).removeClass( value.call( this, j, this.className ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7194 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7195 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7196 |
if ( proceed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7197 |
classes = ( value || "" ).match( rnotwhite ) || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7198 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7199 |
for ( ; i < len; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7200 |
elem = this[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7201 |
// This expression is here for better compressibility (see addClass) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7202 |
cur = elem.nodeType === 1 && ( elem.className ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7203 |
( " " + elem.className + " " ).replace( rclass, " " ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7204 |
"" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7205 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7206 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7207 |
if ( cur ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7208 |
j = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7209 |
while ( (clazz = classes[j++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7210 |
// Remove *all* instances |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7211 |
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7212 |
cur = cur.replace( " " + clazz + " ", " " ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7213 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7214 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7215 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7216 |
// only assign if different to avoid unneeded rendering. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7217 |
finalValue = value ? jQuery.trim( cur ) : ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7218 |
if ( elem.className !== finalValue ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7219 |
elem.className = finalValue; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7220 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7221 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7222 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7223 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7224 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7225 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7226 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7227 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7228 |
toggleClass: function( value, stateVal ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7229 |
var type = typeof value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7230 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7231 |
if ( typeof stateVal === "boolean" && type === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7232 |
return stateVal ? this.addClass( value ) : this.removeClass( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7233 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7234 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7235 |
if ( jQuery.isFunction( value ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7236 |
return this.each(function( i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7237 |
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7238 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7239 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7240 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7241 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7242 |
if ( type === "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7243 |
// toggle individual class names |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7244 |
var className, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7245 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7246 |
self = jQuery( this ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7247 |
classNames = value.match( rnotwhite ) || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7248 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7249 |
while ( (className = classNames[ i++ ]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7250 |
// check each className given, space separated list |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7251 |
if ( self.hasClass( className ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7252 |
self.removeClass( className ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7253 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7254 |
self.addClass( className ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7255 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7256 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7257 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7258 |
// Toggle whole class name |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7259 |
} else if ( type === strundefined || type === "boolean" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7260 |
if ( this.className ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7261 |
// store className if set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7262 |
data_priv.set( this, "__className__", this.className ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7263 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7264 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7265 |
// If the element has a class name or if we're passed "false", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7266 |
// then remove the whole classname (if there was one, the above saved it). |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7267 |
// Otherwise bring back whatever was previously saved (if anything), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7268 |
// falling back to the empty string if nothing was stored. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7269 |
this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7270 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7271 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7272 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7273 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7274 |
hasClass: function( selector ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7275 |
var className = " " + selector + " ", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7276 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7277 |
l = this.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7278 |
for ( ; i < l; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7279 |
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7280 |
return true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7281 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7282 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7283 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7284 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7285 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7286 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7287 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7288 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7289 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7290 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7291 |
var rreturn = /\r/g; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7292 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7293 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7294 |
val: function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7295 |
var hooks, ret, isFunction, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7296 |
elem = this[0]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7297 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7298 |
if ( !arguments.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7299 |
if ( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7300 |
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7301 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7302 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7303 |
return ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7304 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7305 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7306 |
ret = elem.value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7307 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7308 |
return typeof ret === "string" ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7309 |
// handle most common string cases |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7310 |
ret.replace(rreturn, "") : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7311 |
// handle cases where value is null/undef or number |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7312 |
ret == null ? "" : ret; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7313 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7314 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7315 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7316 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7317 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7318 |
isFunction = jQuery.isFunction( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7319 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7320 |
return this.each(function( i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7321 |
var val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7322 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7323 |
if ( this.nodeType !== 1 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7324 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7325 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7326 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7327 |
if ( isFunction ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7328 |
val = value.call( this, i, jQuery( this ).val() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7329 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7330 |
val = value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7331 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7332 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7333 |
// Treat null/undefined as ""; convert numbers to string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7334 |
if ( val == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7335 |
val = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7336 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7337 |
} else if ( typeof val === "number" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7338 |
val += ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7339 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7340 |
} else if ( jQuery.isArray( val ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7341 |
val = jQuery.map( val, function( value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7342 |
return value == null ? "" : value + ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7343 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7344 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7345 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7346 |
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7347 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7348 |
// If set returns undefined, fall back to normal setting |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7349 |
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7350 |
this.value = val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7351 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7352 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7353 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7354 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7355 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7356 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7357 |
valHooks: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7358 |
option: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7359 |
get: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7360 |
var val = jQuery.find.attr( elem, "value" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7361 |
return val != null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7362 |
val : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7363 |
// Support: IE10-11+ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7364 |
// option.text throws exceptions (#14686, #14858) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7365 |
jQuery.trim( jQuery.text( elem ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7366 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7367 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7368 |
select: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7369 |
get: function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7370 |
var value, option, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7371 |
options = elem.options, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7372 |
index = elem.selectedIndex, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7373 |
one = elem.type === "select-one" || index < 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7374 |
values = one ? null : [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7375 |
max = one ? index + 1 : options.length, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7376 |
i = index < 0 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7377 |
max : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7378 |
one ? index : 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7379 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7380 |
// Loop through all the selected options |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7381 |
for ( ; i < max; i++ ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7382 |
option = options[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7383 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7384 |
// IE6-9 doesn't update selected after form reset (#2551) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7385 |
if ( ( option.selected || i === index ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7386 |
// Don't return options that are disabled or in a disabled optgroup |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7387 |
( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7388 |
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7389 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7390 |
// Get the specific value for the option |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7391 |
value = jQuery( option ).val(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7392 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7393 |
// We don't need an array for one selects |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7394 |
if ( one ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7395 |
return value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7396 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7397 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7398 |
// Multi-Selects return an array |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7399 |
values.push( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7400 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7401 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7402 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7403 |
return values; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7404 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7405 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7406 |
set: function( elem, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7407 |
var optionSet, option, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7408 |
options = elem.options, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7409 |
values = jQuery.makeArray( value ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7410 |
i = options.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7411 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7412 |
while ( i-- ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7413 |
option = options[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7414 |
if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7415 |
optionSet = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7416 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7417 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7418 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7419 |
// force browsers to behave consistently when non-matching value is set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7420 |
if ( !optionSet ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7421 |
elem.selectedIndex = -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7422 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7423 |
return values; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7424 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7425 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7426 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7427 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7428 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7429 |
// Radios and checkboxes getter/setter |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7430 |
jQuery.each([ "radio", "checkbox" ], function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7431 |
jQuery.valHooks[ this ] = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7432 |
set: function( elem, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7433 |
if ( jQuery.isArray( value ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7434 |
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7435 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7436 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7437 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7438 |
if ( !support.checkOn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7439 |
jQuery.valHooks[ this ].get = function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7440 |
// Support: Webkit |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7441 |
// "" is returned instead of "on" if a value isn't specified |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7442 |
return elem.getAttribute("value") === null ? "on" : elem.value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7443 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7444 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7445 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7446 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7447 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7448 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7449 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7450 |
// Return jQuery for attributes-only inclusion |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7451 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7452 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7453 |
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7454 |
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7455 |
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7456 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7457 |
// Handle event binding |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7458 |
jQuery.fn[ name ] = function( data, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7459 |
return arguments.length > 0 ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7460 |
this.on( name, null, data, fn ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7461 |
this.trigger( name ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7462 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7463 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7464 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7465 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7466 |
hover: function( fnOver, fnOut ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7467 |
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7468 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7469 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7470 |
bind: function( types, data, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7471 |
return this.on( types, null, data, fn ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7472 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7473 |
unbind: function( types, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7474 |
return this.off( types, null, fn ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7475 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7476 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7477 |
delegate: function( selector, types, data, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7478 |
return this.on( types, selector, data, fn ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7479 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7480 |
undelegate: function( selector, types, fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7481 |
// ( namespace ) or ( selector, types [, fn] ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7482 |
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7483 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7484 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7485 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7486 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7487 |
var nonce = jQuery.now(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7488 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7489 |
var rquery = (/\?/); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7490 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7491 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7492 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7493 |
// Support: Android 2.3 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7494 |
// Workaround failure to string-cast null input |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7495 |
jQuery.parseJSON = function( data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7496 |
return JSON.parse( data + "" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7497 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7498 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7499 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7500 |
// Cross-browser xml parsing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7501 |
jQuery.parseXML = function( data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7502 |
var xml, tmp; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7503 |
if ( !data || typeof data !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7504 |
return null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7505 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7506 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7507 |
// Support: IE9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7508 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7509 |
tmp = new DOMParser(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7510 |
xml = tmp.parseFromString( data, "text/xml" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7511 |
} catch ( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7512 |
xml = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7513 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7514 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7515 |
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7516 |
jQuery.error( "Invalid XML: " + data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7517 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7518 |
return xml; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7519 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7520 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7521 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7522 |
var |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7523 |
// Document location |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7524 |
ajaxLocParts, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7525 |
ajaxLocation, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7526 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7527 |
rhash = /#.*$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7528 |
rts = /([?&])_=[^&]*/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7529 |
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7530 |
// #7653, #8125, #8152: local protocol detection |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7531 |
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7532 |
rnoContent = /^(?:GET|HEAD)$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7533 |
rprotocol = /^\/\//, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7534 |
rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7535 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7536 |
/* Prefilters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7537 |
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7538 |
* 2) These are called: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7539 |
* - BEFORE asking for a transport |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7540 |
* - AFTER param serialization (s.data is a string if s.processData is true) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7541 |
* 3) key is the dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7542 |
* 4) the catchall symbol "*" can be used |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7543 |
* 5) execution will start with transport dataType and THEN continue down to "*" if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7544 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7545 |
prefilters = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7546 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7547 |
/* Transports bindings |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7548 |
* 1) key is the dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7549 |
* 2) the catchall symbol "*" can be used |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7550 |
* 3) selection will start with transport dataType and THEN go to "*" if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7551 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7552 |
transports = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7553 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7554 |
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7555 |
allTypes = "*/".concat("*"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7556 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7557 |
// #8138, IE may throw an exception when accessing |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7558 |
// a field from window.location if document.domain has been set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7559 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7560 |
ajaxLocation = location.href; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7561 |
} catch( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7562 |
// Use the href attribute of an A element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7563 |
// since IE will modify it given document.location |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7564 |
ajaxLocation = document.createElement( "a" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7565 |
ajaxLocation.href = ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7566 |
ajaxLocation = ajaxLocation.href; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7567 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7568 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7569 |
// Segment location into parts |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7570 |
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7571 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7572 |
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7573 |
function addToPrefiltersOrTransports( structure ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7574 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7575 |
// dataTypeExpression is optional and defaults to "*" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7576 |
return function( dataTypeExpression, func ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7577 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7578 |
if ( typeof dataTypeExpression !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7579 |
func = dataTypeExpression; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7580 |
dataTypeExpression = "*"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7581 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7582 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7583 |
var dataType, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7584 |
i = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7585 |
dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7586 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7587 |
if ( jQuery.isFunction( func ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7588 |
// For each dataType in the dataTypeExpression |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7589 |
while ( (dataType = dataTypes[i++]) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7590 |
// Prepend if requested |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7591 |
if ( dataType[0] === "+" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7592 |
dataType = dataType.slice( 1 ) || "*"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7593 |
(structure[ dataType ] = structure[ dataType ] || []).unshift( func ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7594 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7595 |
// Otherwise append |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7596 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7597 |
(structure[ dataType ] = structure[ dataType ] || []).push( func ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7598 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7599 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7600 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7601 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7602 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7603 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7604 |
// Base inspection function for prefilters and transports |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7605 |
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7606 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7607 |
var inspected = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7608 |
seekingTransport = ( structure === transports ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7609 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7610 |
function inspect( dataType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7611 |
var selected; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7612 |
inspected[ dataType ] = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7613 |
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7614 |
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7615 |
if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7616 |
options.dataTypes.unshift( dataTypeOrTransport ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7617 |
inspect( dataTypeOrTransport ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7618 |
return false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7619 |
} else if ( seekingTransport ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7620 |
return !( selected = dataTypeOrTransport ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7621 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7622 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7623 |
return selected; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7624 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7625 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7626 |
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7627 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7628 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7629 |
// A special extend for ajax options |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7630 |
// that takes "flat" options (not to be deep extended) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7631 |
// Fixes #9887 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7632 |
function ajaxExtend( target, src ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7633 |
var key, deep, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7634 |
flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7635 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7636 |
for ( key in src ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7637 |
if ( src[ key ] !== undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7638 |
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7639 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7640 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7641 |
if ( deep ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7642 |
jQuery.extend( true, target, deep ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7643 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7644 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7645 |
return target; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7646 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7647 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7648 |
/* Handles responses to an ajax request: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7649 |
* - finds the right dataType (mediates between content-type and expected dataType) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7650 |
* - returns the corresponding response |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7651 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7652 |
function ajaxHandleResponses( s, jqXHR, responses ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7653 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7654 |
var ct, type, finalDataType, firstDataType, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7655 |
contents = s.contents, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7656 |
dataTypes = s.dataTypes; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7657 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7658 |
// Remove auto dataType and get content-type in the process |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7659 |
while ( dataTypes[ 0 ] === "*" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7660 |
dataTypes.shift(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7661 |
if ( ct === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7662 |
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7663 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7664 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7665 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7666 |
// Check if we're dealing with a known content-type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7667 |
if ( ct ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7668 |
for ( type in contents ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7669 |
if ( contents[ type ] && contents[ type ].test( ct ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7670 |
dataTypes.unshift( type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7671 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7672 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7673 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7674 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7675 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7676 |
// Check to see if we have a response for the expected dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7677 |
if ( dataTypes[ 0 ] in responses ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7678 |
finalDataType = dataTypes[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7679 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7680 |
// Try convertible dataTypes |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7681 |
for ( type in responses ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7682 |
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7683 |
finalDataType = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7684 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7685 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7686 |
if ( !firstDataType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7687 |
firstDataType = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7688 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7689 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7690 |
// Or just use first one |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7691 |
finalDataType = finalDataType || firstDataType; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7692 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7693 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7694 |
// If we found a dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7695 |
// We add the dataType to the list if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7696 |
// and return the corresponding response |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7697 |
if ( finalDataType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7698 |
if ( finalDataType !== dataTypes[ 0 ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7699 |
dataTypes.unshift( finalDataType ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7700 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7701 |
return responses[ finalDataType ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7702 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7703 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7704 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7705 |
/* Chain conversions given the request and the original response |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7706 |
* Also sets the responseXXX fields on the jqXHR instance |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7707 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7708 |
function ajaxConvert( s, response, jqXHR, isSuccess ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7709 |
var conv2, current, conv, tmp, prev, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7710 |
converters = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7711 |
// Work with a copy of dataTypes in case we need to modify it for conversion |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7712 |
dataTypes = s.dataTypes.slice(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7713 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7714 |
// Create converters map with lowercased keys |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7715 |
if ( dataTypes[ 1 ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7716 |
for ( conv in s.converters ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7717 |
converters[ conv.toLowerCase() ] = s.converters[ conv ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7718 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7719 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7720 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7721 |
current = dataTypes.shift(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7722 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7723 |
// Convert to each sequential dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7724 |
while ( current ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7725 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7726 |
if ( s.responseFields[ current ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7727 |
jqXHR[ s.responseFields[ current ] ] = response; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7728 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7729 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7730 |
// Apply the dataFilter if provided |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7731 |
if ( !prev && isSuccess && s.dataFilter ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7732 |
response = s.dataFilter( response, s.dataType ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7733 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7734 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7735 |
prev = current; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7736 |
current = dataTypes.shift(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7737 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7738 |
if ( current ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7739 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7740 |
// There's only work to do if current dataType is non-auto |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7741 |
if ( current === "*" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7742 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7743 |
current = prev; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7744 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7745 |
// Convert response if prev dataType is non-auto and differs from current |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7746 |
} else if ( prev !== "*" && prev !== current ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7747 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7748 |
// Seek a direct converter |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7749 |
conv = converters[ prev + " " + current ] || converters[ "* " + current ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7750 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7751 |
// If none found, seek a pair |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7752 |
if ( !conv ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7753 |
for ( conv2 in converters ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7754 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7755 |
// If conv2 outputs current |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7756 |
tmp = conv2.split( " " ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7757 |
if ( tmp[ 1 ] === current ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7758 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7759 |
// If prev can be converted to accepted input |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7760 |
conv = converters[ prev + " " + tmp[ 0 ] ] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7761 |
converters[ "* " + tmp[ 0 ] ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7762 |
if ( conv ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7763 |
// Condense equivalence converters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7764 |
if ( conv === true ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7765 |
conv = converters[ conv2 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7766 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7767 |
// Otherwise, insert the intermediate dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7768 |
} else if ( converters[ conv2 ] !== true ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7769 |
current = tmp[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7770 |
dataTypes.unshift( tmp[ 1 ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7771 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7772 |
break; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7773 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7774 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7775 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7776 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7777 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7778 |
// Apply converter (if not an equivalence) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7779 |
if ( conv !== true ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7780 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7781 |
// Unless errors are allowed to bubble, catch and return them |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7782 |
if ( conv && s[ "throws" ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7783 |
response = conv( response ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7784 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7785 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7786 |
response = conv( response ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7787 |
} catch ( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7788 |
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7789 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7790 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7791 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7792 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7793 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7794 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7795 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7796 |
return { state: "success", data: response }; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7797 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7798 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7799 |
jQuery.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7800 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7801 |
// Counter for holding the number of active queries |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7802 |
active: 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7803 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7804 |
// Last-Modified header cache for next request |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7805 |
lastModified: {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7806 |
etag: {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7807 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7808 |
ajaxSettings: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7809 |
url: ajaxLocation, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7810 |
type: "GET", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7811 |
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7812 |
global: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7813 |
processData: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7814 |
async: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7815 |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7816 |
/* |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7817 |
timeout: 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7818 |
data: null, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7819 |
dataType: null, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7820 |
username: null, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7821 |
password: null, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7822 |
cache: null, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7823 |
throws: false, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7824 |
traditional: false, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7825 |
headers: {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7826 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7827 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7828 |
accepts: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7829 |
"*": allTypes, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7830 |
text: "text/plain", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7831 |
html: "text/html", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7832 |
xml: "application/xml, text/xml", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7833 |
json: "application/json, text/javascript" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7834 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7835 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7836 |
contents: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7837 |
xml: /xml/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7838 |
html: /html/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7839 |
json: /json/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7840 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7841 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7842 |
responseFields: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7843 |
xml: "responseXML", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7844 |
text: "responseText", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7845 |
json: "responseJSON" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7846 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7847 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7848 |
// Data converters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7849 |
// Keys separate source (or catchall "*") and destination types with a single space |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7850 |
converters: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7851 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7852 |
// Convert anything to text |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7853 |
"* text": String, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7854 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7855 |
// Text to html (true = no transformation) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7856 |
"text html": true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7857 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7858 |
// Evaluate text as a json expression |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7859 |
"text json": jQuery.parseJSON, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7860 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7861 |
// Parse text as xml |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7862 |
"text xml": jQuery.parseXML |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7863 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7864 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7865 |
// For options that shouldn't be deep extended: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7866 |
// you can add your own custom options here if |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7867 |
// and when you create one that shouldn't be |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7868 |
// deep extended (see ajaxExtend) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7869 |
flatOptions: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7870 |
url: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7871 |
context: true |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7872 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7873 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7874 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7875 |
// Creates a full fledged settings object into target |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7876 |
// with both ajaxSettings and settings fields. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7877 |
// If target is omitted, writes into ajaxSettings. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7878 |
ajaxSetup: function( target, settings ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7879 |
return settings ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7880 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7881 |
// Building a settings object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7882 |
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7883 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7884 |
// Extending ajaxSettings |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7885 |
ajaxExtend( jQuery.ajaxSettings, target ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7886 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7887 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7888 |
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7889 |
ajaxTransport: addToPrefiltersOrTransports( transports ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7890 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7891 |
// Main method |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7892 |
ajax: function( url, options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7893 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7894 |
// If url is an object, simulate pre-1.5 signature |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7895 |
if ( typeof url === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7896 |
options = url; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7897 |
url = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7898 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7899 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7900 |
// Force options to be an object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7901 |
options = options || {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7902 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7903 |
var transport, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7904 |
// URL without anti-cache param |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7905 |
cacheURL, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7906 |
// Response headers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7907 |
responseHeadersString, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7908 |
responseHeaders, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7909 |
// timeout handle |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7910 |
timeoutTimer, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7911 |
// Cross-domain detection vars |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7912 |
parts, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7913 |
// To know if global events are to be dispatched |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7914 |
fireGlobals, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7915 |
// Loop variable |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7916 |
i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7917 |
// Create the final options object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7918 |
s = jQuery.ajaxSetup( {}, options ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7919 |
// Callbacks context |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7920 |
callbackContext = s.context || s, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7921 |
// Context for global events is callbackContext if it is a DOM node or jQuery collection |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7922 |
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7923 |
jQuery( callbackContext ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7924 |
jQuery.event, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7925 |
// Deferreds |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7926 |
deferred = jQuery.Deferred(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7927 |
completeDeferred = jQuery.Callbacks("once memory"), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7928 |
// Status-dependent callbacks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7929 |
statusCode = s.statusCode || {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7930 |
// Headers (they are sent all at once) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7931 |
requestHeaders = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7932 |
requestHeadersNames = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7933 |
// The jqXHR state |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7934 |
state = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7935 |
// Default abort message |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7936 |
strAbort = "canceled", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7937 |
// Fake xhr |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7938 |
jqXHR = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7939 |
readyState: 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7940 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7941 |
// Builds headers hashtable if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7942 |
getResponseHeader: function( key ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7943 |
var match; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7944 |
if ( state === 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7945 |
if ( !responseHeaders ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7946 |
responseHeaders = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7947 |
while ( (match = rheaders.exec( responseHeadersString )) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7948 |
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7949 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7950 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7951 |
match = responseHeaders[ key.toLowerCase() ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7952 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7953 |
return match == null ? null : match; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7954 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7955 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7956 |
// Raw string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7957 |
getAllResponseHeaders: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7958 |
return state === 2 ? responseHeadersString : null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7959 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7960 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7961 |
// Caches the header |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7962 |
setRequestHeader: function( name, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7963 |
var lname = name.toLowerCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7964 |
if ( !state ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7965 |
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7966 |
requestHeaders[ name ] = value; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7967 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7968 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7969 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7970 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7971 |
// Overrides response content-type header |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7972 |
overrideMimeType: function( type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7973 |
if ( !state ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7974 |
s.mimeType = type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7975 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7976 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7977 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7978 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7979 |
// Status-dependent callbacks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7980 |
statusCode: function( map ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7981 |
var code; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7982 |
if ( map ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7983 |
if ( state < 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7984 |
for ( code in map ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7985 |
// Lazy-add the new callback in a way that preserves old ones |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7986 |
statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7987 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7988 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7989 |
// Execute the appropriate callbacks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7990 |
jqXHR.always( map[ jqXHR.status ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7991 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7992 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7993 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7994 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7995 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7996 |
// Cancel the request |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7997 |
abort: function( statusText ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7998 |
var finalText = statusText || strAbort; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
7999 |
if ( transport ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8000 |
transport.abort( finalText ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8001 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8002 |
done( 0, finalText ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8003 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8004 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8005 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8006 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8007 |
// Attach deferreds |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8008 |
deferred.promise( jqXHR ).complete = completeDeferred.add; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8009 |
jqXHR.success = jqXHR.done; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8010 |
jqXHR.error = jqXHR.fail; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8011 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8012 |
// Remove hash character (#7531: and string promotion) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8013 |
// Add protocol if not provided (prefilters might expect it) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8014 |
// Handle falsy url in the settings object (#10093: consistency with old signature) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8015 |
// We also use the url parameter if available |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8016 |
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8017 |
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8018 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8019 |
// Alias method option to type as per ticket #12004 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8020 |
s.type = options.method || options.type || s.method || s.type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8021 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8022 |
// Extract dataTypes list |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8023 |
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8024 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8025 |
// A cross-domain request is in order when we have a protocol:host:port mismatch |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8026 |
if ( s.crossDomain == null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8027 |
parts = rurl.exec( s.url.toLowerCase() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8028 |
s.crossDomain = !!( parts && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8029 |
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8030 |
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8031 |
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8032 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8033 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8034 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8035 |
// Convert data if not already a string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8036 |
if ( s.data && s.processData && typeof s.data !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8037 |
s.data = jQuery.param( s.data, s.traditional ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8038 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8039 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8040 |
// Apply prefilters |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8041 |
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8042 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8043 |
// If request was aborted inside a prefilter, stop there |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8044 |
if ( state === 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8045 |
return jqXHR; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8046 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8047 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8048 |
// We can fire global events as of now if asked to |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8049 |
fireGlobals = s.global; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8050 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8051 |
// Watch for a new set of requests |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8052 |
if ( fireGlobals && jQuery.active++ === 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8053 |
jQuery.event.trigger("ajaxStart"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8054 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8055 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8056 |
// Uppercase the type |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8057 |
s.type = s.type.toUpperCase(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8058 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8059 |
// Determine if request has content |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8060 |
s.hasContent = !rnoContent.test( s.type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8061 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8062 |
// Save the URL in case we're toying with the If-Modified-Since |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8063 |
// and/or If-None-Match header later on |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8064 |
cacheURL = s.url; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8065 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8066 |
// More options handling for requests with no content |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8067 |
if ( !s.hasContent ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8068 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8069 |
// If data is available, append data to url |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8070 |
if ( s.data ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8071 |
cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8072 |
// #9682: remove data so that it's not used in an eventual retry |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8073 |
delete s.data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8074 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8075 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8076 |
// Add anti-cache in url if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8077 |
if ( s.cache === false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8078 |
s.url = rts.test( cacheURL ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8079 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8080 |
// If there is already a '_' parameter, set its value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8081 |
cacheURL.replace( rts, "$1_=" + nonce++ ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8082 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8083 |
// Otherwise add one to the end |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8084 |
cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8085 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8086 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8087 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8088 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8089 |
if ( s.ifModified ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8090 |
if ( jQuery.lastModified[ cacheURL ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8091 |
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8092 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8093 |
if ( jQuery.etag[ cacheURL ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8094 |
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8095 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8096 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8097 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8098 |
// Set the correct header, if data is being sent |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8099 |
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8100 |
jqXHR.setRequestHeader( "Content-Type", s.contentType ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8101 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8102 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8103 |
// Set the Accepts header for the server, depending on the dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8104 |
jqXHR.setRequestHeader( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8105 |
"Accept", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8106 |
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8107 |
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8108 |
s.accepts[ "*" ] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8109 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8110 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8111 |
// Check for headers option |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8112 |
for ( i in s.headers ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8113 |
jqXHR.setRequestHeader( i, s.headers[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8114 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8115 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8116 |
// Allow custom headers/mimetypes and early abort |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8117 |
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8118 |
// Abort if not done already and return |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8119 |
return jqXHR.abort(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8120 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8121 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8122 |
// aborting is no longer a cancellation |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8123 |
strAbort = "abort"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8124 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8125 |
// Install callbacks on deferreds |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8126 |
for ( i in { success: 1, error: 1, complete: 1 } ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8127 |
jqXHR[ i ]( s[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8128 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8129 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8130 |
// Get transport |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8131 |
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8132 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8133 |
// If no transport, we auto-abort |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8134 |
if ( !transport ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8135 |
done( -1, "No Transport" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8136 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8137 |
jqXHR.readyState = 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8138 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8139 |
// Send global event |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8140 |
if ( fireGlobals ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8141 |
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8142 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8143 |
// Timeout |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8144 |
if ( s.async && s.timeout > 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8145 |
timeoutTimer = setTimeout(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8146 |
jqXHR.abort("timeout"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8147 |
}, s.timeout ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8148 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8149 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8150 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8151 |
state = 1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8152 |
transport.send( requestHeaders, done ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8153 |
} catch ( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8154 |
// Propagate exception as error if not done |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8155 |
if ( state < 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8156 |
done( -1, e ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8157 |
// Simply rethrow otherwise |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8158 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8159 |
throw e; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8160 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8161 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8162 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8163 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8164 |
// Callback for when everything is done |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8165 |
function done( status, nativeStatusText, responses, headers ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8166 |
var isSuccess, success, error, response, modified, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8167 |
statusText = nativeStatusText; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8168 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8169 |
// Called once |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8170 |
if ( state === 2 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8171 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8172 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8173 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8174 |
// State is "done" now |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8175 |
state = 2; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8176 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8177 |
// Clear timeout if it exists |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8178 |
if ( timeoutTimer ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8179 |
clearTimeout( timeoutTimer ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8180 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8181 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8182 |
// Dereference transport for early garbage collection |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8183 |
// (no matter how long the jqXHR object will be used) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8184 |
transport = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8185 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8186 |
// Cache response headers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8187 |
responseHeadersString = headers || ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8188 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8189 |
// Set readyState |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8190 |
jqXHR.readyState = status > 0 ? 4 : 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8191 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8192 |
// Determine if successful |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8193 |
isSuccess = status >= 200 && status < 300 || status === 304; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8194 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8195 |
// Get response data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8196 |
if ( responses ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8197 |
response = ajaxHandleResponses( s, jqXHR, responses ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8198 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8199 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8200 |
// Convert no matter what (that way responseXXX fields are always set) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8201 |
response = ajaxConvert( s, response, jqXHR, isSuccess ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8202 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8203 |
// If successful, handle type chaining |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8204 |
if ( isSuccess ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8205 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8206 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8207 |
if ( s.ifModified ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8208 |
modified = jqXHR.getResponseHeader("Last-Modified"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8209 |
if ( modified ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8210 |
jQuery.lastModified[ cacheURL ] = modified; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8211 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8212 |
modified = jqXHR.getResponseHeader("etag"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8213 |
if ( modified ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8214 |
jQuery.etag[ cacheURL ] = modified; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8215 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8216 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8217 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8218 |
// if no content |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8219 |
if ( status === 204 || s.type === "HEAD" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8220 |
statusText = "nocontent"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8221 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8222 |
// if not modified |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8223 |
} else if ( status === 304 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8224 |
statusText = "notmodified"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8225 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8226 |
// If we have data, let's convert it |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8227 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8228 |
statusText = response.state; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8229 |
success = response.data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8230 |
error = response.error; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8231 |
isSuccess = !error; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8232 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8233 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8234 |
// We extract error from statusText |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8235 |
// then normalize statusText and status for non-aborts |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8236 |
error = statusText; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8237 |
if ( status || !statusText ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8238 |
statusText = "error"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8239 |
if ( status < 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8240 |
status = 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8241 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8242 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8243 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8244 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8245 |
// Set data for the fake xhr object |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8246 |
jqXHR.status = status; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8247 |
jqXHR.statusText = ( nativeStatusText || statusText ) + ""; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8248 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8249 |
// Success/Error |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8250 |
if ( isSuccess ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8251 |
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8252 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8253 |
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8254 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8255 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8256 |
// Status-dependent callbacks |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8257 |
jqXHR.statusCode( statusCode ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8258 |
statusCode = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8259 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8260 |
if ( fireGlobals ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8261 |
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8262 |
[ jqXHR, s, isSuccess ? success : error ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8263 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8264 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8265 |
// Complete |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8266 |
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8267 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8268 |
if ( fireGlobals ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8269 |
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8270 |
// Handle the global AJAX counter |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8271 |
if ( !( --jQuery.active ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8272 |
jQuery.event.trigger("ajaxStop"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8273 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8274 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8275 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8276 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8277 |
return jqXHR; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8278 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8279 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8280 |
getJSON: function( url, data, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8281 |
return jQuery.get( url, data, callback, "json" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8282 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8283 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8284 |
getScript: function( url, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8285 |
return jQuery.get( url, undefined, callback, "script" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8286 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8287 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8288 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8289 |
jQuery.each( [ "get", "post" ], function( i, method ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8290 |
jQuery[ method ] = function( url, data, callback, type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8291 |
// shift arguments if data argument was omitted |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8292 |
if ( jQuery.isFunction( data ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8293 |
type = type || callback; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8294 |
callback = data; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8295 |
data = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8296 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8297 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8298 |
return jQuery.ajax({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8299 |
url: url, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8300 |
type: method, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8301 |
dataType: type, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8302 |
data: data, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8303 |
success: callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8304 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8305 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8306 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8307 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8308 |
// Attach a bunch of functions for handling common AJAX events |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8309 |
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8310 |
jQuery.fn[ type ] = function( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8311 |
return this.on( type, fn ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8312 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8313 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8314 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8315 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8316 |
jQuery._evalUrl = function( url ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8317 |
return jQuery.ajax({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8318 |
url: url, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8319 |
type: "GET", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8320 |
dataType: "script", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8321 |
async: false, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8322 |
global: false, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8323 |
"throws": true |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8324 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8325 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8326 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8327 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8328 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8329 |
wrapAll: function( html ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8330 |
var wrap; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8331 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8332 |
if ( jQuery.isFunction( html ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8333 |
return this.each(function( i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8334 |
jQuery( this ).wrapAll( html.call(this, i) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8335 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8336 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8337 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8338 |
if ( this[ 0 ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8339 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8340 |
// The elements to wrap the target around |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8341 |
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8342 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8343 |
if ( this[ 0 ].parentNode ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8344 |
wrap.insertBefore( this[ 0 ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8345 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8346 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8347 |
wrap.map(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8348 |
var elem = this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8349 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8350 |
while ( elem.firstElementChild ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8351 |
elem = elem.firstElementChild; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8352 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8353 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8354 |
return elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8355 |
}).append( this ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8356 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8357 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8358 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8359 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8360 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8361 |
wrapInner: function( html ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8362 |
if ( jQuery.isFunction( html ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8363 |
return this.each(function( i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8364 |
jQuery( this ).wrapInner( html.call(this, i) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8365 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8366 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8367 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8368 |
return this.each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8369 |
var self = jQuery( this ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8370 |
contents = self.contents(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8371 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8372 |
if ( contents.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8373 |
contents.wrapAll( html ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8374 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8375 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8376 |
self.append( html ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8377 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8378 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8379 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8380 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8381 |
wrap: function( html ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8382 |
var isFunction = jQuery.isFunction( html ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8383 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8384 |
return this.each(function( i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8385 |
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8386 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8387 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8388 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8389 |
unwrap: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8390 |
return this.parent().each(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8391 |
if ( !jQuery.nodeName( this, "body" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8392 |
jQuery( this ).replaceWith( this.childNodes ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8393 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8394 |
}).end(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8395 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8396 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8397 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8398 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8399 |
jQuery.expr.filters.hidden = function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8400 |
// Support: Opera <= 12.12 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8401 |
// Opera reports offsetWidths and offsetHeights less than zero on some elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8402 |
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8403 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8404 |
jQuery.expr.filters.visible = function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8405 |
return !jQuery.expr.filters.hidden( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8406 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8407 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8408 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8409 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8410 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8411 |
var r20 = /%20/g, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8412 |
rbracket = /\[\]$/, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8413 |
rCRLF = /\r?\n/g, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8414 |
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8415 |
rsubmittable = /^(?:input|select|textarea|keygen)/i; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8416 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8417 |
function buildParams( prefix, obj, traditional, add ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8418 |
var name; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8419 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8420 |
if ( jQuery.isArray( obj ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8421 |
// Serialize array item. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8422 |
jQuery.each( obj, function( i, v ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8423 |
if ( traditional || rbracket.test( prefix ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8424 |
// Treat each array item as a scalar. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8425 |
add( prefix, v ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8426 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8427 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8428 |
// Item is non-scalar (array or object), encode its numeric index. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8429 |
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8430 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8431 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8432 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8433 |
} else if ( !traditional && jQuery.type( obj ) === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8434 |
// Serialize object item. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8435 |
for ( name in obj ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8436 |
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8437 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8438 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8439 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8440 |
// Serialize scalar item. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8441 |
add( prefix, obj ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8442 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8443 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8444 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8445 |
// Serialize an array of form elements or a set of |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8446 |
// key/values into a query string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8447 |
jQuery.param = function( a, traditional ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8448 |
var prefix, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8449 |
s = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8450 |
add = function( key, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8451 |
// If value is a function, invoke it and return its value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8452 |
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8453 |
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8454 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8455 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8456 |
// Set traditional to true for jQuery <= 1.3.2 behavior. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8457 |
if ( traditional === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8458 |
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8459 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8460 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8461 |
// If an array was passed in, assume that it is an array of form elements. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8462 |
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8463 |
// Serialize the form elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8464 |
jQuery.each( a, function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8465 |
add( this.name, this.value ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8466 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8467 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8468 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8469 |
// If traditional, encode the "old" way (the way 1.3.2 or older |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8470 |
// did it), otherwise encode params recursively. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8471 |
for ( prefix in a ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8472 |
buildParams( prefix, a[ prefix ], traditional, add ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8473 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8474 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8475 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8476 |
// Return the resulting serialization |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8477 |
return s.join( "&" ).replace( r20, "+" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8478 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8479 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8480 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8481 |
serialize: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8482 |
return jQuery.param( this.serializeArray() ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8483 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8484 |
serializeArray: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8485 |
return this.map(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8486 |
// Can add propHook for "elements" to filter or add form elements |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8487 |
var elements = jQuery.prop( this, "elements" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8488 |
return elements ? jQuery.makeArray( elements ) : this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8489 |
}) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8490 |
.filter(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8491 |
var type = this.type; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8492 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8493 |
// Use .is( ":disabled" ) so that fieldset[disabled] works |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8494 |
return this.name && !jQuery( this ).is( ":disabled" ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8495 |
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8496 |
( this.checked || !rcheckableType.test( type ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8497 |
}) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8498 |
.map(function( i, elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8499 |
var val = jQuery( this ).val(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8500 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8501 |
return val == null ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8502 |
null : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8503 |
jQuery.isArray( val ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8504 |
jQuery.map( val, function( val ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8505 |
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8506 |
}) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8507 |
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8508 |
}).get(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8509 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8510 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8511 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8512 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8513 |
jQuery.ajaxSettings.xhr = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8514 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8515 |
return new XMLHttpRequest(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8516 |
} catch( e ) {} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8517 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8518 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8519 |
var xhrId = 0, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8520 |
xhrCallbacks = {}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8521 |
xhrSuccessStatus = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8522 |
// file protocol always yields status code 0, assume 200 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8523 |
0: 200, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8524 |
// Support: IE9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8525 |
// #1450: sometimes IE returns 1223 when it should be 204 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8526 |
1223: 204 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8527 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8528 |
xhrSupported = jQuery.ajaxSettings.xhr(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8529 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8530 |
// Support: IE9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8531 |
// Open requests must be manually aborted on unload (#5280) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8532 |
if ( window.ActiveXObject ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8533 |
jQuery( window ).on( "unload", function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8534 |
for ( var key in xhrCallbacks ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8535 |
xhrCallbacks[ key ](); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8536 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8537 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8538 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8539 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8540 |
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8541 |
support.ajax = xhrSupported = !!xhrSupported; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8542 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8543 |
jQuery.ajaxTransport(function( options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8544 |
var callback; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8545 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8546 |
// Cross domain only allowed if supported through XMLHttpRequest |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8547 |
if ( support.cors || xhrSupported && !options.crossDomain ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8548 |
return { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8549 |
send: function( headers, complete ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8550 |
var i, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8551 |
xhr = options.xhr(), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8552 |
id = ++xhrId; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8553 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8554 |
xhr.open( options.type, options.url, options.async, options.username, options.password ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8555 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8556 |
// Apply custom fields if provided |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8557 |
if ( options.xhrFields ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8558 |
for ( i in options.xhrFields ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8559 |
xhr[ i ] = options.xhrFields[ i ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8560 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8561 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8562 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8563 |
// Override mime type if needed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8564 |
if ( options.mimeType && xhr.overrideMimeType ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8565 |
xhr.overrideMimeType( options.mimeType ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8566 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8567 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8568 |
// X-Requested-With header |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8569 |
// For cross-domain requests, seeing as conditions for a preflight are |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8570 |
// akin to a jigsaw puzzle, we simply never set it to be sure. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8571 |
// (it can always be set on a per-request basis or even using ajaxSetup) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8572 |
// For same-domain requests, won't change header if already provided. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8573 |
if ( !options.crossDomain && !headers["X-Requested-With"] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8574 |
headers["X-Requested-With"] = "XMLHttpRequest"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8575 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8576 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8577 |
// Set headers |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8578 |
for ( i in headers ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8579 |
xhr.setRequestHeader( i, headers[ i ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8580 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8581 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8582 |
// Callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8583 |
callback = function( type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8584 |
return function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8585 |
if ( callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8586 |
delete xhrCallbacks[ id ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8587 |
callback = xhr.onload = xhr.onerror = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8588 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8589 |
if ( type === "abort" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8590 |
xhr.abort(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8591 |
} else if ( type === "error" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8592 |
complete( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8593 |
// file: protocol always yields status 0; see #8605, #14207 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8594 |
xhr.status, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8595 |
xhr.statusText |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8596 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8597 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8598 |
complete( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8599 |
xhrSuccessStatus[ xhr.status ] || xhr.status, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8600 |
xhr.statusText, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8601 |
// Support: IE9 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8602 |
// Accessing binary-data responseText throws an exception |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8603 |
// (#11426) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8604 |
typeof xhr.responseText === "string" ? { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8605 |
text: xhr.responseText |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8606 |
} : undefined, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8607 |
xhr.getAllResponseHeaders() |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8608 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8609 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8610 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8611 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8612 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8613 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8614 |
// Listen to events |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8615 |
xhr.onload = callback(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8616 |
xhr.onerror = callback("error"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8617 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8618 |
// Create the abort callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8619 |
callback = xhrCallbacks[ id ] = callback("abort"); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8620 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8621 |
try { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8622 |
// Do send the request (this may raise an exception) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8623 |
xhr.send( options.hasContent && options.data || null ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8624 |
} catch ( e ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8625 |
// #14683: Only rethrow if this hasn't been notified as an error yet |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8626 |
if ( callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8627 |
throw e; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8628 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8629 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8630 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8631 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8632 |
abort: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8633 |
if ( callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8634 |
callback(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8635 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8636 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8637 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8638 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8639 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8640 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8641 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8642 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8643 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8644 |
// Install script dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8645 |
jQuery.ajaxSetup({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8646 |
accepts: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8647 |
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8648 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8649 |
contents: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8650 |
script: /(?:java|ecma)script/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8651 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8652 |
converters: { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8653 |
"text script": function( text ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8654 |
jQuery.globalEval( text ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8655 |
return text; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8656 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8657 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8658 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8659 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8660 |
// Handle cache's special case and crossDomain |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8661 |
jQuery.ajaxPrefilter( "script", function( s ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8662 |
if ( s.cache === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8663 |
s.cache = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8664 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8665 |
if ( s.crossDomain ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8666 |
s.type = "GET"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8667 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8668 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8669 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8670 |
// Bind script tag hack transport |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8671 |
jQuery.ajaxTransport( "script", function( s ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8672 |
// This transport only deals with cross domain requests |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8673 |
if ( s.crossDomain ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8674 |
var script, callback; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8675 |
return { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8676 |
send: function( _, complete ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8677 |
script = jQuery("<script>").prop({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8678 |
async: true, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8679 |
charset: s.scriptCharset, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8680 |
src: s.url |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8681 |
}).on( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8682 |
"load error", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8683 |
callback = function( evt ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8684 |
script.remove(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8685 |
callback = null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8686 |
if ( evt ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8687 |
complete( evt.type === "error" ? 404 : 200, evt.type ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8688 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8689 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8690 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8691 |
document.head.appendChild( script[ 0 ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8692 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8693 |
abort: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8694 |
if ( callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8695 |
callback(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8696 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8697 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8698 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8699 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8700 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8701 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8702 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8703 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8704 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8705 |
var oldCallbacks = [], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8706 |
rjsonp = /(=)\?(?=&|$)|\?\?/; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8707 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8708 |
// Default jsonp settings |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8709 |
jQuery.ajaxSetup({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8710 |
jsonp: "callback", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8711 |
jsonpCallback: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8712 |
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8713 |
this[ callback ] = true; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8714 |
return callback; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8715 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8716 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8717 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8718 |
// Detect, normalize options and install callbacks for jsonp requests |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8719 |
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8720 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8721 |
var callbackName, overwritten, responseContainer, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8722 |
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8723 |
"url" : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8724 |
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8725 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8726 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8727 |
// Handle iff the expected data type is "jsonp" or we have a parameter to set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8728 |
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8729 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8730 |
// Get callback name, remembering preexisting value associated with it |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8731 |
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8732 |
s.jsonpCallback() : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8733 |
s.jsonpCallback; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8734 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8735 |
// Insert callback into url or form data |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8736 |
if ( jsonProp ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8737 |
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8738 |
} else if ( s.jsonp !== false ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8739 |
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8740 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8741 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8742 |
// Use data converter to retrieve json after script execution |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8743 |
s.converters["script json"] = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8744 |
if ( !responseContainer ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8745 |
jQuery.error( callbackName + " was not called" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8746 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8747 |
return responseContainer[ 0 ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8748 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8749 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8750 |
// force json dataType |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8751 |
s.dataTypes[ 0 ] = "json"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8752 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8753 |
// Install callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8754 |
overwritten = window[ callbackName ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8755 |
window[ callbackName ] = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8756 |
responseContainer = arguments; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8757 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8758 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8759 |
// Clean-up function (fires after converters) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8760 |
jqXHR.always(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8761 |
// Restore preexisting value |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8762 |
window[ callbackName ] = overwritten; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8763 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8764 |
// Save back as free |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8765 |
if ( s[ callbackName ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8766 |
// make sure that re-using the options doesn't screw things around |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8767 |
s.jsonpCallback = originalSettings.jsonpCallback; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8768 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8769 |
// save the callback name for future use |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8770 |
oldCallbacks.push( callbackName ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8771 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8772 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8773 |
// Call if it was a function and we have a response |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8774 |
if ( responseContainer && jQuery.isFunction( overwritten ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8775 |
overwritten( responseContainer[ 0 ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8776 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8777 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8778 |
responseContainer = overwritten = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8779 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8780 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8781 |
// Delegate to script |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8782 |
return "script"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8783 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8784 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8785 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8786 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8787 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8788 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8789 |
// data: string of html |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8790 |
// context (optional): If specified, the fragment will be created in this context, defaults to document |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8791 |
// keepScripts (optional): If true, will include scripts passed in the html string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8792 |
jQuery.parseHTML = function( data, context, keepScripts ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8793 |
if ( !data || typeof data !== "string" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8794 |
return null; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8795 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8796 |
if ( typeof context === "boolean" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8797 |
keepScripts = context; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8798 |
context = false; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8799 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8800 |
context = context || document; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8801 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8802 |
var parsed = rsingleTag.exec( data ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8803 |
scripts = !keepScripts && []; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8804 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8805 |
// Single tag |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8806 |
if ( parsed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8807 |
return [ context.createElement( parsed[1] ) ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8808 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8809 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8810 |
parsed = jQuery.buildFragment( [ data ], context, scripts ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8811 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8812 |
if ( scripts && scripts.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8813 |
jQuery( scripts ).remove(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8814 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8815 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8816 |
return jQuery.merge( [], parsed.childNodes ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8817 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8818 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8819 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8820 |
// Keep a copy of the old load method |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8821 |
var _load = jQuery.fn.load; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8822 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8823 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8824 |
* Load a url into a page |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8825 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8826 |
jQuery.fn.load = function( url, params, callback ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8827 |
if ( typeof url !== "string" && _load ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8828 |
return _load.apply( this, arguments ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8829 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8830 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8831 |
var selector, type, response, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8832 |
self = this, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8833 |
off = url.indexOf(" "); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8834 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8835 |
if ( off >= 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8836 |
selector = jQuery.trim( url.slice( off ) ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8837 |
url = url.slice( 0, off ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8838 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8839 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8840 |
// If it's a function |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8841 |
if ( jQuery.isFunction( params ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8842 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8843 |
// We assume that it's the callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8844 |
callback = params; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8845 |
params = undefined; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8846 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8847 |
// Otherwise, build a param string |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8848 |
} else if ( params && typeof params === "object" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8849 |
type = "POST"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8850 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8851 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8852 |
// If we have elements to modify, make the request |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8853 |
if ( self.length > 0 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8854 |
jQuery.ajax({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8855 |
url: url, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8856 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8857 |
// if "type" variable is undefined, then "GET" method will be used |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8858 |
type: type, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8859 |
dataType: "html", |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8860 |
data: params |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8861 |
}).done(function( responseText ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8862 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8863 |
// Save response for use in complete callback |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8864 |
response = arguments; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8865 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8866 |
self.html( selector ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8867 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8868 |
// If a selector was specified, locate the right elements in a dummy div |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8869 |
// Exclude scripts to avoid IE 'Permission Denied' errors |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8870 |
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8871 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8872 |
// Otherwise use the full result |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8873 |
responseText ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8874 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8875 |
}).complete( callback && function( jqXHR, status ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8876 |
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8877 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8878 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8879 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8880 |
return this; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8881 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8882 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8883 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8884 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8885 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8886 |
jQuery.expr.filters.animated = function( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8887 |
return jQuery.grep(jQuery.timers, function( fn ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8888 |
return elem === fn.elem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8889 |
}).length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8890 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8891 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8892 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8893 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8894 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8895 |
var docElem = window.document.documentElement; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8896 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8897 |
/** |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8898 |
* Gets a window from an element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8899 |
*/ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8900 |
function getWindow( elem ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8901 |
return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8902 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8903 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8904 |
jQuery.offset = { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8905 |
setOffset: function( elem, options, i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8906 |
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8907 |
position = jQuery.css( elem, "position" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8908 |
curElem = jQuery( elem ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8909 |
props = {}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8910 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8911 |
// Set position first, in-case top/left are set even on static elem |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8912 |
if ( position === "static" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8913 |
elem.style.position = "relative"; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8914 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8915 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8916 |
curOffset = curElem.offset(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8917 |
curCSSTop = jQuery.css( elem, "top" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8918 |
curCSSLeft = jQuery.css( elem, "left" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8919 |
calculatePosition = ( position === "absolute" || position === "fixed" ) && |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8920 |
( curCSSTop + curCSSLeft ).indexOf("auto") > -1; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8921 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8922 |
// Need to be able to calculate position if either top or left is auto and position is either absolute or fixed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8923 |
if ( calculatePosition ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8924 |
curPosition = curElem.position(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8925 |
curTop = curPosition.top; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8926 |
curLeft = curPosition.left; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8927 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8928 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8929 |
curTop = parseFloat( curCSSTop ) || 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8930 |
curLeft = parseFloat( curCSSLeft ) || 0; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8931 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8932 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8933 |
if ( jQuery.isFunction( options ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8934 |
options = options.call( elem, i, curOffset ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8935 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8936 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8937 |
if ( options.top != null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8938 |
props.top = ( options.top - curOffset.top ) + curTop; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8939 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8940 |
if ( options.left != null ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8941 |
props.left = ( options.left - curOffset.left ) + curLeft; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8942 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8943 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8944 |
if ( "using" in options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8945 |
options.using.call( elem, props ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8946 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8947 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8948 |
curElem.css( props ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8949 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8950 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8951 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8952 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8953 |
jQuery.fn.extend({ |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8954 |
offset: function( options ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8955 |
if ( arguments.length ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8956 |
return options === undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8957 |
this : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8958 |
this.each(function( i ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8959 |
jQuery.offset.setOffset( this, options, i ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8960 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8961 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8962 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8963 |
var docElem, win, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8964 |
elem = this[ 0 ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8965 |
box = { top: 0, left: 0 }, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8966 |
doc = elem && elem.ownerDocument; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8967 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8968 |
if ( !doc ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8969 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8970 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8971 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8972 |
docElem = doc.documentElement; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8973 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8974 |
// Make sure it's not a disconnected DOM node |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8975 |
if ( !jQuery.contains( docElem, elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8976 |
return box; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8977 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8978 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8979 |
// If we don't have gBCR, just use 0,0 rather than error |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8980 |
// BlackBerry 5, iOS 3 (original iPhone) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8981 |
if ( typeof elem.getBoundingClientRect !== strundefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8982 |
box = elem.getBoundingClientRect(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8983 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8984 |
win = getWindow( doc ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8985 |
return { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8986 |
top: box.top + win.pageYOffset - docElem.clientTop, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8987 |
left: box.left + win.pageXOffset - docElem.clientLeft |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8988 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8989 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8990 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8991 |
position: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8992 |
if ( !this[ 0 ] ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8993 |
return; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8994 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8995 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8996 |
var offsetParent, offset, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8997 |
elem = this[ 0 ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8998 |
parentOffset = { top: 0, left: 0 }; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8999 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9000 |
// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9001 |
if ( jQuery.css( elem, "position" ) === "fixed" ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9002 |
// We assume that getBoundingClientRect is available when computed position is fixed |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9003 |
offset = elem.getBoundingClientRect(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9004 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9005 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9006 |
// Get *real* offsetParent |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9007 |
offsetParent = this.offsetParent(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9008 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9009 |
// Get correct offsets |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9010 |
offset = this.offset(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9011 |
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9012 |
parentOffset = offsetParent.offset(); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9013 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9014 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9015 |
// Add offsetParent borders |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9016 |
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9017 |
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9018 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9019 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9020 |
// Subtract parent offsets and element margins |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9021 |
return { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9022 |
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9023 |
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9024 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9025 |
}, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9026 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9027 |
offsetParent: function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9028 |
return this.map(function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9029 |
var offsetParent = this.offsetParent || docElem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9030 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9031 |
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9032 |
offsetParent = offsetParent.offsetParent; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9033 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9034 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9035 |
return offsetParent || docElem; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9036 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9037 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9038 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9039 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9040 |
// Create scrollLeft and scrollTop methods |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9041 |
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9042 |
var top = "pageYOffset" === prop; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9043 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9044 |
jQuery.fn[ method ] = function( val ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9045 |
return access( this, function( elem, method, val ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9046 |
var win = getWindow( elem ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9047 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9048 |
if ( val === undefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9049 |
return win ? win[ prop ] : elem[ method ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9050 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9051 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9052 |
if ( win ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9053 |
win.scrollTo( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9054 |
!top ? val : window.pageXOffset, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9055 |
top ? val : window.pageYOffset |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9056 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9057 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9058 |
} else { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9059 |
elem[ method ] = val; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9060 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9061 |
}, method, val, arguments.length, null ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9062 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9063 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9064 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9065 |
// Add the top/left cssHooks using jQuery.fn.position |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9066 |
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9067 |
// getComputedStyle returns percent when specified for top/left/bottom/right |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9068 |
// rather than make the css module depend on the offset module, we just check for it here |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9069 |
jQuery.each( [ "top", "left" ], function( i, prop ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9070 |
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9071 |
function( elem, computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9072 |
if ( computed ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9073 |
computed = curCSS( elem, prop ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9074 |
// if curCSS returns percentage, fallback to offset |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9075 |
return rnumnonpx.test( computed ) ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9076 |
jQuery( elem ).position()[ prop ] + "px" : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9077 |
computed; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9078 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9079 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9080 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9081 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9082 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9083 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9084 |
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9085 |
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9086 |
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9087 |
// margin is only for outerHeight, outerWidth |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9088 |
jQuery.fn[ funcName ] = function( margin, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9089 |
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9090 |
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9091 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9092 |
return access( this, function( elem, type, value ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9093 |
var doc; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9094 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9095 |
if ( jQuery.isWindow( elem ) ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9096 |
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9097 |
// isn't a whole lot we can do. See pull request at this URL for discussion: |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9098 |
// https://github.com/jquery/jquery/pull/764 |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9099 |
return elem.document.documentElement[ "client" + name ]; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9100 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9101 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9102 |
// Get document width or height |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9103 |
if ( elem.nodeType === 9 ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9104 |
doc = elem.documentElement; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9105 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9106 |
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9107 |
// whichever is greatest |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9108 |
return Math.max( |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9109 |
elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9110 |
elem.body[ "offset" + name ], doc[ "offset" + name ], |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9111 |
doc[ "client" + name ] |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9112 |
); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9113 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9114 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9115 |
return value === undefined ? |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9116 |
// Get width or height on the element, requesting but not forcing parseFloat |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9117 |
jQuery.css( elem, type, extra ) : |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9118 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9119 |
// Set width or height on the element |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9120 |
jQuery.style( elem, type, value, extra ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9121 |
}, type, chainable ? margin : undefined, chainable, null ); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9122 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9123 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9124 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9125 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9126 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9127 |
// The number of elements contained in the matched element set |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9128 |
jQuery.fn.size = function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9129 |
return this.length; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9130 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9131 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9132 |
jQuery.fn.andSelf = jQuery.fn.addBack; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9133 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9134 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9135 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9136 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9137 |
// Register as a named AMD module, since jQuery can be concatenated with other |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9138 |
// files that may use define, but not via a proper concatenation script that |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9139 |
// understands anonymous AMD modules. A named AMD is safest and most robust |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9140 |
// way to register. Lowercase jquery is used because AMD module names are |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9141 |
// derived from file names, and jQuery is normally delivered in a lowercase |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9142 |
// file name. Do this after creating the global so that if an AMD module wants |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9143 |
// to call noConflict to hide this version of jQuery, it will work. |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9144 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9145 |
// Note that for maximum portability, libraries that are not jQuery should |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9146 |
// declare themselves as anonymous modules, and avoid setting a global if an |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9147 |
// AMD loader is present. jQuery is a special case. For more information, see |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9148 |
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9149 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9150 |
if ( typeof define === "function" && define.amd ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9151 |
define( "jquery", [], function() { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9152 |
return jQuery; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9153 |
}); |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9154 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9155 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9156 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9157 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9158 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9159 |
var |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9160 |
// Map over jQuery in case of overwrite |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9161 |
_jQuery = window.jQuery, |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9162 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9163 |
// Map over the $ in case of overwrite |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9164 |
_$ = window.$; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9165 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9166 |
jQuery.noConflict = function( deep ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9167 |
if ( window.$ === jQuery ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9168 |
window.$ = _$; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9169 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9170 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9171 |
if ( deep && window.jQuery === jQuery ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9172 |
window.jQuery = _jQuery; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9173 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9174 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9175 |
return jQuery; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9176 |
}; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9177 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9178 |
// Expose jQuery and $ identifiers, even in |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9179 |
// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9180 |
// and CommonJS for browser emulators (#13566) |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9181 |
if ( typeof noGlobal === strundefined ) { |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9182 |
window.jQuery = window.$ = jQuery; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9183 |
} |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9184 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9185 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9186 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9187 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9188 |
return jQuery; |
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9189 |
|
52d30e6014a0
Initial commit. Experimental cross-platform frontend for yubikey programming.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
9190 |
})); |