diff options
Diffstat (limited to 'deprecated/ZJW/javascripts')
-rw-r--r-- | deprecated/ZJW/javascripts/functions_dev.js | 137 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/garden_dev.js | 199 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/jquery.js | 154 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/jquery.min.js | 3375 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/jquery.swatchbook.js | 255 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/modernizr.custom.79639.js | 167 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/modernizr.js | 8 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/processing.min.js | 12665 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/site.js | 12 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/viz.pde | 81 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/webflow.js | 4445 | ||||
-rw-r--r-- | deprecated/ZJW/javascripts/webfont.js | 828 |
12 files changed, 22326 insertions, 0 deletions
diff --git a/deprecated/ZJW/javascripts/functions_dev.js b/deprecated/ZJW/javascripts/functions_dev.js new file mode 100644 index 0000000..eeae4d0 --- /dev/null +++ b/deprecated/ZJW/javascripts/functions_dev.js | |||
@@ -0,0 +1,137 @@ | |||
1 | // variables | ||
2 | var $window = $(window), gardenCtx, gardenCanvas, $garden, garden; | ||
3 | var clientWidth = $(window).width(); | ||
4 | var clientHeight = $(window).height(); | ||
5 | |||
6 | $(function () { | ||
7 | // setup garden | ||
8 | $loveHeart = $("#loveHeart"); | ||
9 | var offsetX = $loveHeart.width() / 2; | ||
10 | var offsetY = $loveHeart.height() / 2 - 55; | ||
11 | $garden = $("#garden"); | ||
12 | gardenCanvas = $garden[0]; | ||
13 | gardenCanvas.width = $("#loveHeart").width(); | ||
14 | gardenCanvas.height = $("#loveHeart").height() | ||
15 | gardenCtx = gardenCanvas.getContext("2d"); | ||
16 | gardenCtx.globalCompositeOperation = "lighter"; | ||
17 | garden = new Garden(gardenCtx, gardenCanvas); | ||
18 | |||
19 | $("#content").css("width", $loveHeart.width() + $("#code").width()); | ||
20 | $("#content").css("height", Math.max($loveHeart.height(), $("#code").height())); | ||
21 | $("#content").css("margin-top", Math.max(($window.height() - $("#content").height()) / 2, 10)); | ||
22 | $("#content").css("margin-left", Math.max(($window.width() - $("#content").width()) / 2, 10)); | ||
23 | |||
24 | // renderLoop | ||
25 | setInterval(function () { | ||
26 | garden.render(); | ||
27 | }, Garden.options.growSpeed); | ||
28 | }); | ||
29 | |||
30 | $(window).resize(function() { | ||
31 | var newWidth = $(window).width(); | ||
32 | var newHeight = $(window).height(); | ||
33 | if (newWidth != clientWidth && newHeight != clientHeight) { | ||
34 | location.replace(location); | ||
35 | } | ||
36 | }); | ||
37 | |||
38 | function getHeartPoint(angle) { | ||
39 | |||
40 | var xs = [-223, -221, -216, -214, -211, -207, -198, -191, -184, -177, -165, -159, -154, -145, -138, -131, -119, -108, -94, -85, -78, -69, -62, -55, -48, -39, -32, -25, -18, -7, 0, 12, 18, 28, 32, 39, 46, 53, 60, 67, 71, 78, 85, 92, 97, 104, 113, 120, 124, 134, 138, 145, 152, 159, 166, 173, 177, 184, 191, 196, 200, 207, 209, 214, 214, 216, -218, -223, -228, -234, -239, -244, -248, -251, -255, -257, -260, -262, -262, -260, -255, -251, -248, -239, -234, -232, -225, -218, -211, -205, -200, -193, -188, -182, -172, -165, -159, -152, -145, -140, -133, -126, -119, -110, -103, -97, -87, -80, -74, -67, -62, -55, -46, -39, -32, -23, -14, -7, 0, 7, 14, 18, 28, 37, 44, 51, 58, 65, 71, 78, 85, 92, 99, 106, 113, 120, 127, 134, 138, 143, 150, 157, 163, 170, 177, 184, 191, 198, 205, 209, 219, 223, 230, 235, 239, 246, 251, 251, 258, 260, 260, 262, 260, 255, 248, 242, 237, 230, 225, 219, -216, -223, -228, -228, -230, -232, -232, -228, -223, -218, -216, -209, -207, -202, -198, -195, -188, -182, -172, -165, -159, -149, -142, -136, -131, -126, -119, -113, -106, -99, -94, -90, -83, -78, -71, -67, -60, -53, -44, -37, -25, -16, -9, -5, 2, 9, 16, 25, 32, 37, 44, 48, 55, 65, 69, 76, 83, 90, 99, 106, 115, 122, 127, 134, 140, 145, 150, 157, 161, 166, 168, 175, 182, 186, 193, 198, 205, 209, 214, 219, 221, 225, 225, 225, 225, 221, 216, 212, -209, -202, -200, -195, -191, -188, -186, -179, -172, -165, -159, -152, -145, -138, -133, -129, -124, -117, -110, -103, -97, -90, -83, -78, -71, -64, -57, -50, -44, -37, -30, -25, -18, -9, -2, 5, 14, 21, 28, 37, 41, 51, 58, 67, 71, 78, 85, 94, 101, 111, 117, 124, 131, 136, 140, 145, 154, 159, 163, 168, 175, 182, 186, 196, 200, 209, 209, -216, -216, -216, -216, -216, -216, -216, -216, -216, -216, -214, -214, -214, -214, -211, -211, 212, 212, 212, 212, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, -218, -223, -225, -230, -232, -232, -230, -228, -223, -218, -214, -207, -205, -200, -193, -186, -182, -177, -170, -165, -161, -154, -147, -142, -136, -129, -119, -113, -103, -97, -90, -83, -76, -69, -62, -57, -50, -44, -37, -30, -23, -16, -9, -2, 5, 12, 18, 25, 30, 39, 46, 55, 62, 69, 76, 83, 92, 99, 106, 115, 122, 127, 129, 136, 145, 152, 159, 166, 175, 179, 184, 191, 191, 193, 198, 202, 209, 214, 221, 225, 230, 230, 228, 221, 219, -218, -216, -209, -200, -191, -184, -177, -170, -165, -159, -154, -147, -140, -136, -129, -119, -113, -103, -97, -90, -83, -74, -67, -60, -57, -50, -41, -34, -30, -23, -16, -7, 0, 7, 14, 21, 25, 32, 37, 44, 51, 58, 65, 71, 81, 88, 94, 101, 106, 113, 117, 122, 127, 131, 138, 147, 154, 163, 170, 179, 182, 184, 193, 200, 205, 209, -214, -214, -216, -216, -216, -216, -216, -216, -216, -216, -214, -214, -214, -214, -214, -214, -214, -214, -214, 212, 212, 212, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, -124, -129, -133, -138, -145, -154, -161, -170, -177, -184, -188, -193, -195, -198, -202, -205, -209, -216, -221, -225, -225, -225, -223, -218, -216, -205, -200, -191, -184, -177, -170, -165, -159, -154, -145, -138, -131, -124, -117, -110, -103, -97, -90, -83, -76, -69, -60, -53, -46, -39, -34, -27, -21, -11, -2, 5, 12, 18, 23, 30, 35, 44, 51, 60, 67, 74, 81, 88, 94, 104, 111, 120, 124, 131, 136, 140, 145, 152, 159, 168, 175, 179, 186, 191, 196, 198, 200, 205, 212, 219, 221, 223, 223, 219, 212, 205, 198, 193, 186, 173, 166, 161, 157, 152, 147, 138, 129, 117, 69, 62, 55, 48, 37, 32, 25, -27, -32, -39, -46, -53, -62, -69, -122, -126, -133, -138, -145, -152, -159, -165, -172, -177, -179, -184, -186, -188, -195, -200, -202, -205, -202, -198, -188, -182, -172, -163, -159, -149, -142, -133, -124, -115, -106, -94, -85, -78, -69, -62, -53, -44, -34, -25, -16, -9, -2, 7, 14, 21, 28, 35, 41, 51, 58, 65, 81, 88, 94, 104, 113, 117, 124, 129, 134, 140, 152, 159, 168, 173, 177, 182, 184, 189, 196, 200, 202, 200, 196, 191, 184, 179, 173, 166, 159, 152, 147, 140, 134, 129, 122, 115, 69, 62, 55, 46, 41, 35, 28, -25, -30, -37, -44, -48, -55, -62, -71, -129, -122, -115, -108, -106, -101, -99, -94, -87, -80, -74, -67, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -117, -119, -119, -76, -76, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, -115, -110, -103, -97, -92, -85, -117, -115, -108, -101, -97, -90, -83, -99, -99, -99, -106, -108, -110, -110, -108, -103, -103, -99, -97, -94, -92, -92, -94, -21, -21, -23, -23, -23, -23, -23, -23, -23, -21, -21, -21, -21, -21, -21, -21, -21, -30, -23, -16, -7, 0, 5, 9, 16, 23, 30, 21, 18, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 18, 18, -16, -11, -7, 2, 7, 12, 18, 14, 9, 2, -5, -14, -18, -21, 0, 0, -7, -11, -11, -9, -5, 0, 2, 5, 9, 9, 9, 9, 67, 74, 81, 88, 94, 99, 99, 104, 113, 120, 127, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 71, 71, 74, 74, 74, 74, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 106, 99, 92, 85, 81, 74, 78, 85, 92, 97, 101, 104, 92, 92, 90, 85, 85, 85, 88, 90, 97, 99, 101, 101, 101, 101, 97]; | ||
41 | var ys = [289, 296, 301, 303, 310, 312, 315, 317, 317, 319, 319, 319, 324, 324, 326, 328, 331, 331, 333, 333, 335, 335, 335, 335, 335, 335, 335, 335, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 335, 335, 335, 333, 333, 333, 331, 328, 326, 326, 326, 324, 324, 324, 321, 321, 321, 319, 319, 317, 315, 315, 310, 303, 298, 292, 211, 213, 216, 218, 220, 223, 225, 229, 232, 236, 243, 248, 255, 262, 266, 271, 273, 275, 280, 285, 289, 289, 292, 294, 294, 296, 298, 301, 305, 305, 308, 308, 308, 310, 310, 310, 312, 312, 312, 315, 315, 317, 319, 319, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 319, 321, 321, 321, 321, 321, 319, 317, 317, 317, 317, 315, 315, 315, 315, 315, 312, 312, 308, 308, 308, 305, 303, 303, 301, 301, 298, 296, 294, 292, 289, 287, 285, 282, 278, 275, 269, 266, 259, 255, 248, 243, 236, 229, 225, 223, 220, 218, 216, 213, 213, 218, 223, 227, 234, 241, 246, 248, 252, 257, 259, 264, 271, 273, 278, 282, 285, 285, 285, 285, 285, 287, 289, 292, 294, 296, 296, 298, 298, 301, 303, 301, 301, 298, 296, 296, 296, 296, 298, 303, 303, 305, 305, 305, 308, 308, 308, 305, 303, 301, 298, 298, 296, 294, 294, 294, 294, 294, 294, 294, 294, 292, 289, 289, 289, 285, 282, 280, 275, 271, 271, 269, 269, 269, 264, 264, 262, 257, 255, 248, 246, 239, 232, 225, 220, 216, 211, 232, 234, 236, 243, 246, 250, 255, 262, 262, 262, 262, 262, 262, 262, 266, 269, 273, 275, 275, 278, 278, 278, 278, 275, 275, 275, 275, 275, 275, 278, 278, 280, 282, 285, 287, 287, 287, 287, 287, 285, 282, 282, 278, 275, 273, 273, 273, 273, 273, 273, 273, 273, 273, 271, 269, 264, 262, 259, 255, 252, 250, 250, 248, 248, 246, 241, 234, 126, 133, 140, 144, 151, 158, 165, 172, 179, 186, 193, 200, 204, 213, 220, 227, 119, 128, 138, 142, 149, 156, 163, 170, 177, 184, 190, 197, 207, 213, 220, 227, 73, 75, 80, 82, 89, 96, 103, 108, 110, 115, 117, 121, 124, 126, 128, 128, 131, 135, 138, 140, 144, 147, 149, 151, 154, 154, 154, 154, 154, 154, 154, 154, 154, 156, 158, 161, 161, 165, 167, 167, 170, 170, 170, 170, 170, 170, 167, 165, 163, 161, 161, 158, 158, 158, 158, 158, 158, 158, 158, 158, 156, 154, 149, 147, 147, 147, 147, 147, 147, 144, 140, 135, 131, 124, 121, 119, 115, 112, 110, 108, 103, 96, 91, 87, 82, 91, 98, 101, 103, 103, 103, 105, 108, 110, 115, 119, 126, 131, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 135, 138, 140, 142, 142, 142, 144, 147, 147, 147, 147, 147, 144, 144, 142, 142, 140, 140, 140, 140, 140, 140, 140, 140, 138, 135, 133, 133, 128, 126, 124, 124, 124, 124, 124, 121, 119, 115, 112, 110, 108, 105, 103, -37, -28, -24, -14, -7, -0, 6, 13, 20, 27, 32, 39, 45, 55, 62, 68, 75, 82, 89, -44, -35, -28, -21, -12, -5, 2, 9, 18, 25, 32, 39, 45, 52, 59, 66, 75, 82, 91, -113, -111, -106, -104, -102, -102, -104, -104, -104, -104, -99, -97, -92, -88, -83, -79, -76, -74, -72, -65, -60, -53, -47, -42, -37, -37, -37, -35, -30, -26, -21, -19, -14, -12, -10, -10, -10, -10, -7, -7, -7, -7, -7, -7, -5, -5, -5, -0, -0, 2, 4, 4, 6, 6, 6, 6, 6, 6, 4, 2, -0, -0, -0, -0, -0, -3, -3, -3, -3, -3, -3, -3, -3, -5, -10, -12, -17, -19, -19, -19, -19, -21, -24, -26, -30, -35, -40, -47, -49, -51, -56, -63, -72, -76, -83, -86, -88, -90, -90, -90, -92, -97, -102, -106, -109, -111, -111, -113, -115, -115, -118, -120, -122, -125, -125, -122, -120, -118, -118, -118, -118, -115, -102, -99, -97, -95, -95, -92, -92, -92, -92, -90, -86, -81, -76, -69, -67, -65, -63, -56, -51, -51, -51, -51, -51, -44, -40, -33, -30, -28, -28, -28, -28, -28, -26, -26, -26, -24, -21, -17, -17, -17, -17, -17, -14, -14, -14, -17, -19, -19, -21, -21, -21, -21, -21, -21, -21, -21, -24, -26, -28, -33, -35, -35, -35, -35, -37, -40, -42, -44, -51, -53, -56, -58, -63, -69, -69, -74, -74, -76, -79, -81, -81, -86, -90, -95, -99, -102, -102, -102, -102, -102, -104, -106, -106, -109, -111, -113, -111, -111, -109, -106, -106, -106, -106, -74, -76, -76, -76, -72, -67, -69, -72, -74, -74, -74, -74, -81, -88, -95, -102, -109, -115, -122, -129, -136, -143, -150, -157, -164, -171, -178, -184, -81, -88, -92, -99, -106, -115, -125, -132, -138, -145, -152, -161, -168, -175, -180, -187, -187, -182, -182, -182, -184, -187, -189, -194, -194, -194, -196, -194, -189, -191, -198, -207, -201, -205, -212, -219, -224, -230, -235, -233, -228, -224, -219, -210, -205, -189, -182, -175, -168, -161, -152, -148, -141, -134, -127, -120, -113, -106, -99, -90, -83, -76, -72, -72, -72, -72, -69, -72, -74, -74, -74, -74, -83, -90, -95, -104, -111, -118, -125, -132, -138, -148, -152, -159, -168, -175, -182, -187, -184, -182, -182, -182, -182, -184, -187, -191, -194, -194, -194, -194, -191, -191, -201, -210, -207, -214, -221, -228, -233, -240, -237, -233, -228, -221, -214, -207, -79, -76, -76, -74, -72, -67, -74, -74, -76, -76, -76, -79, -88, -95, -104, -113, -120, -129, -136, -143, -150, -155, -161, -168, -175, -182, -189, -86, -92, -99, -109, -115, -122, -132, -141, -148, -155, -161, -168, -175, -182, -184, -184, -182, -184, -184, -189, -194, -194, -194, -191, -189, -182, -201, -205, -203, -207, -214, -221, -230, -235, -235, -230, -226, -219, -212, -205, -203]; | ||
42 | return new Array(offsetX + xs[angle], offsetY + ys[angle]); | ||
43 | } | ||
44 | |||
45 | function startHeartAnimation() { | ||
46 | var interval = 5; | ||
47 | var angle = 0; | ||
48 | var heart = new Array(); | ||
49 | var animationTimer = setInterval(function () { | ||
50 | var bloom = getHeartPoint(angle); | ||
51 | var draw = true; | ||
52 | for (var i = 0; i < heart.length; i++) { | ||
53 | var p = heart[i]; | ||
54 | var distance = Math.sqrt(Math.pow(p[0] - bloom[0], 2) + Math.pow(p[1] - bloom[1], 2)); | ||
55 | if (distance < Garden.options.bloomRadius.max * 1.3) { | ||
56 | draw = false; | ||
57 | break; | ||
58 | } | ||
59 | } | ||
60 | if (draw) { | ||
61 | heart.push(bloom); | ||
62 | garden.createRandomBloom(bloom[0], bloom[1]); | ||
63 | } | ||
64 | |||
65 | if (angle >= 982) { | ||
66 | clearInterval(animationTimer); | ||
67 | showMessages(); | ||
68 | } else { | ||
69 | angle ++; | ||
70 | } | ||
71 | }, interval); | ||
72 | } | ||
73 | |||
74 | (function($) { | ||
75 | $.fn.typewriter = function() { | ||
76 | this.each(function() { | ||
77 | var $ele = $(this), str = $ele.html(), progress = 0; | ||
78 | $ele.html(''); | ||
79 | var timer = setInterval(function() { | ||
80 | var current = str.substr(progress, 1); | ||
81 | if (current == '<') { | ||
82 | progress = str.indexOf('>', progress) + 1; | ||
83 | } else { | ||
84 | progress++; | ||
85 | } | ||
86 | $ele.html(str.substring(0, progress) + (progress & 1 ? '_' : '')); | ||
87 | if (progress >= str.length) { | ||
88 | clearInterval(timer); | ||
89 | } | ||
90 | }, 75); | ||
91 | }); | ||
92 | return this; | ||
93 | }; | ||
94 | })(jQuery); | ||
95 | |||
96 | function timeElapse(date){ | ||
97 | var current = Date(); | ||
98 | var seconds = (Date.parse(current) - Date.parse(date)) / 1000; | ||
99 | var days = Math.floor(seconds / (3600 * 24)); | ||
100 | seconds = seconds % (3600 * 24); | ||
101 | var hours = Math.floor(seconds / 3600); | ||
102 | if (hours < 10) { | ||
103 | hours = "0" + hours; | ||
104 | } | ||
105 | seconds = seconds % 3600; | ||
106 | var minutes = Math.floor(seconds / 60); | ||
107 | if (minutes < 10) { | ||
108 | minutes = "0" + minutes; | ||
109 | } | ||
110 | seconds = seconds % 60; | ||
111 | if (seconds < 10) { | ||
112 | seconds = "0" + seconds; | ||
113 | } | ||
114 | var result = "<span class=\"digit\">" + days + "</span> days <span class=\"digit\">" + hours + "</span> hours <span class=\"digit\">" + minutes + "</span> minutes <span class=\"digit\">" + seconds + "</span> seconds"; | ||
115 | $("#elapseClock").html(result); | ||
116 | } | ||
117 | |||
118 | function showMessages() { | ||
119 | adjustWordsPosition(); | ||
120 | $('#messages').fadeIn(5000, function() { | ||
121 | showLoveU(); | ||
122 | }); | ||
123 | } | ||
124 | |||
125 | function adjustWordsPosition() { | ||
126 | $('#words').css("position", "absolute"); | ||
127 | $('#words').css("top", $("#garden").position().top + 195); | ||
128 | $('#words').css("left", $("#garden").position().left + 70); | ||
129 | } | ||
130 | |||
131 | function adjustCodePosition() { | ||
132 | $('#code').css("margin-top", ($("#garden").height() - $("#code").height()) / 2); | ||
133 | } | ||
134 | |||
135 | function showLoveU() { | ||
136 | $('#loveu').fadeIn(3000); | ||
137 | } \ No newline at end of file | ||
diff --git a/deprecated/ZJW/javascripts/garden_dev.js b/deprecated/ZJW/javascripts/garden_dev.js new file mode 100644 index 0000000..21af667 --- /dev/null +++ b/deprecated/ZJW/javascripts/garden_dev.js | |||
@@ -0,0 +1,199 @@ | |||
1 | function Vector(x, y) { | ||
2 | this.x = x; | ||
3 | this.y = y; | ||
4 | }; | ||
5 | |||
6 | Vector.prototype = { | ||
7 | rotate: function (theta) { | ||
8 | var x = this.x; | ||
9 | var y = this.y; | ||
10 | this.x = Math.cos(theta) * x - Math.sin(theta) * y; | ||
11 | this.y = Math.sin(theta) * x + Math.cos(theta) * y; | ||
12 | return this; | ||
13 | }, | ||
14 | mult: function (f) { | ||
15 | this.x *= f; | ||
16 | this.y *= f; | ||
17 | return this; | ||
18 | }, | ||
19 | clone: function () { | ||
20 | return new Vector(this.x, this.y); | ||
21 | }, | ||
22 | length: function () { | ||
23 | return Math.sqrt(this.x * this.x + this.y * this.y); | ||
24 | }, | ||
25 | subtract: function (v) { | ||
26 | this.x -= v.x; | ||
27 | this.y -= v.y; | ||
28 | return this; | ||
29 | }, | ||
30 | set: function (x, y) { | ||
31 | this.x = x; | ||
32 | this.y = y; | ||
33 | return this; | ||
34 | } | ||
35 | }; | ||
36 | |||
37 | function Petal(stretchA, stretchB, startAngle, angle, growFactor, bloom) { | ||
38 | this.stretchA = stretchA; | ||
39 | this.stretchB = stretchB; | ||
40 | this.startAngle = startAngle; | ||
41 | this.angle = angle; | ||
42 | this.bloom = bloom; | ||
43 | this.growFactor = growFactor; | ||
44 | this.r = 1; | ||
45 | this.isfinished = false; | ||
46 | //this.tanAngleA = Garden.random(-Garden.degrad(Garden.options.tanAngle), Garden.degrad(Garden.options.tanAngle)); | ||
47 | //this.tanAngleB = Garden.random(-Garden.degrad(Garden.options.tanAngle), Garden.degrad(Garden.options.tanAngle)); | ||
48 | } | ||
49 | Petal.prototype = { | ||
50 | draw: function () { | ||
51 | var ctx = this.bloom.garden.ctx; | ||
52 | var v1, v2, v3, v4; | ||
53 | v1 = new Vector(0, this.r).rotate(Garden.degrad(this.startAngle)); | ||
54 | v2 = v1.clone().rotate(Garden.degrad(this.angle)); | ||
55 | v3 = v1.clone().mult(this.stretchA); //.rotate(this.tanAngleA); | ||
56 | v4 = v2.clone().mult(this.stretchB); //.rotate(this.tanAngleB); | ||
57 | ctx.strokeStyle = this.bloom.c; | ||
58 | ctx.beginPath(); | ||
59 | ctx.moveTo(v1.x, v1.y); | ||
60 | ctx.bezierCurveTo(v3.x, v3.y, v4.x, v4.y, v2.x, v2.y); | ||
61 | ctx.stroke(); | ||
62 | }, | ||
63 | render: function () { | ||
64 | if (this.r <= this.bloom.r) { | ||
65 | this.r += this.growFactor; // / 10; | ||
66 | this.draw(); | ||
67 | } else { | ||
68 | this.isfinished = true; | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | |||
73 | function Bloom(p, r, c, pc, garden) { | ||
74 | this.p = p; | ||
75 | this.r = r; | ||
76 | this.c = c; | ||
77 | this.pc = pc; | ||
78 | this.petals = []; | ||
79 | this.garden = garden; | ||
80 | this.init(); | ||
81 | this.garden.addBloom(this); | ||
82 | } | ||
83 | Bloom.prototype = { | ||
84 | draw: function () { | ||
85 | var p, isfinished = true; | ||
86 | this.garden.ctx.save(); | ||
87 | this.garden.ctx.translate(this.p.x, this.p.y); | ||
88 | for (var i = 0; i < this.petals.length; i++) { | ||
89 | p = this.petals[i]; | ||
90 | p.render(); | ||
91 | isfinished *= p.isfinished; | ||
92 | } | ||
93 | this.garden.ctx.restore(); | ||
94 | if (isfinished == true) { | ||
95 | this.garden.removeBloom(this); | ||
96 | } | ||
97 | }, | ||
98 | init: function () { | ||
99 | var angle = 360 / this.pc; | ||
100 | var startAngle = Garden.randomInt(0, 90); | ||
101 | for (var i = 0; i < this.pc; i++) { | ||
102 | this.petals.push(new Petal(Garden.random(Garden.options.petalStretch.min, Garden.options.petalStretch.max), Garden.random(Garden.options.petalStretch.min, Garden.options.petalStretch.max), startAngle + i * angle, angle, Garden.random(Garden.options.growFactor.min, Garden.options.growFactor.max), this)); | ||
103 | } | ||
104 | } | ||
105 | } | ||
106 | |||
107 | function Garden(ctx, element) { | ||
108 | this.blooms = []; | ||
109 | this.element = element; | ||
110 | this.ctx = ctx; | ||
111 | } | ||
112 | Garden.prototype = { | ||
113 | render: function () { | ||
114 | for (var i = 0; i < this.blooms.length; i++) { | ||
115 | this.blooms[i].draw(); | ||
116 | } | ||
117 | }, | ||
118 | addBloom: function (b) { | ||
119 | this.blooms.push(b); | ||
120 | }, | ||
121 | removeBloom: function (b) { | ||
122 | var bloom; | ||
123 | for (var i = 0; i < this.blooms.length; i++) { | ||
124 | bloom = this.blooms[i]; | ||
125 | if (bloom === b) { | ||
126 | this.blooms.splice(i, 1); | ||
127 | return this; | ||
128 | } | ||
129 | } | ||
130 | }, | ||
131 | createRandomBloom: function (x, y) { | ||
132 | this.createBloom(x, y, Garden.randomInt(Garden.options.bloomRadius.min, Garden.options.bloomRadius.max), Garden.randomrgba(Garden.options.color.rmin, Garden.options.color.rmax, Garden.options.color.gmin, Garden.options.color.gmax, Garden.options.color.bmin, Garden.options.color.bmax, Garden.options.color.opacity), Garden.randomInt(Garden.options.petalCount.min, Garden.options.petalCount.max)); | ||
133 | }, | ||
134 | createBloom: function (x, y, r, c, pc) { | ||
135 | new Bloom(new Vector(x, y), r, c, pc, this); | ||
136 | }, | ||
137 | clear: function () { | ||
138 | this.blooms = []; | ||
139 | this.ctx.clearRect(0, 0, this.element.width, this.element.height); | ||
140 | } | ||
141 | } | ||
142 | |||
143 | Garden.options = { | ||
144 | petalCount: { | ||
145 | min: 8, | ||
146 | max: 15 | ||
147 | }, | ||
148 | petalStretch: { | ||
149 | min: 0.1, | ||
150 | max: 3 | ||
151 | }, | ||
152 | growFactor: { | ||
153 | min: 0.1, | ||
154 | max: 1 | ||
155 | }, | ||
156 | bloomRadius: { | ||
157 | min: 4, | ||
158 | max: 7 | ||
159 | }, | ||
160 | density: 10, | ||
161 | growSpeed: 1500 / 60, | ||
162 | color: { | ||
163 | rmin: 128, | ||
164 | rmax: 255, | ||
165 | gmin: 0, | ||
166 | gmax: 128, | ||
167 | bmin: 0, | ||
168 | bmax: 128, | ||
169 | opacity: 0.1 | ||
170 | }, | ||
171 | tanAngle: 60 | ||
172 | }; | ||
173 | Garden.random = function (min, max) { | ||
174 | return Math.random() * (max - min) + min; | ||
175 | }; | ||
176 | Garden.randomInt = function (min, max) { | ||
177 | return Math.floor(Math.random() * (max - min + 1)) + min; | ||
178 | }; | ||
179 | Garden.circle = 2 * Math.PI; | ||
180 | Garden.degrad = function (angle) { | ||
181 | return Garden.circle / 360 * angle; | ||
182 | }; | ||
183 | Garden.raddeg = function (angle) { | ||
184 | return angle / Garden.circle * 360; | ||
185 | }; | ||
186 | Garden.rgba = function (r, g, b, a) { | ||
187 | return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')'; | ||
188 | }; | ||
189 | Garden.randomrgba = function (rmin, rmax, gmin, gmax, bmin, bmax, a) { | ||
190 | var r = Math.round(Garden.random(rmin, rmax)); | ||
191 | var g = Math.round(Garden.random(gmin, gmax)); | ||
192 | var b = Math.round(Garden.random(bmin, bmax)); | ||
193 | var limit = 5; | ||
194 | if (Math.abs(r - g) <= limit && Math.abs(g - b) <= limit && Math.abs(b - r) <= limit) { | ||
195 | return Garden.rgba(rmin, rmax, gmin, gmax, bmin, bmax, a); | ||
196 | } else { | ||
197 | return Garden.rgba(r, g, b, a); | ||
198 | } | ||
199 | }; \ No newline at end of file | ||
diff --git a/deprecated/ZJW/javascripts/jquery.js b/deprecated/ZJW/javascripts/jquery.js new file mode 100644 index 0000000..7c24308 --- /dev/null +++ b/deprecated/ZJW/javascripts/jquery.js | |||
@@ -0,0 +1,154 @@ | |||
1 | /*! | ||
2 | * jQuery JavaScript Library v1.4.2 | ||
3 | * http://jquery.com/ | ||
4 | * | ||
5 | * Copyright 2010, John Resig | ||
6 | * Dual licensed under the MIT or GPL Version 2 licenses. | ||
7 | * http://jquery.org/license | ||
8 | * | ||
9 | * Includes Sizzle.js | ||
10 | * http://sizzlejs.com/ | ||
11 | * Copyright 2010, The Dojo Foundation | ||
12 | * Released under the MIT, BSD, and GPL Licenses. | ||
13 | * | ||
14 | * Date: Sat Feb 13 22:33:48 2010 -0500 | ||
15 | */ | ||
16 | (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o<i;o++)e(a[o],b,f?d.call(a[o],o,e(a[o],b)):d,j);return a}return i? | ||
17 | e(a[0],b):w}function J(){return(new Date).getTime()}function Y(){return false}function Z(){return true}function na(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function oa(a){var b,d=[],f=[],e=arguments,j,i,o,k,n,r;i=c.data(this,"events");if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){a.liveFired=this;var u=i.live.slice(0);for(k=0;k<u.length;k++){i=u[k];i.origType.replace(O,"")===a.type?f.push(i.selector):u.splice(k--,1)}j=c(a.target).closest(f,a.currentTarget);n=0;for(r= | ||
18 | j.length;n<r;n++)for(k=0;k<u.length;k++){i=u[k];if(j[n].selector===i.selector){o=j[n].elem;f=null;if(i.preType==="mouseenter"||i.preType==="mouseleave")f=c(a.relatedTarget).closest(i.selector)[0];if(!f||f!==o)d.push({elem:o,handleObj:i})}}n=0;for(r=d.length;n<r;n++){j=d[n];a.currentTarget=j.elem;a.data=j.handleObj.data;a.handleObj=j.handleObj;if(j.handleObj.origHandler.apply(j.elem,e)===false){b=false;break}}return b}}function pa(a,b){return"live."+(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g, | ||
19 | "&")}function qa(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ra(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var f=c.data(a[d++]),e=c.data(this,f);if(f=f&&f.events){delete e.handle;e.events={};for(var j in f)for(var i in f[j])c.event.add(this,j,f[j][i],f[j][i].data)}}})}function sa(a,b,d){var f,e,j;b=b&&b[0]?b[0].ownerDocument||b[0]:s;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===s&&!ta.test(a[0])&&(c.support.checkClone||!ua.test(a[0]))){e= | ||
20 | true;if(j=c.fragments[a[0]])if(j!==1)f=j}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,d)}if(e)c.fragments[a[0]]=j?f:1;return{fragment:f,cacheable:e}}function K(a,b){var d={};c.each(va.concat.apply([],va.slice(0,b)),function(){d[this]=a});return d}function wa(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},Ra=A.jQuery,Sa=A.$,s=A.document,T,Ta=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, | ||
21 | Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& | ||
22 | (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, | ||
23 | a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== | ||
24 | "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, | ||
25 | function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b<d;b++)if((e=arguments[b])!=null)for(j in e){i=a[j];o=e[j];if(a!==o)if(f&&o&&(c.isPlainObject(o)||c.isArray(o))){i=i&&(c.isPlainObject(i)|| | ||
26 | c.isArray(i))?i:c.isArray(o)?[]:{};a[j]=c.extend(f,i,o)}else if(o!==w)a[j]=o}return a};c.extend({noConflict:function(a){A.$=Sa;if(a)A.jQuery=Ra;return c},isReady:false,ready:function(){if(!c.isReady){if(!s.body)return setTimeout(c.ready,13);c.isReady=true;if(Q){for(var a,b=0;a=Q[b++];)a.call(s,c);Q=null}c.fn.triggerHandler&&c(s).triggerHandler("ready")}},bindReady:function(){if(!xa){xa=true;if(s.readyState==="complete")return c.ready();if(s.addEventListener){s.addEventListener("DOMContentLoaded", | ||
27 | L,false);A.addEventListener("load",c.ready,false)}else if(s.attachEvent){s.attachEvent("onreadystatechange",L);A.attachEvent("onload",c.ready);var a=false;try{a=A.frameElement==null}catch(b){}s.documentElement.doScroll&&a&&ma()}}},isFunction:function(a){return $.call(a)==="[object Function]"},isArray:function(a){return $.call(a)==="[object Array]"},isPlainObject:function(a){if(!a||$.call(a)!=="[object Object]"||a.nodeType||a.setInterval)return false;if(a.constructor&&!aa.call(a,"constructor")&&!aa.call(a.constructor.prototype, | ||
28 | "isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ | ||
29 | a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f], | ||
30 | d)===false)break}else for(;e<j;){if(b.apply(a[e++],d)===false)break}else if(i)for(f in a){if(b.call(a[f],f,a[f])===false)break}else for(d=a[0];e<j&&b.call(d,e,d)!==false;d=a[++e]);return a},trim:function(a){return(a||"").replace(Wa,"")},makeArray:function(a,b){b=b||[];if(a!=null)a.length==null||typeof a==="string"||c.isFunction(a)||typeof a!=="function"&&a.setInterval?ba.call(b,a):c.merge(b,a);return b},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var d=0,f=b.length;d<f;d++)if(b[d]=== | ||
31 | a)return d;return-1},merge:function(a,b){var d=a.length,f=0;if(typeof b.length==="number")for(var e=b.length;f<e;f++)a[d++]=b[f];else for(;b[f]!==w;)a[d++]=b[f++];a.length=d;return a},grep:function(a,b,d){for(var f=[],e=0,j=a.length;e<j;e++)!d!==!b(a[e],e)&&f.push(a[e]);return f},map:function(a,b,d){for(var f=[],e,j=0,i=a.length;j<i;j++){e=b(a[j],j,d);if(e!=null)f[f.length]=e}return f.concat.apply([],f)},guid:1,proxy:function(a,b,d){if(arguments.length===2)if(typeof b==="string"){d=a;a=d[b];b=w}else if(b&& | ||
32 | !c.isFunction(b)){d=b;b=w}if(!b&&a)b=function(){return a.apply(d||this,arguments)};if(a)b.guid=a.guid=a.guid||b.guid||c.guid++;return b},uaMatch:function(a){a=a.toLowerCase();a=/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||!/compatible/.test(a)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}},browser:{}});P=c.uaMatch(P);if(P.browser){c.browser[P.browser]=true;c.browser.version=P.version}if(c.browser.webkit)c.browser.safari= | ||
33 | true;if(ya)c.inArray=function(a,b){return ya.call(b,a)};T=c(s);if(s.addEventListener)L=function(){s.removeEventListener("DOMContentLoaded",L,false);c.ready()};else if(s.attachEvent)L=function(){if(s.readyState==="complete"){s.detachEvent("onreadystatechange",L);c.ready()}};(function(){c.support={};var a=s.documentElement,b=s.createElement("script"),d=s.createElement("div"),f="script"+J();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; | ||
34 | var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, | ||
35 | parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= | ||
36 | false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= | ||
37 | s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, | ||
38 | applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; | ||
39 | else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, | ||
40 | a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== | ||
41 | w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, | ||
42 | cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1)if(e.className){for(var j=" "+e.className+" ", | ||
43 | i=e.className,o=0,k=b.length;o<k;o++)if(j.indexOf(" "+b[o]+" ")<0)i+=" "+b[o];e.className=c.trim(i)}else e.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(k){var n=c(this);n.removeClass(a.call(this,k,n.attr("class")))});if(a&&typeof a==="string"||a===w)for(var b=(a||"").split(ca),d=0,f=this.length;d<f;d++){var e=this[d];if(e.nodeType===1&&e.className)if(a){for(var j=(" "+e.className+" ").replace(Aa," "),i=0,o=b.length;i<o;i++)j=j.replace(" "+b[i]+" ", | ||
44 | " ");e.className=c.trim(j)}else e.className=""}return this},toggleClass:function(a,b){var d=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(e){var j=c(this);j.toggleClass(a.call(this,e,j.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var e,j=0,i=c(this),o=b,k=a.split(ca);e=k[j++];){o=f?o:!i.hasClass(e);i[o?"addClass":"removeClass"](e)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className= | ||
45 | this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j<d;j++){var i= | ||
46 | e[j];if(i.selected){a=c(i).val();if(b)return a;f.push(a)}}return f}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Za,"")}return w}var o=c.isFunction(a);return this.each(function(k){var n=c(this),r=a;if(this.nodeType===1){if(o)r=a.call(this,k,n.val());if(typeof r==="number")r+="";if(c.isArray(r)&&Ba.test(this.type))this.checked=c.inArray(n.val(),r)>=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= | ||
47 | c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); | ||
48 | a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, | ||
49 | function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); | ||
50 | k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), | ||
51 | C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B<r.length;B++){u=r[B];if(d.guid===u.guid){if(i||k.test(u.namespace)){f==null&&r.splice(B--,1);n.remove&&n.remove.call(a,u)}if(f!= | ||
52 | null)break}}if(r.length===0||f!=null&&r.length===1){if(!n.teardown||n.teardown.call(a,o)===false)Ca(a,e,z.handle);delete C[e]}}else for(var B=0;B<r.length;B++){u=r[B];if(i||k.test(u.namespace)){c.event.remove(a,n,u.handler,B);r.splice(B--,1)}}}if(c.isEmptyObject(C)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;c.isEmptyObject(z)&&c.removeData(a)}}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type= | ||
53 | e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& | ||
54 | f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; | ||
55 | if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e<j;e++){var i=d[e];if(b||f.test(i.namespace)){a.handler=i.handler;a.data=i.data;a.handleObj=i;i=i.handler.apply(this,arguments);if(i!==w){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), | ||
56 | fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||s;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=s.documentElement;d=s.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| | ||
57 | d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==w)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,a.origType,c.extend({},a,{handler:oa}))},remove:function(a){var b=true,d=a.origType.replace(O,"");c.each(c.data(this, | ||
58 | "events").live||[],function(){if(d===this.origType.replace(O,""))return b=false});b&&c.event.remove(this,a.origType,oa)}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var Ca=s.removeEventListener?function(a,b,d){a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent= | ||
59 | a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y, | ||
60 | isImmediatePropagationStopped:Y};var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ea:Da,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit= | ||
61 | {setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}}; | ||
62 | if(!c.support.changeBubbles){var da=/textarea|input|select/i,ea,Fa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", | ||
63 | e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, | ||
64 | "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, | ||
65 | d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j<o;j++)c.event.add(this[j],d,i,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&& | ||
66 | !a.preventDefault)for(var d in a)this.unbind(d,a[d]);else{d=0;for(var f=this.length;d<f;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,f){return this.live(b,d,f,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}}, | ||
67 | toggle:function(a){for(var b=arguments,d=1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(f){var e=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,e+1);f.preventDefault();return b[e].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,f,e,j){var i,o=0,k,n,r=j||this.selector, | ||
68 | u=j?this:c(this.context);if(c.isFunction(f)){e=f;f=w}for(d=(d||"").split(" ");(i=d[o++])!=null;){j=O.exec(i);k="";if(j){k=j[0];i=i.replace(O,"")}if(i==="hover")d.push("mouseenter"+k,"mouseleave"+k);else{n=i;if(i==="focus"||i==="blur"){d.push(Ga[i]+k);i+=k}else i=(Ga[i]||i)+k;b==="live"?u.each(function(){c.event.add(this,pa(i,r),{data:f,selector:r,handler:e,origType:i,origHandler:e,preType:n})}):u.unbind(pa(i,r),e)}}return this}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), | ||
69 | function(a,b){c.fn[b]=function(d){return d?this.bind(b,d):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});A.attachEvent&&!A.addEventListener&&A.attachEvent("onunload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(g){for(var h="",l,m=0;g[m];m++){l=g[m];if(l.nodeType===3||l.nodeType===4)h+=l.nodeValue;else if(l.nodeType!==8)h+=a(l.childNodes)}return h}function b(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q]; | ||
70 | if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1&&!p){t.sizcache=l;t.sizset=q}if(t.nodeName.toLowerCase()===h){y=t;break}t=t[g]}m[q]=y}}}function d(g,h,l,m,q,p){q=0;for(var v=m.length;q<v;q++){var t=m[q];if(t){t=t[g];for(var y=false;t;){if(t.sizcache===l){y=m[t.sizset];break}if(t.nodeType===1){if(!p){t.sizcache=l;t.sizset=q}if(typeof h!=="string"){if(t===h){y=true;break}}else if(k.filter(h,[t]).length>0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, | ||
71 | e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); | ||
72 | t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| | ||
73 | g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h<g.length;h++)g[h]===g[h-1]&&g.splice(h--,1)}return g};k.matches=function(g,h){return k(g,null,null,h)};k.find=function(g,h,l){var m,q;if(!g)return[]; | ||
74 | for(var p=0,v=n.order.length;p<v;p++){var t=n.order[p];if(q=n.leftMatch[t].exec(g)){var y=q[1];q.splice(1,1);if(y.substr(y.length-1)!=="\\"){q[1]=(q[1]||"").replace(/\\/g,"");m=n.find[t](q,h,l);if(m!=null){g=g.replace(n.match[t],"");break}}}}m||(m=h.getElementsByTagName("*"));return{set:m,expr:g}};k.filter=function(g,h,l,m){for(var q=g,p=[],v=h,t,y,S=h&&h[0]&&x(h[0]);g&&h.length;){for(var H in n.filter)if((t=n.leftMatch[H].exec(g))!=null&&t[2]){var M=n.filter[H],I,D;D=t[1];y=false;t.splice(1,1);if(D.substr(D.length- | ||
75 | 1)!=="\\"){if(v===p)p=[];if(n.preFilter[H])if(t=n.preFilter[H](t,v,l,p,m,S)){if(t===true)continue}else y=I=true;if(t)for(var U=0;(D=v[U])!=null;U++)if(D){I=M(D,t,U,v);var Ha=m^!!I;if(l&&I!=null)if(Ha)y=true;else v[U]=false;else if(Ha){p.push(D);y=true}}if(I!==w){l||(v=p);g=g.replace(n.match[H],"");if(!y)return[];break}}}if(g===q)if(y==null)k.error(g);else break;q=g}return v};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var n=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, | ||
76 | CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}}, | ||
77 | relative:{"+":function(g,h){var l=typeof h==="string",m=l&&!/\W/.test(h);l=l&&!m;if(m)h=h.toLowerCase();m=0;for(var q=g.length,p;m<q;m++)if(p=g[m]){for(;(p=p.previousSibling)&&p.nodeType!==1;);g[m]=l||p&&p.nodeName.toLowerCase()===h?p||false:p===h}l&&k.filter(h,g,true)},">":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m<q;m++){var p=g[m];if(p){l=p.parentNode;g[m]=l.nodeName.toLowerCase()===h?l:false}}}else{m=0;for(q=g.length;m<q;m++)if(p=g[m])g[m]= | ||
78 | l?p.parentNode:p.parentNode===h;l&&k.filter(h,g,true)}},"":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("parentNode",h,m,g,p,l)},"~":function(g,h,l){var m=e++,q=d;if(typeof h==="string"&&!/\W/.test(h)){var p=h=h.toLowerCase();q=b}q("previousSibling",h,m,g,p,l)}},find:{ID:function(g,h,l){if(typeof h.getElementById!=="undefined"&&!l)return(g=h.getElementById(g[1]))?[g]:[]},NAME:function(g,h){if(typeof h.getElementsByName!=="undefined"){var l=[]; | ||
79 | h=h.getElementsByName(g[1]);for(var m=0,q=h.length;m<q;m++)h[m].getAttribute("name")===g[1]&&l.push(h[m]);return l.length===0?null:l}},TAG:function(g,h){return h.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,h,l,m,q,p){g=" "+g[1].replace(/\\/g,"")+" ";if(p)return g;p=0;for(var v;(v=h[p])!=null;p++)if(v)if(q^(v.className&&(" "+v.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, | ||
80 | CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, | ||
81 | g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, | ||
82 | text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, | ||
83 | setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return h<l[3]-0},gt:function(g,h,l){return h>l[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= | ||
84 | h[3];l=0;for(m=h.length;l<m;l++)if(h[l]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+q)},CHILD:function(g,h){var l=h[1],m=g;switch(l){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(l==="first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":l=h[2];var q=h[3];if(l===1&&q===0)return true;h=h[0];var p=g.parentNode;if(p&&(p.sizcache!==h||!g.nodeIndex)){var v=0;for(m=p.firstChild;m;m= | ||
85 | m.nextSibling)if(m.nodeType===1)m.nodeIndex=++v;p.sizcache=h}g=g.nodeIndex-q;return l===0?g===0:g%l===0&&g/l>=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== | ||
86 | "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, | ||
87 | h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l<m;l++)h.push(g[l]);else for(l=0;g[l];l++)h.push(g[l]);return h}}var B;if(s.documentElement.compareDocumentPosition)B=function(g,h){if(!g.compareDocumentPosition|| | ||
88 | !h.compareDocumentPosition){if(g==h)i=true;return g.compareDocumentPosition?-1:1}g=g.compareDocumentPosition(h)&4?-1:g===h?0:1;if(g===0)i=true;return g};else if("sourceIndex"in s.documentElement)B=function(g,h){if(!g.sourceIndex||!h.sourceIndex){if(g==h)i=true;return g.sourceIndex?-1:1}g=g.sourceIndex-h.sourceIndex;if(g===0)i=true;return g};else if(s.createRange)B=function(g,h){if(!g.ownerDocument||!h.ownerDocument){if(g==h)i=true;return g.ownerDocument?-1:1}var l=g.ownerDocument.createRange(),m= | ||
89 | h.ownerDocument.createRange();l.setStart(g,0);l.setEnd(g,0);m.setStart(h,0);m.setEnd(h,0);g=l.compareBoundaryPoints(Range.START_TO_END,m);if(g===0)i=true;return g};(function(){var g=s.createElement("div"),h="script"+(new Date).getTime();g.innerHTML="<a name='"+h+"'/>";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& | ||
90 | q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; | ||
91 | if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="<p class='TEST'></p>";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); | ||
92 | (function(){var g=s.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: | ||
93 | function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q<p;q++)k(g,h[q],l);return k.filter(m,l)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=a;c.isXMLDoc=x;c.contains=E})();var eb=/Until$/,fb=/^(?:parents|prevUntil|prevAll)/, | ||
94 | gb=/,/;R=Array.prototype.slice;var Ia=function(a,b,d){if(c.isFunction(b))return c.grep(a,function(e,j){return!!b.call(e,j,e)===d});else if(b.nodeType)return c.grep(a,function(e){return e===b===d});else if(typeof b==="string"){var f=c.grep(a,function(e){return e.nodeType===1});if(Ua.test(b))return c.filter(b,f,!d);else b=c.filter(b,f)}return c.grep(a,function(e){return c.inArray(e,b)>=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f<e;f++){d=b.length; | ||
95 | c.find(a,this[f],b);if(f>0)for(var j=d;j<b.length;j++)for(var i=0;i<d;i++)if(b[i]===b[j]){b.splice(j--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,f=b.length;d<f;d++)if(c.contains(this,b[d]))return true})},not:function(a){return this.pushStack(Ia(this,a,false),"not",a)},filter:function(a){return this.pushStack(Ia(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= | ||
96 | {},i;if(f&&a.length){e=0;for(var o=a.length;e<o;e++){i=a[e];j[i]||(j[i]=c.expr.match.POS.test(i)?c(i,b||this.context):i)}for(;f&&f.ownerDocument&&f!==b;){for(i in j){e=j[i];if(e.jquery?e.index(f)>-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== | ||
97 | "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", | ||
98 | d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? | ||
99 | a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== | ||
100 | 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/<tbody/i,jb=/<|&#?\w+;/,ta=/<script|<object|<embed|<option|<style/i,ua=/checked\s*(?:[^=]|=\s*.checked.)/i,Ma=function(a,b,d){return hb.test(d)? | ||
101 | a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= | ||
102 | c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, | ||
103 | wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, | ||
104 | prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, | ||
105 | this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); | ||
106 | return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, | ||
107 | ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?this.each(function(e){var j=c(this),i=j.html();j.empty().append(function(){return a.call(this,e,i)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&& | ||
108 | this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=c(this),f=d.html();d.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){function f(u){return c.nodeName(u,"table")?u.getElementsByTagName("tbody")[0]|| | ||
109 | u.appendChild(u.ownerDocument.createElement("tbody")):u}var e,j,i=a[0],o=[],k;if(!c.support.checkClone&&arguments.length===3&&typeof i==="string"&&ua.test(i))return this.each(function(){c(this).domManip(a,b,d,true)});if(c.isFunction(i))return this.each(function(u){var z=c(this);a[0]=i.call(this,u,b?z.html():w);z.domManip(a,b,d)});if(this[0]){e=i&&i.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:sa(a,this,o);k=e.fragment;if(j=k.childNodes.length=== | ||
110 | 1?(k=k.firstChild):k.firstChild){b=b&&c.nodeName(j,"tr");for(var n=0,r=this.length;n<r;n++)d.call(b?f(this[n],j):this[n],n>0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); | ||
111 | return this}else{e=0;for(var j=d.length;e<j;e++){var i=(e>0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", | ||
112 | ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]==="<table>"&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= | ||
113 | c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? | ||
114 | c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= | ||
115 | function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= | ||
116 | Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, | ||
117 | "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= | ||
118 | a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= | ||
119 | a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=/<script(.|\s)*?\/script>/gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== | ||
120 | "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("<div />").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, | ||
121 | serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), | ||
122 | function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, | ||
123 | global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& | ||
124 | e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? | ||
125 | "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== | ||
126 | false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= | ||
127 | false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", | ||
128 | c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| | ||
129 | d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); | ||
130 | g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== | ||
131 | 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== | ||
132 | "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; | ||
133 | if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay"); | ||
134 | this[a].style.display=d||"";if(c.css(this[a],"display")==="none"){d=this[a].nodeName;var f;if(la[d])f=la[d];else{var e=c("<"+d+" />").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=c.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(K("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var d=c.data(this[a],"olddisplay");!d&&d!=="none"&&c.data(this[a], | ||
135 | "olddisplay",c.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b){var d=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||d?this.each(function(){var f=d?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(K("toggle",3),a,b);return this},fadeTo:function(a,b,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d)}, | ||
136 | animate:function(a,b,d,f){var e=c.speed(b,d,f);if(c.isEmptyObject(a))return this.each(e.complete);return this[e.queue===false?"each":"queue"](function(){var j=c.extend({},e),i,o=this.nodeType===1&&c(this).is(":hidden"),k=this;for(i in a){var n=i.replace(ia,ja);if(i!==n){a[n]=a[i];delete a[i];i=n}if(a[i]==="hide"&&o||a[i]==="show"&&!o)return j.complete.call(this);if((i==="height"||i==="width")&&this.style){j.display=c.css(this,"display");j.overflow=this.style.overflow}if(c.isArray(a[i])){(j.specialEasing= | ||
137 | j.specialEasing||{})[i]=a[i][1];a[i]=a[i][0]}}if(j.overflow!=null)this.style.overflow="hidden";j.curAnim=c.extend({},a);c.each(a,function(r,u){var z=new c.fx(k,j,r);if(Ab.test(u))z[u==="toggle"?o?"show":"hide":u](a);else{var C=Bb.exec(u),B=z.cur(true)||0;if(C){u=parseFloat(C[2]);var E=C[3]||"px";if(E!=="px"){k.style[r]=(u||1)+E;B=(u||1)/z.cur(true)*B;k.style[r]=B+E}if(C[1])u=(C[1]==="-="?-1:1)*u+B;z.custom(B,u,E)}else z.custom(B,u,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]); | ||
138 | this.each(function(){for(var f=d.length-1;f>=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== | ||
139 | "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| | ||
140 | c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; | ||
141 | this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= | ||
142 | this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, | ||
143 | e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length|| | ||
144 | c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement? | ||
145 | function(a){var b=this[0];if(a)return this.each(function(e){c.offset.setOffset(this,a,e)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);var d=b.getBoundingClientRect(),f=b.ownerDocument;b=f.body;f=f.documentElement;return{top:d.top+(self.pageYOffset||c.support.boxModel&&f.scrollTop||b.scrollTop)-(f.clientTop||b.clientTop||0),left:d.left+(self.pageXOffset||c.support.boxModel&&f.scrollLeft||b.scrollLeft)-(f.clientLeft||b.clientLeft||0)}}:function(a){var b= | ||
146 | this[0];if(a)return this.each(function(r){c.offset.setOffset(this,a,r)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d=b.offsetParent,f=b,e=b.ownerDocument,j,i=e.documentElement,o=e.body;f=(e=e.defaultView)?e.getComputedStyle(b,null):b.currentStyle;for(var k=b.offsetTop,n=b.offsetLeft;(b=b.parentNode)&&b!==o&&b!==i;){if(c.offset.supportsFixedPosition&&f.position==="fixed")break;j=e?e.getComputedStyle(b,null):b.currentStyle; | ||
147 | k-=b.scrollTop;n-=b.scrollLeft;if(b===d){k+=b.offsetTop;n+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=d;d=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){k+=parseFloat(j.borderTopWidth)||0;n+=parseFloat(j.borderLeftWidth)||0}f=j}if(f.position==="relative"||f.position==="static"){k+=o.offsetTop;n+=o.offsetLeft}if(c.offset.supportsFixedPosition&& | ||
148 | f.position==="fixed"){k+=Math.max(i.scrollTop,o.scrollTop);n+=Math.max(i.scrollLeft,o.scrollLeft)}return{top:k,left:n}};c.offset={initialize:function(){var a=s.body,b=s.createElement("div"),d,f,e,j=parseFloat(c.curCSS(a,"marginTop",true))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; | ||
149 | a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); | ||
150 | c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, | ||
151 | d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- | ||
152 | f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": | ||
153 | "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in | ||
154 | e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); | ||
diff --git a/deprecated/ZJW/javascripts/jquery.min.js b/deprecated/ZJW/javascripts/jquery.min.js new file mode 100644 index 0000000..60479ce --- /dev/null +++ b/deprecated/ZJW/javascripts/jquery.min.js | |||
@@ -0,0 +1,3375 @@ | |||
1 | /*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ ! function(a, b) { | ||
2 | "object" == typeof module && "object" == typeof module.exports ? module.exports = a.document ? b(a, !0) : function(a) { | ||
3 | if (!a.document) throw new Error("jQuery requires a window with a document"); | ||
4 | return b(a) | ||
5 | } : b(a) | ||
6 | }("undefined" != typeof window ? window : this, function(a, b) { | ||
7 | var c = [], | ||
8 | d = c.slice, | ||
9 | e = c.concat, | ||
10 | f = c.push, | ||
11 | g = c.indexOf, | ||
12 | h = {}, | ||
13 | i = h.toString, | ||
14 | j = h.hasOwnProperty, | ||
15 | k = "".trim, | ||
16 | l = {}, | ||
17 | m = "1.11.0", | ||
18 | n = function(a, b) { | ||
19 | return new n.fn.init(a, b) | ||
20 | }, | ||
21 | o = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | ||
22 | p = /^-ms-/, | ||
23 | q = /-([\da-z])/gi, | ||
24 | r = function(a, b) { | ||
25 | return b.toUpperCase() | ||
26 | }; | ||
27 | n.fn = n.prototype = { | ||
28 | jquery: m, | ||
29 | constructor: n, | ||
30 | selector: "", | ||
31 | length: 0, | ||
32 | toArray: function() { | ||
33 | return d.call(this) | ||
34 | }, | ||
35 | get: function(a) { | ||
36 | return null != a ? 0 > a ? this[a + this.length] : this[a] : d.call(this) | ||
37 | }, | ||
38 | pushStack: function(a) { | ||
39 | var b = n.merge(this.constructor(), a); | ||
40 | return b.prevObject = this, b.context = this.context, b | ||
41 | }, | ||
42 | each: function(a, b) { | ||
43 | return n.each(this, a, b) | ||
44 | }, | ||
45 | map: function(a) { | ||
46 | return this.pushStack(n.map(this, function(b, c) { | ||
47 | return a.call(b, c, b) | ||
48 | })) | ||
49 | }, | ||
50 | slice: function() { | ||
51 | return this.pushStack(d.apply(this, arguments)) | ||
52 | }, | ||
53 | first: function() { | ||
54 | return this.eq(0) | ||
55 | }, | ||
56 | last: function() { | ||
57 | return this.eq(-1) | ||
58 | }, | ||
59 | eq: function(a) { | ||
60 | var b = this.length, | ||
61 | c = +a + (0 > a ? b : 0); | ||
62 | return this.pushStack(c >= 0 && b > c ? [this[c]] : []) | ||
63 | }, | ||
64 | end: function() { | ||
65 | return this.prevObject || this.constructor(null) | ||
66 | }, | ||
67 | push: f, | ||
68 | sort: c.sort, | ||
69 | splice: c.splice | ||
70 | }, n.extend = n.fn.extend = function() { | ||
71 | var a, b, c, d, e, f, g = arguments[0] || {}, | ||
72 | h = 1, | ||
73 | i = arguments.length, | ||
74 | j = !1; | ||
75 | for ("boolean" == typeof g && (j = g, g = arguments[h] || {}, h++), "object" == typeof g || n.isFunction(g) || (g = {}), h === i && (g = this, h--); i > h; h++) | ||
76 | if (null != (e = arguments[h])) | ||
77 | for (d in e) a = g[d], c = e[d], g !== c && (j && c && (n.isPlainObject(c) || (b = n.isArray(c))) ? (b ? (b = !1, f = a && n.isArray(a) ? a : []) : f = a && n.isPlainObject(a) ? a : {}, g[d] = n.extend(j, f, c)) : void 0 !== c && (g[d] = c)); | ||
78 | return g | ||
79 | }, n.extend({ | ||
80 | expando: "jQuery" + (m + Math.random()).replace(/\D/g, ""), | ||
81 | isReady: !0, | ||
82 | error: function(a) { | ||
83 | throw new Error(a) | ||
84 | }, | ||
85 | noop: function() {}, | ||
86 | isFunction: function(a) { | ||
87 | return "function" === n.type(a) | ||
88 | }, | ||
89 | isArray: Array.isArray || function(a) { | ||
90 | return "array" === n.type(a) | ||
91 | }, | ||
92 | isWindow: function(a) { | ||
93 | return null != a && a == a.window | ||
94 | }, | ||
95 | isNumeric: function(a) { | ||
96 | return a - parseFloat(a) >= 0 | ||
97 | }, | ||
98 | isEmptyObject: function(a) { | ||
99 | var b; | ||
100 | for (b in a) return !1; | ||
101 | return !0 | ||
102 | }, | ||
103 | isPlainObject: function(a) { | ||
104 | var b; | ||
105 | if (!a || "object" !== n.type(a) || a.nodeType || n.isWindow(a)) return !1; | ||
106 | try { | ||
107 | if (a.constructor && !j.call(a, "constructor") && !j.call(a.constructor.prototype, "isPrototypeOf")) return !1 | ||
108 | } catch (c) { | ||
109 | return !1 | ||
110 | } | ||
111 | if (l.ownLast) | ||
112 | for (b in a) return j.call(a, b); | ||
113 | for (b in a); | ||
114 | return void 0 === b || j.call(a, b) | ||
115 | }, | ||
116 | type: function(a) { | ||
117 | return null == a ? a + "" : "object" == typeof a || "function" == typeof a ? h[i.call(a)] || "object" : typeof a | ||
118 | }, | ||
119 | globalEval: function(b) { | ||
120 | b && n.trim(b) && (a.execScript || function(b) { | ||
121 | a.eval.call(a, b) | ||
122 | })(b) | ||
123 | }, | ||
124 | camelCase: function(a) { | ||
125 | return a.replace(p, "ms-").replace(q, r) | ||
126 | }, | ||
127 | nodeName: function(a, b) { | ||
128 | return a.nodeName && a.nodeName.toLowerCase() === b.toLowerCase() | ||
129 | }, | ||
130 | each: function(a, b, c) { | ||
131 | var d, e = 0, | ||
132 | f = a.length, | ||
133 | g = s(a); | ||
134 | if (c) { | ||
135 | if (g) { | ||
136 | for (; f > e; e++) | ||
137 | if (d = b.apply(a[e], c), d === !1) break | ||
138 | } else | ||
139 | for (e in a) | ||
140 | if (d = b.apply(a[e], c), d === !1) break | ||
141 | } else if (g) { | ||
142 | for (; f > e; e++) | ||
143 | if (d = b.call(a[e], e, a[e]), d === !1) break | ||
144 | } else | ||
145 | for (e in a) | ||
146 | if (d = b.call(a[e], e, a[e]), d === !1) break; return a | ||
147 | }, | ||
148 | trim: k && !k.call("\ufeff\xa0") ? function(a) { | ||
149 | return null == a ? "" : k.call(a) | ||
150 | } : function(a) { | ||
151 | return null == a ? "" : (a + "").replace(o, "") | ||
152 | }, | ||
153 | makeArray: function(a, b) { | ||
154 | var c = b || []; | ||
155 | return null != a && (s(Object(a)) ? n.merge(c, "string" == typeof a ? [a] : a) : f.call(c, a)), c | ||
156 | }, | ||
157 | inArray: function(a, b, c) { | ||
158 | var d; | ||
159 | if (b) { | ||
160 | if (g) return g.call(b, a, c); | ||
161 | for (d = b.length, c = c ? 0 > c ? Math.max(0, d + c) : c : 0; d > c; c++) | ||
162 | if (c in b && b[c] === a) return c | ||
163 | } | ||
164 | return -1 | ||
165 | }, | ||
166 | merge: function(a, b) { | ||
167 | var c = +b.length, | ||
168 | d = 0, | ||
169 | e = a.length; | ||
170 | while (c > d) a[e++] = b[d++]; | ||
171 | if (c !== c) | ||
172 | while (void 0 !== b[d]) a[e++] = b[d++]; | ||
173 | return a.length = e, a | ||
174 | }, | ||
175 | grep: function(a, b, c) { | ||
176 | for (var d, e = [], f = 0, g = a.length, h = !c; g > f; f++) d = !b(a[f], f), d !== h && e.push(a[f]); | ||
177 | return e | ||
178 | }, | ||
179 | map: function(a, b, c) { | ||
180 | var d, f = 0, | ||
181 | g = a.length, | ||
182 | h = s(a), | ||
183 | i = []; | ||
184 | if (h) | ||
185 | for (; g > f; f++) d = b(a[f], f, c), null != d && i.push(d); | ||
186 | else | ||
187 | for (f in a) d = b(a[f], f, c), null != d && i.push(d); | ||
188 | return e.apply([], i) | ||
189 | }, | ||
190 | guid: 1, | ||
191 | proxy: function(a, b) { | ||
192 | var c, e, f; | ||
193 | return "string" == typeof b && (f = a[b], b = a, a = f), n.isFunction(a) ? (c = d.call(arguments, 2), e = function() { | ||
194 | return a.apply(b || this, c.concat(d.call(arguments))) | ||
195 | }, e.guid = a.guid = a.guid || n.guid++, e) : void 0 | ||
196 | }, | ||
197 | now: function() { | ||
198 | return +new Date | ||
199 | }, | ||
200 | support: l | ||
201 | }), n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(a, b) { | ||
202 | h["[object " + b + "]"] = b.toLowerCase() | ||
203 | }); | ||
204 | |||
205 | function s(a) { | ||
206 | var b = a.length, | ||
207 | c = n.type(a); | ||
208 | return "function" === c || n.isWindow(a) ? !1 : 1 === a.nodeType && b ? !0 : "array" === c || 0 === b || "number" == typeof b && b > 0 && b - 1 in a | ||
209 | } | ||
210 | var t = function(a) { | ||
211 | var b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s = "sizzle" + -new Date, | ||
212 | t = a.document, | ||
213 | u = 0, | ||
214 | v = 0, | ||
215 | w = eb(), | ||
216 | x = eb(), | ||
217 | y = eb(), | ||
218 | z = function(a, b) { | ||
219 | return a === b && (j = !0), 0 | ||
220 | }, | ||
221 | A = "undefined", | ||
222 | B = 1 << 31, | ||
223 | C = {}.hasOwnProperty, | ||
224 | D = [], | ||
225 | E = D.pop, | ||
226 | F = D.push, | ||
227 | G = D.push, | ||
228 | H = D.slice, | ||
229 | I = D.indexOf || function(a) { | ||
230 | for (var b = 0, c = this.length; c > b; b++) | ||
231 | if (this[b] === a) return b; | ||
232 | return -1 | ||
233 | }, | ||
234 | J = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | ||
235 | K = "[\\x20\\t\\r\\n\\f]", | ||
236 | L = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | ||
237 | M = L.replace("w", "w#"), | ||
238 | N = "\\[" + K + "*(" + L + ")" + K + "*(?:([*^$|!~]?=)" + K + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + M + ")|)|)" + K + "*\\]", | ||
239 | O = ":(" + L + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + N.replace(3, 8) + ")*)|.*)\\)|)", | ||
240 | P = new RegExp("^" + K + "+|((?:^|[^\\\\])(?:\\\\.)*)" + K + "+$", "g"), | ||
241 | Q = new RegExp("^" + K + "*," + K + "*"), | ||
242 | R = new RegExp("^" + K + "*([>+~]|" + K + ")" + K + "*"), | ||
243 | S = new RegExp("=" + K + "*([^\\]'\"]*?)" + K + "*\\]", "g"), | ||
244 | T = new RegExp(O), | ||
245 | U = new RegExp("^" + M + "$"), | ||
246 | V = { | ||
247 | ID: new RegExp("^#(" + L + ")"), | ||
248 | CLASS: new RegExp("^\\.(" + L + ")"), | ||
249 | TAG: new RegExp("^(" + L.replace("w", "w*") + ")"), | ||
250 | ATTR: new RegExp("^" + N), | ||
251 | PSEUDO: new RegExp("^" + O), | ||
252 | CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + K + "*(even|odd|(([+-]|)(\\d*)n|)" + K + "*(?:([+-]|)" + K + "*(\\d+)|))" + K + "*\\)|)", "i"), | ||
253 | bool: new RegExp("^(?:" + J + ")$", "i"), | ||
254 | needsContext: new RegExp("^" + K + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + K + "*((?:-\\d)?\\d*)" + K + "*\\)|)(?=[^-]|$)", "i") | ||
255 | }, | ||
256 | W = /^(?:input|select|textarea|button)$/i, | ||
257 | X = /^h\d$/i, | ||
258 | Y = /^[^{]+\{\s*\[native \w/, | ||
259 | Z = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | ||
260 | $ = /[+~]/, | ||
261 | _ = /'|\\/g, | ||
262 | ab = new RegExp("\\\\([\\da-f]{1,6}" + K + "?|(" + K + ")|.)", "ig"), | ||
263 | bb = function(a, b, c) { | ||
264 | var d = "0x" + b - 65536; | ||
265 | return d !== d || c ? b : 0 > d ? String.fromCharCode(d + 65536) : String.fromCharCode(d >> 10 | 55296, 1023 & d | 56320) | ||
266 | }; | ||
267 | try { | ||
268 | G.apply(D = H.call(t.childNodes), t.childNodes), D[t.childNodes.length].nodeType | ||
269 | } catch (cb) { | ||
270 | G = { | ||
271 | apply: D.length ? function(a, b) { | ||
272 | F.apply(a, H.call(b)) | ||
273 | } : function(a, b) { | ||
274 | var c = a.length, | ||
275 | d = 0; | ||
276 | while (a[c++] = b[d++]); | ||
277 | a.length = c - 1 | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | |||
282 | function db(a, b, d, e) { | ||
283 | var f, g, h, i, j, m, p, q, u, v; | ||
284 | if ((b ? b.ownerDocument || b : t) !== l && k(b), b = b || l, d = d || [], !a || "string" != typeof a) return d; | ||
285 | if (1 !== (i = b.nodeType) && 9 !== i) return []; | ||
286 | if (n && !e) { | ||
287 | if (f = Z.exec(a)) | ||
288 | if (h = f[1]) { | ||
289 | if (9 === i) { | ||
290 | if (g = b.getElementById(h), !g || !g.parentNode) return d; | ||
291 | if (g.id === h) return d.push(g), d | ||
292 | } else if (b.ownerDocument && (g = b.ownerDocument.getElementById(h)) && r(b, g) && g.id === h) return d.push(g), d | ||
293 | } else { | ||
294 | if (f[2]) return G.apply(d, b.getElementsByTagName(a)), d; | ||
295 | if ((h = f[3]) && c.getElementsByClassName && b.getElementsByClassName) return G.apply(d, b.getElementsByClassName(h)), d | ||
296 | } | ||
297 | if (c.qsa && (!o || !o.test(a))) { | ||
298 | if (q = p = s, u = b, v = 9 === i && a, 1 === i && "object" !== b.nodeName.toLowerCase()) { | ||
299 | m = ob(a), (p = b.getAttribute("id")) ? q = p.replace(_, "\\$&") : b.setAttribute("id", q), q = "[id='" + q + "'] ", j = m.length; | ||
300 | while (j--) m[j] = q + pb(m[j]); | ||
301 | u = $.test(a) && mb(b.parentNode) || b, v = m.join(",") | ||
302 | } | ||
303 | if (v) try { | ||
304 | return G.apply(d, u.querySelectorAll(v)), d | ||
305 | } catch (w) {} finally { | ||
306 | p || b.removeAttribute("id") | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | return xb(a.replace(P, "$1"), b, d, e) | ||
311 | } | ||
312 | |||
313 | function eb() { | ||
314 | var a = []; | ||
315 | |||
316 | function b(c, e) { | ||
317 | return a.push(c + " ") > d.cacheLength && delete b[a.shift()], b[c + " "] = e | ||
318 | } | ||
319 | return b | ||
320 | } | ||
321 | |||
322 | function fb(a) { | ||
323 | return a[s] = !0, a | ||
324 | } | ||
325 | |||
326 | function gb(a) { | ||
327 | var b = l.createElement("div"); | ||
328 | try { | ||
329 | return !!a(b) | ||
330 | } catch (c) { | ||
331 | return !1 | ||
332 | } finally { | ||
333 | b.parentNode && b.parentNode.removeChild(b), b = null | ||
334 | } | ||
335 | } | ||
336 | |||
337 | function hb(a, b) { | ||
338 | var c = a.split("|"), | ||
339 | e = a.length; | ||
340 | while (e--) d.attrHandle[c[e]] = b | ||
341 | } | ||
342 | |||
343 | function ib(a, b) { | ||
344 | var c = b && a, | ||
345 | d = c && 1 === a.nodeType && 1 === b.nodeType && (~b.sourceIndex || B) - (~a.sourceIndex || B); | ||
346 | if (d) return d; | ||
347 | if (c) | ||
348 | while (c = c.nextSibling) | ||
349 | if (c === b) return -1; | ||
350 | return a ? 1 : -1 | ||
351 | } | ||
352 | |||
353 | function jb(a) { | ||
354 | return function(b) { | ||
355 | var c = b.nodeName.toLowerCase(); | ||
356 | return "input" === c && b.type === a | ||
357 | } | ||
358 | } | ||
359 | |||
360 | function kb(a) { | ||
361 | return function(b) { | ||
362 | var c = b.nodeName.toLowerCase(); | ||
363 | return ("input" === c || "button" === c) && b.type === a | ||
364 | } | ||
365 | } | ||
366 | |||
367 | function lb(a) { | ||
368 | return fb(function(b) { | ||
369 | return b = +b, fb(function(c, d) { | ||
370 | var e, f = a([], c.length, b), | ||
371 | g = f.length; | ||
372 | while (g--) c[e = f[g]] && (c[e] = !(d[e] = c[e])) | ||
373 | }) | ||
374 | }) | ||
375 | } | ||
376 | |||
377 | function mb(a) { | ||
378 | return a && typeof a.getElementsByTagName !== A && a | ||
379 | } | ||
380 | c = db.support = {}, f = db.isXML = function(a) { | ||
381 | var b = a && (a.ownerDocument || a).documentElement; | ||
382 | return b ? "HTML" !== b.nodeName : !1 | ||
383 | }, k = db.setDocument = function(a) { | ||
384 | var b, e = a ? a.ownerDocument || a : t, | ||
385 | g = e.defaultView; | ||
386 | return e !== l && 9 === e.nodeType && e.documentElement ? (l = e, m = e.documentElement, n = !f(e), g && g !== g.top && (g.addEventListener ? g.addEventListener("unload", function() { | ||
387 | k() | ||
388 | }, !1) : g.attachEvent && g.attachEvent("onunload", function() { | ||
389 | k() | ||
390 | })), c.attributes = gb(function(a) { | ||
391 | return a.className = "i", !a.getAttribute("className") | ||
392 | }), c.getElementsByTagName = gb(function(a) { | ||
393 | return a.appendChild(e.createComment("")), !a.getElementsByTagName("*").length | ||
394 | }), c.getElementsByClassName = Y.test(e.getElementsByClassName) && gb(function(a) { | ||
395 | return a.innerHTML = "<div class='a'></div><div class='a i'></div>", a.firstChild.className = "i", 2 === a.getElementsByClassName("i").length | ||
396 | }), c.getById = gb(function(a) { | ||
397 | return m.appendChild(a).id = s, !e.getElementsByName || !e.getElementsByName(s).length | ||
398 | }), c.getById ? (d.find.ID = function(a, b) { | ||
399 | if (typeof b.getElementById !== A && n) { | ||
400 | var c = b.getElementById(a); | ||
401 | return c && c.parentNode ? [c] : [] | ||
402 | } | ||
403 | }, d.filter.ID = function(a) { | ||
404 | var b = a.replace(ab, bb); | ||
405 | return function(a) { | ||
406 | return a.getAttribute("id") === b | ||
407 | } | ||
408 | }) : (delete d.find.ID, d.filter.ID = function(a) { | ||
409 | var b = a.replace(ab, bb); | ||
410 | return function(a) { | ||
411 | var c = typeof a.getAttributeNode !== A && a.getAttributeNode("id"); | ||
412 | return c && c.value === b | ||
413 | } | ||
414 | }), d.find.TAG = c.getElementsByTagName ? function(a, b) { | ||
415 | return typeof b.getElementsByTagName !== A ? b.getElementsByTagName(a) : void 0 | ||
416 | } : function(a, b) { | ||
417 | var c, d = [], | ||
418 | e = 0, | ||
419 | f = b.getElementsByTagName(a); | ||
420 | if ("*" === a) { | ||
421 | while (c = f[e++]) 1 === c.nodeType && d.push(c); | ||
422 | return d | ||
423 | } | ||
424 | return f | ||
425 | }, d.find.CLASS = c.getElementsByClassName && function(a, b) { | ||
426 | return typeof b.getElementsByClassName !== A && n ? b.getElementsByClassName(a) : void 0 | ||
427 | }, p = [], o = [], (c.qsa = Y.test(e.querySelectorAll)) && (gb(function(a) { | ||
428 | a.innerHTML = "<select t=''><option selected=''></option></select>", a.querySelectorAll("[t^='']").length && o.push("[*^$]=" + K + "*(?:''|\"\")"), a.querySelectorAll("[selected]").length || o.push("\\[" + K + "*(?:value|" + J + ")"), a.querySelectorAll(":checked").length || o.push(":checked") | ||
429 | }), gb(function(a) { | ||
430 | var b = e.createElement("input"); | ||
431 | b.setAttribute("type", "hidden"), a.appendChild(b).setAttribute("name", "D"), a.querySelectorAll("[name=d]").length && o.push("name" + K + "*[*^$|!~]?="), a.querySelectorAll(":enabled").length || o.push(":enabled", ":disabled"), a.querySelectorAll("*,:x"), o.push(",.*:") | ||
432 | })), (c.matchesSelector = Y.test(q = m.webkitMatchesSelector || m.mozMatchesSelector || m.oMatchesSelector || m.msMatchesSelector)) && gb(function(a) { | ||
433 | c.disconnectedMatch = q.call(a, "div"), q.call(a, "[s!='']:x"), p.push("!=", O) | ||
434 | }), o = o.length && new RegExp(o.join("|")), p = p.length && new RegExp(p.join("|")), b = Y.test(m.compareDocumentPosition), r = b || Y.test(m.contains) ? function(a, b) { | ||
435 | var c = 9 === a.nodeType ? a.documentElement : a, | ||
436 | d = b && b.parentNode; | ||
437 | return a === d || !(!d || 1 !== d.nodeType || !(c.contains ? c.contains(d) : a.compareDocumentPosition && 16 & a.compareDocumentPosition(d))) | ||
438 | } : function(a, b) { | ||
439 | if (b) | ||
440 | while (b = b.parentNode) | ||
441 | if (b === a) return !0; | ||
442 | return !1 | ||
443 | }, z = b ? function(a, b) { | ||
444 | if (a === b) return j = !0, 0; | ||
445 | var d = !a.compareDocumentPosition - !b.compareDocumentPosition; | ||
446 | return d ? d : (d = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1, 1 & d || !c.sortDetached && b.compareDocumentPosition(a) === d ? a === e || a.ownerDocument === t && r(t, a) ? -1 : b === e || b.ownerDocument === t && r(t, b) ? 1 : i ? I.call(i, a) - I.call(i, b) : 0 : 4 & d ? -1 : 1) | ||
447 | } : function(a, b) { | ||
448 | if (a === b) return j = !0, 0; | ||
449 | var c, d = 0, | ||
450 | f = a.parentNode, | ||
451 | g = b.parentNode, | ||
452 | h = [a], | ||
453 | k = [b]; | ||
454 | if (!f || !g) return a === e ? -1 : b === e ? 1 : f ? -1 : g ? 1 : i ? I.call(i, a) - I.call(i, b) : 0; | ||
455 | if (f === g) return ib(a, b); | ||
456 | c = a; | ||
457 | while (c = c.parentNode) h.unshift(c); | ||
458 | c = b; | ||
459 | while (c = c.parentNode) k.unshift(c); | ||
460 | while (h[d] === k[d]) d++; | ||
461 | return d ? ib(h[d], k[d]) : h[d] === t ? -1 : k[d] === t ? 1 : 0 | ||
462 | }, e) : l | ||
463 | }, db.matches = function(a, b) { | ||
464 | return db(a, null, null, b) | ||
465 | }, db.matchesSelector = function(a, b) { | ||
466 | if ((a.ownerDocument || a) !== l && k(a), b = b.replace(S, "='$1']"), !(!c.matchesSelector || !n || p && p.test(b) || o && o.test(b))) try { | ||
467 | var d = q.call(a, b); | ||
468 | if (d || c.disconnectedMatch || a.document && 11 !== a.document.nodeType) return d | ||
469 | } catch (e) {} | ||
470 | return db(b, l, null, [a]).length > 0 | ||
471 | }, db.contains = function(a, b) { | ||
472 | return (a.ownerDocument || a) !== l && k(a), r(a, b) | ||
473 | }, db.attr = function(a, b) { | ||
474 | (a.ownerDocument || a) !== l && k(a); | ||
475 | var e = d.attrHandle[b.toLowerCase()], | ||
476 | f = e && C.call(d.attrHandle, b.toLowerCase()) ? e(a, b, !n) : void 0; | ||
477 | return void 0 !== f ? f : c.attributes || !n ? a.getAttribute(b) : (f = a.getAttributeNode(b)) && f.specified ? f.value : null | ||
478 | }, db.error = function(a) { | ||
479 | throw new Error("Syntax error, unrecognized expression: " + a) | ||
480 | }, db.uniqueSort = function(a) { | ||
481 | var b, d = [], | ||
482 | e = 0, | ||
483 | f = 0; | ||
484 | if (j = !c.detectDuplicates, i = !c.sortStable && a.slice(0), a.sort(z), j) { | ||
485 | while (b = a[f++]) b === a[f] && (e = d.push(f)); | ||
486 | while (e--) a.splice(d[e], 1) | ||
487 | } | ||
488 | return i = null, a | ||
489 | }, e = db.getText = function(a) { | ||
490 | var b, c = "", | ||
491 | d = 0, | ||
492 | f = a.nodeType; | ||
493 | if (f) { | ||
494 | if (1 === f || 9 === f || 11 === f) { | ||
495 | if ("string" == typeof a.textContent) return a.textContent; | ||
496 | for (a = a.firstChild; a; a = a.nextSibling) c += e(a) | ||
497 | } else if (3 === f || 4 === f) return a.nodeValue | ||
498 | } else | ||
499 | while (b = a[d++]) c += e(b); | ||
500 | return c | ||
501 | }, d = db.selectors = { | ||
502 | cacheLength: 50, | ||
503 | createPseudo: fb, | ||
504 | match: V, | ||
505 | attrHandle: {}, | ||
506 | find: {}, | ||
507 | relative: { | ||
508 | ">": { | ||
509 | dir: "parentNode", | ||
510 | first: !0 | ||
511 | }, | ||
512 | " ": { | ||
513 | dir: "parentNode" | ||
514 | }, | ||
515 | "+": { | ||
516 | dir: "previousSibling", | ||
517 | first: !0 | ||
518 | }, | ||
519 | "~": { | ||
520 | dir: "previousSibling" | ||
521 | } | ||
522 | }, | ||
523 | preFilter: { | ||
524 | ATTR: function(a) { | ||
525 | return a[1] = a[1].replace(ab, bb), a[3] = (a[4] || a[5] || "").replace(ab, bb), "~=" === a[2] && (a[3] = " " + a[3] + " "), a.slice(0, 4) | ||
526 | }, | ||
527 | CHILD: function(a) { | ||
528 | return a[1] = a[1].toLowerCase(), "nth" === a[1].slice(0, 3) ? (a[3] || db.error(a[0]), a[4] = +(a[4] ? a[5] + (a[6] || 1) : 2 * ("even" === a[3] || "odd" === a[3])), a[5] = +(a[7] + a[8] || "odd" === a[3])) : a[3] && db.error(a[0]), a | ||
529 | }, | ||
530 | PSEUDO: function(a) { | ||
531 | var b, c = !a[5] && a[2]; | ||
532 | return V.CHILD.test(a[0]) ? null : (a[3] && void 0 !== a[4] ? a[2] = a[4] : c && T.test(c) && (b = ob(c, !0)) && (b = c.indexOf(")", c.length - b) - c.length) && (a[0] = a[0].slice(0, b), a[2] = c.slice(0, b)), a.slice(0, 3)) | ||
533 | } | ||
534 | }, | ||
535 | filter: { | ||
536 | TAG: function(a) { | ||
537 | var b = a.replace(ab, bb).toLowerCase(); | ||
538 | return "*" === a ? function() { | ||
539 | return !0 | ||
540 | } : function(a) { | ||
541 | return a.nodeName && a.nodeName.toLowerCase() === b | ||
542 | } | ||
543 | }, | ||
544 | CLASS: function(a) { | ||
545 | var b = w[a + " "]; | ||
546 | return b || (b = new RegExp("(^|" + K + ")" + a + "(" + K + "|$)")) && w(a, function(a) { | ||
547 | return b.test("string" == typeof a.className && a.className || typeof a.getAttribute !== A && a.getAttribute("class") || "") | ||
548 | }) | ||
549 | }, | ||
550 | ATTR: function(a, b, c) { | ||
551 | return function(d) { | ||
552 | var e = db.attr(d, a); | ||
553 | return null == e ? "!=" === b : b ? (e += "", "=" === b ? e === c : "!=" === b ? e !== c : "^=" === b ? c && 0 === e.indexOf(c) : "*=" === b ? c && e.indexOf(c) > -1 : "$=" === b ? c && e.slice(-c.length) === c : "~=" === b ? (" " + e + " ").indexOf(c) > -1 : "|=" === b ? e === c || e.slice(0, c.length + 1) === c + "-" : !1) : !0 | ||
554 | } | ||
555 | }, | ||
556 | CHILD: function(a, b, c, d, e) { | ||
557 | var f = "nth" !== a.slice(0, 3), | ||
558 | g = "last" !== a.slice(-4), | ||
559 | h = "of-type" === b; | ||
560 | return 1 === d && 0 === e ? function(a) { | ||
561 | return !!a.parentNode | ||
562 | } : function(b, c, i) { | ||
563 | var j, k, l, m, n, o, p = f !== g ? "nextSibling" : "previousSibling", | ||
564 | q = b.parentNode, | ||
565 | r = h && b.nodeName.toLowerCase(), | ||
566 | t = !i && !h; | ||
567 | if (q) { | ||
568 | if (f) { | ||
569 | while (p) { | ||
570 | l = b; | ||
571 | while (l = l[p]) | ||
572 | if (h ? l.nodeName.toLowerCase() === r : 1 === l.nodeType) return !1; | ||
573 | o = p = "only" === a && !o && "nextSibling" | ||
574 | } | ||
575 | return !0 | ||
576 | } | ||
577 | if (o = [g ? q.firstChild : q.lastChild], g && t) { | ||
578 | k = q[s] || (q[s] = {}), j = k[a] || [], n = j[0] === u && j[1], m = j[0] === u && j[2], l = n && q.childNodes[n]; | ||
579 | while (l = ++n && l && l[p] || (m = n = 0) || o.pop()) | ||
580 | if (1 === l.nodeType && ++m && l === b) { | ||
581 | k[a] = [u, n, m]; | ||
582 | break | ||
583 | } | ||
584 | } else if (t && (j = (b[s] || (b[s] = {}))[a]) && j[0] === u) m = j[1]; | ||
585 | else | ||
586 | while (l = ++n && l && l[p] || (m = n = 0) || o.pop()) | ||
587 | if ((h ? l.nodeName.toLowerCase() === r : 1 === l.nodeType) && ++m && (t && ((l[s] || (l[s] = {}))[a] = [u, m]), l === b)) break; return m -= e, m === d || m % d === 0 && m / d >= 0 | ||
588 | } | ||
589 | } | ||
590 | }, | ||
591 | PSEUDO: function(a, b) { | ||
592 | var c, e = d.pseudos[a] || d.setFilters[a.toLowerCase()] || db.error("unsupported pseudo: " + a); | ||
593 | return e[s] ? e(b) : e.length > 1 ? (c = [a, a, "", b], d.setFilters.hasOwnProperty(a.toLowerCase()) ? fb(function(a, c) { | ||
594 | var d, f = e(a, b), | ||
595 | g = f.length; | ||
596 | while (g--) d = I.call(a, f[g]), a[d] = !(c[d] = f[g]) | ||
597 | }) : function(a) { | ||
598 | return e(a, 0, c) | ||
599 | }) : e | ||
600 | } | ||
601 | }, | ||
602 | pseudos: { | ||
603 | not: fb(function(a) { | ||
604 | var b = [], | ||
605 | c = [], | ||
606 | d = g(a.replace(P, "$1")); | ||
607 | return d[s] ? fb(function(a, b, c, e) { | ||
608 | var f, g = d(a, null, e, []), | ||
609 | h = a.length; | ||
610 | while (h--)(f = g[h]) && (a[h] = !(b[h] = f)) | ||
611 | }) : function(a, e, f) { | ||
612 | return b[0] = a, d(b, null, f, c), !c.pop() | ||
613 | } | ||
614 | }), | ||
615 | has: fb(function(a) { | ||
616 | return function(b) { | ||
617 | return db(a, b).length > 0 | ||
618 | } | ||
619 | }), | ||
620 | contains: fb(function(a) { | ||
621 | return function(b) { | ||
622 | return (b.textContent || b.innerText || e(b)).indexOf(a) > -1 | ||
623 | } | ||
624 | }), | ||
625 | lang: fb(function(a) { | ||
626 | return U.test(a || "") || db.error("unsupported lang: " + a), a = a.replace(ab, bb).toLowerCase(), | ||
627 | function(b) { | ||
628 | var c; | ||
629 | do | ||
630 | if (c = n ? b.lang : b.getAttribute("xml:lang") || b.getAttribute("lang")) return c = c.toLowerCase(), c === a || 0 === c.indexOf(a + "-"); | ||
631 | while ((b = b.parentNode) && 1 === b.nodeType); | ||
632 | return !1 | ||
633 | } | ||
634 | }), | ||
635 | target: function(b) { | ||
636 | var c = a.location && a.location.hash; | ||
637 | return c && c.slice(1) === b.id | ||
638 | }, | ||
639 | root: function(a) { | ||
640 | return a === m | ||
641 | }, | ||
642 | focus: function(a) { | ||
643 | return a === l.activeElement && (!l.hasFocus || l.hasFocus()) && !!(a.type || a.href || ~a.tabIndex) | ||
644 | }, | ||
645 | enabled: function(a) { | ||
646 | return a.disabled === !1 | ||
647 | }, | ||
648 | disabled: function(a) { | ||
649 | return a.disabled === !0 | ||
650 | }, | ||
651 | checked: function(a) { | ||
652 | var b = a.nodeName.toLowerCase(); | ||
653 | return "input" === b && !!a.checked || "option" === b && !!a.selected | ||
654 | }, | ||
655 | selected: function(a) { | ||
656 | return a.parentNode && a.parentNode.selectedIndex, a.selected === !0 | ||
657 | }, | ||
658 | empty: function(a) { | ||
659 | for (a = a.firstChild; a; a = a.nextSibling) | ||
660 | if (a.nodeType < 6) return !1; | ||
661 | return !0 | ||
662 | }, | ||
663 | parent: function(a) { | ||
664 | return !d.pseudos.empty(a) | ||
665 | }, | ||
666 | header: function(a) { | ||
667 | return X.test(a.nodeName) | ||
668 | }, | ||
669 | input: function(a) { | ||
670 | return W.test(a.nodeName) | ||
671 | }, | ||
672 | button: function(a) { | ||
673 | var b = a.nodeName.toLowerCase(); | ||
674 | return "input" === b && "button" === a.type || "button" === b | ||
675 | }, | ||
676 | text: function(a) { | ||
677 | var b; | ||
678 | return "input" === a.nodeName.toLowerCase() && "text" === a.type && (null == (b = a.getAttribute("type")) || "text" === b.toLowerCase()) | ||
679 | }, | ||
680 | first: lb(function() { | ||
681 | return [0] | ||
682 | }), | ||
683 | last: lb(function(a, b) { | ||
684 | return [b - 1] | ||
685 | }), | ||
686 | eq: lb(function(a, b, c) { | ||
687 | return [0 > c ? c + b : c] | ||
688 | }), | ||
689 | even: lb(function(a, b) { | ||
690 | for (var c = 0; b > c; c += 2) a.push(c); | ||
691 | return a | ||
692 | }), | ||
693 | odd: lb(function(a, b) { | ||
694 | for (var c = 1; b > c; c += 2) a.push(c); | ||
695 | return a | ||
696 | }), | ||
697 | lt: lb(function(a, b, c) { | ||
698 | for (var d = 0 > c ? c + b : c; --d >= 0;) a.push(d); | ||
699 | return a | ||
700 | }), | ||
701 | gt: lb(function(a, b, c) { | ||
702 | for (var d = 0 > c ? c + b : c; ++d < b;) a.push(d); | ||
703 | return a | ||
704 | }) | ||
705 | } | ||
706 | }, d.pseudos.nth = d.pseudos.eq; | ||
707 | for (b in { | ||
708 | radio: !0, | ||
709 | checkbox: !0, | ||
710 | file: !0, | ||
711 | password: !0, | ||
712 | image: !0 | ||
713 | }) d.pseudos[b] = jb(b); | ||
714 | for (b in { | ||
715 | submit: !0, | ||
716 | reset: !0 | ||
717 | }) d.pseudos[b] = kb(b); | ||
718 | |||
719 | function nb() {} | ||
720 | nb.prototype = d.filters = d.pseudos, d.setFilters = new nb; | ||
721 | |||
722 | function ob(a, b) { | ||
723 | var c, e, f, g, h, i, j, k = x[a + " "]; | ||
724 | if (k) return b ? 0 : k.slice(0); | ||
725 | h = a, i = [], j = d.preFilter; | ||
726 | while (h) { | ||
727 | (!c || (e = Q.exec(h))) && (e && (h = h.slice(e[0].length) || h), i.push(f = [])), c = !1, (e = R.exec(h)) && (c = e.shift(), f.push({ | ||
728 | value: c, | ||
729 | type: e[0].replace(P, " ") | ||
730 | }), h = h.slice(c.length)); | ||
731 | for (g in d.filter)!(e = V[g].exec(h)) || j[g] && !(e = j[g](e)) || (c = e.shift(), f.push({ | ||
732 | value: c, | ||
733 | type: g, | ||
734 | matches: e | ||
735 | }), h = h.slice(c.length)); | ||
736 | if (!c) break | ||
737 | } | ||
738 | return b ? h.length : h ? db.error(a) : x(a, i).slice(0) | ||
739 | } | ||
740 | |||
741 | function pb(a) { | ||
742 | for (var b = 0, c = a.length, d = ""; c > b; b++) d += a[b].value; | ||
743 | return d | ||
744 | } | ||
745 | |||
746 | function qb(a, b, c) { | ||
747 | var d = b.dir, | ||
748 | e = c && "parentNode" === d, | ||
749 | f = v++; | ||
750 | return b.first ? function(b, c, f) { | ||
751 | while (b = b[d]) | ||
752 | if (1 === b.nodeType || e) return a(b, c, f) | ||
753 | } : function(b, c, g) { | ||
754 | var h, i, j = [u, f]; | ||
755 | if (g) { | ||
756 | while (b = b[d]) | ||
757 | if ((1 === b.nodeType || e) && a(b, c, g)) return !0 | ||
758 | } else | ||
759 | while (b = b[d]) | ||
760 | if (1 === b.nodeType || e) { | ||
761 | if (i = b[s] || (b[s] = {}), (h = i[d]) && h[0] === u && h[1] === f) return j[2] = h[2]; | ||
762 | if (i[d] = j, j[2] = a(b, c, g)) return !0 | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | |||
767 | function rb(a) { | ||
768 | return a.length > 1 ? function(b, c, d) { | ||
769 | var e = a.length; | ||
770 | while (e--) | ||
771 | if (!a[e](b, c, d)) return !1; | ||
772 | return !0 | ||
773 | } : a[0] | ||
774 | } | ||
775 | |||
776 | function sb(a, b, c, d, e) { | ||
777 | for (var f, g = [], h = 0, i = a.length, j = null != b; i > h; h++)(f = a[h]) && (!c || c(f, d, e)) && (g.push(f), j && b.push(h)); | ||
778 | return g | ||
779 | } | ||
780 | |||
781 | function tb(a, b, c, d, e, f) { | ||
782 | return d && !d[s] && (d = tb(d)), e && !e[s] && (e = tb(e, f)), fb(function(f, g, h, i) { | ||
783 | var j, k, l, m = [], | ||
784 | n = [], | ||
785 | o = g.length, | ||
786 | p = f || wb(b || "*", h.nodeType ? [h] : h, []), | ||
787 | q = !a || !f && b ? p : sb(p, m, a, h, i), | ||
788 | r = c ? e || (f ? a : o || d) ? [] : g : q; | ||
789 | if (c && c(q, r, h, i), d) { | ||
790 | j = sb(r, n), d(j, [], h, i), k = j.length; | ||
791 | while (k--)(l = j[k]) && (r[n[k]] = !(q[n[k]] = l)) | ||
792 | } | ||
793 | if (f) { | ||
794 | if (e || a) { | ||
795 | if (e) { | ||
796 | j = [], k = r.length; | ||
797 | while (k--)(l = r[k]) && j.push(q[k] = l); | ||
798 | e(null, r = [], j, i) | ||
799 | } | ||
800 | k = r.length; | ||
801 | while (k--)(l = r[k]) && (j = e ? I.call(f, l) : m[k]) > -1 && (f[j] = !(g[j] = l)) | ||
802 | } | ||
803 | } else r = sb(r === g ? r.splice(o, r.length) : r), e ? e(null, g, r, i) : G.apply(g, r) | ||
804 | }) | ||
805 | } | ||
806 | |||
807 | function ub(a) { | ||
808 | for (var b, c, e, f = a.length, g = d.relative[a[0].type], i = g || d.relative[" "], j = g ? 1 : 0, k = qb(function(a) { | ||
809 | return a === b | ||
810 | }, i, !0), l = qb(function(a) { | ||
811 | return I.call(b, a) > -1 | ||
812 | }, i, !0), m = [ | ||
813 | function(a, c, d) { | ||
814 | return !g && (d || c !== h) || ((b = c).nodeType ? k(a, c, d) : l(a, c, d)) | ||
815 | } | ||
816 | ]; f > j; j++) | ||
817 | if (c = d.relative[a[j].type]) m = [qb(rb(m), c)]; | ||
818 | else { | ||
819 | if (c = d.filter[a[j].type].apply(null, a[j].matches), c[s]) { | ||
820 | for (e = ++j; f > e; e++) | ||
821 | if (d.relative[a[e].type]) break; | ||
822 | return tb(j > 1 && rb(m), j > 1 && pb(a.slice(0, j - 1).concat({ | ||
823 | value: " " === a[j - 2].type ? "*" : "" | ||
824 | })).replace(P, "$1"), c, e > j && ub(a.slice(j, e)), f > e && ub(a = a.slice(e)), f > e && pb(a)) | ||
825 | } | ||
826 | m.push(c) | ||
827 | } | ||
828 | return rb(m) | ||
829 | } | ||
830 | |||
831 | function vb(a, b) { | ||
832 | var c = b.length > 0, | ||
833 | e = a.length > 0, | ||
834 | f = function(f, g, i, j, k) { | ||
835 | var m, n, o, p = 0, | ||
836 | q = "0", | ||
837 | r = f && [], | ||
838 | s = [], | ||
839 | t = h, | ||
840 | v = f || e && d.find.TAG("*", k), | ||
841 | w = u += null == t ? 1 : Math.random() || .1, | ||
842 | x = v.length; | ||
843 | for (k && (h = g !== l && g); q !== x && null != (m = v[q]); q++) { | ||
844 | if (e && m) { | ||
845 | n = 0; | ||
846 | while (o = a[n++]) | ||
847 | if (o(m, g, i)) { | ||
848 | j.push(m); | ||
849 | break | ||
850 | } | ||
851 | k && (u = w) | ||
852 | } | ||
853 | c && ((m = !o && m) && p--, f && r.push(m)) | ||
854 | } | ||
855 | if (p += q, c && q !== p) { | ||
856 | n = 0; | ||
857 | while (o = b[n++]) o(r, s, g, i); | ||
858 | if (f) { | ||
859 | if (p > 0) | ||
860 | while (q--) r[q] || s[q] || (s[q] = E.call(j)); | ||
861 | s = sb(s) | ||
862 | } | ||
863 | G.apply(j, s), k && !f && s.length > 0 && p + b.length > 1 && db.uniqueSort(j) | ||
864 | } | ||
865 | return k && (u = w, h = t), r | ||
866 | }; | ||
867 | return c ? fb(f) : f | ||
868 | } | ||
869 | g = db.compile = function(a, b) { | ||
870 | var c, d = [], | ||
871 | e = [], | ||
872 | f = y[a + " "]; | ||
873 | if (!f) { | ||
874 | b || (b = ob(a)), c = b.length; | ||
875 | while (c--) f = ub(b[c]), f[s] ? d.push(f) : e.push(f); | ||
876 | f = y(a, vb(e, d)) | ||
877 | } | ||
878 | return f | ||
879 | }; | ||
880 | |||
881 | function wb(a, b, c) { | ||
882 | for (var d = 0, e = b.length; e > d; d++) db(a, b[d], c); | ||
883 | return c | ||
884 | } | ||
885 | |||
886 | function xb(a, b, e, f) { | ||
887 | var h, i, j, k, l, m = ob(a); | ||
888 | if (!f && 1 === m.length) { | ||
889 | if (i = m[0] = m[0].slice(0), i.length > 2 && "ID" === (j = i[0]).type && c.getById && 9 === b.nodeType && n && d.relative[i[1].type]) { | ||
890 | if (b = (d.find.ID(j.matches[0].replace(ab, bb), b) || [])[0], !b) return e; | ||
891 | a = a.slice(i.shift().value.length) | ||
892 | } | ||
893 | h = V.needsContext.test(a) ? 0 : i.length; | ||
894 | while (h--) { | ||
895 | if (j = i[h], d.relative[k = j.type]) break; | ||
896 | if ((l = d.find[k]) && (f = l(j.matches[0].replace(ab, bb), $.test(i[0].type) && mb(b.parentNode) || b))) { | ||
897 | if (i.splice(h, 1), a = f.length && pb(i), !a) return G.apply(e, f), e; | ||
898 | break | ||
899 | } | ||
900 | } | ||
901 | } | ||
902 | return g(a, m)(f, b, !n, e, $.test(a) && mb(b.parentNode) || b), e | ||
903 | } | ||
904 | return c.sortStable = s.split("").sort(z).join("") === s, c.detectDuplicates = !!j, k(), c.sortDetached = gb(function(a) { | ||
905 | return 1 & a.compareDocumentPosition(l.createElement("div")) | ||
906 | }), gb(function(a) { | ||
907 | return a.innerHTML = "<a href='#'></a>", "#" === a.firstChild.getAttribute("href") | ||
908 | }) || hb("type|href|height|width", function(a, b, c) { | ||
909 | return c ? void 0 : a.getAttribute(b, "type" === b.toLowerCase() ? 1 : 2) | ||
910 | }), c.attributes && gb(function(a) { | ||
911 | return a.innerHTML = "<input/>", a.firstChild.setAttribute("value", ""), "" === a.firstChild.getAttribute("value") | ||
912 | }) || hb("value", function(a, b, c) { | ||
913 | return c || "input" !== a.nodeName.toLowerCase() ? void 0 : a.defaultValue | ||
914 | }), gb(function(a) { | ||
915 | return null == a.getAttribute("disabled") | ||
916 | }) || hb(J, function(a, b, c) { | ||
917 | var d; | ||
918 | return c ? void 0 : a[b] === !0 ? b.toLowerCase() : (d = a.getAttributeNode(b)) && d.specified ? d.value : null | ||
919 | }), db | ||
920 | }(a); | ||
921 | n.find = t, n.expr = t.selectors, n.expr[":"] = n.expr.pseudos, n.unique = t.uniqueSort, n.text = t.getText, n.isXMLDoc = t.isXML, n.contains = t.contains; | ||
922 | var u = n.expr.match.needsContext, | ||
923 | v = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, | ||
924 | w = /^.[^:#\[\.,]*$/; | ||
925 | |||
926 | function x(a, b, c) { | ||
927 | if (n.isFunction(b)) return n.grep(a, function(a, d) { | ||
928 | return !!b.call(a, d, a) !== c | ||
929 | }); | ||
930 | if (b.nodeType) return n.grep(a, function(a) { | ||
931 | return a === b !== c | ||
932 | }); | ||
933 | if ("string" == typeof b) { | ||
934 | if (w.test(b)) return n.filter(b, a, c); | ||
935 | b = n.filter(b, a) | ||
936 | } | ||
937 | return n.grep(a, function(a) { | ||
938 | return n.inArray(a, b) >= 0 !== c | ||
939 | }) | ||
940 | } | ||
941 | n.filter = function(a, b, c) { | ||
942 | var d = b[0]; | ||
943 | return c && (a = ":not(" + a + ")"), 1 === b.length && 1 === d.nodeType ? n.find.matchesSelector(d, a) ? [d] : [] : n.find.matches(a, n.grep(b, function(a) { | ||
944 | return 1 === a.nodeType | ||
945 | })) | ||
946 | }, n.fn.extend({ | ||
947 | find: function(a) { | ||
948 | var b, c = [], | ||
949 | d = this, | ||
950 | e = d.length; | ||
951 | if ("string" != typeof a) return this.pushStack(n(a).filter(function() { | ||
952 | for (b = 0; e > b; b++) | ||
953 | if (n.contains(d[b], this)) return !0 | ||
954 | })); | ||
955 | for (b = 0; e > b; b++) n.find(a, d[b], c); | ||
956 | return c = this.pushStack(e > 1 ? n.unique(c) : c), c.selector = this.selector ? this.selector + " " + a : a, c | ||
957 | }, | ||
958 | filter: function(a) { | ||
959 | return this.pushStack(x(this, a || [], !1)) | ||
960 | }, | ||
961 | not: function(a) { | ||
962 | return this.pushStack(x(this, a || [], !0)) | ||
963 | }, | ||
964 | is: function(a) { | ||
965 | return !!x(this, "string" == typeof a && u.test(a) ? n(a) : a || [], !1).length | ||
966 | } | ||
967 | }); | ||
968 | var y, z = a.document, | ||
969 | A = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, | ||
970 | B = n.fn.init = function(a, b) { | ||
971 | var c, d; | ||
972 | if (!a) return this; | ||
973 | if ("string" == typeof a) { | ||
974 | if (c = "<" === a.charAt(0) && ">" === a.charAt(a.length - 1) && a.length >= 3 ? [null, a, null] : A.exec(a), !c || !c[1] && b) return !b || b.jquery ? (b || y).find(a) : this.constructor(b).find(a); | ||
975 | if (c[1]) { | ||
976 | if (b = b instanceof n ? b[0] : b, n.merge(this, n.parseHTML(c[1], b && b.nodeType ? b.ownerDocument || b : z, !0)), v.test(c[1]) && n.isPlainObject(b)) | ||
977 | for (c in b) n.isFunction(this[c]) ? this[c](b[c]) : this.attr(c, b[c]); | ||
978 | return this | ||
979 | } | ||
980 | if (d = z.getElementById(c[2]), d && d.parentNode) { | ||
981 | if (d.id !== c[2]) return y.find(a); | ||
982 | this.length = 1, this[0] = d | ||
983 | } | ||
984 | return this.context = z, this.selector = a, this | ||
985 | } | ||
986 | return a.nodeType ? (this.context = this[0] = a, this.length = 1, this) : n.isFunction(a) ? "undefined" != typeof y.ready ? y.ready(a) : a(n) : (void 0 !== a.selector && (this.selector = a.selector, this.context = a.context), n.makeArray(a, this)) | ||
987 | }; | ||
988 | B.prototype = n.fn, y = n(z); | ||
989 | var C = /^(?:parents|prev(?:Until|All))/, | ||
990 | D = { | ||
991 | children: !0, | ||
992 | contents: !0, | ||
993 | next: !0, | ||
994 | prev: !0 | ||
995 | }; | ||
996 | n.extend({ | ||
997 | dir: function(a, b, c) { | ||
998 | var d = [], | ||
999 | e = a[b]; | ||
1000 | while (e && 9 !== e.nodeType && (void 0 === c || 1 !== e.nodeType || !n(e).is(c))) 1 === e.nodeType && d.push(e), e = e[b]; | ||
1001 | return d | ||
1002 | }, | ||
1003 | sibling: function(a, b) { | ||
1004 | for (var c = []; a; a = a.nextSibling) 1 === a.nodeType && a !== b && c.push(a); | ||
1005 | return c | ||
1006 | } | ||
1007 | }), n.fn.extend({ | ||
1008 | has: function(a) { | ||
1009 | var b, c = n(a, this), | ||
1010 | d = c.length; | ||
1011 | return this.filter(function() { | ||
1012 | for (b = 0; d > b; b++) | ||
1013 | if (n.contains(this, c[b])) return !0 | ||
1014 | }) | ||
1015 | }, | ||
1016 | closest: function(a, b) { | ||
1017 | for (var c, d = 0, e = this.length, f = [], g = u.test(a) || "string" != typeof a ? n(a, b || this.context) : 0; e > d; d++) | ||
1018 | for (c = this[d]; c && c !== b; c = c.parentNode) | ||
1019 | if (c.nodeType < 11 && (g ? g.index(c) > -1 : 1 === c.nodeType && n.find.matchesSelector(c, a))) { | ||
1020 | f.push(c); | ||
1021 | break | ||
1022 | } | ||
1023 | return this.pushStack(f.length > 1 ? n.unique(f) : f) | ||
1024 | }, | ||
1025 | index: function(a) { | ||
1026 | return a ? "string" == typeof a ? n.inArray(this[0], n(a)) : n.inArray(a.jquery ? a[0] : a, this) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1 | ||
1027 | }, | ||
1028 | add: function(a, b) { | ||
1029 | return this.pushStack(n.unique(n.merge(this.get(), n(a, b)))) | ||
1030 | }, | ||
1031 | addBack: function(a) { | ||
1032 | return this.add(null == a ? this.prevObject : this.prevObject.filter(a)) | ||
1033 | } | ||
1034 | }); | ||
1035 | |||
1036 | function E(a, b) { | ||
1037 | do a = a[b]; while (a && 1 !== a.nodeType); | ||
1038 | return a | ||
1039 | } | ||
1040 | n.each({ | ||
1041 | parent: function(a) { | ||
1042 | var b = a.parentNode; | ||
1043 | return b && 11 !== b.nodeType ? b : null | ||
1044 | }, | ||
1045 | parents: function(a) { | ||
1046 | return n.dir(a, "parentNode") | ||
1047 | }, | ||
1048 | parentsUntil: function(a, b, c) { | ||
1049 | return n.dir(a, "parentNode", c) | ||
1050 | }, | ||
1051 | next: function(a) { | ||
1052 | return E(a, "nextSibling") | ||
1053 | }, | ||
1054 | prev: function(a) { | ||
1055 | return E(a, "previousSibling") | ||
1056 | }, | ||
1057 | nextAll: function(a) { | ||
1058 | return n.dir(a, "nextSibling") | ||
1059 | }, | ||
1060 | prevAll: function(a) { | ||
1061 | return n.dir(a, "previousSibling") | ||
1062 | }, | ||
1063 | nextUntil: function(a, b, c) { | ||
1064 | return n.dir(a, "nextSibling", c) | ||
1065 | }, | ||
1066 | prevUntil: function(a, b, c) { | ||
1067 | return n.dir(a, "previousSibling", c) | ||
1068 | }, | ||
1069 | siblings: function(a) { | ||
1070 | return n.sibling((a.parentNode || {}).firstChild, a) | ||
1071 | }, | ||
1072 | children: function(a) { | ||
1073 | return n.sibling(a.firstChild) | ||
1074 | }, | ||
1075 | contents: function(a) { | ||
1076 | return n.nodeName(a, "iframe") ? a.contentDocument || a.contentWindow.document : n.merge([], a.childNodes) | ||
1077 | } | ||
1078 | }, function(a, b) { | ||
1079 | n.fn[a] = function(c, d) { | ||
1080 | var e = n.map(this, b, c); | ||
1081 | return "Until" !== a.slice(-5) && (d = c), d && "string" == typeof d && (e = n.filter(d, e)), this.length > 1 && (D[a] || (e = n.unique(e)), C.test(a) && (e = e.reverse())), this.pushStack(e) | ||
1082 | } | ||
1083 | }); | ||
1084 | var F = /\S+/g, | ||
1085 | G = {}; | ||
1086 | |||
1087 | function H(a) { | ||
1088 | var b = G[a] = {}; | ||
1089 | return n.each(a.match(F) || [], function(a, c) { | ||
1090 | b[c] = !0 | ||
1091 | }), b | ||
1092 | } | ||
1093 | n.Callbacks = function(a) { | ||
1094 | a = "string" == typeof a ? G[a] || H(a) : n.extend({}, a); | ||
1095 | var b, c, d, e, f, g, h = [], | ||
1096 | i = !a.once && [], | ||
1097 | j = function(l) { | ||
1098 | for (c = a.memory && l, d = !0, f = g || 0, g = 0, e = h.length, b = !0; h && e > f; f++) | ||
1099 | if (h[f].apply(l[0], l[1]) === !1 && a.stopOnFalse) { | ||
1100 | c = !1; | ||
1101 | break | ||
1102 | } | ||
1103 | b = !1, h && (i ? i.length && j(i.shift()) : c ? h = [] : k.disable()) | ||
1104 | }, | ||
1105 | k = { | ||
1106 | add: function() { | ||
1107 | if (h) { | ||
1108 | var d = h.length; | ||
1109 | ! function f(b) { | ||
1110 | n.each(b, function(b, c) { | ||
1111 | var d = n.type(c); | ||
1112 | "function" === d ? a.unique && k.has(c) || h.push(c) : c && c.length && "string" !== d && f(c) | ||
1113 | }) | ||
1114 | }(arguments), b ? e = h.length : c && (g = d, j(c)) | ||
1115 | } | ||
1116 | return this | ||
1117 | }, | ||
1118 | remove: function() { | ||
1119 | return h && n.each(arguments, function(a, c) { | ||
1120 | var d; | ||
1121 | while ((d = n.inArray(c, h, d)) > -1) h.splice(d, 1), b && (e >= d && e--, f >= d && f--) | ||
1122 | }), this | ||
1123 | }, | ||
1124 | has: function(a) { | ||
1125 | return a ? n.inArray(a, h) > -1 : !(!h || !h.length) | ||
1126 | }, | ||
1127 | empty: function() { | ||
1128 | return h = [], e = 0, this | ||
1129 | }, | ||
1130 | disable: function() { | ||
1131 | return h = i = c = void 0, this | ||
1132 | }, | ||
1133 | disabled: function() { | ||
1134 | return !h | ||
1135 | }, | ||
1136 | lock: function() { | ||
1137 | return i = void 0, c || k.disable(), this | ||
1138 | }, | ||
1139 | locked: function() { | ||
1140 | return !i | ||
1141 | }, | ||
1142 | fireWith: function(a, c) { | ||
1143 | return !h || d && !i || (c = c || [], c = [a, c.slice ? c.slice() : c], b ? i.push(c) : j(c)), this | ||
1144 | }, | ||
1145 | fire: function() { | ||
1146 | return k.fireWith(this, arguments), this | ||
1147 | }, | ||
1148 | fired: function() { | ||
1149 | return !!d | ||
1150 | } | ||
1151 | }; | ||
1152 | return k | ||
1153 | }, n.extend({ | ||
1154 | Deferred: function(a) { | ||
1155 | var b = [ | ||
1156 | ["resolve", "done", n.Callbacks("once memory"), "resolved"], | ||
1157 | ["reject", "fail", n.Callbacks("once memory"), "rejected"], | ||
1158 | ["notify", "progress", n.Callbacks("memory")] | ||
1159 | ], | ||
1160 | c = "pending", | ||
1161 | d = { | ||
1162 | state: function() { | ||
1163 | return c | ||
1164 | }, | ||
1165 | always: function() { | ||
1166 | return e.done(arguments).fail(arguments), this | ||
1167 | }, | ||
1168 | then: function() { | ||
1169 | var a = arguments; | ||
1170 | return n.Deferred(function(c) { | ||
1171 | n.each(b, function(b, f) { | ||
1172 | var g = n.isFunction(a[b]) && a[b]; | ||
1173 | e[f[1]](function() { | ||
1174 | var a = g && g.apply(this, arguments); | ||
1175 | a && n.isFunction(a.promise) ? a.promise().done(c.resolve).fail(c.reject).progress(c.notify) : c[f[0] + "With"](this === d ? c.promise() : this, g ? [a] : arguments) | ||
1176 | }) | ||
1177 | }), a = null | ||
1178 | }).promise() | ||
1179 | }, | ||
1180 | promise: function(a) { | ||
1181 | return null != a ? n.extend(a, d) : d | ||
1182 | } | ||
1183 | }, | ||
1184 | e = {}; | ||
1185 | return d.pipe = d.then, n.each(b, function(a, f) { | ||
1186 | var g = f[2], | ||
1187 | h = f[3]; | ||
1188 | d[f[1]] = g.add, h && g.add(function() { | ||
1189 | c = h | ||
1190 | }, b[1 ^ a][2].disable, b[2][2].lock), e[f[0]] = function() { | ||
1191 | return e[f[0] + "With"](this === e ? d : this, arguments), this | ||
1192 | }, e[f[0] + "With"] = g.fireWith | ||
1193 | }), d.promise(e), a && a.call(e, e), e | ||
1194 | }, | ||
1195 | when: function(a) { | ||
1196 | var b = 0, | ||
1197 | c = d.call(arguments), | ||
1198 | e = c.length, | ||
1199 | f = 1 !== e || a && n.isFunction(a.promise) ? e : 0, | ||
1200 | g = 1 === f ? a : n.Deferred(), | ||
1201 | h = function(a, b, c) { | ||
1202 | return function(e) { | ||
1203 | b[a] = this, c[a] = arguments.length > 1 ? d.call(arguments) : e, c === i ? g.notifyWith(b, c) : --f || g.resolveWith(b, c) | ||
1204 | } | ||
1205 | }, | ||
1206 | i, j, k; | ||
1207 | if (e > 1) | ||
1208 | for (i = new Array(e), j = new Array(e), k = new Array(e); e > b; b++) c[b] && n.isFunction(c[b].promise) ? c[b].promise().done(h(b, k, c)).fail(g.reject).progress(h(b, j, i)) : --f; | ||
1209 | return f || g.resolveWith(k, c), g.promise() | ||
1210 | } | ||
1211 | }); | ||
1212 | var I; | ||
1213 | n.fn.ready = function(a) { | ||
1214 | return n.ready.promise().done(a), this | ||
1215 | }, n.extend({ | ||
1216 | isReady: !1, | ||
1217 | readyWait: 1, | ||
1218 | holdReady: function(a) { | ||
1219 | a ? n.readyWait++ : n.ready(!0) | ||
1220 | }, | ||
1221 | ready: function(a) { | ||
1222 | if (a === !0 ? !--n.readyWait : !n.isReady) { | ||
1223 | if (!z.body) return setTimeout(n.ready); | ||
1224 | n.isReady = !0, a !== !0 && --n.readyWait > 0 || (I.resolveWith(z, [n]), n.fn.trigger && n(z).trigger("ready").off("ready")) | ||
1225 | } | ||
1226 | } | ||
1227 | }); | ||
1228 | |||
1229 | function J() { | ||
1230 | z.addEventListener ? (z.removeEventListener("DOMContentLoaded", K, !1), a.removeEventListener("load", K, !1)) : (z.detachEvent("onreadystatechange", K), a.detachEvent("onload", K)) | ||
1231 | } | ||
1232 | |||
1233 | function K() { | ||
1234 | (z.addEventListener || "load" === event.type || "complete" === z.readyState) && (J(), n.ready()) | ||
1235 | } | ||
1236 | n.ready.promise = function(b) { | ||
1237 | if (!I) | ||
1238 | if (I = n.Deferred(), "complete" === z.readyState) setTimeout(n.ready); | ||
1239 | else if (z.addEventListener) z.addEventListener("DOMContentLoaded", K, !1), a.addEventListener("load", K, !1); | ||
1240 | else { | ||
1241 | z.attachEvent("onreadystatechange", K), a.attachEvent("onload", K); | ||
1242 | var c = !1; | ||
1243 | try { | ||
1244 | c = null == a.frameElement && z.documentElement | ||
1245 | } catch (d) {} | ||
1246 | c && c.doScroll && ! function e() { | ||
1247 | if (!n.isReady) { | ||
1248 | try { | ||
1249 | c.doScroll("left") | ||
1250 | } catch (a) { | ||
1251 | return setTimeout(e, 50) | ||
1252 | } | ||
1253 | J(), n.ready() | ||
1254 | } | ||
1255 | }() | ||
1256 | } | ||
1257 | return I.promise(b) | ||
1258 | }; | ||
1259 | var L = "undefined", | ||
1260 | M; | ||
1261 | for (M in n(l)) break; | ||
1262 | l.ownLast = "0" !== M, l.inlineBlockNeedsLayout = !1, n(function() { | ||
1263 | var a, b, c = z.getElementsByTagName("body")[0]; | ||
1264 | c && (a = z.createElement("div"), a.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", b = z.createElement("div"), c.appendChild(a).appendChild(b), typeof b.style.zoom !== L && (b.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1", (l.inlineBlockNeedsLayout = 3 === b.offsetWidth) && (c.style.zoom = 1)), c.removeChild(a), a = b = null) | ||
1265 | }), | ||
1266 | function() { | ||
1267 | var a = z.createElement("div"); | ||
1268 | if (null == l.deleteExpando) { | ||
1269 | l.deleteExpando = !0; | ||
1270 | try { | ||
1271 | delete a.test | ||
1272 | } catch (b) { | ||
1273 | l.deleteExpando = !1 | ||
1274 | } | ||
1275 | } | ||
1276 | a = null | ||
1277 | }(), n.acceptData = function(a) { | ||
1278 | var b = n.noData[(a.nodeName + " ").toLowerCase()], | ||
1279 | c = +a.nodeType || 1; | ||
1280 | return 1 !== c && 9 !== c ? !1 : !b || b !== !0 && a.getAttribute("classid") === b | ||
1281 | }; | ||
1282 | var N = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | ||
1283 | O = /([A-Z])/g; | ||
1284 | |||
1285 | function P(a, b, c) { | ||
1286 | if (void 0 === c && 1 === a.nodeType) { | ||
1287 | var d = "data-" + b.replace(O, "-$1").toLowerCase(); | ||
1288 | if (c = a.getAttribute(d), "string" == typeof c) { | ||
1289 | try { | ||
1290 | c = "true" === c ? !0 : "false" === c ? !1 : "null" === c ? null : +c + "" === c ? +c : N.test(c) ? n.parseJSON(c) : c | ||
1291 | } catch (e) {} | ||
1292 | n.data(a, b, c) | ||
1293 | } else c = void 0 | ||
1294 | } | ||
1295 | return c | ||
1296 | } | ||
1297 | |||
1298 | function Q(a) { | ||
1299 | var b; | ||
1300 | for (b in a) | ||
1301 | if (("data" !== b || !n.isEmptyObject(a[b])) && "toJSON" !== b) return !1; | ||
1302 | return !0 | ||
1303 | } | ||
1304 | |||
1305 | function R(a, b, d, e) { | ||
1306 | if (n.acceptData(a)) { | ||
1307 | var f, g, h = n.expando, | ||
1308 | i = a.nodeType, | ||
1309 | j = i ? n.cache : a, | ||
1310 | k = i ? a[h] : a[h] && h; | ||
1311 | if (k && j[k] && (e || j[k].data) || void 0 !== d || "string" != typeof b) return k || (k = i ? a[h] = c.pop() || n.guid++ : h), j[k] || (j[k] = i ? {} : { | ||
1312 | toJSON: n.noop | ||
1313 | }), ("object" == typeof b || "function" == typeof b) && (e ? j[k] = n.extend(j[k], b) : j[k].data = n.extend(j[k].data, b)), g = j[k], e || (g.data || (g.data = {}), g = g.data), void 0 !== d && (g[n.camelCase(b)] = d), "string" == typeof b ? (f = g[b], null == f && (f = g[n.camelCase(b)])) : f = g, f | ||
1314 | } | ||
1315 | } | ||
1316 | |||
1317 | function S(a, b, c) { | ||
1318 | if (n.acceptData(a)) { | ||
1319 | var d, e, f = a.nodeType, | ||
1320 | g = f ? n.cache : a, | ||
1321 | h = f ? a[n.expando] : n.expando; | ||
1322 | if (g[h]) { | ||
1323 | if (b && (d = c ? g[h] : g[h].data)) { | ||
1324 | n.isArray(b) ? b = b.concat(n.map(b, n.camelCase)) : b in d ? b = [b] : (b = n.camelCase(b), b = b in d ? [b] : b.split(" ")), e = b.length; | ||
1325 | while (e--) delete d[b[e]]; | ||
1326 | if (c ? !Q(d) : !n.isEmptyObject(d)) return | ||
1327 | }(c || (delete g[h].data, Q(g[h]))) && (f ? n.cleanData([a], !0) : l.deleteExpando || g != g.window ? delete g[h] : g[h] = null) | ||
1328 | } | ||
1329 | } | ||
1330 | } | ||
1331 | n.extend({ | ||
1332 | cache: {}, | ||
1333 | noData: { | ||
1334 | "applet ": !0, | ||
1335 | "embed ": !0, | ||
1336 | "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" | ||
1337 | }, | ||
1338 | hasData: function(a) { | ||
1339 | return a = a.nodeType ? n.cache[a[n.expando]] : a[n.expando], !!a && !Q(a) | ||
1340 | }, | ||
1341 | data: function(a, b, c) { | ||
1342 | return R(a, b, c) | ||
1343 | }, | ||
1344 | removeData: function(a, b) { | ||
1345 | return S(a, b) | ||
1346 | }, | ||
1347 | _data: function(a, b, c) { | ||
1348 | return R(a, b, c, !0) | ||
1349 | }, | ||
1350 | _removeData: function(a, b) { | ||
1351 | return S(a, b, !0) | ||
1352 | } | ||
1353 | }), n.fn.extend({ | ||
1354 | data: function(a, b) { | ||
1355 | var c, d, e, f = this[0], | ||
1356 | g = f && f.attributes; | ||
1357 | if (void 0 === a) { | ||
1358 | if (this.length && (e = n.data(f), 1 === f.nodeType && !n._data(f, "parsedAttrs"))) { | ||
1359 | c = g.length; | ||
1360 | while (c--) d = g[c].name, 0 === d.indexOf("data-") && (d = n.camelCase(d.slice(5)), P(f, d, e[d])); | ||
1361 | n._data(f, "parsedAttrs", !0) | ||
1362 | } | ||
1363 | return e | ||
1364 | } | ||
1365 | return "object" == typeof a ? this.each(function() { | ||
1366 | n.data(this, a) | ||
1367 | }) : arguments.length > 1 ? this.each(function() { | ||
1368 | n.data(this, a, b) | ||
1369 | }) : f ? P(f, a, n.data(f, a)) : void 0 | ||
1370 | }, | ||
1371 | removeData: function(a) { | ||
1372 | return this.each(function() { | ||
1373 | n.removeData(this, a) | ||
1374 | }) | ||
1375 | } | ||
1376 | }), n.extend({ | ||
1377 | queue: function(a, b, c) { | ||
1378 | var d; | ||
1379 | return a ? (b = (b || "fx") + "queue", d = n._data(a, b), c && (!d || n.isArray(c) ? d = n._data(a, b, n.makeArray(c)) : d.push(c)), d || []) : void 0 | ||
1380 | }, | ||
1381 | dequeue: function(a, b) { | ||
1382 | b = b || "fx"; | ||
1383 | var c = n.queue(a, b), | ||
1384 | d = c.length, | ||
1385 | e = c.shift(), | ||
1386 | f = n._queueHooks(a, b), | ||
1387 | g = function() { | ||
1388 | n.dequeue(a, b) | ||
1389 | }; | ||
1390 | "inprogress" === e && (e = c.shift(), d--), e && ("fx" === b && c.unshift("inprogress"), delete f.stop, e.call(a, g, f)), !d && f && f.empty.fire() | ||
1391 | }, | ||
1392 | _queueHooks: function(a, b) { | ||
1393 | var c = b + "queueHooks"; | ||
1394 | return n._data(a, c) || n._data(a, c, { | ||
1395 | empty: n.Callbacks("once memory").add(function() { | ||
1396 | n._removeData(a, b + "queue"), n._removeData(a, c) | ||
1397 | }) | ||
1398 | }) | ||
1399 | } | ||
1400 | }), n.fn.extend({ | ||
1401 | queue: function(a, b) { | ||
1402 | var c = 2; | ||
1403 | return "string" != typeof a && (b = a, a = "fx", c--), arguments.length < c ? n.queue(this[0], a) : void 0 === b ? this : this.each(function() { | ||
1404 | var c = n.queue(this, a, b); | ||
1405 | n._queueHooks(this, a), "fx" === a && "inprogress" !== c[0] && n.dequeue(this, a) | ||
1406 | }) | ||
1407 | }, | ||
1408 | dequeue: function(a) { | ||
1409 | return this.each(function() { | ||
1410 | n.dequeue(this, a) | ||
1411 | }) | ||
1412 | }, | ||
1413 | clearQueue: function(a) { | ||
1414 | return this.queue(a || "fx", []) | ||
1415 | }, | ||
1416 | promise: function(a, b) { | ||
1417 | var c, d = 1, | ||
1418 | e = n.Deferred(), | ||
1419 | f = this, | ||
1420 | g = this.length, | ||
1421 | h = function() { | ||
1422 | --d || e.resolveWith(f, [f]) | ||
1423 | }; | ||
1424 | "string" != typeof a && (b = a, a = void 0), a = a || "fx"; | ||
1425 | while (g--) c = n._data(f[g], a + "queueHooks"), c && c.empty && (d++, c.empty.add(h)); | ||
1426 | return h(), e.promise(b) | ||
1427 | } | ||
1428 | }); | ||
1429 | var T = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, | ||
1430 | U = ["Top", "Right", "Bottom", "Left"], | ||
1431 | V = function(a, b) { | ||
1432 | return a = b || a, "none" === n.css(a, "display") || !n.contains(a.ownerDocument, a) | ||
1433 | }, | ||
1434 | W = n.access = function(a, b, c, d, e, f, g) { | ||
1435 | var h = 0, | ||
1436 | i = a.length, | ||
1437 | j = null == c; | ||
1438 | if ("object" === n.type(c)) { | ||
1439 | e = !0; | ||
1440 | for (h in c) n.access(a, b, h, c[h], !0, f, g) | ||
1441 | } else if (void 0 !== d && (e = !0, n.isFunction(d) || (g = !0), j && (g ? (b.call(a, d), b = null) : (j = b, b = function(a, b, c) { | ||
1442 | return j.call(n(a), c) | ||
1443 | })), b)) | ||
1444 | for (; i > h; h++) b(a[h], c, g ? d : d.call(a[h], h, b(a[h], c))); | ||
1445 | return e ? a : j ? b.call(a) : i ? b(a[0], c) : f | ||
1446 | }, | ||
1447 | X = /^(?:checkbox|radio)$/i; | ||
1448 | ! function() { | ||
1449 | var a = z.createDocumentFragment(), | ||
1450 | b = z.createElement("div"), | ||
1451 | c = z.createElement("input"); | ||
1452 | if (b.setAttribute("className", "t"), b.innerHTML = " <link/><table></table><a href='/a'>a</a>", l.leadingWhitespace = 3 === b.firstChild.nodeType, l.tbody = !b.getElementsByTagName("tbody").length, l.htmlSerialize = !!b.getElementsByTagName("link").length, l.html5Clone = "<:nav></:nav>" !== z.createElement("nav").cloneNode(!0).outerHTML, c.type = "checkbox", c.checked = !0, a.appendChild(c), l.appendChecked = c.checked, b.innerHTML = "<textarea>x</textarea>", l.noCloneChecked = !!b.cloneNode(!0).lastChild.defaultValue, a.appendChild(b), b.innerHTML = "<input type='radio' checked='checked' name='t'/>", l.checkClone = b.cloneNode(!0).cloneNode(!0).lastChild.checked, l.noCloneEvent = !0, b.attachEvent && (b.attachEvent("onclick", function() { | ||
1453 | l.noCloneEvent = !1 | ||
1454 | }), b.cloneNode(!0).click()), null == l.deleteExpando) { | ||
1455 | l.deleteExpando = !0; | ||
1456 | try { | ||
1457 | delete b.test | ||
1458 | } catch (d) { | ||
1459 | l.deleteExpando = !1 | ||
1460 | } | ||
1461 | } | ||
1462 | a = b = c = null | ||
1463 | }(), | ||
1464 | function() { | ||
1465 | var b, c, d = z.createElement("div"); | ||
1466 | for (b in { | ||
1467 | submit: !0, | ||
1468 | change: !0, | ||
1469 | focusin: !0 | ||
1470 | }) c = "on" + b, (l[b + "Bubbles"] = c in a) || (d.setAttribute(c, "t"), l[b + "Bubbles"] = d.attributes[c].expando === !1); | ||
1471 | d = null | ||
1472 | }(); | ||
1473 | var Y = /^(?:input|select|textarea)$/i, | ||
1474 | Z = /^key/, | ||
1475 | $ = /^(?:mouse|contextmenu)|click/, | ||
1476 | _ = /^(?:focusinfocus|focusoutblur)$/, | ||
1477 | ab = /^([^.]*)(?:\.(.+)|)$/; | ||
1478 | |||
1479 | function bb() { | ||
1480 | return !0 | ||
1481 | } | ||
1482 | |||
1483 | function cb() { | ||
1484 | return !1 | ||
1485 | } | ||
1486 | |||
1487 | function db() { | ||
1488 | try { | ||
1489 | return z.activeElement | ||
1490 | } catch (a) {} | ||
1491 | } | ||
1492 | n.event = { | ||
1493 | global: {}, | ||
1494 | add: function(a, b, c, d, e) { | ||
1495 | var f, g, h, i, j, k, l, m, o, p, q, r = n._data(a); | ||
1496 | if (r) { | ||
1497 | c.handler && (i = c, c = i.handler, e = i.selector), c.guid || (c.guid = n.guid++), (g = r.events) || (g = r.events = {}), (k = r.handle) || (k = r.handle = function(a) { | ||
1498 | return typeof n === L || a && n.event.triggered === a.type ? void 0 : n.event.dispatch.apply(k.elem, arguments) | ||
1499 | }, k.elem = a), b = (b || "").match(F) || [""], h = b.length; | ||
1500 | while (h--) f = ab.exec(b[h]) || [], o = q = f[1], p = (f[2] || "").split(".").sort(), o && (j = n.event.special[o] || {}, o = (e ? j.delegateType : j.bindType) || o, j = n.event.special[o] || {}, l = n.extend({ | ||
1501 | type: o, | ||
1502 | origType: q, | ||
1503 | data: d, | ||
1504 | handler: c, | ||
1505 | guid: c.guid, | ||
1506 | selector: e, | ||
1507 | needsContext: e && n.expr.match.needsContext.test(e), | ||
1508 | namespace: p.join(".") | ||
1509 | }, i), (m = g[o]) || (m = g[o] = [], m.delegateCount = 0, j.setup && j.setup.call(a, d, p, k) !== !1 || (a.addEventListener ? a.addEventListener(o, k, !1) : a.attachEvent && a.attachEvent("on" + o, k))), j.add && (j.add.call(a, l), l.handler.guid || (l.handler.guid = c.guid)), e ? m.splice(m.delegateCount++, 0, l) : m.push(l), n.event.global[o] = !0); | ||
1510 | a = null | ||
1511 | } | ||
1512 | }, | ||
1513 | remove: function(a, b, c, d, e) { | ||
1514 | var f, g, h, i, j, k, l, m, o, p, q, r = n.hasData(a) && n._data(a); | ||
1515 | if (r && (k = r.events)) { | ||
1516 | b = (b || "").match(F) || [""], j = b.length; | ||
1517 | while (j--) | ||
1518 | if (h = ab.exec(b[j]) || [], o = q = h[1], p = (h[2] || "").split(".").sort(), o) { | ||
1519 | l = n.event.special[o] || {}, o = (d ? l.delegateType : l.bindType) || o, m = k[o] || [], h = h[2] && new RegExp("(^|\\.)" + p.join("\\.(?:.*\\.|)") + "(\\.|$)"), i = f = m.length; | ||
1520 | while (f--) g = m[f], !e && q !== g.origType || c && c.guid !== g.guid || h && !h.test(g.namespace) || d && d !== g.selector && ("**" !== d || !g.selector) || (m.splice(f, 1), g.selector && m.delegateCount--, l.remove && l.remove.call(a, g)); | ||
1521 | i && !m.length && (l.teardown && l.teardown.call(a, p, r.handle) !== !1 || n.removeEvent(a, o, r.handle), delete k[o]) | ||
1522 | } else | ||
1523 | for (o in k) n.event.remove(a, o + b[j], c, d, !0); | ||
1524 | n.isEmptyObject(k) && (delete r.handle, n._removeData(a, "events")) | ||
1525 | } | ||
1526 | }, | ||
1527 | trigger: function(b, c, d, e) { | ||
1528 | var f, g, h, i, k, l, m, o = [d || z], | ||
1529 | p = j.call(b, "type") ? b.type : b, | ||
1530 | q = j.call(b, "namespace") ? b.namespace.split(".") : []; | ||
1531 | if (h = l = d = d || z, 3 !== d.nodeType && 8 !== d.nodeType && !_.test(p + n.event.triggered) && (p.indexOf(".") >= 0 && (q = p.split("."), p = q.shift(), q.sort()), g = p.indexOf(":") < 0 && "on" + p, b = b[n.expando] ? b : new n.Event(p, "object" == typeof b && b), b.isTrigger = e ? 2 : 3, b.namespace = q.join("."), b.namespace_re = b.namespace ? new RegExp("(^|\\.)" + q.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, b.result = void 0, b.target || (b.target = d), c = null == c ? [b] : n.makeArray(c, [b]), k = n.event.special[p] || {}, e || !k.trigger || k.trigger.apply(d, c) !== !1)) { | ||
1532 | if (!e && !k.noBubble && !n.isWindow(d)) { | ||
1533 | for (i = k.delegateType || p, _.test(i + p) || (h = h.parentNode); h; h = h.parentNode) o.push(h), l = h; | ||
1534 | l === (d.ownerDocument || z) && o.push(l.defaultView || l.parentWindow || a) | ||
1535 | } | ||
1536 | m = 0; | ||
1537 | while ((h = o[m++]) && !b.isPropagationStopped()) b.type = m > 1 ? i : k.bindType || p, f = (n._data(h, "events") || {})[b.type] && n._data(h, "handle"), f && f.apply(h, c), f = g && h[g], f && f.apply && n.acceptData(h) && (b.result = f.apply(h, c), b.result === !1 && b.preventDefault()); | ||
1538 | if (b.type = p, !e && !b.isDefaultPrevented() && (!k._default || k._default.apply(o.pop(), c) === !1) && n.acceptData(d) && g && d[p] && !n.isWindow(d)) { | ||
1539 | l = d[g], l && (d[g] = null), n.event.triggered = p; | ||
1540 | try { | ||
1541 | d[p]() | ||
1542 | } catch (r) {} | ||
1543 | n.event.triggered = void 0, l && (d[g] = l) | ||
1544 | } | ||
1545 | return b.result | ||
1546 | } | ||
1547 | }, | ||
1548 | dispatch: function(a) { | ||
1549 | a = n.event.fix(a); | ||
1550 | var b, c, e, f, g, h = [], | ||
1551 | i = d.call(arguments), | ||
1552 | j = (n._data(this, "events") || {})[a.type] || [], | ||
1553 | k = n.event.special[a.type] || {}; | ||
1554 | if (i[0] = a, a.delegateTarget = this, !k.preDispatch || k.preDispatch.call(this, a) !== !1) { | ||
1555 | h = n.event.handlers.call(this, a, j), b = 0; | ||
1556 | while ((f = h[b++]) && !a.isPropagationStopped()) { | ||
1557 | a.currentTarget = f.elem, g = 0; | ||
1558 | while ((e = f.handlers[g++]) && !a.isImmediatePropagationStopped())(!a.namespace_re || a.namespace_re.test(e.namespace)) && (a.handleObj = e, a.data = e.data, c = ((n.event.special[e.origType] || {}).handle || e.handler).apply(f.elem, i), void 0 !== c && (a.result = c) === !1 && (a.preventDefault(), a.stopPropagation())) | ||
1559 | } | ||
1560 | return k.postDispatch && k.postDispatch.call(this, a), a.result | ||
1561 | } | ||
1562 | }, | ||
1563 | handlers: function(a, b) { | ||
1564 | var c, d, e, f, g = [], | ||
1565 | h = b.delegateCount, | ||
1566 | i = a.target; | ||
1567 | if (h && i.nodeType && (!a.button || "click" !== a.type)) | ||
1568 | for (; i != this; i = i.parentNode || this) | ||
1569 | if (1 === i.nodeType && (i.disabled !== !0 || "click" !== a.type)) { | ||
1570 | for (e = [], f = 0; h > f; f++) d = b[f], c = d.selector + " ", void 0 === e[c] && (e[c] = d.needsContext ? n(c, this).index(i) >= 0 : n.find(c, this, null, [i]).length), e[c] && e.push(d); | ||
1571 | e.length && g.push({ | ||
1572 | elem: i, | ||
1573 | handlers: e | ||
1574 | }) | ||
1575 | } | ||
1576 | return h < b.length && g.push({ | ||
1577 | elem: this, | ||
1578 | handlers: b.slice(h) | ||
1579 | }), g | ||
1580 | }, | ||
1581 | fix: function(a) { | ||
1582 | if (a[n.expando]) return a; | ||
1583 | var b, c, d, e = a.type, | ||
1584 | f = a, | ||
1585 | g = this.fixHooks[e]; | ||
1586 | g || (this.fixHooks[e] = g = $.test(e) ? this.mouseHooks : Z.test(e) ? this.keyHooks : {}), d = g.props ? this.props.concat(g.props) : this.props, a = new n.Event(f), b = d.length; | ||
1587 | while (b--) c = d[b], a[c] = f[c]; | ||
1588 | return a.target || (a.target = f.srcElement || z), 3 === a.target.nodeType && (a.target = a.target.parentNode), a.metaKey = !!a.metaKey, g.filter ? g.filter(a, f) : a | ||
1589 | }, | ||
1590 | props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | ||
1591 | fixHooks: {}, | ||
1592 | keyHooks: { | ||
1593 | props: "char charCode key keyCode".split(" "), | ||
1594 | filter: function(a, b) { | ||
1595 | return null == a.which && (a.which = null != b.charCode ? b.charCode : b.keyCode), a | ||
1596 | } | ||
1597 | }, | ||
1598 | mouseHooks: { | ||
1599 | props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | ||
1600 | filter: function(a, b) { | ||
1601 | var c, d, e, f = b.button, | ||
1602 | g = b.fromElement; | ||
1603 | return null == a.pageX && null != b.clientX && (d = a.target.ownerDocument || z, e = d.documentElement, c = d.body, a.pageX = b.clientX + (e && e.scrollLeft || c && c.scrollLeft || 0) - (e && e.clientLeft || c && c.clientLeft || 0), a.pageY = b.clientY + (e && e.scrollTop || c && c.scrollTop || 0) - (e && e.clientTop || c && c.clientTop || 0)), !a.relatedTarget && g && (a.relatedTarget = g === a.target ? b.toElement : g), a.which || void 0 === f || (a.which = 1 & f ? 1 : 2 & f ? 3 : 4 & f ? 2 : 0), a | ||
1604 | } | ||
1605 | }, | ||
1606 | special: { | ||
1607 | load: { | ||
1608 | noBubble: !0 | ||
1609 | }, | ||
1610 | focus: { | ||
1611 | trigger: function() { | ||
1612 | if (this !== db() && this.focus) try { | ||
1613 | return this.focus(), !1 | ||
1614 | } catch (a) {} | ||
1615 | }, | ||
1616 | delegateType: "focusin" | ||
1617 | }, | ||
1618 | blur: { | ||
1619 | trigger: function() { | ||
1620 | return this === db() && this.blur ? (this.blur(), !1) : void 0 | ||
1621 | }, | ||
1622 | delegateType: "focusout" | ||
1623 | }, | ||
1624 | click: { | ||
1625 | trigger: function() { | ||
1626 | return n.nodeName(this, "input") && "checkbox" === this.type && this.click ? (this.click(), !1) : void 0 | ||
1627 | }, | ||
1628 | _default: function(a) { | ||
1629 | return n.nodeName(a.target, "a") | ||
1630 | } | ||
1631 | }, | ||
1632 | beforeunload: { | ||
1633 | postDispatch: function(a) { | ||
1634 | void 0 !== a.result && (a.originalEvent.returnValue = a.result) | ||
1635 | } | ||
1636 | } | ||
1637 | }, | ||
1638 | simulate: function(a, b, c, d) { | ||
1639 | var e = n.extend(new n.Event, c, { | ||
1640 | type: a, | ||
1641 | isSimulated: !0, | ||
1642 | originalEvent: {} | ||
1643 | }); | ||
1644 | d ? n.event.trigger(e, null, b) : n.event.dispatch.call(b, e), e.isDefaultPrevented() && c.preventDefault() | ||
1645 | } | ||
1646 | }, n.removeEvent = z.removeEventListener ? function(a, b, c) { | ||
1647 | a.removeEventListener && a.removeEventListener(b, c, !1) | ||
1648 | } : function(a, b, c) { | ||
1649 | var d = "on" + b; | ||
1650 | a.detachEvent && (typeof a[d] === L && (a[d] = null), a.detachEvent(d, c)) | ||
1651 | }, n.Event = function(a, b) { | ||
1652 | return this instanceof n.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && (a.returnValue === !1 || a.getPreventDefault && a.getPreventDefault()) ? bb : cb) : this.type = a, b && n.extend(this, b), this.timeStamp = a && a.timeStamp || n.now(), void(this[n.expando] = !0)) : new n.Event(a, b) | ||
1653 | }, n.Event.prototype = { | ||
1654 | isDefaultPrevented: cb, | ||
1655 | isPropagationStopped: cb, | ||
1656 | isImmediatePropagationStopped: cb, | ||
1657 | preventDefault: function() { | ||
1658 | var a = this.originalEvent; | ||
1659 | this.isDefaultPrevented = bb, a && (a.preventDefault ? a.preventDefault() : a.returnValue = !1) | ||
1660 | }, | ||
1661 | stopPropagation: function() { | ||
1662 | var a = this.originalEvent; | ||
1663 | this.isPropagationStopped = bb, a && (a.stopPropagation && a.stopPropagation(), a.cancelBubble = !0) | ||
1664 | }, | ||
1665 | stopImmediatePropagation: function() { | ||
1666 | this.isImmediatePropagationStopped = bb, this.stopPropagation() | ||
1667 | } | ||
1668 | }, n.each({ | ||
1669 | mouseenter: "mouseover", | ||
1670 | mouseleave: "mouseout" | ||
1671 | }, function(a, b) { | ||
1672 | n.event.special[a] = { | ||
1673 | delegateType: b, | ||
1674 | bindType: b, | ||
1675 | handle: function(a) { | ||
1676 | var c, d = this, | ||
1677 | e = a.relatedTarget, | ||
1678 | f = a.handleObj; | ||
1679 | return (!e || e !== d && !n.contains(d, e)) && (a.type = f.origType, c = f.handler.apply(this, arguments), a.type = b), c | ||
1680 | } | ||
1681 | } | ||
1682 | }), l.submitBubbles || (n.event.special.submit = { | ||
1683 | setup: function() { | ||
1684 | return n.nodeName(this, "form") ? !1 : void n.event.add(this, "click._submit keypress._submit", function(a) { | ||
1685 | var b = a.target, | ||
1686 | c = n.nodeName(b, "input") || n.nodeName(b, "button") ? b.form : void 0; | ||
1687 | c && !n._data(c, "submitBubbles") && (n.event.add(c, "submit._submit", function(a) { | ||
1688 | a._submit_bubble = !0 | ||
1689 | }), n._data(c, "submitBubbles", !0)) | ||
1690 | }) | ||
1691 | }, | ||
1692 | postDispatch: function(a) { | ||
1693 | a._submit_bubble && (delete a._submit_bubble, this.parentNode && !a.isTrigger && n.event.simulate("submit", this.parentNode, a, !0)) | ||
1694 | }, | ||
1695 | teardown: function() { | ||
1696 | return n.nodeName(this, "form") ? !1 : void n.event.remove(this, "._submit") | ||
1697 | } | ||
1698 | }), l.changeBubbles || (n.event.special.change = { | ||
1699 | setup: function() { | ||
1700 | return Y.test(this.nodeName) ? (("checkbox" === this.type || "radio" === this.type) && (n.event.add(this, "propertychange._change", function(a) { | ||
1701 | "checked" === a.originalEvent.propertyName && (this._just_changed = !0) | ||
1702 | }), n.event.add(this, "click._change", function(a) { | ||
1703 | this._just_changed && !a.isTrigger && (this._just_changed = !1), n.event.simulate("change", this, a, !0) | ||
1704 | })), !1) : void n.event.add(this, "beforeactivate._change", function(a) { | ||
1705 | var b = a.target; | ||
1706 | Y.test(b.nodeName) && !n._data(b, "changeBubbles") && (n.event.add(b, "change._change", function(a) { | ||
1707 | !this.parentNode || a.isSimulated || a.isTrigger || n.event.simulate("change", this.parentNode, a, !0) | ||
1708 | }), n._data(b, "changeBubbles", !0)) | ||
1709 | }) | ||
1710 | }, | ||
1711 | handle: function(a) { | ||
1712 | var b = a.target; | ||
1713 | return this !== b || a.isSimulated || a.isTrigger || "radio" !== b.type && "checkbox" !== b.type ? a.handleObj.handler.apply(this, arguments) : void 0 | ||
1714 | }, | ||
1715 | teardown: function() { | ||
1716 | return n.event.remove(this, "._change"), !Y.test(this.nodeName) | ||
1717 | } | ||
1718 | }), l.focusinBubbles || n.each({ | ||
1719 | focus: "focusin", | ||
1720 | blur: "focusout" | ||
1721 | }, function(a, b) { | ||
1722 | var c = function(a) { | ||
1723 | n.event.simulate(b, a.target, n.event.fix(a), !0) | ||
1724 | }; | ||
1725 | n.event.special[b] = { | ||
1726 | setup: function() { | ||
1727 | var d = this.ownerDocument || this, | ||
1728 | e = n._data(d, b); | ||
1729 | e || d.addEventListener(a, c, !0), n._data(d, b, (e || 0) + 1) | ||
1730 | }, | ||
1731 | teardown: function() { | ||
1732 | var d = this.ownerDocument || this, | ||
1733 | e = n._data(d, b) - 1; | ||
1734 | e ? n._data(d, b, e) : (d.removeEventListener(a, c, !0), n._removeData(d, b)) | ||
1735 | } | ||
1736 | } | ||
1737 | }), n.fn.extend({ | ||
1738 | on: function(a, b, c, d, e) { | ||
1739 | var f, g; | ||
1740 | if ("object" == typeof a) { | ||
1741 | "string" != typeof b && (c = c || b, b = void 0); | ||
1742 | for (f in a) this.on(f, b, c, a[f], e); | ||
1743 | return this | ||
1744 | } | ||
1745 | if (null == c && null == d ? (d = b, c = b = void 0) : null == d && ("string" == typeof b ? (d = c, c = void 0) : (d = c, c = b, b = void 0)), d === !1) d = cb; | ||
1746 | else if (!d) return this; | ||
1747 | return 1 === e && (g = d, d = function(a) { | ||
1748 | return n().off(a), g.apply(this, arguments) | ||
1749 | }, d.guid = g.guid || (g.guid = n.guid++)), this.each(function() { | ||
1750 | n.event.add(this, a, d, c, b) | ||
1751 | }) | ||
1752 | }, | ||
1753 | one: function(a, b, c, d) { | ||
1754 | return this.on(a, b, c, d, 1) | ||
1755 | }, | ||
1756 | off: function(a, b, c) { | ||
1757 | var d, e; | ||
1758 | if (a && a.preventDefault && a.handleObj) return d = a.handleObj, n(a.delegateTarget).off(d.namespace ? d.origType + "." + d.namespace : d.origType, d.selector, d.handler), this; | ||
1759 | if ("object" == typeof a) { | ||
1760 | for (e in a) this.off(e, b, a[e]); | ||
1761 | return this | ||
1762 | } | ||
1763 | return (b === !1 || "function" == typeof b) && (c = b, b = void 0), c === !1 && (c = cb), this.each(function() { | ||
1764 | n.event.remove(this, a, c, b) | ||
1765 | }) | ||
1766 | }, | ||
1767 | trigger: function(a, b) { | ||
1768 | return this.each(function() { | ||
1769 | n.event.trigger(a, b, this) | ||
1770 | }) | ||
1771 | }, | ||
1772 | triggerHandler: function(a, b) { | ||
1773 | var c = this[0]; | ||
1774 | return c ? n.event.trigger(a, b, c, !0) : void 0 | ||
1775 | } | ||
1776 | }); | ||
1777 | |||
1778 | function eb(a) { | ||
1779 | var b = fb.split("|"), | ||
1780 | c = a.createDocumentFragment(); | ||
1781 | if (c.createElement) | ||
1782 | while (b.length) c.createElement(b.pop()); | ||
1783 | return c | ||
1784 | } | ||
1785 | var fb = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", | ||
1786 | gb = / jQuery\d+="(?:null|\d+)"/g, | ||
1787 | hb = new RegExp("<(?:" + fb + ")[\\s/>]", "i"), | ||
1788 | ib = /^\s+/, | ||
1789 | jb = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, | ||
1790 | kb = /<([\w:]+)/, | ||
1791 | lb = /<tbody/i, | ||
1792 | mb = /<|&#?\w+;/, | ||
1793 | nb = /<(?:script|style|link)/i, | ||
1794 | ob = /checked\s*(?:[^=]|=\s*.checked.)/i, | ||
1795 | pb = /^$|\/(?:java|ecma)script/i, | ||
1796 | qb = /^true\/(.*)/, | ||
1797 | rb = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, | ||
1798 | sb = { | ||
1799 | option: [1, "<select multiple='multiple'>", "</select>"], | ||
1800 | legend: [1, "<fieldset>", "</fieldset>"], | ||
1801 | area: [1, "<map>", "</map>"], | ||
1802 | param: [1, "<object>", "</object>"], | ||
1803 | thead: [1, "<table>", "</table>"], | ||
1804 | tr: [2, "<table><tbody>", "</tbody></table>"], | ||
1805 | col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], | ||
1806 | td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], | ||
1807 | _default: l.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"] | ||
1808 | }, | ||
1809 | tb = eb(z), | ||
1810 | ub = tb.appendChild(z.createElement("div")); | ||
1811 | sb.optgroup = sb.option, sb.tbody = sb.tfoot = sb.colgroup = sb.caption = sb.thead, sb.th = sb.td; | ||
1812 | |||
1813 | function vb(a, b) { | ||
1814 | var c, d, e = 0, | ||
1815 | f = typeof a.getElementsByTagName !== L ? a.getElementsByTagName(b || "*") : typeof a.querySelectorAll !== L ? a.querySelectorAll(b || "*") : void 0; | ||
1816 | if (!f) | ||
1817 | for (f = [], c = a.childNodes || a; null != (d = c[e]); e++)!b || n.nodeName(d, b) ? f.push(d) : n.merge(f, vb(d, b)); | ||
1818 | return void 0 === b || b && n.nodeName(a, b) ? n.merge([a], f) : f | ||
1819 | } | ||
1820 | |||
1821 | function wb(a) { | ||
1822 | X.test(a.type) && (a.defaultChecked = a.checked) | ||
1823 | } | ||
1824 | |||
1825 | function xb(a, b) { | ||
1826 | return n.nodeName(a, "table") && n.nodeName(11 !== b.nodeType ? b : b.firstChild, "tr") ? a.getElementsByTagName("tbody")[0] || a.appendChild(a.ownerDocument.createElement("tbody")) : a | ||
1827 | } | ||
1828 | |||
1829 | function yb(a) { | ||
1830 | return a.type = (null !== n.find.attr(a, "type")) + "/" + a.type, a | ||
1831 | } | ||
1832 | |||
1833 | function zb(a) { | ||
1834 | var b = qb.exec(a.type); | ||
1835 | return b ? a.type = b[1] : a.removeAttribute("type"), a | ||
1836 | } | ||
1837 | |||
1838 | function Ab(a, b) { | ||
1839 | for (var c, d = 0; null != (c = a[d]); d++) n._data(c, "globalEval", !b || n._data(b[d], "globalEval")) | ||
1840 | } | ||
1841 | |||
1842 | function Bb(a, b) { | ||
1843 | if (1 === b.nodeType && n.hasData(a)) { | ||
1844 | var c, d, e, f = n._data(a), | ||
1845 | g = n._data(b, f), | ||
1846 | h = f.events; | ||
1847 | if (h) { | ||
1848 | delete g.handle, g.events = {}; | ||
1849 | for (c in h) | ||
1850 | for (d = 0, e = h[c].length; e > d; d++) n.event.add(b, c, h[c][d]) | ||
1851 | } | ||
1852 | g.data && (g.data = n.extend({}, g.data)) | ||
1853 | } | ||
1854 | } | ||
1855 | |||
1856 | function Cb(a, b) { | ||
1857 | var c, d, e; | ||
1858 | if (1 === b.nodeType) { | ||
1859 | if (c = b.nodeName.toLowerCase(), !l.noCloneEvent && b[n.expando]) { | ||
1860 | e = n._data(b); | ||
1861 | for (d in e.events) n.removeEvent(b, d, e.handle); | ||
1862 | b.removeAttribute(n.expando) | ||
1863 | } | ||
1864 | "script" === c && b.text !== a.text ? (yb(b).text = a.text, zb(b)) : "object" === c ? (b.parentNode && (b.outerHTML = a.outerHTML), l.html5Clone && a.innerHTML && !n.trim(b.innerHTML) && (b.innerHTML = a.innerHTML)) : "input" === c && X.test(a.type) ? (b.defaultChecked = b.checked = a.checked, b.value !== a.value && (b.value = a.value)) : "option" === c ? b.defaultSelected = b.selected = a.defaultSelected : ("input" === c || "textarea" === c) && (b.defaultValue = a.defaultValue) | ||
1865 | } | ||
1866 | } | ||
1867 | n.extend({ | ||
1868 | clone: function(a, b, c) { | ||
1869 | var d, e, f, g, h, i = n.contains(a.ownerDocument, a); | ||
1870 | if (l.html5Clone || n.isXMLDoc(a) || !hb.test("<" + a.nodeName + ">") ? f = a.cloneNode(!0) : (ub.innerHTML = a.outerHTML, ub.removeChild(f = ub.firstChild)), !(l.noCloneEvent && l.noCloneChecked || 1 !== a.nodeType && 11 !== a.nodeType || n.isXMLDoc(a))) | ||
1871 | for (d = vb(f), h = vb(a), g = 0; null != (e = h[g]); ++g) d[g] && Cb(e, d[g]); | ||
1872 | if (b) | ||
1873 | if (c) | ||
1874 | for (h = h || vb(a), d = d || vb(f), g = 0; null != (e = h[g]); g++) Bb(e, d[g]); | ||
1875 | else Bb(a, f); | ||
1876 | return d = vb(f, "script"), d.length > 0 && Ab(d, !i && vb(a, "script")), d = h = e = null, f | ||
1877 | }, | ||
1878 | buildFragment: function(a, b, c, d) { | ||
1879 | for (var e, f, g, h, i, j, k, m = a.length, o = eb(b), p = [], q = 0; m > q; q++) | ||
1880 | if (f = a[q], f || 0 === f) | ||
1881 | if ("object" === n.type(f)) n.merge(p, f.nodeType ? [f] : f); | ||
1882 | else if (mb.test(f)) { | ||
1883 | h = h || o.appendChild(b.createElement("div")), i = (kb.exec(f) || ["", ""])[1].toLowerCase(), k = sb[i] || sb._default, h.innerHTML = k[1] + f.replace(jb, "<$1></$2>") + k[2], e = k[0]; | ||
1884 | while (e--) h = h.lastChild; | ||
1885 | if (!l.leadingWhitespace && ib.test(f) && p.push(b.createTextNode(ib.exec(f)[0])), !l.tbody) { | ||
1886 | f = "table" !== i || lb.test(f) ? "<table>" !== k[1] || lb.test(f) ? 0 : h : h.firstChild, e = f && f.childNodes.length; | ||
1887 | while (e--) n.nodeName(j = f.childNodes[e], "tbody") && !j.childNodes.length && f.removeChild(j) | ||
1888 | } | ||
1889 | n.merge(p, h.childNodes), h.textContent = ""; | ||
1890 | while (h.firstChild) h.removeChild(h.firstChild); | ||
1891 | h = o.lastChild | ||
1892 | } else p.push(b.createTextNode(f)); | ||
1893 | h && o.removeChild(h), l.appendChecked || n.grep(vb(p, "input"), wb), q = 0; | ||
1894 | while (f = p[q++]) | ||
1895 | if ((!d || -1 === n.inArray(f, d)) && (g = n.contains(f.ownerDocument, f), h = vb(o.appendChild(f), "script"), g && Ab(h), c)) { | ||
1896 | e = 0; | ||
1897 | while (f = h[e++]) pb.test(f.type || "") && c.push(f) | ||
1898 | } | ||
1899 | return h = null, o | ||
1900 | }, | ||
1901 | cleanData: function(a, b) { | ||
1902 | for (var d, e, f, g, h = 0, i = n.expando, j = n.cache, k = l.deleteExpando, m = n.event.special; null != (d = a[h]); h++) | ||
1903 | if ((b || n.acceptData(d)) && (f = d[i], g = f && j[f])) { | ||
1904 | if (g.events) | ||
1905 | for (e in g.events) m[e] ? n.event.remove(d, e) : n.removeEvent(d, e, g.handle); | ||
1906 | j[f] && (delete j[f], k ? delete d[i] : typeof d.removeAttribute !== L ? d.removeAttribute(i) : d[i] = null, c.push(f)) | ||
1907 | } | ||
1908 | } | ||
1909 | }), n.fn.extend({ | ||
1910 | text: function(a) { | ||
1911 | return W(this, function(a) { | ||
1912 | return void 0 === a ? n.text(this) : this.empty().append((this[0] && this[0].ownerDocument || z).createTextNode(a)) | ||
1913 | }, null, a, arguments.length) | ||
1914 | }, | ||
1915 | append: function() { | ||
1916 | return this.domManip(arguments, function(a) { | ||
1917 | if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { | ||
1918 | var b = xb(this, a); | ||
1919 | b.appendChild(a) | ||
1920 | } | ||
1921 | }) | ||
1922 | }, | ||
1923 | prepend: function() { | ||
1924 | return this.domManip(arguments, function(a) { | ||
1925 | if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { | ||
1926 | var b = xb(this, a); | ||
1927 | b.insertBefore(a, b.firstChild) | ||
1928 | } | ||
1929 | }) | ||
1930 | }, | ||
1931 | before: function() { | ||
1932 | return this.domManip(arguments, function(a) { | ||
1933 | this.parentNode && this.parentNode.insertBefore(a, this) | ||
1934 | }) | ||
1935 | }, | ||
1936 | after: function() { | ||
1937 | return this.domManip(arguments, function(a) { | ||
1938 | this.parentNode && this.parentNode.insertBefore(a, this.nextSibling) | ||
1939 | }) | ||
1940 | }, | ||
1941 | remove: function(a, b) { | ||
1942 | for (var c, d = a ? n.filter(a, this) : this, e = 0; null != (c = d[e]); e++) b || 1 !== c.nodeType || n.cleanData(vb(c)), c.parentNode && (b && n.contains(c.ownerDocument, c) && Ab(vb(c, "script")), c.parentNode.removeChild(c)); | ||
1943 | return this | ||
1944 | }, | ||
1945 | empty: function() { | ||
1946 | for (var a, b = 0; null != (a = this[b]); b++) { | ||
1947 | 1 === a.nodeType && n.cleanData(vb(a, !1)); | ||
1948 | while (a.firstChild) a.removeChild(a.firstChild); | ||
1949 | a.options && n.nodeName(a, "select") && (a.options.length = 0) | ||
1950 | } | ||
1951 | return this | ||
1952 | }, | ||
1953 | clone: function(a, b) { | ||
1954 | return a = null == a ? !1 : a, b = null == b ? a : b, this.map(function() { | ||
1955 | return n.clone(this, a, b) | ||
1956 | }) | ||
1957 | }, | ||
1958 | html: function(a) { | ||
1959 | return W(this, function(a) { | ||
1960 | var b = this[0] || {}, | ||
1961 | c = 0, | ||
1962 | d = this.length; | ||
1963 | if (void 0 === a) return 1 === b.nodeType ? b.innerHTML.replace(gb, "") : void 0; | ||
1964 | if (!("string" != typeof a || nb.test(a) || !l.htmlSerialize && hb.test(a) || !l.leadingWhitespace && ib.test(a) || sb[(kb.exec(a) || ["", ""])[1].toLowerCase()])) { | ||
1965 | a = a.replace(jb, "<$1></$2>"); | ||
1966 | try { | ||
1967 | for (; d > c; c++) b = this[c] || {}, 1 === b.nodeType && (n.cleanData(vb(b, !1)), b.innerHTML = a); | ||
1968 | b = 0 | ||
1969 | } catch (e) {} | ||
1970 | } | ||
1971 | b && this.empty().append(a) | ||
1972 | }, null, a, arguments.length) | ||
1973 | }, | ||
1974 | replaceWith: function() { | ||
1975 | var a = arguments[0]; | ||
1976 | return this.domManip(arguments, function(b) { | ||
1977 | a = this.parentNode, n.cleanData(vb(this)), a && a.replaceChild(b, this) | ||
1978 | }), a && (a.length || a.nodeType) ? this : this.remove() | ||
1979 | }, | ||
1980 | detach: function(a) { | ||
1981 | return this.remove(a, !0) | ||
1982 | }, | ||
1983 | domManip: function(a, b) { | ||
1984 | a = e.apply([], a); | ||
1985 | var c, d, f, g, h, i, j = 0, | ||
1986 | k = this.length, | ||
1987 | m = this, | ||
1988 | o = k - 1, | ||
1989 | p = a[0], | ||
1990 | q = n.isFunction(p); | ||
1991 | if (q || k > 1 && "string" == typeof p && !l.checkClone && ob.test(p)) return this.each(function(c) { | ||
1992 | var d = m.eq(c); | ||
1993 | q && (a[0] = p.call(this, c, d.html())), d.domManip(a, b) | ||
1994 | }); | ||
1995 | if (k && (i = n.buildFragment(a, this[0].ownerDocument, !1, this), c = i.firstChild, 1 === i.childNodes.length && (i = c), c)) { | ||
1996 | for (g = n.map(vb(i, "script"), yb), f = g.length; k > j; j++) d = i, j !== o && (d = n.clone(d, !0, !0), f && n.merge(g, vb(d, "script"))), b.call(this[j], d, j); | ||
1997 | if (f) | ||
1998 | for (h = g[g.length - 1].ownerDocument, n.map(g, zb), j = 0; f > j; j++) d = g[j], pb.test(d.type || "") && !n._data(d, "globalEval") && n.contains(h, d) && (d.src ? n._evalUrl && n._evalUrl(d.src) : n.globalEval((d.text || d.textContent || d.innerHTML || "").replace(rb, ""))); | ||
1999 | i = c = null | ||
2000 | } | ||
2001 | return this | ||
2002 | } | ||
2003 | }), n.each({ | ||
2004 | appendTo: "append", | ||
2005 | prependTo: "prepend", | ||
2006 | insertBefore: "before", | ||
2007 | insertAfter: "after", | ||
2008 | replaceAll: "replaceWith" | ||
2009 | }, function(a, b) { | ||
2010 | n.fn[a] = function(a) { | ||
2011 | for (var c, d = 0, e = [], g = n(a), h = g.length - 1; h >= d; d++) c = d === h ? this : this.clone(!0), n(g[d])[b](c), f.apply(e, c.get()); | ||
2012 | return this.pushStack(e) | ||
2013 | } | ||
2014 | }); | ||
2015 | var Db, Eb = {}; | ||
2016 | |||
2017 | function Fb(b, c) { | ||
2018 | var d = n(c.createElement(b)).appendTo(c.body), | ||
2019 | e = a.getDefaultComputedStyle ? a.getDefaultComputedStyle(d[0]).display : n.css(d[0], "display"); | ||
2020 | return d.detach(), e | ||
2021 | } | ||
2022 | |||
2023 | function Gb(a) { | ||
2024 | var b = z, | ||
2025 | c = Eb[a]; | ||
2026 | return c || (c = Fb(a, b), "none" !== c && c || (Db = (Db || n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement), b = (Db[0].contentWindow || Db[0].contentDocument).document, b.write(), b.close(), c = Fb(a, b), Db.detach()), Eb[a] = c), c | ||
2027 | }! function() { | ||
2028 | var a, b, c = z.createElement("div"), | ||
2029 | d = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0"; | ||
2030 | c.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", a = c.getElementsByTagName("a")[0], a.style.cssText = "float:left;opacity:.5", l.opacity = /^0.5/.test(a.style.opacity), l.cssFloat = !!a.style.cssFloat, c.style.backgroundClip = "content-box", c.cloneNode(!0).style.backgroundClip = "", l.clearCloneStyle = "content-box" === c.style.backgroundClip, a = c = null, l.shrinkWrapBlocks = function() { | ||
2031 | var a, c, e, f; | ||
2032 | if (null == b) { | ||
2033 | if (a = z.getElementsByTagName("body")[0], !a) return; | ||
2034 | f = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px", c = z.createElement("div"), e = z.createElement("div"), a.appendChild(c).appendChild(e), b = !1, typeof e.style.zoom !== L && (e.style.cssText = d + ";width:1px;padding:1px;zoom:1", e.innerHTML = "<div></div>", e.firstChild.style.width = "5px", b = 3 !== e.offsetWidth), a.removeChild(c), a = c = e = null | ||
2035 | } | ||
2036 | return b | ||
2037 | } | ||
2038 | }(); | ||
2039 | var Hb = /^margin/, | ||
2040 | Ib = new RegExp("^(" + T + ")(?!px)[a-z%]+$", "i"), | ||
2041 | Jb, Kb, Lb = /^(top|right|bottom|left)$/; | ||
2042 | a.getComputedStyle ? (Jb = function(a) { | ||
2043 | return a.ownerDocument.defaultView.getComputedStyle(a, null) | ||
2044 | }, Kb = function(a, b, c) { | ||
2045 | var d, e, f, g, h = a.style; | ||
2046 | return c = c || Jb(a), g = c ? c.getPropertyValue(b) || c[b] : void 0, c && ("" !== g || n.contains(a.ownerDocument, a) || (g = n.style(a, b)), Ib.test(g) && Hb.test(b) && (d = h.width, e = h.minWidth, f = h.maxWidth, h.minWidth = h.maxWidth = h.width = g, g = c.width, h.width = d, h.minWidth = e, h.maxWidth = f)), void 0 === g ? g : g + "" | ||
2047 | }) : z.documentElement.currentStyle && (Jb = function(a) { | ||
2048 | return a.currentStyle | ||
2049 | }, Kb = function(a, b, c) { | ||
2050 | var d, e, f, g, h = a.style; | ||
2051 | return c = c || Jb(a), g = c ? c[b] : void 0, null == g && h && h[b] && (g = h[b]), Ib.test(g) && !Lb.test(b) && (d = h.left, e = a.runtimeStyle, f = e && e.left, f && (e.left = a.currentStyle.left), h.left = "fontSize" === b ? "1em" : g, g = h.pixelLeft + "px", h.left = d, f && (e.left = f)), void 0 === g ? g : g + "" || "auto" | ||
2052 | }); | ||
2053 | |||
2054 | function Mb(a, b) { | ||
2055 | return { | ||
2056 | get: function() { | ||
2057 | var c = a(); | ||
2058 | if (null != c) return c ? void delete this.get : (this.get = b).apply(this, arguments) | ||
2059 | } | ||
2060 | } | ||
2061 | }! function() { | ||
2062 | var b, c, d, e, f, g, h = z.createElement("div"), | ||
2063 | i = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px", | ||
2064 | j = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;padding:0;margin:0;border:0"; | ||
2065 | h.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", b = h.getElementsByTagName("a")[0], b.style.cssText = "float:left;opacity:.5", l.opacity = /^0.5/.test(b.style.opacity), l.cssFloat = !!b.style.cssFloat, h.style.backgroundClip = "content-box", h.cloneNode(!0).style.backgroundClip = "", l.clearCloneStyle = "content-box" === h.style.backgroundClip, b = h = null, n.extend(l, { | ||
2066 | reliableHiddenOffsets: function() { | ||
2067 | if (null != c) return c; | ||
2068 | var a, b, d, e = z.createElement("div"), | ||
2069 | f = z.getElementsByTagName("body")[0]; | ||
2070 | if (f) return e.setAttribute("className", "t"), e.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", a = z.createElement("div"), a.style.cssText = i, f.appendChild(a).appendChild(e), e.innerHTML = "<table><tr><td></td><td>t</td></tr></table>", b = e.getElementsByTagName("td"), b[0].style.cssText = "padding:0;margin:0;border:0;display:none", d = 0 === b[0].offsetHeight, b[0].style.display = "", b[1].style.display = "none", c = d && 0 === b[0].offsetHeight, f.removeChild(a), e = f = null, c | ||
2071 | }, | ||
2072 | boxSizing: function() { | ||
2073 | return null == d && k(), d | ||
2074 | }, | ||
2075 | boxSizingReliable: function() { | ||
2076 | return null == e && k(), e | ||
2077 | }, | ||
2078 | pixelPosition: function() { | ||
2079 | return null == f && k(), f | ||
2080 | }, | ||
2081 | reliableMarginRight: function() { | ||
2082 | var b, c, d, e; | ||
2083 | if (null == g && a.getComputedStyle) { | ||
2084 | if (b = z.getElementsByTagName("body")[0], !b) return; | ||
2085 | c = z.createElement("div"), d = z.createElement("div"), c.style.cssText = i, b.appendChild(c).appendChild(d), e = d.appendChild(z.createElement("div")), e.style.cssText = d.style.cssText = j, e.style.marginRight = e.style.width = "0", d.style.width = "1px", g = !parseFloat((a.getComputedStyle(e, null) || {}).marginRight), b.removeChild(c) | ||
2086 | } | ||
2087 | return g | ||
2088 | } | ||
2089 | }); | ||
2090 | |||
2091 | function k() { | ||
2092 | var b, c, h = z.getElementsByTagName("body")[0]; | ||
2093 | h && (b = z.createElement("div"), c = z.createElement("div"), b.style.cssText = i, h.appendChild(b).appendChild(c), c.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;display:block;padding:1px;border:1px;width:4px;margin-top:1%;top:1%", n.swap(h, null != h.style.zoom ? { | ||
2094 | zoom: 1 | ||
2095 | } : {}, function() { | ||
2096 | d = 4 === c.offsetWidth | ||
2097 | }), e = !0, f = !1, g = !0, a.getComputedStyle && (f = "1%" !== (a.getComputedStyle(c, null) || {}).top, e = "4px" === (a.getComputedStyle(c, null) || { | ||
2098 | width: "4px" | ||
2099 | }).width), h.removeChild(b), c = h = null) | ||
2100 | } | ||
2101 | }(), n.swap = function(a, b, c, d) { | ||
2102 | var e, f, g = {}; | ||
2103 | for (f in b) g[f] = a.style[f], a.style[f] = b[f]; | ||
2104 | e = c.apply(a, d || []); | ||
2105 | for (f in b) a.style[f] = g[f]; | ||
2106 | return e | ||
2107 | }; | ||
2108 | var Nb = /alpha\([^)]*\)/i, | ||
2109 | Ob = /opacity\s*=\s*([^)]*)/, | ||
2110 | Pb = /^(none|table(?!-c[ea]).+)/, | ||
2111 | Qb = new RegExp("^(" + T + ")(.*)$", "i"), | ||
2112 | Rb = new RegExp("^([+-])=(" + T + ")", "i"), | ||
2113 | Sb = { | ||
2114 | position: "absolute", | ||
2115 | visibility: "hidden", | ||
2116 | display: "block" | ||
2117 | }, | ||
2118 | Tb = { | ||
2119 | letterSpacing: 0, | ||
2120 | fontWeight: 400 | ||
2121 | }, | ||
2122 | Ub = ["Webkit", "O", "Moz", "ms"]; | ||
2123 | |||
2124 | function Vb(a, b) { | ||
2125 | if (b in a) return b; | ||
2126 | var c = b.charAt(0).toUpperCase() + b.slice(1), | ||
2127 | d = b, | ||
2128 | e = Ub.length; | ||
2129 | while (e--) | ||
2130 | if (b = Ub[e] + c, b in a) return b; | ||
2131 | return d | ||
2132 | } | ||
2133 | |||
2134 | function Wb(a, b) { | ||
2135 | for (var c, d, e, f = [], g = 0, h = a.length; h > g; g++) d = a[g], d.style && (f[g] = n._data(d, "olddisplay"), c = d.style.display, b ? (f[g] || "none" !== c || (d.style.display = ""), "" === d.style.display && V(d) && (f[g] = n._data(d, "olddisplay", Gb(d.nodeName)))) : f[g] || (e = V(d), (c && "none" !== c || !e) && n._data(d, "olddisplay", e ? c : n.css(d, "display")))); | ||
2136 | for (g = 0; h > g; g++) d = a[g], d.style && (b && "none" !== d.style.display && "" !== d.style.display || (d.style.display = b ? f[g] || "" : "none")); | ||
2137 | return a | ||
2138 | } | ||
2139 | |||
2140 | function Xb(a, b, c) { | ||
2141 | var d = Qb.exec(b); | ||
2142 | return d ? Math.max(0, d[1] - (c || 0)) + (d[2] || "px") : b | ||
2143 | } | ||
2144 | |||
2145 | function Yb(a, b, c, d, e) { | ||
2146 | for (var f = c === (d ? "border" : "content") ? 4 : "width" === b ? 1 : 0, g = 0; 4 > f; f += 2) "margin" === c && (g += n.css(a, c + U[f], !0, e)), d ? ("content" === c && (g -= n.css(a, "padding" + U[f], !0, e)), "margin" !== c && (g -= n.css(a, "border" + U[f] + "Width", !0, e))) : (g += n.css(a, "padding" + U[f], !0, e), "padding" !== c && (g += n.css(a, "border" + U[f] + "Width", !0, e))); | ||
2147 | return g | ||
2148 | } | ||
2149 | |||
2150 | function Zb(a, b, c) { | ||
2151 | var d = !0, | ||
2152 | e = "width" === b ? a.offsetWidth : a.offsetHeight, | ||
2153 | f = Jb(a), | ||
2154 | g = l.boxSizing() && "border-box" === n.css(a, "boxSizing", !1, f); | ||
2155 | if (0 >= e || null == e) { | ||
2156 | if (e = Kb(a, b, f), (0 > e || null == e) && (e = a.style[b]), Ib.test(e)) return e; | ||
2157 | d = g && (l.boxSizingReliable() || e === a.style[b]), e = parseFloat(e) || 0 | ||
2158 | } | ||
2159 | return e + Yb(a, b, c || (g ? "border" : "content"), d, f) + "px" | ||
2160 | } | ||
2161 | n.extend({ | ||
2162 | cssHooks: { | ||
2163 | opacity: { | ||
2164 | get: function(a, b) { | ||
2165 | if (b) { | ||
2166 | var c = Kb(a, "opacity"); | ||
2167 | return "" === c ? "1" : c | ||
2168 | } | ||
2169 | } | ||
2170 | } | ||
2171 | }, | ||
2172 | cssNumber: { | ||
2173 | columnCount: !0, | ||
2174 | fillOpacity: !0, | ||
2175 | fontWeight: !0, | ||
2176 | lineHeight: !0, | ||
2177 | opacity: !0, | ||
2178 | order: !0, | ||
2179 | orphans: !0, | ||
2180 | widows: !0, | ||
2181 | zIndex: !0, | ||
2182 | zoom: !0 | ||
2183 | }, | ||
2184 | cssProps: { | ||
2185 | "float": l.cssFloat ? "cssFloat" : "styleFloat" | ||
2186 | }, | ||
2187 | style: function(a, b, c, d) { | ||
2188 | if (a && 3 !== a.nodeType && 8 !== a.nodeType && a.style) { | ||
2189 | var e, f, g, h = n.camelCase(b), | ||
2190 | i = a.style; | ||
2191 | if (b = n.cssProps[h] || (n.cssProps[h] = Vb(i, h)), g = n.cssHooks[b] || n.cssHooks[h], void 0 === c) return g && "get" in g && void 0 !== (e = g.get(a, !1, d)) ? e : i[b]; | ||
2192 | if (f = typeof c, "string" === f && (e = Rb.exec(c)) && (c = (e[1] + 1) * e[2] + parseFloat(n.css(a, b)), f = "number"), null != c && c === c && ("number" !== f || n.cssNumber[h] || (c += "px"), l.clearCloneStyle || "" !== c || 0 !== b.indexOf("background") || (i[b] = "inherit"), !(g && "set" in g && void 0 === (c = g.set(a, c, d))))) try { | ||
2193 | i[b] = "", i[b] = c | ||
2194 | } catch (j) {} | ||
2195 | } | ||
2196 | }, | ||
2197 | css: function(a, b, c, d) { | ||
2198 | var e, f, g, h = n.camelCase(b); | ||
2199 | return b = n.cssProps[h] || (n.cssProps[h] = Vb(a.style, h)), g = n.cssHooks[b] || n.cssHooks[h], g && "get" in g && (f = g.get(a, !0, c)), void 0 === f && (f = Kb(a, b, d)), "normal" === f && b in Tb && (f = Tb[b]), "" === c || c ? (e = parseFloat(f), c === !0 || n.isNumeric(e) ? e || 0 : f) : f | ||
2200 | } | ||
2201 | }), n.each(["height", "width"], function(a, b) { | ||
2202 | n.cssHooks[b] = { | ||
2203 | get: function(a, c, d) { | ||
2204 | return c ? 0 === a.offsetWidth && Pb.test(n.css(a, "display")) ? n.swap(a, Sb, function() { | ||
2205 | return Zb(a, b, d) | ||
2206 | }) : Zb(a, b, d) : void 0 | ||
2207 | }, | ||
2208 | set: function(a, c, d) { | ||
2209 | var e = d && Jb(a); | ||
2210 | return Xb(a, c, d ? Yb(a, b, d, l.boxSizing() && "border-box" === n.css(a, "boxSizing", !1, e), e) : 0) | ||
2211 | } | ||
2212 | } | ||
2213 | }), l.opacity || (n.cssHooks.opacity = { | ||
2214 | get: function(a, b) { | ||
2215 | return Ob.test((b && a.currentStyle ? a.currentStyle.filter : a.style.filter) || "") ? .01 * parseFloat(RegExp.$1) + "" : b ? "1" : "" | ||
2216 | }, | ||
2217 | set: function(a, b) { | ||
2218 | var c = a.style, | ||
2219 | d = a.currentStyle, | ||
2220 | e = n.isNumeric(b) ? "alpha(opacity=" + 100 * b + ")" : "", | ||
2221 | f = d && d.filter || c.filter || ""; | ||
2222 | c.zoom = 1, (b >= 1 || "" === b) && "" === n.trim(f.replace(Nb, "")) && c.removeAttribute && (c.removeAttribute("filter"), "" === b || d && !d.filter) || (c.filter = Nb.test(f) ? f.replace(Nb, e) : f + " " + e) | ||
2223 | } | ||
2224 | }), n.cssHooks.marginRight = Mb(l.reliableMarginRight, function(a, b) { | ||
2225 | return b ? n.swap(a, { | ||
2226 | display: "inline-block" | ||
2227 | }, Kb, [a, "marginRight"]) : void 0 | ||
2228 | }), n.each({ | ||
2229 | margin: "", | ||
2230 | padding: "", | ||
2231 | border: "Width" | ||
2232 | }, function(a, b) { | ||
2233 | n.cssHooks[a + b] = { | ||
2234 | expand: function(c) { | ||
2235 | for (var d = 0, e = {}, f = "string" == typeof c ? c.split(" ") : [c]; 4 > d; d++) e[a + U[d] + b] = f[d] || f[d - 2] || f[0]; | ||
2236 | return e | ||
2237 | } | ||
2238 | }, Hb.test(a) || (n.cssHooks[a + b].set = Xb) | ||
2239 | }), n.fn.extend({ | ||
2240 | css: function(a, b) { | ||
2241 | return W(this, function(a, b, c) { | ||
2242 | var d, e, f = {}, | ||
2243 | g = 0; | ||
2244 | if (n.isArray(b)) { | ||
2245 | for (d = Jb(a), e = b.length; e > g; g++) f[b[g]] = n.css(a, b[g], !1, d); | ||
2246 | return f | ||
2247 | } | ||
2248 | return void 0 !== c ? n.style(a, b, c) : n.css(a, b) | ||
2249 | }, a, b, arguments.length > 1) | ||
2250 | }, | ||
2251 | show: function() { | ||
2252 | return Wb(this, !0) | ||
2253 | }, | ||
2254 | hide: function() { | ||
2255 | return Wb(this) | ||
2256 | }, | ||
2257 | toggle: function(a) { | ||
2258 | return "boolean" == typeof a ? a ? this.show() : this.hide() : this.each(function() { | ||
2259 | V(this) ? n(this).show() : n(this).hide() | ||
2260 | }) | ||
2261 | } | ||
2262 | }); | ||
2263 | |||
2264 | function $b(a, b, c, d, e) { | ||
2265 | return new $b.prototype.init(a, b, c, d, e) | ||
2266 | } | ||
2267 | n.Tween = $b, $b.prototype = { | ||
2268 | constructor: $b, | ||
2269 | init: function(a, b, c, d, e, f) { | ||
2270 | this.elem = a, this.prop = c, this.easing = e || "swing", this.options = b, this.start = this.now = this.cur(), this.end = d, this.unit = f || (n.cssNumber[c] ? "" : "px") | ||
2271 | }, | ||
2272 | cur: function() { | ||
2273 | var a = $b.propHooks[this.prop]; | ||
2274 | return a && a.get ? a.get(this) : $b.propHooks._default.get(this) | ||
2275 | }, | ||
2276 | run: function(a) { | ||
2277 | var b, c = $b.propHooks[this.prop]; | ||
2278 | return this.pos = b = this.options.duration ? n.easing[this.easing](a, this.options.duration * a, 0, 1, this.options.duration) : a, this.now = (this.end - this.start) * b + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), c && c.set ? c.set(this) : $b.propHooks._default.set(this), this | ||
2279 | } | ||
2280 | }, $b.prototype.init.prototype = $b.prototype, $b.propHooks = { | ||
2281 | _default: { | ||
2282 | get: function(a) { | ||
2283 | var b; | ||
2284 | return null == a.elem[a.prop] || a.elem.style && null != a.elem.style[a.prop] ? (b = n.css(a.elem, a.prop, ""), b && "auto" !== b ? b : 0) : a.elem[a.prop] | ||
2285 | }, | ||
2286 | set: function(a) { | ||
2287 | n.fx.step[a.prop] ? n.fx.step[a.prop](a) : a.elem.style && (null != a.elem.style[n.cssProps[a.prop]] || n.cssHooks[a.prop]) ? n.style(a.elem, a.prop, a.now + a.unit) : a.elem[a.prop] = a.now | ||
2288 | } | ||
2289 | } | ||
2290 | }, $b.propHooks.scrollTop = $b.propHooks.scrollLeft = { | ||
2291 | set: function(a) { | ||
2292 | a.elem.nodeType && a.elem.parentNode && (a.elem[a.prop] = a.now) | ||
2293 | } | ||
2294 | }, n.easing = { | ||
2295 | linear: function(a) { | ||
2296 | return a | ||
2297 | }, | ||
2298 | swing: function(a) { | ||
2299 | return .5 - Math.cos(a * Math.PI) / 2 | ||
2300 | } | ||
2301 | }, n.fx = $b.prototype.init, n.fx.step = {}; | ||
2302 | var _b, ac, bc = /^(?:toggle|show|hide)$/, | ||
2303 | cc = new RegExp("^(?:([+-])=|)(" + T + ")([a-z%]*)$", "i"), | ||
2304 | dc = /queueHooks$/, | ||
2305 | ec = [jc], | ||
2306 | fc = { | ||
2307 | "*": [ | ||
2308 | function(a, b) { | ||
2309 | var c = this.createTween(a, b), | ||
2310 | d = c.cur(), | ||
2311 | e = cc.exec(b), | ||
2312 | f = e && e[3] || (n.cssNumber[a] ? "" : "px"), | ||
2313 | g = (n.cssNumber[a] || "px" !== f && +d) && cc.exec(n.css(c.elem, a)), | ||
2314 | h = 1, | ||
2315 | i = 20; | ||
2316 | if (g && g[3] !== f) { | ||
2317 | f = f || g[3], e = e || [], g = +d || 1; | ||
2318 | do h = h || ".5", g /= h, n.style(c.elem, a, g + f); while (h !== (h = c.cur() / d) && 1 !== h && --i) | ||
2319 | } | ||
2320 | return e && (g = c.start = +g || +d || 0, c.unit = f, c.end = e[1] ? g + (e[1] + 1) * e[2] : +e[2]), c | ||
2321 | } | ||
2322 | ] | ||
2323 | }; | ||
2324 | |||
2325 | function gc() { | ||
2326 | return setTimeout(function() { | ||
2327 | _b = void 0 | ||
2328 | }), _b = n.now() | ||
2329 | } | ||
2330 | |||
2331 | function hc(a, b) { | ||
2332 | var c, d = { | ||
2333 | height: a | ||
2334 | }, | ||
2335 | e = 0; | ||
2336 | for (b = b ? 1 : 0; 4 > e; e += 2 - b) c = U[e], d["margin" + c] = d["padding" + c] = a; | ||
2337 | return b && (d.opacity = d.width = a), d | ||
2338 | } | ||
2339 | |||
2340 | function ic(a, b, c) { | ||
2341 | for (var d, e = (fc[b] || []).concat(fc["*"]), f = 0, g = e.length; g > f; f++) | ||
2342 | if (d = e[f].call(c, b, a)) return d | ||
2343 | } | ||
2344 | |||
2345 | function jc(a, b, c) { | ||
2346 | var d, e, f, g, h, i, j, k, m = this, | ||
2347 | o = {}, | ||
2348 | p = a.style, | ||
2349 | q = a.nodeType && V(a), | ||
2350 | r = n._data(a, "fxshow"); | ||
2351 | c.queue || (h = n._queueHooks(a, "fx"), null == h.unqueued && (h.unqueued = 0, i = h.empty.fire, h.empty.fire = function() { | ||
2352 | h.unqueued || i() | ||
2353 | }), h.unqueued++, m.always(function() { | ||
2354 | m.always(function() { | ||
2355 | h.unqueued--, n.queue(a, "fx").length || h.empty.fire() | ||
2356 | }) | ||
2357 | })), 1 === a.nodeType && ("height" in b || "width" in b) && (c.overflow = [p.overflow, p.overflowX, p.overflowY], j = n.css(a, "display"), k = Gb(a.nodeName), "none" === j && (j = k), "inline" === j && "none" === n.css(a, "float") && (l.inlineBlockNeedsLayout && "inline" !== k ? p.zoom = 1 : p.display = "inline-block")), c.overflow && (p.overflow = "hidden", l.shrinkWrapBlocks() || m.always(function() { | ||
2358 | p.overflow = c.overflow[0], p.overflowX = c.overflow[1], p.overflowY = c.overflow[2] | ||
2359 | })); | ||
2360 | for (d in b) | ||
2361 | if (e = b[d], bc.exec(e)) { | ||
2362 | if (delete b[d], f = f || "toggle" === e, e === (q ? "hide" : "show")) { | ||
2363 | if ("show" !== e || !r || void 0 === r[d]) continue; | ||
2364 | q = !0 | ||
2365 | } | ||
2366 | o[d] = r && r[d] || n.style(a, d) | ||
2367 | } | ||
2368 | if (!n.isEmptyObject(o)) { | ||
2369 | r ? "hidden" in r && (q = r.hidden) : r = n._data(a, "fxshow", {}), f && (r.hidden = !q), q ? n(a).show() : m.done(function() { | ||
2370 | n(a).hide() | ||
2371 | }), m.done(function() { | ||
2372 | var b; | ||
2373 | n._removeData(a, "fxshow"); | ||
2374 | for (b in o) n.style(a, b, o[b]) | ||
2375 | }); | ||
2376 | for (d in o) g = ic(q ? r[d] : 0, d, m), d in r || (r[d] = g.start, q && (g.end = g.start, g.start = "width" === d || "height" === d ? 1 : 0)) | ||
2377 | } | ||
2378 | } | ||
2379 | |||
2380 | function kc(a, b) { | ||
2381 | var c, d, e, f, g; | ||
2382 | for (c in a) | ||
2383 | if (d = n.camelCase(c), e = b[d], f = a[c], n.isArray(f) && (e = f[1], f = a[c] = f[0]), c !== d && (a[d] = f, delete a[c]), g = n.cssHooks[d], g && "expand" in g) { | ||
2384 | f = g.expand(f), delete a[d]; | ||
2385 | for (c in f) c in a || (a[c] = f[c], b[c] = e) | ||
2386 | } else b[d] = e | ||
2387 | } | ||
2388 | |||
2389 | function lc(a, b, c) { | ||
2390 | var d, e, f = 0, | ||
2391 | g = ec.length, | ||
2392 | h = n.Deferred().always(function() { | ||
2393 | delete i.elem | ||
2394 | }), | ||
2395 | i = function() { | ||
2396 | if (e) return !1; | ||
2397 | for (var b = _b || gc(), c = Math.max(0, j.startTime + j.duration - b), d = c / j.duration || 0, f = 1 - d, g = 0, i = j.tweens.length; i > g; g++) j.tweens[g].run(f); | ||
2398 | return h.notifyWith(a, [j, f, c]), 1 > f && i ? c : (h.resolveWith(a, [j]), !1) | ||
2399 | }, | ||
2400 | j = h.promise({ | ||
2401 | elem: a, | ||
2402 | props: n.extend({}, b), | ||
2403 | opts: n.extend(!0, { | ||
2404 | specialEasing: {} | ||
2405 | }, c), | ||
2406 | originalProperties: b, | ||
2407 | originalOptions: c, | ||
2408 | startTime: _b || gc(), | ||
2409 | duration: c.duration, | ||
2410 | tweens: [], | ||
2411 | createTween: function(b, c) { | ||
2412 | var d = n.Tween(a, j.opts, b, c, j.opts.specialEasing[b] || j.opts.easing); | ||
2413 | return j.tweens.push(d), d | ||
2414 | }, | ||
2415 | stop: function(b) { | ||
2416 | var c = 0, | ||
2417 | d = b ? j.tweens.length : 0; | ||
2418 | if (e) return this; | ||
2419 | for (e = !0; d > c; c++) j.tweens[c].run(1); | ||
2420 | return b ? h.resolveWith(a, [j, b]) : h.rejectWith(a, [j, b]), this | ||
2421 | } | ||
2422 | }), | ||
2423 | k = j.props; | ||
2424 | for (kc(k, j.opts.specialEasing); g > f; f++) | ||
2425 | if (d = ec[f].call(j, a, k, j.opts)) return d; | ||
2426 | return n.map(k, ic, j), n.isFunction(j.opts.start) && j.opts.start.call(a, j), n.fx.timer(n.extend(i, { | ||
2427 | elem: a, | ||
2428 | anim: j, | ||
2429 | queue: j.opts.queue | ||
2430 | })), j.progress(j.opts.progress).done(j.opts.done, j.opts.complete).fail(j.opts.fail).always(j.opts.always) | ||
2431 | } | ||
2432 | n.Animation = n.extend(lc, { | ||
2433 | tweener: function(a, b) { | ||
2434 | n.isFunction(a) ? (b = a, a = ["*"]) : a = a.split(" "); | ||
2435 | for (var c, d = 0, e = a.length; e > d; d++) c = a[d], fc[c] = fc[c] || [], fc[c].unshift(b) | ||
2436 | }, | ||
2437 | prefilter: function(a, b) { | ||
2438 | b ? ec.unshift(a) : ec.push(a) | ||
2439 | } | ||
2440 | }), n.speed = function(a, b, c) { | ||
2441 | var d = a && "object" == typeof a ? n.extend({}, a) : { | ||
2442 | complete: c || !c && b || n.isFunction(a) && a, | ||
2443 | duration: a, | ||
2444 | easing: c && b || b && !n.isFunction(b) && b | ||
2445 | }; | ||
2446 | return d.duration = n.fx.off ? 0 : "number" == typeof d.duration ? d.duration : d.duration in n.fx.speeds ? n.fx.speeds[d.duration] : n.fx.speeds._default, (null == d.queue || d.queue === !0) && (d.queue = "fx"), d.old = d.complete, d.complete = function() { | ||
2447 | n.isFunction(d.old) && d.old.call(this), d.queue && n.dequeue(this, d.queue) | ||
2448 | }, d | ||
2449 | }, n.fn.extend({ | ||
2450 | fadeTo: function(a, b, c, d) { | ||
2451 | return this.filter(V).css("opacity", 0).show().end().animate({ | ||
2452 | opacity: b | ||
2453 | }, a, c, d) | ||
2454 | }, | ||
2455 | animate: function(a, b, c, d) { | ||
2456 | var e = n.isEmptyObject(a), | ||
2457 | f = n.speed(b, c, d), | ||
2458 | g = function() { | ||
2459 | var b = lc(this, n.extend({}, a), f); | ||
2460 | (e || n._data(this, "finish")) && b.stop(!0) | ||
2461 | }; | ||
2462 | return g.finish = g, e || f.queue === !1 ? this.each(g) : this.queue(f.queue, g) | ||
2463 | }, | ||
2464 | stop: function(a, b, c) { | ||
2465 | var d = function(a) { | ||
2466 | var b = a.stop; | ||
2467 | delete a.stop, b(c) | ||
2468 | }; | ||
2469 | return "string" != typeof a && (c = b, b = a, a = void 0), b && a !== !1 && this.queue(a || "fx", []), this.each(function() { | ||
2470 | var b = !0, | ||
2471 | e = null != a && a + "queueHooks", | ||
2472 | f = n.timers, | ||
2473 | g = n._data(this); | ||
2474 | if (e) g[e] && g[e].stop && d(g[e]); | ||
2475 | else | ||
2476 | for (e in g) g[e] && g[e].stop && dc.test(e) && d(g[e]); | ||
2477 | for (e = f.length; e--;) f[e].elem !== this || null != a && f[e].queue !== a || (f[e].anim.stop(c), b = !1, f.splice(e, 1)); | ||
2478 | (b || !c) && n.dequeue(this, a) | ||
2479 | }) | ||
2480 | }, | ||
2481 | finish: function(a) { | ||
2482 | return a !== !1 && (a = a || "fx"), this.each(function() { | ||
2483 | var b, c = n._data(this), | ||
2484 | d = c[a + "queue"], | ||
2485 | e = c[a + "queueHooks"], | ||
2486 | f = n.timers, | ||
2487 | g = d ? d.length : 0; | ||
2488 | for (c.finish = !0, n.queue(this, a, []), e && e.stop && e.stop.call(this, !0), b = f.length; b--;) f[b].elem === this && f[b].queue === a && (f[b].anim.stop(!0), f.splice(b, 1)); | ||
2489 | for (b = 0; g > b; b++) d[b] && d[b].finish && d[b].finish.call(this); | ||
2490 | delete c.finish | ||
2491 | }) | ||
2492 | } | ||
2493 | }), n.each(["toggle", "show", "hide"], function(a, b) { | ||
2494 | var c = n.fn[b]; | ||
2495 | n.fn[b] = function(a, d, e) { | ||
2496 | return null == a || "boolean" == typeof a ? c.apply(this, arguments) : this.animate(hc(b, !0), a, d, e) | ||
2497 | } | ||
2498 | }), n.each({ | ||
2499 | slideDown: hc("show"), | ||
2500 | slideUp: hc("hide"), | ||
2501 | slideToggle: hc("toggle"), | ||
2502 | fadeIn: { | ||
2503 | opacity: "show" | ||
2504 | }, | ||
2505 | fadeOut: { | ||
2506 | opacity: "hide" | ||
2507 | }, | ||
2508 | fadeToggle: { | ||
2509 | opacity: "toggle" | ||
2510 | } | ||
2511 | }, function(a, b) { | ||
2512 | n.fn[a] = function(a, c, d) { | ||
2513 | return this.animate(b, a, c, d) | ||
2514 | } | ||
2515 | }), n.timers = [], n.fx.tick = function() { | ||
2516 | var a, b = n.timers, | ||
2517 | c = 0; | ||
2518 | for (_b = n.now(); c < b.length; c++) a = b[c], a() || b[c] !== a || b.splice(c--, 1); | ||
2519 | b.length || n.fx.stop(), _b = void 0 | ||
2520 | }, n.fx.timer = function(a) { | ||
2521 | n.timers.push(a), a() ? n.fx.start() : n.timers.pop() | ||
2522 | }, n.fx.interval = 13, n.fx.start = function() { | ||
2523 | ac || (ac = setInterval(n.fx.tick, n.fx.interval)) | ||
2524 | }, n.fx.stop = function() { | ||
2525 | clearInterval(ac), ac = null | ||
2526 | }, n.fx.speeds = { | ||
2527 | slow: 600, | ||
2528 | fast: 200, | ||
2529 | _default: 400 | ||
2530 | }, n.fn.delay = function(a, b) { | ||
2531 | return a = n.fx ? n.fx.speeds[a] || a : a, b = b || "fx", this.queue(b, function(b, c) { | ||
2532 | var d = setTimeout(b, a); | ||
2533 | c.stop = function() { | ||
2534 | clearTimeout(d) | ||
2535 | } | ||
2536 | }) | ||
2537 | }, | ||
2538 | function() { | ||
2539 | var a, b, c, d, e = z.createElement("div"); | ||
2540 | e.setAttribute("className", "t"), e.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", a = e.getElementsByTagName("a")[0], c = z.createElement("select"), d = c.appendChild(z.createElement("option")), b = e.getElementsByTagName("input")[0], a.style.cssText = "top:1px", l.getSetAttribute = "t" !== e.className, l.style = /top/.test(a.getAttribute("style")), l.hrefNormalized = "/a" === a.getAttribute("href"), l.checkOn = !!b.value, l.optSelected = d.selected, l.enctype = !!z.createElement("form").enctype, c.disabled = !0, l.optDisabled = !d.disabled, b = z.createElement("input"), b.setAttribute("value", ""), l.input = "" === b.getAttribute("value"), b.value = "t", b.setAttribute("type", "radio"), l.radioValue = "t" === b.value, a = b = c = d = e = null | ||
2541 | }(); | ||
2542 | var mc = /\r/g; | ||
2543 | n.fn.extend({ | ||
2544 | val: function(a) { | ||
2545 | var b, c, d, e = this[0]; { | ||
2546 | if (arguments.length) return d = n.isFunction(a), this.each(function(c) { | ||
2547 | var e; | ||
2548 | 1 === this.nodeType && (e = d ? a.call(this, c, n(this).val()) : a, null == e ? e = "" : "number" == typeof e ? e += "" : n.isArray(e) && (e = n.map(e, function(a) { | ||
2549 | return null == a ? "" : a + "" | ||
2550 | })), b = n.valHooks[this.type] || n.valHooks[this.nodeName.toLowerCase()], b && "set" in b && void 0 !== b.set(this, e, "value") || (this.value = e)) | ||
2551 | }); | ||
2552 | if (e) return b = n.valHooks[e.type] || n.valHooks[e.nodeName.toLowerCase()], b && "get" in b && void 0 !== (c = b.get(e, "value")) ? c : (c = e.value, "string" == typeof c ? c.replace(mc, "") : null == c ? "" : c) | ||
2553 | } | ||
2554 | } | ||
2555 | }), n.extend({ | ||
2556 | valHooks: { | ||
2557 | option: { | ||
2558 | get: function(a) { | ||
2559 | var b = n.find.attr(a, "value"); | ||
2560 | return null != b ? b : n.text(a) | ||
2561 | } | ||
2562 | }, | ||
2563 | select: { | ||
2564 | get: function(a) { | ||
2565 | for (var b, c, d = a.options, e = a.selectedIndex, f = "select-one" === a.type || 0 > e, g = f ? null : [], h = f ? e + 1 : d.length, i = 0 > e ? h : f ? e : 0; h > i; i++) | ||
2566 | if (c = d[i], !(!c.selected && i !== e || (l.optDisabled ? c.disabled : null !== c.getAttribute("disabled")) || c.parentNode.disabled && n.nodeName(c.parentNode, "optgroup"))) { | ||
2567 | if (b = n(c).val(), f) return b; | ||
2568 | g.push(b) | ||
2569 | } | ||
2570 | return g | ||
2571 | }, | ||
2572 | set: function(a, b) { | ||
2573 | var c, d, e = a.options, | ||
2574 | f = n.makeArray(b), | ||
2575 | g = e.length; | ||
2576 | while (g--) | ||
2577 | if (d = e[g], n.inArray(n.valHooks.option.get(d), f) >= 0) try { | ||
2578 | d.selected = c = !0 | ||
2579 | } catch (h) { | ||
2580 | d.scrollHeight | ||
2581 | } else d.selected = !1; | ||
2582 | return c || (a.selectedIndex = -1), e | ||
2583 | } | ||
2584 | } | ||
2585 | } | ||
2586 | }), n.each(["radio", "checkbox"], function() { | ||
2587 | n.valHooks[this] = { | ||
2588 | set: function(a, b) { | ||
2589 | return n.isArray(b) ? a.checked = n.inArray(n(a).val(), b) >= 0 : void 0 | ||
2590 | } | ||
2591 | }, l.checkOn || (n.valHooks[this].get = function(a) { | ||
2592 | return null === a.getAttribute("value") ? "on" : a.value | ||
2593 | }) | ||
2594 | }); | ||
2595 | var nc, oc, pc = n.expr.attrHandle, | ||
2596 | qc = /^(?:checked|selected)$/i, | ||
2597 | rc = l.getSetAttribute, | ||
2598 | sc = l.input; | ||
2599 | n.fn.extend({ | ||
2600 | attr: function(a, b) { | ||
2601 | return W(this, n.attr, a, b, arguments.length > 1) | ||
2602 | }, | ||
2603 | removeAttr: function(a) { | ||
2604 | return this.each(function() { | ||
2605 | n.removeAttr(this, a) | ||
2606 | }) | ||
2607 | } | ||
2608 | }), n.extend({ | ||
2609 | attr: function(a, b, c) { | ||
2610 | var d, e, f = a.nodeType; | ||
2611 | if (a && 3 !== f && 8 !== f && 2 !== f) return typeof a.getAttribute === L ? n.prop(a, b, c) : (1 === f && n.isXMLDoc(a) || (b = b.toLowerCase(), d = n.attrHooks[b] || (n.expr.match.bool.test(b) ? oc : nc)), void 0 === c ? d && "get" in d && null !== (e = d.get(a, b)) ? e : (e = n.find.attr(a, b), null == e ? void 0 : e) : null !== c ? d && "set" in d && void 0 !== (e = d.set(a, c, b)) ? e : (a.setAttribute(b, c + ""), c) : void n.removeAttr(a, b)) | ||
2612 | }, | ||
2613 | removeAttr: function(a, b) { | ||
2614 | var c, d, e = 0, | ||
2615 | f = b && b.match(F); | ||
2616 | if (f && 1 === a.nodeType) | ||
2617 | while (c = f[e++]) d = n.propFix[c] || c, n.expr.match.bool.test(c) ? sc && rc || !qc.test(c) ? a[d] = !1 : a[n.camelCase("default-" + c)] = a[d] = !1 : n.attr(a, c, ""), a.removeAttribute(rc ? c : d) | ||
2618 | }, | ||
2619 | attrHooks: { | ||
2620 | type: { | ||
2621 | set: function(a, b) { | ||
2622 | if (!l.radioValue && "radio" === b && n.nodeName(a, "input")) { | ||
2623 | var c = a.value; | ||
2624 | return a.setAttribute("type", b), c && (a.value = c), b | ||
2625 | } | ||
2626 | } | ||
2627 | } | ||
2628 | } | ||
2629 | }), oc = { | ||
2630 | set: function(a, b, c) { | ||
2631 | return b === !1 ? n.removeAttr(a, c) : sc && rc || !qc.test(c) ? a.setAttribute(!rc && n.propFix[c] || c, c) : a[n.camelCase("default-" + c)] = a[c] = !0, c | ||
2632 | } | ||
2633 | }, n.each(n.expr.match.bool.source.match(/\w+/g), function(a, b) { | ||
2634 | var c = pc[b] || n.find.attr; | ||
2635 | pc[b] = sc && rc || !qc.test(b) ? function(a, b, d) { | ||
2636 | var e, f; | ||
2637 | return d || (f = pc[b], pc[b] = e, e = null != c(a, b, d) ? b.toLowerCase() : null, pc[b] = f), e | ||
2638 | } : function(a, b, c) { | ||
2639 | return c ? void 0 : a[n.camelCase("default-" + b)] ? b.toLowerCase() : null | ||
2640 | } | ||
2641 | }), sc && rc || (n.attrHooks.value = { | ||
2642 | set: function(a, b, c) { | ||
2643 | return n.nodeName(a, "input") ? void(a.defaultValue = b) : nc && nc.set(a, b, c) | ||
2644 | } | ||
2645 | }), rc || (nc = { | ||
2646 | set: function(a, b, c) { | ||
2647 | var d = a.getAttributeNode(c); | ||
2648 | return d || a.setAttributeNode(d = a.ownerDocument.createAttribute(c)), d.value = b += "", "value" === c || b === a.getAttribute(c) ? b : void 0 | ||
2649 | } | ||
2650 | }, pc.id = pc.name = pc.coords = function(a, b, c) { | ||
2651 | var d; | ||
2652 | return c ? void 0 : (d = a.getAttributeNode(b)) && "" !== d.value ? d.value : null | ||
2653 | }, n.valHooks.button = { | ||
2654 | get: function(a, b) { | ||
2655 | var c = a.getAttributeNode(b); | ||
2656 | return c && c.specified ? c.value : void 0 | ||
2657 | }, | ||
2658 | set: nc.set | ||
2659 | }, n.attrHooks.contenteditable = { | ||
2660 | set: function(a, b, c) { | ||
2661 | nc.set(a, "" === b ? !1 : b, c) | ||
2662 | } | ||
2663 | }, n.each(["width", "height"], function(a, b) { | ||
2664 | n.attrHooks[b] = { | ||
2665 | set: function(a, c) { | ||
2666 | return "" === c ? (a.setAttribute(b, "auto"), c) : void 0 | ||
2667 | } | ||
2668 | } | ||
2669 | })), l.style || (n.attrHooks.style = { | ||
2670 | get: function(a) { | ||
2671 | return a.style.cssText || void 0 | ||
2672 | }, | ||
2673 | set: function(a, b) { | ||
2674 | return a.style.cssText = b + "" | ||
2675 | } | ||
2676 | }); | ||
2677 | var tc = /^(?:input|select|textarea|button|object)$/i, | ||
2678 | uc = /^(?:a|area)$/i; | ||
2679 | n.fn.extend({ | ||
2680 | prop: function(a, b) { | ||
2681 | return W(this, n.prop, a, b, arguments.length > 1) | ||
2682 | }, | ||
2683 | removeProp: function(a) { | ||
2684 | return a = n.propFix[a] || a, this.each(function() { | ||
2685 | try { | ||
2686 | this[a] = void 0, delete this[a] | ||
2687 | } catch (b) {} | ||
2688 | }) | ||
2689 | } | ||
2690 | }), n.extend({ | ||
2691 | propFix: { | ||
2692 | "for": "htmlFor", | ||
2693 | "class": "className" | ||
2694 | }, | ||
2695 | prop: function(a, b, c) { | ||
2696 | var d, e, f, g = a.nodeType; | ||
2697 | if (a && 3 !== g && 8 !== g && 2 !== g) return f = 1 !== g || !n.isXMLDoc(a), f && (b = n.propFix[b] || b, e = n.propHooks[b]), void 0 !== c ? e && "set" in e && void 0 !== (d = e.set(a, c, b)) ? d : a[b] = c : e && "get" in e && null !== (d = e.get(a, b)) ? d : a[b] | ||
2698 | }, | ||
2699 | propHooks: { | ||
2700 | tabIndex: { | ||
2701 | get: function(a) { | ||
2702 | var b = n.find.attr(a, "tabindex"); | ||
2703 | return b ? parseInt(b, 10) : tc.test(a.nodeName) || uc.test(a.nodeName) && a.href ? 0 : -1 | ||
2704 | } | ||
2705 | } | ||
2706 | } | ||
2707 | }), l.hrefNormalized || n.each(["href", "src"], function(a, b) { | ||
2708 | n.propHooks[b] = { | ||
2709 | get: function(a) { | ||
2710 | return a.getAttribute(b, 4) | ||
2711 | } | ||
2712 | } | ||
2713 | }), l.optSelected || (n.propHooks.selected = { | ||
2714 | get: function(a) { | ||
2715 | var b = a.parentNode; | ||
2716 | return b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex), null | ||
2717 | } | ||
2718 | }), n.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() { | ||
2719 | n.propFix[this.toLowerCase()] = this | ||
2720 | }), l.enctype || (n.propFix.enctype = "encoding"); | ||
2721 | var vc = /[\t\r\n\f]/g; | ||
2722 | n.fn.extend({ | ||
2723 | addClass: function(a) { | ||
2724 | var b, c, d, e, f, g, h = 0, | ||
2725 | i = this.length, | ||
2726 | j = "string" == typeof a && a; | ||
2727 | if (n.isFunction(a)) return this.each(function(b) { | ||
2728 | n(this).addClass(a.call(this, b, this.className)) | ||
2729 | }); | ||
2730 | if (j) | ||
2731 | for (b = (a || "").match(F) || []; i > h; h++) | ||
2732 | if (c = this[h], d = 1 === c.nodeType && (c.className ? (" " + c.className + " ").replace(vc, " ") : " ")) { | ||
2733 | f = 0; | ||
2734 | while (e = b[f++]) d.indexOf(" " + e + " ") < 0 && (d += e + " "); | ||
2735 | g = n.trim(d), c.className !== g && (c.className = g) | ||
2736 | } | ||
2737 | return this | ||
2738 | }, | ||
2739 | removeClass: function(a) { | ||
2740 | var b, c, d, e, f, g, h = 0, | ||
2741 | i = this.length, | ||
2742 | j = 0 === arguments.length || "string" == typeof a && a; | ||
2743 | if (n.isFunction(a)) return this.each(function(b) { | ||
2744 | n(this).removeClass(a.call(this, b, this.className)) | ||
2745 | }); | ||
2746 | if (j) | ||
2747 | for (b = (a || "").match(F) || []; i > h; h++) | ||
2748 | if (c = this[h], d = 1 === c.nodeType && (c.className ? (" " + c.className + " ").replace(vc, " ") : "")) { | ||
2749 | f = 0; | ||
2750 | while (e = b[f++]) | ||
2751 | while (d.indexOf(" " + e + " ") >= 0) d = d.replace(" " + e + " ", " "); | ||
2752 | g = a ? n.trim(d) : "", c.className !== g && (c.className = g) | ||
2753 | } | ||
2754 | return this | ||
2755 | }, | ||
2756 | toggleClass: function(a, b) { | ||
2757 | var c = typeof a; | ||
2758 | return "boolean" == typeof b && "string" === c ? b ? this.addClass(a) : this.removeClass(a) : this.each(n.isFunction(a) ? function(c) { | ||
2759 | n(this).toggleClass(a.call(this, c, this.className, b), b) | ||
2760 | } : function() { | ||
2761 | if ("string" === c) { | ||
2762 | var b, d = 0, | ||
2763 | e = n(this), | ||
2764 | f = a.match(F) || []; | ||
2765 | while (b = f[d++]) e.hasClass(b) ? e.removeClass(b) : e.addClass(b) | ||
2766 | } else(c === L || "boolean" === c) && (this.className && n._data(this, "__className__", this.className), this.className = this.className || a === !1 ? "" : n._data(this, "__className__") || "") | ||
2767 | }) | ||
2768 | }, | ||
2769 | hasClass: function(a) { | ||
2770 | for (var b = " " + a + " ", c = 0, d = this.length; d > c; c++) | ||
2771 | if (1 === this[c].nodeType && (" " + this[c].className + " ").replace(vc, " ").indexOf(b) >= 0) return !0; | ||
2772 | return !1 | ||
2773 | } | ||
2774 | }), n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function(a, b) { | ||
2775 | n.fn[b] = function(a, c) { | ||
2776 | return arguments.length > 0 ? this.on(b, null, a, c) : this.trigger(b) | ||
2777 | } | ||
2778 | }), n.fn.extend({ | ||
2779 | hover: function(a, b) { | ||
2780 | return this.mouseenter(a).mouseleave(b || a) | ||
2781 | }, | ||
2782 | bind: function(a, b, c) { | ||
2783 | return this.on(a, null, b, c) | ||
2784 | }, | ||
2785 | unbind: function(a, b) { | ||
2786 | return this.off(a, null, b) | ||
2787 | }, | ||
2788 | delegate: function(a, b, c, d) { | ||
2789 | return this.on(b, a, c, d) | ||
2790 | }, | ||
2791 | undelegate: function(a, b, c) { | ||
2792 | return 1 === arguments.length ? this.off(a, "**") : this.off(b, a || "**", c) | ||
2793 | } | ||
2794 | }); | ||
2795 | var wc = n.now(), | ||
2796 | xc = /\?/, | ||
2797 | yc = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; | ||
2798 | n.parseJSON = function(b) { | ||
2799 | if (a.JSON && a.JSON.parse) return a.JSON.parse(b + ""); | ||
2800 | var c, d = null, | ||
2801 | e = n.trim(b + ""); | ||
2802 | return e && !n.trim(e.replace(yc, function(a, b, e, f) { | ||
2803 | return c && b && (d = 0), 0 === d ? a : (c = e || b, d += !f - !e, "") | ||
2804 | })) ? Function("return " + e)() : n.error("Invalid JSON: " + b) | ||
2805 | }, n.parseXML = function(b) { | ||
2806 | var c, d; | ||
2807 | if (!b || "string" != typeof b) return null; | ||
2808 | try { | ||
2809 | a.DOMParser ? (d = new DOMParser, c = d.parseFromString(b, "text/xml")) : (c = new ActiveXObject("Microsoft.XMLDOM"), c.async = "false", c.loadXML(b)) | ||
2810 | } catch (e) { | ||
2811 | c = void 0 | ||
2812 | } | ||
2813 | return c && c.documentElement && !c.getElementsByTagName("parsererror").length || n.error("Invalid XML: " + b), c | ||
2814 | }; | ||
2815 | var zc, Ac, Bc = /#.*$/, | ||
2816 | Cc = /([?&])_=[^&]*/, | ||
2817 | Dc = /^(.*?):[ \t]*([^\r\n]*)\r?$/gm, | ||
2818 | Ec = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | ||
2819 | Fc = /^(?:GET|HEAD)$/, | ||
2820 | Gc = /^\/\//, | ||
2821 | Hc = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, | ||
2822 | Ic = {}, | ||
2823 | Jc = {}, | ||
2824 | Kc = "*/".concat("*"); | ||
2825 | try { | ||
2826 | Ac = location.href | ||
2827 | } catch (Lc) { | ||
2828 | Ac = z.createElement("a"), Ac.href = "", Ac = Ac.href | ||
2829 | } | ||
2830 | zc = Hc.exec(Ac.toLowerCase()) || []; | ||
2831 | |||
2832 | function Mc(a) { | ||
2833 | return function(b, c) { | ||
2834 | "string" != typeof b && (c = b, b = "*"); | ||
2835 | var d, e = 0, | ||
2836 | f = b.toLowerCase().match(F) || []; | ||
2837 | if (n.isFunction(c)) | ||
2838 | while (d = f[e++]) "+" === d.charAt(0) ? (d = d.slice(1) || "*", (a[d] = a[d] || []).unshift(c)) : (a[d] = a[d] || []).push(c) | ||
2839 | } | ||
2840 | } | ||
2841 | |||
2842 | function Nc(a, b, c, d) { | ||
2843 | var e = {}, | ||
2844 | f = a === Jc; | ||
2845 | |||
2846 | function g(h) { | ||
2847 | var i; | ||
2848 | return e[h] = !0, n.each(a[h] || [], function(a, h) { | ||
2849 | var j = h(b, c, d); | ||
2850 | return "string" != typeof j || f || e[j] ? f ? !(i = j) : void 0 : (b.dataTypes.unshift(j), g(j), !1) | ||
2851 | }), i | ||
2852 | } | ||
2853 | return g(b.dataTypes[0]) || !e["*"] && g("*") | ||
2854 | } | ||
2855 | |||
2856 | function Oc(a, b) { | ||
2857 | var c, d, e = n.ajaxSettings.flatOptions || {}; | ||
2858 | for (d in b) void 0 !== b[d] && ((e[d] ? a : c || (c = {}))[d] = b[d]); | ||
2859 | return c && n.extend(!0, a, c), a | ||
2860 | } | ||
2861 | |||
2862 | function Pc(a, b, c) { | ||
2863 | var d, e, f, g, h = a.contents, | ||
2864 | i = a.dataTypes; | ||
2865 | while ("*" === i[0]) i.shift(), void 0 === e && (e = a.mimeType || b.getResponseHeader("Content-Type")); | ||
2866 | if (e) | ||
2867 | for (g in h) | ||
2868 | if (h[g] && h[g].test(e)) { | ||
2869 | i.unshift(g); | ||
2870 | break | ||
2871 | } | ||
2872 | if (i[0] in c) f = i[0]; | ||
2873 | else { | ||
2874 | for (g in c) { | ||
2875 | if (!i[0] || a.converters[g + " " + i[0]]) { | ||
2876 | f = g; | ||
2877 | break | ||
2878 | } | ||
2879 | d || (d = g) | ||
2880 | } | ||
2881 | f = f || d | ||
2882 | } | ||
2883 | return f ? (f !== i[0] && i.unshift(f), c[f]) : void 0 | ||
2884 | } | ||
2885 | |||
2886 | function Qc(a, b, c, d) { | ||
2887 | var e, f, g, h, i, j = {}, | ||
2888 | k = a.dataTypes.slice(); | ||
2889 | if (k[1]) | ||
2890 | for (g in a.converters) j[g.toLowerCase()] = a.converters[g]; | ||
2891 | f = k.shift(); | ||
2892 | while (f) | ||
2893 | if (a.responseFields[f] && (c[a.responseFields[f]] = b), !i && d && a.dataFilter && (b = a.dataFilter(b, a.dataType)), i = f, f = k.shift()) | ||
2894 | if ("*" === f) f = i; | ||
2895 | else if ("*" !== i && i !== f) { | ||
2896 | if (g = j[i + " " + f] || j["* " + f], !g) | ||
2897 | for (e in j) | ||
2898 | if (h = e.split(" "), h[1] === f && (g = j[i + " " + h[0]] || j["* " + h[0]])) { | ||
2899 | g === !0 ? g = j[e] : j[e] !== !0 && (f = h[0], k.unshift(h[1])); | ||
2900 | break | ||
2901 | } | ||
2902 | if (g !== !0) | ||
2903 | if (g && a["throws"]) b = g(b); | ||
2904 | else try { | ||
2905 | b = g(b) | ||
2906 | } catch (l) { | ||
2907 | return { | ||
2908 | state: "parsererror", | ||
2909 | error: g ? l : "No conversion from " + i + " to " + f | ||
2910 | } | ||
2911 | } | ||
2912 | } | ||
2913 | return { | ||
2914 | state: "success", | ||
2915 | data: b | ||
2916 | } | ||
2917 | } | ||
2918 | n.extend({ | ||
2919 | active: 0, | ||
2920 | lastModified: {}, | ||
2921 | etag: {}, | ||
2922 | ajaxSettings: { | ||
2923 | url: Ac, | ||
2924 | type: "GET", | ||
2925 | isLocal: Ec.test(zc[1]), | ||
2926 | global: !0, | ||
2927 | processData: !0, | ||
2928 | async: !0, | ||
2929 | contentType: "application/x-www-form-urlencoded; charset=UTF-8", | ||
2930 | accepts: { | ||
2931 | "*": Kc, | ||
2932 | text: "text/plain", | ||
2933 | html: "text/html", | ||
2934 | xml: "application/xml, text/xml", | ||
2935 | json: "application/json, text/javascript" | ||
2936 | }, | ||
2937 | contents: { | ||
2938 | xml: /xml/, | ||
2939 | html: /html/, | ||
2940 | json: /json/ | ||
2941 | }, | ||
2942 | responseFields: { | ||
2943 | xml: "responseXML", | ||
2944 | text: "responseText", | ||
2945 | json: "responseJSON" | ||
2946 | }, | ||
2947 | converters: { | ||
2948 | "* text": String, | ||
2949 | "text html": !0, | ||
2950 | "text json": n.parseJSON, | ||
2951 | "text xml": n.parseXML | ||
2952 | }, | ||
2953 | flatOptions: { | ||
2954 | url: !0, | ||
2955 | context: !0 | ||
2956 | } | ||
2957 | }, | ||
2958 | ajaxSetup: function(a, b) { | ||
2959 | return b ? Oc(Oc(a, n.ajaxSettings), b) : Oc(n.ajaxSettings, a) | ||
2960 | }, | ||
2961 | ajaxPrefilter: Mc(Ic), | ||
2962 | ajaxTransport: Mc(Jc), | ||
2963 | ajax: function(a, b) { | ||
2964 | "object" == typeof a && (b = a, a = void 0), b = b || {}; | ||
2965 | var c, d, e, f, g, h, i, j, k = n.ajaxSetup({}, b), | ||
2966 | l = k.context || k, | ||
2967 | m = k.context && (l.nodeType || l.jquery) ? n(l) : n.event, | ||
2968 | o = n.Deferred(), | ||
2969 | p = n.Callbacks("once memory"), | ||
2970 | q = k.statusCode || {}, | ||
2971 | r = {}, | ||
2972 | s = {}, | ||
2973 | t = 0, | ||
2974 | u = "canceled", | ||
2975 | v = { | ||
2976 | readyState: 0, | ||
2977 | getResponseHeader: function(a) { | ||
2978 | var b; | ||
2979 | if (2 === t) { | ||
2980 | if (!j) { | ||
2981 | j = {}; | ||
2982 | while (b = Dc.exec(f)) j[b[1].toLowerCase()] = b[2] | ||
2983 | } | ||
2984 | b = j[a.toLowerCase()] | ||
2985 | } | ||
2986 | return null == b ? null : b | ||
2987 | }, | ||
2988 | getAllResponseHeaders: function() { | ||
2989 | return 2 === t ? f : null | ||
2990 | }, | ||
2991 | setRequestHeader: function(a, b) { | ||
2992 | var c = a.toLowerCase(); | ||
2993 | return t || (a = s[c] = s[c] || a, r[a] = b), this | ||
2994 | }, | ||
2995 | overrideMimeType: function(a) { | ||
2996 | return t || (k.mimeType = a), this | ||
2997 | }, | ||
2998 | statusCode: function(a) { | ||
2999 | var b; | ||
3000 | if (a) | ||
3001 | if (2 > t) | ||
3002 | for (b in a) q[b] = [q[b], a[b]]; | ||
3003 | else v.always(a[v.status]); | ||
3004 | return this | ||
3005 | }, | ||
3006 | abort: function(a) { | ||
3007 | var b = a || u; | ||
3008 | return i && i.abort(b), x(0, b), this | ||
3009 | } | ||
3010 | }; | ||
3011 | if (o.promise(v).complete = p.add, v.success = v.done, v.error = v.fail, k.url = ((a || k.url || Ac) + "").replace(Bc, "").replace(Gc, zc[1] + "//"), k.type = b.method || b.type || k.method || k.type, k.dataTypes = n.trim(k.dataType || "*").toLowerCase().match(F) || [""], null == k.crossDomain && (c = Hc.exec(k.url.toLowerCase()), k.crossDomain = !(!c || c[1] === zc[1] && c[2] === zc[2] && (c[3] || ("http:" === c[1] ? "80" : "443")) === (zc[3] || ("http:" === zc[1] ? "80" : "443")))), k.data && k.processData && "string" != typeof k.data && (k.data = n.param(k.data, k.traditional)), Nc(Ic, k, b, v), 2 === t) return v; | ||
3012 | h = k.global, h && 0 === n.active++ && n.event.trigger("ajaxStart"), k.type = k.type.toUpperCase(), k.hasContent = !Fc.test(k.type), e = k.url, k.hasContent || (k.data && (e = k.url += (xc.test(e) ? "&" : "?") + k.data, delete k.data), k.cache === !1 && (k.url = Cc.test(e) ? e.replace(Cc, "$1_=" + wc++) : e + (xc.test(e) ? "&" : "?") + "_=" + wc++)), k.ifModified && (n.lastModified[e] && v.setRequestHeader("If-Modified-Since", n.lastModified[e]), n.etag[e] && v.setRequestHeader("If-None-Match", n.etag[e])), (k.data && k.hasContent && k.contentType !== !1 || b.contentType) && v.setRequestHeader("Content-Type", k.contentType), v.setRequestHeader("Accept", k.dataTypes[0] && k.accepts[k.dataTypes[0]] ? k.accepts[k.dataTypes[0]] + ("*" !== k.dataTypes[0] ? ", " + Kc + "; q=0.01" : "") : k.accepts["*"]); | ||
3013 | for (d in k.headers) v.setRequestHeader(d, k.headers[d]); | ||
3014 | if (k.beforeSend && (k.beforeSend.call(l, v, k) === !1 || 2 === t)) return v.abort(); | ||
3015 | u = "abort"; | ||
3016 | for (d in { | ||
3017 | success: 1, | ||
3018 | error: 1, | ||
3019 | complete: 1 | ||
3020 | }) v[d](k[d]); | ||
3021 | if (i = Nc(Jc, k, b, v)) { | ||
3022 | v.readyState = 1, h && m.trigger("ajaxSend", [v, k]), k.async && k.timeout > 0 && (g = setTimeout(function() { | ||
3023 | v.abort("timeout") | ||
3024 | }, k.timeout)); | ||
3025 | try { | ||
3026 | t = 1, i.send(r, x) | ||
3027 | } catch (w) { | ||
3028 | if (!(2 > t)) throw w; | ||
3029 | x(-1, w) | ||
3030 | } | ||
3031 | } else x(-1, "No Transport"); | ||
3032 | |||
3033 | function x(a, b, c, d) { | ||
3034 | var j, r, s, u, w, x = b; | ||
3035 | 2 !== t && (t = 2, g && clearTimeout(g), i = void 0, f = d || "", v.readyState = a > 0 ? 4 : 0, j = a >= 200 && 300 > a || 304 === a, c && (u = Pc(k, v, c)), u = Qc(k, u, v, j), j ? (k.ifModified && (w = v.getResponseHeader("Last-Modified"), w && (n.lastModified[e] = w), w = v.getResponseHeader("etag"), w && (n.etag[e] = w)), 204 === a || "HEAD" === k.type ? x = "nocontent" : 304 === a ? x = "notmodified" : (x = u.state, r = u.data, s = u.error, j = !s)) : (s = x, (a || !x) && (x = "error", 0 > a && (a = 0))), v.status = a, v.statusText = (b || x) + "", j ? o.resolveWith(l, [r, x, v]) : o.rejectWith(l, [v, x, s]), v.statusCode(q), q = void 0, h && m.trigger(j ? "ajaxSuccess" : "ajaxError", [v, k, j ? r : s]), p.fireWith(l, [v, x]), h && (m.trigger("ajaxComplete", [v, k]), --n.active || n.event.trigger("ajaxStop"))) | ||
3036 | } | ||
3037 | return v | ||
3038 | }, | ||
3039 | getJSON: function(a, b, c) { | ||
3040 | return n.get(a, b, c, "json") | ||
3041 | }, | ||
3042 | getScript: function(a, b) { | ||
3043 | return n.get(a, void 0, b, "script") | ||
3044 | } | ||
3045 | }), n.each(["get", "post"], function(a, b) { | ||
3046 | n[b] = function(a, c, d, e) { | ||
3047 | return n.isFunction(c) && (e = e || d, d = c, c = void 0), n.ajax({ | ||
3048 | url: a, | ||
3049 | type: b, | ||
3050 | dataType: e, | ||
3051 | data: c, | ||
3052 | success: d | ||
3053 | }) | ||
3054 | } | ||
3055 | }), n.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(a, b) { | ||
3056 | n.fn[b] = function(a) { | ||
3057 | return this.on(b, a) | ||
3058 | } | ||
3059 | }), n._evalUrl = function(a) { | ||
3060 | return n.ajax({ | ||
3061 | url: a, | ||
3062 | type: "GET", | ||
3063 | dataType: "script", | ||
3064 | async: !1, | ||
3065 | global: !1, | ||
3066 | "throws": !0 | ||
3067 | }) | ||
3068 | }, n.fn.extend({ | ||
3069 | wrapAll: function(a) { | ||
3070 | if (n.isFunction(a)) return this.each(function(b) { | ||
3071 | n(this).wrapAll(a.call(this, b)) | ||
3072 | }); | ||
3073 | if (this[0]) { | ||
3074 | var b = n(a, this[0].ownerDocument).eq(0).clone(!0); | ||
3075 | this[0].parentNode && b.insertBefore(this[0]), b.map(function() { | ||
3076 | var a = this; | ||
3077 | while (a.firstChild && 1 === a.firstChild.nodeType) a = a.firstChild; | ||
3078 | return a | ||
3079 | }).append(this) | ||
3080 | } | ||
3081 | return this | ||
3082 | }, | ||
3083 | wrapInner: function(a) { | ||
3084 | return this.each(n.isFunction(a) ? function(b) { | ||
3085 | n(this).wrapInner(a.call(this, b)) | ||
3086 | } : function() { | ||
3087 | var b = n(this), | ||
3088 | c = b.contents(); | ||
3089 | c.length ? c.wrapAll(a) : b.append(a) | ||
3090 | }) | ||
3091 | }, | ||
3092 | wrap: function(a) { | ||
3093 | var b = n.isFunction(a); | ||
3094 | return this.each(function(c) { | ||
3095 | n(this).wrapAll(b ? a.call(this, c) : a) | ||
3096 | }) | ||
3097 | }, | ||
3098 | unwrap: function() { | ||
3099 | return this.parent().each(function() { | ||
3100 | n.nodeName(this, "body") || n(this).replaceWith(this.childNodes) | ||
3101 | }).end() | ||
3102 | } | ||
3103 | }), n.expr.filters.hidden = function(a) { | ||
3104 | return a.offsetWidth <= 0 && a.offsetHeight <= 0 || !l.reliableHiddenOffsets() && "none" === (a.style && a.style.display || n.css(a, "display")) | ||
3105 | }, n.expr.filters.visible = function(a) { | ||
3106 | return !n.expr.filters.hidden(a) | ||
3107 | }; | ||
3108 | var Rc = /%20/g, | ||
3109 | Sc = /\[\]$/, | ||
3110 | Tc = /\r?\n/g, | ||
3111 | Uc = /^(?:submit|button|image|reset|file)$/i, | ||
3112 | Vc = /^(?:input|select|textarea|keygen)/i; | ||
3113 | |||
3114 | function Wc(a, b, c, d) { | ||
3115 | var e; | ||
3116 | if (n.isArray(b)) n.each(b, function(b, e) { | ||
3117 | c || Sc.test(a) ? d(a, e) : Wc(a + "[" + ("object" == typeof e ? b : "") + "]", e, c, d) | ||
3118 | }); | ||
3119 | else if (c || "object" !== n.type(b)) d(a, b); | ||
3120 | else | ||
3121 | for (e in b) Wc(a + "[" + e + "]", b[e], c, d) | ||
3122 | } | ||
3123 | n.param = function(a, b) { | ||
3124 | var c, d = [], | ||
3125 | e = function(a, b) { | ||
3126 | b = n.isFunction(b) ? b() : null == b ? "" : b, d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b) | ||
3127 | }; | ||
3128 | if (void 0 === b && (b = n.ajaxSettings && n.ajaxSettings.traditional), n.isArray(a) || a.jquery && !n.isPlainObject(a)) n.each(a, function() { | ||
3129 | e(this.name, this.value) | ||
3130 | }); | ||
3131 | else | ||
3132 | for (c in a) Wc(c, a[c], b, e); | ||
3133 | return d.join("&").replace(Rc, "+") | ||
3134 | }, n.fn.extend({ | ||
3135 | serialize: function() { | ||
3136 | return n.param(this.serializeArray()) | ||
3137 | }, | ||
3138 | serializeArray: function() { | ||
3139 | return this.map(function() { | ||
3140 | var a = n.prop(this, "elements"); | ||
3141 | return a ? n.makeArray(a) : this | ||
3142 | }).filter(function() { | ||
3143 | var a = this.type; | ||
3144 | return this.name && !n(this).is(":disabled") && Vc.test(this.nodeName) && !Uc.test(a) && (this.checked || !X.test(a)) | ||
3145 | }).map(function(a, b) { | ||
3146 | var c = n(this).val(); | ||
3147 | return null == c ? null : n.isArray(c) ? n.map(c, function(a) { | ||
3148 | return { | ||
3149 | name: b.name, | ||
3150 | value: a.replace(Tc, "\r\n") | ||
3151 | } | ||
3152 | }) : { | ||
3153 | name: b.name, | ||
3154 | value: c.replace(Tc, "\r\n") | ||
3155 | } | ||
3156 | }).get() | ||
3157 | } | ||
3158 | }), n.ajaxSettings.xhr = void 0 !== a.ActiveXObject ? function() { | ||
3159 | return !this.isLocal && /^(get|post|head|put|delete|options)$/i.test(this.type) && $c() || _c() | ||
3160 | } : $c; | ||
3161 | var Xc = 0, | ||
3162 | Yc = {}, | ||
3163 | Zc = n.ajaxSettings.xhr(); | ||
3164 | a.ActiveXObject && n(a).on("unload", function() { | ||
3165 | for (var a in Yc) Yc[a](void 0, !0) | ||
3166 | }), l.cors = !!Zc && "withCredentials" in Zc, Zc = l.ajax = !!Zc, Zc && n.ajaxTransport(function(a) { | ||
3167 | if (!a.crossDomain || l.cors) { | ||
3168 | var b; | ||
3169 | return { | ||
3170 | send: function(c, d) { | ||
3171 | var e, f = a.xhr(), | ||
3172 | g = ++Xc; | ||
3173 | if (f.open(a.type, a.url, a.async, a.username, a.password), a.xhrFields) | ||
3174 | for (e in a.xhrFields) f[e] = a.xhrFields[e]; | ||
3175 | a.mimeType && f.overrideMimeType && f.overrideMimeType(a.mimeType), a.crossDomain || c["X-Requested-With"] || (c["X-Requested-With"] = "XMLHttpRequest"); | ||
3176 | for (e in c) void 0 !== c[e] && f.setRequestHeader(e, c[e] + ""); | ||
3177 | f.send(a.hasContent && a.data || null), b = function(c, e) { | ||
3178 | var h, i, j; | ||
3179 | if (b && (e || 4 === f.readyState)) | ||
3180 | if (delete Yc[g], b = void 0, f.onreadystatechange = n.noop, e) 4 !== f.readyState && f.abort(); | ||
3181 | else { | ||
3182 | j = {}, h = f.status, "string" == typeof f.responseText && (j.text = f.responseText); | ||
3183 | try { | ||
3184 | i = f.statusText | ||
3185 | } catch (k) { | ||
3186 | i = "" | ||
3187 | } | ||
3188 | h || !a.isLocal || a.crossDomain ? 1223 === h && (h = 204) : h = j.text ? 200 : 404 | ||
3189 | } | ||
3190 | j && d(h, i, j, f.getAllResponseHeaders()) | ||
3191 | }, a.async ? 4 === f.readyState ? setTimeout(b) : f.onreadystatechange = Yc[g] = b : b() | ||
3192 | }, | ||
3193 | abort: function() { | ||
3194 | b && b(void 0, !0) | ||
3195 | } | ||
3196 | } | ||
3197 | } | ||
3198 | }); | ||
3199 | |||
3200 | function $c() { | ||
3201 | try { | ||
3202 | return new a.XMLHttpRequest | ||
3203 | } catch (b) {} | ||
3204 | } | ||
3205 | |||
3206 | function _c() { | ||
3207 | try { | ||
3208 | return new a.ActiveXObject("Microsoft.XMLHTTP") | ||
3209 | } catch (b) {} | ||
3210 | } | ||
3211 | n.ajaxSetup({ | ||
3212 | accepts: { | ||
3213 | script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | ||
3214 | }, | ||
3215 | contents: { | ||
3216 | script: /(?:java|ecma)script/ | ||
3217 | }, | ||
3218 | converters: { | ||
3219 | "text script": function(a) { | ||
3220 | return n.globalEval(a), a | ||
3221 | } | ||
3222 | } | ||
3223 | }), n.ajaxPrefilter("script", function(a) { | ||
3224 | void 0 === a.cache && (a.cache = !1), a.crossDomain && (a.type = "GET", a.global = !1) | ||
3225 | }), n.ajaxTransport("script", function(a) { | ||
3226 | if (a.crossDomain) { | ||
3227 | var b, c = z.head || n("head")[0] || z.documentElement; | ||
3228 | return { | ||
3229 | send: function(d, e) { | ||
3230 | b = z.createElement("script"), b.async = !0, a.scriptCharset && (b.charset = a.scriptCharset), b.src = a.url, b.onload = b.onreadystatechange = function(a, c) { | ||
3231 | (c || !b.readyState || /loaded|complete/.test(b.readyState)) && (b.onload = b.onreadystatechange = null, b.parentNode && b.parentNode.removeChild(b), b = null, c || e(200, "success")) | ||
3232 | }, c.insertBefore(b, c.firstChild) | ||
3233 | }, | ||
3234 | abort: function() { | ||
3235 | b && b.onload(void 0, !0) | ||
3236 | } | ||
3237 | } | ||
3238 | } | ||
3239 | }); | ||
3240 | var ad = [], | ||
3241 | bd = /(=)\?(?=&|$)|\?\?/; | ||
3242 | n.ajaxSetup({ | ||
3243 | jsonp: "callback", | ||
3244 | jsonpCallback: function() { | ||
3245 | var a = ad.pop() || n.expando + "_" + wc++; | ||
3246 | return this[a] = !0, a | ||
3247 | } | ||
3248 | }), n.ajaxPrefilter("json jsonp", function(b, c, d) { | ||
3249 | var e, f, g, h = b.jsonp !== !1 && (bd.test(b.url) ? "url" : "string" == typeof b.data && !(b.contentType || "").indexOf("application/x-www-form-urlencoded") && bd.test(b.data) && "data"); | ||
3250 | return h || "jsonp" === b.dataTypes[0] ? (e = b.jsonpCallback = n.isFunction(b.jsonpCallback) ? b.jsonpCallback() : b.jsonpCallback, h ? b[h] = b[h].replace(bd, "$1" + e) : b.jsonp !== !1 && (b.url += (xc.test(b.url) ? "&" : "?") + b.jsonp + "=" + e), b.converters["script json"] = function() { | ||
3251 | return g || n.error(e + " was not called"), g[0] | ||
3252 | }, b.dataTypes[0] = "json", f = a[e], a[e] = function() { | ||
3253 | g = arguments | ||
3254 | }, d.always(function() { | ||
3255 | a[e] = f, b[e] && (b.jsonpCallback = c.jsonpCallback, ad.push(e)), g && n.isFunction(f) && f(g[0]), g = f = void 0 | ||
3256 | }), "script") : void 0 | ||
3257 | }), n.parseHTML = function(a, b, c) { | ||
3258 | if (!a || "string" != typeof a) return null; | ||
3259 | "boolean" == typeof b && (c = b, b = !1), b = b || z; | ||
3260 | var d = v.exec(a), | ||
3261 | e = !c && []; | ||
3262 | return d ? [b.createElement(d[1])] : (d = n.buildFragment([a], b, e), e && e.length && n(e).remove(), n.merge([], d.childNodes)) | ||
3263 | }; | ||
3264 | var cd = n.fn.load; | ||
3265 | n.fn.load = function(a, b, c) { | ||
3266 | if ("string" != typeof a && cd) return cd.apply(this, arguments); | ||
3267 | var d, e, f, g = this, | ||
3268 | h = a.indexOf(" "); | ||
3269 | return h >= 0 && (d = a.slice(h, a.length), a = a.slice(0, h)), n.isFunction(b) ? (c = b, b = void 0) : b && "object" == typeof b && (f = "POST"), g.length > 0 && n.ajax({ | ||
3270 | url: a, | ||
3271 | type: f, | ||
3272 | dataType: "html", | ||
3273 | data: b | ||
3274 | }).done(function(a) { | ||
3275 | e = arguments, g.html(d ? n("<div>").append(n.parseHTML(a)).find(d) : a) | ||
3276 | }).complete(c && function(a, b) { | ||
3277 | g.each(c, e || [a.responseText, b, a]) | ||
3278 | }), this | ||
3279 | }, n.expr.filters.animated = function(a) { | ||
3280 | return n.grep(n.timers, function(b) { | ||
3281 | return a === b.elem | ||
3282 | }).length | ||
3283 | }; | ||
3284 | var dd = a.document.documentElement; | ||
3285 | |||
3286 | function ed(a) { | ||
3287 | return n.isWindow(a) ? a : 9 === a.nodeType ? a.defaultView || a.parentWindow : !1 | ||
3288 | } | ||
3289 | n.offset = { | ||
3290 | setOffset: function(a, b, c) { | ||
3291 | var d, e, f, g, h, i, j, k = n.css(a, "position"), | ||
3292 | l = n(a), | ||
3293 | m = {}; | ||
3294 | "static" === k && (a.style.position = "relative"), h = l.offset(), f = n.css(a, "top"), i = n.css(a, "left"), j = ("absolute" === k || "fixed" === k) && n.inArray("auto", [f, i]) > -1, j ? (d = l.position(), g = d.top, e = d.left) : (g = parseFloat(f) || 0, e = parseFloat(i) || 0), n.isFunction(b) && (b = b.call(a, c, h)), null != b.top && (m.top = b.top - h.top + g), null != b.left && (m.left = b.left - h.left + e), "using" in b ? b.using.call(a, m) : l.css(m) | ||
3295 | } | ||
3296 | }, n.fn.extend({ | ||
3297 | offset: function(a) { | ||
3298 | if (arguments.length) return void 0 === a ? this : this.each(function(b) { | ||
3299 | n.offset.setOffset(this, a, b) | ||
3300 | }); | ||
3301 | var b, c, d = { | ||
3302 | top: 0, | ||
3303 | left: 0 | ||
3304 | }, | ||
3305 | e = this[0], | ||
3306 | f = e && e.ownerDocument; | ||
3307 | if (f) return b = f.documentElement, n.contains(b, e) ? (typeof e.getBoundingClientRect !== L && (d = e.getBoundingClientRect()), c = ed(f), { | ||
3308 | top: d.top + (c.pageYOffset || b.scrollTop) - (b.clientTop || 0), | ||
3309 | left: d.left + (c.pageXOffset || b.scrollLeft) - (b.clientLeft || 0) | ||
3310 | }) : d | ||
3311 | }, | ||
3312 | position: function() { | ||
3313 | if (this[0]) { | ||
3314 | var a, b, c = { | ||
3315 | top: 0, | ||
3316 | left: 0 | ||
3317 | }, | ||
3318 | d = this[0]; | ||
3319 | return "fixed" === n.css(d, "position") ? b = d.getBoundingClientRect() : (a = this.offsetParent(), b = this.offset(), n.nodeName(a[0], "html") || (c = a.offset()), c.top += n.css(a[0], "borderTopWidth", !0), c.left += n.css(a[0], "borderLeftWidth", !0)), { | ||
3320 | top: b.top - c.top - n.css(d, "marginTop", !0), | ||
3321 | left: b.left - c.left - n.css(d, "marginLeft", !0) | ||
3322 | } | ||
3323 | } | ||
3324 | }, | ||
3325 | offsetParent: function() { | ||
3326 | return this.map(function() { | ||
3327 | var a = this.offsetParent || dd; | ||
3328 | while (a && !n.nodeName(a, "html") && "static" === n.css(a, "position")) a = a.offsetParent; | ||
3329 | return a || dd | ||
3330 | }) | ||
3331 | } | ||
3332 | }), n.each({ | ||
3333 | scrollLeft: "pageXOffset", | ||
3334 | scrollTop: "pageYOffset" | ||
3335 | }, function(a, b) { | ||
3336 | var c = /Y/.test(b); | ||
3337 | n.fn[a] = function(d) { | ||
3338 | return W(this, function(a, d, e) { | ||
3339 | var f = ed(a); | ||
3340 | return void 0 === e ? f ? b in f ? f[b] : f.document.documentElement[d] : a[d] : void(f ? f.scrollTo(c ? n(f).scrollLeft() : e, c ? e : n(f).scrollTop()) : a[d] = e) | ||
3341 | }, a, d, arguments.length, null) | ||
3342 | } | ||
3343 | }), n.each(["top", "left"], function(a, b) { | ||
3344 | n.cssHooks[b] = Mb(l.pixelPosition, function(a, c) { | ||
3345 | return c ? (c = Kb(a, b), Ib.test(c) ? n(a).position()[b] + "px" : c) : void 0 | ||
3346 | }) | ||
3347 | }), n.each({ | ||
3348 | Height: "height", | ||
3349 | Width: "width" | ||
3350 | }, function(a, b) { | ||
3351 | n.each({ | ||
3352 | padding: "inner" + a, | ||
3353 | content: b, | ||
3354 | "": "outer" + a | ||
3355 | }, function(c, d) { | ||
3356 | n.fn[d] = function(d, e) { | ||
3357 | var f = arguments.length && (c || "boolean" != typeof d), | ||
3358 | g = c || (d === !0 || e === !0 ? "margin" : "border"); | ||
3359 | return W(this, function(b, c, d) { | ||
3360 | var e; | ||
3361 | return n.isWindow(b) ? b.document.documentElement["client" + a] : 9 === b.nodeType ? (e = b.documentElement, Math.max(b.body["scroll" + a], e["scroll" + a], b.body["offset" + a], e["offset" + a], e["client" + a])) : void 0 === d ? n.css(b, c, g) : n.style(b, c, d, g) | ||
3362 | }, b, f ? d : void 0, f, null) | ||
3363 | } | ||
3364 | }) | ||
3365 | }), n.fn.size = function() { | ||
3366 | return this.length | ||
3367 | }, n.fn.andSelf = n.fn.addBack, "function" == typeof define && define.amd && define("jquery", [], function() { | ||
3368 | return n | ||
3369 | }); | ||
3370 | var fd = a.jQuery, | ||
3371 | gd = a.$; | ||
3372 | return n.noConflict = function(b) { | ||
3373 | return a.$ === n && (a.$ = gd), b && a.jQuery === n && (a.jQuery = fd), n | ||
3374 | }, typeof b === L && (a.jQuery = a.$ = n), n | ||
3375 | }); \ No newline at end of file | ||
diff --git a/deprecated/ZJW/javascripts/jquery.swatchbook.js b/deprecated/ZJW/javascripts/jquery.swatchbook.js new file mode 100644 index 0000000..dc6ce43 --- /dev/null +++ b/deprecated/ZJW/javascripts/jquery.swatchbook.js | |||
@@ -0,0 +1,255 @@ | |||
1 | /** | ||
2 | * jquery.swatchbook.js v1.1.0 | ||
3 | * http://www.codrops.com | ||
4 | * | ||
5 | * Licensed under the MIT license. | ||
6 | * http://www.opensource.org/licenses/mit-license.php | ||
7 | * | ||
8 | * Copyright 2012, Codrops | ||
9 | * http://www.codrops.com | ||
10 | */ | ||
11 | |||
12 | ; | ||
13 | (function($, window, undefined) { | ||
14 | |||
15 | 'use strict'; | ||
16 | |||
17 | // global | ||
18 | var Modernizr = window.Modernizr; | ||
19 | |||
20 | jQuery.fn.reverse = [].reverse; | ||
21 | |||
22 | $.SwatchBook = function(options, element) { | ||
23 | |||
24 | this.$el = $(element); | ||
25 | this._init(options); | ||
26 | |||
27 | }; | ||
28 | |||
29 | $.SwatchBook.defaults = { | ||
30 | // index of initial centered item | ||
31 | center: 6, | ||
32 | // number of degrees that is between each item | ||
33 | angleInc: 8, | ||
34 | speed: 700, | ||
35 | easing: 'ease', | ||
36 | // amount in degrees for the opened item's next sibling | ||
37 | proximity: 45, | ||
38 | // amount in degrees between the opened item's next siblings | ||
39 | neighbor: 4, | ||
40 | // animate on load | ||
41 | onLoadAnim: true, | ||
42 | // if it should be closed by default | ||
43 | initclosed: false, | ||
44 | // index of the element that when clicked, triggers the open/close function | ||
45 | // by default there is no such element | ||
46 | closeIdx: -1, | ||
47 | // open one specific item initially (overrides initclosed) | ||
48 | openAt: -1 | ||
49 | }; | ||
50 | |||
51 | $.SwatchBook.prototype = { | ||
52 | |||
53 | _init: function(options) { | ||
54 | |||
55 | this.options = $.extend(true, {}, $.SwatchBook.defaults, options); | ||
56 | |||
57 | this.$items = this.$el.children('div'); | ||
58 | this.itemsCount = this.$items.length; | ||
59 | this.current = -1; | ||
60 | this.support = Modernizr.csstransitions; | ||
61 | this.cache = []; | ||
62 | |||
63 | if (this.options.onLoadAnim) { | ||
64 | this._setTransition(); | ||
65 | } | ||
66 | |||
67 | if (!this.options.initclosed) { | ||
68 | this._center(this.options.center, this.options.onLoadAnim); | ||
69 | } else { | ||
70 | |||
71 | this.isClosed = true; | ||
72 | if (!this.options.onLoadAnim) { | ||
73 | this._setTransition(); | ||
74 | } | ||
75 | |||
76 | } | ||
77 | |||
78 | if (this.options.openAt >= 0 && this.options.openAt < this.itemsCount) { | ||
79 | this._openItem(this.$items.eq(this.options.openAt)); | ||
80 | } | ||
81 | |||
82 | this._initEvents(); | ||
83 | |||
84 | }, | ||
85 | _setTransition: function() { | ||
86 | |||
87 | if (this.support) { | ||
88 | this.$items.css({ | ||
89 | 'transition': 'all ' + this.options.speed + 'ms ' + this.options.easing | ||
90 | }); | ||
91 | } | ||
92 | |||
93 | }, | ||
94 | _openclose: function() { | ||
95 | |||
96 | this.isClosed ? this._center(this.options.center, true) : this.$items.css({ | ||
97 | 'transform': 'rotate(0deg)' | ||
98 | }); | ||
99 | this.isClosed = !this.isClosed; | ||
100 | |||
101 | }, | ||
102 | _center: function(idx, anim) { | ||
103 | |||
104 | var self = this; | ||
105 | |||
106 | this.$items.each(function(i) { | ||
107 | |||
108 | var transformStr = 'rotate(' + (self.options.angleInc * (i - idx)) + 'deg)'; | ||
109 | $(this).css({ | ||
110 | 'transform': transformStr | ||
111 | }); | ||
112 | |||
113 | }); | ||
114 | |||
115 | }, | ||
116 | _openItem: function($item) { | ||
117 | |||
118 | var itmIdx = $item.index(); | ||
119 | |||
120 | if (itmIdx !== this.current) { | ||
121 | |||
122 | if (this.options.closeIdx !== -1 && itmIdx === this.options.closeIdx) { | ||
123 | |||
124 | this._openclose(); | ||
125 | this._setCurrent(); | ||
126 | |||
127 | } else { | ||
128 | |||
129 | this._setCurrent($item); | ||
130 | $item.css({ | ||
131 | 'transform': 'rotate(0deg)' | ||
132 | }); | ||
133 | this._rotateSiblings($item); | ||
134 | |||
135 | } | ||
136 | |||
137 | } | ||
138 | |||
139 | }, | ||
140 | _initEvents: function() { | ||
141 | |||
142 | var self = this; | ||
143 | |||
144 | this.$items.on('click.swatchbook', function(event) { | ||
145 | self._openItem($(this)); | ||
146 | }); | ||
147 | |||
148 | }, | ||
149 | _rotateSiblings: function($item) { | ||
150 | |||
151 | var self = this, | ||
152 | idx = $item.index(), | ||
153 | $cached = this.cache[idx], | ||
154 | $siblings; | ||
155 | |||
156 | if ($cached) { | ||
157 | $siblings = $cached; | ||
158 | } else { | ||
159 | |||
160 | $siblings = $item.siblings(); | ||
161 | this.cache[idx] = $siblings; | ||
162 | |||
163 | } | ||
164 | |||
165 | $siblings.each(function(i) { | ||
166 | |||
167 | var rotateVal = i < idx ? | ||
168 | self.options.angleInc * (i - idx) : | ||
169 | i - idx === 1 ? | ||
170 | self.options.proximity : | ||
171 | self.options.proximity + (i - idx - 1) * self.options.neighbor; | ||
172 | |||
173 | var transformStr = 'rotate(' + rotateVal + 'deg)'; | ||
174 | |||
175 | $(this).css({ | ||
176 | 'transform': transformStr | ||
177 | }); | ||
178 | |||
179 | }); | ||
180 | |||
181 | }, | ||
182 | _setCurrent: function($el) { | ||
183 | |||
184 | this.current = $el ? $el.index() : -1; | ||
185 | this.$items.removeClass('ff-active'); | ||
186 | if ($el) { | ||
187 | $el.addClass('ff-active'); | ||
188 | } | ||
189 | |||
190 | } | ||
191 | |||
192 | }; | ||
193 | |||
194 | var logError = function(message) { | ||
195 | |||
196 | if (window.console) { | ||
197 | |||
198 | window.console.error(message); | ||
199 | |||
200 | } | ||
201 | |||
202 | }; | ||
203 | |||
204 | $.fn.swatchbook = function(options) { | ||
205 | |||
206 | var instance = $.data(this, 'swatchbook'); | ||
207 | |||
208 | if (typeof options === 'string') { | ||
209 | |||
210 | var args = Array.prototype.slice.call(arguments, 1); | ||
211 | |||
212 | this.each(function() { | ||
213 | |||
214 | if (!instance) { | ||
215 | |||
216 | logError("cannot call methods on swatchbook prior to initialization; " + | ||
217 | "attempted to call method '" + options + "'"); | ||
218 | return; | ||
219 | |||
220 | } | ||
221 | |||
222 | if (!$.isFunction(instance[options]) || options.charAt(0) === "_") { | ||
223 | |||
224 | logError("no such method '" + options + "' for swatchbook instance"); | ||
225 | return; | ||
226 | |||
227 | } | ||
228 | |||
229 | instance[options].apply(instance, args); | ||
230 | |||
231 | }); | ||
232 | |||
233 | } else { | ||
234 | |||
235 | this.each(function() { | ||
236 | |||
237 | if (instance) { | ||
238 | |||
239 | instance._init(); | ||
240 | |||
241 | } else { | ||
242 | |||
243 | instance = $.data(this, 'swatchbook', new $.SwatchBook(options, this)); | ||
244 | |||
245 | } | ||
246 | |||
247 | }); | ||
248 | |||
249 | } | ||
250 | |||
251 | return instance; | ||
252 | |||
253 | }; | ||
254 | |||
255 | })(jQuery, window); \ No newline at end of file | ||
diff --git a/deprecated/ZJW/javascripts/modernizr.custom.79639.js b/deprecated/ZJW/javascripts/modernizr.custom.79639.js new file mode 100644 index 0000000..23b151c --- /dev/null +++ b/deprecated/ZJW/javascripts/modernizr.custom.79639.js | |||
@@ -0,0 +1,167 @@ | |||
1 | /* Modernizr 2.5.3 (Custom Build) | MIT & BSD | ||
2 | * Build: http://www.modernizr.com/download/#-cssanimations-csstransforms-csstransforms3d-csstransitions-shiv-cssclasses-teststyles-testprop-testallprops-prefixes-domprefixes | ||
3 | */ | ||
4 | ; | ||
5 | window.Modernizr = function(a, b, c) { | ||
6 | function z(a) { | ||
7 | j.cssText = a | ||
8 | } | ||
9 | |||
10 | function A(a, b) { | ||
11 | return z(m.join(a + ";") + (b || "")) | ||
12 | } | ||
13 | |||
14 | function B(a, b) { | ||
15 | return typeof a === b | ||
16 | } | ||
17 | |||
18 | function C(a, b) { | ||
19 | return !!~("" + a).indexOf(b) | ||
20 | } | ||
21 | |||
22 | function D(a, b) { | ||
23 | for (var d in a) | ||
24 | if (j[a[d]] !== c) return b == "pfx" ? a[d] : !0; | ||
25 | return !1 | ||
26 | } | ||
27 | |||
28 | function E(a, b, d) { | ||
29 | for (var e in a) { | ||
30 | var f = b[a[e]]; | ||
31 | if (f !== c) return d === !1 ? a[e] : B(f, "function") ? f.bind(d || b) : f | ||
32 | } | ||
33 | return !1 | ||
34 | } | ||
35 | |||
36 | function F(a, b, c) { | ||
37 | var d = a.charAt(0).toUpperCase() + a.substr(1), | ||
38 | e = (a + " " + o.join(d + " ") + d).split(" "); | ||
39 | return B(b, "string") || B(b, "undefined") ? D(e, b) : (e = (a + " " + p.join(d + " ") + d).split(" "), E(e, b, c)) | ||
40 | } | ||
41 | var d = "2.5.3", | ||
42 | e = {}, | ||
43 | f = !0, | ||
44 | g = b.documentElement, | ||
45 | h = "modernizr", | ||
46 | i = b.createElement(h), | ||
47 | j = i.style, | ||
48 | k, l = {}.toString, | ||
49 | m = " -webkit- -moz- -o- -ms- ".split(" "), | ||
50 | n = "Webkit Moz O ms", | ||
51 | o = n.split(" "), | ||
52 | p = n.toLowerCase().split(" "), | ||
53 | q = {}, | ||
54 | r = {}, | ||
55 | s = {}, | ||
56 | t = [], | ||
57 | u = t.slice, | ||
58 | v, w = function(a, c, d, e) { | ||
59 | var f, i, j, k = b.createElement("div"), | ||
60 | l = b.body, | ||
61 | m = l ? l : b.createElement("body"); | ||
62 | if (parseInt(d, 10)) | ||
63 | while (d--) j = b.createElement("div"), j.id = e ? e[d] : h + (d + 1), k.appendChild(j); | ||
64 | return f = ["­", "<style>", a, "</style>"].join(""), k.id = h, (l ? k : m).innerHTML += f, m.appendChild(k), l || (m.style.background = "", g.appendChild(m)), i = c(k, a), l ? k.parentNode.removeChild(k) : m.parentNode.removeChild(m), !!i | ||
65 | }, | ||
66 | x = {}.hasOwnProperty, | ||
67 | y; | ||
68 | !B(x, "undefined") && !B(x.call, "undefined") ? y = function(a, b) { | ||
69 | return x.call(a, b) | ||
70 | } : y = function(a, b) { | ||
71 | return b in a && B(a.constructor.prototype[b], "undefined") | ||
72 | }, Function.prototype.bind || (Function.prototype.bind = function(b) { | ||
73 | var c = this; | ||
74 | if (typeof c != "function") throw new TypeError; | ||
75 | var d = u.call(arguments, 1), | ||
76 | e = function() { | ||
77 | if (this instanceof e) { | ||
78 | var a = function() {}; | ||
79 | a.prototype = c.prototype; | ||
80 | var f = new a, | ||
81 | g = c.apply(f, d.concat(u.call(arguments))); | ||
82 | return Object(g) === g ? g : f | ||
83 | } | ||
84 | return c.apply(b, d.concat(u.call(arguments))) | ||
85 | }; | ||
86 | return e | ||
87 | }); | ||
88 | var G = function(a, c) { | ||
89 | var d = a.join(""), | ||
90 | f = c.length; | ||
91 | w(d, function(a, c) { | ||
92 | var d = b.styleSheets[b.styleSheets.length - 1], | ||
93 | g = d ? d.cssRules && d.cssRules[0] ? d.cssRules[0].cssText : d.cssText || "" : "", | ||
94 | h = a.childNodes, | ||
95 | i = {}; | ||
96 | while (f--) i[h[f].id] = h[f]; | ||
97 | e.csstransforms3d = (i.csstransforms3d && i.csstransforms3d.offsetLeft) === 9 && i.csstransforms3d.offsetHeight === 3 | ||
98 | }, f, c) | ||
99 | }([, ["@media (", m.join("transform-3d),("), h, ")", "{#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join("")], [, "csstransforms3d"]); | ||
100 | q.cssanimations = function() { | ||
101 | return F("animationName") | ||
102 | }, q.csstransforms = function() { | ||
103 | return !!F("transform") | ||
104 | }, q.csstransforms3d = function() { | ||
105 | var a = !!F("perspective"); | ||
106 | return a && "webkitPerspective" in g.style && (a = e.csstransforms3d), a | ||
107 | }, q.csstransitions = function() { | ||
108 | return F("transition") | ||
109 | }; | ||
110 | for (var H in q) y(q, H) && (v = H.toLowerCase(), e[v] = q[H](), t.push((e[v] ? "" : "no-") + v)); | ||
111 | return z(""), i = k = null, | ||
112 | function(a, b) { | ||
113 | function g(a, b) { | ||
114 | var c = a.createElement("p"), | ||
115 | d = a.getElementsByTagName("head")[0] || a.documentElement; | ||
116 | return c.innerHTML = "x<style>" + b + "</style>", d.insertBefore(c.lastChild, d.firstChild) | ||
117 | } | ||
118 | |||
119 | function h() { | ||
120 | var a = k.elements; | ||
121 | return typeof a == "string" ? a.split(" ") : a | ||
122 | } | ||
123 | |||
124 | function i(a) { | ||
125 | var b = {}, | ||
126 | c = a.createElement, | ||
127 | e = a.createDocumentFragment, | ||
128 | f = e(); | ||
129 | a.createElement = function(a) { | ||
130 | var e = (b[a] || (b[a] = c(a))).cloneNode(); | ||
131 | return k.shivMethods && e.canHaveChildren && !d.test(a) ? f.appendChild(e) : e | ||
132 | }, a.createDocumentFragment = Function("h,f", "return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&(" + h().join().replace(/\w+/g, function(a) { | ||
133 | return b[a] = c(a), f.createElement(a), 'c("' + a + '")' | ||
134 | }) + ");return n}")(k, f) | ||
135 | } | ||
136 | |||
137 | function j(a) { | ||
138 | var b; | ||
139 | return a.documentShived ? a : (k.shivCSS && !e && (b = !!g(a, "article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")), f || (b = !i(a)), b && (a.documentShived = b), a) | ||
140 | } | ||
141 | var c = a.html5 || {}, | ||
142 | d = /^<|^(?:button|form|map|select|textarea)$/i, | ||
143 | e, f; | ||
144 | (function() { | ||
145 | var a = b.createElement("a"); | ||
146 | a.innerHTML = "<xyz></xyz>", e = "hidden" in a, f = a.childNodes.length == 1 || function() { | ||
147 | try { | ||
148 | b.createElement("a") | ||
149 | } catch (a) { | ||
150 | return !0 | ||
151 | } | ||
152 | var c = b.createDocumentFragment(); | ||
153 | return typeof c.cloneNode == "undefined" || typeof c.createDocumentFragment == "undefined" || typeof c.createElement == "undefined" | ||
154 | }() | ||
155 | })(); | ||
156 | var k = { | ||
157 | elements: c.elements || "abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video", | ||
158 | shivCSS: c.shivCSS !== !1, | ||
159 | shivMethods: c.shivMethods !== !1, | ||
160 | type: "default", | ||
161 | shivDocument: j | ||
162 | }; | ||
163 | a.html5 = k, j(b) | ||
164 | }(this, b), e._version = d, e._prefixes = m, e._domPrefixes = p, e._cssomPrefixes = o, e.testProp = function(a) { | ||
165 | return D([a]) | ||
166 | }, e.testAllProps = F, e.testStyles = w, g.className = g.className.replace(/(^|\s)no-js(\s|$)/, "$1$2") + (f ? " js " + t.join(" ") : ""), e | ||
167 | }(this, this.document); \ No newline at end of file | ||
diff --git a/deprecated/ZJW/javascripts/modernizr.js b/deprecated/ZJW/javascripts/modernizr.js new file mode 100644 index 0000000..3ecc284 --- /dev/null +++ b/deprecated/ZJW/javascripts/modernizr.js | |||
@@ -0,0 +1,8 @@ | |||
1 | /* Modernizr 2.7.1 (Custom Build) | MIT & BSD | ||
2 | * Build: http://modernizr.com/download/#-video-touch-shiv-cssclasses-teststyles-prefixes-cssclassprefix:w!mod! | ||
3 | */ | ||
4 | ;window.Modernizr=function(a,b,c){function w(a){j.cssText=a}function x(a,b){return w(m.join(a+";")+(b||""))}function y(a,b){return typeof a===b}function z(a,b){return!!~(""+a).indexOf(b)}function A(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:y(f,"function")?f.bind(d||b):f}return!1}var d="2.7.1",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={},o={},p={},q=[],r=q.slice,s,t=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},u={}.hasOwnProperty,v;!y(u,"undefined")&&!y(u.call,"undefined")?v=function(a,b){return u.call(a,b)}:v=function(a,b){return b in a&&y(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:t(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},n.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c};for(var B in n)v(n,B)&&(s=B.toLowerCase(),e[s]=n[B](),q.push((e[s]?"":"no-")+s));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)v(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" w-mod-"+(b?"":"no-")+a),e[a]=b}return e},w(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=m,e.testStyles=t,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" w-mod-js w-mod-"+q.join(" w-mod-"):""),e}(this,this.document); | ||
5 | /** | ||
6 | * Webflow: Custom tests | ||
7 | */ | ||
8 | Modernizr.addTest('ios', /(ipod|iphone|ipad)/i.test(navigator.userAgent)); | ||
diff --git a/deprecated/ZJW/javascripts/processing.min.js b/deprecated/ZJW/javascripts/processing.min.js new file mode 100644 index 0000000..81e7fe8 --- /dev/null +++ b/deprecated/ZJW/javascripts/processing.min.js | |||
@@ -0,0 +1,12665 @@ | |||
1 | /*** | ||
2 | |||
3 | P R O C E S S I N G . J S - 1.4.1 | ||
4 | a port of the Processing visualization language | ||
5 | |||
6 | Processing.js is licensed under the MIT License, see LICENSE. | ||
7 | For a list of copyright holders, please refer to AUTHORS. | ||
8 | |||
9 | http://processingjs.org | ||
10 | |||
11 | ***/ | ||
12 | |||
13 | (function(D, d, q, t) { | ||
14 | var G = function() {}; | ||
15 | var s = function() { | ||
16 | if ("console" in D) { | ||
17 | return function(N) { | ||
18 | D.console.log("Processing.js: " + N) | ||
19 | } | ||
20 | } | ||
21 | return G | ||
22 | }(); | ||
23 | var w = function(N) { | ||
24 | var O = new XMLHttpRequest; | ||
25 | O.open("GET", N, false); | ||
26 | if (O.overrideMimeType) { | ||
27 | O.overrideMimeType("text/plain") | ||
28 | } | ||
29 | O.setRequestHeader("If-Modified-Since", "Fri, 01 Jan 1960 00:00:00 GMT"); | ||
30 | O.send(null); | ||
31 | if (O.status !== 200 && O.status !== 0) { | ||
32 | throw "XMLHttpRequest failed, status code " + O.status | ||
33 | } | ||
34 | return O.responseText | ||
35 | }; | ||
36 | var n = "document" in this && !("fake" in this.document); | ||
37 | d.head = d.head || d.getElementsByTagName("head")[0]; | ||
38 | |||
39 | function C(N, O) { | ||
40 | if (N in D) { | ||
41 | return D[N] | ||
42 | } | ||
43 | if (typeof D[O] === "function") { | ||
44 | return D[O] | ||
45 | } | ||
46 | return function(Q) { | ||
47 | if (Q instanceof Array) { | ||
48 | return Q | ||
49 | } | ||
50 | if (typeof Q === "number") { | ||
51 | var P = []; | ||
52 | P.length = Q; | ||
53 | return P | ||
54 | } | ||
55 | } | ||
56 | } | ||
57 | if (d.documentMode >= 9 && !d.doctype) { | ||
58 | throw "The doctype directive is missing. The recommended doctype in Internet Explorer is the HTML5 doctype: <!DOCTYPE html>" | ||
59 | } | ||
60 | var e = C("Float32Array", "WebGLFloatArray"), | ||
61 | K = C("Int32Array", "WebGLIntArray"), | ||
62 | y = C("Uint16Array", "WebGLUnsignedShortArray"), | ||
63 | b = C("Uint8Array", "WebGLUnsignedByteArray"); | ||
64 | var B = { | ||
65 | X: 0, | ||
66 | Y: 1, | ||
67 | Z: 2, | ||
68 | R: 3, | ||
69 | G: 4, | ||
70 | B: 5, | ||
71 | A: 6, | ||
72 | U: 7, | ||
73 | V: 8, | ||
74 | NX: 9, | ||
75 | NY: 10, | ||
76 | NZ: 11, | ||
77 | EDGE: 12, | ||
78 | SR: 13, | ||
79 | SG: 14, | ||
80 | SB: 15, | ||
81 | SA: 16, | ||
82 | SW: 17, | ||
83 | TX: 18, | ||
84 | TY: 19, | ||
85 | TZ: 20, | ||
86 | VX: 21, | ||
87 | VY: 22, | ||
88 | VZ: 23, | ||
89 | VW: 24, | ||
90 | AR: 25, | ||
91 | AG: 26, | ||
92 | AB: 27, | ||
93 | DR: 3, | ||
94 | DG: 4, | ||
95 | DB: 5, | ||
96 | DA: 6, | ||
97 | SPR: 28, | ||
98 | SPG: 29, | ||
99 | SPB: 30, | ||
100 | SHINE: 31, | ||
101 | ER: 32, | ||
102 | EG: 33, | ||
103 | EB: 34, | ||
104 | BEEN_LIT: 35, | ||
105 | VERTEX_FIELD_COUNT: 36, | ||
106 | P2D: 1, | ||
107 | JAVA2D: 1, | ||
108 | WEBGL: 2, | ||
109 | P3D: 2, | ||
110 | OPENGL: 2, | ||
111 | PDF: 0, | ||
112 | DXF: 0, | ||
113 | OTHER: 0, | ||
114 | WINDOWS: 1, | ||
115 | MAXOSX: 2, | ||
116 | LINUX: 3, | ||
117 | EPSILON: 0.0001, | ||
118 | MAX_FLOAT: 3.4028235e+38, | ||
119 | MIN_FLOAT: -3.4028235e+38, | ||
120 | MAX_INT: 2147483647, | ||
121 | MIN_INT: -2147483648, | ||
122 | PI: q.PI, | ||
123 | TWO_PI: 2 * q.PI, | ||
124 | HALF_PI: q.PI / 2, | ||
125 | THIRD_PI: q.PI / 3, | ||
126 | QUARTER_PI: q.PI / 4, | ||
127 | DEG_TO_RAD: q.PI / 180, | ||
128 | RAD_TO_DEG: 180 / q.PI, | ||
129 | WHITESPACE: " \t\n\r\u000c\u00a0", | ||
130 | RGB: 1, | ||
131 | ARGB: 2, | ||
132 | HSB: 3, | ||
133 | ALPHA: 4, | ||
134 | CMYK: 5, | ||
135 | TIFF: 0, | ||
136 | TARGA: 1, | ||
137 | JPEG: 2, | ||
138 | GIF: 3, | ||
139 | BLUR: 11, | ||
140 | GRAY: 12, | ||
141 | INVERT: 13, | ||
142 | OPAQUE: 14, | ||
143 | POSTERIZE: 15, | ||
144 | THRESHOLD: 16, | ||
145 | ERODE: 17, | ||
146 | DILATE: 18, | ||
147 | REPLACE: 0, | ||
148 | BLEND: 1 << 0, | ||
149 | ADD: 1 << 1, | ||
150 | SUBTRACT: 1 << 2, | ||
151 | LIGHTEST: 1 << 3, | ||
152 | DARKEST: 1 << 4, | ||
153 | DIFFERENCE: 1 << 5, | ||
154 | EXCLUSION: 1 << 6, | ||
155 | MULTIPLY: 1 << 7, | ||
156 | SCREEN: 1 << 8, | ||
157 | OVERLAY: 1 << 9, | ||
158 | HARD_LIGHT: 1 << 10, | ||
159 | SOFT_LIGHT: 1 << 11, | ||
160 | DODGE: 1 << 12, | ||
161 | BURN: 1 << 13, | ||
162 | ALPHA_MASK: 4278190080, | ||
163 | RED_MASK: 16711680, | ||
164 | GREEN_MASK: 65280, | ||
165 | BLUE_MASK: 255, | ||
166 | CUSTOM: 0, | ||
167 | ORTHOGRAPHIC: 2, | ||
168 | PERSPECTIVE: 3, | ||
169 | POINT: 2, | ||
170 | POINTS: 2, | ||
171 | LINE: 4, | ||
172 | LINES: 4, | ||
173 | TRIANGLE: 8, | ||
174 | TRIANGLES: 9, | ||
175 | TRIANGLE_STRIP: 10, | ||
176 | TRIANGLE_FAN: 11, | ||
177 | QUAD: 16, | ||
178 | QUADS: 16, | ||
179 | QUAD_STRIP: 17, | ||
180 | POLYGON: 20, | ||
181 | PATH: 21, | ||
182 | RECT: 30, | ||
183 | ELLIPSE: 31, | ||
184 | ARC: 32, | ||
185 | SPHERE: 40, | ||
186 | BOX: 41, | ||
187 | GROUP: 0, | ||
188 | PRIMITIVE: 1, | ||
189 | GEOMETRY: 3, | ||
190 | VERTEX: 0, | ||
191 | BEZIER_VERTEX: 1, | ||
192 | CURVE_VERTEX: 2, | ||
193 | BREAK: 3, | ||
194 | CLOSESHAPE: 4, | ||
195 | OPEN: 1, | ||
196 | CLOSE: 2, | ||
197 | CORNER: 0, | ||
198 | CORNERS: 1, | ||
199 | RADIUS: 2, | ||
200 | CENTER_RADIUS: 2, | ||
201 | CENTER: 3, | ||
202 | DIAMETER: 3, | ||
203 | CENTER_DIAMETER: 3, | ||
204 | BASELINE: 0, | ||
205 | TOP: 101, | ||
206 | BOTTOM: 102, | ||
207 | NORMAL: 1, | ||
208 | NORMALIZED: 1, | ||
209 | IMAGE: 2, | ||
210 | MODEL: 4, | ||
211 | SHAPE: 5, | ||
212 | SQUARE: "butt", | ||
213 | ROUND: "round", | ||
214 | PROJECT: "square", | ||
215 | MITER: "miter", | ||
216 | BEVEL: "bevel", | ||
217 | AMBIENT: 0, | ||
218 | DIRECTIONAL: 1, | ||
219 | SPOT: 3, | ||
220 | BACKSPACE: 8, | ||
221 | TAB: 9, | ||
222 | ENTER: 10, | ||
223 | RETURN: 13, | ||
224 | ESC: 27, | ||
225 | DELETE: 127, | ||
226 | CODED: 65535, | ||
227 | SHIFT: 16, | ||
228 | CONTROL: 17, | ||
229 | ALT: 18, | ||
230 | CAPSLK: 20, | ||
231 | PGUP: 33, | ||
232 | PGDN: 34, | ||
233 | END: 35, | ||
234 | HOME: 36, | ||
235 | LEFT: 37, | ||
236 | UP: 38, | ||
237 | RIGHT: 39, | ||
238 | DOWN: 40, | ||
239 | F1: 112, | ||
240 | F2: 113, | ||
241 | F3: 114, | ||
242 | F4: 115, | ||
243 | F5: 116, | ||
244 | F6: 117, | ||
245 | F7: 118, | ||
246 | F8: 119, | ||
247 | F9: 120, | ||
248 | F10: 121, | ||
249 | F11: 122, | ||
250 | F12: 123, | ||
251 | NUMLK: 144, | ||
252 | META: 157, | ||
253 | INSERT: 155, | ||
254 | ARROW: "default", | ||
255 | CROSS: "crosshair", | ||
256 | HAND: "pointer", | ||
257 | MOVE: "move", | ||
258 | TEXT: "text", | ||
259 | WAIT: "wait", | ||
260 | NOCURSOR: "url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto", | ||
261 | DISABLE_OPENGL_2X_SMOOTH: 1, | ||
262 | ENABLE_OPENGL_2X_SMOOTH: -1, | ||
263 | ENABLE_OPENGL_4X_SMOOTH: 2, | ||
264 | ENABLE_NATIVE_FONTS: 3, | ||
265 | DISABLE_DEPTH_TEST: 4, | ||
266 | ENABLE_DEPTH_TEST: -4, | ||
267 | ENABLE_DEPTH_SORT: 5, | ||
268 | DISABLE_DEPTH_SORT: -5, | ||
269 | DISABLE_OPENGL_ERROR_REPORT: 6, | ||
270 | ENABLE_OPENGL_ERROR_REPORT: -6, | ||
271 | ENABLE_ACCURATE_TEXTURES: 7, | ||
272 | DISABLE_ACCURATE_TEXTURES: -7, | ||
273 | HINT_COUNT: 10, | ||
274 | SINCOS_LENGTH: 720, | ||
275 | PRECISIONB: 15, | ||
276 | PRECISIONF: 1 << 15, | ||
277 | PREC_MAXVAL: (1 << 15) - 1, | ||
278 | PREC_ALPHA_SHIFT: 24 - 15, | ||
279 | PREC_RED_SHIFT: 16 - 15, | ||
280 | NORMAL_MODE_AUTO: 0, | ||
281 | NORMAL_MODE_SHAPE: 1, | ||
282 | NORMAL_MODE_VERTEX: 2, | ||
283 | MAX_LIGHTS: 8 | ||
284 | }; | ||
285 | |||
286 | function h(P) { | ||
287 | if (typeof P === "string") { | ||
288 | var O = 0; | ||
289 | for (var N = 0; N < P.length; ++N) { | ||
290 | O = O * 31 + P.charCodeAt(N) & 4294967295 | ||
291 | } | ||
292 | return O | ||
293 | } | ||
294 | if (typeof P !== "object") { | ||
295 | return P & 4294967295 | ||
296 | } | ||
297 | if (P.hashCode instanceof Function) { | ||
298 | return P.hashCode() | ||
299 | } | ||
300 | if (P.$id === t) { | ||
301 | P.$id = q.floor(q.random() * 65536) - 32768 << 16 | q.floor(q.random() * 65536) | ||
302 | } | ||
303 | return P.$id | ||
304 | } | ||
305 | |||
306 | function r(O, N) { | ||
307 | if (O === null || N === null) { | ||
308 | return O === null && N === null | ||
309 | } | ||
310 | if (typeof O === "string") { | ||
311 | return O === N | ||
312 | } | ||
313 | if (typeof O !== "object") { | ||
314 | return O === N | ||
315 | } | ||
316 | if (O.equals instanceof Function) { | ||
317 | return O.equals(N) | ||
318 | } | ||
319 | return O === N | ||
320 | } | ||
321 | var o = function(O) { | ||
322 | if (O.iterator instanceof Function) { | ||
323 | return O.iterator() | ||
324 | } | ||
325 | if (O instanceof Array) { | ||
326 | var N = -1; | ||
327 | this.hasNext = function() { | ||
328 | return ++N < O.length | ||
329 | }; | ||
330 | this.next = function() { | ||
331 | return O[N] | ||
332 | } | ||
333 | } else { | ||
334 | throw "Unable to iterate: " + O | ||
335 | } | ||
336 | }; | ||
337 | var f = function() { | ||
338 | function O(Q) { | ||
339 | var P = 0; | ||
340 | this.hasNext = function() { | ||
341 | return P < Q.length | ||
342 | }; | ||
343 | this.next = function() { | ||
344 | return Q[P++] | ||
345 | }; | ||
346 | this.remove = function() { | ||
347 | Q.splice(P, 1) | ||
348 | } | ||
349 | } | ||
350 | |||
351 | function N(P) { | ||
352 | var Q; | ||
353 | if (P instanceof N) { | ||
354 | Q = P.toArray() | ||
355 | } else { | ||
356 | Q = []; | ||
357 | if (typeof P === "number") { | ||
358 | Q.length = P > 0 ? P : 0 | ||
359 | } | ||
360 | } | ||
361 | this.get = function(R) { | ||
362 | return Q[R] | ||
363 | }; | ||
364 | this.contains = function(R) { | ||
365 | return this.indexOf(R) > -1 | ||
366 | }; | ||
367 | this.indexOf = function(T) { | ||
368 | for (var S = 0, R = Q.length; S < R; ++S) { | ||
369 | if (r(T, Q[S])) { | ||
370 | return S | ||
371 | } | ||
372 | } | ||
373 | return -1 | ||
374 | }; | ||
375 | this.lastIndexOf = function(S) { | ||
376 | for (var R = Q.length - 1; R >= 0; --R) { | ||
377 | if (r(S, Q[R])) { | ||
378 | return R | ||
379 | } | ||
380 | } | ||
381 | return -1 | ||
382 | }; | ||
383 | this.add = function() { | ||
384 | if (arguments.length === 1) { | ||
385 | Q.push(arguments[0]) | ||
386 | } else { | ||
387 | if (arguments.length === 2) { | ||
388 | var R = arguments[0]; | ||
389 | if (typeof R === "number") { | ||
390 | if (R >= 0 && R <= Q.length) { | ||
391 | Q.splice(R, 0, arguments[1]) | ||
392 | } else { | ||
393 | throw R + " is not a valid index" | ||
394 | } | ||
395 | } else { | ||
396 | throw typeof R + " is not a number" | ||
397 | } | ||
398 | } else { | ||
399 | throw "Please use the proper number of parameters." | ||
400 | } | ||
401 | } | ||
402 | }; | ||
403 | this.addAll = function(S, R) { | ||
404 | var T; | ||
405 | if (typeof S === "number") { | ||
406 | if (S < 0 || S > Q.length) { | ||
407 | throw "Index out of bounds for addAll: " + S + " greater or equal than " + Q.length | ||
408 | } | ||
409 | T = new o(R); | ||
410 | while (T.hasNext()) { | ||
411 | Q.splice(S++, 0, T.next()) | ||
412 | } | ||
413 | } else { | ||
414 | T = new o(S); | ||
415 | while (T.hasNext()) { | ||
416 | Q.push(T.next()) | ||
417 | } | ||
418 | } | ||
419 | }; | ||
420 | this.set = function() { | ||
421 | if (arguments.length === 2) { | ||
422 | var R = arguments[0]; | ||
423 | if (typeof R === "number") { | ||
424 | if (R >= 0 && R < Q.length) { | ||
425 | Q.splice(R, 1, arguments[1]) | ||
426 | } else { | ||
427 | throw R + " is not a valid index." | ||
428 | } | ||
429 | } else { | ||
430 | throw typeof R + " is not a number" | ||
431 | } | ||
432 | } else { | ||
433 | throw "Please use the proper number of parameters." | ||
434 | } | ||
435 | }; | ||
436 | this.size = function() { | ||
437 | return Q.length | ||
438 | }; | ||
439 | this.clear = function() { | ||
440 | Q.length = 0 | ||
441 | }; | ||
442 | this.remove = function(R) { | ||
443 | if (typeof R === "number") { | ||
444 | return Q.splice(R, 1)[0] | ||
445 | } | ||
446 | R = this.indexOf(R); | ||
447 | if (R > -1) { | ||
448 | Q.splice(R, 1); | ||
449 | return true | ||
450 | } | ||
451 | return false | ||
452 | }; | ||
453 | this.removeAll = function(V) { | ||
454 | var S, R, U, T = new N; | ||
455 | T.addAll(this); | ||
456 | this.clear(); | ||
457 | for (S = 0, R = 0; S < T.size(); S++) { | ||
458 | U = T.get(S); | ||
459 | if (!V.contains(U)) { | ||
460 | this.add(R++, U) | ||
461 | } | ||
462 | } | ||
463 | if (this.size() < T.size()) { | ||
464 | return true | ||
465 | } | ||
466 | return false | ||
467 | }; | ||
468 | this.isEmpty = function() { | ||
469 | return !Q.length | ||
470 | }; | ||
471 | this.clone = function() { | ||
472 | return new N(this) | ||
473 | }; | ||
474 | this.toArray = function() { | ||
475 | return Q.slice(0) | ||
476 | }; | ||
477 | this.iterator = function() { | ||
478 | return new O(Q) | ||
479 | } | ||
480 | } | ||
481 | return N | ||
482 | }(); | ||
483 | var x = function() { | ||
484 | function N() { | ||
485 | if (arguments.length === 1 && arguments[0] instanceof N) { | ||
486 | return arguments[0].clone() | ||
487 | } | ||
488 | var W = arguments.length > 0 ? arguments[0] : 16; | ||
489 | var X = arguments.length > 1 ? arguments[1] : 0.75; | ||
490 | var Q = []; | ||
491 | Q.length = W; | ||
492 | var S = 0; | ||
493 | var O = this; | ||
494 | |||
495 | function U(Z) { | ||
496 | var Y = h(Z) % Q.length; | ||
497 | return Y < 0 ? Q.length + Y : Y | ||
498 | } | ||
499 | |||
500 | function R() { | ||
501 | if (S <= X * Q.length) { | ||
502 | return | ||
503 | } | ||
504 | var ab = []; | ||
505 | for (var aa = 0; aa < Q.length; ++aa) { | ||
506 | if (Q[aa] !== t) { | ||
507 | ab = ab.concat(Q[aa]) | ||
508 | } | ||
509 | } | ||
510 | var ac = Q.length * 2; | ||
511 | Q = []; | ||
512 | Q.length = ac; | ||
513 | for (var Z = 0; Z < ab.length; ++Z) { | ||
514 | var Y = U(ab[Z].key); | ||
515 | var ad = Q[Y]; | ||
516 | if (ad === t) { | ||
517 | Q[Y] = ad = [] | ||
518 | } | ||
519 | ad.push(ab[Z]) | ||
520 | } | ||
521 | } | ||
522 | |||
523 | function P(ad, ae) { | ||
524 | var Y = 0; | ||
525 | var ac = -1; | ||
526 | var ab = false; | ||
527 | var aa; | ||
528 | |||
529 | function Z() { | ||
530 | while (!ab) { | ||
531 | ++ac; | ||
532 | if (Y >= Q.length) { | ||
533 | ab = true | ||
534 | } else { | ||
535 | if (Q[Y] === t || ac >= Q[Y].length) { | ||
536 | ac = -1; | ||
537 | ++Y | ||
538 | } else { | ||
539 | return | ||
540 | } | ||
541 | } | ||
542 | } | ||
543 | } | ||
544 | this.hasNext = function() { | ||
545 | return !ab | ||
546 | }; | ||
547 | this.next = function() { | ||
548 | aa = ad(Q[Y][ac]); | ||
549 | Z(); | ||
550 | return aa | ||
551 | }; | ||
552 | this.remove = function() { | ||
553 | if (aa !== t) { | ||
554 | ae(aa); | ||
555 | --ac; | ||
556 | Z() | ||
557 | } | ||
558 | }; | ||
559 | Z() | ||
560 | } | ||
561 | |||
562 | function V(Y, Z, aa) { | ||
563 | this.clear = function() { | ||
564 | O.clear() | ||
565 | }; | ||
566 | this.contains = function(ab) { | ||
567 | return Z(ab) | ||
568 | }; | ||
569 | this.containsAll = function(ac) { | ||
570 | var ab = ac.iterator(); | ||
571 | while (ab.hasNext()) { | ||
572 | if (!this.contains(ab.next())) { | ||
573 | return false | ||
574 | } | ||
575 | } | ||
576 | return true | ||
577 | }; | ||
578 | this.isEmpty = function() { | ||
579 | return O.isEmpty() | ||
580 | }; | ||
581 | this.iterator = function() { | ||
582 | return new P(Y, aa) | ||
583 | }; | ||
584 | this.remove = function(ab) { | ||
585 | if (this.contains(ab)) { | ||
586 | aa(ab); | ||
587 | return true | ||
588 | } | ||
589 | return false | ||
590 | }; | ||
591 | this.removeAll = function(ae) { | ||
592 | var ab = ae.iterator(); | ||
593 | var ad = false; | ||
594 | while (ab.hasNext()) { | ||
595 | var ac = ab.next(); | ||
596 | if (this.contains(ac)) { | ||
597 | aa(ac); | ||
598 | ad = true | ||
599 | } | ||
600 | } | ||
601 | return true | ||
602 | }; | ||
603 | this.retainAll = function(af) { | ||
604 | var ad = this.iterator(); | ||
605 | var ac = []; | ||
606 | while (ad.hasNext()) { | ||
607 | var ae = ad.next(); | ||
608 | if (!af.contains(ae)) { | ||
609 | ac.push(ae) | ||
610 | } | ||
611 | } | ||
612 | for (var ab = 0; ab < ac.length; ++ab) { | ||
613 | aa(ac[ab]) | ||
614 | } | ||
615 | return ac.length > 0 | ||
616 | }; | ||
617 | this.size = function() { | ||
618 | return O.size() | ||
619 | }; | ||
620 | this.toArray = function() { | ||
621 | var ab = []; | ||
622 | var ac = this.iterator(); | ||
623 | while (ac.hasNext()) { | ||
624 | ab.push(ac.next()) | ||
625 | } | ||
626 | return ab | ||
627 | } | ||
628 | } | ||
629 | |||
630 | function T(Y) { | ||
631 | this._isIn = function(Z) { | ||
632 | return Z === O && Y.removed === t | ||
633 | }; | ||
634 | this.equals = function(Z) { | ||
635 | return r(Y.key, Z.getKey()) | ||
636 | }; | ||
637 | this.getKey = function() { | ||
638 | return Y.key | ||
639 | }; | ||
640 | this.getValue = function() { | ||
641 | return Y.value | ||
642 | }; | ||
643 | this.hashCode = function(Z) { | ||
644 | return h(Y.key) | ||
645 | }; | ||
646 | this.setValue = function(aa) { | ||
647 | var Z = Y.value; | ||
648 | Y.value = aa; | ||
649 | return Z | ||
650 | } | ||
651 | } | ||
652 | this.clear = function() { | ||
653 | S = 0; | ||
654 | Q = []; | ||
655 | Q.length = W | ||
656 | }; | ||
657 | this.clone = function() { | ||
658 | var Y = new N; | ||
659 | Y.putAll(this); | ||
660 | return Y | ||
661 | }; | ||
662 | this.containsKey = function(aa) { | ||
663 | var Y = U(aa); | ||
664 | var ab = Q[Y]; | ||
665 | if (ab === t) { | ||
666 | return false | ||
667 | } | ||
668 | for (var Z = 0; Z < ab.length; ++Z) { | ||
669 | if (r(ab[Z].key, aa)) { | ||
670 | return true | ||
671 | } | ||
672 | } | ||
673 | return false | ||
674 | }; | ||
675 | this.containsValue = function(aa) { | ||
676 | for (var Z = 0; Z < Q.length; ++Z) { | ||
677 | var ab = Q[Z]; | ||
678 | if (ab === t) { | ||
679 | continue | ||
680 | } | ||
681 | for (var Y = 0; Y < ab.length; ++Y) { | ||
682 | if (r(ab[Y].value, aa)) { | ||
683 | return true | ||
684 | } | ||
685 | } | ||
686 | } | ||
687 | return false | ||
688 | }; | ||
689 | this.entrySet = function() { | ||
690 | return new V(function(Y) { | ||
691 | return new T(Y) | ||
692 | }, function(Y) { | ||
693 | return Y instanceof T && Y._isIn(O) | ||
694 | }, function(Y) { | ||
695 | return O.remove(Y.getKey()) | ||
696 | }) | ||
697 | }; | ||
698 | this.get = function(aa) { | ||
699 | var Y = U(aa); | ||
700 | var ab = Q[Y]; | ||
701 | if (ab === t) { | ||
702 | return null | ||
703 | } | ||
704 | for (var Z = 0; Z < ab.length; ++Z) { | ||
705 | if (r(ab[Z].key, aa)) { | ||
706 | return ab[Z].value | ||
707 | } | ||
708 | } | ||
709 | return null | ||
710 | }; | ||
711 | this.isEmpty = function() { | ||
712 | return S === 0 | ||
713 | }; | ||
714 | this.keySet = function() { | ||
715 | return new V(function(Y) { | ||
716 | return Y.key | ||
717 | }, function(Y) { | ||
718 | return O.containsKey(Y) | ||
719 | }, function(Y) { | ||
720 | return O.remove(Y) | ||
721 | }) | ||
722 | }; | ||
723 | this.values = function() { | ||
724 | return new V(function(Y) { | ||
725 | return Y.value | ||
726 | }, function(Y) { | ||
727 | return O.containsValue(Y) | ||
728 | }, function(Y) { | ||
729 | return O.removeByValue(Y) | ||
730 | }) | ||
731 | }; | ||
732 | this.put = function(aa, ac) { | ||
733 | var Y = U(aa); | ||
734 | var ad = Q[Y]; | ||
735 | if (ad === t) { | ||
736 | ++S; | ||
737 | Q[Y] = [{ | ||
738 | key: aa, | ||
739 | value: ac | ||
740 | }]; | ||
741 | R(); | ||
742 | return null | ||
743 | } | ||
744 | for (var Z = 0; Z < ad.length; ++Z) { | ||
745 | if (r(ad[Z].key, aa)) { | ||
746 | var ab = ad[Z].value; | ||
747 | ad[Z].value = ac; | ||
748 | return ab | ||
749 | } | ||
750 | }++S; | ||
751 | ad.push({ | ||
752 | key: aa, | ||
753 | value: ac | ||
754 | }); | ||
755 | R(); | ||
756 | return null | ||
757 | }; | ||
758 | this.putAll = function(Y) { | ||
759 | var Z = Y.entrySet().iterator(); | ||
760 | while (Z.hasNext()) { | ||
761 | var aa = Z.next(); | ||
762 | this.put(aa.getKey(), aa.getValue()) | ||
763 | } | ||
764 | }; | ||
765 | this.remove = function(aa) { | ||
766 | var Y = U(aa); | ||
767 | var ac = Q[Y]; | ||
768 | if (ac === t) { | ||
769 | return null | ||
770 | } | ||
771 | for (var Z = 0; Z < ac.length; ++Z) { | ||
772 | if (r(ac[Z].key, aa)) { | ||
773 | --S; | ||
774 | var ab = ac[Z].value; | ||
775 | ac[Z].removed = true; | ||
776 | if (ac.length > 1) { | ||
777 | ac.splice(Z, 1) | ||
778 | } else { | ||
779 | Q[Y] = t | ||
780 | } | ||
781 | return ab | ||
782 | } | ||
783 | } | ||
784 | return null | ||
785 | }; | ||
786 | this.removeByValue = function(aa) { | ||
787 | var ac, Z, Y, ab; | ||
788 | for (ac in Q) { | ||
789 | if (Q.hasOwnProperty(ac)) { | ||
790 | for (Z = 0, Y = Q[ac].length; Z < Y; Z++) { | ||
791 | ab = Q[ac][Z]; | ||
792 | if (ab.value === aa) { | ||
793 | Q[ac].splice(Z, 1); | ||
794 | return true | ||
795 | } | ||
796 | } | ||
797 | } | ||
798 | } | ||
799 | return false | ||
800 | }; | ||
801 | this.size = function() { | ||
802 | return S | ||
803 | } | ||
804 | } | ||
805 | return N | ||
806 | }(); | ||
807 | var A = function() { | ||
808 | function N(Q, S, R) { | ||
809 | this.x = Q || 0; | ||
810 | this.y = S || 0; | ||
811 | this.z = R || 0 | ||
812 | } | ||
813 | N.dist = function(R, Q) { | ||
814 | return R.dist(Q) | ||
815 | }; | ||
816 | N.dot = function(R, Q) { | ||
817 | return R.dot(Q) | ||
818 | }; | ||
819 | N.cross = function(R, Q) { | ||
820 | return R.cross(Q) | ||
821 | }; | ||
822 | N.angleBetween = function(R, Q) { | ||
823 | return q.acos(R.dot(Q) / (R.mag() * Q.mag())) | ||
824 | }; | ||
825 | N.prototype = { | ||
826 | set: function(Q, S, R) { | ||
827 | if (arguments.length === 1) { | ||
828 | this.set(Q.x || Q[0] || 0, Q.y || Q[1] || 0, Q.z || Q[2] || 0) | ||
829 | } else { | ||
830 | this.x = Q; | ||
831 | this.y = S; | ||
832 | this.z = R | ||
833 | } | ||
834 | }, | ||
835 | get: function() { | ||
836 | return new N(this.x, this.y, this.z) | ||
837 | }, | ||
838 | mag: function() { | ||
839 | var Q = this.x, | ||
840 | S = this.y, | ||
841 | R = this.z; | ||
842 | return q.sqrt(Q * Q + S * S + R * R) | ||
843 | }, | ||
844 | add: function(Q, S, R) { | ||
845 | if (arguments.length === 1) { | ||
846 | this.x += Q.x; | ||
847 | this.y += Q.y; | ||
848 | this.z += Q.z | ||
849 | } else { | ||
850 | this.x += Q; | ||
851 | this.y += S; | ||
852 | this.z += R | ||
853 | } | ||
854 | }, | ||
855 | sub: function(Q, S, R) { | ||
856 | if (arguments.length === 1) { | ||
857 | this.x -= Q.x; | ||
858 | this.y -= Q.y; | ||
859 | this.z -= Q.z | ||
860 | } else { | ||
861 | this.x -= Q; | ||
862 | this.y -= S; | ||
863 | this.z -= R | ||
864 | } | ||
865 | }, | ||
866 | mult: function(Q) { | ||
867 | if (typeof Q === "number") { | ||
868 | this.x *= Q; | ||
869 | this.y *= Q; | ||
870 | this.z *= Q | ||
871 | } else { | ||
872 | this.x *= Q.x; | ||
873 | this.y *= Q.y; | ||
874 | this.z *= Q.z | ||
875 | } | ||
876 | }, | ||
877 | div: function(Q) { | ||
878 | if (typeof Q === "number") { | ||
879 | this.x /= Q; | ||
880 | this.y /= Q; | ||
881 | this.z /= Q | ||
882 | } else { | ||
883 | this.x /= Q.x; | ||
884 | this.y /= Q.y; | ||
885 | this.z /= Q.z | ||
886 | } | ||
887 | }, | ||
888 | dist: function(T) { | ||
889 | var S = this.x - T.x, | ||
890 | R = this.y - T.y, | ||
891 | Q = this.z - T.z; | ||
892 | return q.sqrt(S * S + R * R + Q * Q) | ||
893 | }, | ||
894 | dot: function(Q, S, R) { | ||
895 | if (arguments.length === 1) { | ||
896 | return this.x * Q.x + this.y * Q.y + this.z * Q.z | ||
897 | } | ||
898 | return this.x * Q + this.y * S + this.z * R | ||
899 | }, | ||
900 | cross: function(R) { | ||
901 | var Q = this.x, | ||
902 | T = this.y, | ||
903 | S = this.z; | ||
904 | return new N(T * R.z - R.y * S, S * R.x - R.z * Q, Q * R.y - R.x * T) | ||
905 | }, | ||
906 | normalize: function() { | ||
907 | var Q = this.mag(); | ||
908 | if (Q > 0) { | ||
909 | this.div(Q) | ||
910 | } | ||
911 | }, | ||
912 | limit: function(Q) { | ||
913 | if (this.mag() > Q) { | ||
914 | this.normalize(); | ||
915 | this.mult(Q) | ||
916 | } | ||
917 | }, | ||
918 | heading2D: function() { | ||
919 | return -q.atan2(-this.y, this.x) | ||
920 | }, | ||
921 | toString: function() { | ||
922 | return "[" + this.x + ", " + this.y + ", " + this.z + "]" | ||
923 | }, | ||
924 | array: function() { | ||
925 | return [this.x, this.y, this.z] | ||
926 | } | ||
927 | }; | ||
928 | |||
929 | function O(Q) { | ||
930 | return function(T, S) { | ||
931 | var R = T.get(); | ||
932 | R[Q](S); | ||
933 | return R | ||
934 | } | ||
935 | } | ||
936 | for (var P in N.prototype) { | ||
937 | if (N.prototype.hasOwnProperty(P) && !N.hasOwnProperty(P)) { | ||
938 | N[P] = O(P) | ||
939 | } | ||
940 | } | ||
941 | return N | ||
942 | }(); | ||
943 | |||
944 | function M() {} | ||
945 | M.prototype = B; | ||
946 | var g = new M; | ||
947 | g.ArrayList = f; | ||
948 | g.HashMap = x; | ||
949 | g.PVector = A; | ||
950 | g.ObjectIterator = o; | ||
951 | g.PConstants = B; | ||
952 | g.defineProperty = function(O, N, P) { | ||
953 | if ("defineProperty" in Object) { | ||
954 | Object.defineProperty(O, N, P) | ||
955 | } else { | ||
956 | if (P.hasOwnProperty("get")) { | ||
957 | O.__defineGetter__(N, P.get) | ||
958 | } | ||
959 | if (P.hasOwnProperty("set")) { | ||
960 | O.__defineSetter__(N, P.set) | ||
961 | } | ||
962 | } | ||
963 | }; | ||
964 | |||
965 | function m(O, N, R) { | ||
966 | if (!O.hasOwnProperty(N) || typeof O[N] !== "function") { | ||
967 | O[N] = R; | ||
968 | return | ||
969 | } | ||
970 | var Q = O[N]; | ||
971 | if ("$overloads" in Q) { | ||
972 | Q.$defaultOverload = R; | ||
973 | return | ||
974 | } | ||
975 | if (!("$overloads" in R) && Q.length === R.length) { | ||
976 | return | ||
977 | } | ||
978 | var T, P; | ||
979 | if ("$overloads" in R) { | ||
980 | T = R.$overloads.slice(0); | ||
981 | T[Q.length] = Q; | ||
982 | P = R.$defaultOverload | ||
983 | } else { | ||
984 | T = []; | ||
985 | T[R.length] = R; | ||
986 | T[Q.length] = Q; | ||
987 | P = Q | ||
988 | } | ||
989 | var S = function() { | ||
990 | var U = S.$overloads[arguments.length] || ("$methodArgsIndex" in S && arguments.length > S.$methodArgsIndex ? S.$overloads[S.$methodArgsIndex] : null) || S.$defaultOverload; | ||
991 | return U.apply(this, arguments) | ||
992 | }; | ||
993 | S.$overloads = T; | ||
994 | if ("$methodArgsIndex" in R) { | ||
995 | S.$methodArgsIndex = R.$methodArgsIndex | ||
996 | } | ||
997 | S.$defaultOverload = P; | ||
998 | S.name = N; | ||
999 | O[N] = S | ||
1000 | } | ||
1001 | |||
1002 | function i(Q, P) { | ||
1003 | function R(S) { | ||
1004 | g.defineProperty(Q, S, { | ||
1005 | get: function() { | ||
1006 | return P[S] | ||
1007 | }, | ||
1008 | set: function(T) { | ||
1009 | P[S] = T | ||
1010 | }, | ||
1011 | enumerable: true | ||
1012 | }) | ||
1013 | } | ||
1014 | var O = []; | ||
1015 | for (var N in P) { | ||
1016 | if (typeof P[N] === "function") { | ||
1017 | m(Q, N, P[N]) | ||
1018 | } else { | ||
1019 | if (N.charAt(0) !== "$" && !(N in Q)) { | ||
1020 | O.push(N) | ||
1021 | } | ||
1022 | } | ||
1023 | } | ||
1024 | while (O.length > 0) { | ||
1025 | R(O.shift()) | ||
1026 | } | ||
1027 | Q.$super = P | ||
1028 | } | ||
1029 | g.extendClassChain = function(O) { | ||
1030 | var P = [O]; | ||
1031 | for (var N = O.$upcast; N; N = N.$upcast) { | ||
1032 | i(N, O); | ||
1033 | P.push(N); | ||
1034 | O = N | ||
1035 | } | ||
1036 | while (P.length > 0) { | ||
1037 | P.pop().$self = O | ||
1038 | } | ||
1039 | }; | ||
1040 | g.extendStaticMembers = function(N, O) { | ||
1041 | i(N, O) | ||
1042 | }; | ||
1043 | g.extendInterfaceMembers = function(N, O) { | ||
1044 | i(N, O) | ||
1045 | }; | ||
1046 | g.addMethod = function(Q, P, S, R) { | ||
1047 | var N = Q[P]; | ||
1048 | if (N || R) { | ||
1049 | var O = S.length; | ||
1050 | if ("$overloads" in N) { | ||
1051 | N.$overloads[O] = S | ||
1052 | } else { | ||
1053 | var T = function() { | ||
1054 | var V = T.$overloads[arguments.length] || ("$methodArgsIndex" in T && arguments.length > T.$methodArgsIndex ? T.$overloads[T.$methodArgsIndex] : null) || T.$defaultOverload; | ||
1055 | return V.apply(this, arguments) | ||
1056 | }; | ||
1057 | var U = []; | ||
1058 | if (N) { | ||
1059 | U[N.length] = N | ||
1060 | } | ||
1061 | U[O] = S; | ||
1062 | T.$overloads = U; | ||
1063 | T.$defaultOverload = N || S; | ||
1064 | if (R) { | ||
1065 | T.$methodArgsIndex = O | ||
1066 | } | ||
1067 | T.name = P; | ||
1068 | Q[P] = T | ||
1069 | } | ||
1070 | } else { | ||
1071 | Q[P] = S | ||
1072 | } | ||
1073 | }; | ||
1074 | |||
1075 | function l(N) { | ||
1076 | if (typeof N !== "string") { | ||
1077 | return false | ||
1078 | } | ||
1079 | return ["byte", "int", "char", "color", "float", "long", "double"].indexOf(N) !== -1 | ||
1080 | } | ||
1081 | g.createJavaArray = function(S, T) { | ||
1082 | var O = null, | ||
1083 | P = null; | ||
1084 | if (typeof S === "string") { | ||
1085 | if (S === "boolean") { | ||
1086 | P = false | ||
1087 | } else { | ||
1088 | if (l(S)) { | ||
1089 | P = 0 | ||
1090 | } | ||
1091 | } | ||
1092 | } | ||
1093 | if (typeof T[0] === "number") { | ||
1094 | var N = 0 | T[0]; | ||
1095 | if (T.length <= 1) { | ||
1096 | O = []; | ||
1097 | O.length = N; | ||
1098 | for (var R = 0; R < N; ++R) { | ||
1099 | O[R] = P | ||
1100 | } | ||
1101 | } else { | ||
1102 | O = []; | ||
1103 | var U = T.slice(1); | ||
1104 | for (var Q = 0; Q < N; ++Q) { | ||
1105 | O.push(g.createJavaArray(S, U)) | ||
1106 | } | ||
1107 | } | ||
1108 | } | ||
1109 | return O | ||
1110 | }; | ||
1111 | var E = { | ||
1112 | aliceblue: "#f0f8ff", | ||
1113 | antiquewhite: "#faebd7", | ||
1114 | aqua: "#00ffff", | ||
1115 | aquamarine: "#7fffd4", | ||
1116 | azure: "#f0ffff", | ||
1117 | beige: "#f5f5dc", | ||
1118 | bisque: "#ffe4c4", | ||
1119 | black: "#000000", | ||
1120 | blanchedalmond: "#ffebcd", | ||
1121 | blue: "#0000ff", | ||
1122 | blueviolet: "#8a2be2", | ||
1123 | brown: "#a52a2a", | ||
1124 | burlywood: "#deb887", | ||
1125 | cadetblue: "#5f9ea0", | ||
1126 | chartreuse: "#7fff00", | ||
1127 | chocolate: "#d2691e", | ||
1128 | coral: "#ff7f50", | ||
1129 | cornflowerblue: "#6495ed", | ||
1130 | cornsilk: "#fff8dc", | ||
1131 | crimson: "#dc143c", | ||
1132 | cyan: "#00ffff", | ||
1133 | darkblue: "#00008b", | ||
1134 | darkcyan: "#008b8b", | ||
1135 | darkgoldenrod: "#b8860b", | ||
1136 | darkgray: "#a9a9a9", | ||
1137 | darkgreen: "#006400", | ||
1138 | darkkhaki: "#bdb76b", | ||
1139 | darkmagenta: "#8b008b", | ||
1140 | darkolivegreen: "#556b2f", | ||
1141 | darkorange: "#ff8c00", | ||
1142 | darkorchid: "#9932cc", | ||
1143 | darkred: "#8b0000", | ||
1144 | darksalmon: "#e9967a", | ||
1145 | darkseagreen: "#8fbc8f", | ||
1146 | darkslateblue: "#483d8b", | ||
1147 | darkslategray: "#2f4f4f", | ||
1148 | darkturquoise: "#00ced1", | ||
1149 | darkviolet: "#9400d3", | ||
1150 | deeppink: "#ff1493", | ||
1151 | deepskyblue: "#00bfff", | ||
1152 | dimgray: "#696969", | ||
1153 | dodgerblue: "#1e90ff", | ||
1154 | firebrick: "#b22222", | ||
1155 | floralwhite: "#fffaf0", | ||
1156 | forestgreen: "#228b22", | ||
1157 | fuchsia: "#ff00ff", | ||
1158 | gainsboro: "#dcdcdc", | ||
1159 | ghostwhite: "#f8f8ff", | ||
1160 | gold: "#ffd700", | ||
1161 | goldenrod: "#daa520", | ||
1162 | gray: "#808080", | ||
1163 | green: "#008000", | ||
1164 | greenyellow: "#adff2f", | ||
1165 | honeydew: "#f0fff0", | ||
1166 | hotpink: "#ff69b4", | ||
1167 | indianred: "#cd5c5c", | ||
1168 | indigo: "#4b0082", | ||
1169 | ivory: "#fffff0", | ||
1170 | khaki: "#f0e68c", | ||
1171 | lavender: "#e6e6fa", | ||
1172 | lavenderblush: "#fff0f5", | ||
1173 | lawngreen: "#7cfc00", | ||
1174 | lemonchiffon: "#fffacd", | ||
1175 | lightblue: "#add8e6", | ||
1176 | lightcoral: "#f08080", | ||
1177 | lightcyan: "#e0ffff", | ||
1178 | lightgoldenrodyellow: "#fafad2", | ||
1179 | lightgrey: "#d3d3d3", | ||
1180 | lightgreen: "#90ee90", | ||
1181 | lightpink: "#ffb6c1", | ||
1182 | lightsalmon: "#ffa07a", | ||
1183 | lightseagreen: "#20b2aa", | ||
1184 | lightskyblue: "#87cefa", | ||
1185 | lightslategray: "#778899", | ||
1186 | lightsteelblue: "#b0c4de", | ||
1187 | lightyellow: "#ffffe0", | ||
1188 | lime: "#00ff00", | ||
1189 | limegreen: "#32cd32", | ||
1190 | linen: "#faf0e6", | ||
1191 | magenta: "#ff00ff", | ||
1192 | maroon: "#800000", | ||
1193 | mediumaquamarine: "#66cdaa", | ||
1194 | mediumblue: "#0000cd", | ||
1195 | mediumorchid: "#ba55d3", | ||
1196 | mediumpurple: "#9370d8", | ||
1197 | mediumseagreen: "#3cb371", | ||
1198 | mediumslateblue: "#7b68ee", | ||
1199 | mediumspringgreen: "#00fa9a", | ||
1200 | mediumturquoise: "#48d1cc", | ||
1201 | mediumvioletred: "#c71585", | ||
1202 | midnightblue: "#191970", | ||
1203 | mintcream: "#f5fffa", | ||
1204 | mistyrose: "#ffe4e1", | ||
1205 | moccasin: "#ffe4b5", | ||
1206 | navajowhite: "#ffdead", | ||
1207 | navy: "#000080", | ||
1208 | oldlace: "#fdf5e6", | ||
1209 | olive: "#808000", | ||
1210 | olivedrab: "#6b8e23", | ||
1211 | orange: "#ffa500", | ||
1212 | orangered: "#ff4500", | ||
1213 | orchid: "#da70d6", | ||
1214 | palegoldenrod: "#eee8aa", | ||
1215 | palegreen: "#98fb98", | ||
1216 | paleturquoise: "#afeeee", | ||
1217 | palevioletred: "#d87093", | ||
1218 | papayawhip: "#ffefd5", | ||
1219 | peachpuff: "#ffdab9", | ||
1220 | peru: "#cd853f", | ||
1221 | pink: "#ffc0cb", | ||
1222 | plum: "#dda0dd", | ||
1223 | powderblue: "#b0e0e6", | ||
1224 | purple: "#800080", | ||
1225 | red: "#ff0000", | ||
1226 | rosybrown: "#bc8f8f", | ||
1227 | royalblue: "#4169e1", | ||
1228 | saddlebrown: "#8b4513", | ||
1229 | salmon: "#fa8072", | ||
1230 | sandybrown: "#f4a460", | ||
1231 | seagreen: "#2e8b57", | ||
1232 | seashell: "#fff5ee", | ||
1233 | sienna: "#a0522d", | ||
1234 | silver: "#c0c0c0", | ||
1235 | skyblue: "#87ceeb", | ||
1236 | slateblue: "#6a5acd", | ||
1237 | slategray: "#708090", | ||
1238 | snow: "#fffafa", | ||
1239 | springgreen: "#00ff7f", | ||
1240 | steelblue: "#4682b4", | ||
1241 | tan: "#d2b48c", | ||
1242 | teal: "#008080", | ||
1243 | thistle: "#d8bfd8", | ||
1244 | tomato: "#ff6347", | ||
1245 | turquoise: "#40e0d0", | ||
1246 | violet: "#ee82ee", | ||
1247 | wheat: "#f5deb3", | ||
1248 | white: "#ffffff", | ||
1249 | whitesmoke: "#f5f5f5", | ||
1250 | yellow: "#ffff00", | ||
1251 | yellowgreen: "#9acd32" | ||
1252 | }; | ||
1253 | (function(O) { | ||
1254 | var R = ("open() createOutput() createInput() BufferedReader selectFolder() dataPath() createWriter() selectOutput() beginRecord() saveStream() endRecord() selectInput() saveBytes() createReader() beginRaw() endRaw() PrintWriter delay()").split(" "), | ||
1255 | Q = R.length, | ||
1256 | N, S; | ||
1257 | |||
1258 | function P(T) { | ||
1259 | return function() { | ||
1260 | throw "Processing.js does not support " + T + "." | ||
1261 | } | ||
1262 | } | ||
1263 | while (Q--) { | ||
1264 | N = R[Q]; | ||
1265 | S = N.replace("()", ""); | ||
1266 | O[S] = P(N) | ||
1267 | } | ||
1268 | })(g); | ||
1269 | g.defineProperty(g, "screenWidth", { | ||
1270 | get: function() { | ||
1271 | return D.innerWidth | ||
1272 | } | ||
1273 | }); | ||
1274 | g.defineProperty(g, "screenHeight", { | ||
1275 | get: function() { | ||
1276 | return D.innerHeight | ||
1277 | } | ||
1278 | }); | ||
1279 | g.defineProperty(g, "online", { | ||
1280 | get: function() { | ||
1281 | return true | ||
1282 | } | ||
1283 | }); | ||
1284 | var k = []; | ||
1285 | var J = {}; | ||
1286 | var L = function(N) { | ||
1287 | k.splice(J[N], 1); | ||
1288 | delete J[N] | ||
1289 | }; | ||
1290 | var a = function(N) { | ||
1291 | if (N.externals.canvas.id === t || !N.externals.canvas.id.length) { | ||
1292 | N.externals.canvas.id = "__processing" + k.length | ||
1293 | } | ||
1294 | J[N.externals.canvas.id] = k.length; | ||
1295 | k.push(N) | ||
1296 | }; | ||
1297 | |||
1298 | function p(X) { | ||
1299 | var Q = 250, | ||
1300 | ae = X.size / Q, | ||
1301 | N = d.createElement("canvas"); | ||
1302 | N.width = 2 * Q; | ||
1303 | N.height = 2 * Q; | ||
1304 | N.style.opacity = 0; | ||
1305 | var W = X.getCSSDefinition(Q + "px", "normal"), | ||
1306 | Y = N.getContext("2d"); | ||
1307 | Y.font = W; | ||
1308 | var ac = "dbflkhyjqpg"; | ||
1309 | N.width = Y.measureText(ac).width; | ||
1310 | Y.font = W; | ||
1311 | var T = d.createElement("div"); | ||
1312 | T.style.position = "absolute"; | ||
1313 | T.style.opacity = 0; | ||
1314 | T.style.fontFamily = '"' + X.name + '"'; | ||
1315 | T.style.fontSize = Q + "px"; | ||
1316 | T.innerHTML = ac + "<br/>" + ac; | ||
1317 | d.body.appendChild(T); | ||
1318 | var U = N.width, | ||
1319 | ab = N.height, | ||
1320 | V = ab / 2; | ||
1321 | Y.fillStyle = "white"; | ||
1322 | Y.fillRect(0, 0, U, ab); | ||
1323 | Y.fillStyle = "black"; | ||
1324 | Y.fillText(ac, 0, V); | ||
1325 | var P = Y.getImageData(0, 0, U, ab).data; | ||
1326 | var Z = 0, | ||
1327 | S = U * 4, | ||
1328 | aa = P.length; | ||
1329 | while (++Z < aa && P[Z] === 255) { | ||
1330 | G() | ||
1331 | } | ||
1332 | var R = q.round(Z / S); | ||
1333 | Z = aa - 1; | ||
1334 | while (--Z > 0 && P[Z] === 255) { | ||
1335 | G() | ||
1336 | } | ||
1337 | var ad = q.round(Z / S); | ||
1338 | X.ascent = ae * (V - R); | ||
1339 | X.descent = ae * (ad - V); | ||
1340 | if (d.defaultView.getComputedStyle) { | ||
1341 | var O = d.defaultView.getComputedStyle(T, null).getPropertyValue("height"); | ||
1342 | O = ae * O.replace("px", ""); | ||
1343 | if (O >= X.size * 2) { | ||
1344 | X.leading = q.round(O / 2) | ||
1345 | } | ||
1346 | } | ||
1347 | d.body.removeChild(T); | ||
1348 | if (X.caching) { | ||
1349 | return Y | ||
1350 | } | ||
1351 | } | ||
1352 | |||
1353 | function H(N, O) { | ||
1354 | if (N === t) { | ||
1355 | N = "" | ||
1356 | } | ||
1357 | this.name = N; | ||
1358 | if (O === t) { | ||
1359 | O = 0 | ||
1360 | } | ||
1361 | this.size = O; | ||
1362 | this.glyph = false; | ||
1363 | this.ascent = 0; | ||
1364 | this.descent = 0; | ||
1365 | this.leading = 1.2 * O; | ||
1366 | var R = N.indexOf(" Italic Bold"); | ||
1367 | if (R !== -1) { | ||
1368 | N = N.substring(0, R) | ||
1369 | } | ||
1370 | this.style = "normal"; | ||
1371 | var Q = N.indexOf(" Italic"); | ||
1372 | if (Q !== -1) { | ||
1373 | N = N.substring(0, Q); | ||
1374 | this.style = "italic" | ||
1375 | } | ||
1376 | this.weight = "normal"; | ||
1377 | var P = N.indexOf(" Bold"); | ||
1378 | if (P !== -1) { | ||
1379 | N = N.substring(0, P); | ||
1380 | this.weight = "bold" | ||
1381 | } | ||
1382 | this.family = "sans-serif"; | ||
1383 | if (N !== t) { | ||
1384 | switch (N) { | ||
1385 | case "sans-serif": | ||
1386 | case "serif": | ||
1387 | case "monospace": | ||
1388 | case "fantasy": | ||
1389 | case "cursive": | ||
1390 | this.family = N; | ||
1391 | break; | ||
1392 | default: | ||
1393 | this.family = '"' + N + '", sans-serif'; | ||
1394 | break | ||
1395 | } | ||
1396 | } | ||
1397 | this.context2d = p(this); | ||
1398 | this.css = this.getCSSDefinition(); | ||
1399 | if (this.context2d) { | ||
1400 | this.context2d.font = this.css | ||
1401 | } | ||
1402 | } | ||
1403 | H.prototype.caching = true; | ||
1404 | H.prototype.getCSSDefinition = function(P, N) { | ||
1405 | if (P === t) { | ||
1406 | P = this.size + "px" | ||
1407 | } | ||
1408 | if (N === t) { | ||
1409 | N = this.leading + "px" | ||
1410 | } | ||
1411 | var O = [this.style, "normal", this.weight, P + "/" + N, this.family]; | ||
1412 | return O.join(" ") | ||
1413 | }; | ||
1414 | H.prototype.measureTextWidth = function(N) { | ||
1415 | return this.context2d.measureText(N).width | ||
1416 | }; | ||
1417 | H.prototype.measureTextWidthFallback = function(P) { | ||
1418 | var O = d.createElement("canvas"), | ||
1419 | N = O.getContext("2d"); | ||
1420 | N.font = this.css; | ||
1421 | return N.measureText(P).width | ||
1422 | }; | ||
1423 | H.PFontCache = { | ||
1424 | length: 0 | ||
1425 | }; | ||
1426 | H.get = function(Q, R) { | ||
1427 | R = (R * 10 + 0.5 | 0) / 10; | ||
1428 | var O = H.PFontCache, | ||
1429 | N = Q + "/" + R; | ||
1430 | if (!O[N]) { | ||
1431 | O[N] = new H(Q, R); | ||
1432 | O.length++; | ||
1433 | if (O.length === 50) { | ||
1434 | H.prototype.measureTextWidth = H.prototype.measureTextWidthFallback; | ||
1435 | H.prototype.caching = false; | ||
1436 | var P; | ||
1437 | for (P in O) { | ||
1438 | if (P !== "length") { | ||
1439 | O[P].context2d = null | ||
1440 | } | ||
1441 | } | ||
1442 | return new H(Q, R) | ||
1443 | } | ||
1444 | if (O.length === 400) { | ||
1445 | H.PFontCache = {}; | ||
1446 | H.get = H.getFallback; | ||
1447 | return new H(Q, R) | ||
1448 | } | ||
1449 | } | ||
1450 | return O[N] | ||
1451 | }; | ||
1452 | H.getFallback = function(N, O) { | ||
1453 | return new H(N, O) | ||
1454 | }; | ||
1455 | H.list = function() { | ||
1456 | return ["sans-serif", "serif", "monospace", "fantasy", "cursive"] | ||
1457 | }; | ||
1458 | H.preloading = { | ||
1459 | template: {}, | ||
1460 | initialized: false, | ||
1461 | initialize: function() { | ||
1462 | var P = function() { | ||
1463 | var R = "#E3KAI2wAgT1MvMg7Eo3VmNtYX7ABi3CxnbHlm7Abw3kaGVhZ7ACs3OGhoZWE7A53CRobXR47AY3AGbG9jYQ7G03Bm1heH7ABC3CBuYW1l7Ae3AgcG9zd7AI3AE#B3AQ2kgTY18PPPUACwAg3ALSRoo3#yld0xg32QAB77#E777773B#E3C#I#Q77773E#Q7777777772CMAIw7AB77732B#M#Q3wAB#g3B#E#E2BB//82BB////w#B7#gAEg3E77x2B32B#E#Q#MTcBAQ32gAe#M#QQJ#E32M#QQJ#I#g32Q77#"; | ||
1464 | var Q = function(S) { | ||
1465 | return "AAAAAAAA".substr(~~S ? 7 - S : 6) | ||
1466 | }; | ||
1467 | return R.replace(/[#237]/g, Q) | ||
1468 | }; | ||
1469 | var N = d.createElement("style"); | ||
1470 | N.setAttribute("type", "text/css"); | ||
1471 | N.innerHTML = '@font-face {\n font-family: "PjsEmptyFont";\n src: url(\'data:application/x-font-ttf;base64,' + P() + "')\n format('truetype');\n}"; | ||
1472 | d.head.appendChild(N); | ||
1473 | var O = d.createElement("span"); | ||
1474 | O.style.cssText = 'position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;'; | ||
1475 | O.innerHTML = "AAAAAAAA"; | ||
1476 | d.body.appendChild(O); | ||
1477 | this.template = O; | ||
1478 | this.initialized = true | ||
1479 | }, | ||
1480 | getElementWidth: function(N) { | ||
1481 | return d.defaultView.getComputedStyle(N, "").getPropertyValue("width") | ||
1482 | }, | ||
1483 | timeAttempted: 0, | ||
1484 | pending: function(R) { | ||
1485 | if (!this.initialized) { | ||
1486 | this.initialize() | ||
1487 | } | ||
1488 | var P, N, Q = this.getElementWidth(this.template); | ||
1489 | for (var O = 0; O < this.fontList.length; O++) { | ||
1490 | P = this.fontList[O]; | ||
1491 | N = this.getElementWidth(P); | ||
1492 | if (this.timeAttempted < 4000 && N === Q) { | ||
1493 | this.timeAttempted += R; | ||
1494 | return true | ||
1495 | } else { | ||
1496 | d.body.removeChild(P); | ||
1497 | this.fontList.splice(O--, 1); | ||
1498 | this.timeAttempted = 0 | ||
1499 | } | ||
1500 | } | ||
1501 | if (this.fontList.length === 0) { | ||
1502 | return false | ||
1503 | } | ||
1504 | return true | ||
1505 | }, | ||
1506 | fontList: [], | ||
1507 | addedList: {}, | ||
1508 | add: function(N) { | ||
1509 | if (!this.initialized) { | ||
1510 | this.initialize() | ||
1511 | } | ||
1512 | var R = typeof N === "object" ? N.fontFace : N, | ||
1513 | Q = typeof N === "object" ? N.url : N; | ||
1514 | if (this.addedList[R]) { | ||
1515 | return | ||
1516 | } | ||
1517 | var P = d.createElement("style"); | ||
1518 | P.setAttribute("type", "text/css"); | ||
1519 | P.innerHTML = "@font-face{\n font-family: '" + R + "';\n src: url('" + Q + "');\n}\n"; | ||
1520 | d.head.appendChild(P); | ||
1521 | this.addedList[R] = true; | ||
1522 | var O = d.createElement("span"); | ||
1523 | O.style.cssText = "position: absolute; top: 0; left: 0; opacity: 0;"; | ||
1524 | O.style.fontFamily = '"' + R + '", "PjsEmptyFont", fantasy'; | ||
1525 | O.innerHTML = "AAAAAAAA"; | ||
1526 | d.body.appendChild(O); | ||
1527 | this.fontList.push(O) | ||
1528 | } | ||
1529 | }; | ||
1530 | g.PFont = H; | ||
1531 | var F = this.Processing = function(be, ba) { | ||
1532 | if (!(this instanceof F)) { | ||
1533 | throw "called Processing constructor as if it were a function: missing 'new'." | ||
1534 | } | ||
1535 | var ae, cV = be === t && ba === t; | ||
1536 | if (cV) { | ||
1537 | ae = d.createElement("canvas") | ||
1538 | } else { | ||
1539 | ae = typeof be === "string" ? d.getElementById(be) : be | ||
1540 | } if (!(ae instanceof HTMLCanvasElement)) { | ||
1541 | throw "called Processing constructor without passing canvas element reference or id." | ||
1542 | } | ||
1543 | |||
1544 | function dw(ea) { | ||
1545 | F.debug("Unimplemented - " + ea) | ||
1546 | } | ||
1547 | var cW = this; | ||
1548 | cW.externals = { | ||
1549 | canvas: ae, | ||
1550 | context: t, | ||
1551 | sketch: t | ||
1552 | }; | ||
1553 | cW.name = "Processing.js Instance"; | ||
1554 | cW.use3DContext = false; | ||
1555 | cW.focused = false; | ||
1556 | cW.breakShape = false; | ||
1557 | cW.glyphTable = {}; | ||
1558 | cW.pmouseX = 0; | ||
1559 | cW.pmouseY = 0; | ||
1560 | cW.mouseX = 0; | ||
1561 | cW.mouseY = 0; | ||
1562 | cW.mouseButton = 0; | ||
1563 | cW.mouseScroll = 0; | ||
1564 | cW.mouseClicked = t; | ||
1565 | cW.mouseDragged = t; | ||
1566 | cW.mouseMoved = t; | ||
1567 | cW.mousePressed = t; | ||
1568 | cW.mouseReleased = t; | ||
1569 | cW.mouseScrolled = t; | ||
1570 | cW.mouseOver = t; | ||
1571 | cW.mouseOut = t; | ||
1572 | cW.touchStart = t; | ||
1573 | cW.touchEnd = t; | ||
1574 | cW.touchMove = t; | ||
1575 | cW.touchCancel = t; | ||
1576 | cW.key = t; | ||
1577 | cW.keyCode = t; | ||
1578 | cW.keyPressed = G; | ||
1579 | cW.keyReleased = G; | ||
1580 | cW.keyTyped = G; | ||
1581 | cW.draw = t; | ||
1582 | cW.setup = t; | ||
1583 | cW.__mousePressed = false; | ||
1584 | cW.__keyPressed = false; | ||
1585 | cW.__frameRate = 60; | ||
1586 | cW.frameCount = 0; | ||
1587 | cW.width = 100; | ||
1588 | cW.height = 100; | ||
1589 | var d8, cQ, dY, bD = true, | ||
1590 | aH = true, | ||
1591 | bo = [1, 1, 1, 1], | ||
1592 | a1 = 4294967295, | ||
1593 | aq = true, | ||
1594 | ce = true, | ||
1595 | c0 = [0, 0, 0, 1], | ||
1596 | cv = 4278190080, | ||
1597 | b3 = true, | ||
1598 | dW = 1, | ||
1599 | ax = false, | ||
1600 | dO = false, | ||
1601 | aC = true, | ||
1602 | b4 = 0, | ||
1603 | bK = 0, | ||
1604 | cN = 3, | ||
1605 | a8 = 0, | ||
1606 | a7 = 0, | ||
1607 | a6 = 0, | ||
1608 | a2 = 0, | ||
1609 | dU = 60, | ||
1610 | az = 1000 / dU, | ||
1611 | Z = "default", | ||
1612 | ck = ae.style.cursor, | ||
1613 | dR = 20, | ||
1614 | cj = 0, | ||
1615 | d6 = [], | ||
1616 | aJ = 0, | ||
1617 | Q = 20, | ||
1618 | cM = false, | ||
1619 | a4 = -3355444, | ||
1620 | cy = 20, | ||
1621 | bU = 255, | ||
1622 | bJ = 255, | ||
1623 | bI = 255, | ||
1624 | bG = 255, | ||
1625 | cZ = false, | ||
1626 | aK = false, | ||
1627 | dN = 0, | ||
1628 | d5 = 0, | ||
1629 | cY = 1, | ||
1630 | bf = null, | ||
1631 | bw = null, | ||
1632 | a5 = false, | ||
1633 | dq = Date.now(), | ||
1634 | dt = dq, | ||
1635 | P = 0, | ||
1636 | cE, c3, aQ, aL, bz, cd, U, dC = { | ||
1637 | attributes: {}, | ||
1638 | locations: {} | ||
1639 | }, | ||
1640 | dx, dQ, bT, bh, cJ, dk, aB, b2, bg, b8, at, aG, bC, aw, af, c7, bS, cs = { | ||
1641 | width: 0, | ||
1642 | height: 0 | ||
1643 | }, | ||
1644 | d4 = 2, | ||
1645 | dT = false, | ||
1646 | cH, ac, R, N = 37, | ||
1647 | c1 = 0, | ||
1648 | cI = 4, | ||
1649 | Y = "Arial", | ||
1650 | d0 = 12, | ||
1651 | a3 = 9, | ||
1652 | dA = 2, | ||
1653 | d7 = 14, | ||
1654 | W = H.get(Y, d0), | ||
1655 | aj, cn = null, | ||
1656 | dV = false, | ||
1657 | d3, bZ = 1000, | ||
1658 | ag = [], | ||
1659 | dI = null, | ||
1660 | dX = [16, 17, 18, 20, 33, 34, 35, 36, 37, 38, 39, 40, 144, 155, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 157]; | ||
1661 | var ad, dp, aU, bX; | ||
1662 | if (d.defaultView && d.defaultView.getComputedStyle) { | ||
1663 | ad = parseInt(d.defaultView.getComputedStyle(ae, null)["paddingLeft"], 10) || 0; | ||
1664 | dp = parseInt(d.defaultView.getComputedStyle(ae, null)["paddingTop"], 10) || 0; | ||
1665 | aU = parseInt(d.defaultView.getComputedStyle(ae, null)["borderLeftWidth"], 10) || 0; | ||
1666 | bX = parseInt(d.defaultView.getComputedStyle(ae, null)["borderTopWidth"], 10) || 0 | ||
1667 | } | ||
1668 | var dL = 0; | ||
1669 | var bL = 0, | ||
1670 | bM = 0, | ||
1671 | bt = [], | ||
1672 | bs = [], | ||
1673 | br = [], | ||
1674 | ah = new e(720), | ||
1675 | bl = new e(720), | ||
1676 | cF, cA; | ||
1677 | var bV, ch, dJ, aT, am, da, ab, db, ap = false, | ||
1678 | ci = false, | ||
1679 | cK = 60 * (q.PI / 180), | ||
1680 | dl = cW.width / 2, | ||
1681 | dj = cW.height / 2, | ||
1682 | di = dj / q.tan(cK / 2), | ||
1683 | a0 = di / 10, | ||
1684 | av = di * 10, | ||
1685 | b5 = cW.width / cW.height; | ||
1686 | var bb = [], | ||
1687 | cb = [], | ||
1688 | c2 = 0, | ||
1689 | dP = false, | ||
1690 | aa = false, | ||
1691 | du = true; | ||
1692 | var S = 0; | ||
1693 | var bm = []; | ||
1694 | var dh = new e([0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5]); | ||
1695 | var bH = new e([0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5]); | ||
1696 | var df = new e([0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0]); | ||
1697 | var ak = new e([0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]); | ||
1698 | var ai = new e([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]); | ||
1699 | var aO = "varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec4 aColor;uniform mat4 uView;uniform mat4 uProjection;uniform float uPointSize;void main(void) { vFrontColor = aColor; gl_PointSize = uPointSize; gl_Position = uProjection * uView * vec4(aVertex, 1.0);}"; | ||
1700 | var bQ = "#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform bool uSmooth;void main(void){ if(uSmooth == true){ float dist = distance(gl_PointCoord, vec2(0.5)); if(dist > 0.5){ discard; } } gl_FragColor = vFrontColor;}"; | ||
1701 | var dE = "varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec2 aTextureCoord;uniform vec4 uColor;uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection;uniform float uPointSize;varying vec2 vTextureCoord;void main(void) { gl_PointSize = uPointSize; vFrontColor = uColor; gl_Position = uProjection * uView * uModel * vec4(aVertex, 1.0); vTextureCoord = aTextureCoord;}"; | ||
1702 | var aW = "#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform int uIsDrawingText;uniform bool uSmooth;void main(void){ if(uSmooth == true){ float dist = distance(gl_PointCoord, vec2(0.5)); if(dist > 0.5){ discard; } } if(uIsDrawingText == 1){ float alpha = texture2D(uSampler, vTextureCoord).a; gl_FragColor = vec4(vFrontColor.rgb * alpha, alpha); } else{ gl_FragColor = vFrontColor; }}"; | ||
1703 | var bA = /Windows/.test(navigator.userAgent); | ||
1704 | var dn = "varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec3 aNormal;attribute vec4 aColor;attribute vec2 aTexture;varying vec2 vTexture;uniform vec4 uColor;uniform bool uUsingMat;uniform vec3 uSpecular;uniform vec3 uMaterialEmissive;uniform vec3 uMaterialAmbient;uniform vec3 uMaterialSpecular;uniform float uShininess;uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection;uniform mat4 uNormalTransform;uniform int uLightCount;uniform vec3 uFalloff;struct Light { int type; vec3 color; vec3 position; vec3 direction; float angle; vec3 halfVector; float concentration;};uniform Light uLights0;uniform Light uLights1;uniform Light uLights2;uniform Light uLights3;uniform Light uLights4;uniform Light uLights5;uniform Light uLights6;uniform Light uLights7;Light getLight(int index){ if(index == 0) return uLights0; if(index == 1) return uLights1; if(index == 2) return uLights2; if(index == 3) return uLights3; if(index == 4) return uLights4; if(index == 5) return uLights5; if(index == 6) return uLights6; return uLights7;}void AmbientLight( inout vec3 totalAmbient, in vec3 ecPos, in Light light ) { float d = length( light.position - ecPos ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d )); totalAmbient += light.color * attenuation;}void DirectionalLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerFactor = 0.0; float nDotVP = max(0.0, dot( vertNormal, normalize(-light.position) )); float nDotVH = max(0.0, dot( vertNormal, normalize(-light.position-normalize(ecPos) ))); if( nDotVP != 0.0 ){ powerFactor = pow( nDotVH, uShininess ); } col += light.color * nDotVP; spec += uSpecular * powerFactor;}void PointLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerFactor; vec3 VP = light.position - ecPos; float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d )); float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0 ) { powerFactor = 0.0; } else { powerFactor = pow( nDotHV, uShininess ); } spec += uSpecular * powerFactor * attenuation; col += light.color * nDotVP * attenuation;}void SpotLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float spotAttenuation; float powerFactor = 0.0; vec3 VP = light.position - ecPos; vec3 ldir = normalize( -light.direction ); float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d ) ); float spotDot = dot( VP, ldir );" + (bA ? " spotAttenuation = 1.0; " : " if( spotDot > cos( light.angle ) ) { spotAttenuation = pow( spotDot, light.concentration ); } else{ spotAttenuation = 0.0; } attenuation *= spotAttenuation;") + " float nDotVP = max( 0.0, dot( vertNormal, VP ) ); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector ) ); if( nDotVP != 0.0 ) { powerFactor = pow( nDotHV, uShininess ); } spec += uSpecular * powerFactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0 ); vec3 finalDiffuse = vec3( 0.0 ); vec3 finalSpecular = vec3( 0.0 ); vec4 col = uColor; if ( uColor[0] == -1.0 ){ col = aColor; } vec3 norm = normalize(vec3( uNormalTransform * vec4( aNormal, 0.0 ) )); vec4 ecPos4 = uView * uModel * vec4(aVertex, 1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( uLightCount == 0 ) { vFrontColor = col + vec4(uMaterialSpecular, 1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= uLightCount ){ break; } if( l.type == 0 ) { AmbientLight( finalAmbient, ecPos, l ); } else if( l.type == 1 ) { DirectionalLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else if( l.type == 2 ) { PointLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else { SpotLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } } if( uUsingMat == false ) { vFrontColor = vec4( vec3( col ) * finalAmbient + vec3( col ) * finalDiffuse + vec3( col ) * finalSpecular, col[3] ); } else{ vFrontColor = vec4( uMaterialEmissive + (vec3(col) * uMaterialAmbient * finalAmbient ) + (vec3(col) * finalDiffuse) + (uMaterialSpecular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = uProjection * uView * uModel * vec4( aVertex, 1.0 );}"; | ||
1705 | var aF = "#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform sampler2D uSampler;uniform bool uUsingTexture;varying vec2 vTexture;void main(void){ if( uUsingTexture ){ gl_FragColor = vec4(texture2D(uSampler, vTexture.xy)) * vFrontColor; } else{ gl_FragColor = vFrontColor; }}"; | ||
1706 | |||
1707 | function d2(ec, eb, ee, ed) { | ||
1708 | var ea = dC.locations[ec]; | ||
1709 | if (ea === t) { | ||
1710 | ea = d8.getUniformLocation(eb, ee); | ||
1711 | dC.locations[ec] = ea | ||
1712 | } | ||
1713 | if (ea !== null) { | ||
1714 | if (ed.length === 4) { | ||
1715 | d8.uniform4fv(ea, ed) | ||
1716 | } else { | ||
1717 | if (ed.length === 3) { | ||
1718 | d8.uniform3fv(ea, ed) | ||
1719 | } else { | ||
1720 | if (ed.length === 2) { | ||
1721 | d8.uniform2fv(ea, ed) | ||
1722 | } else { | ||
1723 | d8.uniform1f(ea, ed) | ||
1724 | } | ||
1725 | } | ||
1726 | } | ||
1727 | } | ||
1728 | } | ||
1729 | |||
1730 | function dZ(ec, eb, ee, ed) { | ||
1731 | var ea = dC.locations[ec]; | ||
1732 | if (ea === t) { | ||
1733 | ea = d8.getUniformLocation(eb, ee); | ||
1734 | dC.locations[ec] = ea | ||
1735 | } | ||
1736 | if (ea !== null) { | ||
1737 | if (ed.length === 4) { | ||
1738 | d8.uniform4iv(ea, ed) | ||
1739 | } else { | ||
1740 | if (ed.length === 3) { | ||
1741 | d8.uniform3iv(ea, ed) | ||
1742 | } else { | ||
1743 | if (ed.length === 2) { | ||
1744 | d8.uniform2iv(ea, ed) | ||
1745 | } else { | ||
1746 | d8.uniform1i(ea, ed) | ||
1747 | } | ||
1748 | } | ||
1749 | } | ||
1750 | } | ||
1751 | } | ||
1752 | |||
1753 | function a9(ee, ec, ef, ed, eb) { | ||
1754 | var ea = dC.locations[ee]; | ||
1755 | if (ea === t) { | ||
1756 | ea = d8.getUniformLocation(ec, ef); | ||
1757 | dC.locations[ee] = ea | ||
1758 | } | ||
1759 | if (ea !== -1) { | ||
1760 | if (eb.length === 16) { | ||
1761 | d8.uniformMatrix4fv(ea, ed, eb) | ||
1762 | } else { | ||
1763 | if (eb.length === 9) { | ||
1764 | d8.uniformMatrix3fv(ea, ed, eb) | ||
1765 | } else { | ||
1766 | d8.uniformMatrix2fv(ea, ed, eb) | ||
1767 | } | ||
1768 | } | ||
1769 | } | ||
1770 | } | ||
1771 | |||
1772 | function dc(ee, ec, ef, eb, ed) { | ||
1773 | var ea = dC.attributes[ee]; | ||
1774 | if (ea === t) { | ||
1775 | ea = d8.getAttribLocation(ec, ef); | ||
1776 | dC.attributes[ee] = ea | ||
1777 | } | ||
1778 | if (ea !== -1) { | ||
1779 | d8.bindBuffer(d8.ARRAY_BUFFER, ed); | ||
1780 | d8.vertexAttribPointer(ea, eb, d8.FLOAT, false, 0, 0); | ||
1781 | d8.enableVertexAttribArray(ea) | ||
1782 | } | ||
1783 | } | ||
1784 | |||
1785 | function cg(ec, eb, ed) { | ||
1786 | var ea = dC.attributes[ec]; | ||
1787 | if (ea === t) { | ||
1788 | ea = d8.getAttribLocation(eb, ed); | ||
1789 | dC.attributes[ec] = ea | ||
1790 | } | ||
1791 | if (ea !== -1) { | ||
1792 | d8.disableVertexAttribArray(ea) | ||
1793 | } | ||
1794 | } | ||
1795 | var bF = function(ec, ee, eb) { | ||
1796 | var ef = ec.createShader(ec.VERTEX_SHADER); | ||
1797 | ec.shaderSource(ef, ee); | ||
1798 | ec.compileShader(ef); | ||
1799 | if (!ec.getShaderParameter(ef, ec.COMPILE_STATUS)) { | ||
1800 | throw ec.getShaderInfoLog(ef) | ||
1801 | } | ||
1802 | var ed = ec.createShader(ec.FRAGMENT_SHADER); | ||
1803 | ec.shaderSource(ed, eb); | ||
1804 | ec.compileShader(ed); | ||
1805 | if (!ec.getShaderParameter(ed, ec.COMPILE_STATUS)) { | ||
1806 | throw ec.getShaderInfoLog(ed) | ||
1807 | } | ||
1808 | var ea = ec.createProgram(); | ||
1809 | ec.attachShader(ea, ef); | ||
1810 | ec.attachShader(ea, ed); | ||
1811 | ec.linkProgram(ea); | ||
1812 | if (!ec.getProgramParameter(ea, ec.LINK_STATUS)) { | ||
1813 | throw "Error linking shaders." | ||
1814 | } | ||
1815 | return ea | ||
1816 | }; | ||
1817 | var aZ = function(ea, ee, eb, ed, ec) { | ||
1818 | return { | ||
1819 | x: ea, | ||
1820 | y: ee, | ||
1821 | w: eb, | ||
1822 | h: ed | ||
1823 | } | ||
1824 | }; | ||
1825 | var bk = aZ; | ||
1826 | var b1 = function(ea, ee, eb, ed, ec) { | ||
1827 | return { | ||
1828 | x: ea, | ||
1829 | y: ee, | ||
1830 | w: ec ? eb : eb - ea, | ||
1831 | h: ec ? ed : ed - ee | ||
1832 | } | ||
1833 | }; | ||
1834 | var aN = function(ea, ee, eb, ed, ec) { | ||
1835 | return { | ||
1836 | x: ea - eb / 2, | ||
1837 | y: ee - ed / 2, | ||
1838 | w: eb, | ||
1839 | h: ed | ||
1840 | } | ||
1841 | }; | ||
1842 | var ds = function() {}; | ||
1843 | var bR = function() {}; | ||
1844 | var bB = function() {}; | ||
1845 | var ca = function() {}; | ||
1846 | bR.prototype = new ds; | ||
1847 | bR.prototype.constructor = bR; | ||
1848 | bB.prototype = new ds; | ||
1849 | bB.prototype.constructor = bB; | ||
1850 | ca.prototype = new ds; | ||
1851 | ca.prototype.constructor = ca; | ||
1852 | ds.prototype.a3DOnlyFunction = G; | ||
1853 | var cl = {}; | ||
1854 | var bP = cW.Character = function(ea) { | ||
1855 | if (typeof ea === "string" && ea.length === 1) { | ||
1856 | this.code = ea.charCodeAt(0) | ||
1857 | } else { | ||
1858 | if (typeof ea === "number") { | ||
1859 | this.code = ea | ||
1860 | } else { | ||
1861 | if (ea instanceof bP) { | ||
1862 | this.code = ea | ||
1863 | } else { | ||
1864 | this.code = NaN | ||
1865 | } | ||
1866 | } | ||
1867 | } | ||
1868 | return cl[this.code] === t ? cl[this.code] = this : cl[this.code] | ||
1869 | }; | ||
1870 | bP.prototype.toString = function() { | ||
1871 | return String.fromCharCode(this.code) | ||
1872 | }; | ||
1873 | bP.prototype.valueOf = function() { | ||
1874 | return this.code | ||
1875 | }; | ||
1876 | var O = cW.PShape = function(ea) { | ||
1877 | this.family = ea || 0; | ||
1878 | this.visible = true; | ||
1879 | this.style = true; | ||
1880 | this.children = []; | ||
1881 | this.nameTable = []; | ||
1882 | this.params = []; | ||
1883 | this.name = ""; | ||
1884 | this.image = null; | ||
1885 | this.matrix = null; | ||
1886 | this.kind = null; | ||
1887 | this.close = null; | ||
1888 | this.width = null; | ||
1889 | this.height = null; | ||
1890 | this.parent = null | ||
1891 | }; | ||
1892 | O.prototype = { | ||
1893 | isVisible: function() { | ||
1894 | return this.visible | ||
1895 | }, | ||
1896 | setVisible: function(ea) { | ||
1897 | this.visible = ea | ||
1898 | }, | ||
1899 | disableStyle: function() { | ||
1900 | this.style = false; | ||
1901 | for (var eb = 0, ea = this.children.length; eb < ea; eb++) { | ||
1902 | this.children[eb].disableStyle() | ||
1903 | } | ||
1904 | }, | ||
1905 | enableStyle: function() { | ||
1906 | this.style = true; | ||
1907 | for (var eb = 0, ea = this.children.length; eb < ea; eb++) { | ||
1908 | this.children[eb].enableStyle() | ||
1909 | } | ||
1910 | }, | ||
1911 | getFamily: function() { | ||
1912 | return this.family | ||
1913 | }, | ||
1914 | getWidth: function() { | ||
1915 | return this.width | ||
1916 | }, | ||
1917 | getHeight: function() { | ||
1918 | return this.height | ||
1919 | }, | ||
1920 | setName: function(ea) { | ||
1921 | this.name = ea | ||
1922 | }, | ||
1923 | getName: function() { | ||
1924 | return this.name | ||
1925 | }, | ||
1926 | draw: function(ea) { | ||
1927 | ea = ea || cW; | ||
1928 | if (this.visible) { | ||
1929 | this.pre(ea); | ||
1930 | this.drawImpl(ea); | ||
1931 | this.post(ea) | ||
1932 | } | ||
1933 | }, | ||
1934 | drawImpl: function(ea) { | ||
1935 | if (this.family === 0) { | ||
1936 | this.drawGroup(ea) | ||
1937 | } else { | ||
1938 | if (this.family === 1) { | ||
1939 | this.drawPrimitive(ea) | ||
1940 | } else { | ||
1941 | if (this.family === 3) { | ||
1942 | this.drawGeometry(ea) | ||
1943 | } else { | ||
1944 | if (this.family === 21) { | ||
1945 | this.drawPath(ea) | ||
1946 | } | ||
1947 | } | ||
1948 | } | ||
1949 | } | ||
1950 | }, | ||
1951 | drawPath: function(ec) { | ||
1952 | var ed, eb; | ||
1953 | if (this.vertices.length === 0) { | ||
1954 | return | ||
1955 | } | ||
1956 | ec.beginShape(); | ||
1957 | if (this.vertexCodes.length === 0) { | ||
1958 | if (this.vertices[0].length === 2) { | ||
1959 | for (ed = 0, eb = this.vertices.length; ed < eb; ed++) { | ||
1960 | ec.vertex(this.vertices[ed][0], this.vertices[ed][1]) | ||
1961 | } | ||
1962 | } else { | ||
1963 | for (ed = 0, eb = this.vertices.length; ed < eb; ed++) { | ||
1964 | ec.vertex(this.vertices[ed][0], this.vertices[ed][1], this.vertices[ed][2]) | ||
1965 | } | ||
1966 | } | ||
1967 | } else { | ||
1968 | var ea = 0; | ||
1969 | if (this.vertices[0].length === 2) { | ||
1970 | for (ed = 0, eb = this.vertexCodes.length; ed < eb; ed++) { | ||
1971 | if (this.vertexCodes[ed] === 0) { | ||
1972 | ec.vertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea]["moveTo"]); | ||
1973 | ec.breakShape = false; | ||
1974 | ea++ | ||
1975 | } else { | ||
1976 | if (this.vertexCodes[ed] === 1) { | ||
1977 | ec.bezierVertex(this.vertices[ea + 0][0], this.vertices[ea + 0][1], this.vertices[ea + 1][0], this.vertices[ea + 1][1], this.vertices[ea + 2][0], this.vertices[ea + 2][1]); | ||
1978 | ea += 3 | ||
1979 | } else { | ||
1980 | if (this.vertexCodes[ed] === 2) { | ||
1981 | ec.curveVertex(this.vertices[ea][0], this.vertices[ea][1]); | ||
1982 | ea++ | ||
1983 | } else { | ||
1984 | if (this.vertexCodes[ed] === 3) { | ||
1985 | ec.breakShape = true | ||
1986 | } | ||
1987 | } | ||
1988 | } | ||
1989 | } | ||
1990 | } | ||
1991 | } else { | ||
1992 | for (ed = 0, eb = this.vertexCodes.length; ed < eb; ed++) { | ||
1993 | if (this.vertexCodes[ed] === 0) { | ||
1994 | ec.vertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea][2]); | ||
1995 | if (this.vertices[ea]["moveTo"] === true) { | ||
1996 | bb[bb.length - 1]["moveTo"] = true | ||
1997 | } else { | ||
1998 | if (this.vertices[ea]["moveTo"] === false) { | ||
1999 | bb[bb.length - 1]["moveTo"] = false | ||
2000 | } | ||
2001 | } | ||
2002 | ec.breakShape = false | ||
2003 | } else { | ||
2004 | if (this.vertexCodes[ed] === 1) { | ||
2005 | ec.bezierVertex(this.vertices[ea + 0][0], this.vertices[ea + 0][1], this.vertices[ea + 0][2], this.vertices[ea + 1][0], this.vertices[ea + 1][1], this.vertices[ea + 1][2], this.vertices[ea + 2][0], this.vertices[ea + 2][1], this.vertices[ea + 2][2]); | ||
2006 | ea += 3 | ||
2007 | } else { | ||
2008 | if (this.vertexCodes[ed] === 2) { | ||
2009 | ec.curveVertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea][2]); | ||
2010 | ea++ | ||
2011 | } else { | ||
2012 | if (this.vertexCodes[ed] === 3) { | ||
2013 | ec.breakShape = true | ||
2014 | } | ||
2015 | } | ||
2016 | } | ||
2017 | } | ||
2018 | } | ||
2019 | } | ||
2020 | } | ||
2021 | ec.endShape(this.close ? 2 : 1) | ||
2022 | }, | ||
2023 | drawGeometry: function(ec) { | ||
2024 | var ed, eb; | ||
2025 | ec.beginShape(this.kind); | ||
2026 | if (this.style) { | ||
2027 | for (ed = 0, eb = this.vertices.length; ed < eb; ed++) { | ||
2028 | ec.vertex(this.vertices[ed]) | ||
2029 | } | ||
2030 | } else { | ||
2031 | for (ed = 0, eb = this.vertices.length; ed < eb; ed++) { | ||
2032 | var ea = this.vertices[ed]; | ||
2033 | if (ea[2] === 0) { | ||
2034 | ec.vertex(ea[0], ea[1]) | ||
2035 | } else { | ||
2036 | ec.vertex(ea[0], ea[1], ea[2]) | ||
2037 | } | ||
2038 | } | ||
2039 | } | ||
2040 | ec.endShape() | ||
2041 | }, | ||
2042 | drawGroup: function(eb) { | ||
2043 | for (var ec = 0, ea = this.children.length; ec < ea; ec++) { | ||
2044 | this.children[ec].draw(eb) | ||
2045 | } | ||
2046 | }, | ||
2047 | drawPrimitive: function(ea) { | ||
2048 | if (this.kind === 2) { | ||
2049 | ea.point(this.params[0], this.params[1]) | ||
2050 | } else { | ||
2051 | if (this.kind === 4) { | ||
2052 | if (this.params.length === 4) { | ||
2053 | ea.line(this.params[0], this.params[1], this.params[2], this.params[3]) | ||
2054 | } else { | ||
2055 | ea.line(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5]) | ||
2056 | } | ||
2057 | } else { | ||
2058 | if (this.kind === 8) { | ||
2059 | ea.triangle(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5]) | ||
2060 | } else { | ||
2061 | if (this.kind === 16) { | ||
2062 | ea.quad(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5], this.params[6], this.params[7]) | ||
2063 | } else { | ||
2064 | if (this.kind === 30) { | ||
2065 | if (this.image !== null) { | ||
2066 | var ee = bk; | ||
2067 | ea.imageMode(0); | ||
2068 | ea.image(this.image, this.params[0], this.params[1], this.params[2], this.params[3]); | ||
2069 | bk = ee | ||
2070 | } else { | ||
2071 | var eb = bK; | ||
2072 | ea.rectMode(0); | ||
2073 | ea.rect(this.params[0], this.params[1], this.params[2], this.params[3]); | ||
2074 | bK = eb | ||
2075 | } | ||
2076 | } else { | ||
2077 | if (this.kind === 31) { | ||
2078 | var ec = cN; | ||
2079 | ea.ellipseMode(0); | ||
2080 | ea.ellipse(this.params[0], this.params[1], this.params[2], this.params[3]); | ||
2081 | cN = ec | ||
2082 | } else { | ||
2083 | if (this.kind === 32) { | ||
2084 | var ed = cN; | ||
2085 | ea.ellipseMode(0); | ||
2086 | ea.arc(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5]); | ||
2087 | cN = ed | ||
2088 | } else { | ||
2089 | if (this.kind === 41) { | ||
2090 | if (this.params.length === 1) { | ||
2091 | ea.box(this.params[0]) | ||
2092 | } else { | ||
2093 | ea.box(this.params[0], this.params[1], this.params[2]) | ||
2094 | } | ||
2095 | } else { | ||
2096 | if (this.kind === 40) { | ||
2097 | ea.sphere(this.params[0]) | ||
2098 | } | ||
2099 | } | ||
2100 | } | ||
2101 | } | ||
2102 | } | ||
2103 | } | ||
2104 | } | ||
2105 | } | ||
2106 | } | ||
2107 | }, | ||
2108 | pre: function(ea) { | ||
2109 | if (this.matrix) { | ||
2110 | ea.pushMatrix(); | ||
2111 | ea.transform(this.matrix) | ||
2112 | } | ||
2113 | if (this.style) { | ||
2114 | ea.pushStyle(); | ||
2115 | this.styles(ea) | ||
2116 | } | ||
2117 | }, | ||
2118 | post: function(ea) { | ||
2119 | if (this.matrix) { | ||
2120 | ea.popMatrix() | ||
2121 | } | ||
2122 | if (this.style) { | ||
2123 | ea.popStyle() | ||
2124 | } | ||
2125 | }, | ||
2126 | styles: function(ea) { | ||
2127 | if (this.stroke) { | ||
2128 | ea.stroke(this.strokeColor); | ||
2129 | ea.strokeWeight(this.strokeWeight); | ||
2130 | ea.strokeCap(this.strokeCap); | ||
2131 | ea.strokeJoin(this.strokeJoin) | ||
2132 | } else { | ||
2133 | ea.noStroke() | ||
2134 | } if (this.fill) { | ||
2135 | ea.fill(this.fillColor) | ||
2136 | } else { | ||
2137 | ea.noFill() | ||
2138 | } | ||
2139 | }, | ||
2140 | getChild: function(ed) { | ||
2141 | var eb, ea; | ||
2142 | if (typeof ed === "number") { | ||
2143 | return this.children[ed] | ||
2144 | } | ||
2145 | var ec; | ||
2146 | if (ed === "" || this.name === ed) { | ||
2147 | return this | ||
2148 | } | ||
2149 | if (this.nameTable.length > 0) { | ||
2150 | for (eb = 0, ea = this.nameTable.length; eb < ea || ec; eb++) { | ||
2151 | if (this.nameTable[eb].getName === ed) { | ||
2152 | ec = this.nameTable[eb]; | ||
2153 | break | ||
2154 | } | ||
2155 | } | ||
2156 | if (ec) { | ||
2157 | return ec | ||
2158 | } | ||
2159 | } | ||
2160 | for (eb = 0, ea = this.children.length; eb < ea; eb++) { | ||
2161 | ec = this.children[eb].getChild(ed); | ||
2162 | if (ec) { | ||
2163 | return ec | ||
2164 | } | ||
2165 | } | ||
2166 | return null | ||
2167 | }, | ||
2168 | getChildCount: function() { | ||
2169 | return this.children.length | ||
2170 | }, | ||
2171 | addChild: function(ea) { | ||
2172 | this.children.push(ea); | ||
2173 | ea.parent = this; | ||
2174 | if (ea.getName() !== null) { | ||
2175 | this.addName(ea.getName(), ea) | ||
2176 | } | ||
2177 | }, | ||
2178 | addName: function(eb, ea) { | ||
2179 | if (this.parent !== null) { | ||
2180 | this.parent.addName(eb, ea) | ||
2181 | } else { | ||
2182 | this.nameTable.push([eb, ea]) | ||
2183 | } | ||
2184 | }, | ||
2185 | translate: function() { | ||
2186 | if (arguments.length === 2) { | ||
2187 | this.checkMatrix(2); | ||
2188 | this.matrix.translate(arguments[0], arguments[1]) | ||
2189 | } else { | ||
2190 | this.checkMatrix(3); | ||
2191 | this.matrix.translate(arguments[0], arguments[1], 0) | ||
2192 | } | ||
2193 | }, | ||
2194 | checkMatrix: function(ea) { | ||
2195 | if (this.matrix === null) { | ||
2196 | if (ea === 2) { | ||
2197 | this.matrix = new cW.PMatrix2D | ||
2198 | } else { | ||
2199 | this.matrix = new cW.PMatrix3D | ||
2200 | } | ||
2201 | } else { | ||
2202 | if (ea === 3 && this.matrix instanceof cW.PMatrix2D) { | ||
2203 | this.matrix = new cW.PMatrix3D | ||
2204 | } | ||
2205 | } | ||
2206 | }, | ||
2207 | rotateX: function(ea) { | ||
2208 | this.rotate(ea, 1, 0, 0) | ||
2209 | }, | ||
2210 | rotateY: function(ea) { | ||
2211 | this.rotate(ea, 0, 1, 0) | ||
2212 | }, | ||
2213 | rotateZ: function(ea) { | ||
2214 | this.rotate(ea, 0, 0, 1) | ||
2215 | }, | ||
2216 | rotate: function() { | ||
2217 | if (arguments.length === 1) { | ||
2218 | this.checkMatrix(2); | ||
2219 | this.matrix.rotate(arguments[0]) | ||
2220 | } else { | ||
2221 | this.checkMatrix(3); | ||
2222 | this.matrix.rotate(arguments[0], arguments[1], arguments[2], arguments[3]) | ||
2223 | } | ||
2224 | }, | ||
2225 | scale: function() { | ||
2226 | if (arguments.length === 2) { | ||
2227 | this.checkMatrix(2); | ||
2228 | this.matrix.scale(arguments[0], arguments[1]) | ||
2229 | } else { | ||
2230 | if (arguments.length === 3) { | ||
2231 | this.checkMatrix(2); | ||
2232 | this.matrix.scale(arguments[0], arguments[1], arguments[2]) | ||
2233 | } else { | ||
2234 | this.checkMatrix(2); | ||
2235 | this.matrix.scale(arguments[0]) | ||
2236 | } | ||
2237 | } | ||
2238 | }, | ||
2239 | resetMatrix: function() { | ||
2240 | this.checkMatrix(2); | ||
2241 | this.matrix.reset() | ||
2242 | }, | ||
2243 | applyMatrix: function(ea) { | ||
2244 | if (arguments.length === 1) { | ||
2245 | this.applyMatrix(ea.elements[0], ea.elements[1], 0, ea.elements[2], ea.elements[3], ea.elements[4], 0, ea.elements[5], 0, 0, 1, 0, 0, 0, 0, 1) | ||
2246 | } else { | ||
2247 | if (arguments.length === 6) { | ||
2248 | this.checkMatrix(2); | ||
2249 | this.matrix.apply(arguments[0], arguments[1], arguments[2], 0, arguments[3], arguments[4], arguments[5], 0, 0, 0, 1, 0, 0, 0, 0, 1) | ||
2250 | } else { | ||
2251 | if (arguments.length === 16) { | ||
2252 | this.checkMatrix(3); | ||
2253 | this.matrix.apply(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10], arguments[11], arguments[12], arguments[13], arguments[14], arguments[15]) | ||
2254 | } | ||
2255 | } | ||
2256 | } | ||
2257 | } | ||
2258 | }; | ||
2259 | var cr = cW.PShapeSVG = function() { | ||
2260 | cW.PShape.call(this); | ||
2261 | if (arguments.length === 1) { | ||
2262 | this.element = arguments[0]; | ||
2263 | this.vertexCodes = []; | ||
2264 | this.vertices = []; | ||
2265 | this.opacity = 1; | ||
2266 | this.stroke = false; | ||
2267 | this.strokeColor = 4278190080; | ||
2268 | this.strokeWeight = 1; | ||
2269 | this.strokeCap = "butt"; | ||
2270 | this.strokeJoin = "miter"; | ||
2271 | this.strokeGradient = null; | ||
2272 | this.strokeGradientPaint = null; | ||
2273 | this.strokeName = null; | ||
2274 | this.strokeOpacity = 1; | ||
2275 | this.fill = true; | ||
2276 | this.fillColor = 4278190080; | ||
2277 | this.fillGradient = null; | ||
2278 | this.fillGradientPaint = null; | ||
2279 | this.fillName = null; | ||
2280 | this.fillOpacity = 1; | ||
2281 | if (this.element.getName() !== "svg") { | ||
2282 | throw "root is not <svg>, it's <" + this.element.getName() + ">" | ||
2283 | } | ||
2284 | } else { | ||
2285 | if (arguments.length === 2) { | ||
2286 | if (typeof arguments[1] === "string") { | ||
2287 | if (arguments[1].indexOf(".svg") > -1) { | ||
2288 | this.element = new cW.XMLElement(cW, arguments[1]); | ||
2289 | this.vertexCodes = []; | ||
2290 | this.vertices = []; | ||
2291 | this.opacity = 1; | ||
2292 | this.stroke = false; | ||
2293 | this.strokeColor = 4278190080; | ||
2294 | this.strokeWeight = 1; | ||
2295 | this.strokeCap = "butt"; | ||
2296 | this.strokeJoin = "miter"; | ||
2297 | this.strokeGradient = ""; | ||
2298 | this.strokeGradientPaint = ""; | ||
2299 | this.strokeName = ""; | ||
2300 | this.strokeOpacity = 1; | ||
2301 | this.fill = true; | ||
2302 | this.fillColor = 4278190080; | ||
2303 | this.fillGradient = null; | ||
2304 | this.fillGradientPaint = null; | ||
2305 | this.fillOpacity = 1 | ||
2306 | } | ||
2307 | } else { | ||
2308 | if (arguments[0]) { | ||
2309 | this.element = arguments[1]; | ||
2310 | this.vertexCodes = arguments[0].vertexCodes.slice(); | ||
2311 | this.vertices = arguments[0].vertices.slice(); | ||
2312 | this.stroke = arguments[0].stroke; | ||
2313 | this.strokeColor = arguments[0].strokeColor; | ||
2314 | this.strokeWeight = arguments[0].strokeWeight; | ||
2315 | this.strokeCap = arguments[0].strokeCap; | ||
2316 | this.strokeJoin = arguments[0].strokeJoin; | ||
2317 | this.strokeGradient = arguments[0].strokeGradient; | ||
2318 | this.strokeGradientPaint = arguments[0].strokeGradientPaint; | ||
2319 | this.strokeName = arguments[0].strokeName; | ||
2320 | this.fill = arguments[0].fill; | ||
2321 | this.fillColor = arguments[0].fillColor; | ||
2322 | this.fillGradient = arguments[0].fillGradient; | ||
2323 | this.fillGradientPaint = arguments[0].fillGradientPaint; | ||
2324 | this.fillName = arguments[0].fillName; | ||
2325 | this.strokeOpacity = arguments[0].strokeOpacity; | ||
2326 | this.fillOpacity = arguments[0].fillOpacity; | ||
2327 | this.opacity = arguments[0].opacity | ||
2328 | } | ||
2329 | } | ||
2330 | } | ||
2331 | } | ||
2332 | this.name = this.element.getStringAttribute("id"); | ||
2333 | var ea = this.element.getStringAttribute("display", "inline"); | ||
2334 | this.visible = ea !== "none"; | ||
2335 | var ef = this.element.getAttribute("transform"); | ||
2336 | if (ef) { | ||
2337 | this.matrix = this.parseMatrix(ef) | ||
2338 | } | ||
2339 | var ec = this.element.getStringAttribute("viewBox"); | ||
2340 | if (ec !== null) { | ||
2341 | var ee = ec.split(" "); | ||
2342 | this.width = ee[2]; | ||
2343 | this.height = ee[3] | ||
2344 | } | ||
2345 | var eb = this.element.getStringAttribute("width"); | ||
2346 | var ed = this.element.getStringAttribute("height"); | ||
2347 | if (eb !== null) { | ||
2348 | this.width = this.parseUnitSize(eb); | ||
2349 | this.height = this.parseUnitSize(ed) | ||
2350 | } else { | ||
2351 | if (this.width === 0 || this.height === 0) { | ||
2352 | this.width = 1; | ||
2353 | this.height = 1; | ||
2354 | throw "The width and/or height is not readable in the <svg> tag of this file." | ||
2355 | } | ||
2356 | } | ||
2357 | this.parseColors(this.element); | ||
2358 | this.parseChildren(this.element) | ||
2359 | }; | ||
2360 | cr.prototype = new O; | ||
2361 | cr.prototype.parseMatrix = function() { | ||
2362 | function ea(ec) { | ||
2363 | var eb = []; | ||
2364 | ec.replace(/\((.*?)\)/, function() { | ||
2365 | return function(ed, ee) { | ||
2366 | eb = ee.replace(/,+/g, " ").split(/\s+/) | ||
2367 | } | ||
2368 | }()); | ||
2369 | return eb | ||
2370 | } | ||
2371 | return function(ei) { | ||
2372 | this.checkMatrix(2); | ||
2373 | var eb = []; | ||
2374 | ei.replace(/\s*(\w+)\((.*?)\)/g, function(el) { | ||
2375 | eb.push(cW.trim(el)) | ||
2376 | }); | ||
2377 | if (eb.length === 0) { | ||
2378 | return null | ||
2379 | } | ||
2380 | for (var eg = 0, ee = eb.length; eg < ee; eg++) { | ||
2381 | var ec = ea(eb[eg]); | ||
2382 | if (eb[eg].indexOf("matrix") !== -1) { | ||
2383 | this.matrix.set(ec[0], ec[2], ec[4], ec[1], ec[3], ec[5]) | ||
2384 | } else { | ||
2385 | if (eb[eg].indexOf("translate") !== -1) { | ||
2386 | var eh = ec[0]; | ||
2387 | var ef = ec.length === 2 ? ec[1] : 0; | ||
2388 | this.matrix.translate(eh, ef) | ||
2389 | } else { | ||
2390 | if (eb[eg].indexOf("scale") !== -1) { | ||
2391 | var ek = ec[0]; | ||
2392 | var ej = ec.length === 2 ? ec[1] : ec[0]; | ||
2393 | this.matrix.scale(ek, ej) | ||
2394 | } else { | ||
2395 | if (eb[eg].indexOf("rotate") !== -1) { | ||
2396 | var ed = ec[0]; | ||
2397 | if (ec.length === 1) { | ||
2398 | this.matrix.rotate(cW.radians(ed)) | ||
2399 | } else { | ||
2400 | if (ec.length === 3) { | ||
2401 | this.matrix.translate(ec[1], ec[2]); | ||
2402 | this.matrix.rotate(cW.radians(ec[0])); | ||
2403 | this.matrix.translate(-ec[1], -ec[2]) | ||
2404 | } | ||
2405 | } | ||
2406 | } else { | ||
2407 | if (eb[eg].indexOf("skewX") !== -1) { | ||
2408 | this.matrix.skewX(parseFloat(ec[0])) | ||
2409 | } else { | ||
2410 | if (eb[eg].indexOf("skewY") !== -1) { | ||
2411 | this.matrix.skewY(ec[0]) | ||
2412 | } else { | ||
2413 | if (eb[eg].indexOf("shearX") !== -1) { | ||
2414 | this.matrix.shearX(ec[0]) | ||
2415 | } else { | ||
2416 | if (eb[eg].indexOf("shearY") !== -1) { | ||
2417 | this.matrix.shearY(ec[0]) | ||
2418 | } | ||
2419 | } | ||
2420 | } | ||
2421 | } | ||
2422 | } | ||
2423 | } | ||
2424 | } | ||
2425 | } | ||
2426 | } | ||
2427 | return this.matrix | ||
2428 | } | ||
2429 | }(); | ||
2430 | cr.prototype.parseChildren = function(ef) { | ||
2431 | var eb = ef.getChildren(); | ||
2432 | var ee = new cW.PShape; | ||
2433 | for (var ed = 0, ec = eb.length; ed < ec; ed++) { | ||
2434 | var ea = this.parseChild(eb[ed]); | ||
2435 | if (ea) { | ||
2436 | ee.addChild(ea) | ||
2437 | } | ||
2438 | } | ||
2439 | this.children.push(ee) | ||
2440 | }; | ||
2441 | cr.prototype.getName = function() { | ||
2442 | return this.name | ||
2443 | }; | ||
2444 | cr.prototype.parseChild = function(ec) { | ||
2445 | var eb = ec.getName(); | ||
2446 | var ea; | ||
2447 | if (eb === "g") { | ||
2448 | ea = new cr(this, ec) | ||
2449 | } else { | ||
2450 | if (eb === "defs") { | ||
2451 | ea = new cr(this, ec) | ||
2452 | } else { | ||
2453 | if (eb === "line") { | ||
2454 | ea = new cr(this, ec); | ||
2455 | ea.parseLine() | ||
2456 | } else { | ||
2457 | if (eb === "circle") { | ||
2458 | ea = new cr(this, ec); | ||
2459 | ea.parseEllipse(true) | ||
2460 | } else { | ||
2461 | if (eb === "ellipse") { | ||
2462 | ea = new cr(this, ec); | ||
2463 | ea.parseEllipse(false) | ||
2464 | } else { | ||
2465 | if (eb === "rect") { | ||
2466 | ea = new cr(this, ec); | ||
2467 | ea.parseRect() | ||
2468 | } else { | ||
2469 | if (eb === "polygon") { | ||
2470 | ea = new cr(this, ec); | ||
2471 | ea.parsePoly(true) | ||
2472 | } else { | ||
2473 | if (eb === "polyline") { | ||
2474 | ea = new cr(this, ec); | ||
2475 | ea.parsePoly(false) | ||
2476 | } else { | ||
2477 | if (eb === "path") { | ||
2478 | ea = new cr(this, ec); | ||
2479 | ea.parsePath() | ||
2480 | } else { | ||
2481 | if (eb === "radialGradient") { | ||
2482 | dw("PShapeSVG.prototype.parseChild, name = radialGradient") | ||
2483 | } else { | ||
2484 | if (eb === "linearGradient") { | ||
2485 | dw("PShapeSVG.prototype.parseChild, name = linearGradient") | ||
2486 | } else { | ||
2487 | if (eb === "text") { | ||
2488 | dw("PShapeSVG.prototype.parseChild, name = text") | ||
2489 | } else { | ||
2490 | if (eb === "filter") { | ||
2491 | dw("PShapeSVG.prototype.parseChild, name = filter") | ||
2492 | } else { | ||
2493 | if (eb === "mask") { | ||
2494 | dw("PShapeSVG.prototype.parseChild, name = mask") | ||
2495 | } else { | ||
2496 | G() | ||
2497 | } | ||
2498 | } | ||
2499 | } | ||
2500 | } | ||
2501 | } | ||
2502 | } | ||
2503 | } | ||
2504 | } | ||
2505 | } | ||
2506 | } | ||
2507 | } | ||
2508 | } | ||
2509 | } | ||
2510 | } | ||
2511 | return ea | ||
2512 | }; | ||
2513 | cr.prototype.parsePath = function() { | ||
2514 | this.family = 21; | ||
2515 | this.kind = 0; | ||
2516 | var ef = []; | ||
2517 | var ez; | ||
2518 | var ey = cW.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g, " ")); | ||
2519 | if (ey === null) { | ||
2520 | return | ||
2521 | } | ||
2522 | ey = cW.__toCharArray(ey); | ||
2523 | var ed = 0, | ||
2524 | ec = 0, | ||
2525 | ek = 0, | ||
2526 | ei = 0, | ||
2527 | ej = 0, | ||
2528 | eh = 0, | ||
2529 | eq = 0, | ||
2530 | ep = 0, | ||
2531 | eb = 0, | ||
2532 | ea = 0, | ||
2533 | em = 0, | ||
2534 | el = 0, | ||
2535 | eo = 0, | ||
2536 | en = 0, | ||
2537 | ex = 0, | ||
2538 | et = 0; | ||
2539 | var er = ""; | ||
2540 | var ev = []; | ||
2541 | var ew = false; | ||
2542 | var eg; | ||
2543 | var ee; | ||
2544 | var eu, es; | ||
2545 | while (ex < ey.length) { | ||
2546 | et = ey[ex].valueOf(); | ||
2547 | if (et >= 65 && et <= 90 || et >= 97 && et <= 122) { | ||
2548 | eu = ex; | ||
2549 | ex++; | ||
2550 | if (ex < ey.length) { | ||
2551 | ev = []; | ||
2552 | et = ey[ex].valueOf(); | ||
2553 | while (!(et >= 65 && et <= 90 || et >= 97 && et <= 100 || et >= 102 && et <= 122) && ew === false) { | ||
2554 | if (et === 32) { | ||
2555 | if (er !== "") { | ||
2556 | ev.push(parseFloat(er)); | ||
2557 | er = "" | ||
2558 | } | ||
2559 | ex++ | ||
2560 | } else { | ||
2561 | if (et === 45) { | ||
2562 | if (ey[ex - 1].valueOf() === 101) { | ||
2563 | er += ey[ex].toString(); | ||
2564 | ex++ | ||
2565 | } else { | ||
2566 | if (er !== "") { | ||
2567 | ev.push(parseFloat(er)) | ||
2568 | } | ||
2569 | er = ey[ex].toString(); | ||
2570 | ex++ | ||
2571 | } | ||
2572 | } else { | ||
2573 | er += ey[ex].toString(); | ||
2574 | ex++ | ||
2575 | } | ||
2576 | } if (ex === ey.length) { | ||
2577 | ew = true | ||
2578 | } else { | ||
2579 | et = ey[ex].valueOf() | ||
2580 | } | ||
2581 | } | ||
2582 | } | ||
2583 | if (er !== "") { | ||
2584 | ev.push(parseFloat(er)); | ||
2585 | er = "" | ||
2586 | } | ||
2587 | ee = ey[eu]; | ||
2588 | et = ee.valueOf(); | ||
2589 | if (et === 77) { | ||
2590 | if (ev.length >= 2 && ev.length % 2 === 0) { | ||
2591 | ed = ev[0]; | ||
2592 | ec = ev[1]; | ||
2593 | this.parsePathMoveto(ed, ec); | ||
2594 | if (ev.length > 2) { | ||
2595 | for (eu = 2, es = ev.length; eu < es; eu += 2) { | ||
2596 | ed = ev[eu]; | ||
2597 | ec = ev[eu + 1]; | ||
2598 | this.parsePathLineto(ed, ec) | ||
2599 | } | ||
2600 | } | ||
2601 | } | ||
2602 | } else { | ||
2603 | if (et === 109) { | ||
2604 | if (ev.length >= 2 && ev.length % 2 === 0) { | ||
2605 | ed += ev[0]; | ||
2606 | ec += ev[1]; | ||
2607 | this.parsePathMoveto(ed, ec); | ||
2608 | if (ev.length > 2) { | ||
2609 | for (eu = 2, es = ev.length; eu < es; eu += 2) { | ||
2610 | ed += ev[eu]; | ||
2611 | ec += ev[eu + 1]; | ||
2612 | this.parsePathLineto(ed, ec) | ||
2613 | } | ||
2614 | } | ||
2615 | } | ||
2616 | } else { | ||
2617 | if (et === 76) { | ||
2618 | if (ev.length >= 2 && ev.length % 2 === 0) { | ||
2619 | for (eu = 0, es = ev.length; eu < es; eu += 2) { | ||
2620 | ed = ev[eu]; | ||
2621 | ec = ev[eu + 1]; | ||
2622 | this.parsePathLineto(ed, ec) | ||
2623 | } | ||
2624 | } | ||
2625 | } else { | ||
2626 | if (et === 108) { | ||
2627 | if (ev.length >= 2 && ev.length % 2 === 0) { | ||
2628 | for (eu = 0, es = ev.length; eu < es; eu += 2) { | ||
2629 | ed += ev[eu]; | ||
2630 | ec += ev[eu + 1]; | ||
2631 | this.parsePathLineto(ed, ec) | ||
2632 | } | ||
2633 | } | ||
2634 | } else { | ||
2635 | if (et === 72) { | ||
2636 | for (eu = 0, es = ev.length; eu < es; eu++) { | ||
2637 | ed = ev[eu]; | ||
2638 | this.parsePathLineto(ed, ec) | ||
2639 | } | ||
2640 | } else { | ||
2641 | if (et === 104) { | ||
2642 | for (eu = 0, es = ev.length; eu < es; eu++) { | ||
2643 | ed += ev[eu]; | ||
2644 | this.parsePathLineto(ed, ec) | ||
2645 | } | ||
2646 | } else { | ||
2647 | if (et === 86) { | ||
2648 | for (eu = 0, es = ev.length; eu < es; eu++) { | ||
2649 | ec = ev[eu]; | ||
2650 | this.parsePathLineto(ed, ec) | ||
2651 | } | ||
2652 | } else { | ||
2653 | if (et === 118) { | ||
2654 | for (eu = 0, es = ev.length; eu < es; eu++) { | ||
2655 | ec += ev[eu]; | ||
2656 | this.parsePathLineto(ed, ec) | ||
2657 | } | ||
2658 | } else { | ||
2659 | if (et === 67) { | ||
2660 | if (ev.length >= 6 && ev.length % 6 === 0) { | ||
2661 | for (eu = 0, es = ev.length; eu < es; eu += 6) { | ||
2662 | ej = ev[eu]; | ||
2663 | eq = ev[eu + 1]; | ||
2664 | eh = ev[eu + 2]; | ||
2665 | ep = ev[eu + 3]; | ||
2666 | eb = ev[eu + 4]; | ||
2667 | ea = ev[eu + 5]; | ||
2668 | this.parsePathCurveto(ej, eq, eh, ep, eb, ea); | ||
2669 | ed = eb; | ||
2670 | ec = ea | ||
2671 | } | ||
2672 | } | ||
2673 | } else { | ||
2674 | if (et === 99) { | ||
2675 | if (ev.length >= 6 && ev.length % 6 === 0) { | ||
2676 | for (eu = 0, es = ev.length; eu < es; eu += 6) { | ||
2677 | ej = ed + ev[eu]; | ||
2678 | eq = ec + ev[eu + 1]; | ||
2679 | eh = ed + ev[eu + 2]; | ||
2680 | ep = ec + ev[eu + 3]; | ||
2681 | eb = ed + ev[eu + 4]; | ||
2682 | ea = ec + ev[eu + 5]; | ||
2683 | this.parsePathCurveto(ej, eq, eh, ep, eb, ea); | ||
2684 | ed = eb; | ||
2685 | ec = ea | ||
2686 | } | ||
2687 | } | ||
2688 | } else { | ||
2689 | if (et === 83) { | ||
2690 | if (ev.length >= 4 && ev.length % 4 === 0) { | ||
2691 | for (eu = 0, es = ev.length; eu < es; eu += 4) { | ||
2692 | if (eg.toLowerCase() === "c" || eg.toLowerCase() === "s") { | ||
2693 | em = this.vertices[this.vertices.length - 2][0]; | ||
2694 | el = this.vertices[this.vertices.length - 2][1]; | ||
2695 | eo = this.vertices[this.vertices.length - 1][0]; | ||
2696 | en = this.vertices[this.vertices.length - 1][1]; | ||
2697 | ej = eo + (eo - em); | ||
2698 | eq = en + (en - el) | ||
2699 | } else { | ||
2700 | ej = this.vertices[this.vertices.length - 1][0]; | ||
2701 | eq = this.vertices[this.vertices.length - 1][1] | ||
2702 | } | ||
2703 | eh = ev[eu]; | ||
2704 | ep = ev[eu + 1]; | ||
2705 | eb = ev[eu + 2]; | ||
2706 | ea = ev[eu + 3]; | ||
2707 | this.parsePathCurveto(ej, eq, eh, ep, eb, ea); | ||
2708 | ed = eb; | ||
2709 | ec = ea | ||
2710 | } | ||
2711 | } | ||
2712 | } else { | ||
2713 | if (et === 115) { | ||
2714 | if (ev.length >= 4 && ev.length % 4 === 0) { | ||
2715 | for (eu = 0, es = ev.length; eu < es; eu += 4) { | ||
2716 | if (eg.toLowerCase() === "c" || eg.toLowerCase() === "s") { | ||
2717 | em = this.vertices[this.vertices.length - 2][0]; | ||
2718 | el = this.vertices[this.vertices.length - 2][1]; | ||
2719 | eo = this.vertices[this.vertices.length - 1][0]; | ||
2720 | en = this.vertices[this.vertices.length - 1][1]; | ||
2721 | ej = eo + (eo - em); | ||
2722 | eq = en + (en - el) | ||
2723 | } else { | ||
2724 | ej = this.vertices[this.vertices.length - 1][0]; | ||
2725 | eq = this.vertices[this.vertices.length - 1][1] | ||
2726 | } | ||
2727 | eh = ed + ev[eu]; | ||
2728 | ep = ec + ev[eu + 1]; | ||
2729 | eb = ed + ev[eu + 2]; | ||
2730 | ea = ec + ev[eu + 3]; | ||
2731 | this.parsePathCurveto(ej, eq, eh, ep, eb, ea); | ||
2732 | ed = eb; | ||
2733 | ec = ea | ||
2734 | } | ||
2735 | } | ||
2736 | } else { | ||
2737 | if (et === 81) { | ||
2738 | if (ev.length >= 4 && ev.length % 4 === 0) { | ||
2739 | for (eu = 0, es = ev.length; eu < es; eu += 4) { | ||
2740 | ek = ev[eu]; | ||
2741 | ei = ev[eu + 1]; | ||
2742 | eb = ev[eu + 2]; | ||
2743 | ea = ev[eu + 3]; | ||
2744 | this.parsePathQuadto(ed, ec, ek, ei, eb, ea); | ||
2745 | ed = eb; | ||
2746 | ec = ea | ||
2747 | } | ||
2748 | } | ||
2749 | } else { | ||
2750 | if (et === 113) { | ||
2751 | if (ev.length >= 4 && ev.length % 4 === 0) { | ||
2752 | for (eu = 0, es = ev.length; eu < es; eu += 4) { | ||
2753 | ek = ed + ev[eu]; | ||
2754 | ei = ec + ev[eu + 1]; | ||
2755 | eb = ed + ev[eu + 2]; | ||
2756 | ea = ec + ev[eu + 3]; | ||
2757 | this.parsePathQuadto(ed, ec, ek, ei, eb, ea); | ||
2758 | ed = eb; | ||
2759 | ec = ea | ||
2760 | } | ||
2761 | } | ||
2762 | } else { | ||
2763 | if (et === 84) { | ||
2764 | if (ev.length >= 2 && ev.length % 2 === 0) { | ||
2765 | for (eu = 0, es = ev.length; eu < es; eu += 2) { | ||
2766 | if (eg.toLowerCase() === "q" || eg.toLowerCase() === "t") { | ||
2767 | em = this.vertices[this.vertices.length - 2][0]; | ||
2768 | el = this.vertices[this.vertices.length - 2][1]; | ||
2769 | eo = this.vertices[this.vertices.length - 1][0]; | ||
2770 | en = this.vertices[this.vertices.length - 1][1]; | ||
2771 | ek = eo + (eo - em); | ||
2772 | ei = en + (en - el) | ||
2773 | } else { | ||
2774 | ek = ed; | ||
2775 | ei = ec | ||
2776 | } | ||
2777 | eb = ev[eu]; | ||
2778 | ea = ev[eu + 1]; | ||
2779 | this.parsePathQuadto(ed, ec, ek, ei, eb, ea); | ||
2780 | ed = eb; | ||
2781 | ec = ea | ||
2782 | } | ||
2783 | } | ||
2784 | } else { | ||
2785 | if (et === 116) { | ||
2786 | if (ev.length >= 2 && ev.length % 2 === 0) { | ||
2787 | for (eu = 0, es = ev.length; eu < es; eu += 2) { | ||
2788 | if (eg.toLowerCase() === "q" || eg.toLowerCase() === "t") { | ||
2789 | em = this.vertices[this.vertices.length - 2][0]; | ||
2790 | el = this.vertices[this.vertices.length - 2][1]; | ||
2791 | eo = this.vertices[this.vertices.length - 1][0]; | ||
2792 | en = this.vertices[this.vertices.length - 1][1]; | ||
2793 | ek = eo + (eo - em); | ||
2794 | ei = en + (en - el) | ||
2795 | } else { | ||
2796 | ek = ed; | ||
2797 | ei = ec | ||
2798 | } | ||
2799 | eb = ed + ev[eu]; | ||
2800 | ea = ec + ev[eu + 1]; | ||
2801 | this.parsePathQuadto(ed, ec, ek, ei, eb, ea); | ||
2802 | ed = eb; | ||
2803 | ec = ea | ||
2804 | } | ||
2805 | } | ||
2806 | } else { | ||
2807 | if (et === 90 || et === 122) { | ||
2808 | this.close = true | ||
2809 | } | ||
2810 | } | ||
2811 | } | ||
2812 | } | ||
2813 | } | ||
2814 | } | ||
2815 | } | ||
2816 | } | ||
2817 | } | ||
2818 | } | ||
2819 | } | ||
2820 | } | ||
2821 | } | ||
2822 | } | ||
2823 | } | ||
2824 | } | ||
2825 | } | ||
2826 | eg = ee.toString() | ||
2827 | } else { | ||
2828 | ex++ | ||
2829 | } | ||
2830 | } | ||
2831 | }; | ||
2832 | cr.prototype.parsePathQuadto = function(ec, ee, ea, ef, eb, ed) { | ||
2833 | if (this.vertices.length > 0) { | ||
2834 | this.parsePathCode(1); | ||
2835 | this.parsePathVertex(ec + (ea - ec) * 2 / 3, ee + (ef - ee) * 2 / 3); | ||
2836 | this.parsePathVertex(eb + (ea - eb) * 2 / 3, ed + (ef - ed) * 2 / 3); | ||
2837 | this.parsePathVertex(eb, ed) | ||
2838 | } else { | ||
2839 | throw "Path must start with M/m" | ||
2840 | } | ||
2841 | }; | ||
2842 | cr.prototype.parsePathCurveto = function(ed, ef, eb, ee, ea, ec) { | ||
2843 | if (this.vertices.length > 0) { | ||
2844 | this.parsePathCode(1); | ||
2845 | this.parsePathVertex(ed, ef); | ||
2846 | this.parsePathVertex(eb, ee); | ||
2847 | this.parsePathVertex(ea, ec) | ||
2848 | } else { | ||
2849 | throw "Path must start with M/m" | ||
2850 | } | ||
2851 | }; | ||
2852 | cr.prototype.parsePathLineto = function(eb, ea) { | ||
2853 | if (this.vertices.length > 0) { | ||
2854 | this.parsePathCode(0); | ||
2855 | this.parsePathVertex(eb, ea); | ||
2856 | this.vertices[this.vertices.length - 1]["moveTo"] = false | ||
2857 | } else { | ||
2858 | throw "Path must start with M/m" | ||
2859 | } | ||
2860 | }; | ||
2861 | cr.prototype.parsePathMoveto = function(eb, ea) { | ||
2862 | if (this.vertices.length > 0) { | ||
2863 | this.parsePathCode(3) | ||
2864 | } | ||
2865 | this.parsePathCode(0); | ||
2866 | this.parsePathVertex(eb, ea); | ||
2867 | this.vertices[this.vertices.length - 1]["moveTo"] = true | ||
2868 | }; | ||
2869 | cr.prototype.parsePathVertex = function(ea, ec) { | ||
2870 | var eb = []; | ||
2871 | eb[0] = ea; | ||
2872 | eb[1] = ec; | ||
2873 | this.vertices.push(eb) | ||
2874 | }; | ||
2875 | cr.prototype.parsePathCode = function(ea) { | ||
2876 | this.vertexCodes.push(ea) | ||
2877 | }; | ||
2878 | cr.prototype.parsePoly = function(ee) { | ||
2879 | this.family = 21; | ||
2880 | this.close = ee; | ||
2881 | var eb = cW.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g, " ")); | ||
2882 | if (eb !== null) { | ||
2883 | var ea = eb.split(" "); | ||
2884 | if (ea.length % 2 === 0) { | ||
2885 | for (var ed = 0, ec = ea.length; ed < ec; ed++) { | ||
2886 | var ef = []; | ||
2887 | ef[0] = ea[ed]; | ||
2888 | ef[1] = ea[++ed]; | ||
2889 | this.vertices.push(ef) | ||
2890 | } | ||
2891 | } else { | ||
2892 | throw "Error parsing polygon points: odd number of coordinates provided" | ||
2893 | } | ||
2894 | } | ||
2895 | }; | ||
2896 | cr.prototype.parseRect = function() { | ||
2897 | this.kind = 30; | ||
2898 | this.family = 1; | ||
2899 | this.params = []; | ||
2900 | this.params[0] = this.element.getFloatAttribute("x"); | ||
2901 | this.params[1] = this.element.getFloatAttribute("y"); | ||
2902 | this.params[2] = this.element.getFloatAttribute("width"); | ||
2903 | this.params[3] = this.element.getFloatAttribute("height"); | ||
2904 | if (this.params[2] < 0 || this.params[3] < 0) { | ||
2905 | throw "svg error: negative width or height found while parsing <rect>" | ||
2906 | } | ||
2907 | }; | ||
2908 | cr.prototype.parseEllipse = function(ec) { | ||
2909 | this.kind = 31; | ||
2910 | this.family = 1; | ||
2911 | this.params = []; | ||
2912 | this.params[0] = this.element.getFloatAttribute("cx") | 0; | ||
2913 | this.params[1] = this.element.getFloatAttribute("cy") | 0; | ||
2914 | var eb, ea; | ||
2915 | if (ec) { | ||
2916 | eb = ea = this.element.getFloatAttribute("r"); | ||
2917 | if (eb < 0) { | ||
2918 | throw "svg error: negative radius found while parsing <circle>" | ||
2919 | } | ||
2920 | } else { | ||
2921 | eb = this.element.getFloatAttribute("rx"); | ||
2922 | ea = this.element.getFloatAttribute("ry"); | ||
2923 | if (eb < 0 || ea < 0) { | ||
2924 | throw "svg error: negative x-axis radius or y-axis radius found while parsing <ellipse>" | ||
2925 | } | ||
2926 | } | ||
2927 | this.params[0] -= eb; | ||
2928 | this.params[1] -= ea; | ||
2929 | this.params[2] = eb * 2; | ||
2930 | this.params[3] = ea * 2 | ||
2931 | }; | ||
2932 | cr.prototype.parseLine = function() { | ||
2933 | this.kind = 4; | ||
2934 | this.family = 1; | ||
2935 | this.params = []; | ||
2936 | this.params[0] = this.element.getFloatAttribute("x1"); | ||
2937 | this.params[1] = this.element.getFloatAttribute("y1"); | ||
2938 | this.params[2] = this.element.getFloatAttribute("x2"); | ||
2939 | this.params[3] = this.element.getFloatAttribute("y2") | ||
2940 | }; | ||
2941 | cr.prototype.parseColors = function(ec) { | ||
2942 | if (ec.hasAttribute("opacity")) { | ||
2943 | this.setOpacity(ec.getAttribute("opacity")) | ||
2944 | } | ||
2945 | if (ec.hasAttribute("stroke")) { | ||
2946 | this.setStroke(ec.getAttribute("stroke")) | ||
2947 | } | ||
2948 | if (ec.hasAttribute("stroke-width")) { | ||
2949 | this.setStrokeWeight(ec.getAttribute("stroke-width")) | ||
2950 | } | ||
2951 | if (ec.hasAttribute("stroke-linejoin")) { | ||
2952 | this.setStrokeJoin(ec.getAttribute("stroke-linejoin")) | ||
2953 | } | ||
2954 | if (ec.hasAttribute("stroke-linecap")) { | ||
2955 | this.setStrokeCap(ec.getStringAttribute("stroke-linecap")) | ||
2956 | } | ||
2957 | if (ec.hasAttribute("fill")) { | ||
2958 | this.setFill(ec.getStringAttribute("fill")) | ||
2959 | } | ||
2960 | if (ec.hasAttribute("style")) { | ||
2961 | var ef = ec.getStringAttribute("style"); | ||
2962 | var ed = ef.toString().split(";"); | ||
2963 | for (var eb = 0, ea = ed.length; eb < ea; eb++) { | ||
2964 | var ee = cW.trim(ed[eb].split(":")); | ||
2965 | if (ee[0] === "fill") { | ||
2966 | this.setFill(ee[1]) | ||
2967 | } else { | ||
2968 | if (ee[0] === "fill-opacity") { | ||
2969 | this.setFillOpacity(ee[1]) | ||
2970 | } else { | ||
2971 | if (ee[0] === "stroke") { | ||
2972 | this.setStroke(ee[1]) | ||
2973 | } else { | ||
2974 | if (ee[0] === "stroke-width") { | ||
2975 | this.setStrokeWeight(ee[1]) | ||
2976 | } else { | ||
2977 | if (ee[0] === "stroke-linecap") { | ||
2978 | this.setStrokeCap(ee[1]) | ||
2979 | } else { | ||
2980 | if (ee[0] === "stroke-linejoin") { | ||
2981 | this.setStrokeJoin(ee[1]) | ||
2982 | } else { | ||
2983 | if (ee[0] === "stroke-opacity") { | ||
2984 | this.setStrokeOpacity(ee[1]) | ||
2985 | } else { | ||
2986 | if (ee[0] === "opacity") { | ||
2987 | this.setOpacity(ee[1]) | ||
2988 | } | ||
2989 | } | ||
2990 | } | ||
2991 | } | ||
2992 | } | ||
2993 | } | ||
2994 | } | ||
2995 | } | ||
2996 | } | ||
2997 | } | ||
2998 | }; | ||
2999 | cr.prototype.setFillOpacity = function(ea) { | ||
3000 | this.fillOpacity = parseFloat(ea); | ||
3001 | this.fillColor = this.fillOpacity * 255 << 24 | this.fillColor & 16777215 | ||
3002 | }; | ||
3003 | cr.prototype.setFill = function(ea) { | ||
3004 | var eb = this.fillColor & 4278190080; | ||
3005 | if (ea === "none") { | ||
3006 | this.fill = false | ||
3007 | } else { | ||
3008 | if (ea.indexOf("#") === 0) { | ||
3009 | this.fill = true; | ||
3010 | if (ea.length === 4) { | ||
3011 | ea = ea.replace(/#(.)(.)(.)/, "#$1$1$2$2$3$3") | ||
3012 | } | ||
3013 | this.fillColor = eb | parseInt(ea.substring(1), 16) & 16777215 | ||
3014 | } else { | ||
3015 | if (ea.indexOf("rgb") === 0) { | ||
3016 | this.fill = true; | ||
3017 | this.fillColor = eb | this.parseRGB(ea) | ||
3018 | } else { | ||
3019 | if (ea.indexOf("url(#") === 0) { | ||
3020 | this.fillName = ea.substring(5, ea.length - 1) | ||
3021 | } else { | ||
3022 | if (E[ea]) { | ||
3023 | this.fill = true; | ||
3024 | this.fillColor = eb | parseInt(E[ea].substring(1), 16) & 16777215 | ||
3025 | } | ||
3026 | } | ||
3027 | } | ||
3028 | } | ||
3029 | } | ||
3030 | }; | ||
3031 | cr.prototype.setOpacity = function(ea) { | ||
3032 | this.strokeColor = parseFloat(ea) * 255 << 24 | this.strokeColor & 16777215; | ||
3033 | this.fillColor = parseFloat(ea) * 255 << 24 | this.fillColor & 16777215 | ||
3034 | }; | ||
3035 | cr.prototype.setStroke = function(ea) { | ||
3036 | var eb = this.strokeColor & 4278190080; | ||
3037 | if (ea === "none") { | ||
3038 | this.stroke = false | ||
3039 | } else { | ||
3040 | if (ea.charAt(0) === "#") { | ||
3041 | this.stroke = true; | ||
3042 | if (ea.length === 4) { | ||
3043 | ea = ea.replace(/#(.)(.)(.)/, "#$1$1$2$2$3$3") | ||
3044 | } | ||
3045 | this.strokeColor = eb | parseInt(ea.substring(1), 16) & 16777215 | ||
3046 | } else { | ||
3047 | if (ea.indexOf("rgb") === 0) { | ||
3048 | this.stroke = true; | ||
3049 | this.strokeColor = eb | this.parseRGB(ea) | ||
3050 | } else { | ||
3051 | if (ea.indexOf("url(#") === 0) { | ||
3052 | this.strokeName = ea.substring(5, ea.length - 1) | ||
3053 | } else { | ||
3054 | if (E[ea]) { | ||
3055 | this.stroke = true; | ||
3056 | this.strokeColor = eb | parseInt(E[ea].substring(1), 16) & 16777215 | ||
3057 | } | ||
3058 | } | ||
3059 | } | ||
3060 | } | ||
3061 | } | ||
3062 | }; | ||
3063 | cr.prototype.setStrokeWeight = function(ea) { | ||
3064 | this.strokeWeight = this.parseUnitSize(ea) | ||
3065 | }; | ||
3066 | cr.prototype.setStrokeJoin = function(ea) { | ||
3067 | if (ea === "miter") { | ||
3068 | this.strokeJoin = "miter" | ||
3069 | } else { | ||
3070 | if (ea === "round") { | ||
3071 | this.strokeJoin = "round" | ||
3072 | } else { | ||
3073 | if (ea === "bevel") { | ||
3074 | this.strokeJoin = "bevel" | ||
3075 | } | ||
3076 | } | ||
3077 | } | ||
3078 | }; | ||
3079 | cr.prototype.setStrokeCap = function(ea) { | ||
3080 | if (ea === "butt") { | ||
3081 | this.strokeCap = "butt" | ||
3082 | } else { | ||
3083 | if (ea === "round") { | ||
3084 | this.strokeCap = "round" | ||
3085 | } else { | ||
3086 | if (ea === "square") { | ||
3087 | this.strokeCap = "square" | ||
3088 | } | ||
3089 | } | ||
3090 | } | ||
3091 | }; | ||
3092 | cr.prototype.setStrokeOpacity = function(ea) { | ||
3093 | this.strokeOpacity = parseFloat(ea); | ||
3094 | this.strokeColor = this.strokeOpacity * 255 << 24 | this.strokeColor & 16777215 | ||
3095 | }; | ||
3096 | cr.prototype.parseRGB = function(eb) { | ||
3097 | var ec = eb.substring(eb.indexOf("(") + 1, eb.indexOf(")")); | ||
3098 | var ea = ec.split(", "); | ||
3099 | return ea[0] << 16 | ea[1] << 8 | ea[2] | ||
3100 | }; | ||
3101 | cr.prototype.parseUnitSize = function(eb) { | ||
3102 | var ea = eb.length - 2; | ||
3103 | if (ea < 0) { | ||
3104 | return eb | ||
3105 | } | ||
3106 | if (eb.indexOf("pt") === ea) { | ||
3107 | return parseFloat(eb.substring(0, ea)) * 1.25 | ||
3108 | } | ||
3109 | if (eb.indexOf("pc") === ea) { | ||
3110 | return parseFloat(eb.substring(0, ea)) * 15 | ||
3111 | } | ||
3112 | if (eb.indexOf("mm") === ea) { | ||
3113 | return parseFloat(eb.substring(0, ea)) * 3.543307 | ||
3114 | } | ||
3115 | if (eb.indexOf("cm") === ea) { | ||
3116 | return parseFloat(eb.substring(0, ea)) * 35.43307 | ||
3117 | } | ||
3118 | if (eb.indexOf("in") === ea) { | ||
3119 | return parseFloat(eb.substring(0, ea)) * 90 | ||
3120 | } | ||
3121 | if (eb.indexOf("px") === ea) { | ||
3122 | return parseFloat(eb.substring(0, ea)) | ||
3123 | } | ||
3124 | return parseFloat(eb) | ||
3125 | }; | ||
3126 | cW.shape = function(ec, eb, ee, ed, ea) { | ||
3127 | if (arguments.length >= 1 && arguments[0] !== null) { | ||
3128 | if (ec.isVisible()) { | ||
3129 | cW.pushMatrix(); | ||
3130 | if (S === 3) { | ||
3131 | if (arguments.length === 5) { | ||
3132 | cW.translate(eb - ed / 2, ee - ea / 2); | ||
3133 | cW.scale(ed / ec.getWidth(), ea / ec.getHeight()) | ||
3134 | } else { | ||
3135 | if (arguments.length === 3) { | ||
3136 | cW.translate(eb - ec.getWidth() / 2, -ec.getHeight() / 2) | ||
3137 | } else { | ||
3138 | cW.translate(-ec.getWidth() / 2, -ec.getHeight() / 2) | ||
3139 | } | ||
3140 | } | ||
3141 | } else { | ||
3142 | if (S === 0) { | ||
3143 | if (arguments.length === 5) { | ||
3144 | cW.translate(eb, ee); | ||
3145 | cW.scale(ed / ec.getWidth(), ea / ec.getHeight()) | ||
3146 | } else { | ||
3147 | if (arguments.length === 3) { | ||
3148 | cW.translate(eb, ee) | ||
3149 | } | ||
3150 | } | ||
3151 | } else { | ||
3152 | if (S === 1) { | ||
3153 | if (arguments.length === 5) { | ||
3154 | ed -= eb; | ||
3155 | ea -= ee; | ||
3156 | cW.translate(eb, ee); | ||
3157 | cW.scale(ed / ec.getWidth(), ea / ec.getHeight()) | ||
3158 | } else { | ||
3159 | if (arguments.length === 3) { | ||
3160 | cW.translate(eb, ee) | ||
3161 | } | ||
3162 | } | ||
3163 | } | ||
3164 | } | ||
3165 | } | ||
3166 | ec.draw(cW); | ||
3167 | if (arguments.length === 1 && S === 3 || arguments.length > 1) { | ||
3168 | cW.popMatrix() | ||
3169 | } | ||
3170 | } | ||
3171 | } | ||
3172 | }; | ||
3173 | cW.shapeMode = function(ea) { | ||
3174 | S = ea | ||
3175 | }; | ||
3176 | cW.loadShape = function(ea) { | ||
3177 | if (arguments.length === 1) { | ||
3178 | if (ea.indexOf(".svg") > -1) { | ||
3179 | return new cr(null, ea) | ||
3180 | } | ||
3181 | } | ||
3182 | return null | ||
3183 | }; | ||
3184 | var cT = function(ee, ed, ea, eb, ec) { | ||
3185 | this.fullName = ee || ""; | ||
3186 | this.name = ed || ""; | ||
3187 | this.namespace = ea || ""; | ||
3188 | this.value = eb; | ||
3189 | this.type = ec | ||
3190 | }; | ||
3191 | cT.prototype = { | ||
3192 | getName: function() { | ||
3193 | return this.name | ||
3194 | }, | ||
3195 | getFullName: function() { | ||
3196 | return this.fullName | ||
3197 | }, | ||
3198 | getNamespace: function() { | ||
3199 | return this.namespace | ||
3200 | }, | ||
3201 | getValue: function() { | ||
3202 | return this.value | ||
3203 | }, | ||
3204 | getType: function() { | ||
3205 | return this.type | ||
3206 | }, | ||
3207 | setValue: function(ea) { | ||
3208 | this.value = ea | ||
3209 | } | ||
3210 | }; | ||
3211 | var b9 = cW.XMLElement = function(ea, ec, ed, eb) { | ||
3212 | this.attributes = []; | ||
3213 | this.children = []; | ||
3214 | this.fullName = null; | ||
3215 | this.name = null; | ||
3216 | this.namespace = ""; | ||
3217 | this.content = null; | ||
3218 | this.parent = null; | ||
3219 | this.lineNr = ""; | ||
3220 | this.systemID = ""; | ||
3221 | this.type = "ELEMENT"; | ||
3222 | if (ea) { | ||
3223 | if (typeof ea === "string") { | ||
3224 | if (ec === t && ea.indexOf("<") > -1) { | ||
3225 | this.parse(ea) | ||
3226 | } else { | ||
3227 | this.fullName = ea; | ||
3228 | this.namespace = ec; | ||
3229 | this.systemId = ed; | ||
3230 | this.lineNr = eb | ||
3231 | } | ||
3232 | } else { | ||
3233 | this.parse(ec) | ||
3234 | } | ||
3235 | } | ||
3236 | }; | ||
3237 | b9.prototype = { | ||
3238 | parse: function(ea) { | ||
3239 | var ec; | ||
3240 | try { | ||
3241 | var ee = ea.substring(ea.length - 4); | ||
3242 | if (ee === ".xml" || ee === ".svg") { | ||
3243 | ea = w(ea) | ||
3244 | } | ||
3245 | ec = (new DOMParser).parseFromString(ea, "text/xml"); | ||
3246 | var eb = ec.documentElement; | ||
3247 | if (eb) { | ||
3248 | this.parseChildrenRecursive(null, eb) | ||
3249 | } else { | ||
3250 | throw "Error loading document" | ||
3251 | } | ||
3252 | return this | ||
3253 | } catch (ed) { | ||
3254 | throw ed | ||
3255 | } | ||
3256 | }, | ||
3257 | parseChildrenRecursive: function(ei, eg) { | ||
3258 | var ef, eb, eh, ee, ed, ea; | ||
3259 | if (!ei) { | ||
3260 | this.fullName = eg.localName; | ||
3261 | this.name = eg.nodeName; | ||
3262 | ef = this | ||
3263 | } else { | ||
3264 | ef = new b9(eg.nodeName); | ||
3265 | ef.parent = ei | ||
3266 | } if (eg.nodeType === 3 && eg.textContent !== "") { | ||
3267 | return this.createPCDataElement(eg.textContent) | ||
3268 | } | ||
3269 | if (eg.nodeType === 4) { | ||
3270 | return this.createCDataElement(eg.textContent) | ||
3271 | } | ||
3272 | if (eg.attributes) { | ||
3273 | for (ee = 0, ed = eg.attributes.length; ee < ed; ee++) { | ||
3274 | eh = eg.attributes[ee]; | ||
3275 | eb = new cT(eh.getname, eh.nodeName, eh.namespaceURI, eh.nodeValue, eh.nodeType); | ||
3276 | ef.attributes.push(eb) | ||
3277 | } | ||
3278 | } | ||
3279 | if (eg.childNodes) { | ||
3280 | for (ee = 0, ed = eg.childNodes.length; ee < ed; ee++) { | ||
3281 | var ec = eg.childNodes[ee]; | ||
3282 | ea = ef.parseChildrenRecursive(ef, ec); | ||
3283 | if (ea !== null) { | ||
3284 | ef.children.push(ea) | ||
3285 | } | ||
3286 | } | ||
3287 | } | ||
3288 | return ef | ||
3289 | }, | ||
3290 | createElement: function(eb, ec, ed, ea) { | ||
3291 | if (ed === t) { | ||
3292 | return new b9(eb, ec) | ||
3293 | } | ||
3294 | return new b9(eb, ec, ed, ea) | ||
3295 | }, | ||
3296 | createPCDataElement: function(eb, ea) { | ||
3297 | if (eb.replace(/^\s+$/g, "") === "") { | ||
3298 | return null | ||
3299 | } | ||
3300 | var ec = new b9; | ||
3301 | ec.type = "TEXT"; | ||
3302 | ec.content = eb; | ||
3303 | return ec | ||
3304 | }, | ||
3305 | createCDataElement: function(ec) { | ||
3306 | var ed = this.createPCDataElement(ec); | ||
3307 | if (ed === null) { | ||
3308 | return null | ||
3309 | } | ||
3310 | ed.type = "CDATA"; | ||
3311 | var eb = { | ||
3312 | "<": "<", | ||
3313 | ">": ">", | ||
3314 | "'": "'", | ||
3315 | '"': """ | ||
3316 | }, | ||
3317 | ea; | ||
3318 | for (ea in eb) { | ||
3319 | if (!Object.hasOwnProperty(eb, ea)) { | ||
3320 | ec = ec.replace(new RegExp(ea, "g"), eb[ea]) | ||
3321 | } | ||
3322 | } | ||
3323 | ed.cdata = ec; | ||
3324 | return ed | ||
3325 | }, | ||
3326 | hasAttribute: function() { | ||
3327 | if (arguments.length === 1) { | ||
3328 | return this.getAttribute(arguments[0]) !== null | ||
3329 | } | ||
3330 | if (arguments.length === 2) { | ||
3331 | return this.getAttribute(arguments[0], arguments[1]) !== null | ||
3332 | } | ||
3333 | }, | ||
3334 | equals: function(ef) { | ||
3335 | if (!(ef instanceof b9)) { | ||
3336 | return false | ||
3337 | } | ||
3338 | var ec, eb; | ||
3339 | if (this.fullName !== ef.fullName) { | ||
3340 | return false | ||
3341 | } | ||
3342 | if (this.attributes.length !== ef.getAttributeCount()) { | ||
3343 | return false | ||
3344 | } | ||
3345 | if (this.attributes.length !== ef.attributes.length) { | ||
3346 | return false | ||
3347 | } | ||
3348 | var ej, eh, ea, eg, ei; | ||
3349 | for (ec = 0, eb = this.attributes.length; ec < eb; ec++) { | ||
3350 | ej = this.attributes[ec].getName(); | ||
3351 | eh = this.attributes[ec].getNamespace(); | ||
3352 | ei = ef.findAttribute(ej, eh); | ||
3353 | if (ei === null) { | ||
3354 | return false | ||
3355 | } | ||
3356 | if (this.attributes[ec].getValue() !== ei.getValue()) { | ||
3357 | return false | ||
3358 | } | ||
3359 | if (this.attributes[ec].getType() !== ei.getType()) { | ||
3360 | return false | ||
3361 | } | ||
3362 | } | ||
3363 | if (this.children.length !== ef.getChildCount()) { | ||
3364 | return false | ||
3365 | } | ||
3366 | if (this.children.length > 0) { | ||
3367 | var ee, ed; | ||
3368 | for (ec = 0, eb = this.children.length; ec < eb; ec++) { | ||
3369 | ee = this.getChild(ec); | ||
3370 | ed = ef.getChild(ec); | ||
3371 | if (!ee.equals(ed)) { | ||
3372 | return false | ||
3373 | } | ||
3374 | } | ||
3375 | return true | ||
3376 | } | ||
3377 | return this.content === ef.content | ||
3378 | }, | ||
3379 | getContent: function() { | ||
3380 | if (this.type === "TEXT" || this.type === "CDATA") { | ||
3381 | return this.content | ||
3382 | } | ||
3383 | var ea = this.children; | ||
3384 | if (ea.length === 1 && (ea[0].type === "TEXT" || ea[0].type === "CDATA")) { | ||
3385 | return ea[0].content | ||
3386 | } | ||
3387 | return null | ||
3388 | }, | ||
3389 | getAttribute: function() { | ||
3390 | var ea; | ||
3391 | if (arguments.length === 2) { | ||
3392 | ea = this.findAttribute(arguments[0]); | ||
3393 | if (ea) { | ||
3394 | return ea.getValue() | ||
3395 | } | ||
3396 | return arguments[1] | ||
3397 | } else { | ||
3398 | if (arguments.length === 1) { | ||
3399 | ea = this.findAttribute(arguments[0]); | ||
3400 | if (ea) { | ||
3401 | return ea.getValue() | ||
3402 | } | ||
3403 | return null | ||
3404 | } else { | ||
3405 | if (arguments.length === 3) { | ||
3406 | ea = this.findAttribute(arguments[0], arguments[1]); | ||
3407 | if (ea) { | ||
3408 | return ea.getValue() | ||
3409 | } | ||
3410 | return arguments[2] | ||
3411 | } | ||
3412 | } | ||
3413 | } | ||
3414 | }, | ||
3415 | getStringAttribute: function() { | ||
3416 | if (arguments.length === 1) { | ||
3417 | return this.getAttribute(arguments[0]) | ||
3418 | } | ||
3419 | if (arguments.length === 2) { | ||
3420 | return this.getAttribute(arguments[0], arguments[1]) | ||
3421 | } | ||
3422 | return this.getAttribute(arguments[0], arguments[1], arguments[2]) | ||
3423 | }, | ||
3424 | getString: function(ea) { | ||
3425 | return this.getStringAttribute(ea) | ||
3426 | }, | ||
3427 | getFloatAttribute: function() { | ||
3428 | if (arguments.length === 1) { | ||
3429 | return parseFloat(this.getAttribute(arguments[0], 0)) | ||
3430 | } | ||
3431 | if (arguments.length === 2) { | ||
3432 | return this.getAttribute(arguments[0], arguments[1]) | ||
3433 | } | ||
3434 | return this.getAttribute(arguments[0], arguments[1], arguments[2]) | ||
3435 | }, | ||
3436 | getFloat: function(ea) { | ||
3437 | return this.getFloatAttribute(ea) | ||
3438 | }, | ||
3439 | getIntAttribute: function() { | ||
3440 | if (arguments.length === 1) { | ||
3441 | return this.getAttribute(arguments[0], 0) | ||
3442 | } | ||
3443 | if (arguments.length === 2) { | ||
3444 | return this.getAttribute(arguments[0], arguments[1]) | ||
3445 | } | ||
3446 | return this.getAttribute(arguments[0], arguments[1], arguments[2]) | ||
3447 | }, | ||
3448 | getInt: function(ea) { | ||
3449 | return this.getIntAttribute(ea) | ||
3450 | }, | ||
3451 | hasChildren: function() { | ||
3452 | return this.children.length > 0 | ||
3453 | }, | ||
3454 | addChild: function(ea) { | ||
3455 | if (ea !== null) { | ||
3456 | ea.parent = this; | ||
3457 | this.children.push(ea) | ||
3458 | } | ||
3459 | }, | ||
3460 | insertChild: function(ec, ea) { | ||
3461 | if (ec) { | ||
3462 | if (ec.getLocalName() === null && !this.hasChildren()) { | ||
3463 | var eb = this.children[this.children.length - 1]; | ||
3464 | if (eb.getLocalName() === null) { | ||
3465 | eb.setContent(eb.getContent() + ec.getContent()); | ||
3466 | return | ||
3467 | } | ||
3468 | } | ||
3469 | ec.parent = this; | ||
3470 | this.children.splice(ea, 0, ec) | ||
3471 | } | ||
3472 | }, | ||
3473 | getChild: function(eb) { | ||
3474 | if (typeof eb === "number") { | ||
3475 | return this.children[eb] | ||
3476 | } | ||
3477 | if (eb.indexOf("/") !== -1) { | ||
3478 | return this.getChildRecursive(eb.split("/"), 0) | ||
3479 | } | ||
3480 | var ea, ee; | ||
3481 | for (var ed = 0, ec = this.getChildCount(); ed < ec; ed++) { | ||
3482 | ea = this.getChild(ed); | ||
3483 | ee = ea.getName(); | ||
3484 | if (ee !== null && ee === eb) { | ||
3485 | return ea | ||
3486 | } | ||
3487 | } | ||
3488 | return null | ||
3489 | }, | ||
3490 | getChildren: function() { | ||
3491 | if (arguments.length === 1) { | ||
3492 | if (typeof arguments[0] === "number") { | ||
3493 | return this.getChild(arguments[0]) | ||
3494 | } | ||
3495 | if (arguments[0].indexOf("/") !== -1) { | ||
3496 | return this.getChildrenRecursive(arguments[0].split("/"), 0) | ||
3497 | } | ||
3498 | var ee = []; | ||
3499 | var ea, ed; | ||
3500 | for (var ec = 0, eb = this.getChildCount(); ec < eb; ec++) { | ||
3501 | ea = this.getChild(ec); | ||
3502 | ed = ea.getName(); | ||
3503 | if (ed !== null && ed === arguments[0]) { | ||
3504 | ee.push(ea) | ||
3505 | } | ||
3506 | } | ||
3507 | return ee | ||
3508 | } | ||
3509 | return this.children | ||
3510 | }, | ||
3511 | getChildCount: function() { | ||
3512 | return this.children.length | ||
3513 | }, | ||
3514 | getChildRecursive: function(eb, eg) { | ||
3515 | if (eg === eb.length) { | ||
3516 | return this | ||
3517 | } | ||
3518 | var ea, ef, ee = eb[eg]; | ||
3519 | for (var ed = 0, ec = this.getChildCount(); ed < ec; ed++) { | ||
3520 | ea = this.getChild(ed); | ||
3521 | ef = ea.getName(); | ||
3522 | if (ef !== null && ef === ee) { | ||
3523 | return ea.getChildRecursive(eb, eg + 1) | ||
3524 | } | ||
3525 | } | ||
3526 | return null | ||
3527 | }, | ||
3528 | getChildrenRecursive: function(ea, ee) { | ||
3529 | if (ee === ea.length - 1) { | ||
3530 | return this.getChildren(ea[ee]) | ||
3531 | } | ||
3532 | var ed = this.getChildren(ea[ee]); | ||
3533 | var ec = []; | ||
3534 | for (var eb = 0; eb < ed.length; eb++) { | ||
3535 | ec = ec.concat(ed[eb].getChildrenRecursive(ea, ee + 1)) | ||
3536 | } | ||
3537 | return ec | ||
3538 | }, | ||
3539 | isLeaf: function() { | ||
3540 | return !this.hasChildren() | ||
3541 | }, | ||
3542 | listChildren: function() { | ||
3543 | var ea = []; | ||
3544 | for (var ec = 0, eb = this.children.length; ec < eb; ec++) { | ||
3545 | ea.push(this.getChild(ec).getName()) | ||
3546 | } | ||
3547 | return ea | ||
3548 | }, | ||
3549 | removeAttribute: function(eb, ed) { | ||
3550 | this.namespace = ed || ""; | ||
3551 | for (var ec = 0, ea = this.attributes.length; ec < ea; ec++) { | ||
3552 | if (this.attributes[ec].getName() === eb && this.attributes[ec].getNamespace() === this.namespace) { | ||
3553 | this.attributes.splice(ec, 1); | ||
3554 | break | ||
3555 | } | ||
3556 | } | ||
3557 | }, | ||
3558 | removeChild: function(ec) { | ||
3559 | if (ec) { | ||
3560 | for (var eb = 0, ea = this.children.length; eb < ea; eb++) { | ||
3561 | if (this.children[eb].equals(ec)) { | ||
3562 | this.children.splice(eb, 1); | ||
3563 | break | ||
3564 | } | ||
3565 | } | ||
3566 | } | ||
3567 | }, | ||
3568 | removeChildAtIndex: function(ea) { | ||
3569 | if (this.children.length > ea) { | ||
3570 | this.children.splice(ea, 1) | ||
3571 | } | ||
3572 | }, | ||
3573 | findAttribute: function(eb, ed) { | ||
3574 | this.namespace = ed || ""; | ||
3575 | for (var ec = 0, ea = this.attributes.length; ec < ea; ec++) { | ||
3576 | if (this.attributes[ec].getName() === eb && this.attributes[ec].getNamespace() === this.namespace) { | ||
3577 | return this.attributes[ec] | ||
3578 | } | ||
3579 | } | ||
3580 | return null | ||
3581 | }, | ||
3582 | setAttribute: function() { | ||
3583 | var ea; | ||
3584 | if (arguments.length === 3) { | ||
3585 | var ec = arguments[0].indexOf(":"); | ||
3586 | var eb = arguments[0].substring(ec + 1); | ||
3587 | ea = this.findAttribute(eb, arguments[1]); | ||
3588 | if (ea) { | ||
3589 | ea.setValue(arguments[2]) | ||
3590 | } else { | ||
3591 | ea = new cT(arguments[0], eb, arguments[1], arguments[2], "CDATA"); | ||
3592 | this.attributes.push(ea) | ||
3593 | } | ||
3594 | } else { | ||
3595 | ea = this.findAttribute(arguments[0]); | ||
3596 | if (ea) { | ||
3597 | ea.setValue(arguments[1]) | ||
3598 | } else { | ||
3599 | ea = new cT(arguments[0], arguments[0], null, arguments[1], "CDATA"); | ||
3600 | this.attributes.push(ea) | ||
3601 | } | ||
3602 | } | ||
3603 | }, | ||
3604 | setString: function(ea, eb) { | ||
3605 | this.setAttribute(ea, eb) | ||
3606 | }, | ||
3607 | setInt: function(ea, eb) { | ||
3608 | this.setAttribute(ea, eb) | ||
3609 | }, | ||
3610 | setFloat: function(ea, eb) { | ||
3611 | this.setAttribute(ea, eb) | ||
3612 | }, | ||
3613 | setContent: function(ea) { | ||
3614 | if (this.children.length > 0) { | ||
3615 | F.debug("Tried to set content for XMLElement with children") | ||
3616 | } | ||
3617 | this.content = ea | ||
3618 | }, | ||
3619 | setName: function() { | ||
3620 | if (arguments.length === 1) { | ||
3621 | this.name = arguments[0]; | ||
3622 | this.fullName = arguments[0]; | ||
3623 | this.namespace = null | ||
3624 | } else { | ||
3625 | var ea = arguments[0].indexOf(":"); | ||
3626 | if (arguments[1] === null || ea < 0) { | ||
3627 | this.name = arguments[0] | ||
3628 | } else { | ||
3629 | this.name = arguments[0].substring(ea + 1) | ||
3630 | } | ||
3631 | this.fullName = arguments[0]; | ||
3632 | this.namespace = arguments[1] | ||
3633 | } | ||
3634 | }, | ||
3635 | getName: function() { | ||
3636 | return this.fullName | ||
3637 | }, | ||
3638 | getLocalName: function() { | ||
3639 | return this.name | ||
3640 | }, | ||
3641 | getAttributeCount: function() { | ||
3642 | return this.attributes.length | ||
3643 | }, | ||
3644 | toString: function() { | ||
3645 | if (this.type === "TEXT") { | ||
3646 | return this.content | ||
3647 | } | ||
3648 | if (this.type === "CDATA") { | ||
3649 | return this.cdata | ||
3650 | } | ||
3651 | var ec = this.fullName; | ||
3652 | var ed = "<" + ec; | ||
3653 | var eb, ee; | ||
3654 | for (eb = 0; eb < this.attributes.length; eb++) { | ||
3655 | var ea = this.attributes[eb]; | ||
3656 | ed += " " + ea.getName() + '="' + ea.getValue() + '"' | ||
3657 | } | ||
3658 | if (this.children.length === 0) { | ||
3659 | if (this.content === "") { | ||
3660 | ed += "/>" | ||
3661 | } else { | ||
3662 | ed += ">" + this.content + "</" + ec + ">" | ||
3663 | } | ||
3664 | } else { | ||
3665 | ed += ">"; | ||
3666 | for (ee = 0; ee < this.children.length; ee++) { | ||
3667 | ed += this.children[ee].toString() | ||
3668 | } | ||
3669 | ed += "</" + ec + ">" | ||
3670 | } | ||
3671 | return ed | ||
3672 | } | ||
3673 | }; | ||
3674 | b9.parse = function(eb) { | ||
3675 | var ea = new b9; | ||
3676 | ea.parse(eb); | ||
3677 | return ea | ||
3678 | }; | ||
3679 | var dg = cW.XML = cW.XMLElement; | ||
3680 | cW.loadXML = function(ea) { | ||
3681 | return new dg(cW, ea) | ||
3682 | }; | ||
3683 | var cm = function(ed) { | ||
3684 | var ea = 0; | ||
3685 | for (var eb = 0; eb < ed.length; eb++) { | ||
3686 | if (eb !== 0) { | ||
3687 | ea = q.max(ea, q.abs(ed[eb])) | ||
3688 | } else { | ||
3689 | ea = q.abs(ed[eb]) | ||
3690 | } | ||
3691 | } | ||
3692 | var ec = (ea + "").indexOf("."); | ||
3693 | if (ec === 0) { | ||
3694 | ec = 1 | ||
3695 | } else { | ||
3696 | if (ec === -1) { | ||
3697 | ec = (ea + "").length | ||
3698 | } | ||
3699 | } | ||
3700 | return ec | ||
3701 | }; | ||
3702 | var aX = cW.PMatrix2D = function() { | ||
3703 | if (arguments.length === 0) { | ||
3704 | this.reset() | ||
3705 | } else { | ||
3706 | if (arguments.length === 1 && arguments[0] instanceof aX) { | ||
3707 | this.set(arguments[0].array()) | ||
3708 | } else { | ||
3709 | if (arguments.length === 6) { | ||
3710 | this.set(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]) | ||
3711 | } | ||
3712 | } | ||
3713 | } | ||
3714 | }; | ||
3715 | aX.prototype = { | ||
3716 | set: function() { | ||
3717 | if (arguments.length === 6) { | ||
3718 | var ea = arguments; | ||
3719 | this.set([ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]]) | ||
3720 | } else { | ||
3721 | if (arguments.length === 1 && arguments[0] instanceof aX) { | ||
3722 | this.elements = arguments[0].array() | ||
3723 | } else { | ||
3724 | if (arguments.length === 1 && arguments[0] instanceof Array) { | ||
3725 | this.elements = arguments[0].slice() | ||
3726 | } | ||
3727 | } | ||
3728 | } | ||
3729 | }, | ||
3730 | get: function() { | ||
3731 | var ea = new aX; | ||
3732 | ea.set(this.elements); | ||
3733 | return ea | ||
3734 | }, | ||
3735 | reset: function() { | ||
3736 | this.set([1, 0, 0, 0, 1, 0]) | ||
3737 | }, | ||
3738 | array: function aE() { | ||
3739 | return this.elements.slice() | ||
3740 | }, | ||
3741 | translate: function(eb, ea) { | ||
3742 | this.elements[2] = eb * this.elements[0] + ea * this.elements[1] + this.elements[2]; | ||
3743 | this.elements[5] = eb * this.elements[3] + ea * this.elements[4] + this.elements[5] | ||
3744 | }, | ||
3745 | invTranslate: function(eb, ea) { | ||
3746 | this.translate(-eb, -ea) | ||
3747 | }, | ||
3748 | transpose: function() {}, | ||
3749 | mult: function(eb, ec) { | ||
3750 | var ea, ed; | ||
3751 | if (eb instanceof A) { | ||
3752 | ea = eb.x; | ||
3753 | ed = eb.y; | ||
3754 | if (!ec) { | ||
3755 | ec = new A | ||
3756 | } | ||
3757 | } else { | ||
3758 | if (eb instanceof Array) { | ||
3759 | ea = eb[0]; | ||
3760 | ed = eb[1]; | ||
3761 | if (!ec) { | ||
3762 | ec = [] | ||
3763 | } | ||
3764 | } | ||
3765 | } if (ec instanceof Array) { | ||
3766 | ec[0] = this.elements[0] * ea + this.elements[1] * ed + this.elements[2]; | ||
3767 | ec[1] = this.elements[3] * ea + this.elements[4] * ed + this.elements[5] | ||
3768 | } else { | ||
3769 | if (ec instanceof A) { | ||
3770 | ec.x = this.elements[0] * ea + this.elements[1] * ed + this.elements[2]; | ||
3771 | ec.y = this.elements[3] * ea + this.elements[4] * ed + this.elements[5]; | ||
3772 | ec.z = 0 | ||
3773 | } | ||
3774 | } | ||
3775 | return ec | ||
3776 | }, | ||
3777 | multX: function(ea, eb) { | ||
3778 | return ea * this.elements[0] + eb * this.elements[1] + this.elements[2] | ||
3779 | }, | ||
3780 | multY: function(ea, eb) { | ||
3781 | return ea * this.elements[3] + eb * this.elements[4] + this.elements[5] | ||
3782 | }, | ||
3783 | skewX: function(ea) { | ||
3784 | this.apply(1, 0, 1, ea, 0, 0) | ||
3785 | }, | ||
3786 | skewY: function(ea) { | ||
3787 | this.apply(1, 0, 1, 0, ea, 0) | ||
3788 | }, | ||
3789 | shearX: function(ea) { | ||
3790 | this.apply(1, 0, 1, q.tan(ea), 0, 0) | ||
3791 | }, | ||
3792 | shearY: function(ea) { | ||
3793 | this.apply(1, 0, 1, 0, q.tan(ea), 0) | ||
3794 | }, | ||
3795 | determinant: function() { | ||
3796 | return this.elements[0] * this.elements[4] - this.elements[1] * this.elements[3] | ||
3797 | }, | ||
3798 | invert: function() { | ||
3799 | var ef = this.determinant(); | ||
3800 | if (q.abs(ef) > -2147483648) { | ||
3801 | var eb = this.elements[0]; | ||
3802 | var eg = this.elements[1]; | ||
3803 | var ee = this.elements[2]; | ||
3804 | var ed = this.elements[3]; | ||
3805 | var ec = this.elements[4]; | ||
3806 | var ea = this.elements[5]; | ||
3807 | this.elements[0] = ec / ef; | ||
3808 | this.elements[3] = -ed / ef; | ||
3809 | this.elements[1] = -eg / ef; | ||
3810 | this.elements[4] = eb / ef; | ||
3811 | this.elements[2] = (eg * ea - ec * ee) / ef; | ||
3812 | this.elements[5] = (ed * ee - eb * ea) / ef; | ||
3813 | return true | ||
3814 | } | ||
3815 | return false | ||
3816 | }, | ||
3817 | scale: function(eb, ea) { | ||
3818 | if (eb && !ea) { | ||
3819 | ea = eb | ||
3820 | } | ||
3821 | if (eb && ea) { | ||
3822 | this.elements[0] *= eb; | ||
3823 | this.elements[1] *= ea; | ||
3824 | this.elements[3] *= eb; | ||
3825 | this.elements[4] *= ea | ||
3826 | } | ||
3827 | }, | ||
3828 | invScale: function(eb, ea) { | ||
3829 | if (eb && !ea) { | ||
3830 | ea = eb | ||
3831 | } | ||
3832 | this.scale(1 / eb, 1 / ea) | ||
3833 | }, | ||
3834 | apply: function() { | ||
3835 | var ec; | ||
3836 | if (arguments.length === 1 && arguments[0] instanceof aX) { | ||
3837 | ec = arguments[0].array() | ||
3838 | } else { | ||
3839 | if (arguments.length === 6) { | ||
3840 | ec = Array.prototype.slice.call(arguments) | ||
3841 | } else { | ||
3842 | if (arguments.length === 1 && arguments[0] instanceof Array) { | ||
3843 | ec = arguments[0] | ||
3844 | } | ||
3845 | } | ||
3846 | } | ||
3847 | var ea = [0, 0, this.elements[2], 0, 0, this.elements[5]]; | ||
3848 | var ed = 0; | ||
3849 | for (var ee = 0; ee < 2; ee++) { | ||
3850 | for (var eb = 0; eb < 3; eb++, ed++) { | ||
3851 | ea[ed] += this.elements[ee * 3 + 0] * ec[eb + 0] + this.elements[ee * 3 + 1] * ec[eb + 3] | ||
3852 | } | ||
3853 | } | ||
3854 | this.elements = ea.slice() | ||
3855 | }, | ||
3856 | preApply: function() { | ||
3857 | var eb; | ||
3858 | if (arguments.length === 1 && arguments[0] instanceof aX) { | ||
3859 | eb = arguments[0].array() | ||
3860 | } else { | ||
3861 | if (arguments.length === 6) { | ||
3862 | eb = Array.prototype.slice.call(arguments) | ||
3863 | } else { | ||
3864 | if (arguments.length === 1 && arguments[0] instanceof Array) { | ||
3865 | eb = arguments[0] | ||
3866 | } | ||
3867 | } | ||
3868 | } | ||
3869 | var ea = [0, 0, eb[2], 0, 0, eb[5]]; | ||
3870 | ea[2] = eb[2] + this.elements[2] * eb[0] + this.elements[5] * eb[1]; | ||
3871 | ea[5] = eb[5] + this.elements[2] * eb[3] + this.elements[5] * eb[4]; | ||
3872 | ea[0] = this.elements[0] * eb[0] + this.elements[3] * eb[1]; | ||
3873 | ea[3] = this.elements[0] * eb[3] + this.elements[3] * eb[4]; | ||
3874 | ea[1] = this.elements[1] * eb[0] + this.elements[4] * eb[1]; | ||
3875 | ea[4] = this.elements[1] * eb[3] + this.elements[4] * eb[4]; | ||
3876 | this.elements = ea.slice() | ||
3877 | }, | ||
3878 | rotate: function(ec) { | ||
3879 | var ee = q.cos(ec); | ||
3880 | var ea = q.sin(ec); | ||
3881 | var ed = this.elements[0]; | ||
3882 | var eb = this.elements[1]; | ||
3883 | this.elements[0] = ee * ed + ea * eb; | ||
3884 | this.elements[1] = -ea * ed + ee * eb; | ||
3885 | ed = this.elements[3]; | ||
3886 | eb = this.elements[4]; | ||
3887 | this.elements[3] = ee * ed + ea * eb; | ||
3888 | this.elements[4] = -ea * ed + ee * eb | ||
3889 | }, | ||
3890 | rotateZ: function(ea) { | ||
3891 | this.rotate(ea) | ||
3892 | }, | ||
3893 | invRotateZ: function(ea) { | ||
3894 | this.rotateZ(ea - q.PI) | ||
3895 | }, | ||
3896 | print: function() { | ||
3897 | var eb = cm(this.elements); | ||
3898 | var ea = "" + cW.nfs(this.elements[0], eb, 4) + " " + cW.nfs(this.elements[1], eb, 4) + " " + cW.nfs(this.elements[2], eb, 4) + "\n" + cW.nfs(this.elements[3], eb, 4) + " " + cW.nfs(this.elements[4], eb, 4) + " " + cW.nfs(this.elements[5], eb, 4) + "\n\n"; | ||
3899 | cW.println(ea) | ||
3900 | } | ||
3901 | }; | ||
3902 | var aP = cW.PMatrix3D = function() { | ||
3903 | this.reset() | ||
3904 | }; | ||
3905 | aP.prototype = { | ||
3906 | set: function() { | ||
3907 | if (arguments.length === 16) { | ||
3908 | this.elements = Array.prototype.slice.call(arguments) | ||
3909 | } else { | ||
3910 | if (arguments.length === 1 && arguments[0] instanceof aP) { | ||
3911 | this.elements = arguments[0].array() | ||
3912 | } else { | ||
3913 | if (arguments.length === 1 && arguments[0] instanceof Array) { | ||
3914 | this.elements = arguments[0].slice() | ||
3915 | } | ||
3916 | } | ||
3917 | } | ||
3918 | }, | ||
3919 | get: function() { | ||
3920 | var ea = new aP; | ||
3921 | ea.set(this.elements); | ||
3922 | return ea | ||
3923 | }, | ||
3924 | reset: function() { | ||
3925 | this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] | ||
3926 | }, | ||
3927 | array: function aE() { | ||
3928 | return this.elements.slice() | ||
3929 | }, | ||
3930 | translate: function(eb, ea, ec) { | ||
3931 | if (ec === t) { | ||
3932 | ec = 0 | ||
3933 | } | ||
3934 | this.elements[3] += eb * this.elements[0] + ea * this.elements[1] + ec * this.elements[2]; | ||
3935 | this.elements[7] += eb * this.elements[4] + ea * this.elements[5] + ec * this.elements[6]; | ||
3936 | this.elements[11] += eb * this.elements[8] + ea * this.elements[9] + ec * this.elements[10]; | ||
3937 | this.elements[15] += eb * this.elements[12] + ea * this.elements[13] + ec * this.elements[14] | ||
3938 | }, | ||
3939 | transpose: function() { | ||
3940 | var ea = this.elements[4]; | ||
3941 | this.elements[4] = this.elements[1]; | ||
3942 | this.elements[1] = ea; | ||
3943 | ea = this.elements[8]; | ||
3944 | this.elements[8] = this.elements[2]; | ||
3945 | this.elements[2] = ea; | ||
3946 | ea = this.elements[6]; | ||
3947 | this.elements[6] = this.elements[9]; | ||
3948 | this.elements[9] = ea; | ||
3949 | ea = this.elements[3]; | ||
3950 | this.elements[3] = this.elements[12]; | ||
3951 | this.elements[12] = ea; | ||
3952 | ea = this.elements[7]; | ||
3953 | this.elements[7] = this.elements[13]; | ||
3954 | this.elements[13] = ea; | ||
3955 | ea = this.elements[11]; | ||
3956 | this.elements[11] = this.elements[14]; | ||
3957 | this.elements[14] = ea | ||
3958 | }, | ||
3959 | mult: function(ec, ed) { | ||
3960 | var ea, ef, ee, eb; | ||
3961 | if (ec instanceof A) { | ||
3962 | ea = ec.x; | ||
3963 | ef = ec.y; | ||
3964 | ee = ec.z; | ||
3965 | eb = 1; | ||
3966 | if (!ed) { | ||
3967 | ed = new A | ||
3968 | } | ||
3969 | } else { | ||
3970 | if (ec instanceof Array) { | ||
3971 | ea = ec[0]; | ||
3972 | ef = ec[1]; | ||
3973 | ee = ec[2]; | ||
3974 | eb = ec[3] || 1; | ||
3975 | if (!ed || ed.length !== 3 && ed.length !== 4) { | ||
3976 | ed = [0, 0, 0] | ||
3977 | } | ||
3978 | } | ||
3979 | } if (ed instanceof Array) { | ||
3980 | if (ed.length === 3) { | ||
3981 | ed[0] = this.elements[0] * ea + this.elements[1] * ef + this.elements[2] * ee + this.elements[3]; | ||
3982 | ed[1] = this.elements[4] * ea + this.elements[5] * ef + this.elements[6] * ee + this.elements[7]; | ||
3983 | ed[2] = this.elements[8] * ea + this.elements[9] * ef + this.elements[10] * ee + this.elements[11] | ||
3984 | } else { | ||
3985 | if (ed.length === 4) { | ||
3986 | ed[0] = this.elements[0] * ea + this.elements[1] * ef + this.elements[2] * ee + this.elements[3] * eb; | ||
3987 | ed[1] = this.elements[4] * ea + this.elements[5] * ef + this.elements[6] * ee + this.elements[7] * eb; | ||
3988 | ed[2] = this.elements[8] * ea + this.elements[9] * ef + this.elements[10] * ee + this.elements[11] * eb; | ||
3989 | ed[3] = this.elements[12] * ea + this.elements[13] * ef + this.elements[14] * ee + this.elements[15] * eb | ||
3990 | } | ||
3991 | } | ||
3992 | } | ||
3993 | if (ed instanceof A) { | ||
3994 | ed.x = this.elements[0] * ea + this.elements[1] * ef + this.elements[2] * ee + this.elements[3]; | ||
3995 | ed.y = this.elements[4] * ea + this.elements[5] * ef + this.elements[6] * ee + this.elements[7]; | ||
3996 | ed.z = this.elements[8] * ea + this.elements[9] * ef + this.elements[10] * ee + this.elements[11] | ||
3997 | } | ||
3998 | return ed | ||
3999 | }, | ||
4000 | preApply: function() { | ||
4001 | var ec; | ||
4002 | if (arguments.length === 1 && arguments[0] instanceof aP) { | ||
4003 | ec = arguments[0].array() | ||
4004 | } else { | ||
4005 | if (arguments.length === 16) { | ||
4006 | ec = Array.prototype.slice.call(arguments) | ||
4007 | } else { | ||
4008 | if (arguments.length === 1 && arguments[0] instanceof Array) { | ||
4009 | ec = arguments[0] | ||
4010 | } | ||
4011 | } | ||
4012 | } | ||
4013 | var ea = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | ||
4014 | var ed = 0; | ||
4015 | for (var ee = 0; ee < 4; ee++) { | ||
4016 | for (var eb = 0; eb < 4; eb++, ed++) { | ||
4017 | ea[ed] += this.elements[eb + 0] * ec[ee * 4 + 0] + this.elements[eb + 4] * ec[ee * 4 + 1] + this.elements[eb + 8] * ec[ee * 4 + 2] + this.elements[eb + 12] * ec[ee * 4 + 3] | ||
4018 | } | ||
4019 | } | ||
4020 | this.elements = ea.slice() | ||
4021 | }, | ||
4022 | apply: function() { | ||
4023 | var ec; | ||
4024 | if (arguments.length === 1 && arguments[0] instanceof aP) { | ||
4025 | ec = arguments[0].array() | ||
4026 | } else { | ||
4027 | if (arguments.length === 16) { | ||
4028 | ec = Array.prototype.slice.call(arguments) | ||
4029 | } else { | ||
4030 | if (arguments.length === 1 && arguments[0] instanceof Array) { | ||
4031 | ec = arguments[0] | ||
4032 | } | ||
4033 | } | ||
4034 | } | ||
4035 | var ea = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; | ||
4036 | var ed = 0; | ||
4037 | for (var ee = 0; ee < 4; ee++) { | ||
4038 | for (var eb = 0; eb < 4; eb++, ed++) { | ||
4039 | ea[ed] += this.elements[ee * 4 + 0] * ec[eb + 0] + this.elements[ee * 4 + 1] * ec[eb + 4] + this.elements[ee * 4 + 2] * ec[eb + 8] + this.elements[ee * 4 + 3] * ec[eb + 12] | ||
4040 | } | ||
4041 | } | ||
4042 | this.elements = ea.slice() | ||
4043 | }, | ||
4044 | rotate: function(ee, ea, eg, ed) { | ||
4045 | if (!eg) { | ||
4046 | this.rotateZ(ee) | ||
4047 | } else { | ||
4048 | var ef = cW.cos(ee); | ||
4049 | var ec = cW.sin(ee); | ||
4050 | var eb = 1 - ef; | ||
4051 | this.apply(eb * ea * ea + ef, eb * ea * eg - ec * ed, eb * ea * ed + ec * eg, 0, eb * ea * eg + ec * ed, eb * eg * eg + ef, eb * eg * ed - ec * ea, 0, eb * ea * ed - ec * eg, eb * eg * ed + ec * ea, eb * ed * ed + ef, 0, 0, 0, 0, 1) | ||
4052 | } | ||
4053 | }, | ||
4054 | invApply: function() { | ||
4055 | if (ab === t) { | ||
4056 | ab = new aP | ||
4057 | } | ||
4058 | var ea = arguments; | ||
4059 | ab.set(ea[0], ea[1], ea[2], ea[3], ea[4], ea[5], ea[6], ea[7], ea[8], ea[9], ea[10], ea[11], ea[12], ea[13], ea[14], ea[15]); | ||
4060 | if (!ab.invert()) { | ||
4061 | return false | ||
4062 | } | ||
4063 | this.preApply(ab); | ||
4064 | return true | ||
4065 | }, | ||
4066 | rotateX: function(eb) { | ||
4067 | var ec = cW.cos(eb); | ||
4068 | var ea = cW.sin(eb); | ||
4069 | this.apply([1, 0, 0, 0, 0, ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1]) | ||
4070 | }, | ||
4071 | rotateY: function(eb) { | ||
4072 | var ec = cW.cos(eb); | ||
4073 | var ea = cW.sin(eb); | ||
4074 | this.apply([ec, 0, ea, 0, 0, 1, 0, 0, -ea, 0, ec, 0, 0, 0, 0, 1]) | ||
4075 | }, | ||
4076 | rotateZ: function(eb) { | ||
4077 | var ec = q.cos(eb); | ||
4078 | var ea = q.sin(eb); | ||
4079 | this.apply([ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) | ||
4080 | }, | ||
4081 | scale: function(ec, eb, ea) { | ||
4082 | if (ec && !eb && !ea) { | ||
4083 | eb = ea = ec | ||
4084 | } else { | ||
4085 | if (ec && eb && !ea) { | ||
4086 | ea = 1 | ||
4087 | } | ||
4088 | } if (ec && eb && ea) { | ||
4089 | this.elements[0] *= ec; | ||
4090 | this.elements[1] *= eb; | ||
4091 | this.elements[2] *= ea; | ||
4092 | this.elements[4] *= ec; | ||
4093 | this.elements[5] *= eb; | ||
4094 | this.elements[6] *= ea; | ||
4095 | this.elements[8] *= ec; | ||
4096 | this.elements[9] *= eb; | ||
4097 | this.elements[10] *= ea; | ||
4098 | this.elements[12] *= ec; | ||
4099 | this.elements[13] *= eb; | ||
4100 | this.elements[14] *= ea | ||
4101 | } | ||
4102 | }, | ||
4103 | skewX: function(eb) { | ||
4104 | var ea = q.tan(eb); | ||
4105 | this.apply(1, ea, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) | ||
4106 | }, | ||
4107 | skewY: function(eb) { | ||
4108 | var ea = q.tan(eb); | ||
4109 | this.apply(1, 0, 0, 0, ea, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) | ||
4110 | }, | ||
4111 | shearX: function(eb) { | ||
4112 | var ea = q.tan(eb); | ||
4113 | this.apply(1, ea, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) | ||
4114 | }, | ||
4115 | shearY: function(eb) { | ||
4116 | var ea = q.tan(eb); | ||
4117 | this.apply(1, 0, 0, 0, ea, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) | ||
4118 | }, | ||
4119 | multX: function(ea, ed, ec, eb) { | ||
4120 | if (!ec) { | ||
4121 | return this.elements[0] * ea + this.elements[1] * ed + this.elements[3] | ||
4122 | } | ||
4123 | if (!eb) { | ||
4124 | return this.elements[0] * ea + this.elements[1] * ed + this.elements[2] * ec + this.elements[3] | ||
4125 | } | ||
4126 | return this.elements[0] * ea + this.elements[1] * ed + this.elements[2] * ec + this.elements[3] * eb | ||
4127 | }, | ||
4128 | multY: function(ea, ed, ec, eb) { | ||
4129 | if (!ec) { | ||
4130 | return this.elements[4] * ea + this.elements[5] * ed + this.elements[7] | ||
4131 | } | ||
4132 | if (!eb) { | ||
4133 | return this.elements[4] * ea + this.elements[5] * ed + this.elements[6] * ec + this.elements[7] | ||
4134 | } | ||
4135 | return this.elements[4] * ea + this.elements[5] * ed + this.elements[6] * ec + this.elements[7] * eb | ||
4136 | }, | ||
4137 | multZ: function(ea, ed, ec, eb) { | ||
4138 | if (!eb) { | ||
4139 | return this.elements[8] * ea + this.elements[9] * ed + this.elements[10] * ec + this.elements[11] | ||
4140 | } | ||
4141 | return this.elements[8] * ea + this.elements[9] * ed + this.elements[10] * ec + this.elements[11] * eb | ||
4142 | }, | ||
4143 | multW: function(ea, ed, ec, eb) { | ||
4144 | if (!eb) { | ||
4145 | return this.elements[12] * ea + this.elements[13] * ed + this.elements[14] * ec + this.elements[15] | ||
4146 | } | ||
4147 | return this.elements[12] * ea + this.elements[13] * ed + this.elements[14] * ec + this.elements[15] * eb | ||
4148 | }, | ||
4149 | invert: function() { | ||
4150 | var ej = this.elements[0] * this.elements[5] - this.elements[1] * this.elements[4]; | ||
4151 | var ei = this.elements[0] * this.elements[6] - this.elements[2] * this.elements[4]; | ||
4152 | var eh = this.elements[0] * this.elements[7] - this.elements[3] * this.elements[4]; | ||
4153 | var eg = this.elements[1] * this.elements[6] - this.elements[2] * this.elements[5]; | ||
4154 | var ef = this.elements[1] * this.elements[7] - this.elements[3] * this.elements[5]; | ||
4155 | var ee = this.elements[2] * this.elements[7] - this.elements[3] * this.elements[6]; | ||
4156 | var ed = this.elements[8] * this.elements[13] - this.elements[9] * this.elements[12]; | ||
4157 | var ec = this.elements[8] * this.elements[14] - this.elements[10] * this.elements[12]; | ||
4158 | var eb = this.elements[8] * this.elements[15] - this.elements[11] * this.elements[12]; | ||
4159 | var eo = this.elements[9] * this.elements[14] - this.elements[10] * this.elements[13]; | ||
4160 | var em = this.elements[9] * this.elements[15] - this.elements[11] * this.elements[13]; | ||
4161 | var el = this.elements[10] * this.elements[15] - this.elements[11] * this.elements[14]; | ||
4162 | var en = ej * el - ei * em + eh * eo + eg * eb - ef * ec + ee * ed; | ||
4163 | if (q.abs(en) <= 1e-9) { | ||
4164 | return false | ||
4165 | } | ||
4166 | var ek = []; | ||
4167 | ek[0] = +this.elements[5] * el - this.elements[6] * em + this.elements[7] * eo; | ||
4168 | ek[4] = -this.elements[4] * el + this.elements[6] * eb - this.elements[7] * ec; | ||
4169 | ek[8] = +this.elements[4] * em - this.elements[5] * eb + this.elements[7] * ed; | ||
4170 | ek[12] = -this.elements[4] * eo + this.elements[5] * ec - this.elements[6] * ed; | ||
4171 | ek[1] = -this.elements[1] * el + this.elements[2] * em - this.elements[3] * eo; | ||
4172 | ek[5] = +this.elements[0] * el - this.elements[2] * eb + this.elements[3] * ec; | ||
4173 | ek[9] = -this.elements[0] * em + this.elements[1] * eb - this.elements[3] * ed; | ||
4174 | ek[13] = +this.elements[0] * eo - this.elements[1] * ec + this.elements[2] * ed; | ||
4175 | ek[2] = +this.elements[13] * ee - this.elements[14] * ef + this.elements[15] * eg; | ||
4176 | ek[6] = -this.elements[12] * ee + this.elements[14] * eh - this.elements[15] * ei; | ||
4177 | ek[10] = +this.elements[12] * ef - this.elements[13] * eh + this.elements[15] * ej; | ||
4178 | ek[14] = -this.elements[12] * eg + this.elements[13] * ei - this.elements[14] * ej; | ||
4179 | ek[3] = -this.elements[9] * ee + this.elements[10] * ef - this.elements[11] * eg; | ||
4180 | ek[7] = +this.elements[8] * ee - this.elements[10] * eh + this.elements[11] * ei; | ||
4181 | ek[11] = -this.elements[8] * ef + this.elements[9] * eh - this.elements[11] * ej; | ||
4182 | ek[15] = +this.elements[8] * eg - this.elements[9] * ei + this.elements[10] * ej; | ||
4183 | var ea = 1 / en; | ||
4184 | ek[0] *= ea; | ||
4185 | ek[1] *= ea; | ||
4186 | ek[2] *= ea; | ||
4187 | ek[3] *= ea; | ||
4188 | ek[4] *= ea; | ||
4189 | ek[5] *= ea; | ||
4190 | ek[6] *= ea; | ||
4191 | ek[7] *= ea; | ||
4192 | ek[8] *= ea; | ||
4193 | ek[9] *= ea; | ||
4194 | ek[10] *= ea; | ||
4195 | ek[11] *= ea; | ||
4196 | ek[12] *= ea; | ||
4197 | ek[13] *= ea; | ||
4198 | ek[14] *= ea; | ||
4199 | ek[15] *= ea; | ||
4200 | this.elements = ek.slice(); | ||
4201 | return true | ||
4202 | }, | ||
4203 | toString: function() { | ||
4204 | var eb = ""; | ||
4205 | for (var ea = 0; ea < 15; ea++) { | ||
4206 | eb += this.elements[ea] + ", " | ||
4207 | } | ||
4208 | eb += this.elements[15]; | ||
4209 | return eb | ||
4210 | }, | ||
4211 | print: function() { | ||
4212 | var eb = cm(this.elements); | ||
4213 | var ea = "" + cW.nfs(this.elements[0], eb, 4) + " " + cW.nfs(this.elements[1], eb, 4) + " " + cW.nfs(this.elements[2], eb, 4) + " " + cW.nfs(this.elements[3], eb, 4) + "\n" + cW.nfs(this.elements[4], eb, 4) + " " + cW.nfs(this.elements[5], eb, 4) + " " + cW.nfs(this.elements[6], eb, 4) + " " + cW.nfs(this.elements[7], eb, 4) + "\n" + cW.nfs(this.elements[8], eb, 4) + " " + cW.nfs(this.elements[9], eb, 4) + " " + cW.nfs(this.elements[10], eb, 4) + " " + cW.nfs(this.elements[11], eb, 4) + "\n" + cW.nfs(this.elements[12], eb, 4) + " " + cW.nfs(this.elements[13], eb, 4) + " " + cW.nfs(this.elements[14], eb, 4) + " " + cW.nfs(this.elements[15], eb, 4) + "\n\n"; | ||
4214 | cW.println(ea) | ||
4215 | }, | ||
4216 | invTranslate: function(eb, ea, ec) { | ||
4217 | this.preApply(1, 0, 0, -eb, 0, 1, 0, -ea, 0, 0, 1, -ec, 0, 0, 0, 1) | ||
4218 | }, | ||
4219 | invRotateX: function(eb) { | ||
4220 | var ec = q.cos(-eb); | ||
4221 | var ea = q.sin(-eb); | ||
4222 | this.preApply([1, 0, 0, 0, 0, ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1]) | ||
4223 | }, | ||
4224 | invRotateY: function(eb) { | ||
4225 | var ec = q.cos(-eb); | ||
4226 | var ea = q.sin(-eb); | ||
4227 | this.preApply([ec, 0, ea, 0, 0, 1, 0, 0, -ea, 0, ec, 0, 0, 0, 0, 1]) | ||
4228 | }, | ||
4229 | invRotateZ: function(eb) { | ||
4230 | var ec = q.cos(-eb); | ||
4231 | var ea = q.sin(-eb); | ||
4232 | this.preApply([ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) | ||
4233 | }, | ||
4234 | invScale: function(ea, ec, eb) { | ||
4235 | this.preApply([1 / ea, 0, 0, 0, 0, 1 / ec, 0, 0, 0, 0, 1 / eb, 0, 0, 0, 0, 1]) | ||
4236 | } | ||
4237 | }; | ||
4238 | var V = cW.PMatrixStack = function() { | ||
4239 | this.matrixStack = [] | ||
4240 | }; | ||
4241 | V.prototype.load = function() { | ||
4242 | var ea = dY.$newPMatrix(); | ||
4243 | if (arguments.length === 1) { | ||
4244 | ea.set(arguments[0]) | ||
4245 | } else { | ||
4246 | ea.set(arguments) | ||
4247 | } | ||
4248 | this.matrixStack.push(ea) | ||
4249 | }; | ||
4250 | bR.prototype.$newPMatrix = function() { | ||
4251 | return new aX | ||
4252 | }; | ||
4253 | bB.prototype.$newPMatrix = function() { | ||
4254 | return new aP | ||
4255 | }; | ||
4256 | V.prototype.push = function() { | ||
4257 | this.matrixStack.push(this.peek()) | ||
4258 | }; | ||
4259 | V.prototype.pop = function() { | ||
4260 | return this.matrixStack.pop() | ||
4261 | }; | ||
4262 | V.prototype.peek = function() { | ||
4263 | var ea = dY.$newPMatrix(); | ||
4264 | ea.set(this.matrixStack[this.matrixStack.length - 1]); | ||
4265 | return ea | ||
4266 | }; | ||
4267 | V.prototype.mult = function(ea) { | ||
4268 | this.matrixStack[this.matrixStack.length - 1].apply(ea) | ||
4269 | }; | ||
4270 | cW.split = function(eb, ea) { | ||
4271 | return eb.split(ea) | ||
4272 | }; | ||
4273 | cW.splitTokens = function(eg, ef) { | ||
4274 | if (ef === t) { | ||
4275 | return eg.split(/\s+/g) | ||
4276 | } | ||
4277 | var ed = ef.split(/()/g), | ||
4278 | eb = "", | ||
4279 | ea = eg.length, | ||
4280 | ec, eh, ee = []; | ||
4281 | for (ec = 0; ec < ea; ec++) { | ||
4282 | eh = eg[ec]; | ||
4283 | if (ed.indexOf(eh) > -1) { | ||
4284 | if (eb !== "") { | ||
4285 | ee.push(eb) | ||
4286 | } | ||
4287 | eb = "" | ||
4288 | } else { | ||
4289 | eb += eh | ||
4290 | } | ||
4291 | } | ||
4292 | if (eb !== "") { | ||
4293 | ee.push(eb) | ||
4294 | } | ||
4295 | return ee | ||
4296 | }; | ||
4297 | cW.append = function(eb, ea) { | ||
4298 | eb[eb.length] = ea; | ||
4299 | return eb | ||
4300 | }; | ||
4301 | cW.concat = function(eb, ea) { | ||
4302 | return eb.concat(ea) | ||
4303 | }; | ||
4304 | cW.sort = function(ef, ed) { | ||
4305 | var eb = []; | ||
4306 | if (ef.length > 0) { | ||
4307 | var ee = ed > 0 ? ed : ef.length; | ||
4308 | for (var ec = 0; ec < ee; ec++) { | ||
4309 | eb.push(ef[ec]) | ||
4310 | } | ||
4311 | if (typeof ef[0] === "string") { | ||
4312 | eb.sort() | ||
4313 | } else { | ||
4314 | eb.sort(function(eh, eg) { | ||
4315 | return eh - eg | ||
4316 | }) | ||
4317 | } if (ed > 0) { | ||
4318 | for (var ea = eb.length; ea < ef.length; ea++) { | ||
4319 | eb.push(ef[ea]) | ||
4320 | } | ||
4321 | } | ||
4322 | } | ||
4323 | return eb | ||
4324 | }; | ||
4325 | cW.splice = function(ee, ed, eb) { | ||
4326 | if (ed.length === 0) { | ||
4327 | return ee | ||
4328 | } | ||
4329 | if (ed instanceof Array) { | ||
4330 | for (var ec = 0, ea = eb; ec < ed.length; ea++, ec++) { | ||
4331 | ee.splice(ea, 0, ed[ec]) | ||
4332 | } | ||
4333 | } else { | ||
4334 | ee.splice(eb, 0, ed) | ||
4335 | } | ||
4336 | return ee | ||
4337 | }; | ||
4338 | cW.subset = function(ed, ec, eb) { | ||
4339 | var ea = eb !== t ? ec + eb : ed.length; | ||
4340 | return ed.slice(ec, ea) | ||
4341 | }; | ||
4342 | cW.join = function(eb, ea) { | ||
4343 | return eb.join(ea) | ||
4344 | }; | ||
4345 | cW.shorten = function(ed) { | ||
4346 | var eb = []; | ||
4347 | var ea = ed.length; | ||
4348 | for (var ec = 0; ec < ea; ec++) { | ||
4349 | eb[ec] = ed[ec] | ||
4350 | } | ||
4351 | eb.pop(); | ||
4352 | return eb | ||
4353 | }; | ||
4354 | cW.expand = function(ec, ed) { | ||
4355 | var eb = ec.slice(0), | ||
4356 | ea = ed || ec.length * 2; | ||
4357 | eb.length = ea; | ||
4358 | return eb | ||
4359 | }; | ||
4360 | cW.arrayCopy = function() { | ||
4361 | var eg, ee = 0, | ||
4362 | ec, eb = 0, | ||
4363 | ef; | ||
4364 | if (arguments.length === 2) { | ||
4365 | eg = arguments[0]; | ||
4366 | ec = arguments[1]; | ||
4367 | ef = eg.length | ||
4368 | } else { | ||
4369 | if (arguments.length === 3) { | ||
4370 | eg = arguments[0]; | ||
4371 | ec = arguments[1]; | ||
4372 | ef = arguments[2] | ||
4373 | } else { | ||
4374 | if (arguments.length === 5) { | ||
4375 | eg = arguments[0]; | ||
4376 | ee = arguments[1]; | ||
4377 | ec = arguments[2]; | ||
4378 | eb = arguments[3]; | ||
4379 | ef = arguments[4] | ||
4380 | } | ||
4381 | } | ||
4382 | } | ||
4383 | for (var ed = ee, ea = eb; ed < ef + ee; ed++, ea++) { | ||
4384 | if (ec[ea] !== t) { | ||
4385 | ec[ea] = eg[ed] | ||
4386 | } else { | ||
4387 | throw "array index out of bounds exception" | ||
4388 | } | ||
4389 | } | ||
4390 | }; | ||
4391 | cW.reverse = function(ea) { | ||
4392 | return ea.reverse() | ||
4393 | }; | ||
4394 | cW.mix = function(eb, ea, ec) { | ||
4395 | return eb + ((ea - eb) * ec >> 8) | ||
4396 | }; | ||
4397 | cW.peg = function(ea) { | ||
4398 | return ea < 0 ? 0 : ea > 255 ? 255 : ea | ||
4399 | }; | ||
4400 | cW.modes = function() { | ||
4401 | var ef = 4278190080, | ||
4402 | ec = 16711680, | ||
4403 | eb = 65280, | ||
4404 | ee = 255, | ||
4405 | ed = q.min, | ||
4406 | ea = q.max; | ||
4407 | |||
4408 | function eg(el, eo, ek, et, ev, eu, em, eq, ep, ei, ej) { | ||
4409 | var es = ed(((el & 4278190080) >>> 24) + eo, 255) << 24; | ||
4410 | var eh = ek + ((ep - ek) * eo >> 8); | ||
4411 | eh = (eh < 0 ? 0 : eh > 255 ? 255 : eh) << 16; | ||
4412 | var en = et + ((ei - et) * eo >> 8); | ||
4413 | en = (en < 0 ? 0 : en > 255 ? 255 : en) << 8; | ||
4414 | var er = ev + ((ej - ev) * eo >> 8); | ||
4415 | er = er < 0 ? 0 : er > 255 ? 255 : er; | ||
4416 | return es | eh | en | er | ||
4417 | } | ||
4418 | return { | ||
4419 | replace: function(ei, eh) { | ||
4420 | return eh | ||
4421 | }, | ||
4422 | blend: function(ej, ei) { | ||
4423 | var el = (ei & ef) >>> 24, | ||
4424 | eh = ej & ec, | ||
4425 | en = ej & eb, | ||
4426 | ep = ej & ee, | ||
4427 | eo = ei & ec, | ||
4428 | ek = ei & eb, | ||
4429 | em = ei & ee; | ||
4430 | return ed(((ej & ef) >>> 24) + el, 255) << 24 | eh + ((eo - eh) * el >> 8) & ec | en + ((ek - en) * el >> 8) & eb | ep + ((em - ep) * el >> 8) & ee | ||
4431 | }, | ||
4432 | add: function(ei, eh) { | ||
4433 | var ej = (eh & ef) >>> 24; | ||
4434 | return ed(((ei & ef) >>> 24) + ej, 255) << 24 | ed((ei & ec) + ((eh & ec) >> 8) * ej, ec) & ec | ed((ei & eb) + ((eh & eb) >> 8) * ej, eb) & eb | ed((ei & ee) + ((eh & ee) * ej >> 8), ee) | ||
4435 | }, | ||
4436 | subtract: function(ei, eh) { | ||
4437 | var ej = (eh & ef) >>> 24; | ||
4438 | return ed(((ei & ef) >>> 24) + ej, 255) << 24 | ea((ei & ec) - ((eh & ec) >> 8) * ej, eb) & ec | ea((ei & eb) - ((eh & eb) >> 8) * ej, ee) & eb | ea((ei & ee) - ((eh & ee) * ej >> 8), 0) | ||
4439 | }, | ||
4440 | lightest: function(ei, eh) { | ||
4441 | var ej = (eh & ef) >>> 24; | ||
4442 | return ed(((ei & ef) >>> 24) + ej, 255) << 24 | ea(ei & ec, ((eh & ec) >> 8) * ej) & ec | ea(ei & eb, ((eh & eb) >> 8) * ej) & eb | ea(ei & ee, (eh & ee) * ej >> 8) | ||
4443 | }, | ||
4444 | darkest: function(ej, ei) { | ||
4445 | var el = (ei & ef) >>> 24, | ||
4446 | eh = ej & ec, | ||
4447 | en = ej & eb, | ||
4448 | ep = ej & ee, | ||
4449 | eo = ed(ej & ec, ((ei & ec) >> 8) * el), | ||
4450 | ek = ed(ej & eb, ((ei & eb) >> 8) * el), | ||
4451 | em = ed(ej & ee, (ei & ee) * el >> 8); | ||
4452 | return ed(((ej & ef) >>> 24) + el, 255) << 24 | eh + ((eo - eh) * el >> 8) & ec | en + ((ek - en) * el >> 8) & eb | ep + ((em - ep) * el >> 8) & ee | ||
4453 | }, | ||
4454 | difference: function(el, ek) { | ||
4455 | var en = (ek & ef) >>> 24, | ||
4456 | ej = (el & ec) >> 16, | ||
4457 | eq = (el & eb) >> 8, | ||
4458 | es = el & ee, | ||
4459 | er = (ek & ec) >> 16, | ||
4460 | em = (ek & eb) >> 8, | ||
4461 | ep = ek & ee, | ||
4462 | eo = ej > er ? ej - er : er - ej, | ||
4463 | eh = eq > em ? eq - em : em - eq, | ||
4464 | ei = es > ep ? es - ep : ep - es; | ||
4465 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4466 | }, | ||
4467 | exclusion: function(el, ek) { | ||
4468 | var en = (ek & ef) >>> 24, | ||
4469 | ej = (el & ec) >> 16, | ||
4470 | eq = (el & eb) >> 8, | ||
4471 | es = el & ee, | ||
4472 | er = (ek & ec) >> 16, | ||
4473 | em = (ek & eb) >> 8, | ||
4474 | ep = ek & ee, | ||
4475 | eo = ej + er - (ej * er >> 7), | ||
4476 | eh = eq + em - (eq * em >> 7), | ||
4477 | ei = es + ep - (es * ep >> 7); | ||
4478 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4479 | }, | ||
4480 | multiply: function(el, ek) { | ||
4481 | var en = (ek & ef) >>> 24, | ||
4482 | ej = (el & ec) >> 16, | ||
4483 | eq = (el & eb) >> 8, | ||
4484 | es = el & ee, | ||
4485 | er = (ek & ec) >> 16, | ||
4486 | em = (ek & eb) >> 8, | ||
4487 | ep = ek & ee, | ||
4488 | eo = ej * er >> 8, | ||
4489 | eh = eq * em >> 8, | ||
4490 | ei = es * ep >> 8; | ||
4491 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4492 | }, | ||
4493 | screen: function(el, ek) { | ||
4494 | var en = (ek & ef) >>> 24, | ||
4495 | ej = (el & ec) >> 16, | ||
4496 | eq = (el & eb) >> 8, | ||
4497 | es = el & ee, | ||
4498 | er = (ek & ec) >> 16, | ||
4499 | em = (ek & eb) >> 8, | ||
4500 | ep = ek & ee, | ||
4501 | eo = 255 - ((255 - ej) * (255 - er) >> 8), | ||
4502 | eh = 255 - ((255 - eq) * (255 - em) >> 8), | ||
4503 | ei = 255 - ((255 - es) * (255 - ep) >> 8); | ||
4504 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4505 | }, | ||
4506 | hard_light: function(el, ek) { | ||
4507 | var en = (ek & ef) >>> 24, | ||
4508 | ej = (el & ec) >> 16, | ||
4509 | eq = (el & eb) >> 8, | ||
4510 | es = el & ee, | ||
4511 | er = (ek & ec) >> 16, | ||
4512 | em = (ek & eb) >> 8, | ||
4513 | ep = ek & ee, | ||
4514 | eo = er < 128 ? ej * er >> 7 : 255 - ((255 - ej) * (255 - er) >> 7), | ||
4515 | eh = em < 128 ? eq * em >> 7 : 255 - ((255 - eq) * (255 - em) >> 7), | ||
4516 | ei = ep < 128 ? es * ep >> 7 : 255 - ((255 - es) * (255 - ep) >> 7); | ||
4517 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4518 | }, | ||
4519 | soft_light: function(el, ek) { | ||
4520 | var en = (ek & ef) >>> 24, | ||
4521 | ej = (el & ec) >> 16, | ||
4522 | eq = (el & eb) >> 8, | ||
4523 | es = el & ee, | ||
4524 | er = (ek & ec) >> 16, | ||
4525 | em = (ek & eb) >> 8, | ||
4526 | ep = ek & ee, | ||
4527 | eo = (ej * er >> 7) + (ej * ej >> 8) - (ej * ej * er >> 15), | ||
4528 | eh = (eq * em >> 7) + (eq * eq >> 8) - (eq * eq * em >> 15), | ||
4529 | ei = (es * ep >> 7) + (es * es >> 8) - (es * es * ep >> 15); | ||
4530 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4531 | }, | ||
4532 | overlay: function(el, ek) { | ||
4533 | var en = (ek & ef) >>> 24, | ||
4534 | ej = (el & ec) >> 16, | ||
4535 | eq = (el & eb) >> 8, | ||
4536 | es = el & ee, | ||
4537 | er = (ek & ec) >> 16, | ||
4538 | em = (ek & eb) >> 8, | ||
4539 | ep = ek & ee, | ||
4540 | eo = ej < 128 ? ej * er >> 7 : 255 - ((255 - ej) * (255 - er) >> 7), | ||
4541 | eh = eq < 128 ? eq * em >> 7 : 255 - ((255 - eq) * (255 - em) >> 7), | ||
4542 | ei = es < 128 ? es * ep >> 7 : 255 - ((255 - es) * (255 - ep) >> 7); | ||
4543 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4544 | }, | ||
4545 | dodge: function(el, ek) { | ||
4546 | var en = (ek & ef) >>> 24, | ||
4547 | ej = (el & ec) >> 16, | ||
4548 | eq = (el & eb) >> 8, | ||
4549 | es = el & ee, | ||
4550 | er = (ek & ec) >> 16, | ||
4551 | em = (ek & eb) >> 8, | ||
4552 | ep = ek & ee; | ||
4553 | var eo = 255; | ||
4554 | if (er !== 255) { | ||
4555 | eo = (ej << 8) / (255 - er); | ||
4556 | eo = eo < 0 ? 0 : eo > 255 ? 255 : eo | ||
4557 | } | ||
4558 | var eh = 255; | ||
4559 | if (em !== 255) { | ||
4560 | eh = (eq << 8) / (255 - em); | ||
4561 | eh = eh < 0 ? 0 : eh > 255 ? 255 : eh | ||
4562 | } | ||
4563 | var ei = 255; | ||
4564 | if (ep !== 255) { | ||
4565 | ei = (es << 8) / (255 - ep); | ||
4566 | ei = ei < 0 ? 0 : ei > 255 ? 255 : ei | ||
4567 | } | ||
4568 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4569 | }, | ||
4570 | burn: function(el, ek) { | ||
4571 | var en = (ek & ef) >>> 24, | ||
4572 | ej = (el & ec) >> 16, | ||
4573 | eq = (el & eb) >> 8, | ||
4574 | es = el & ee, | ||
4575 | er = (ek & ec) >> 16, | ||
4576 | em = (ek & eb) >> 8, | ||
4577 | ep = ek & ee; | ||
4578 | var eo = 0; | ||
4579 | if (er !== 0) { | ||
4580 | eo = (255 - ej << 8) / er; | ||
4581 | eo = 255 - (eo < 0 ? 0 : eo > 255 ? 255 : eo) | ||
4582 | } | ||
4583 | var eh = 0; | ||
4584 | if (em !== 0) { | ||
4585 | eh = (255 - eq << 8) / em; | ||
4586 | eh = 255 - (eh < 0 ? 0 : eh > 255 ? 255 : eh) | ||
4587 | } | ||
4588 | var ei = 0; | ||
4589 | if (ep !== 0) { | ||
4590 | ei = (255 - es << 8) / ep; | ||
4591 | ei = 255 - (ei < 0 ? 0 : ei > 255 ? 255 : ei) | ||
4592 | } | ||
4593 | return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei) | ||
4594 | } | ||
4595 | } | ||
4596 | }(); | ||
4597 | |||
4598 | function dH(ef, ee, ec, eb) { | ||
4599 | var ea, ed, eh, ei; | ||
4600 | if (cY === 3) { | ||
4601 | var eg = cW.color.toRGB(ef, ee, ec); | ||
4602 | ea = eg[0]; | ||
4603 | ed = eg[1]; | ||
4604 | eh = eg[2] | ||
4605 | } else { | ||
4606 | ea = q.round(255 * (ef / bJ)); | ||
4607 | ed = q.round(255 * (ee / bI)); | ||
4608 | eh = q.round(255 * (ec / bG)) | ||
4609 | } | ||
4610 | ei = q.round(255 * (eb / bU)); | ||
4611 | ea = ea < 0 ? 0 : ea; | ||
4612 | ed = ed < 0 ? 0 : ed; | ||
4613 | eh = eh < 0 ? 0 : eh; | ||
4614 | ei = ei < 0 ? 0 : ei; | ||
4615 | ea = ea > 255 ? 255 : ea; | ||
4616 | ed = ed > 255 ? 255 : ed; | ||
4617 | eh = eh > 255 ? 255 : eh; | ||
4618 | ei = ei > 255 ? 255 : ei; | ||
4619 | return ei << 24 & 4278190080 | ea << 16 & 16711680 | ed << 8 & 65280 | eh & 255 | ||
4620 | } | ||
4621 | |||
4622 | function dK(ea, ec) { | ||
4623 | var eb; | ||
4624 | if (ea & 4278190080) { | ||
4625 | eb = q.round(255 * (ec / bU)); | ||
4626 | eb = eb > 255 ? 255 : eb; | ||
4627 | eb = eb < 0 ? 0 : eb; | ||
4628 | return ea - (ea & 4278190080) + (eb << 24 & 4278190080) | ||
4629 | } | ||
4630 | if (cY === 1) { | ||
4631 | return dH(ea, ea, ea, ec) | ||
4632 | } | ||
4633 | if (cY === 3) { | ||
4634 | return dH(0, 0, ea / bJ * bG, ec) | ||
4635 | } | ||
4636 | } | ||
4637 | |||
4638 | function dM(ea) { | ||
4639 | if (ea <= bJ && ea >= 0) { | ||
4640 | if (cY === 1) { | ||
4641 | return dH(ea, ea, ea, bU) | ||
4642 | } | ||
4643 | if (cY === 3) { | ||
4644 | return dH(0, 0, ea / bJ * bG, bU) | ||
4645 | } | ||
4646 | } | ||
4647 | if (ea) { | ||
4648 | if (ea > 2147483647) { | ||
4649 | ea -= 4294967296 | ||
4650 | } | ||
4651 | return ea | ||
4652 | } | ||
4653 | } | ||
4654 | cW.color = function(ea, ed, ec, eb) { | ||
4655 | if (ea !== t && ed !== t && ec !== t && eb !== t) { | ||
4656 | return dH(ea, ed, ec, eb) | ||
4657 | } | ||
4658 | if (ea !== t && ed !== t && ec !== t) { | ||
4659 | return dH(ea, ed, ec, bU) | ||
4660 | } | ||
4661 | if (ea !== t && ed !== t) { | ||
4662 | return dK(ea, ed) | ||
4663 | } | ||
4664 | if (typeof ea === "number") { | ||
4665 | return dM(ea) | ||
4666 | } | ||
4667 | return dH(bJ, bI, bG, bU) | ||
4668 | }; | ||
4669 | cW.color.toString = function(ea) { | ||
4670 | return "rgba(" + ((ea >> 16) & 255) + "," + ((ea >> 8) & 255) + "," + (ea & 255) + "," + ((ea >> 24) & 255) / 255 + ")" | ||
4671 | }; | ||
4672 | cW.color.toInt = function(ed, ec, ea, eb) { | ||
4673 | return eb << 24 & 4278190080 | ed << 16 & 16711680 | ec << 8 & 65280 | ea & 255 | ||
4674 | }; | ||
4675 | cW.color.toArray = function(ea) { | ||
4676 | return [(ea >> 16) & 255, (ea >> 8) & 255, ea & 255, (ea >> 24) & 255] | ||
4677 | }; | ||
4678 | cW.color.toGLArray = function(ea) { | ||
4679 | return [((ea & 16711680) >>> 16) / 255, ((ea >> 8) & 255) / 255, (ea & 255) / 255, ((ea >> 24) & 255) / 255] | ||
4680 | }; | ||
4681 | cW.color.toRGB = function(ec, ei, ef) { | ||
4682 | ec = ec > bJ ? bJ : ec; | ||
4683 | ei = ei > bI ? bI : ei; | ||
4684 | ef = ef > bG ? bG : ef; | ||
4685 | ec = ec / bJ * 360; | ||
4686 | ei = ei / bI * 100; | ||
4687 | ef = ef / bG * 100; | ||
4688 | var eh = q.round(ef / 100 * 255); | ||
4689 | if (ei === 0) { | ||
4690 | return [eh, eh, eh] | ||
4691 | } | ||
4692 | var ed = ec % 360; | ||
4693 | var ee = ed % 60; | ||
4694 | var eb = q.round(ef * (100 - ei) / 10000 * 255); | ||
4695 | var ea = q.round(ef * (6000 - ei * ee) / 600000 * 255); | ||
4696 | var eg = q.round(ef * (6000 - ei * (60 - ee)) / 600000 * 255); | ||
4697 | switch (q.floor(ed / 60)) { | ||
4698 | case 0: | ||
4699 | return [eh, eg, eb]; | ||
4700 | case 1: | ||
4701 | return [ea, eh, eb]; | ||
4702 | case 2: | ||
4703 | return [eb, eh, eg]; | ||
4704 | case 3: | ||
4705 | return [eb, ea, eh]; | ||
4706 | case 4: | ||
4707 | return [eg, eb, eh]; | ||
4708 | case 5: | ||
4709 | return [eh, eb, ea] | ||
4710 | } | ||
4711 | }; | ||
4712 | |||
4713 | function aS(eh) { | ||
4714 | var eg, ef, eb; | ||
4715 | eg = ((eh >> 16) & 255) / 255; | ||
4716 | ef = ((eh >> 8) & 255) / 255; | ||
4717 | eb = (eh & 255) / 255; | ||
4718 | var ea = cW.max(cW.max(eg, ef), eb), | ||
4719 | ed = cW.min(cW.min(eg, ef), eb), | ||
4720 | ec, ee; | ||
4721 | if (ed === ea) { | ||
4722 | return [0, 0, ea * bG] | ||
4723 | } | ||
4724 | ee = (ea - ed) / ea; | ||
4725 | if (eg === ea) { | ||
4726 | ec = (ef - eb) / (ea - ed) | ||
4727 | } else { | ||
4728 | if (ef === ea) { | ||
4729 | ec = 2 + (eb - eg) / (ea - ed) | ||
4730 | } else { | ||
4731 | ec = 4 + (eg - ef) / (ea - ed) | ||
4732 | } | ||
4733 | } | ||
4734 | ec /= 6; | ||
4735 | if (ec < 0) { | ||
4736 | ec += 1 | ||
4737 | } else { | ||
4738 | if (ec > 1) { | ||
4739 | ec -= 1 | ||
4740 | } | ||
4741 | } | ||
4742 | return [ec * bJ, ee * bI, ea * bG] | ||
4743 | } | ||
4744 | cW.brightness = function(ea) { | ||
4745 | return aS(ea)[2] | ||
4746 | }; | ||
4747 | cW.saturation = function(ea) { | ||
4748 | return aS(ea)[1] | ||
4749 | }; | ||
4750 | cW.hue = function(ea) { | ||
4751 | return aS(ea)[0] | ||
4752 | }; | ||
4753 | cW.red = function(ea) { | ||
4754 | return ((ea >> 16) & 255) / 255 * bJ | ||
4755 | }; | ||
4756 | cW.green = function(ea) { | ||
4757 | return ((ea & 65280) >>> 8) / 255 * bI | ||
4758 | }; | ||
4759 | cW.blue = function(ea) { | ||
4760 | return (ea & 255) / 255 * bG | ||
4761 | }; | ||
4762 | cW.alpha = function(ea) { | ||
4763 | return ((ea >> 24) & 255) / 255 * bU | ||
4764 | }; | ||
4765 | cW.lerpColor = function(em, el, ef) { | ||
4766 | var ek, eq, er, es, eo, ea, eg, eu, en, ev, ee, et; | ||
4767 | var ei, eh, eb, ep, ej; | ||
4768 | var ed = cW.color(em); | ||
4769 | var ec = cW.color(el); | ||
4770 | if (cY === 3) { | ||
4771 | ei = aS(ed); | ||
4772 | eu = ((ed >> 24) & 255) / bU; | ||
4773 | eh = aS(ec); | ||
4774 | et = ((ec & 4278190080) >>> 24) / bU; | ||
4775 | ep = cW.lerp(ei[0], eh[0], ef); | ||
4776 | ej = cW.lerp(ei[1], eh[1], ef); | ||
4777 | er = cW.lerp(ei[2], eh[2], ef); | ||
4778 | eb = cW.color.toRGB(ep, ej, er); | ||
4779 | es = cW.lerp(eu, et, ef) * bU; | ||
4780 | return es << 24 & 4278190080 | (eb[0] & 255) << 16 | (eb[1] & 255) << 8 | eb[2] & 255 | ||
4781 | } | ||
4782 | eo = (ed >> 16) & 255; | ||
4783 | ea = (ed >> 8) & 255; | ||
4784 | eg = ed & 255; | ||
4785 | eu = ((ed >> 24) & 255) / bU; | ||
4786 | en = (ec & 16711680) >>> 16; | ||
4787 | ev = (ec >> 8) & 255; | ||
4788 | ee = ec & 255; | ||
4789 | et = ((ec >> 24) & 255) / bU; | ||
4790 | ek = cW.lerp(eo, en, ef) | 0; | ||
4791 | eq = cW.lerp(ea, ev, ef) | 0; | ||
4792 | er = cW.lerp(eg, ee, ef) | 0; | ||
4793 | es = cW.lerp(eu, et, ef) * bU; | ||
4794 | return es << 24 & 4278190080 | ek << 16 & 16711680 | eq << 8 & 65280 | er & 255 | ||
4795 | }; | ||
4796 | cW.colorMode = function() { | ||
4797 | cY = arguments[0]; | ||
4798 | if (arguments.length > 1) { | ||
4799 | bJ = arguments[1]; | ||
4800 | bI = arguments[2] || arguments[1]; | ||
4801 | bG = arguments[3] || arguments[1]; | ||
4802 | bU = arguments[4] || arguments[1] | ||
4803 | } | ||
4804 | }; | ||
4805 | cW.blendColor = function(eb, ea, ec) { | ||
4806 | if (ec === 0) { | ||
4807 | return cW.modes.replace(eb, ea) | ||
4808 | } else { | ||
4809 | if (ec === 1) { | ||
4810 | return cW.modes.blend(eb, ea) | ||
4811 | } else { | ||
4812 | if (ec === 2) { | ||
4813 | return cW.modes.add(eb, ea) | ||
4814 | } else { | ||
4815 | if (ec === 4) { | ||
4816 | return cW.modes.subtract(eb, ea) | ||
4817 | } else { | ||
4818 | if (ec === 8) { | ||
4819 | return cW.modes.lightest(eb, ea) | ||
4820 | } else { | ||
4821 | if (ec === 16) { | ||
4822 | return cW.modes.darkest(eb, ea) | ||
4823 | } else { | ||
4824 | if (ec === 32) { | ||
4825 | return cW.modes.difference(eb, ea) | ||
4826 | } else { | ||
4827 | if (ec === 64) { | ||
4828 | return cW.modes.exclusion(eb, ea) | ||
4829 | } else { | ||
4830 | if (ec === 128) { | ||
4831 | return cW.modes.multiply(eb, ea) | ||
4832 | } else { | ||
4833 | if (ec === 256) { | ||
4834 | return cW.modes.screen(eb, ea) | ||
4835 | } else { | ||
4836 | if (ec === 1024) { | ||
4837 | return cW.modes.hard_light(eb, ea) | ||
4838 | } else { | ||
4839 | if (ec === 2048) { | ||
4840 | return cW.modes.soft_light(eb, ea) | ||
4841 | } else { | ||
4842 | if (ec === 512) { | ||
4843 | return cW.modes.overlay(eb, ea) | ||
4844 | } else { | ||
4845 | if (ec === 4096) { | ||
4846 | return cW.modes.dodge(eb, ea) | ||
4847 | } else { | ||
4848 | if (ec === 8192) { | ||
4849 | return cW.modes.burn(eb, ea) | ||
4850 | } | ||
4851 | } | ||
4852 | } | ||
4853 | } | ||
4854 | } | ||
4855 | } | ||
4856 | } | ||
4857 | } | ||
4858 | } | ||
4859 | } | ||
4860 | } | ||
4861 | } | ||
4862 | } | ||
4863 | } | ||
4864 | } | ||
4865 | }; | ||
4866 | |||
4867 | function aD() { | ||
4868 | d8.save() | ||
4869 | } | ||
4870 | |||
4871 | function cP() { | ||
4872 | d8.restore(); | ||
4873 | b3 = true; | ||
4874 | aq = true | ||
4875 | } | ||
4876 | cW.printMatrix = function() { | ||
4877 | dJ.print() | ||
4878 | }; | ||
4879 | bR.prototype.translate = function(ea, eb) { | ||
4880 | dJ.translate(ea, eb); | ||
4881 | aT.invTranslate(ea, eb); | ||
4882 | d8.translate(ea, eb) | ||
4883 | }; | ||
4884 | bB.prototype.translate = function(ea, ec, eb) { | ||
4885 | dJ.translate(ea, ec, eb); | ||
4886 | aT.invTranslate(ea, ec, eb) | ||
4887 | }; | ||
4888 | bR.prototype.scale = function(ea, eb) { | ||
4889 | dJ.scale(ea, eb); | ||
4890 | aT.invScale(ea, eb); | ||
4891 | d8.scale(ea, eb || ea) | ||
4892 | }; | ||
4893 | bB.prototype.scale = function(ea, ec, eb) { | ||
4894 | dJ.scale(ea, ec, eb); | ||
4895 | aT.invScale(ea, ec, eb) | ||
4896 | }; | ||
4897 | bR.prototype.transform = function(eb) { | ||
4898 | var ea = eb.array(); | ||
4899 | d8.transform(ea[0], ea[3], ea[1], ea[4], ea[2], ea[5]) | ||
4900 | }; | ||
4901 | bB.prototype.transformm = function(ea) { | ||
4902 | throw "p.transform is currently not supported in 3D mode" | ||
4903 | }; | ||
4904 | bR.prototype.pushMatrix = function() { | ||
4905 | am.load(dJ); | ||
4906 | da.load(aT); | ||
4907 | aD() | ||
4908 | }; | ||
4909 | bB.prototype.pushMatrix = function() { | ||
4910 | am.load(dJ); | ||
4911 | da.load(aT) | ||
4912 | }; | ||
4913 | bR.prototype.popMatrix = function() { | ||
4914 | dJ.set(am.pop()); | ||
4915 | aT.set(da.pop()); | ||
4916 | cP() | ||
4917 | }; | ||
4918 | bB.prototype.popMatrix = function() { | ||
4919 | dJ.set(am.pop()); | ||
4920 | aT.set(da.pop()) | ||
4921 | }; | ||
4922 | bR.prototype.resetMatrix = function() { | ||
4923 | dJ.reset(); | ||
4924 | aT.reset(); | ||
4925 | d8.setTransform(1, 0, 0, 1, 0, 0) | ||
4926 | }; | ||
4927 | bB.prototype.resetMatrix = function() { | ||
4928 | dJ.reset(); | ||
4929 | aT.reset() | ||
4930 | }; | ||
4931 | ds.prototype.applyMatrix = function() { | ||
4932 | var ea = arguments; | ||
4933 | dJ.apply(ea[0], ea[1], ea[2], ea[3], ea[4], ea[5], ea[6], ea[7], ea[8], ea[9], ea[10], ea[11], ea[12], ea[13], ea[14], ea[15]); | ||
4934 | aT.invApply(ea[0], ea[1], ea[2], ea[3], ea[4], ea[5], ea[6], ea[7], ea[8], ea[9], ea[10], ea[11], ea[12], ea[13], ea[14], ea[15]) | ||
4935 | }; | ||
4936 | bR.prototype.applyMatrix = function() { | ||
4937 | var ea = arguments; | ||
4938 | for (var eb = ea.length; eb < 16; eb++) { | ||
4939 | ea[eb] = 0 | ||
4940 | } | ||
4941 | ea[10] = ea[15] = 1; | ||
4942 | ds.prototype.applyMatrix.apply(this, ea) | ||
4943 | }; | ||
4944 | cW.rotateX = function(ea) { | ||
4945 | dJ.rotateX(ea); | ||
4946 | aT.invRotateX(ea) | ||
4947 | }; | ||
4948 | bR.prototype.rotateZ = function() { | ||
4949 | throw "rotateZ() is not supported in 2D mode. Use rotate(float) instead." | ||
4950 | }; | ||
4951 | bB.prototype.rotateZ = function(ea) { | ||
4952 | dJ.rotateZ(ea); | ||
4953 | aT.invRotateZ(ea) | ||
4954 | }; | ||
4955 | cW.rotateY = function(ea) { | ||
4956 | dJ.rotateY(ea); | ||
4957 | aT.invRotateY(ea) | ||
4958 | }; | ||
4959 | bR.prototype.rotate = function(ea) { | ||
4960 | dJ.rotateZ(ea); | ||
4961 | aT.invRotateZ(ea); | ||
4962 | d8.rotate(ea) | ||
4963 | }; | ||
4964 | bB.prototype.rotate = function(ea) { | ||
4965 | cW.rotateZ(ea) | ||
4966 | }; | ||
4967 | bR.prototype.shearX = function(ea) { | ||
4968 | dJ.shearX(ea); | ||
4969 | d8.transform(1, 0, ea, 1, 0, 0) | ||
4970 | }; | ||
4971 | bB.prototype.shearX = function(ea) { | ||
4972 | dJ.shearX(ea) | ||
4973 | }; | ||
4974 | bR.prototype.shearY = function(ea) { | ||
4975 | dJ.shearY(ea); | ||
4976 | d8.transform(1, ea, 0, 1, 0, 0) | ||
4977 | }; | ||
4978 | bB.prototype.shearY = function(ea) { | ||
4979 | dJ.shearY(ea) | ||
4980 | }; | ||
4981 | cW.pushStyle = function() { | ||
4982 | aD(); | ||
4983 | cW.pushMatrix(); | ||
4984 | var ea = { | ||
4985 | doFill: aH, | ||
4986 | currentFillColor: a1, | ||
4987 | doStroke: ce, | ||
4988 | currentStrokeColor: cv, | ||
4989 | curTint: bf, | ||
4990 | curRectMode: bK, | ||
4991 | curColorMode: cY, | ||
4992 | colorModeX: bJ, | ||
4993 | colorModeZ: bG, | ||
4994 | colorModeY: bI, | ||
4995 | colorModeA: bU, | ||
4996 | curTextFont: W, | ||
4997 | horizontalTextAlignment: N, | ||
4998 | verticalTextAlignment: c1, | ||
4999 | textMode: cI, | ||
5000 | curFontName: Y, | ||
5001 | curTextSize: d0, | ||
5002 | curTextAscent: a3, | ||
5003 | curTextDescent: dA, | ||
5004 | curTextLeading: d7 | ||
5005 | }; | ||
5006 | bm.push(ea) | ||
5007 | }; | ||
5008 | cW.popStyle = function() { | ||
5009 | var ea = bm.pop(); | ||
5010 | if (ea) { | ||
5011 | cP(); | ||
5012 | cW.popMatrix(); | ||
5013 | aH = ea.doFill; | ||
5014 | a1 = ea.currentFillColor; | ||
5015 | ce = ea.doStroke; | ||
5016 | cv = ea.currentStrokeColor; | ||
5017 | bf = ea.curTint; | ||
5018 | bK = ea.curRectMode; | ||
5019 | cY = ea.curColorMode; | ||
5020 | bJ = ea.colorModeX; | ||
5021 | bG = ea.colorModeZ; | ||
5022 | bI = ea.colorModeY; | ||
5023 | bU = ea.colorModeA; | ||
5024 | W = ea.curTextFont; | ||
5025 | Y = ea.curFontName; | ||
5026 | d0 = ea.curTextSize; | ||
5027 | N = ea.horizontalTextAlignment; | ||
5028 | c1 = ea.verticalTextAlignment; | ||
5029 | cI = ea.textMode; | ||
5030 | a3 = ea.curTextAscent; | ||
5031 | dA = ea.curTextDescent; | ||
5032 | d7 = ea.curTextLeading | ||
5033 | } else { | ||
5034 | throw "Too many popStyle() without enough pushStyle()" | ||
5035 | } | ||
5036 | }; | ||
5037 | cW.year = function() { | ||
5038 | return (new Date).getFullYear() | ||
5039 | }; | ||
5040 | cW.month = function() { | ||
5041 | return (new Date).getMonth() + 1 | ||
5042 | }; | ||
5043 | cW.day = function() { | ||
5044 | return (new Date).getDate() | ||
5045 | }; | ||
5046 | cW.hour = function() { | ||
5047 | return (new Date).getHours() | ||
5048 | }; | ||
5049 | cW.minute = function() { | ||
5050 | return (new Date).getMinutes() | ||
5051 | }; | ||
5052 | cW.second = function() { | ||
5053 | return (new Date).getSeconds() | ||
5054 | }; | ||
5055 | cW.millis = function() { | ||
5056 | return Date.now() - dq | ||
5057 | }; | ||
5058 | |||
5059 | function ct() { | ||
5060 | var ea = (Date.now() - dt) / 1000; | ||
5061 | P++; | ||
5062 | var eb = P / ea; | ||
5063 | if (ea > 0.5) { | ||
5064 | dt = Date.now(); | ||
5065 | P = 0; | ||
5066 | cW.__frameRate = eb | ||
5067 | } | ||
5068 | cW.frameCount++ | ||
5069 | } | ||
5070 | bR.prototype.redraw = function() { | ||
5071 | ct(); | ||
5072 | d8.lineWidth = dW; | ||
5073 | var ea = cW.pmouseX, | ||
5074 | eb = cW.pmouseY; | ||
5075 | cW.pmouseX = dN; | ||
5076 | cW.pmouseY = d5; | ||
5077 | aD(); | ||
5078 | cW.draw(); | ||
5079 | cP(); | ||
5080 | dN = cW.mouseX; | ||
5081 | d5 = cW.mouseY; | ||
5082 | cW.pmouseX = ea; | ||
5083 | cW.pmouseY = eb | ||
5084 | }; | ||
5085 | bB.prototype.redraw = function() { | ||
5086 | ct(); | ||
5087 | var ea = cW.pmouseX, | ||
5088 | eb = cW.pmouseY; | ||
5089 | cW.pmouseX = dN; | ||
5090 | cW.pmouseY = d5; | ||
5091 | d8.clear(d8.DEPTH_BUFFER_BIT); | ||
5092 | dC = { | ||
5093 | attributes: {}, | ||
5094 | locations: {} | ||
5095 | }; | ||
5096 | cW.noLights(); | ||
5097 | cW.lightFalloff(1, 0, 0); | ||
5098 | cW.shininess(1); | ||
5099 | cW.ambient(255, 255, 255); | ||
5100 | cW.specular(0, 0, 0); | ||
5101 | cW.emissive(0, 0, 0); | ||
5102 | cW.camera(); | ||
5103 | cW.draw(); | ||
5104 | dN = cW.mouseX; | ||
5105 | d5 = cW.mouseY; | ||
5106 | cW.pmouseX = ea; | ||
5107 | cW.pmouseY = eb | ||
5108 | }; | ||
5109 | cW.noLoop = function() { | ||
5110 | aC = false; | ||
5111 | ax = false; | ||
5112 | clearInterval(b4); | ||
5113 | cQ.onPause() | ||
5114 | }; | ||
5115 | cW.loop = function() { | ||
5116 | if (ax) { | ||
5117 | return | ||
5118 | } | ||
5119 | dt = Date.now(); | ||
5120 | P = 0; | ||
5121 | b4 = D.setInterval(function() { | ||
5122 | try { | ||
5123 | cQ.onFrameStart(); | ||
5124 | cW.redraw(); | ||
5125 | cQ.onFrameEnd() | ||
5126 | } catch (ea) { | ||
5127 | D.clearInterval(b4); | ||
5128 | throw ea | ||
5129 | } | ||
5130 | }, az); | ||
5131 | aC = true; | ||
5132 | ax = true; | ||
5133 | cQ.onLoop() | ||
5134 | }; | ||
5135 | cW.frameRate = function(ea) { | ||
5136 | dU = ea; | ||
5137 | az = 1000 / dU; | ||
5138 | if (aC) { | ||
5139 | cW.noLoop(); | ||
5140 | cW.loop() | ||
5141 | } | ||
5142 | }; | ||
5143 | var au = []; | ||
5144 | |||
5145 | function bO(ec, eb, ea) { | ||
5146 | if (ec.addEventListener) { | ||
5147 | ec.addEventListener(eb, ea, false) | ||
5148 | } else { | ||
5149 | ec.attachEvent("on" + eb, ea) | ||
5150 | } | ||
5151 | au.push({ | ||
5152 | elem: ec, | ||
5153 | type: eb, | ||
5154 | fn: ea | ||
5155 | }) | ||
5156 | } | ||
5157 | |||
5158 | function de(ea) { | ||
5159 | var ed = ea.elem, | ||
5160 | ec = ea.type, | ||
5161 | eb = ea.fn; | ||
5162 | if (ed.removeEventListener) { | ||
5163 | ed.removeEventListener(ec, eb, false) | ||
5164 | } else { | ||
5165 | if (ed.detachEvent) { | ||
5166 | ed.detachEvent("on" + ec, eb) | ||
5167 | } | ||
5168 | } | ||
5169 | } | ||
5170 | cW.exit = function() { | ||
5171 | D.clearInterval(b4); | ||
5172 | L(cW.externals.canvas.id); | ||
5173 | delete ae.onmousedown; | ||
5174 | for (var eb in F.lib) { | ||
5175 | if (F.lib.hasOwnProperty(eb)) { | ||
5176 | if (F.lib[eb].hasOwnProperty("detach")) { | ||
5177 | F.lib[eb].detach(cW) | ||
5178 | } | ||
5179 | } | ||
5180 | } | ||
5181 | var ea = au.length; | ||
5182 | while (ea--) { | ||
5183 | de(au[ea]) | ||
5184 | } | ||
5185 | cQ.onExit() | ||
5186 | }; | ||
5187 | cW.cursor = function() { | ||
5188 | if (arguments.length > 1 || arguments.length === 1 && arguments[0] instanceof cW.PImage) { | ||
5189 | var ed = arguments[0], | ||
5190 | ea, ef; | ||
5191 | if (arguments.length >= 3) { | ||
5192 | ea = arguments[1]; | ||
5193 | ef = arguments[2]; | ||
5194 | if (ea < 0 || ef < 0 || ef >= ed.height || ea >= ed.width) { | ||
5195 | throw "x and y must be non-negative and less than the dimensions of the image" | ||
5196 | } | ||
5197 | } else { | ||
5198 | ea = ed.width >>> 1; | ||
5199 | ef = ed.height >>> 1 | ||
5200 | } | ||
5201 | var eb = ed.toDataURL(); | ||
5202 | var ec = 'url("' + eb + '") ' + ea + " " + ef + ", default"; | ||
5203 | Z = ae.style.cursor = ec | ||
5204 | } else { | ||
5205 | if (arguments.length === 1) { | ||
5206 | var ee = arguments[0]; | ||
5207 | Z = ae.style.cursor = ee | ||
5208 | } else { | ||
5209 | Z = ae.style.cursor = ck | ||
5210 | } | ||
5211 | } | ||
5212 | }; | ||
5213 | cW.noCursor = function() { | ||
5214 | Z = ae.style.cursor = B.NOCURSOR | ||
5215 | }; | ||
5216 | cW.link = function(ea, eb) { | ||
5217 | if (eb !== t) { | ||
5218 | D.open(ea, eb) | ||
5219 | } else { | ||
5220 | D.location = ea | ||
5221 | } | ||
5222 | }; | ||
5223 | cW.beginDraw = G; | ||
5224 | cW.endDraw = G; | ||
5225 | bR.prototype.toImageData = function(ea, ed, eb, ec) { | ||
5226 | ea = ea !== t ? ea : 0; | ||
5227 | ed = ed !== t ? ed : 0; | ||
5228 | eb = eb !== t ? eb : cW.width; | ||
5229 | ec = ec !== t ? ec : cW.height; | ||
5230 | return d8.getImageData(ea, ed, eb, ec) | ||
5231 | }; | ||
5232 | bB.prototype.toImageData = function(ei, eh, ej, ee) { | ||
5233 | ei = ei !== t ? ei : 0; | ||
5234 | eh = eh !== t ? eh : 0; | ||
5235 | ej = ej !== t ? ej : cW.width; | ||
5236 | ee = ee !== t ? ee : cW.height; | ||
5237 | var eg = d.createElement("canvas"), | ||
5238 | ek = eg.getContext("2d"), | ||
5239 | ed = ek.createImageData(ej, ee), | ||
5240 | eb = new b(ej * ee * 4); | ||
5241 | d8.readPixels(ei, eh, ej, ee, d8.RGBA, d8.UNSIGNED_BYTE, eb); | ||
5242 | for (var ec = 0, ef = eb.length, ea = ed.data; ec < ef; ec++) { | ||
5243 | ea[ec] = eb[(ee - 1 - q.floor(ec / 4 / ej)) * ej * 4 + ec % (ej * 4)] | ||
5244 | } | ||
5245 | return ed | ||
5246 | }; | ||
5247 | cW.status = function(ea) { | ||
5248 | D.status = ea | ||
5249 | }; | ||
5250 | cW.binary = function(eb, ec) { | ||
5251 | var ed; | ||
5252 | if (ec > 0) { | ||
5253 | ed = ec | ||
5254 | } else { | ||
5255 | if (eb instanceof bP) { | ||
5256 | ed = 16; | ||
5257 | eb |= 0 | ||
5258 | } else { | ||
5259 | ed = 32; | ||
5260 | while (ed > 1 && !(eb >>> ed - 1 & 1)) { | ||
5261 | ed-- | ||
5262 | } | ||
5263 | } | ||
5264 | } | ||
5265 | var ea = ""; | ||
5266 | while (ed > 0) { | ||
5267 | ea += eb >>> --ed & 1 ? "1" : "0" | ||
5268 | } | ||
5269 | return ea | ||
5270 | }; | ||
5271 | cW.unbinary = function(eb) { | ||
5272 | var ed = eb.length - 1, | ||
5273 | ec = 1, | ||
5274 | ea = 0; | ||
5275 | while (ed >= 0) { | ||
5276 | var ee = eb[ed--]; | ||
5277 | if (ee !== "0" && ee !== "1") { | ||
5278 | throw "the value passed into unbinary was not an 8 bit binary number" | ||
5279 | } | ||
5280 | if (ee === "1") { | ||
5281 | ea += ec | ||
5282 | } | ||
5283 | ec <<= 1 | ||
5284 | } | ||
5285 | return ea | ||
5286 | }; | ||
5287 | |||
5288 | function cX(em, ek, ee, ep, eg, en) { | ||
5289 | var ec = em < 0 ? ee : ek; | ||
5290 | var eb = eg === 0; | ||
5291 | var el = eg === t || eg < 0 ? 0 : eg; | ||
5292 | var ej = q.abs(em); | ||
5293 | if (eb) { | ||
5294 | el = 1; | ||
5295 | ej *= 10; | ||
5296 | while (q.abs(q.round(ej) - ej) > 0.000001 && el < 7) { | ||
5297 | ++el; | ||
5298 | ej *= 10 | ||
5299 | } | ||
5300 | } else { | ||
5301 | if (el !== 0) { | ||
5302 | ej *= q.pow(10, el) | ||
5303 | } | ||
5304 | } | ||
5305 | var ed, ei = ej * 2; | ||
5306 | if (q.floor(ej) === ej) { | ||
5307 | ed = ej | ||
5308 | } else { | ||
5309 | if (q.floor(ei) === ei) { | ||
5310 | var ea = q.floor(ej); | ||
5311 | ed = ea + ea % 2 | ||
5312 | } else { | ||
5313 | ed = q.round(ej) | ||
5314 | } | ||
5315 | } | ||
5316 | var ef = ""; | ||
5317 | var eo = ep + el; | ||
5318 | while (eo > 0 || ed > 0) { | ||
5319 | eo--; | ||
5320 | ef = "" + ed % 10 + ef; | ||
5321 | ed = q.floor(ed / 10) | ||
5322 | } | ||
5323 | if (en !== t) { | ||
5324 | var eh = ef.length - 3 - el; | ||
5325 | while (eh > 0) { | ||
5326 | ef = ef.substring(0, eh) + en + ef.substring(eh); | ||
5327 | eh -= 3 | ||
5328 | } | ||
5329 | } | ||
5330 | if (el > 0) { | ||
5331 | return ec + ef.substring(0, ef.length - el) + "." + ef.substring(ef.length - el, ef.length) | ||
5332 | } | ||
5333 | return ec + ef | ||
5334 | } | ||
5335 | |||
5336 | function ao(eg, ef, ea, ei, eb, eh) { | ||
5337 | if (eg instanceof Array) { | ||
5338 | var ed = []; | ||
5339 | for (var ec = 0, ee = eg.length; ec < ee; ec++) { | ||
5340 | ed.push(cX(eg[ec], ef, ea, ei, eb, eh)) | ||
5341 | } | ||
5342 | return ed | ||
5343 | } | ||
5344 | return cX(eg, ef, ea, ei, eb, eh) | ||
5345 | } | ||
5346 | cW.nf = function(ec, ea, eb) { | ||
5347 | return ao(ec, "", "-", ea, eb) | ||
5348 | }; | ||
5349 | cW.nfs = function(ec, ea, eb) { | ||
5350 | return ao(ec, " ", "-", ea, eb) | ||
5351 | }; | ||
5352 | cW.nfp = function(ec, ea, eb) { | ||
5353 | return ao(ec, "+", "-", ea, eb) | ||
5354 | }; | ||
5355 | cW.nfc = function(ec, ea, eb) { | ||
5356 | return ao(ec, "", "-", ea, eb, ",") | ||
5357 | }; | ||
5358 | var aM = function(ec, eb) { | ||
5359 | eb = eb === t || eb === null ? eb = 8 : eb; | ||
5360 | if (ec < 0) { | ||
5361 | ec = 4294967295 + ec + 1 | ||
5362 | } | ||
5363 | var ea = Number(ec).toString(16).toUpperCase(); | ||
5364 | while (ea.length < eb) { | ||
5365 | ea = "0" + ea | ||
5366 | } | ||
5367 | if (ea.length >= eb) { | ||
5368 | ea = ea.substring(ea.length - eb, ea.length) | ||
5369 | } | ||
5370 | return ea | ||
5371 | }; | ||
5372 | cW.hex = function(eb, ea) { | ||
5373 | if (arguments.length === 1) { | ||
5374 | if (eb instanceof bP) { | ||
5375 | ea = 4 | ||
5376 | } else { | ||
5377 | ea = 8 | ||
5378 | } | ||
5379 | } | ||
5380 | return aM(eb, ea) | ||
5381 | }; | ||
5382 | |||
5383 | function dF(ea) { | ||
5384 | var eb = parseInt("0x" + ea, 16); | ||
5385 | if (eb > 2147483647) { | ||
5386 | eb -= 4294967296 | ||
5387 | } | ||
5388 | return eb | ||
5389 | } | ||
5390 | cW.unhex = function(ec) { | ||
5391 | if (ec instanceof Array) { | ||
5392 | var ea = []; | ||
5393 | for (var eb = 0; eb < ec.length; eb++) { | ||
5394 | ea.push(dF(ec[eb])) | ||
5395 | } | ||
5396 | return ea | ||
5397 | } | ||
5398 | return dF(ec) | ||
5399 | }; | ||
5400 | cW.loadStrings = function(eb) { | ||
5401 | if (localStorage[eb]) { | ||
5402 | return localStorage[eb].split("\n") | ||
5403 | } | ||
5404 | var ea = w(eb); | ||
5405 | if (typeof ea !== "string" || ea === "") { | ||
5406 | return [] | ||
5407 | } | ||
5408 | ea = ea.replace(/(\r\n?)/g, "\n").replace(/\n$/, ""); | ||
5409 | return ea.split("\n") | ||
5410 | }; | ||
5411 | cW.saveStrings = function(eb, ea) { | ||
5412 | localStorage[eb] = ea.join("\n") | ||
5413 | }; | ||
5414 | cW.loadBytes = function(ec) { | ||
5415 | var eb = w(ec); | ||
5416 | var ea = []; | ||
5417 | for (var ed = 0; ed < eb.length; ed++) { | ||
5418 | ea.push(eb.charCodeAt(ed)) | ||
5419 | } | ||
5420 | return ea | ||
5421 | }; | ||
5422 | |||
5423 | function bc(ea) { | ||
5424 | return Array.prototype.slice.call(ea, 1) | ||
5425 | } | ||
5426 | cW.matchAll = function(eb, ea) { | ||
5427 | var ed = [], | ||
5428 | ec; | ||
5429 | var ee = new RegExp(ea, "g"); | ||
5430 | while ((ec = ee.exec(eb)) !== null) { | ||
5431 | ed.push(ec); | ||
5432 | if (ec[0].length === 0) { | ||
5433 | ++ee.lastIndex | ||
5434 | } | ||
5435 | } | ||
5436 | return ed.length > 0 ? ed : null | ||
5437 | }; | ||
5438 | cW.__contains = function(eb, ea) { | ||
5439 | if (typeof eb !== "string") { | ||
5440 | return eb.contains.apply(eb, bc(arguments)) | ||
5441 | } | ||
5442 | return eb !== null && ea !== null && typeof ea === "string" && eb.indexOf(ea) > -1 | ||
5443 | }; | ||
5444 | cW.__replaceAll = function(ea, ec, eb) { | ||
5445 | if (typeof ea !== "string") { | ||
5446 | return ea.replaceAll.apply(ea, bc(arguments)) | ||
5447 | } | ||
5448 | return ea.replace(new RegExp(ec, "g"), eb) | ||
5449 | }; | ||
5450 | cW.__replaceFirst = function(ea, ec, eb) { | ||
5451 | if (typeof ea !== "string") { | ||
5452 | return ea.replaceFirst.apply(ea, bc(arguments)) | ||
5453 | } | ||
5454 | return ea.replace(new RegExp(ec, ""), eb) | ||
5455 | }; | ||
5456 | cW.__replace = function(ed, ef, ee) { | ||
5457 | if (typeof ed !== "string") { | ||
5458 | return ed.replace.apply(ed, bc(arguments)) | ||
5459 | } | ||
5460 | if (ef instanceof RegExp) { | ||
5461 | return ed.replace(ef, ee) | ||
5462 | } | ||
5463 | if (typeof ef !== "string") { | ||
5464 | ef = ef.toString() | ||
5465 | } | ||
5466 | if (ef === "") { | ||
5467 | return ed | ||
5468 | } | ||
5469 | var ec = ed.indexOf(ef); | ||
5470 | if (ec < 0) { | ||
5471 | return ed | ||
5472 | } | ||
5473 | var eb = 0, | ||
5474 | ea = ""; | ||
5475 | do { | ||
5476 | ea += ed.substring(eb, ec) + ee; | ||
5477 | eb = ec + ef.length | ||
5478 | } while ((ec = ed.indexOf(ef, eb)) >= 0); | ||
5479 | return ea + ed.substring(eb) | ||
5480 | }; | ||
5481 | cW.__equals = function(eb, ea) { | ||
5482 | if (eb.equals instanceof Function) { | ||
5483 | return eb.equals.apply(eb, bc(arguments)) | ||
5484 | } | ||
5485 | return eb.valueOf() === ea.valueOf() | ||
5486 | }; | ||
5487 | cW.__equalsIgnoreCase = function(eb, ea) { | ||
5488 | if (typeof eb !== "string") { | ||
5489 | return eb.equalsIgnoreCase.apply(eb, bc(arguments)) | ||
5490 | } | ||
5491 | return eb.toLowerCase() === ea.toLowerCase() | ||
5492 | }; | ||
5493 | cW.__toCharArray = function(ec) { | ||
5494 | if (typeof ec !== "string") { | ||
5495 | return ec.toCharArray.apply(ec, bc(arguments)) | ||
5496 | } | ||
5497 | var ed = []; | ||
5498 | for (var eb = 0, ea = ec.length; eb < ea; ++eb) { | ||
5499 | ed[eb] = new bP(ec.charAt(eb)) | ||
5500 | } | ||
5501 | return ed | ||
5502 | }; | ||
5503 | cW.__split = function(ed, ee, eb) { | ||
5504 | if (typeof ed !== "string") { | ||
5505 | return ed.split.apply(ed, bc(arguments)) | ||
5506 | } | ||
5507 | var eg = new RegExp(ee); | ||
5508 | if (eb === t || eb < 1) { | ||
5509 | return ed.split(eg) | ||
5510 | } | ||
5511 | var ea = [], | ||
5512 | ef = ed, | ||
5513 | eh; | ||
5514 | while ((eh = ef.search(eg)) !== -1 && ea.length < eb - 1) { | ||
5515 | var ec = eg.exec(ef).toString(); | ||
5516 | ea.push(ef.substring(0, eh)); | ||
5517 | ef = ef.substring(eh + ec.length) | ||
5518 | } | ||
5519 | if (eh !== -1 || ef !== "") { | ||
5520 | ea.push(ef) | ||
5521 | } | ||
5522 | return ea | ||
5523 | }; | ||
5524 | cW.__codePointAt = function(ed, eb) { | ||
5525 | var ee = ed.charCodeAt(eb), | ||
5526 | ec, ea; | ||
5527 | if (55296 <= ee && ee <= 56319) { | ||
5528 | ec = ee; | ||
5529 | ea = ed.charCodeAt(eb + 1); | ||
5530 | return (ec - 55296) * 1024 + (ea - 56320) + 65536 | ||
5531 | } | ||
5532 | return ee | ||
5533 | }; | ||
5534 | cW.match = function(eb, ea) { | ||
5535 | return eb.match(ea) | ||
5536 | }; | ||
5537 | cW.__matches = function(eb, ea) { | ||
5538 | return (new RegExp(ea)).test(eb) | ||
5539 | }; | ||
5540 | cW.__startsWith = function(ea, ec, eb) { | ||
5541 | if (typeof ea !== "string") { | ||
5542 | return ea.startsWith.apply(ea, bc(arguments)) | ||
5543 | } | ||
5544 | eb = eb || 0; | ||
5545 | if (eb < 0 || eb > ea.length) { | ||
5546 | return false | ||
5547 | } | ||
5548 | return ec === "" || ec === ea ? true : ea.indexOf(ec) === eb | ||
5549 | }; | ||
5550 | cW.__endsWith = function(eb, ec) { | ||
5551 | if (typeof eb !== "string") { | ||
5552 | return eb.endsWith.apply(eb, bc(arguments)) | ||
5553 | } | ||
5554 | var ea = ec ? ec.length : 0; | ||
5555 | return ec === "" || ec === eb ? true : eb.indexOf(ec) === eb.length - ea | ||
5556 | }; | ||
5557 | cW.__hashCode = function(ea) { | ||
5558 | if (ea.hashCode instanceof Function) { | ||
5559 | return ea.hashCode.apply(ea, bc(arguments)) | ||
5560 | } | ||
5561 | return h(ea) | ||
5562 | }; | ||
5563 | cW.__printStackTrace = function(ea) { | ||
5564 | cW.println("Exception: " + ea.toString()) | ||
5565 | }; | ||
5566 | var d9 = []; | ||
5567 | cW.println = function(ea) { | ||
5568 | var eb = d9.length; | ||
5569 | if (eb) { | ||
5570 | F.logger.log(d9.join("")); | ||
5571 | d9.length = 0 | ||
5572 | } | ||
5573 | if (arguments.length === 0 && eb === 0) { | ||
5574 | F.logger.log("") | ||
5575 | } else { | ||
5576 | if (arguments.length !== 0) { | ||
5577 | F.logger.log(ea) | ||
5578 | } | ||
5579 | } | ||
5580 | }; | ||
5581 | cW.print = function(ea) { | ||
5582 | d9.push(ea) | ||
5583 | }; | ||
5584 | cW.str = function(ec) { | ||
5585 | if (ec instanceof Array) { | ||
5586 | var ea = []; | ||
5587 | for (var eb = 0; eb < ec.length; eb++) { | ||
5588 | ea.push(ec[eb].toString() + "") | ||
5589 | } | ||
5590 | return ea | ||
5591 | } | ||
5592 | return ec.toString() + "" | ||
5593 | }; | ||
5594 | cW.trim = function(ec) { | ||
5595 | if (ec instanceof Array) { | ||
5596 | var ea = []; | ||
5597 | for (var eb = 0; eb < ec.length; eb++) { | ||
5598 | ea.push(ec[eb].replace(/^\s*/, "").replace(/\s*$/, "").replace(/\r*$/, "")) | ||
5599 | } | ||
5600 | return ea | ||
5601 | } | ||
5602 | return ec.replace(/^\s*/, "").replace(/\s*$/, "").replace(/\r*$/, "") | ||
5603 | }; | ||
5604 | |||
5605 | function aR(ea) { | ||
5606 | if (typeof ea === "number") { | ||
5607 | return ea !== 0 | ||
5608 | } | ||
5609 | if (typeof ea === "boolean") { | ||
5610 | return ea | ||
5611 | } | ||
5612 | if (typeof ea === "string") { | ||
5613 | return ea.toLowerCase() === "true" | ||
5614 | } | ||
5615 | if (ea instanceof bP) { | ||
5616 | return ea.code === 49 || ea.code === 84 || ea.code === 116 | ||
5617 | } | ||
5618 | } | ||
5619 | cW.parseBoolean = function(ec) { | ||
5620 | if (ec instanceof Array) { | ||
5621 | var ea = []; | ||
5622 | for (var eb = 0; eb < ec.length; eb++) { | ||
5623 | ea.push(aR(ec[eb])) | ||
5624 | } | ||
5625 | return ea | ||
5626 | } | ||
5627 | return aR(ec) | ||
5628 | }; | ||
5629 | cW.parseByte = function(ec) { | ||
5630 | if (ec instanceof Array) { | ||
5631 | var ea = []; | ||
5632 | for (var eb = 0; eb < ec.length; eb++) { | ||
5633 | ea.push(0 - (ec[eb] & 128) | ec[eb] & 127) | ||
5634 | } | ||
5635 | return ea | ||
5636 | } | ||
5637 | return 0 - (ec & 128) | ec & 127 | ||
5638 | }; | ||
5639 | cW.parseChar = function(ec) { | ||
5640 | if (typeof ec === "number") { | ||
5641 | return new bP(String.fromCharCode(ec & 65535)) | ||
5642 | } | ||
5643 | if (ec instanceof Array) { | ||
5644 | var ea = []; | ||
5645 | for (var eb = 0; eb < ec.length; eb++) { | ||
5646 | ea.push(new bP(String.fromCharCode(ec[eb] & 65535))) | ||
5647 | } | ||
5648 | return ea | ||
5649 | } | ||
5650 | throw "char() may receive only one argument of type int, byte, int[], or byte[]." | ||
5651 | }; | ||
5652 | |||
5653 | function cO(ea) { | ||
5654 | if (typeof ea === "number") { | ||
5655 | return ea | ||
5656 | } | ||
5657 | if (typeof ea === "boolean") { | ||
5658 | return ea ? 1 : 0 | ||
5659 | } | ||
5660 | if (typeof ea === "string") { | ||
5661 | return parseFloat(ea) | ||
5662 | } | ||
5663 | if (ea instanceof bP) { | ||
5664 | return ea.code | ||
5665 | } | ||
5666 | } | ||
5667 | cW.parseFloat = function(ec) { | ||
5668 | if (ec instanceof Array) { | ||
5669 | var ea = []; | ||
5670 | for (var eb = 0; eb < ec.length; eb++) { | ||
5671 | ea.push(cO(ec[eb])) | ||
5672 | } | ||
5673 | return ea | ||
5674 | } | ||
5675 | return cO(ec) | ||
5676 | }; | ||
5677 | |||
5678 | function al(ec, ea) { | ||
5679 | if (typeof ec === "number") { | ||
5680 | return ec & 4294967295 | ||
5681 | } | ||
5682 | if (typeof ec === "boolean") { | ||
5683 | return ec ? 1 : 0 | ||
5684 | } | ||
5685 | if (typeof ec === "string") { | ||
5686 | var eb = parseInt(ec, ea || 10); | ||
5687 | return eb & 4294967295 | ||
5688 | } | ||
5689 | if (ec instanceof bP) { | ||
5690 | return ec.code | ||
5691 | } | ||
5692 | } | ||
5693 | cW.parseInt = function(ed, ec) { | ||
5694 | if (ed instanceof Array) { | ||
5695 | var ea = []; | ||
5696 | for (var eb = 0; eb < ed.length; eb++) { | ||
5697 | if (typeof ed[eb] === "string" && !/^\s*[+\-]?\d+\s*$/.test(ed[eb])) { | ||
5698 | ea.push(0) | ||
5699 | } else { | ||
5700 | ea.push(al(ed[eb], ec)) | ||
5701 | } | ||
5702 | } | ||
5703 | return ea | ||
5704 | } | ||
5705 | return al(ed, ec) | ||
5706 | }; | ||
5707 | cW.__int_cast = function(ea) { | ||
5708 | return 0 | ea | ||
5709 | }; | ||
5710 | cW.__instanceof = function(ec, eb) { | ||
5711 | if (typeof eb !== "function") { | ||
5712 | throw "Function is expected as type argument for instanceof operator" | ||
5713 | } | ||
5714 | if (typeof ec === "string") { | ||
5715 | return eb === Object || eb === String | ||
5716 | } | ||
5717 | if (ec instanceof eb) { | ||
5718 | return true | ||
5719 | } | ||
5720 | if (typeof ec !== "object" || ec === null) { | ||
5721 | return false | ||
5722 | } | ||
5723 | var ee = ec.constructor; | ||
5724 | if (eb.$isInterface) { | ||
5725 | var ed = []; | ||
5726 | while (ee) { | ||
5727 | if (ee.$interfaces) { | ||
5728 | ed = ed.concat(ee.$interfaces) | ||
5729 | } | ||
5730 | ee = ee.$base | ||
5731 | } | ||
5732 | while (ed.length > 0) { | ||
5733 | var ea = ed.shift(); | ||
5734 | if (ea === eb) { | ||
5735 | return true | ||
5736 | } | ||
5737 | if (ea.$interfaces) { | ||
5738 | ed = ed.concat(ea.$interfaces) | ||
5739 | } | ||
5740 | } | ||
5741 | return false | ||
5742 | } | ||
5743 | while (ee.hasOwnProperty("$base")) { | ||
5744 | ee = ee.$base; | ||
5745 | if (ee === eb) { | ||
5746 | return true | ||
5747 | } | ||
5748 | } | ||
5749 | return false | ||
5750 | }; | ||
5751 | cW.abs = q.abs; | ||
5752 | cW.ceil = q.ceil; | ||
5753 | cW.constrain = function(eb, ec, ea) { | ||
5754 | return eb > ea ? ea : eb < ec ? ec : eb | ||
5755 | }; | ||
5756 | cW.dist = function() { | ||
5757 | var ec, eb, ea; | ||
5758 | if (arguments.length === 4) { | ||
5759 | ec = arguments[0] - arguments[2]; | ||
5760 | eb = arguments[1] - arguments[3]; | ||
5761 | return q.sqrt(ec * ec + eb * eb) | ||
5762 | } | ||
5763 | if (arguments.length === 6) { | ||
5764 | ec = arguments[0] - arguments[3]; | ||
5765 | eb = arguments[1] - arguments[4]; | ||
5766 | ea = arguments[2] - arguments[5]; | ||
5767 | return q.sqrt(ec * ec + eb * eb + ea * ea) | ||
5768 | } | ||
5769 | }; | ||
5770 | cW.exp = q.exp; | ||
5771 | cW.floor = q.floor; | ||
5772 | cW.lerp = function(eb, ea, ec) { | ||
5773 | return (ea - eb) * ec + eb | ||
5774 | }; | ||
5775 | cW.log = q.log; | ||
5776 | cW.mag = function(eb, ea, ec) { | ||
5777 | if (ec) { | ||
5778 | return q.sqrt(eb * eb + ea * ea + ec * ec) | ||
5779 | } | ||
5780 | return q.sqrt(eb * eb + ea * ea) | ||
5781 | }; | ||
5782 | cW.map = function(ed, eb, ec, ea, ee) { | ||
5783 | return ea + (ee - ea) * ((ed - eb) / (ec - eb)) | ||
5784 | }; | ||
5785 | cW.max = function() { | ||
5786 | if (arguments.length === 2) { | ||
5787 | return arguments[0] < arguments[1] ? arguments[1] : arguments[0] | ||
5788 | } | ||
5789 | var eb = arguments.length === 1 ? arguments[0] : arguments; | ||
5790 | if (!("length" in eb && eb.length > 0)) { | ||
5791 | throw "Non-empty array is expected" | ||
5792 | } | ||
5793 | var ea = eb[0], | ||
5794 | ed = eb.length; | ||
5795 | for (var ec = 1; ec < ed; ++ec) { | ||
5796 | if (ea < eb[ec]) { | ||
5797 | ea = eb[ec] | ||
5798 | } | ||
5799 | } | ||
5800 | return ea | ||
5801 | }; | ||
5802 | cW.min = function() { | ||
5803 | if (arguments.length === 2) { | ||
5804 | return arguments[0] < arguments[1] ? arguments[0] : arguments[1] | ||
5805 | } | ||
5806 | var ea = arguments.length === 1 ? arguments[0] : arguments; | ||
5807 | if (!("length" in ea && ea.length > 0)) { | ||
5808 | throw "Non-empty array is expected" | ||
5809 | } | ||
5810 | var ec = ea[0], | ||
5811 | ed = ea.length; | ||
5812 | for (var eb = 1; eb < ed; ++eb) { | ||
5813 | if (ec > ea[eb]) { | ||
5814 | ec = ea[eb] | ||
5815 | } | ||
5816 | } | ||
5817 | return ec | ||
5818 | }; | ||
5819 | cW.norm = function(eb, ea, ec) { | ||
5820 | return (eb - ea) / (ec - ea) | ||
5821 | }; | ||
5822 | cW.pow = q.pow; | ||
5823 | cW.round = q.round; | ||
5824 | cW.sq = function(ea) { | ||
5825 | return ea * ea | ||
5826 | }; | ||
5827 | cW.sqrt = q.sqrt; | ||
5828 | cW.acos = q.acos; | ||
5829 | cW.asin = q.asin; | ||
5830 | cW.atan = q.atan; | ||
5831 | cW.atan2 = q.atan2; | ||
5832 | cW.cos = q.cos; | ||
5833 | cW.degrees = function(ea) { | ||
5834 | return ea * 180 / q.PI | ||
5835 | }; | ||
5836 | cW.radians = function(ea) { | ||
5837 | return ea / 180 * q.PI | ||
5838 | }; | ||
5839 | cW.sin = q.sin; | ||
5840 | cW.tan = q.tan; | ||
5841 | var bY = q.random; | ||
5842 | cW.random = function() { | ||
5843 | if (arguments.length === 0) { | ||
5844 | return bY() | ||
5845 | } | ||
5846 | if (arguments.length === 1) { | ||
5847 | return bY() * arguments[0] | ||
5848 | } | ||
5849 | var eb = arguments[0], | ||
5850 | ea = arguments[1]; | ||
5851 | return bY() * (ea - eb) + eb | ||
5852 | }; | ||
5853 | |||
5854 | function co(ec, eb) { | ||
5855 | var ee = ec || 362436069, | ||
5856 | ea = eb || 521288629; | ||
5857 | var ed = function() { | ||
5858 | ee = 36969 * (ee & 65535) + (ee >>> 16) & 4294967295; | ||
5859 | ea = 18000 * (ea & 65535) + (ea >>> 16) & 4294967295; | ||
5860 | return ((ee & 65535) << 16 | ea & 65535) & 4294967295 | ||
5861 | }; | ||
5862 | this.nextDouble = function() { | ||
5863 | var ef = ed() / 4294967296; | ||
5864 | return ef < 0 ? 1 + ef : ef | ||
5865 | }; | ||
5866 | this.nextInt = ed | ||
5867 | } | ||
5868 | co.createRandomized = function() { | ||
5869 | var ea = new Date; | ||
5870 | return new co(ea / 60000 & 4294967295, ea & 4294967295) | ||
5871 | }; | ||
5872 | cW.randomSeed = function(ea) { | ||
5873 | bY = (new co(ea)).nextDouble | ||
5874 | }; | ||
5875 | cW.Random = function(ea) { | ||
5876 | var ed = false, | ||
5877 | eb, ec; | ||
5878 | this.nextGaussian = function() { | ||
5879 | if (ed) { | ||
5880 | ed = false; | ||
5881 | return eb | ||
5882 | } | ||
5883 | var eh, ef, ee; | ||
5884 | do { | ||
5885 | eh = 2 * ec() - 1; | ||
5886 | ef = 2 * ec() - 1; | ||
5887 | ee = eh * eh + ef * ef | ||
5888 | } while (ee >= 1 || ee === 0); | ||
5889 | var eg = q.sqrt(-2 * q.log(ee) / ee); | ||
5890 | eb = ef * eg; | ||
5891 | ed = true; | ||
5892 | return eh * eg | ||
5893 | }; | ||
5894 | ec = ea === t ? q.random : (new co(ea)).nextDouble | ||
5895 | }; | ||
5896 | |||
5897 | function dz(eh) { | ||
5898 | var eb = eh !== t ? new co(eh) : co.createRandomized(); | ||
5899 | var eg, ee; | ||
5900 | var ed = new b(512); | ||
5901 | for (eg = 0; eg < 256; ++eg) { | ||
5902 | ed[eg] = eg | ||
5903 | } | ||
5904 | for (eg = 0; eg < 256; ++eg) { | ||
5905 | var ej = ed[ee = eb.nextInt() & 255]; | ||
5906 | ed[ee] = ed[eg]; | ||
5907 | ed[eg] = ej | ||
5908 | } | ||
5909 | for (eg = 0; eg < 256; ++eg) { | ||
5910 | ed[eg + 256] = ed[eg] | ||
5911 | } | ||
5912 | |||
5913 | function ea(en, ek, eq, ep) { | ||
5914 | var eo = en & 15; | ||
5915 | var em = eo < 8 ? ek : eq, | ||
5916 | el = eo < 4 ? eq : eo === 12 || eo === 14 ? ek : ep; | ||
5917 | return ((eo & 1) === 0 ? em : -em) + ((eo & 2) === 0 ? el : -el) | ||
5918 | } | ||
5919 | |||
5920 | function ef(em, ek, en) { | ||
5921 | var el = (em & 1) === 0 ? ek : en; | ||
5922 | return (em & 2) === 0 ? -el : el | ||
5923 | } | ||
5924 | |||
5925 | function ei(el, ek) { | ||
5926 | return (el & 1) === 0 ? -ek : ek | ||
5927 | } | ||
5928 | |||
5929 | function ec(em, el, ek) { | ||
5930 | return el + em * (ek - el) | ||
5931 | } | ||
5932 | this.noise3d = function(ew, ev, eu) { | ||
5933 | var en = q.floor(ew) & 255, | ||
5934 | el = q.floor(ev) & 255, | ||
5935 | ek = q.floor(eu) & 255; | ||
5936 | ew -= q.floor(ew); | ||
5937 | ev -= q.floor(ev); | ||
5938 | eu -= q.floor(eu); | ||
5939 | var er = (3 - 2 * ew) * ew * ew, | ||
5940 | eq = (3 - 2 * ev) * ev * ev, | ||
5941 | ep = (3 - 2 * eu) * eu * eu; | ||
5942 | var ey = ed[en] + el, | ||
5943 | et = ed[ey] + ek, | ||
5944 | es = ed[ey + 1] + ek, | ||
5945 | ex = ed[en + 1] + el, | ||
5946 | eo = ed[ex] + ek, | ||
5947 | em = ed[ex + 1] + ek; | ||
5948 | return ec(ep, ec(eq, ec(er, ea(ed[et], ew, ev, eu), ea(ed[eo], ew - 1, ev, eu)), ec(er, ea(ed[es], ew, ev - 1, eu), ea(ed[em], ew - 1, ev - 1, eu))), ec(eq, ec(er, ea(ed[et + 1], ew, ev, eu - 1), ea(ed[eo + 1], ew - 1, ev, eu - 1)), ec(er, ea(ed[es + 1], ew, ev - 1, eu - 1), ea(ed[em + 1], ew - 1, ev - 1, eu - 1)))) | ||
5949 | }; | ||
5950 | this.noise2d = function(ek, er) { | ||
5951 | var eq = q.floor(ek) & 255, | ||
5952 | eo = q.floor(er) & 255; | ||
5953 | ek -= q.floor(ek); | ||
5954 | er -= q.floor(er); | ||
5955 | var em = (3 - 2 * ek) * ek * ek, | ||
5956 | el = (3 - 2 * er) * er * er; | ||
5957 | var ep = ed[eq] + eo, | ||
5958 | en = ed[eq + 1] + eo; | ||
5959 | return ec(el, ec(em, ef(ed[ep], ek, er), ef(ed[en], ek - 1, er)), ec(em, ef(ed[ep + 1], ek, er - 1), ef(ed[en + 1], ek - 1, er - 1))) | ||
5960 | }; | ||
5961 | this.noise1d = function(ek) { | ||
5962 | var em = q.floor(ek) & 255; | ||
5963 | ek -= q.floor(ek); | ||
5964 | var el = (3 - 2 * ek) * ek * ek; | ||
5965 | return ec(el, ei(ed[em], ek), ei(ed[em + 1], ek - 1)) | ||
5966 | } | ||
5967 | } | ||
5968 | var bW = { | ||
5969 | generator: t, | ||
5970 | octaves: 4, | ||
5971 | fallout: 0.5, | ||
5972 | seed: t | ||
5973 | }; | ||
5974 | cW.noise = function(ea, eh, eg) { | ||
5975 | if (bW.generator === t) { | ||
5976 | bW.generator = new dz(bW.seed) | ||
5977 | } | ||
5978 | var ef = bW.generator; | ||
5979 | var ee = 1, | ||
5980 | eb = 1, | ||
5981 | ed = 0; | ||
5982 | for (var ec = 0; ec < bW.octaves; ++ec) { | ||
5983 | ee *= bW.fallout; | ||
5984 | switch (arguments.length) { | ||
5985 | case 1: | ||
5986 | ed += ee * (1 + ef.noise1d(eb * ea)) / 2; | ||
5987 | break; | ||
5988 | case 2: | ||
5989 | ed += ee * (1 + ef.noise2d(eb * ea, eb * eh)) / 2; | ||
5990 | break; | ||
5991 | case 3: | ||
5992 | ed += ee * (1 + ef.noise3d(eb * ea, eb * eh, eb * eg)) / 2; | ||
5993 | break | ||
5994 | } | ||
5995 | eb *= 2 | ||
5996 | } | ||
5997 | return ed | ||
5998 | }; | ||
5999 | cW.noiseDetail = function(eb, ea) { | ||
6000 | bW.octaves = eb; | ||
6001 | if (ea !== t) { | ||
6002 | bW.fallout = ea | ||
6003 | } | ||
6004 | }; | ||
6005 | cW.noiseSeed = function(ea) { | ||
6006 | bW.seed = ea; | ||
6007 | bW.generator = t | ||
6008 | }; | ||
6009 | ds.prototype.size = function(eb, ee, ed) { | ||
6010 | if (ce) { | ||
6011 | cW.stroke(0) | ||
6012 | } | ||
6013 | if (aH) { | ||
6014 | cW.fill(255) | ||
6015 | } | ||
6016 | var ec = { | ||
6017 | fillStyle: d8.fillStyle, | ||
6018 | strokeStyle: d8.strokeStyle, | ||
6019 | lineCap: d8.lineCap, | ||
6020 | lineJoin: d8.lineJoin | ||
6021 | }; | ||
6022 | if (ae.style.length > 0) { | ||
6023 | ae.style.removeProperty("width"); | ||
6024 | ae.style.removeProperty("height") | ||
6025 | } | ||
6026 | ae.width = cW.width = eb || 100; | ||
6027 | ae.height = cW.height = ee || 100; | ||
6028 | for (var ef in ec) { | ||
6029 | if (ec.hasOwnProperty(ef)) { | ||
6030 | d8[ef] = ec[ef] | ||
6031 | } | ||
6032 | } | ||
6033 | cW.textFont(W); | ||
6034 | cW.background(); | ||
6035 | bZ = q.max(1000, eb * ee * 0.05); | ||
6036 | cW.externals.context = d8; | ||
6037 | for (var ea = 0; ea < 720; ea++) { | ||
6038 | ah[ea] = cW.sin(ea * (q.PI / 180) * 0.5); | ||
6039 | bl[ea] = cW.cos(ea * (q.PI / 180) * 0.5) | ||
6040 | } | ||
6041 | }; | ||
6042 | bR.prototype.size = function(ea, ec, eb) { | ||
6043 | if (d8 === t) { | ||
6044 | d8 = ae.getContext("2d"); | ||
6045 | am = new V; | ||
6046 | da = new V; | ||
6047 | dJ = new aX; | ||
6048 | aT = new aX | ||
6049 | } | ||
6050 | ds.prototype.size.apply(this, arguments) | ||
6051 | }; | ||
6052 | bB.prototype.size = function() { | ||
6053 | var eb = false; | ||
6054 | return function ea(ed, ef, ee) { | ||
6055 | if (eb) { | ||
6056 | throw "Multiple calls to size() for 3D renders are not allowed." | ||
6057 | } | ||
6058 | eb = true; | ||
6059 | |||
6060 | function eg(ei) { | ||
6061 | var el = ["experimental-webgl", "webgl", "webkit-3d"], | ||
6062 | ek; | ||
6063 | for (var ej = 0, eh = el.length; ej < eh; ej++) { | ||
6064 | ek = ei.getContext(el[ej], { | ||
6065 | antialias: false, | ||
6066 | preserveDrawingBuffer: true | ||
6067 | }); | ||
6068 | if (ek) { | ||
6069 | break | ||
6070 | } | ||
6071 | } | ||
6072 | return ek | ||
6073 | } | ||
6074 | try { | ||
6075 | ae.width = cW.width = ed || 100; | ||
6076 | ae.height = cW.height = ef || 100; | ||
6077 | d8 = eg(ae); | ||
6078 | c7 = d8.createTexture(); | ||
6079 | bS = d8.createTexture() | ||
6080 | } catch (ec) { | ||
6081 | F.debug(ec) | ||
6082 | } | ||
6083 | if (!d8) { | ||
6084 | throw "WebGL context is not supported on this browser." | ||
6085 | } | ||
6086 | d8.viewport(0, 0, ae.width, ae.height); | ||
6087 | d8.enable(d8.DEPTH_TEST); | ||
6088 | d8.enable(d8.BLEND); | ||
6089 | d8.blendFunc(d8.SRC_ALPHA, d8.ONE_MINUS_SRC_ALPHA); | ||
6090 | dQ = bF(d8, dE, aW); | ||
6091 | bT = bF(d8, aO, bQ); | ||
6092 | cW.strokeWeight(1); | ||
6093 | dx = bF(d8, dn, aF); | ||
6094 | d8.useProgram(dx); | ||
6095 | dZ("usingTexture3d", dx, "usingTexture", dT); | ||
6096 | cW.lightFalloff(1, 0, 0); | ||
6097 | cW.shininess(1); | ||
6098 | cW.ambient(255, 255, 255); | ||
6099 | cW.specular(0, 0, 0); | ||
6100 | cW.emissive(0, 0, 0); | ||
6101 | bh = d8.createBuffer(); | ||
6102 | d8.bindBuffer(d8.ARRAY_BUFFER, bh); | ||
6103 | d8.bufferData(d8.ARRAY_BUFFER, dh, d8.STATIC_DRAW); | ||
6104 | cJ = d8.createBuffer(); | ||
6105 | d8.bindBuffer(d8.ARRAY_BUFFER, cJ); | ||
6106 | d8.bufferData(d8.ARRAY_BUFFER, df, d8.STATIC_DRAW); | ||
6107 | dk = d8.createBuffer(); | ||
6108 | d8.bindBuffer(d8.ARRAY_BUFFER, dk); | ||
6109 | d8.bufferData(d8.ARRAY_BUFFER, bH, d8.STATIC_DRAW); | ||
6110 | aB = d8.createBuffer(); | ||
6111 | d8.bindBuffer(d8.ARRAY_BUFFER, aB); | ||
6112 | d8.bufferData(d8.ARRAY_BUFFER, ak, d8.STATIC_DRAW); | ||
6113 | b2 = d8.createBuffer(); | ||
6114 | d8.bindBuffer(d8.ARRAY_BUFFER, b2); | ||
6115 | d8.bufferData(d8.ARRAY_BUFFER, ai, d8.STATIC_DRAW); | ||
6116 | bg = d8.createBuffer(); | ||
6117 | b8 = d8.createBuffer(); | ||
6118 | at = d8.createBuffer(); | ||
6119 | aG = d8.createBuffer(); | ||
6120 | bC = d8.createBuffer(); | ||
6121 | af = d8.createBuffer(); | ||
6122 | aw = d8.createBuffer(); | ||
6123 | d8.bindBuffer(d8.ARRAY_BUFFER, aw); | ||
6124 | d8.bufferData(d8.ARRAY_BUFFER, new e([0, 0, 0]), d8.STATIC_DRAW); | ||
6125 | cH = d8.createBuffer(); | ||
6126 | d8.bindBuffer(d8.ARRAY_BUFFER, cH); | ||
6127 | d8.bufferData(d8.ARRAY_BUFFER, new e([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]), d8.STATIC_DRAW); | ||
6128 | ac = d8.createBuffer(); | ||
6129 | d8.bindBuffer(d8.ARRAY_BUFFER, ac); | ||
6130 | d8.bufferData(d8.ARRAY_BUFFER, new e([0, 0, 1, 0, 1, 1, 0, 1]), d8.STATIC_DRAW); | ||
6131 | R = d8.createBuffer(); | ||
6132 | d8.bindBuffer(d8.ELEMENT_ARRAY_BUFFER, R); | ||
6133 | d8.bufferData(d8.ELEMENT_ARRAY_BUFFER, new y([0, 1, 2, 2, 3, 0]), d8.STATIC_DRAW); | ||
6134 | bV = new aP; | ||
6135 | ch = new aP; | ||
6136 | dJ = new aP; | ||
6137 | aT = new aP; | ||
6138 | db = new aP; | ||
6139 | cW.camera(); | ||
6140 | cW.perspective(); | ||
6141 | am = new V; | ||
6142 | da = new V; | ||
6143 | c3 = new aP; | ||
6144 | aQ = new aP; | ||
6145 | aL = new aP; | ||
6146 | bz = new aP; | ||
6147 | cd = new aP; | ||
6148 | U = new aP; | ||
6149 | U.set(-1, 3, -3, 1, 3, -6, 3, 0, -3, 3, 0, 0, 1, 0, 0, 0); | ||
6150 | ds.prototype.size.apply(this, arguments) | ||
6151 | } | ||
6152 | }(); | ||
6153 | bR.prototype.ambientLight = ds.prototype.a3DOnlyFunction; | ||
6154 | bB.prototype.ambientLight = function(ea, ed, ei, ej, ef, ee) { | ||
6155 | if (dL === 8) { | ||
6156 | throw "can only create " + 8 + " lights" | ||
6157 | } | ||
6158 | var eg = new A(ej, ef, ee); | ||
6159 | var eh = new aP; | ||
6160 | eh.scale(1, -1, 1); | ||
6161 | eh.apply(dJ.array()); | ||
6162 | eh.mult(eg, eg); | ||
6163 | var eb = dH(ea, ed, ei, 0); | ||
6164 | var ec = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255]; | ||
6165 | d8.useProgram(dx); | ||
6166 | d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ec); | ||
6167 | d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", eg.array()); | ||
6168 | dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 0); | ||
6169 | dZ("uLightCount3d", dx, "uLightCount", ++dL) | ||
6170 | }; | ||
6171 | bR.prototype.directionalLight = ds.prototype.a3DOnlyFunction; | ||
6172 | bB.prototype.directionalLight = function(ea, eg, ei, eh, ef, ee) { | ||
6173 | if (dL === 8) { | ||
6174 | throw "can only create " + 8 + " lights" | ||
6175 | } | ||
6176 | d8.useProgram(dx); | ||
6177 | var ej = new aP; | ||
6178 | ej.scale(1, -1, 1); | ||
6179 | ej.apply(dJ.array()); | ||
6180 | ej = ej.array(); | ||
6181 | var ec = [ej[0] * eh + ej[4] * ef + ej[8] * ee, ej[1] * eh + ej[5] * ef + ej[9] * ee, ej[2] * eh + ej[6] * ef + ej[10] * ee]; | ||
6182 | var eb = dH(ea, eg, ei, 0); | ||
6183 | var ed = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255]; | ||
6184 | d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ed); | ||
6185 | d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", ec); | ||
6186 | dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 1); | ||
6187 | dZ("uLightCount3d", dx, "uLightCount", ++dL) | ||
6188 | }; | ||
6189 | bR.prototype.lightFalloff = ds.prototype.a3DOnlyFunction; | ||
6190 | bB.prototype.lightFalloff = function(eb, ea, ec) { | ||
6191 | d8.useProgram(dx); | ||
6192 | d2("uFalloff3d", dx, "uFalloff", [eb, ea, ec]) | ||
6193 | }; | ||
6194 | bR.prototype.lightSpecular = ds.prototype.a3DOnlyFunction; | ||
6195 | bB.prototype.lightSpecular = function(ee, ed, ea) { | ||
6196 | var eb = dH(ee, ed, ea, 0); | ||
6197 | var ec = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255]; | ||
6198 | d8.useProgram(dx); | ||
6199 | d2("uSpecular3d", dx, "uSpecular", ec) | ||
6200 | }; | ||
6201 | cW.lights = function() { | ||
6202 | cW.ambientLight(128, 128, 128); | ||
6203 | cW.directionalLight(128, 128, 128, 0, 0, -1); | ||
6204 | cW.lightFalloff(1, 0, 0); | ||
6205 | cW.lightSpecular(0, 0, 0) | ||
6206 | }; | ||
6207 | bR.prototype.pointLight = ds.prototype.a3DOnlyFunction; | ||
6208 | bB.prototype.pointLight = function(ea, ed, ei, ej, ef, ee) { | ||
6209 | if (dL === 8) { | ||
6210 | throw "can only create " + 8 + " lights" | ||
6211 | } | ||
6212 | var eg = new A(ej, ef, ee); | ||
6213 | var eh = new aP; | ||
6214 | eh.scale(1, -1, 1); | ||
6215 | eh.apply(dJ.array()); | ||
6216 | eh.mult(eg, eg); | ||
6217 | var eb = dH(ea, ed, ei, 0); | ||
6218 | var ec = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255]; | ||
6219 | d8.useProgram(dx); | ||
6220 | d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ec); | ||
6221 | d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", eg.array()); | ||
6222 | dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 2); | ||
6223 | dZ("uLightCount3d", dx, "uLightCount", ++dL) | ||
6224 | }; | ||
6225 | bR.prototype.noLights = ds.prototype.a3DOnlyFunction; | ||
6226 | bB.prototype.noLights = function() { | ||
6227 | dL = 0; | ||
6228 | d8.useProgram(dx); | ||
6229 | dZ("uLightCount3d", dx, "uLightCount", dL) | ||
6230 | }; | ||
6231 | bR.prototype.spotLight = ds.prototype.a3DOnlyFunction; | ||
6232 | bB.prototype.spotLight = function(ea, ei, en, eo, em, ek, ej, eh, ef, ee, eg) { | ||
6233 | if (dL === 8) { | ||
6234 | throw "can only create " + 8 + " lights" | ||
6235 | } | ||
6236 | d8.useProgram(dx); | ||
6237 | var el = new A(eo, em, ek); | ||
6238 | var ep = new aP; | ||
6239 | ep.scale(1, -1, 1); | ||
6240 | ep.apply(dJ.array()); | ||
6241 | ep.mult(el, el); | ||
6242 | ep = ep.array(); | ||
6243 | var ec = [ep[0] * ej + ep[4] * eh + ep[8] * ef, ep[1] * ej + ep[5] * eh + ep[9] * ef, ep[2] * ej + ep[6] * eh + ep[10] * ef]; | ||
6244 | var eb = dH(ea, ei, en, 0); | ||
6245 | var ed = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255]; | ||
6246 | d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ed); | ||
6247 | d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", el.array()); | ||
6248 | d2("uLights.direction.3d." + dL, dx, "uLights" + dL + ".direction", ec); | ||
6249 | d2("uLights.concentration.3d." + dL, dx, "uLights" + dL + ".concentration", eg); | ||
6250 | d2("uLights.angle.3d." + dL, dx, "uLights" + dL + ".angle", ee); | ||
6251 | dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 3); | ||
6252 | dZ("uLightCount3d", dx, "uLightCount", ++dL) | ||
6253 | }; | ||
6254 | bR.prototype.beginCamera = function() { | ||
6255 | throw "beginCamera() is not available in 2D mode" | ||
6256 | }; | ||
6257 | bB.prototype.beginCamera = function() { | ||
6258 | if (ap) { | ||
6259 | throw "You cannot call beginCamera() again before calling endCamera()" | ||
6260 | } | ||
6261 | ap = true; | ||
6262 | dJ = ch; | ||
6263 | aT = bV | ||
6264 | }; | ||
6265 | bR.prototype.endCamera = function() { | ||
6266 | throw "endCamera() is not available in 2D mode" | ||
6267 | }; | ||
6268 | bB.prototype.endCamera = function() { | ||
6269 | if (!ap) { | ||
6270 | throw "You cannot call endCamera() before calling beginCamera()" | ||
6271 | } | ||
6272 | dJ.set(bV); | ||
6273 | aT.set(ch); | ||
6274 | ap = false | ||
6275 | }; | ||
6276 | cW.camera = function(el, ek, ei, eg, ee, ed, et, er, ep) { | ||
6277 | if (el === t) { | ||
6278 | dl = cW.width / 2; | ||
6279 | dj = cW.height / 2; | ||
6280 | di = dj / q.tan(cK / 2); | ||
6281 | el = dl; | ||
6282 | ek = dj; | ||
6283 | ei = di; | ||
6284 | eg = dl; | ||
6285 | ee = dj; | ||
6286 | ed = 0; | ||
6287 | et = 0; | ||
6288 | er = 1; | ||
6289 | ep = 0 | ||
6290 | } | ||
6291 | var ef = new A(el - eg, ek - ee, ei - ed); | ||
6292 | var eh = new A(et, er, ep); | ||
6293 | ef.normalize(); | ||
6294 | var ej = A.cross(eh, ef); | ||
6295 | eh = A.cross(ef, ej); | ||
6296 | ej.normalize(); | ||
6297 | eh.normalize(); | ||
6298 | var eu = ej.x, | ||
6299 | es = ej.y, | ||
6300 | eq = ej.z; | ||
6301 | var ec = eh.x, | ||
6302 | eb = eh.y, | ||
6303 | ea = eh.z; | ||
6304 | var eo = ef.x, | ||
6305 | en = ef.y, | ||
6306 | em = ef.z; | ||
6307 | bV.set(eu, es, eq, 0, ec, eb, ea, 0, eo, en, em, 0, 0, 0, 0, 1); | ||
6308 | bV.translate(-el, -ek, -ei); | ||
6309 | ch.reset(); | ||
6310 | ch.invApply(eu, es, eq, 0, ec, eb, ea, 0, eo, en, em, 0, 0, 0, 0, 1); | ||
6311 | ch.translate(el, ek, ei); | ||
6312 | dJ.set(bV); | ||
6313 | aT.set(ch) | ||
6314 | }; | ||
6315 | cW.perspective = function(ee, ec, ef, eb) { | ||
6316 | if (arguments.length === 0) { | ||
6317 | dj = ae.height / 2; | ||
6318 | di = dj / q.tan(cK / 2); | ||
6319 | a0 = di / 10; | ||
6320 | av = di * 10; | ||
6321 | b5 = cW.width / cW.height; | ||
6322 | ee = cK; | ||
6323 | ec = b5; | ||
6324 | ef = a0; | ||
6325 | eb = av | ||
6326 | } | ||
6327 | var eg, ea, eh, ed; | ||
6328 | eg = ef * q.tan(ee / 2); | ||
6329 | ea = -eg; | ||
6330 | eh = eg * ec; | ||
6331 | ed = ea * ec; | ||
6332 | cW.frustum(ed, eh, ea, eg, ef, eb) | ||
6333 | }; | ||
6334 | bR.prototype.frustum = function() { | ||
6335 | throw "Processing.js: frustum() is not supported in 2D mode" | ||
6336 | }; | ||
6337 | bB.prototype.frustum = function(eg, ec, eb, ef, ee, ea) { | ||
6338 | ci = true; | ||
6339 | db = new aP; | ||
6340 | db.set(2 * ee / (ec - eg), 0, (ec + eg) / (ec - eg), 0, 0, 2 * ee / (ef - eb), (ef + eb) / (ef - eb), 0, 0, 0, -(ea + ee) / (ea - ee), -(2 * ea * ee) / (ea - ee), 0, 0, -1, 0); | ||
6341 | var ed = new aP; | ||
6342 | ed.set(db); | ||
6343 | ed.transpose(); | ||
6344 | d8.useProgram(dQ); | ||
6345 | a9("projection2d", dQ, "uProjection", false, ed.array()); | ||
6346 | d8.useProgram(dx); | ||
6347 | a9("projection3d", dx, "uProjection", false, ed.array()); | ||
6348 | d8.useProgram(bT); | ||
6349 | a9("uProjectionUS", bT, "uProjection", false, ed.array()) | ||
6350 | }; | ||
6351 | cW.ortho = function(eb, em, ea, ek, eh, eg) { | ||
6352 | if (arguments.length === 0) { | ||
6353 | eb = 0; | ||
6354 | em = cW.width; | ||
6355 | ea = 0; | ||
6356 | ek = cW.height; | ||
6357 | eh = -10; | ||
6358 | eg = 10 | ||
6359 | } | ||
6360 | var el = 2 / (em - eb); | ||
6361 | var ej = 2 / (ek - ea); | ||
6362 | var ei = -2 / (eg - eh); | ||
6363 | var ef = -(em + eb) / (em - eb); | ||
6364 | var ee = -(ek + ea) / (ek - ea); | ||
6365 | var ed = -(eg + eh) / (eg - eh); | ||
6366 | db = new aP; | ||
6367 | db.set(el, 0, 0, ef, 0, ej, 0, ee, 0, 0, ei, ed, 0, 0, 0, 1); | ||
6368 | var ec = new aP; | ||
6369 | ec.set(db); | ||
6370 | ec.transpose(); | ||
6371 | d8.useProgram(dQ); | ||
6372 | a9("projection2d", dQ, "uProjection", false, ec.array()); | ||
6373 | d8.useProgram(dx); | ||
6374 | a9("projection3d", dx, "uProjection", false, ec.array()); | ||
6375 | d8.useProgram(bT); | ||
6376 | a9("uProjectionUS", bT, "uProjection", false, ec.array()); | ||
6377 | ci = false | ||
6378 | }; | ||
6379 | cW.printProjection = function() { | ||
6380 | db.print() | ||
6381 | }; | ||
6382 | cW.printCamera = function() { | ||
6383 | bV.print() | ||
6384 | }; | ||
6385 | bR.prototype.box = ds.prototype.a3DOnlyFunction; | ||
6386 | bB.prototype.box = function(ec, ef, eh) { | ||
6387 | if (!ef || !eh) { | ||
6388 | ef = eh = ec | ||
6389 | } | ||
6390 | var ee = new aP; | ||
6391 | ee.scale(ec, ef, eh); | ||
6392 | var eb = new aP; | ||
6393 | eb.scale(1, -1, 1); | ||
6394 | eb.apply(dJ.array()); | ||
6395 | eb.transpose(); | ||
6396 | if (aH) { | ||
6397 | d8.useProgram(dx); | ||
6398 | a9("model3d", dx, "uModel", false, ee.array()); | ||
6399 | a9("view3d", dx, "uView", false, eb.array()); | ||
6400 | d8.enable(d8.POLYGON_OFFSET_FILL); | ||
6401 | d8.polygonOffset(1, 1); | ||
6402 | d2("color3d", dx, "uColor", bo); | ||
6403 | if (dL > 0) { | ||
6404 | var ed = new aP; | ||
6405 | ed.set(eb); | ||
6406 | var ea = new aP; | ||
6407 | ea.set(ee); | ||
6408 | ed.mult(ea); | ||
6409 | var eg = new aP; | ||
6410 | eg.set(ed); | ||
6411 | eg.invert(); | ||
6412 | eg.transpose(); | ||
6413 | a9("uNormalTransform3d", dx, "uNormalTransform", false, eg.array()); | ||
6414 | dc("aNormal3d", dx, "aNormal", 3, cJ) | ||
6415 | } else { | ||
6416 | cg("aNormal3d", dx, "aNormal") | ||
6417 | } | ||
6418 | dc("aVertex3d", dx, "aVertex", 3, bh); | ||
6419 | cg("aColor3d", dx, "aColor"); | ||
6420 | cg("aTexture3d", dx, "aTexture"); | ||
6421 | d8.drawArrays(d8.TRIANGLES, 0, dh.length / 3); | ||
6422 | d8.disable(d8.POLYGON_OFFSET_FILL) | ||
6423 | } | ||
6424 | if (dW > 0 && ce) { | ||
6425 | d8.useProgram(dQ); | ||
6426 | a9("uModel2d", dQ, "uModel", false, ee.array()); | ||
6427 | a9("uView2d", dQ, "uView", false, eb.array()); | ||
6428 | d2("uColor2d", dQ, "uColor", c0); | ||
6429 | dZ("uIsDrawingText2d", dQ, "uIsDrawingText", false); | ||
6430 | dc("vertex2d", dQ, "aVertex", 3, dk); | ||
6431 | cg("aTextureCoord2d", dQ, "aTextureCoord"); | ||
6432 | d8.drawArrays(d8.LINES, 0, bH.length / 3) | ||
6433 | } | ||
6434 | }; | ||
6435 | var cD = function() { | ||
6436 | var eb; | ||
6437 | cF = []; | ||
6438 | for (eb = 0; eb < bM; eb++) { | ||
6439 | cF.push(0); | ||
6440 | cF.push(-1); | ||
6441 | cF.push(0); | ||
6442 | cF.push(bt[eb]); | ||
6443 | cF.push(bs[eb]); | ||
6444 | cF.push(br[eb]) | ||
6445 | } | ||
6446 | cF.push(0); | ||
6447 | cF.push(-1); | ||
6448 | cF.push(0); | ||
6449 | cF.push(bt[0]); | ||
6450 | cF.push(bs[0]); | ||
6451 | cF.push(br[0]); | ||
6452 | var ef, ec, ee; | ||
6453 | var ed = 0; | ||
6454 | for (eb = 2; eb < bL; eb++) { | ||
6455 | ef = ec = ed; | ||
6456 | ed += bM; | ||
6457 | ee = ed; | ||
6458 | for (var ea = 0; ea < bM; ea++) { | ||
6459 | cF.push(bt[ef]); | ||
6460 | cF.push(bs[ef]); | ||
6461 | cF.push(br[ef++]); | ||
6462 | cF.push(bt[ee]); | ||
6463 | cF.push(bs[ee]); | ||
6464 | cF.push(br[ee++]) | ||
6465 | } | ||
6466 | ef = ec; | ||
6467 | ee = ed; | ||
6468 | cF.push(bt[ef]); | ||
6469 | cF.push(bs[ef]); | ||
6470 | cF.push(br[ef]); | ||
6471 | cF.push(bt[ee]); | ||
6472 | cF.push(bs[ee]); | ||
6473 | cF.push(br[ee]) | ||
6474 | } | ||
6475 | for (eb = 0; eb < bM; eb++) { | ||
6476 | ee = ed + eb; | ||
6477 | cF.push(bt[ee]); | ||
6478 | cF.push(bs[ee]); | ||
6479 | cF.push(br[ee]); | ||
6480 | cF.push(0); | ||
6481 | cF.push(1); | ||
6482 | cF.push(0) | ||
6483 | } | ||
6484 | cF.push(bt[ed]); | ||
6485 | cF.push(bs[ed]); | ||
6486 | cF.push(br[ed]); | ||
6487 | cF.push(0); | ||
6488 | cF.push(1); | ||
6489 | cF.push(0); | ||
6490 | d8.bindBuffer(d8.ARRAY_BUFFER, bg); | ||
6491 | d8.bufferData(d8.ARRAY_BUFFER, new e(cF), d8.STATIC_DRAW) | ||
6492 | }; | ||
6493 | cW.sphereDetail = function(eb, em) { | ||
6494 | var eh; | ||
6495 | if (arguments.length === 1) { | ||
6496 | eb = em = arguments[0] | ||
6497 | } | ||
6498 | if (eb < 3) { | ||
6499 | eb = 3 | ||
6500 | } | ||
6501 | if (em < 2) { | ||
6502 | em = 2 | ||
6503 | } | ||
6504 | if (eb === bM && em === bL) { | ||
6505 | return | ||
6506 | } | ||
6507 | var el = 720 / eb; | ||
6508 | var ef = new e(eb); | ||
6509 | var ec = new e(eb); | ||
6510 | for (eh = 0; eh < eb; eh++) { | ||
6511 | ef[eh] = bl[eh * el % 720 | 0]; | ||
6512 | ec[eh] = ah[eh * el % 720 | 0] | ||
6513 | } | ||
6514 | var ek = eb * (em - 1) + 2; | ||
6515 | var ej = 0; | ||
6516 | bt = new e(ek); | ||
6517 | bs = new e(ek); | ||
6518 | br = new e(ek); | ||
6519 | var ei = 720 * 0.5 / em; | ||
6520 | var ee = ei; | ||
6521 | for (eh = 1; eh < em; eh++) { | ||
6522 | var ed = ah[ee % 720 | 0]; | ||
6523 | var ea = -bl[ee % 720 | 0]; | ||
6524 | for (var eg = 0; eg < eb; eg++) { | ||
6525 | bt[ej] = ef[eg] * ed; | ||
6526 | bs[ej] = ea; | ||
6527 | br[ej++] = ec[eg] * ed | ||
6528 | } | ||
6529 | ee += ei | ||
6530 | } | ||
6531 | bM = eb; | ||
6532 | bL = em; | ||
6533 | cD() | ||
6534 | }; | ||
6535 | bR.prototype.sphere = ds.prototype.a3DOnlyFunction; | ||
6536 | bB.prototype.sphere = function() { | ||
6537 | var ee = arguments[0]; | ||
6538 | if (bM < 3 || bL < 2) { | ||
6539 | cW.sphereDetail(30) | ||
6540 | } | ||
6541 | var ed = new aP; | ||
6542 | ed.scale(ee, ee, ee); | ||
6543 | var eb = new aP; | ||
6544 | eb.scale(1, -1, 1); | ||
6545 | eb.apply(dJ.array()); | ||
6546 | eb.transpose(); | ||
6547 | if (aH) { | ||
6548 | if (dL > 0) { | ||
6549 | var ec = new aP; | ||
6550 | ec.set(eb); | ||
6551 | var ea = new aP; | ||
6552 | ea.set(ed); | ||
6553 | ec.mult(ea); | ||
6554 | var ef = new aP; | ||
6555 | ef.set(ec); | ||
6556 | ef.invert(); | ||
6557 | ef.transpose(); | ||
6558 | a9("uNormalTransform3d", dx, "uNormalTransform", false, ef.array()); | ||
6559 | dc("aNormal3d", dx, "aNormal", 3, bg) | ||
6560 | } else { | ||
6561 | cg("aNormal3d", dx, "aNormal") | ||
6562 | } | ||
6563 | d8.useProgram(dx); | ||
6564 | cg("aTexture3d", dx, "aTexture"); | ||
6565 | a9("uModel3d", dx, "uModel", false, ed.array()); | ||
6566 | a9("uView3d", dx, "uView", false, eb.array()); | ||
6567 | dc("aVertex3d", dx, "aVertex", 3, bg); | ||
6568 | cg("aColor3d", dx, "aColor"); | ||
6569 | d8.enable(d8.POLYGON_OFFSET_FILL); | ||
6570 | d8.polygonOffset(1, 1); | ||
6571 | d2("uColor3d", dx, "uColor", bo); | ||
6572 | d8.drawArrays(d8.TRIANGLE_STRIP, 0, cF.length / 3); | ||
6573 | d8.disable(d8.POLYGON_OFFSET_FILL) | ||
6574 | } | ||
6575 | if (dW > 0 && ce) { | ||
6576 | d8.useProgram(dQ); | ||
6577 | a9("uModel2d", dQ, "uModel", false, ed.array()); | ||
6578 | a9("uView2d", dQ, "uView", false, eb.array()); | ||
6579 | dc("aVertex2d", dQ, "aVertex", 3, bg); | ||
6580 | cg("aTextureCoord2d", dQ, "aTextureCoord"); | ||
6581 | d2("uColor2d", dQ, "uColor", c0); | ||
6582 | dZ("uIsDrawingText", dQ, "uIsDrawingText", false); | ||
6583 | d8.drawArrays(d8.LINE_STRIP, 0, cF.length / 3) | ||
6584 | } | ||
6585 | }; | ||
6586 | cW.modelX = function(eg, ef, ee) { | ||
6587 | var ei = dJ.array(); | ||
6588 | var ek = ch.array(); | ||
6589 | var ea = ei[0] * eg + ei[1] * ef + ei[2] * ee + ei[3]; | ||
6590 | var ej = ei[4] * eg + ei[5] * ef + ei[6] * ee + ei[7]; | ||
6591 | var eh = ei[8] * eg + ei[9] * ef + ei[10] * ee + ei[11]; | ||
6592 | var eb = ei[12] * eg + ei[13] * ef + ei[14] * ee + ei[15]; | ||
6593 | var ec = ek[0] * ea + ek[1] * ej + ek[2] * eh + ek[3] * eb; | ||
6594 | var ed = ek[12] * ea + ek[13] * ej + ek[14] * eh + ek[15] * eb; | ||
6595 | return ed !== 0 ? ec / ed : ec | ||
6596 | }; | ||
6597 | cW.modelY = function(eg, ef, ee) { | ||
6598 | var ei = dJ.array(); | ||
6599 | var ek = ch.array(); | ||
6600 | var ea = ei[0] * eg + ei[1] * ef + ei[2] * ee + ei[3]; | ||
6601 | var ej = ei[4] * eg + ei[5] * ef + ei[6] * ee + ei[7]; | ||
6602 | var eh = ei[8] * eg + ei[9] * ef + ei[10] * ee + ei[11]; | ||
6603 | var eb = ei[12] * eg + ei[13] * ef + ei[14] * ee + ei[15]; | ||
6604 | var ec = ek[4] * ea + ek[5] * ej + ek[6] * eh + ek[7] * eb; | ||
6605 | var ed = ek[12] * ea + ek[13] * ej + ek[14] * eh + ek[15] * eb; | ||
6606 | return ed !== 0 ? ec / ed : ec | ||
6607 | }; | ||
6608 | cW.modelZ = function(eg, ef, ee) { | ||
6609 | var ei = dJ.array(); | ||
6610 | var ek = ch.array(); | ||
6611 | var ea = ei[0] * eg + ei[1] * ef + ei[2] * ee + ei[3]; | ||
6612 | var ej = ei[4] * eg + ei[5] * ef + ei[6] * ee + ei[7]; | ||
6613 | var eh = ei[8] * eg + ei[9] * ef + ei[10] * ee + ei[11]; | ||
6614 | var ec = ei[12] * eg + ei[13] * ef + ei[14] * ee + ei[15]; | ||
6615 | var eb = ek[8] * ea + ek[9] * ej + ek[10] * eh + ek[11] * ec; | ||
6616 | var ed = ek[12] * ea + ek[13] * ej + ek[14] * eh + ek[15] * ec; | ||
6617 | return ed !== 0 ? eb / ed : eb | ||
6618 | }; | ||
6619 | bR.prototype.ambient = ds.prototype.a3DOnlyFunction; | ||
6620 | bB.prototype.ambient = function(ed, ec, eb) { | ||
6621 | d8.useProgram(dx); | ||
6622 | dZ("uUsingMat3d", dx, "uUsingMat", true); | ||
6623 | var ea = cW.color(ed, ec, eb); | ||
6624 | d2("uMaterialAmbient3d", dx, "uMaterialAmbient", cW.color.toGLArray(ea).slice(0, 3)) | ||
6625 | }; | ||
6626 | bR.prototype.emissive = ds.prototype.a3DOnlyFunction; | ||
6627 | bB.prototype.emissive = function(ed, ec, eb) { | ||
6628 | d8.useProgram(dx); | ||
6629 | dZ("uUsingMat3d", dx, "uUsingMat", true); | ||
6630 | var ea = cW.color(ed, ec, eb); | ||
6631 | d2("uMaterialEmissive3d", dx, "uMaterialEmissive", cW.color.toGLArray(ea).slice(0, 3)) | ||
6632 | }; | ||
6633 | bR.prototype.shininess = ds.prototype.a3DOnlyFunction; | ||
6634 | bB.prototype.shininess = function(ea) { | ||
6635 | d8.useProgram(dx); | ||
6636 | dZ("uUsingMat3d", dx, "uUsingMat", true); | ||
6637 | d2("uShininess3d", dx, "uShininess", ea) | ||
6638 | }; | ||
6639 | bR.prototype.specular = ds.prototype.a3DOnlyFunction; | ||
6640 | bB.prototype.specular = function(ed, ec, eb) { | ||
6641 | d8.useProgram(dx); | ||
6642 | dZ("uUsingMat3d", dx, "uUsingMat", true); | ||
6643 | var ea = cW.color(ed, ec, eb); | ||
6644 | d2("uMaterialSpecular3d", dx, "uMaterialSpecular", cW.color.toGLArray(ea).slice(0, 3)) | ||
6645 | }; | ||
6646 | cW.screenX = function(eh, eg, ef) { | ||
6647 | var ej = dJ.array(); | ||
6648 | if (ej.length === 16) { | ||
6649 | var ea = ej[0] * eh + ej[1] * eg + ej[2] * ef + ej[3]; | ||
6650 | var ek = ej[4] * eh + ej[5] * eg + ej[6] * ef + ej[7]; | ||
6651 | var ei = ej[8] * eh + ej[9] * eg + ej[10] * ef + ej[11]; | ||
6652 | var eb = ej[12] * eh + ej[13] * eg + ej[14] * ef + ej[15]; | ||
6653 | var ee = db.array(); | ||
6654 | var ec = ee[0] * ea + ee[1] * ek + ee[2] * ei + ee[3] * eb; | ||
6655 | var ed = ee[12] * ea + ee[13] * ek + ee[14] * ei + ee[15] * eb; | ||
6656 | if (ed !== 0) { | ||
6657 | ec /= ed | ||
6658 | } | ||
6659 | return cW.width * (1 + ec) / 2 | ||
6660 | } | ||
6661 | return dJ.multX(eh, eg) | ||
6662 | }; | ||
6663 | cW.screenY = function aA(eh, eg, ef) { | ||
6664 | var ej = dJ.array(); | ||
6665 | if (ej.length === 16) { | ||
6666 | var ea = ej[0] * eh + ej[1] * eg + ej[2] * ef + ej[3]; | ||
6667 | var ek = ej[4] * eh + ej[5] * eg + ej[6] * ef + ej[7]; | ||
6668 | var ei = ej[8] * eh + ej[9] * eg + ej[10] * ef + ej[11]; | ||
6669 | var eb = ej[12] * eh + ej[13] * eg + ej[14] * ef + ej[15]; | ||
6670 | var ee = db.array(); | ||
6671 | var ec = ee[4] * ea + ee[5] * ek + ee[6] * ei + ee[7] * eb; | ||
6672 | var ed = ee[12] * ea + ee[13] * ek + ee[14] * ei + ee[15] * eb; | ||
6673 | if (ed !== 0) { | ||
6674 | ec /= ed | ||
6675 | } | ||
6676 | return cW.height * (1 + ec) / 2 | ||
6677 | } | ||
6678 | return dJ.multY(eh, eg) | ||
6679 | }; | ||
6680 | cW.screenZ = function ay(eh, eg, ef) { | ||
6681 | var ej = dJ.array(); | ||
6682 | if (ej.length !== 16) { | ||
6683 | return 0 | ||
6684 | } | ||
6685 | var ee = db.array(); | ||
6686 | var ea = ej[0] * eh + ej[1] * eg + ej[2] * ef + ej[3]; | ||
6687 | var ek = ej[4] * eh + ej[5] * eg + ej[6] * ef + ej[7]; | ||
6688 | var ei = ej[8] * eh + ej[9] * eg + ej[10] * ef + ej[11]; | ||
6689 | var ec = ej[12] * eh + ej[13] * eg + ej[14] * ef + ej[15]; | ||
6690 | var eb = ee[8] * ea + ee[9] * ek + ee[10] * ei + ee[11] * ec; | ||
6691 | var ed = ee[12] * ea + ee[13] * ek + ee[14] * ei + ee[15] * ec; | ||
6692 | if (ed !== 0) { | ||
6693 | eb /= ed | ||
6694 | } | ||
6695 | return (eb + 1) / 2 | ||
6696 | }; | ||
6697 | ds.prototype.fill = function() { | ||
6698 | var ea = cW.color(arguments[0], arguments[1], arguments[2], arguments[3]); | ||
6699 | if (ea === a1 && aH) { | ||
6700 | return | ||
6701 | } | ||
6702 | aH = true; | ||
6703 | a1 = ea | ||
6704 | }; | ||
6705 | bR.prototype.fill = function() { | ||
6706 | ds.prototype.fill.apply(this, arguments); | ||
6707 | aq = true | ||
6708 | }; | ||
6709 | bB.prototype.fill = function() { | ||
6710 | ds.prototype.fill.apply(this, arguments); | ||
6711 | bo = cW.color.toGLArray(a1) | ||
6712 | }; | ||
6713 | |||
6714 | function bn() { | ||
6715 | if (aH) { | ||
6716 | if (aq) { | ||
6717 | d8.fillStyle = cW.color.toString(a1); | ||
6718 | aq = false | ||
6719 | } | ||
6720 | d8.fill() | ||
6721 | } | ||
6722 | } | ||
6723 | cW.noFill = function() { | ||
6724 | aH = false | ||
6725 | }; | ||
6726 | ds.prototype.stroke = function() { | ||
6727 | var ea = cW.color(arguments[0], arguments[1], arguments[2], arguments[3]); | ||
6728 | if (ea === cv && ce) { | ||
6729 | return | ||
6730 | } | ||
6731 | ce = true; | ||
6732 | cv = ea | ||
6733 | }; | ||
6734 | bR.prototype.stroke = function() { | ||
6735 | ds.prototype.stroke.apply(this, arguments); | ||
6736 | b3 = true | ||
6737 | }; | ||
6738 | bB.prototype.stroke = function() { | ||
6739 | ds.prototype.stroke.apply(this, arguments); | ||
6740 | c0 = cW.color.toGLArray(cv) | ||
6741 | }; | ||
6742 | |||
6743 | function dd() { | ||
6744 | if (ce) { | ||
6745 | if (b3) { | ||
6746 | d8.strokeStyle = cW.color.toString(cv); | ||
6747 | b3 = false | ||
6748 | } | ||
6749 | d8.stroke() | ||
6750 | } | ||
6751 | } | ||
6752 | cW.noStroke = function() { | ||
6753 | ce = false | ||
6754 | }; | ||
6755 | ds.prototype.strokeWeight = function(ea) { | ||
6756 | dW = ea | ||
6757 | }; | ||
6758 | bR.prototype.strokeWeight = function(ea) { | ||
6759 | ds.prototype.strokeWeight.apply(this, arguments); | ||
6760 | d8.lineWidth = ea | ||
6761 | }; | ||
6762 | bB.prototype.strokeWeight = function(ea) { | ||
6763 | ds.prototype.strokeWeight.apply(this, arguments); | ||
6764 | d8.useProgram(dQ); | ||
6765 | d2("pointSize2d", dQ, "uPointSize", ea); | ||
6766 | d8.useProgram(bT); | ||
6767 | d2("pointSizeUnlitShape", bT, "uPointSize", ea); | ||
6768 | d8.lineWidth(ea) | ||
6769 | }; | ||
6770 | cW.strokeCap = function(ea) { | ||
6771 | dY.$ensureContext().lineCap = ea | ||
6772 | }; | ||
6773 | cW.strokeJoin = function(ea) { | ||
6774 | dY.$ensureContext().lineJoin = ea | ||
6775 | }; | ||
6776 | bR.prototype.smooth = function() { | ||
6777 | dO = true; | ||
6778 | var ea = ae.style; | ||
6779 | ea.setProperty("image-rendering", "optimizeQuality", "important"); | ||
6780 | ea.setProperty("-ms-interpolation-mode", "bicubic", "important"); | ||
6781 | if (d8.hasOwnProperty("mozImageSmoothingEnabled")) { | ||
6782 | d8.mozImageSmoothingEnabled = true | ||
6783 | } | ||
6784 | }; | ||
6785 | bB.prototype.smooth = function() { | ||
6786 | dO = true | ||
6787 | }; | ||
6788 | bR.prototype.noSmooth = function() { | ||
6789 | dO = false; | ||
6790 | var ea = ae.style; | ||
6791 | ea.setProperty("image-rendering", "optimizeSpeed", "important"); | ||
6792 | ea.setProperty("image-rendering", "-moz-crisp-edges", "important"); | ||
6793 | ea.setProperty("image-rendering", "-webkit-optimize-contrast", "important"); | ||
6794 | ea.setProperty("image-rendering", "optimize-contrast", "important"); | ||
6795 | ea.setProperty("-ms-interpolation-mode", "nearest-neighbor", "important"); | ||
6796 | if (d8.hasOwnProperty("mozImageSmoothingEnabled")) { | ||
6797 | d8.mozImageSmoothingEnabled = false | ||
6798 | } | ||
6799 | }; | ||
6800 | bB.prototype.noSmooth = function() { | ||
6801 | dO = false | ||
6802 | }; | ||
6803 | bR.prototype.point = function(ea, eb) { | ||
6804 | if (!ce) { | ||
6805 | return | ||
6806 | } | ||
6807 | ea = q.round(ea); | ||
6808 | eb = q.round(eb); | ||
6809 | d8.fillStyle = cW.color.toString(cv); | ||
6810 | aq = true; | ||
6811 | if (dW > 1) { | ||
6812 | d8.beginPath(); | ||
6813 | d8.arc(ea, eb, dW / 2, 0, 6.283185307179586, false); | ||
6814 | d8.fill() | ||
6815 | } else { | ||
6816 | d8.fillRect(ea, eb, 1, 1) | ||
6817 | } | ||
6818 | }; | ||
6819 | bB.prototype.point = function(ea, ee, ed) { | ||
6820 | var ec = new aP; | ||
6821 | ec.translate(ea, ee, ed || 0); | ||
6822 | ec.transpose(); | ||
6823 | var eb = new aP; | ||
6824 | eb.scale(1, -1, 1); | ||
6825 | eb.apply(dJ.array()); | ||
6826 | eb.transpose(); | ||
6827 | d8.useProgram(dQ); | ||
6828 | a9("uModel2d", dQ, "uModel", false, ec.array()); | ||
6829 | a9("uView2d", dQ, "uView", false, eb.array()); | ||
6830 | if (dW > 0 && ce) { | ||
6831 | d2("uColor2d", dQ, "uColor", c0); | ||
6832 | dZ("uIsDrawingText2d", dQ, "uIsDrawingText", false); | ||
6833 | dZ("uSmooth2d", dQ, "uSmooth", dO); | ||
6834 | dc("aVertex2d", dQ, "aVertex", 3, aw); | ||
6835 | cg("aTextureCoord2d", dQ, "aTextureCoord"); | ||
6836 | d8.drawArrays(d8.POINTS, 0, 1) | ||
6837 | } | ||
6838 | }; | ||
6839 | cW.beginShape = function(ea) { | ||
6840 | dR = ea; | ||
6841 | d6 = []; | ||
6842 | bb = [] | ||
6843 | }; | ||
6844 | bR.prototype.vertex = function(eb, ed, ea) { | ||
6845 | var ec = []; | ||
6846 | if (du) { | ||
6847 | du = false | ||
6848 | } | ||
6849 | ec.isVert = true; | ||
6850 | ec[0] = eb; | ||
6851 | ec[1] = ed; | ||
6852 | ec[2] = 0; | ||
6853 | ec[3] = 0; | ||
6854 | ec[4] = 0; | ||
6855 | ec[5] = a1; | ||
6856 | ec[6] = cv; | ||
6857 | bb.push(ec); | ||
6858 | if (ea) { | ||
6859 | bb[bb.length - 1]["moveTo"] = ea | ||
6860 | } | ||
6861 | }; | ||
6862 | bB.prototype.vertex = function(ea, ef, ee, ed, ec) { | ||
6863 | var eb = []; | ||
6864 | if (du) { | ||
6865 | du = false | ||
6866 | } | ||
6867 | eb.isVert = true; | ||
6868 | if (ec === t && dT) { | ||
6869 | ec = ed; | ||
6870 | ed = ee; | ||
6871 | ee = 0 | ||
6872 | } | ||
6873 | if (ed !== t && ec !== t) { | ||
6874 | if (d4 === 2) { | ||
6875 | ed /= cs.width; | ||
6876 | ec /= cs.height | ||
6877 | } | ||
6878 | ed = ed > 1 ? 1 : ed; | ||
6879 | ed = ed < 0 ? 0 : ed; | ||
6880 | ec = ec > 1 ? 1 : ec; | ||
6881 | ec = ec < 0 ? 0 : ec | ||
6882 | } | ||
6883 | eb[0] = ea; | ||
6884 | eb[1] = ef; | ||
6885 | eb[2] = ee || 0; | ||
6886 | eb[3] = ed || 0; | ||
6887 | eb[4] = ec || 0; | ||
6888 | eb[5] = bo[0]; | ||
6889 | eb[6] = bo[1]; | ||
6890 | eb[7] = bo[2]; | ||
6891 | eb[8] = bo[3]; | ||
6892 | eb[9] = c0[0]; | ||
6893 | eb[10] = c0[1]; | ||
6894 | eb[11] = c0[2]; | ||
6895 | eb[12] = c0[3]; | ||
6896 | eb[13] = a8; | ||
6897 | eb[14] = a7; | ||
6898 | eb[15] = a6; | ||
6899 | bb.push(eb) | ||
6900 | }; | ||
6901 | var d1 = function(ec, eb) { | ||
6902 | var ea = new aP; | ||
6903 | ea.scale(1, -1, 1); | ||
6904 | ea.apply(dJ.array()); | ||
6905 | ea.transpose(); | ||
6906 | d8.useProgram(bT); | ||
6907 | a9("uViewUS", bT, "uView", false, ea.array()); | ||
6908 | dZ("uSmoothUS", bT, "uSmooth", dO); | ||
6909 | dc("aVertexUS", bT, "aVertex", 3, aw); | ||
6910 | d8.bufferData(d8.ARRAY_BUFFER, new e(ec), d8.STREAM_DRAW); | ||
6911 | dc("aColorUS", bT, "aColor", 4, aG); | ||
6912 | d8.bufferData(d8.ARRAY_BUFFER, new e(eb), d8.STREAM_DRAW); | ||
6913 | d8.drawArrays(d8.POINTS, 0, ec.length / 3) | ||
6914 | }; | ||
6915 | var bj = function(ee, ed, ec) { | ||
6916 | var eb; | ||
6917 | if (ed === "LINES") { | ||
6918 | eb = d8.LINES | ||
6919 | } else { | ||
6920 | if (ed === "LINE_LOOP") { | ||
6921 | eb = d8.LINE_LOOP | ||
6922 | } else { | ||
6923 | eb = d8.LINE_STRIP | ||
6924 | } | ||
6925 | } | ||
6926 | var ea = new aP; | ||
6927 | ea.scale(1, -1, 1); | ||
6928 | ea.apply(dJ.array()); | ||
6929 | ea.transpose(); | ||
6930 | d8.useProgram(bT); | ||
6931 | a9("uViewUS", bT, "uView", false, ea.array()); | ||
6932 | dc("aVertexUS", bT, "aVertex", 3, b8); | ||
6933 | d8.bufferData(d8.ARRAY_BUFFER, new e(ee), d8.STREAM_DRAW); | ||
6934 | dc("aColorUS", bT, "aColor", 4, bC); | ||
6935 | d8.bufferData(d8.ARRAY_BUFFER, new e(ec), d8.STREAM_DRAW); | ||
6936 | d8.drawArrays(eb, 0, ee.length / 3) | ||
6937 | }; | ||
6938 | var dm = function(ef, ee, ed, ec) { | ||
6939 | var eb; | ||
6940 | if (ee === "TRIANGLES") { | ||
6941 | eb = d8.TRIANGLES | ||
6942 | } else { | ||
6943 | if (ee === "TRIANGLE_FAN") { | ||
6944 | eb = d8.TRIANGLE_FAN | ||
6945 | } else { | ||
6946 | eb = d8.TRIANGLE_STRIP | ||
6947 | } | ||
6948 | } | ||
6949 | var ea = new aP; | ||
6950 | ea.scale(1, -1, 1); | ||
6951 | ea.apply(dJ.array()); | ||
6952 | ea.transpose(); | ||
6953 | d8.useProgram(dx); | ||
6954 | a9("model3d", dx, "uModel", false, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); | ||
6955 | a9("view3d", dx, "uView", false, ea.array()); | ||
6956 | d8.enable(d8.POLYGON_OFFSET_FILL); | ||
6957 | d8.polygonOffset(1, 1); | ||
6958 | d2("color3d", dx, "uColor", [-1, 0, 0, 0]); | ||
6959 | dc("vertex3d", dx, "aVertex", 3, at); | ||
6960 | d8.bufferData(d8.ARRAY_BUFFER, new e(ef), d8.STREAM_DRAW); | ||
6961 | if (dT && bf !== null) { | ||
6962 | bw(ed) | ||
6963 | } | ||
6964 | dc("aColor3d", dx, "aColor", 4, aG); | ||
6965 | d8.bufferData(d8.ARRAY_BUFFER, new e(ed), d8.STREAM_DRAW); | ||
6966 | cg("aNormal3d", dx, "aNormal"); | ||
6967 | if (dT) { | ||
6968 | dZ("uUsingTexture3d", dx, "uUsingTexture", dT); | ||
6969 | dc("aTexture3d", dx, "aTexture", 2, af); | ||
6970 | d8.bufferData(d8.ARRAY_BUFFER, new e(ec), d8.STREAM_DRAW) | ||
6971 | } | ||
6972 | d8.drawArrays(eb, 0, ef.length / 3); | ||
6973 | d8.disable(d8.POLYGON_OFFSET_FILL) | ||
6974 | }; | ||
6975 | |||
6976 | function cS() { | ||
6977 | bn(); | ||
6978 | dd(); | ||
6979 | d8.closePath() | ||
6980 | } | ||
6981 | bR.prototype.endShape = function(eh) { | ||
6982 | if (bb.length === 0) { | ||
6983 | return | ||
6984 | } | ||
6985 | var ed = eh === 2; | ||
6986 | if (ed) { | ||
6987 | bb.push(bb[0]) | ||
6988 | } | ||
6989 | var ec = []; | ||
6990 | var ea = []; | ||
6991 | var ej = []; | ||
6992 | var em = []; | ||
6993 | var ef = []; | ||
6994 | var ei; | ||
6995 | du = true; | ||
6996 | var eg, ee, eb; | ||
6997 | var el = bb.length; | ||
6998 | for (eg = 0; eg < el; eg++) { | ||
6999 | ei = bb[eg]; | ||
7000 | for (ee = 0; ee < 3; ee++) { | ||
7001 | ea.push(ei[ee]) | ||
7002 | } | ||
7003 | } | ||
7004 | for (eg = 0; eg < el; eg++) { | ||
7005 | ei = bb[eg]; | ||
7006 | for (ee = 5; ee < 9; ee++) { | ||
7007 | ej.push(ei[ee]) | ||
7008 | } | ||
7009 | } | ||
7010 | for (eg = 0; eg < el; eg++) { | ||
7011 | ei = bb[eg]; | ||
7012 | for (ee = 9; ee < 13; ee++) { | ||
7013 | em.push(ei[ee]) | ||
7014 | } | ||
7015 | } | ||
7016 | for (eg = 0; eg < el; eg++) { | ||
7017 | ei = bb[eg]; | ||
7018 | ef.push(ei[3]); | ||
7019 | ef.push(ei[4]) | ||
7020 | } | ||
7021 | if (dP && (dR === 20 || dR === t)) { | ||
7022 | if (el > 3) { | ||
7023 | var ek = [], | ||
7024 | en = 1 - aJ; | ||
7025 | d8.beginPath(); | ||
7026 | d8.moveTo(bb[1][0], bb[1][1]); | ||
7027 | for (eg = 1; eg + 2 < el; eg++) { | ||
7028 | ei = bb[eg]; | ||
7029 | ek[0] = [ei[0], ei[1]]; | ||
7030 | ek[1] = [ei[0] + (en * bb[eg + 1][0] - en * bb[eg - 1][0]) / 6, ei[1] + (en * bb[eg + 1][1] - en * bb[eg - 1][1]) / 6]; | ||
7031 | ek[2] = [bb[eg + 1][0] + (en * bb[eg][0] - en * bb[eg + 2][0]) / 6, bb[eg + 1][1] + (en * bb[eg][1] - en * bb[eg + 2][1]) / 6]; | ||
7032 | ek[3] = [bb[eg + 1][0], bb[eg + 1][1]]; | ||
7033 | d8.bezierCurveTo(ek[1][0], ek[1][1], ek[2][0], ek[2][1], ek[3][0], ek[3][1]) | ||
7034 | } | ||
7035 | cS() | ||
7036 | } | ||
7037 | } else { | ||
7038 | if (aa && (dR === 20 || dR === t)) { | ||
7039 | d8.beginPath(); | ||
7040 | for (eg = 0; eg < el; eg++) { | ||
7041 | ei = bb[eg]; | ||
7042 | if (bb[eg]["isVert"]) { | ||
7043 | if (bb[eg]["moveTo"]) { | ||
7044 | d8.moveTo(ei[0], ei[1]) | ||
7045 | } else { | ||
7046 | d8.lineTo(ei[0], ei[1]) | ||
7047 | } | ||
7048 | } else { | ||
7049 | d8.bezierCurveTo(bb[eg][0], bb[eg][1], bb[eg][2], bb[eg][3], bb[eg][4], bb[eg][5]) | ||
7050 | } | ||
7051 | } | ||
7052 | cS() | ||
7053 | } else { | ||
7054 | if (dR === 2) { | ||
7055 | for (eg = 0; eg < el; eg++) { | ||
7056 | ei = bb[eg]; | ||
7057 | if (ce) { | ||
7058 | cW.stroke(ei[6]) | ||
7059 | } | ||
7060 | cW.point(ei[0], ei[1]) | ||
7061 | } | ||
7062 | } else { | ||
7063 | if (dR === 4) { | ||
7064 | for (eg = 0; eg + 1 < el; eg += 2) { | ||
7065 | ei = bb[eg]; | ||
7066 | if (ce) { | ||
7067 | cW.stroke(bb[eg + 1][6]) | ||
7068 | } | ||
7069 | cW.line(ei[0], ei[1], bb[eg + 1][0], bb[eg + 1][1]) | ||
7070 | } | ||
7071 | } else { | ||
7072 | if (dR === 9) { | ||
7073 | for (eg = 0; eg + 2 < el; eg += 3) { | ||
7074 | ei = bb[eg]; | ||
7075 | d8.beginPath(); | ||
7076 | d8.moveTo(ei[0], ei[1]); | ||
7077 | d8.lineTo(bb[eg + 1][0], bb[eg + 1][1]); | ||
7078 | d8.lineTo(bb[eg + 2][0], bb[eg + 2][1]); | ||
7079 | d8.lineTo(ei[0], ei[1]); | ||
7080 | if (aH) { | ||
7081 | cW.fill(bb[eg + 2][5]); | ||
7082 | bn() | ||
7083 | } | ||
7084 | if (ce) { | ||
7085 | cW.stroke(bb[eg + 2][6]); | ||
7086 | dd() | ||
7087 | } | ||
7088 | d8.closePath() | ||
7089 | } | ||
7090 | } else { | ||
7091 | if (dR === 10) { | ||
7092 | for (eg = 0; eg + 1 < el; eg++) { | ||
7093 | ei = bb[eg]; | ||
7094 | d8.beginPath(); | ||
7095 | d8.moveTo(bb[eg + 1][0], bb[eg + 1][1]); | ||
7096 | d8.lineTo(ei[0], ei[1]); | ||
7097 | if (ce) { | ||
7098 | cW.stroke(bb[eg + 1][6]) | ||
7099 | } | ||
7100 | if (aH) { | ||
7101 | cW.fill(bb[eg + 1][5]) | ||
7102 | } | ||
7103 | if (eg + 2 < el) { | ||
7104 | d8.lineTo(bb[eg + 2][0], bb[eg + 2][1]); | ||
7105 | if (ce) { | ||
7106 | cW.stroke(bb[eg + 2][6]) | ||
7107 | } | ||
7108 | if (aH) { | ||
7109 | cW.fill(bb[eg + 2][5]) | ||
7110 | } | ||
7111 | } | ||
7112 | cS() | ||
7113 | } | ||
7114 | } else { | ||
7115 | if (dR === 11) { | ||
7116 | if (el > 2) { | ||
7117 | d8.beginPath(); | ||
7118 | d8.moveTo(bb[0][0], bb[0][1]); | ||
7119 | d8.lineTo(bb[1][0], bb[1][1]); | ||
7120 | d8.lineTo(bb[2][0], bb[2][1]); | ||
7121 | if (aH) { | ||
7122 | cW.fill(bb[2][5]); | ||
7123 | bn() | ||
7124 | } | ||
7125 | if (ce) { | ||
7126 | cW.stroke(bb[2][6]); | ||
7127 | dd() | ||
7128 | } | ||
7129 | d8.closePath(); | ||
7130 | for (eg = 3; eg < el; eg++) { | ||
7131 | ei = bb[eg]; | ||
7132 | d8.beginPath(); | ||
7133 | d8.moveTo(bb[0][0], bb[0][1]); | ||
7134 | d8.lineTo(bb[eg - 1][0], bb[eg - 1][1]); | ||
7135 | d8.lineTo(ei[0], ei[1]); | ||
7136 | if (aH) { | ||
7137 | cW.fill(ei[5]); | ||
7138 | bn() | ||
7139 | } | ||
7140 | if (ce) { | ||
7141 | cW.stroke(ei[6]); | ||
7142 | dd() | ||
7143 | } | ||
7144 | d8.closePath() | ||
7145 | } | ||
7146 | } | ||
7147 | } else { | ||
7148 | if (dR === 16) { | ||
7149 | for (eg = 0; eg + 3 < el; eg += 4) { | ||
7150 | ei = bb[eg]; | ||
7151 | d8.beginPath(); | ||
7152 | d8.moveTo(ei[0], ei[1]); | ||
7153 | for (ee = 1; ee < 4; ee++) { | ||
7154 | d8.lineTo(bb[eg + ee][0], bb[eg + ee][1]) | ||
7155 | } | ||
7156 | d8.lineTo(ei[0], ei[1]); | ||
7157 | if (aH) { | ||
7158 | cW.fill(bb[eg + 3][5]); | ||
7159 | bn() | ||
7160 | } | ||
7161 | if (ce) { | ||
7162 | cW.stroke(bb[eg + 3][6]); | ||
7163 | dd() | ||
7164 | } | ||
7165 | d8.closePath() | ||
7166 | } | ||
7167 | } else { | ||
7168 | if (dR === 17) { | ||
7169 | if (el > 3) { | ||
7170 | for (eg = 0; eg + 1 < el; eg += 2) { | ||
7171 | ei = bb[eg]; | ||
7172 | d8.beginPath(); | ||
7173 | if (eg + 3 < el) { | ||
7174 | d8.moveTo(bb[eg + 2][0], bb[eg + 2][1]); | ||
7175 | d8.lineTo(ei[0], ei[1]); | ||
7176 | d8.lineTo(bb[eg + 1][0], bb[eg + 1][1]); | ||
7177 | d8.lineTo(bb[eg + 3][0], bb[eg + 3][1]); | ||
7178 | if (aH) { | ||
7179 | cW.fill(bb[eg + 3][5]) | ||
7180 | } | ||
7181 | if (ce) { | ||
7182 | cW.stroke(bb[eg + 3][6]) | ||
7183 | } | ||
7184 | } else { | ||
7185 | d8.moveTo(ei[0], ei[1]); | ||
7186 | d8.lineTo(bb[eg + 1][0], bb[eg + 1][1]) | ||
7187 | } | ||
7188 | cS() | ||
7189 | } | ||
7190 | } | ||
7191 | } else { | ||
7192 | d8.beginPath(); | ||
7193 | d8.moveTo(bb[0][0], bb[0][1]); | ||
7194 | for (eg = 1; eg < el; eg++) { | ||
7195 | ei = bb[eg]; | ||
7196 | if (ei.isVert) { | ||
7197 | if (ei.moveTo) { | ||
7198 | d8.moveTo(ei[0], ei[1]) | ||
7199 | } else { | ||
7200 | d8.lineTo(ei[0], ei[1]) | ||
7201 | } | ||
7202 | } | ||
7203 | } | ||
7204 | cS() | ||
7205 | } | ||
7206 | } | ||
7207 | } | ||
7208 | } | ||
7209 | } | ||
7210 | } | ||
7211 | } | ||
7212 | } | ||
7213 | } | ||
7214 | dP = false; | ||
7215 | aa = false; | ||
7216 | cb = []; | ||
7217 | c2 = 0; | ||
7218 | if (ed) { | ||
7219 | bb.pop() | ||
7220 | } | ||
7221 | }; | ||
7222 | bB.prototype.endShape = function(eh) { | ||
7223 | if (bb.length === 0) { | ||
7224 | return | ||
7225 | } | ||
7226 | var ed = eh === 2; | ||
7227 | var ec = []; | ||
7228 | var ea = []; | ||
7229 | var ej = []; | ||
7230 | var em = []; | ||
7231 | var ef = []; | ||
7232 | var ei; | ||
7233 | du = true; | ||
7234 | var eg, ee, eb; | ||
7235 | var el = bb.length; | ||
7236 | for (eg = 0; eg < el; eg++) { | ||
7237 | ei = bb[eg]; | ||
7238 | for (ee = 0; ee < 3; ee++) { | ||
7239 | ea.push(ei[ee]) | ||
7240 | } | ||
7241 | } | ||
7242 | for (eg = 0; eg < el; eg++) { | ||
7243 | ei = bb[eg]; | ||
7244 | for (ee = 5; ee < 9; ee++) { | ||
7245 | ej.push(ei[ee]) | ||
7246 | } | ||
7247 | } | ||
7248 | for (eg = 0; eg < el; eg++) { | ||
7249 | ei = bb[eg]; | ||
7250 | for (ee = 9; ee < 13; ee++) { | ||
7251 | em.push(ei[ee]) | ||
7252 | } | ||
7253 | } | ||
7254 | for (eg = 0; eg < el; eg++) { | ||
7255 | ei = bb[eg]; | ||
7256 | ef.push(ei[3]); | ||
7257 | ef.push(ei[4]) | ||
7258 | } | ||
7259 | if (ed) { | ||
7260 | ea.push(bb[0][0]); | ||
7261 | ea.push(bb[0][1]); | ||
7262 | ea.push(bb[0][2]); | ||
7263 | for (eg = 5; eg < 9; eg++) { | ||
7264 | ej.push(bb[0][eg]) | ||
7265 | } | ||
7266 | for (eg = 9; eg < 13; eg++) { | ||
7267 | em.push(bb[0][eg]) | ||
7268 | } | ||
7269 | ef.push(bb[0][3]); | ||
7270 | ef.push(bb[0][4]) | ||
7271 | } | ||
7272 | if (dP && (dR === 20 || dR === t)) { | ||
7273 | ec = ea; | ||
7274 | if (ce) { | ||
7275 | bj(ec, null, em) | ||
7276 | } | ||
7277 | if (aH) { | ||
7278 | dm(ea, null, ej) | ||
7279 | } | ||
7280 | } else { | ||
7281 | if (aa && (dR === 20 || dR === t)) { | ||
7282 | ec = ea; | ||
7283 | ec.splice(ec.length - 3); | ||
7284 | em.splice(em.length - 4); | ||
7285 | if (ce) { | ||
7286 | bj(ec, null, em) | ||
7287 | } | ||
7288 | if (aH) { | ||
7289 | dm(ea, "TRIANGLES", ej) | ||
7290 | } | ||
7291 | } else { | ||
7292 | if (dR === 2) { | ||
7293 | for (eg = 0; eg < el; eg++) { | ||
7294 | ei = bb[eg]; | ||
7295 | for (ee = 0; ee < 3; ee++) { | ||
7296 | ec.push(ei[ee]) | ||
7297 | } | ||
7298 | } | ||
7299 | d1(ec, em) | ||
7300 | } else { | ||
7301 | if (dR === 4) { | ||
7302 | for (eg = 0; eg < el; eg++) { | ||
7303 | ei = bb[eg]; | ||
7304 | for (ee = 0; ee < 3; ee++) { | ||
7305 | ec.push(ei[ee]) | ||
7306 | } | ||
7307 | } | ||
7308 | for (eg = 0; eg < el; eg++) { | ||
7309 | ei = bb[eg]; | ||
7310 | for (ee = 5; ee < 9; ee++) { | ||
7311 | ej.push(ei[ee]) | ||
7312 | } | ||
7313 | } | ||
7314 | bj(ec, "LINES", em) | ||
7315 | } else { | ||
7316 | if (dR === 9) { | ||
7317 | if (el > 2) { | ||
7318 | for (eg = 0; eg + 2 < el; eg += 3) { | ||
7319 | ea = []; | ||
7320 | ef = []; | ||
7321 | ec = []; | ||
7322 | ej = []; | ||
7323 | em = []; | ||
7324 | for (ee = 0; ee < 3; ee++) { | ||
7325 | for (eb = 0; eb < 3; eb++) { | ||
7326 | ec.push(bb[eg + ee][eb]); | ||
7327 | ea.push(bb[eg + ee][eb]) | ||
7328 | } | ||
7329 | } | ||
7330 | for (ee = 0; ee < 3; ee++) { | ||
7331 | for (eb = 3; eb < 5; eb++) { | ||
7332 | ef.push(bb[eg + ee][eb]) | ||
7333 | } | ||
7334 | } | ||
7335 | for (ee = 0; ee < 3; ee++) { | ||
7336 | for (eb = 5; eb < 9; eb++) { | ||
7337 | ej.push(bb[eg + ee][eb]); | ||
7338 | em.push(bb[eg + ee][eb + 4]) | ||
7339 | } | ||
7340 | } | ||
7341 | if (ce) { | ||
7342 | bj(ec, "LINE_LOOP", em) | ||
7343 | } | ||
7344 | if (aH || dT) { | ||
7345 | dm(ea, "TRIANGLES", ej, ef) | ||
7346 | } | ||
7347 | } | ||
7348 | } | ||
7349 | } else { | ||
7350 | if (dR === 10) { | ||
7351 | if (el > 2) { | ||
7352 | for (eg = 0; eg + 2 < el; eg++) { | ||
7353 | ec = []; | ||
7354 | ea = []; | ||
7355 | em = []; | ||
7356 | ej = []; | ||
7357 | ef = []; | ||
7358 | for (ee = 0; ee < 3; ee++) { | ||
7359 | for (eb = 0; eb < 3; eb++) { | ||
7360 | ec.push(bb[eg + ee][eb]); | ||
7361 | ea.push(bb[eg + ee][eb]) | ||
7362 | } | ||
7363 | } | ||
7364 | for (ee = 0; ee < 3; ee++) { | ||
7365 | for (eb = 3; eb < 5; eb++) { | ||
7366 | ef.push(bb[eg + ee][eb]) | ||
7367 | } | ||
7368 | } | ||
7369 | for (ee = 0; ee < 3; ee++) { | ||
7370 | for (eb = 5; eb < 9; eb++) { | ||
7371 | em.push(bb[eg + ee][eb + 4]); | ||
7372 | ej.push(bb[eg + ee][eb]) | ||
7373 | } | ||
7374 | } | ||
7375 | if (aH || dT) { | ||
7376 | dm(ea, "TRIANGLE_STRIP", ej, ef) | ||
7377 | } | ||
7378 | if (ce) { | ||
7379 | bj(ec, "LINE_LOOP", em) | ||
7380 | } | ||
7381 | } | ||
7382 | } | ||
7383 | } else { | ||
7384 | if (dR === 11) { | ||
7385 | if (el > 2) { | ||
7386 | for (eg = 0; eg < 3; eg++) { | ||
7387 | ei = bb[eg]; | ||
7388 | for (ee = 0; ee < 3; ee++) { | ||
7389 | ec.push(ei[ee]) | ||
7390 | } | ||
7391 | } | ||
7392 | for (eg = 0; eg < 3; eg++) { | ||
7393 | ei = bb[eg]; | ||
7394 | for (ee = 9; ee < 13; ee++) { | ||
7395 | em.push(ei[ee]) | ||
7396 | } | ||
7397 | } | ||
7398 | if (ce) { | ||
7399 | bj(ec, "LINE_LOOP", em) | ||
7400 | } | ||
7401 | for (eg = 2; eg + 1 < el; eg++) { | ||
7402 | ec = []; | ||
7403 | em = []; | ||
7404 | ec.push(bb[0][0]); | ||
7405 | ec.push(bb[0][1]); | ||
7406 | ec.push(bb[0][2]); | ||
7407 | em.push(bb[0][9]); | ||
7408 | em.push(bb[0][10]); | ||
7409 | em.push(bb[0][11]); | ||
7410 | em.push(bb[0][12]); | ||
7411 | for (ee = 0; ee < 2; ee++) { | ||
7412 | for (eb = 0; eb < 3; eb++) { | ||
7413 | ec.push(bb[eg + ee][eb]) | ||
7414 | } | ||
7415 | } | ||
7416 | for (ee = 0; ee < 2; ee++) { | ||
7417 | for (eb = 9; eb < 13; eb++) { | ||
7418 | em.push(bb[eg + ee][eb]) | ||
7419 | } | ||
7420 | } | ||
7421 | if (ce) { | ||
7422 | bj(ec, "LINE_STRIP", em) | ||
7423 | } | ||
7424 | } | ||
7425 | if (aH || dT) { | ||
7426 | dm(ea, "TRIANGLE_FAN", ej, ef) | ||
7427 | } | ||
7428 | } | ||
7429 | } else { | ||
7430 | if (dR === 16) { | ||
7431 | for (eg = 0; eg + 3 < el; eg += 4) { | ||
7432 | ec = []; | ||
7433 | for (ee = 0; ee < 4; ee++) { | ||
7434 | ei = bb[eg + ee]; | ||
7435 | for (eb = 0; eb < 3; eb++) { | ||
7436 | ec.push(ei[eb]) | ||
7437 | } | ||
7438 | } | ||
7439 | if (ce) { | ||
7440 | bj(ec, "LINE_LOOP", em) | ||
7441 | } | ||
7442 | if (aH) { | ||
7443 | ea = []; | ||
7444 | ej = []; | ||
7445 | ef = []; | ||
7446 | for (ee = 0; ee < 3; ee++) { | ||
7447 | ea.push(bb[eg][ee]) | ||
7448 | } | ||
7449 | for (ee = 5; ee < 9; ee++) { | ||
7450 | ej.push(bb[eg][ee]) | ||
7451 | } | ||
7452 | for (ee = 0; ee < 3; ee++) { | ||
7453 | ea.push(bb[eg + 1][ee]) | ||
7454 | } | ||
7455 | for (ee = 5; ee < 9; ee++) { | ||
7456 | ej.push(bb[eg + 1][ee]) | ||
7457 | } | ||
7458 | for (ee = 0; ee < 3; ee++) { | ||
7459 | ea.push(bb[eg + 3][ee]) | ||
7460 | } | ||
7461 | for (ee = 5; ee < 9; ee++) { | ||
7462 | ej.push(bb[eg + 3][ee]) | ||
7463 | } | ||
7464 | for (ee = 0; ee < 3; ee++) { | ||
7465 | ea.push(bb[eg + 2][ee]) | ||
7466 | } | ||
7467 | for (ee = 5; ee < 9; ee++) { | ||
7468 | ej.push(bb[eg + 2][ee]) | ||
7469 | } | ||
7470 | if (dT) { | ||
7471 | ef.push(bb[eg + 0][3]); | ||
7472 | ef.push(bb[eg + 0][4]); | ||
7473 | ef.push(bb[eg + 1][3]); | ||
7474 | ef.push(bb[eg + 1][4]); | ||
7475 | ef.push(bb[eg + 3][3]); | ||
7476 | ef.push(bb[eg + 3][4]); | ||
7477 | ef.push(bb[eg + 2][3]); | ||
7478 | ef.push(bb[eg + 2][4]) | ||
7479 | } | ||
7480 | dm(ea, "TRIANGLE_STRIP", ej, ef) | ||
7481 | } | ||
7482 | } | ||
7483 | } else { | ||
7484 | if (dR === 17) { | ||
7485 | var ek = []; | ||
7486 | if (el > 3) { | ||
7487 | for (eg = 0; eg < 2; eg++) { | ||
7488 | ei = bb[eg]; | ||
7489 | for (ee = 0; ee < 3; ee++) { | ||
7490 | ec.push(ei[ee]) | ||
7491 | } | ||
7492 | } | ||
7493 | for (eg = 0; eg < 2; eg++) { | ||
7494 | ei = bb[eg]; | ||
7495 | for (ee = 9; ee < 13; ee++) { | ||
7496 | em.push(ei[ee]) | ||
7497 | } | ||
7498 | } | ||
7499 | bj(ec, "LINE_STRIP", em); | ||
7500 | if (el > 4 && el % 2 > 0) { | ||
7501 | ek = ea.splice(ea.length - 3); | ||
7502 | bb.pop() | ||
7503 | } | ||
7504 | for (eg = 0; eg + 3 < el; eg += 2) { | ||
7505 | ec = []; | ||
7506 | em = []; | ||
7507 | for (ee = 0; ee < 3; ee++) { | ||
7508 | ec.push(bb[eg + 1][ee]) | ||
7509 | } | ||
7510 | for (ee = 0; ee < 3; ee++) { | ||
7511 | ec.push(bb[eg + 3][ee]) | ||
7512 | } | ||
7513 | for (ee = 0; ee < 3; ee++) { | ||
7514 | ec.push(bb[eg + 2][ee]) | ||
7515 | } | ||
7516 | for (ee = 0; ee < 3; ee++) { | ||
7517 | ec.push(bb[eg + 0][ee]) | ||
7518 | } | ||
7519 | for (ee = 9; ee < 13; ee++) { | ||
7520 | em.push(bb[eg + 1][ee]) | ||
7521 | } | ||
7522 | for (ee = 9; ee < 13; ee++) { | ||
7523 | em.push(bb[eg + 3][ee]) | ||
7524 | } | ||
7525 | for (ee = 9; ee < 13; ee++) { | ||
7526 | em.push(bb[eg + 2][ee]) | ||
7527 | } | ||
7528 | for (ee = 9; ee < 13; ee++) { | ||
7529 | em.push(bb[eg + 0][ee]) | ||
7530 | } | ||
7531 | if (ce) { | ||
7532 | bj(ec, "LINE_STRIP", em) | ||
7533 | } | ||
7534 | } | ||
7535 | if (aH || dT) { | ||
7536 | dm(ea, "TRIANGLE_LIST", ej, ef) | ||
7537 | } | ||
7538 | } | ||
7539 | } else { | ||
7540 | if (el === 1) { | ||
7541 | for (ee = 0; ee < 3; ee++) { | ||
7542 | ec.push(bb[0][ee]) | ||
7543 | } | ||
7544 | for (ee = 9; ee < 13; ee++) { | ||
7545 | em.push(bb[0][ee]) | ||
7546 | } | ||
7547 | d1(ec, em) | ||
7548 | } else { | ||
7549 | for (eg = 0; eg < el; eg++) { | ||
7550 | ei = bb[eg]; | ||
7551 | for (ee = 0; ee < 3; ee++) { | ||
7552 | ec.push(ei[ee]) | ||
7553 | } | ||
7554 | for (ee = 5; ee < 9; ee++) { | ||
7555 | em.push(ei[ee]) | ||
7556 | } | ||
7557 | } | ||
7558 | if (ce && ed) { | ||
7559 | bj(ec, "LINE_LOOP", em) | ||
7560 | } else { | ||
7561 | if (ce && !ed) { | ||
7562 | bj(ec, "LINE_STRIP", em) | ||
7563 | } | ||
7564 | } if (aH || dT) { | ||
7565 | dm(ea, "TRIANGLE_FAN", ej, ef) | ||
7566 | } | ||
7567 | } | ||
7568 | } | ||
7569 | } | ||
7570 | } | ||
7571 | } | ||
7572 | } | ||
7573 | } | ||
7574 | } | ||
7575 | dT = false; | ||
7576 | d8.useProgram(dx); | ||
7577 | dZ("usingTexture3d", dx, "uUsingTexture", dT) | ||
7578 | } | ||
7579 | } | ||
7580 | dP = false; | ||
7581 | aa = false; | ||
7582 | cb = []; | ||
7583 | c2 = 0 | ||
7584 | }; | ||
7585 | var aY = function(ed, ec) { | ||
7586 | var ee = 1 / ed; | ||
7587 | var eb = ee * ee; | ||
7588 | var ea = eb * ee; | ||
7589 | ec.set(0, 0, 0, 1, ea, eb, ee, 0, 6 * ea, 2 * eb, 0, 0, 6 * ea, 0, 0, 0) | ||
7590 | }; | ||
7591 | var dr = function() { | ||
7592 | if (!aL) { | ||
7593 | c3 = new aP; | ||
7594 | aL = new aP; | ||
7595 | cM = true | ||
7596 | } | ||
7597 | var ea = aJ; | ||
7598 | c3.set((ea - 1) / 2, (ea + 3) / 2, (-3 - ea) / 2, (1 - ea) / 2, 1 - ea, (-5 - ea) / 2, ea + 2, (ea - 1) / 2, (ea - 1) / 2, 0, (1 - ea) / 2, 0, 0, 1, 0, 0); | ||
7599 | aY(Q, aL); | ||
7600 | if (!cd) { | ||
7601 | aQ = new aP | ||
7602 | } | ||
7603 | aQ.set(c3); | ||
7604 | aQ.preApply(cd); | ||
7605 | aL.apply(c3) | ||
7606 | }; | ||
7607 | bR.prototype.bezierVertex = function() { | ||
7608 | aa = true; | ||
7609 | var ea = []; | ||
7610 | if (du) { | ||
7611 | throw "vertex() must be used at least once before calling bezierVertex()" | ||
7612 | } | ||
7613 | for (var eb = 0; eb < arguments.length; eb++) { | ||
7614 | ea[eb] = arguments[eb] | ||
7615 | } | ||
7616 | bb.push(ea); | ||
7617 | bb[bb.length - 1]["isVert"] = false | ||
7618 | }; | ||
7619 | bB.prototype.bezierVertex = function() { | ||
7620 | aa = true; | ||
7621 | var eh = []; | ||
7622 | if (du) { | ||
7623 | throw "vertex() must be used at least once before calling bezierVertex()" | ||
7624 | } | ||
7625 | if (arguments.length === 9) { | ||
7626 | if (bz === t) { | ||
7627 | bz = new aP | ||
7628 | } | ||
7629 | var em = bb.length - 1; | ||
7630 | aY(cy, bz); | ||
7631 | bz.apply(U); | ||
7632 | var eo = bz.array(); | ||
7633 | var ed = bb[em][0], | ||
7634 | en = bb[em][1], | ||
7635 | eg = bb[em][2]; | ||
7636 | var ej = eo[4] * ed + eo[5] * arguments[0] + eo[6] * arguments[3] + eo[7] * arguments[6]; | ||
7637 | var ei = eo[8] * ed + eo[9] * arguments[0] + eo[10] * arguments[3] + eo[11] * arguments[6]; | ||
7638 | var ef = eo[12] * ed + eo[13] * arguments[0] + eo[14] * arguments[3] + eo[15] * arguments[6]; | ||
7639 | var ep = eo[4] * en + eo[5] * arguments[1] + eo[6] * arguments[4] + eo[7] * arguments[7]; | ||
7640 | var el = eo[8] * en + eo[9] * arguments[1] + eo[10] * arguments[4] + eo[11] * arguments[7]; | ||
7641 | var ek = eo[12] * en + eo[13] * arguments[1] + eo[14] * arguments[4] + eo[15] * arguments[7]; | ||
7642 | var ec = eo[4] * eg + eo[5] * arguments[2] + eo[6] * arguments[5] + eo[7] * arguments[8]; | ||
7643 | var eb = eo[8] * eg + eo[9] * arguments[2] + eo[10] * arguments[5] + eo[11] * arguments[8]; | ||
7644 | var ea = eo[12] * eg + eo[13] * arguments[2] + eo[14] * arguments[5] + eo[15] * arguments[8]; | ||
7645 | for (var ee = 0; ee < cy; ee++) { | ||
7646 | ed += ej; | ||
7647 | ej += ei; | ||
7648 | ei += ef; | ||
7649 | en += ep; | ||
7650 | ep += el; | ||
7651 | el += ek; | ||
7652 | eg += ec; | ||
7653 | ec += eb; | ||
7654 | eb += ea; | ||
7655 | cW.vertex(ed, en, eg) | ||
7656 | } | ||
7657 | cW.vertex(arguments[6], arguments[7], arguments[8]) | ||
7658 | } | ||
7659 | }; | ||
7660 | cW.texture = function(ed) { | ||
7661 | var eb = dY.$ensureContext(); | ||
7662 | if (ed.__texture) { | ||
7663 | eb.bindTexture(eb.TEXTURE_2D, ed.__texture) | ||
7664 | } else { | ||
7665 | if (ed.localName === "canvas") { | ||
7666 | eb.bindTexture(eb.TEXTURE_2D, c7); | ||
7667 | eb.texImage2D(eb.TEXTURE_2D, 0, eb.RGBA, eb.RGBA, eb.UNSIGNED_BYTE, ed); | ||
7668 | eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MAG_FILTER, eb.LINEAR); | ||
7669 | eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MIN_FILTER, eb.LINEAR); | ||
7670 | eb.generateMipmap(eb.TEXTURE_2D); | ||
7671 | cs.width = ed.width; | ||
7672 | cs.height = ed.height | ||
7673 | } else { | ||
7674 | var ec = eb.createTexture(), | ||
7675 | ef = d.createElement("canvas"), | ||
7676 | ea = ef.getContext("2d"), | ||
7677 | ee; | ||
7678 | if (ed.width & ed.width - 1 === 0) { | ||
7679 | ef.width = ed.width | ||
7680 | } else { | ||
7681 | ee = 1; | ||
7682 | while (ee < ed.width) { | ||
7683 | ee *= 2 | ||
7684 | } | ||
7685 | ef.width = ee | ||
7686 | } if (ed.height & ed.height - 1 === 0) { | ||
7687 | ef.height = ed.height | ||
7688 | } else { | ||
7689 | ee = 1; | ||
7690 | while (ee < ed.height) { | ||
7691 | ee *= 2 | ||
7692 | } | ||
7693 | ef.height = ee | ||
7694 | } | ||
7695 | ea.drawImage(ed.sourceImg, 0, 0, ed.width, ed.height, 0, 0, ef.width, ef.height); | ||
7696 | eb.bindTexture(eb.TEXTURE_2D, ec); | ||
7697 | eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MIN_FILTER, eb.LINEAR_MIPMAP_LINEAR); | ||
7698 | eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MAG_FILTER, eb.LINEAR); | ||
7699 | eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_WRAP_T, eb.CLAMP_TO_EDGE); | ||
7700 | eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_WRAP_S, eb.CLAMP_TO_EDGE); | ||
7701 | eb.texImage2D(eb.TEXTURE_2D, 0, eb.RGBA, eb.RGBA, eb.UNSIGNED_BYTE, ef); | ||
7702 | eb.generateMipmap(eb.TEXTURE_2D); | ||
7703 | ed.__texture = ec; | ||
7704 | cs.width = ed.width; | ||
7705 | cs.height = ed.height | ||
7706 | } | ||
7707 | } | ||
7708 | dT = true; | ||
7709 | eb.useProgram(dx); | ||
7710 | dZ("usingTexture3d", dx, "uUsingTexture", dT) | ||
7711 | }; | ||
7712 | cW.textureMode = function(ea) { | ||
7713 | d4 = ea | ||
7714 | }; | ||
7715 | var ar = function(ev, eg, em, et, ef, el, er, ee, ek, ep, ed, ei) { | ||
7716 | var ew = et; | ||
7717 | var eh = ef; | ||
7718 | var en = el; | ||
7719 | var ej = aL.array(); | ||
7720 | var eu = ej[4] * ev + ej[5] * et + ej[6] * er + ej[7] * ep; | ||
7721 | var es = ej[8] * ev + ej[9] * et + ej[10] * er + ej[11] * ep; | ||
7722 | var eq = ej[12] * ev + ej[13] * et + ej[14] * er + ej[15] * ep; | ||
7723 | var ez = ej[4] * eg + ej[5] * ef + ej[6] * ee + ej[7] * ed; | ||
7724 | var ey = ej[8] * eg + ej[9] * ef + ej[10] * ee + ej[11] * ed; | ||
7725 | var ex = ej[12] * eg + ej[13] * ef + ej[14] * ee + ej[15] * ed; | ||
7726 | var ec = ej[4] * em + ej[5] * el + ej[6] * ek + ej[7] * ei; | ||
7727 | var eb = ej[8] * em + ej[9] * el + ej[10] * ek + ej[11] * ei; | ||
7728 | var ea = ej[12] * em + ej[13] * el + ej[14] * ek + ej[15] * ei; | ||
7729 | cW.vertex(ew, eh, en); | ||
7730 | for (var eo = 0; eo < Q; eo++) { | ||
7731 | ew += eu; | ||
7732 | eu += es; | ||
7733 | es += eq; | ||
7734 | eh += ez; | ||
7735 | ez += ey; | ||
7736 | ey += ex; | ||
7737 | en += ec; | ||
7738 | ec += eb; | ||
7739 | eb += ea; | ||
7740 | cW.vertex(ew, eh, en) | ||
7741 | } | ||
7742 | }; | ||
7743 | bR.prototype.curveVertex = function(ea, eb) { | ||
7744 | dP = true; | ||
7745 | cW.vertex(ea, eb) | ||
7746 | }; | ||
7747 | bB.prototype.curveVertex = function(ea, ed, ec) { | ||
7748 | dP = true; | ||
7749 | if (!cM) { | ||
7750 | dr() | ||
7751 | } | ||
7752 | var eb = []; | ||
7753 | eb[0] = ea; | ||
7754 | eb[1] = ed; | ||
7755 | eb[2] = ec; | ||
7756 | cb.push(eb); | ||
7757 | c2++; | ||
7758 | if (c2 > 3) { | ||
7759 | ar(cb[c2 - 4][0], cb[c2 - 4][1], cb[c2 - 4][2], cb[c2 - 3][0], cb[c2 - 3][1], cb[c2 - 3][2], cb[c2 - 2][0], cb[c2 - 2][1], cb[c2 - 2][2], cb[c2 - 1][0], cb[c2 - 1][1], cb[c2 - 1][2]) | ||
7760 | } | ||
7761 | }; | ||
7762 | bR.prototype.curve = function(ef, eh, ed, eg, eb, ee, ea, ec) { | ||
7763 | cW.beginShape(); | ||
7764 | cW.curveVertex(ef, eh); | ||
7765 | cW.curveVertex(ed, eg); | ||
7766 | cW.curveVertex(eb, ee); | ||
7767 | cW.curveVertex(ea, ec); | ||
7768 | cW.endShape() | ||
7769 | }; | ||
7770 | bB.prototype.curve = function(ec, ek, eg, eb, ej, ef, ea, ei, ee, el, eh, ed) { | ||
7771 | if (ed !== t) { | ||
7772 | cW.beginShape(); | ||
7773 | cW.curveVertex(ec, ek, eg); | ||
7774 | cW.curveVertex(eb, ej, ef); | ||
7775 | cW.curveVertex(ea, ei, ee); | ||
7776 | cW.curveVertex(el, eh, ed); | ||
7777 | cW.endShape(); | ||
7778 | return | ||
7779 | } | ||
7780 | cW.beginShape(); | ||
7781 | cW.curveVertex(ec, ek); | ||
7782 | cW.curveVertex(eg, eb); | ||
7783 | cW.curveVertex(ej, ef); | ||
7784 | cW.curveVertex(ea, ei); | ||
7785 | cW.endShape() | ||
7786 | }; | ||
7787 | cW.curveTightness = function(ea) { | ||
7788 | aJ = ea | ||
7789 | }; | ||
7790 | cW.curveDetail = function(ea) { | ||
7791 | Q = ea; | ||
7792 | dr() | ||
7793 | }; | ||
7794 | cW.rectMode = function(ea) { | ||
7795 | bK = ea | ||
7796 | }; | ||
7797 | cW.imageMode = function(ea) { | ||
7798 | switch (ea) { | ||
7799 | case 0: | ||
7800 | bk = aZ; | ||
7801 | break; | ||
7802 | case 1: | ||
7803 | bk = b1; | ||
7804 | break; | ||
7805 | case 3: | ||
7806 | bk = aN; | ||
7807 | break; | ||
7808 | default: | ||
7809 | throw "Invalid imageMode" | ||
7810 | } | ||
7811 | }; | ||
7812 | cW.ellipseMode = function(ea) { | ||
7813 | cN = ea | ||
7814 | }; | ||
7815 | cW.arc = function(em, ek, ed, eo, ec, el) { | ||
7816 | if (ed <= 0 || el < ec) { | ||
7817 | return | ||
7818 | } | ||
7819 | if (cN === 1) { | ||
7820 | ed = ed - em; | ||
7821 | eo = eo - ek | ||
7822 | } else { | ||
7823 | if (cN === 2) { | ||
7824 | em = em - ed; | ||
7825 | ek = ek - eo; | ||
7826 | ed = ed * 2; | ||
7827 | eo = eo * 2 | ||
7828 | } else { | ||
7829 | if (cN === 3) { | ||
7830 | em = em - ed / 2; | ||
7831 | ek = ek - eo / 2 | ||
7832 | } | ||
7833 | } | ||
7834 | } | ||
7835 | while (ec < 0) { | ||
7836 | ec += 6.283185307179586; | ||
7837 | el += 6.283185307179586 | ||
7838 | } | ||
7839 | if (el - ec > 6.283185307179586) { | ||
7840 | ec = 0; | ||
7841 | el = 6.283185307179586 | ||
7842 | } | ||
7843 | var en = ed / 2, | ||
7844 | ep = eo / 2, | ||
7845 | eh = em + en, | ||
7846 | ef = ek + ep, | ||
7847 | eb = 0 | 0.5 + ec * cW.RAD_TO_DEG * 2, | ||
7848 | ej = 0 | 0.5 + el * cW.RAD_TO_DEG * 2, | ||
7849 | ei, eg; | ||
7850 | if (aH) { | ||
7851 | var ee = ce; | ||
7852 | ce = false; | ||
7853 | cW.beginShape(); | ||
7854 | cW.vertex(eh, ef); | ||
7855 | for (ei = eb; ei <= ej; ei++) { | ||
7856 | eg = ei % 720; | ||
7857 | cW.vertex(eh + bl[eg] * en, ef + ah[eg] * ep) | ||
7858 | } | ||
7859 | cW.endShape(2); | ||
7860 | ce = ee | ||
7861 | } | ||
7862 | if (ce) { | ||
7863 | var ea = aH; | ||
7864 | aH = false; | ||
7865 | cW.beginShape(); | ||
7866 | for (ei = eb; ei <= ej; ei++) { | ||
7867 | eg = ei % 720; | ||
7868 | cW.vertex(eh + bl[eg] * en, ef + ah[eg] * ep) | ||
7869 | } | ||
7870 | cW.endShape(); | ||
7871 | aH = ea | ||
7872 | } | ||
7873 | }; | ||
7874 | bR.prototype.line = function(eb, ei, ea, eg) { | ||
7875 | if (!ce) { | ||
7876 | return | ||
7877 | } | ||
7878 | eb = q.round(eb); | ||
7879 | ea = q.round(ea); | ||
7880 | ei = q.round(ei); | ||
7881 | eg = q.round(eg); | ||
7882 | if (eb === ea && ei === eg) { | ||
7883 | cW.point(eb, ei); | ||
7884 | return | ||
7885 | } | ||
7886 | var ec = t, | ||
7887 | ej = t, | ||
7888 | ef = true, | ||
7889 | eh = dJ.array(), | ||
7890 | ed = [1, 0, 0, 0, 1, 0]; | ||
7891 | for (var ee = 0; ee < 6 && ef; ee++) { | ||
7892 | ef = eh[ee] === ed[ee] | ||
7893 | } | ||
7894 | if (ef) { | ||
7895 | if (eb === ea) { | ||
7896 | if (ei > eg) { | ||
7897 | ec = ei; | ||
7898 | ei = eg; | ||
7899 | eg = ec | ||
7900 | } | ||
7901 | eg++; | ||
7902 | if (dW % 2 === 1) { | ||
7903 | d8.translate(0.5, 0) | ||
7904 | } | ||
7905 | } else { | ||
7906 | if (ei === eg) { | ||
7907 | if (eb > ea) { | ||
7908 | ec = eb; | ||
7909 | eb = ea; | ||
7910 | ea = ec | ||
7911 | } | ||
7912 | ea++; | ||
7913 | if (dW % 2 === 1) { | ||
7914 | d8.translate(0, 0.5) | ||
7915 | } | ||
7916 | } | ||
7917 | } if (dW === 1) { | ||
7918 | ej = d8.lineCap; | ||
7919 | d8.lineCap = "butt" | ||
7920 | } | ||
7921 | } | ||
7922 | d8.beginPath(); | ||
7923 | d8.moveTo(eb || 0, ei || 0); | ||
7924 | d8.lineTo(ea || 0, eg || 0); | ||
7925 | dd(); | ||
7926 | if (ef) { | ||
7927 | if (eb === ea && dW % 2 === 1) { | ||
7928 | d8.translate(-0.5, 0) | ||
7929 | } else { | ||
7930 | if (ei === eg && dW % 2 === 1) { | ||
7931 | d8.translate(0, -0.5) | ||
7932 | } | ||
7933 | } if (dW === 1) { | ||
7934 | d8.lineCap = ej | ||
7935 | } | ||
7936 | } | ||
7937 | }; | ||
7938 | bB.prototype.line = function(ec, ef, eh, eb, ed, eg) { | ||
7939 | if (ed === t || eg === t) { | ||
7940 | eg = 0; | ||
7941 | ed = eb; | ||
7942 | eb = eh; | ||
7943 | eh = 0 | ||
7944 | } | ||
7945 | if (ec === eb && ef === ed && eh === eg) { | ||
7946 | cW.point(ec, ef, eh); | ||
7947 | return | ||
7948 | } | ||
7949 | var ee = [ec, ef, eh, eb, ed, eg]; | ||
7950 | var ea = new aP; | ||
7951 | ea.scale(1, -1, 1); | ||
7952 | ea.apply(dJ.array()); | ||
7953 | ea.transpose(); | ||
7954 | if (dW > 0 && ce) { | ||
7955 | d8.useProgram(dQ); | ||
7956 | a9("uModel2d", dQ, "uModel", false, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); | ||
7957 | a9("uView2d", dQ, "uView", false, ea.array()); | ||
7958 | d2("uColor2d", dQ, "uColor", c0); | ||
7959 | dZ("uIsDrawingText", dQ, "uIsDrawingText", false); | ||
7960 | dc("aVertex2d", dQ, "aVertex", 3, b8); | ||
7961 | cg("aTextureCoord2d", dQ, "aTextureCoord"); | ||
7962 | d8.bufferData(d8.ARRAY_BUFFER, new e(ee), d8.STREAM_DRAW); | ||
7963 | d8.drawArrays(d8.LINES, 0, 2) | ||
7964 | } | ||
7965 | }; | ||
7966 | bR.prototype.bezier = function() { | ||
7967 | if (arguments.length !== 8) { | ||
7968 | throw "You must use 8 parameters for bezier() in 2D mode" | ||
7969 | } | ||
7970 | cW.beginShape(); | ||
7971 | cW.vertex(arguments[0], arguments[1]); | ||
7972 | cW.bezierVertex(arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7]); | ||
7973 | cW.endShape() | ||
7974 | }; | ||
7975 | bB.prototype.bezier = function() { | ||
7976 | if (arguments.length !== 12) { | ||
7977 | throw "You must use 12 parameters for bezier() in 3D mode" | ||
7978 | } | ||
7979 | cW.beginShape(); | ||
7980 | cW.vertex(arguments[0], arguments[1], arguments[2]); | ||
7981 | cW.bezierVertex(arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10], arguments[11]); | ||
7982 | cW.endShape() | ||
7983 | }; | ||
7984 | cW.bezierDetail = function(ea) { | ||
7985 | cy = ea | ||
7986 | }; | ||
7987 | cW.bezierPoint = function(eb, ea, ee, ed, ec) { | ||
7988 | return (1 - ec) * (1 - ec) * (1 - ec) * eb + 3 * (1 - ec) * (1 - ec) * ec * ea + 3 * (1 - ec) * ec * ec * ee + ec * ec * ec * ed | ||
7989 | }; | ||
7990 | cW.bezierTangent = function(eb, ea, ee, ed, ec) { | ||
7991 | return 3 * ec * ec * (-eb + 3 * ea - 3 * ee + ed) + 6 * ec * (eb - 2 * ea + ee) + 3 * (-eb + ea) | ||
7992 | }; | ||
7993 | cW.curvePoint = function(eb, ea, ee, ed, ec) { | ||
7994 | return 0.5 * (2 * ea + (-eb + ee) * ec + (2 * eb - 5 * ea + 4 * ee - ed) * ec * ec + (-eb + 3 * ea - 3 * ee + ed) * ec * ec * ec) | ||
7995 | }; | ||
7996 | cW.curveTangent = function(eb, ea, ee, ed, ec) { | ||
7997 | return 0.5 * (-eb + ee + 2 * (2 * eb - 5 * ea + 4 * ee - ed) * ec + 3 * (-eb + 3 * ea - 3 * ee + ed) * ec * ec) | ||
7998 | }; | ||
7999 | cW.triangle = function(ed, ef, eb, ee, ea, ec) { | ||
8000 | cW.beginShape(9); | ||
8001 | cW.vertex(ed, ef, 0); | ||
8002 | cW.vertex(eb, ee, 0); | ||
8003 | cW.vertex(ea, ec, 0); | ||
8004 | cW.endShape() | ||
8005 | }; | ||
8006 | cW.quad = function(ef, eh, ed, eg, eb, ee, ea, ec) { | ||
8007 | cW.beginShape(16); | ||
8008 | cW.vertex(ef, eh, 0); | ||
8009 | cW.vertex(ed, eg, 0); | ||
8010 | cW.vertex(eb, ee, 0); | ||
8011 | cW.vertex(ea, ec, 0); | ||
8012 | cW.endShape() | ||
8013 | }; | ||
8014 | var bN = function(eg, ef, ea, eh, ej, ee, ei, eb) { | ||
8015 | if (eb === t) { | ||
8016 | ee = ej; | ||
8017 | ei = ej; | ||
8018 | eb = ej | ||
8019 | } | ||
8020 | var ec = ea / 2, | ||
8021 | ed = eh / 2; | ||
8022 | if (ej > ec || ej > ed) { | ||
8023 | ej = q.min(ec, ed) | ||
8024 | } | ||
8025 | if (ee > ec || ee > ed) { | ||
8026 | ee = q.min(ec, ed) | ||
8027 | } | ||
8028 | if (ei > ec || ei > ed) { | ||
8029 | ei = q.min(ec, ed) | ||
8030 | } | ||
8031 | if (eb > ec || eb > ed) { | ||
8032 | eb = q.min(ec, ed) | ||
8033 | } | ||
8034 | if (!aH || ce) { | ||
8035 | d8.translate(0.5, 0.5) | ||
8036 | } | ||
8037 | d8.beginPath(); | ||
8038 | d8.moveTo(eg + ej, ef); | ||
8039 | d8.lineTo(eg + ea - ee, ef); | ||
8040 | d8.quadraticCurveTo(eg + ea, ef, eg + ea, ef + ee); | ||
8041 | d8.lineTo(eg + ea, ef + eh - ei); | ||
8042 | d8.quadraticCurveTo(eg + ea, ef + eh, eg + ea - ei, ef + eh); | ||
8043 | d8.lineTo(eg + eb, ef + eh); | ||
8044 | d8.quadraticCurveTo(eg, ef + eh, eg, ef + eh - eb); | ||
8045 | d8.lineTo(eg, ef + ej); | ||
8046 | d8.quadraticCurveTo(eg, ef, eg + ej, ef); | ||
8047 | if (!aH || ce) { | ||
8048 | d8.translate(-0.5, -0.5) | ||
8049 | } | ||
8050 | bn(); | ||
8051 | dd() | ||
8052 | }; | ||
8053 | bR.prototype.rect = function(eb, eh, ee, ea, ec, ef, ed, eg) { | ||
8054 | if (!ee && !ea) { | ||
8055 | return | ||
8056 | } | ||
8057 | if (bK === 1) { | ||
8058 | ee -= eb; | ||
8059 | ea -= eh | ||
8060 | } else { | ||
8061 | if (bK === 2) { | ||
8062 | ee *= 2; | ||
8063 | ea *= 2; | ||
8064 | eb -= ee / 2; | ||
8065 | eh -= ea / 2 | ||
8066 | } else { | ||
8067 | if (bK === 3) { | ||
8068 | eb -= ee / 2; | ||
8069 | eh -= ea / 2 | ||
8070 | } | ||
8071 | } | ||
8072 | } | ||
8073 | eb = q.round(eb); | ||
8074 | eh = q.round(eh); | ||
8075 | ee = q.round(ee); | ||
8076 | ea = q.round(ea); | ||
8077 | if (ec !== t) { | ||
8078 | bN(eb, eh, ee, ea, ec, ef, ed, eg); | ||
8079 | return | ||
8080 | } | ||
8081 | if (ce && dW % 2 === 1) { | ||
8082 | d8.translate(0.5, 0.5) | ||
8083 | } | ||
8084 | d8.beginPath(); | ||
8085 | d8.rect(eb, eh, ee, ea); | ||
8086 | bn(); | ||
8087 | dd(); | ||
8088 | if (ce && dW % 2 === 1) { | ||
8089 | d8.translate(-0.5, -0.5) | ||
8090 | } | ||
8091 | }; | ||
8092 | bB.prototype.rect = function(ei, eh, ea, ek, em, ef, el, eb) { | ||
8093 | if (em !== t) { | ||
8094 | throw "rect() with rounded corners is not supported in 3D mode" | ||
8095 | } | ||
8096 | if (bK === 1) { | ||
8097 | ea -= ei; | ||
8098 | ek -= eh | ||
8099 | } else { | ||
8100 | if (bK === 2) { | ||
8101 | ea *= 2; | ||
8102 | ek *= 2; | ||
8103 | ei -= ea / 2; | ||
8104 | eh -= ek / 2 | ||
8105 | } else { | ||
8106 | if (bK === 3) { | ||
8107 | ei -= ea / 2; | ||
8108 | eh -= ek / 2 | ||
8109 | } | ||
8110 | } | ||
8111 | } | ||
8112 | var ee = new aP; | ||
8113 | ee.translate(ei, eh, 0); | ||
8114 | ee.scale(ea, ek, 1); | ||
8115 | ee.transpose(); | ||
8116 | var eg = new aP; | ||
8117 | eg.scale(1, -1, 1); | ||
8118 | eg.apply(dJ.array()); | ||
8119 | eg.transpose(); | ||
8120 | if (dW > 0 && ce) { | ||
8121 | d8.useProgram(dQ); | ||
8122 | a9("uModel2d", dQ, "uModel", false, ee.array()); | ||
8123 | a9("uView2d", dQ, "uView", false, eg.array()); | ||
8124 | d2("uColor2d", dQ, "uColor", c0); | ||
8125 | dZ("uIsDrawingText2d", dQ, "uIsDrawingText", false); | ||
8126 | dc("aVertex2d", dQ, "aVertex", 3, aB); | ||
8127 | cg("aTextureCoord2d", dQ, "aTextureCoord"); | ||
8128 | d8.drawArrays(d8.LINE_LOOP, 0, ak.length / 3) | ||
8129 | } | ||
8130 | if (aH) { | ||
8131 | d8.useProgram(dx); | ||
8132 | a9("uModel3d", dx, "uModel", false, ee.array()); | ||
8133 | a9("uView3d", dx, "uView", false, eg.array()); | ||
8134 | d8.enable(d8.POLYGON_OFFSET_FILL); | ||
8135 | d8.polygonOffset(1, 1); | ||
8136 | d2("color3d", dx, "uColor", bo); | ||
8137 | if (dL > 0) { | ||
8138 | var ej = new aP; | ||
8139 | ej.set(eg); | ||
8140 | var ec = new aP; | ||
8141 | ec.set(ee); | ||
8142 | ej.mult(ec); | ||
8143 | var ed = new aP; | ||
8144 | ed.set(ej); | ||
8145 | ed.invert(); | ||
8146 | ed.transpose(); | ||
8147 | a9("uNormalTransform3d", dx, "uNormalTransform", false, ed.array()); | ||
8148 | dc("aNormal3d", dx, "aNormal", 3, b2) | ||
8149 | } else { | ||
8150 | cg("normal3d", dx, "aNormal") | ||
8151 | } | ||
8152 | dc("vertex3d", dx, "aVertex", 3, aB); | ||
8153 | d8.drawArrays(d8.TRIANGLE_FAN, 0, ak.length / 3); | ||
8154 | d8.disable(d8.POLYGON_OFFSET_FILL) | ||
8155 | } | ||
8156 | }; | ||
8157 | bR.prototype.ellipse = function(eg, ef, eb, ei) { | ||
8158 | eg = eg || 0; | ||
8159 | ef = ef || 0; | ||
8160 | if (eb <= 0 && ei <= 0) { | ||
8161 | return | ||
8162 | } | ||
8163 | if (cN === 2) { | ||
8164 | eb *= 2; | ||
8165 | ei *= 2 | ||
8166 | } else { | ||
8167 | if (cN === 1) { | ||
8168 | eb = eb - eg; | ||
8169 | ei = ei - ef; | ||
8170 | eg += eb / 2; | ||
8171 | ef += ei / 2 | ||
8172 | } else { | ||
8173 | if (cN === 0) { | ||
8174 | eg += eb / 2; | ||
8175 | ef += ei / 2 | ||
8176 | } | ||
8177 | } | ||
8178 | } if (eb === ei) { | ||
8179 | d8.beginPath(); | ||
8180 | d8.arc(eg, ef, eb / 2, 0, 6.283185307179586, false); | ||
8181 | bn(); | ||
8182 | dd() | ||
8183 | } else { | ||
8184 | var eh = eb / 2, | ||
8185 | ee = ei / 2, | ||
8186 | ea = 0.5522847498307933, | ||
8187 | ed = ea * eh, | ||
8188 | ec = ea * ee; | ||
8189 | cW.beginShape(); | ||
8190 | cW.vertex(eg + eh, ef); | ||
8191 | cW.bezierVertex(eg + eh, ef - ec, eg + ed, ef - ee, eg, ef - ee); | ||
8192 | cW.bezierVertex(eg - ed, ef - ee, eg - eh, ef - ec, eg - eh, ef); | ||
8193 | cW.bezierVertex(eg - eh, ef + ec, eg - ed, ef + ee, eg, ef + ee); | ||
8194 | cW.bezierVertex(eg + ed, ef + ee, eg + eh, ef + ec, eg + eh, ef); | ||
8195 | cW.endShape() | ||
8196 | } | ||
8197 | }; | ||
8198 | bB.prototype.ellipse = function(en, em, ec, ep) { | ||
8199 | en = en || 0; | ||
8200 | em = em || 0; | ||
8201 | if (ec <= 0 && ep <= 0) { | ||
8202 | return | ||
8203 | } | ||
8204 | if (cN === 2) { | ||
8205 | ec *= 2; | ||
8206 | ep *= 2 | ||
8207 | } else { | ||
8208 | if (cN === 1) { | ||
8209 | ec = ec - en; | ||
8210 | ep = ep - em; | ||
8211 | en += ec / 2; | ||
8212 | em += ep / 2 | ||
8213 | } else { | ||
8214 | if (cN === 0) { | ||
8215 | en += ec / 2; | ||
8216 | em += ep / 2 | ||
8217 | } | ||
8218 | } | ||
8219 | } | ||
8220 | var eo = ec / 2, | ||
8221 | ej = ep / 2, | ||
8222 | ea = 0.5522847498307933, | ||
8223 | ee = ea * eo, | ||
8224 | ed = ea * ej; | ||
8225 | cW.beginShape(); | ||
8226 | cW.vertex(en + eo, em); | ||
8227 | cW.bezierVertex(en + eo, em - ed, 0, en + ee, em - ej, 0, en, em - ej, 0); | ||
8228 | cW.bezierVertex(en - ee, em - ej, 0, en - eo, em - ed, 0, en - eo, em, 0); | ||
8229 | cW.bezierVertex(en - eo, em + ed, 0, en - ee, em + ej, 0, en, em + ej, 0); | ||
8230 | cW.bezierVertex(en + ee, em + ej, 0, en + eo, em + ed, 0, en + eo, em, 0); | ||
8231 | cW.endShape(); | ||
8232 | if (aH) { | ||
8233 | var ef = 0, | ||
8234 | ek = 0, | ||
8235 | eh, eg; | ||
8236 | for (eh = 0; eh < bb.length; eh++) { | ||
8237 | ef += bb[eh][0]; | ||
8238 | ek += bb[eh][1] | ||
8239 | } | ||
8240 | ef /= bb.length; | ||
8241 | ek /= bb.length; | ||
8242 | var ei = [], | ||
8243 | eb = [], | ||
8244 | el = []; | ||
8245 | ei[0] = ef; | ||
8246 | ei[1] = ek; | ||
8247 | ei[2] = 0; | ||
8248 | ei[3] = 0; | ||
8249 | ei[4] = 0; | ||
8250 | ei[5] = bo[0]; | ||
8251 | ei[6] = bo[1]; | ||
8252 | ei[7] = bo[2]; | ||
8253 | ei[8] = bo[3]; | ||
8254 | ei[9] = c0[0]; | ||
8255 | ei[10] = c0[1]; | ||
8256 | ei[11] = c0[2]; | ||
8257 | ei[12] = c0[3]; | ||
8258 | ei[13] = a8; | ||
8259 | ei[14] = a7; | ||
8260 | ei[15] = a6; | ||
8261 | bb.unshift(ei); | ||
8262 | for (eh = 0; eh < bb.length; eh++) { | ||
8263 | for (eg = 0; eg < 3; eg++) { | ||
8264 | eb.push(bb[eh][eg]) | ||
8265 | } | ||
8266 | for (eg = 5; eg < 9; eg++) { | ||
8267 | el.push(bb[eh][eg]) | ||
8268 | } | ||
8269 | } | ||
8270 | dm(eb, "TRIANGLE_FAN", el) | ||
8271 | } | ||
8272 | }; | ||
8273 | cW.normal = function(ea, ec, eb) { | ||
8274 | if (arguments.length !== 3 || !(typeof ea === "number" && typeof ec === "number" && typeof eb === "number")) { | ||
8275 | throw "normal() requires three numeric arguments." | ||
8276 | } | ||
8277 | a8 = ea; | ||
8278 | a7 = ec; | ||
8279 | a6 = eb; | ||
8280 | if (dR !== 0) { | ||
8281 | if (a2 === 0) { | ||
8282 | a2 = 1 | ||
8283 | } else { | ||
8284 | if (a2 === 1) { | ||
8285 | a2 = 2 | ||
8286 | } | ||
8287 | } | ||
8288 | } | ||
8289 | }; | ||
8290 | cW.save = function(eb, ea) { | ||
8291 | if (ea !== t) { | ||
8292 | return D.open(ea.toDataURL(), "_blank") | ||
8293 | } | ||
8294 | return D.open(cW.externals.canvas.toDataURL(), "_blank") | ||
8295 | }; | ||
8296 | var cw = 0; | ||
8297 | cW.saveFrame = function(ea) { | ||
8298 | if (ea === t) { | ||
8299 | ea = "screen-####.png" | ||
8300 | } | ||
8301 | var eb = ea.replace(/#+/, function(ed) { | ||
8302 | var ec = "" + cw++; | ||
8303 | while (ec.length < ed.length) { | ||
8304 | ec = "0" + ec | ||
8305 | } | ||
8306 | return ec | ||
8307 | }); | ||
8308 | cW.save(eb) | ||
8309 | }; | ||
8310 | var cc = d.createElement("canvas").getContext("2d"); | ||
8311 | var X = [t, t, t]; | ||
8312 | |||
8313 | function by(eh, eb, eg) { | ||
8314 | var ed = X.shift(); | ||
8315 | if (ed === t) { | ||
8316 | ed = {}; | ||
8317 | ed.canvas = d.createElement("canvas"); | ||
8318 | ed.context = ed.canvas.getContext("2d") | ||
8319 | } | ||
8320 | X.push(ed); | ||
8321 | var ec = ed.canvas, | ||
8322 | ee = ed.context, | ||
8323 | ef = eb || eh.width, | ||
8324 | ea = eg || eh.height; | ||
8325 | ec.width = ef; | ||
8326 | ec.height = ea; | ||
8327 | if (!eh) { | ||
8328 | ee.clearRect(0, 0, ef, ea) | ||
8329 | } else { | ||
8330 | if ("data" in eh) { | ||
8331 | ee.putImageData(eh, 0, 0) | ||
8332 | } else { | ||
8333 | ee.clearRect(0, 0, ef, ea); | ||
8334 | ee.drawImage(eh, 0, 0, ef, ea) | ||
8335 | } | ||
8336 | } | ||
8337 | return ed | ||
8338 | } | ||
8339 | |||
8340 | function b0(ea) { | ||
8341 | return { | ||
8342 | getLength: function(eb) { | ||
8343 | return function() { | ||
8344 | if (eb.isRemote) { | ||
8345 | throw "Image is loaded remotely. Cannot get length." | ||
8346 | } else { | ||
8347 | return eb.imageData.data.length ? eb.imageData.data.length / 4 : 0 | ||
8348 | } | ||
8349 | } | ||
8350 | }(ea), | ||
8351 | getPixel: function(eb) { | ||
8352 | return function(ec) { | ||
8353 | var ee = ec * 4, | ||
8354 | ed = eb.imageData.data; | ||
8355 | if (eb.isRemote) { | ||
8356 | throw "Image is loaded remotely. Cannot get pixels." | ||
8357 | } | ||
8358 | return (ed[ee + 3] & 255) << 24 | (ed[ee] & 255) << 16 | (ed[ee + 1] & 255) << 8 | ed[ee + 2] & 255 | ||
8359 | } | ||
8360 | }(ea), | ||
8361 | setPixel: function(eb) { | ||
8362 | return function(ec, ef) { | ||
8363 | var ee = ec * 4, | ||
8364 | ed = eb.imageData.data; | ||
8365 | if (eb.isRemote) { | ||
8366 | throw "Image is loaded remotely. Cannot set pixel." | ||
8367 | } | ||
8368 | ed[ee + 0] = (ef >> 16) & 255; | ||
8369 | ed[ee + 1] = (ef >> 8) & 255; | ||
8370 | ed[ee + 2] = ef & 255; | ||
8371 | ed[ee + 3] = (ef >> 24) & 255; | ||
8372 | eb.__isDirty = true | ||
8373 | } | ||
8374 | }(ea), | ||
8375 | toArray: function(eb) { | ||
8376 | return function() { | ||
8377 | var ec = [], | ||
8378 | ef = eb.imageData.data, | ||
8379 | ee = eb.width * eb.height; | ||
8380 | if (eb.isRemote) { | ||
8381 | throw "Image is loaded remotely. Cannot get pixels." | ||
8382 | } | ||
8383 | for (var ed = 0, eg = 0; ed < ee; ed++, eg += 4) { | ||
8384 | ec.push((ef[eg + 3] & 255) << 24 | (ef[eg] & 255) << 16 | (ef[eg + 1] & 255) << 8 | ef[eg + 2] & 255) | ||
8385 | } | ||
8386 | return ec | ||
8387 | } | ||
8388 | }(ea), | ||
8389 | set: function(eb) { | ||
8390 | return function(ec) { | ||
8391 | var eg, ef, eh; | ||
8392 | if (this.isRemote) { | ||
8393 | throw "Image is loaded remotely. Cannot set pixels." | ||
8394 | } | ||
8395 | ef = eb.imageData.data; | ||
8396 | for (var ed = 0, ee = ec.length; ed < ee; ed++) { | ||
8397 | eh = ec[ed]; | ||
8398 | eg = ed * 4; | ||
8399 | ef[eg + 0] = (eh >> 16) & 255; | ||
8400 | ef[eg + 1] = (eh >> 8) & 255; | ||
8401 | ef[eg + 2] = eh & 255; | ||
8402 | ef[eg + 3] = (eh >> 24) & 255 | ||
8403 | } | ||
8404 | eb.__isDirty = true | ||
8405 | } | ||
8406 | }(ea) | ||
8407 | } | ||
8408 | } | ||
8409 | var cG = function(ed, eg, ee) { | ||
8410 | this.__isDirty = false; | ||
8411 | if (ed instanceof HTMLImageElement) { | ||
8412 | this.fromHTMLImageData(ed) | ||
8413 | } else { | ||
8414 | if (eg || ee) { | ||
8415 | this.width = ed || 1; | ||
8416 | this.height = eg || 1; | ||
8417 | var eb = this.sourceImg = d.createElement("canvas"); | ||
8418 | eb.width = this.width; | ||
8419 | eb.height = this.height; | ||
8420 | var eh = this.imageData = eb.getContext("2d").createImageData(this.width, this.height); | ||
8421 | this.format = ee === 2 || ee === 4 ? ee : 1; | ||
8422 | if (this.format === 1) { | ||
8423 | for (var ec = 3, ef = this.imageData.data, ea = ef.length; ec < ea; ec += 4) { | ||
8424 | ef[ec] = 255 | ||
8425 | } | ||
8426 | } | ||
8427 | this.__isDirty = true; | ||
8428 | this.updatePixels() | ||
8429 | } else { | ||
8430 | this.width = 0; | ||
8431 | this.height = 0; | ||
8432 | this.imageData = cc.createImageData(1, 1); | ||
8433 | this.format = 2 | ||
8434 | } | ||
8435 | } | ||
8436 | this.pixels = b0(this) | ||
8437 | }; | ||
8438 | cG.prototype = { | ||
8439 | __isPImage: true, | ||
8440 | updatePixels: function() { | ||
8441 | var ea = this.sourceImg; | ||
8442 | if (ea && ea instanceof HTMLCanvasElement && this.__isDirty) { | ||
8443 | ea.getContext("2d").putImageData(this.imageData, 0, 0) | ||
8444 | } | ||
8445 | this.__isDirty = false | ||
8446 | }, | ||
8447 | fromHTMLImageData: function(ea) { | ||
8448 | var eb = by(ea); | ||
8449 | try { | ||
8450 | var ed = eb.context.getImageData(0, 0, ea.width, ea.height); | ||
8451 | this.fromImageData(ed) | ||
8452 | } catch (ec) { | ||
8453 | if (ea.width && ea.height) { | ||
8454 | this.isRemote = true; | ||
8455 | this.width = ea.width; | ||
8456 | this.height = ea.height | ||
8457 | } | ||
8458 | } | ||
8459 | this.sourceImg = ea | ||
8460 | }, | ||
8461 | get: function(ea, ed, eb, ec) { | ||
8462 | if (!arguments.length) { | ||
8463 | return cW.get(this) | ||
8464 | } | ||
8465 | if (arguments.length === 2) { | ||
8466 | return cW.get(ea, ed, this) | ||
8467 | } | ||
8468 | if (arguments.length === 4) { | ||
8469 | return cW.get(ea, ed, eb, ec, this) | ||
8470 | } | ||
8471 | }, | ||
8472 | set: function(ea, ec, eb) { | ||
8473 | cW.set(ea, ec, eb, this); | ||
8474 | this.__isDirty = true | ||
8475 | }, | ||
8476 | blend: function(ei, ee, ed, eb, eg, ej, eh, ef, ea, ec) { | ||
8477 | if (arguments.length === 9) { | ||
8478 | cW.blend(this, ei, ee, ed, eb, eg, ej, eh, ef, ea, this) | ||
8479 | } else { | ||
8480 | if (arguments.length === 10) { | ||
8481 | cW.blend(ei, ee, ed, eb, eg, ej, eh, ef, ea, ec, this) | ||
8482 | } | ||
8483 | } | ||
8484 | delete this.sourceImg | ||
8485 | }, | ||
8486 | copy: function(eh, ee, ed, ec, eb, ei, eg, ef, ea) { | ||
8487 | if (arguments.length === 8) { | ||
8488 | cW.blend(this, eh, ee, ed, ec, eb, ei, eg, ef, 0, this) | ||
8489 | } else { | ||
8490 | if (arguments.length === 9) { | ||
8491 | cW.blend(eh, ee, ed, ec, eb, ei, eg, ef, ea, 0, this) | ||
8492 | } | ||
8493 | } | ||
8494 | delete this.sourceImg | ||
8495 | }, | ||
8496 | filter: function(eb, ea) { | ||
8497 | if (arguments.length === 2) { | ||
8498 | cW.filter(eb, ea, this) | ||
8499 | } else { | ||
8500 | if (arguments.length === 1) { | ||
8501 | cW.filter(eb, null, this) | ||
8502 | } | ||
8503 | } | ||
8504 | delete this.sourceImg | ||
8505 | }, | ||
8506 | save: function(ea) { | ||
8507 | cW.save(ea, this) | ||
8508 | }, | ||
8509 | resize: function(ea, ec) { | ||
8510 | if (this.isRemote) { | ||
8511 | throw "Image is loaded remotely. Cannot resize." | ||
8512 | } | ||
8513 | if (this.width !== 0 || this.height !== 0) { | ||
8514 | if (ea === 0 && ec !== 0) { | ||
8515 | ea = q.floor(this.width / this.height * ec) | ||
8516 | } else { | ||
8517 | if (ec === 0 && ea !== 0) { | ||
8518 | ec = q.floor(this.height / this.width * ea) | ||
8519 | } | ||
8520 | } | ||
8521 | var eb = by(this.imageData).canvas; | ||
8522 | var ed = by(eb, ea, ec).context.getImageData(0, 0, ea, ec); | ||
8523 | this.fromImageData(ed) | ||
8524 | } | ||
8525 | }, | ||
8526 | mask: function(ea) { | ||
8527 | var ed = this.toImageData(), | ||
8528 | ec, eb; | ||
8529 | if (ea instanceof cG || ea.__isPImage) { | ||
8530 | if (ea.width === this.width && ea.height === this.height) { | ||
8531 | ea = ea.toImageData(); | ||
8532 | for (ec = 2, eb = this.width * this.height * 4; ec < eb; ec += 4) { | ||
8533 | ed.data[ec + 1] = ea.data[ec] | ||
8534 | } | ||
8535 | } else { | ||
8536 | throw "mask must have the same dimensions as PImage." | ||
8537 | } | ||
8538 | } else { | ||
8539 | if (ea instanceof Array) { | ||
8540 | if (this.width * this.height === ea.length) { | ||
8541 | for (ec = 0, eb = ea.length; ec < eb; ++ec) { | ||
8542 | ed.data[ec * 4 + 3] = ea[ec] | ||
8543 | } | ||
8544 | } else { | ||
8545 | throw "mask array must be the same length as PImage pixels array." | ||
8546 | } | ||
8547 | } | ||
8548 | } | ||
8549 | this.fromImageData(ed) | ||
8550 | }, | ||
8551 | loadPixels: G, | ||
8552 | toImageData: function() { | ||
8553 | if (this.isRemote) { | ||
8554 | return this.sourceImg | ||
8555 | } | ||
8556 | if (!this.__isDirty) { | ||
8557 | return this.imageData | ||
8558 | } | ||
8559 | var ea = by(this.sourceImg); | ||
8560 | return ea.context.getImageData(0, 0, this.width, this.height) | ||
8561 | }, | ||
8562 | toDataURL: function() { | ||
8563 | if (this.isRemote) { | ||
8564 | throw "Image is loaded remotely. Cannot create dataURI." | ||
8565 | } | ||
8566 | var ea = by(this.imageData); | ||
8567 | return ea.canvas.toDataURL() | ||
8568 | }, | ||
8569 | fromImageData: function(ee) { | ||
8570 | var eb = ee.width, | ||
8571 | ed = ee.height, | ||
8572 | ec = d.createElement("canvas"), | ||
8573 | ea = ec.getContext("2d"); | ||
8574 | this.width = ec.width = eb; | ||
8575 | this.height = ec.height = ed; | ||
8576 | ea.putImageData(ee, 0, 0); | ||
8577 | this.format = 2; | ||
8578 | this.imageData = ee; | ||
8579 | this.sourceImg = ec | ||
8580 | } | ||
8581 | }; | ||
8582 | cW.PImage = cG; | ||
8583 | cW.createImage = function(ea, eb, ec) { | ||
8584 | return new cG(ea, eb, ec) | ||
8585 | }; | ||
8586 | cW.loadImage = function(eb, ec, ee) { | ||
8587 | if (ec) { | ||
8588 | eb = eb + "." + ec | ||
8589 | } | ||
8590 | var ed; | ||
8591 | if (cQ.imageCache.images[eb]) { | ||
8592 | ed = new cG(cQ.imageCache.images[eb]); | ||
8593 | ed.loaded = true; | ||
8594 | return ed | ||
8595 | } | ||
8596 | ed = new cG; | ||
8597 | var ea = d.createElement("img"); | ||
8598 | ed.sourceImg = ea; | ||
8599 | ea.onload = function(ei, eg, ef) { | ||
8600 | var ej = ei; | ||
8601 | var eh = eg; | ||
8602 | var ek = ef; | ||
8603 | return function() { | ||
8604 | eh.fromHTMLImageData(ej); | ||
8605 | eh.loaded = true; | ||
8606 | if (ek) { | ||
8607 | ek() | ||
8608 | } | ||
8609 | } | ||
8610 | }(ea, ed, ee); | ||
8611 | ea.src = eb; | ||
8612 | return ed | ||
8613 | }; | ||
8614 | cW.requestImage = cW.loadImage; | ||
8615 | |||
8616 | function c9(ea, ed) { | ||
8617 | var eb; | ||
8618 | if (ea >= cW.width || ea < 0 || ed < 0 || ed >= cW.height) { | ||
8619 | return 0 | ||
8620 | } | ||
8621 | if (dV) { | ||
8622 | var ec = ((0 | ea) + cW.width * (0 | ed)) * 4; | ||
8623 | eb = cW.imageData.data; | ||
8624 | return (eb[ec + 3] & 255) << 24 | (eb[ec] & 255) << 16 | (eb[ec + 1] & 255) << 8 | eb[ec + 2] & 255 | ||
8625 | } | ||
8626 | eb = cW.toImageData(0 | ea, 0 | ed, 1, 1).data; | ||
8627 | return (eb[3] & 255) << 24 | (eb[0] & 255) << 16 | (eb[1] & 255) << 8 | eb[2] & 255 | ||
8628 | } | ||
8629 | |||
8630 | function c8(ea, ee, eb) { | ||
8631 | if (eb.isRemote) { | ||
8632 | throw "Image is loaded remotely. Cannot get x,y." | ||
8633 | } | ||
8634 | var ed = ee * eb.width * 4 + ea * 4, | ||
8635 | ec = eb.imageData.data; | ||
8636 | return (ec[ed + 3] & 255) << 24 | (ec[ed] & 255) << 16 | (ec[ed + 1] & 255) << 8 | ec[ed + 2] & 255 | ||
8637 | } | ||
8638 | |||
8639 | function c6(ea, ee, eb, ec) { | ||
8640 | var ed = new cG(eb, ec, 2); | ||
8641 | ed.fromImageData(cW.toImageData(ea, ee, eb, ec)); | ||
8642 | return ed | ||
8643 | } | ||
8644 | |||
8645 | function c5(ef, ee, eg, el, er) { | ||
8646 | if (er.isRemote) { | ||
8647 | throw "Image is loaded remotely. Cannot get x,y,w,h." | ||
8648 | } | ||
8649 | var ep = new cG(eg, el, 2), | ||
8650 | ec = ep.imageData.data, | ||
8651 | ed = er.width, | ||
8652 | em = er.height, | ||
8653 | eo = er.imageData.data; | ||
8654 | var ea = q.max(0, -ee), | ||
8655 | eb = q.max(0, -ef), | ||
8656 | eh = q.min(el, em - ee), | ||
8657 | ei = q.min(eg, ed - ef); | ||
8658 | for (var ek = ea; ek < eh; ++ek) { | ||
8659 | var en = ((ee + ek) * ed + (ef + eb)) * 4; | ||
8660 | var eq = (ek * eg + eb) * 4; | ||
8661 | for (var ej = eb; ej < ei; ++ej) { | ||
8662 | ec[eq++] = eo[en++]; | ||
8663 | ec[eq++] = eo[en++]; | ||
8664 | ec[eq++] = eo[en++]; | ||
8665 | ec[eq++] = eo[en++] | ||
8666 | } | ||
8667 | } | ||
8668 | ep.__isDirty = true; | ||
8669 | return ep | ||
8670 | } | ||
8671 | cW.get = function(ea, ee, eb, ed, ec) { | ||
8672 | if (ec !== undefined) { | ||
8673 | return c5(ea, ee, eb, ed, ec) | ||
8674 | } | ||
8675 | if (ed !== undefined) { | ||
8676 | return c6(ea, ee, eb, ed) | ||
8677 | } | ||
8678 | if (eb !== undefined) { | ||
8679 | return c8(ea, ee, eb) | ||
8680 | } | ||
8681 | if (ee !== undefined) { | ||
8682 | return c9(ea, ee) | ||
8683 | } | ||
8684 | if (ea !== undefined) { | ||
8685 | return c5(0, 0, ea.width, ea.height, ea) | ||
8686 | } | ||
8687 | return c6(0, 0, cW.width, cW.height) | ||
8688 | }; | ||
8689 | cW.createGraphics = function(ea, ec, eb) { | ||
8690 | var ed = new F; | ||
8691 | ed.size(ea, ec, eb); | ||
8692 | ed.background(0, 0); | ||
8693 | return ed | ||
8694 | }; | ||
8695 | |||
8696 | function T() { | ||
8697 | if (dV) { | ||
8698 | d8 = aj; | ||
8699 | dV = false; | ||
8700 | cW.updatePixels() | ||
8701 | } | ||
8702 | } | ||
8703 | |||
8704 | function cq() { | ||
8705 | function eb(ef, ed) { | ||
8706 | function ee() { | ||
8707 | T(); | ||
8708 | d8[ed].apply(d8, arguments) | ||
8709 | } | ||
8710 | ef[ed] = ee | ||
8711 | } | ||
8712 | |||
8713 | function ea(eg, ee) { | ||
8714 | function ed() { | ||
8715 | T(); | ||
8716 | return d8[ee] | ||
8717 | } | ||
8718 | |||
8719 | function ef(eh) { | ||
8720 | T(); | ||
8721 | d8[ee] = eh | ||
8722 | } | ||
8723 | cW.defineProperty(eg, ee, { | ||
8724 | get: ed, | ||
8725 | set: ef | ||
8726 | }) | ||
8727 | } | ||
8728 | for (var ec in d8) { | ||
8729 | if (typeof d8[ec] === "function") { | ||
8730 | eb(this, ec) | ||
8731 | } else { | ||
8732 | ea(this, ec) | ||
8733 | } | ||
8734 | } | ||
8735 | } | ||
8736 | |||
8737 | function cC() { | ||
8738 | if (dV) { | ||
8739 | return | ||
8740 | } | ||
8741 | cW.loadPixels(); | ||
8742 | if (cn === null) { | ||
8743 | aj = d8; | ||
8744 | cn = new cq | ||
8745 | } | ||
8746 | dV = true; | ||
8747 | d8 = cn; | ||
8748 | d3 = 0 | ||
8749 | } | ||
8750 | |||
8751 | function bx(ea, ec, eb) { | ||
8752 | if (ea < cW.width && ea >= 0 && ec >= 0 && ec < cW.height) { | ||
8753 | cC(); | ||
8754 | cW.pixels.setPixel((0 | ea) + cW.width * (0 | ec), eb); | ||
8755 | if (++d3 > bZ) { | ||
8756 | T() | ||
8757 | } | ||
8758 | } | ||
8759 | } | ||
8760 | |||
8761 | function bv(ea, eg, ed, eb) { | ||
8762 | if (eb.isRemote) { | ||
8763 | throw "Image is loaded remotely. Cannot set x,y." | ||
8764 | } | ||
8765 | var ef = cW.color.toArray(ed); | ||
8766 | var ee = eg * eb.width * 4 + ea * 4; | ||
8767 | var ec = eb.imageData.data; | ||
8768 | ec[ee] = ef[0]; | ||
8769 | ec[ee + 1] = ef[1]; | ||
8770 | ec[ee + 2] = ef[2]; | ||
8771 | ec[ee + 3] = ef[3] | ||
8772 | } | ||
8773 | cW.set = function(ea, ef, ed, ec) { | ||
8774 | var eb, ee; | ||
8775 | if (arguments.length === 3) { | ||
8776 | if (typeof ed === "number") { | ||
8777 | bx(ea, ef, ed) | ||
8778 | } else { | ||
8779 | if (ed instanceof cG || ed.__isPImage) { | ||
8780 | cW.image(ed, ea, ef) | ||
8781 | } | ||
8782 | } | ||
8783 | } else { | ||
8784 | if (arguments.length === 4) { | ||
8785 | bv(ea, ef, ed, ec) | ||
8786 | } | ||
8787 | } | ||
8788 | }; | ||
8789 | cW.imageData = {}; | ||
8790 | cW.pixels = { | ||
8791 | getLength: function() { | ||
8792 | return cW.imageData.data.length ? cW.imageData.data.length / 4 : 0 | ||
8793 | }, | ||
8794 | getPixel: function(ea) { | ||
8795 | var ec = ea * 4, | ||
8796 | eb = cW.imageData.data; | ||
8797 | return eb[ec + 3] << 24 & 4278190080 | eb[ec + 0] << 16 & 16711680 | eb[ec + 1] << 8 & 65280 | eb[ec + 2] & 255 | ||
8798 | }, | ||
8799 | setPixel: function(ea, ed) { | ||
8800 | var ec = ea * 4, | ||
8801 | eb = cW.imageData.data; | ||
8802 | eb[ec + 0] = (ed & 16711680) >>> 16; | ||
8803 | eb[ec + 1] = (ed & 65280) >>> 8; | ||
8804 | eb[ec + 2] = ed & 255; | ||
8805 | eb[ec + 3] = (ed & 4278190080) >>> 24 | ||
8806 | }, | ||
8807 | toArray: function() { | ||
8808 | var ea = [], | ||
8809 | ec = cW.imageData.width * cW.imageData.height, | ||
8810 | ed = cW.imageData.data; | ||
8811 | for (var eb = 0, ee = 0; eb < ec; eb++, ee += 4) { | ||
8812 | ea.push(ed[ee + 3] << 24 & 4278190080 | ed[ee + 0] << 16 & 16711680 | ed[ee + 1] << 8 & 65280 | ed[ee + 2] & 255) | ||
8813 | } | ||
8814 | return ea | ||
8815 | }, | ||
8816 | set: function(ea) { | ||
8817 | for (var eb = 0, ec = ea.length; eb < ec; eb++) { | ||
8818 | this.setPixel(eb, ea[eb]) | ||
8819 | } | ||
8820 | } | ||
8821 | }; | ||
8822 | cW.loadPixels = function() { | ||
8823 | cW.imageData = dY.$ensureContext().getImageData(0, 0, cW.width, cW.height) | ||
8824 | }; | ||
8825 | cW.updatePixels = function() { | ||
8826 | if (cW.imageData) { | ||
8827 | dY.$ensureContext().putImageData(cW.imageData, 0, 0) | ||
8828 | } | ||
8829 | }; | ||
8830 | cW.hint = function(eb) { | ||
8831 | var ea = dY.$ensureContext(); | ||
8832 | if (eb === 4) { | ||
8833 | ea.disable(ea.DEPTH_TEST); | ||
8834 | ea.depthMask(false); | ||
8835 | ea.clear(ea.DEPTH_BUFFER_BIT) | ||
8836 | } else { | ||
8837 | if (eb === -4) { | ||
8838 | ea.enable(ea.DEPTH_TEST); | ||
8839 | ea.depthMask(true) | ||
8840 | } else { | ||
8841 | if (eb === -1 || eb === 2) { | ||
8842 | dO = true | ||
8843 | } else { | ||
8844 | if (eb === 1) { | ||
8845 | dO = false | ||
8846 | } | ||
8847 | } | ||
8848 | } | ||
8849 | } | ||
8850 | }; | ||
8851 | var bE = function(ed, ec, eb, ea) { | ||
8852 | var ee; | ||
8853 | if (ed instanceof cG || ed.__isPImage) { | ||
8854 | ee = ed; | ||
8855 | if (!ee.loaded) { | ||
8856 | throw "Error using image in background(): PImage not loaded." | ||
8857 | } | ||
8858 | if (ee.width !== cW.width || ee.height !== cW.height) { | ||
8859 | throw "Background image must be the same dimensions as the canvas." | ||
8860 | } | ||
8861 | } else { | ||
8862 | ee = cW.color(ed, ec, eb, ea) | ||
8863 | } | ||
8864 | a4 = ee | ||
8865 | }; | ||
8866 | bR.prototype.background = function(ed, ec, eb, ea) { | ||
8867 | if (ed !== t) { | ||
8868 | bE(ed, ec, eb, ea) | ||
8869 | } | ||
8870 | if (a4 instanceof cG || a4.__isPImage) { | ||
8871 | aD(); | ||
8872 | d8.setTransform(1, 0, 0, 1, 0, 0); | ||
8873 | cW.image(a4, 0, 0); | ||
8874 | cP() | ||
8875 | } else { | ||
8876 | aD(); | ||
8877 | d8.setTransform(1, 0, 0, 1, 0, 0); | ||
8878 | if (cW.alpha(a4) !== bU) { | ||
8879 | d8.clearRect(0, 0, cW.width, cW.height) | ||
8880 | } | ||
8881 | d8.fillStyle = cW.color.toString(a4); | ||
8882 | d8.fillRect(0, 0, cW.width, cW.height); | ||
8883 | aq = true; | ||
8884 | cP() | ||
8885 | } | ||
8886 | }; | ||
8887 | bB.prototype.background = function(ed, ec, eb, ea) { | ||
8888 | if (arguments.length > 0) { | ||
8889 | bE(ed, ec, eb, ea) | ||
8890 | } | ||
8891 | var ee = cW.color.toGLArray(a4); | ||
8892 | d8.clearColor(ee[0], ee[1], ee[2], ee[3]); | ||
8893 | d8.clear(d8.COLOR_BUFFER_BIT | d8.DEPTH_BUFFER_BIT) | ||
8894 | }; | ||
8895 | bR.prototype.image = function(ed, ei, eg, ej, ee) { | ||
8896 | ei = q.round(ei); | ||
8897 | eg = q.round(eg); | ||
8898 | if (ed.width > 0) { | ||
8899 | var ek = ej || ed.width; | ||
8900 | var eh = ee || ed.height; | ||
8901 | var ea = bk(ei || 0, eg || 0, ej || ed.width, ee || ed.height, arguments.length < 4); | ||
8902 | var ef = !!ed.sourceImg && bf === null; | ||
8903 | if (ef) { | ||
8904 | var eb = ed.sourceImg; | ||
8905 | if (ed.__isDirty) { | ||
8906 | ed.updatePixels() | ||
8907 | } | ||
8908 | d8.drawImage(eb, 0, 0, eb.width, eb.height, ea.x, ea.y, ea.w, ea.h) | ||
8909 | } else { | ||
8910 | var ec = ed.toImageData(); | ||
8911 | if (bf !== null) { | ||
8912 | bf(ec); | ||
8913 | ed.__isDirty = true | ||
8914 | } | ||
8915 | d8.drawImage(by(ec).canvas, 0, 0, ed.width, ed.height, ea.x, ea.y, ea.w, ea.h) | ||
8916 | } | ||
8917 | } | ||
8918 | }; | ||
8919 | bB.prototype.image = function(ec, ea, ee, eb, ed) { | ||
8920 | if (ec.width > 0) { | ||
8921 | ea = q.round(ea); | ||
8922 | ee = q.round(ee); | ||
8923 | eb = eb || ec.width; | ||
8924 | ed = ed || ec.height; | ||
8925 | cW.beginShape(cW.QUADS); | ||
8926 | cW.texture(ec); | ||
8927 | cW.vertex(ea, ee, 0, 0, 0); | ||
8928 | cW.vertex(ea, ee + ed, 0, 0, ed); | ||
8929 | cW.vertex(ea + eb, ee + ed, 0, eb, ed); | ||
8930 | cW.vertex(ea + eb, ee, 0, eb, 0); | ||
8931 | cW.endShape() | ||
8932 | } | ||
8933 | }; | ||
8934 | cW.tint = function(ed, ec, ea, ei) { | ||
8935 | var ef = cW.color(ed, ec, ea, ei); | ||
8936 | var eb = cW.red(ef) / bJ; | ||
8937 | var ee = cW.green(ef) / bI; | ||
8938 | var eg = cW.blue(ef) / bG; | ||
8939 | var eh = cW.alpha(ef) / bU; | ||
8940 | bf = function(em) { | ||
8941 | var el = em.data, | ||
8942 | ek = 4 * em.width * em.height; | ||
8943 | for (var ej = 0; ej < ek;) { | ||
8944 | el[ej++] *= eb; | ||
8945 | el[ej++] *= ee; | ||
8946 | el[ej++] *= eg; | ||
8947 | el[ej++] *= eh | ||
8948 | } | ||
8949 | }; | ||
8950 | bw = function(ek) { | ||
8951 | for (var ej = 0; ej < ek.length;) { | ||
8952 | ek[ej++] = eb; | ||
8953 | ek[ej++] = ee; | ||
8954 | ek[ej++] = eg; | ||
8955 | ek[ej++] = eh | ||
8956 | } | ||
8957 | } | ||
8958 | }; | ||
8959 | cW.noTint = function() { | ||
8960 | bf = null; | ||
8961 | bw = null | ||
8962 | }; | ||
8963 | cW.copy = function(ea, ef, ee, eg, ec, ei, eh, eb, ed) { | ||
8964 | if (ed === t) { | ||
8965 | ed = eb; | ||
8966 | eb = eh; | ||
8967 | eh = ei; | ||
8968 | ei = ec; | ||
8969 | ec = eg; | ||
8970 | eg = ee; | ||
8971 | ee = ef; | ||
8972 | ef = ea; | ||
8973 | ea = cW | ||
8974 | } | ||
8975 | cW.blend(ea, ef, ee, eg, ec, ei, eh, eb, ed, 0) | ||
8976 | }; | ||
8977 | cW.blend = function(ea, ek, ej, en, ef, ep, eo, eb, eh, eg, ed) { | ||
8978 | if (ea.isRemote) { | ||
8979 | throw "Image is loaded remotely. Cannot blend image." | ||
8980 | } | ||
8981 | if (eg === t) { | ||
8982 | eg = eh; | ||
8983 | eh = eb; | ||
8984 | eb = eo; | ||
8985 | eo = ep; | ||
8986 | ep = ef; | ||
8987 | ef = en; | ||
8988 | en = ej; | ||
8989 | ej = ek; | ||
8990 | ek = ea; | ||
8991 | ea = cW | ||
8992 | } | ||
8993 | var ec = ek + en, | ||
8994 | ei = ej + ef, | ||
8995 | em = ep + eb, | ||
8996 | ee = eo + eh, | ||
8997 | el = ed || cW; | ||
8998 | if (ed === t || eg === t) { | ||
8999 | cW.loadPixels() | ||
9000 | } | ||
9001 | ea.loadPixels(); | ||
9002 | if (ea === cW && cW.intersect(ek, ej, ec, ei, ep, eo, em, ee)) { | ||
9003 | cW.blit_resize(cW.get(ek, ej, ec - ek, ei - ej), 0, 0, ec - ek - 1, ei - ej - 1, el.imageData.data, el.width, el.height, ep, eo, em, ee, eg) | ||
9004 | } else { | ||
9005 | cW.blit_resize(ea, ek, ej, ec, ei, el.imageData.data, el.width, el.height, ep, eo, em, ee, eg) | ||
9006 | } if (ed === t) { | ||
9007 | cW.updatePixels() | ||
9008 | } | ||
9009 | }; | ||
9010 | var bp = function(ee) { | ||
9011 | var ea = cW.floor(ee * 3.5), | ||
9012 | ec, eb; | ||
9013 | ea = ea < 1 ? 1 : ea < 248 ? ea : 248; | ||
9014 | if (cW.shared.blurRadius !== ea) { | ||
9015 | cW.shared.blurRadius = ea; | ||
9016 | cW.shared.blurKernelSize = 1 + (cW.shared.blurRadius << 1); | ||
9017 | cW.shared.blurKernel = new e(cW.shared.blurKernelSize); | ||
9018 | var eg = cW.shared.blurKernel; | ||
9019 | var ef = cW.shared.blurKernelSize; | ||
9020 | var ed = cW.shared.blurRadius; | ||
9021 | for (ec = 0; ec < ef; ec++) { | ||
9022 | eg[ec] = 0 | ||
9023 | } | ||
9024 | var eh = (ea - 1) * (ea - 1); | ||
9025 | for (ec = 1; ec < ea; ec++) { | ||
9026 | eg[ea + ec] = eg[eb] = eh | ||
9027 | } | ||
9028 | eg[ea] = ea * ea | ||
9029 | } | ||
9030 | }; | ||
9031 | var b7 = function(eo, et) { | ||
9032 | var ec, ef, el, eq, er, eA, es; | ||
9033 | var ev, en, ez, ey, ep; | ||
9034 | var ei = et.pixels.getLength(); | ||
9035 | var eu = new e(ei); | ||
9036 | var eD = new e(ei); | ||
9037 | var eh = new e(ei); | ||
9038 | var eC = new e(ei); | ||
9039 | var eB = 0; | ||
9040 | var ek, ej, ex, ee; | ||
9041 | bp(eo); | ||
9042 | var eb = et.height; | ||
9043 | var ea = et.width; | ||
9044 | var ew = cW.shared.blurKernelSize; | ||
9045 | var em = cW.shared.blurRadius; | ||
9046 | var eg = cW.shared.blurKernel; | ||
9047 | var ed = et.imageData.data; | ||
9048 | for (ej = 0; ej < eb; ej++) { | ||
9049 | for (ek = 0; ek < ea; ek++) { | ||
9050 | eq = el = ef = er = ec = 0; | ||
9051 | ev = ek - em; | ||
9052 | if (ev < 0) { | ||
9053 | ep = -ev; | ||
9054 | ev = 0 | ||
9055 | } else { | ||
9056 | if (ev >= ea) { | ||
9057 | break | ||
9058 | } | ||
9059 | ep = 0 | ||
9060 | } | ||
9061 | for (ex = ep; ex < ew; ex++) { | ||
9062 | if (ev >= ea) { | ||
9063 | break | ||
9064 | } | ||
9065 | ee = (ev + eB) * 4; | ||
9066 | es = eg[ex]; | ||
9067 | er += es * ed[ee + 3]; | ||
9068 | ef += es * ed[ee]; | ||
9069 | el += es * ed[ee + 1]; | ||
9070 | eq += es * ed[ee + 2]; | ||
9071 | ec += es; | ||
9072 | ev++ | ||
9073 | } | ||
9074 | en = eB + ek; | ||
9075 | eC[en] = er / ec; | ||
9076 | eu[en] = ef / ec; | ||
9077 | eD[en] = el / ec; | ||
9078 | eh[en] = eq / ec | ||
9079 | } | ||
9080 | eB += ea | ||
9081 | } | ||
9082 | eB = 0; | ||
9083 | ez = -em; | ||
9084 | ey = ez * ea; | ||
9085 | for (ej = 0; ej < eb; ej++) { | ||
9086 | for (ek = 0; ek < ea; ek++) { | ||
9087 | eq = el = ef = er = ec = 0; | ||
9088 | if (ez < 0) { | ||
9089 | ep = en = -ez; | ||
9090 | ev = ek | ||
9091 | } else { | ||
9092 | if (ez >= eb) { | ||
9093 | break | ||
9094 | } | ||
9095 | ep = 0; | ||
9096 | en = ez; | ||
9097 | ev = ek + ey | ||
9098 | } | ||
9099 | for (ex = ep; ex < ew; ex++) { | ||
9100 | if (en >= eb) { | ||
9101 | break | ||
9102 | } | ||
9103 | es = eg[ex]; | ||
9104 | er += es * eC[ev]; | ||
9105 | ef += es * eu[ev]; | ||
9106 | el += es * eD[ev]; | ||
9107 | eq += es * eh[ev]; | ||
9108 | ec += es; | ||
9109 | en++; | ||
9110 | ev += ea | ||
9111 | } | ||
9112 | ee = (ek + eB) * 4; | ||
9113 | ed[ee] = ef / ec; | ||
9114 | ed[ee + 1] = el / ec; | ||
9115 | ed[ee + 2] = eq / ec; | ||
9116 | ed[ee + 3] = er / ec | ||
9117 | } | ||
9118 | eB += ea; | ||
9119 | ey += ea; | ||
9120 | ez++ | ||
9121 | } | ||
9122 | }; | ||
9123 | var cf = function(er, el) { | ||
9124 | var eh = 0; | ||
9125 | var ev = el.pixels.getLength(); | ||
9126 | var em = new K(ev); | ||
9127 | var ep, eb, ek, ej, ed; | ||
9128 | var eq, ee, eg, ei, ec, en, eu, ea, es, ef, et, eo; | ||
9129 | if (!er) { | ||
9130 | while (eh < ev) { | ||
9131 | ep = eh; | ||
9132 | eb = eh + el.width; | ||
9133 | while (eh < eb) { | ||
9134 | ek = ej = el.pixels.getPixel(eh); | ||
9135 | ee = eh - 1; | ||
9136 | eq = eh + 1; | ||
9137 | eg = eh - el.width; | ||
9138 | ei = eh + el.width; | ||
9139 | if (ee < ep) { | ||
9140 | ee = eh | ||
9141 | } | ||
9142 | if (eq >= eb) { | ||
9143 | eq = eh | ||
9144 | } | ||
9145 | if (eg < 0) { | ||
9146 | eg = 0 | ||
9147 | } | ||
9148 | if (ei >= ev) { | ||
9149 | ei = eh | ||
9150 | } | ||
9151 | eu = el.pixels.getPixel(eg); | ||
9152 | en = el.pixels.getPixel(ee); | ||
9153 | ea = el.pixels.getPixel(ei); | ||
9154 | ec = el.pixels.getPixel(eq); | ||
9155 | ed = 77 * (ek >> 16 & 255) + 151 * (ek >> 8 & 255) + 28 * (ek & 255); | ||
9156 | ef = 77 * (en >> 16 & 255) + 151 * (en >> 8 & 255) + 28 * (en & 255); | ||
9157 | es = 77 * (ec >> 16 & 255) + 151 * (ec >> 8 & 255) + 28 * (ec & 255); | ||
9158 | et = 77 * (eu >> 16 & 255) + 151 * (eu >> 8 & 255) + 28 * (eu & 255); | ||
9159 | eo = 77 * (ea >> 16 & 255) + 151 * (ea >> 8 & 255) + 28 * (ea & 255); | ||
9160 | if (ef > ed) { | ||
9161 | ej = en; | ||
9162 | ed = ef | ||
9163 | } | ||
9164 | if (es > ed) { | ||
9165 | ej = ec; | ||
9166 | ed = es | ||
9167 | } | ||
9168 | if (et > ed) { | ||
9169 | ej = eu; | ||
9170 | ed = et | ||
9171 | } | ||
9172 | if (eo > ed) { | ||
9173 | ej = ea; | ||
9174 | ed = eo | ||
9175 | } | ||
9176 | em[eh++] = ej | ||
9177 | } | ||
9178 | } | ||
9179 | } else { | ||
9180 | while (eh < ev) { | ||
9181 | ep = eh; | ||
9182 | eb = eh + el.width; | ||
9183 | while (eh < eb) { | ||
9184 | ek = ej = el.pixels.getPixel(eh); | ||
9185 | ee = eh - 1; | ||
9186 | eq = eh + 1; | ||
9187 | eg = eh - el.width; | ||
9188 | ei = eh + el.width; | ||
9189 | if (ee < ep) { | ||
9190 | ee = eh | ||
9191 | } | ||
9192 | if (eq >= eb) { | ||
9193 | eq = eh | ||
9194 | } | ||
9195 | if (eg < 0) { | ||
9196 | eg = 0 | ||
9197 | } | ||
9198 | if (ei >= ev) { | ||
9199 | ei = eh | ||
9200 | } | ||
9201 | eu = el.pixels.getPixel(eg); | ||
9202 | en = el.pixels.getPixel(ee); | ||
9203 | ea = el.pixels.getPixel(ei); | ||
9204 | ec = el.pixels.getPixel(eq); | ||
9205 | ed = 77 * (ek >> 16 & 255) + 151 * (ek >> 8 & 255) + 28 * (ek & 255); | ||
9206 | ef = 77 * (en >> 16 & 255) + 151 * (en >> 8 & 255) + 28 * (en & 255); | ||
9207 | es = 77 * (ec >> 16 & 255) + 151 * (ec >> 8 & 255) + 28 * (ec & 255); | ||
9208 | et = 77 * (eu >> 16 & 255) + 151 * (eu >> 8 & 255) + 28 * (eu & 255); | ||
9209 | eo = 77 * (ea >> 16 & 255) + 151 * (ea >> 8 & 255) + 28 * (ea & 255); | ||
9210 | if (ef < ed) { | ||
9211 | ej = en; | ||
9212 | ed = ef | ||
9213 | } | ||
9214 | if (es < ed) { | ||
9215 | ej = ec; | ||
9216 | ed = es | ||
9217 | } | ||
9218 | if (et < ed) { | ||
9219 | ej = eu; | ||
9220 | ed = et | ||
9221 | } | ||
9222 | if (eo < ed) { | ||
9223 | ej = ea; | ||
9224 | ed = eo | ||
9225 | } | ||
9226 | em[eh++] = ej | ||
9227 | } | ||
9228 | } | ||
9229 | } | ||
9230 | el.pixels.set(em) | ||
9231 | }; | ||
9232 | cW.filter = function(eh, eg, ed) { | ||
9233 | var ek, ef, eb, ej; | ||
9234 | if (arguments.length === 3) { | ||
9235 | ed.loadPixels(); | ||
9236 | ek = ed | ||
9237 | } else { | ||
9238 | cW.loadPixels(); | ||
9239 | ek = cW | ||
9240 | } if (eg === t) { | ||
9241 | eg = null | ||
9242 | } | ||
9243 | if (ek.isRemote) { | ||
9244 | throw "Image is loaded remotely. Cannot filter image." | ||
9245 | } | ||
9246 | var el = ek.pixels.getLength(); | ||
9247 | switch (eh) { | ||
9248 | case 11: | ||
9249 | var em = eg || 1; | ||
9250 | b7(em, ek); | ||
9251 | break; | ||
9252 | case 12: | ||
9253 | if (ek.format === 4) { | ||
9254 | for (ej = 0; ej < el; ej++) { | ||
9255 | ef = 255 - ek.pixels.getPixel(ej); | ||
9256 | ek.pixels.setPixel(ej, 4278190080 | ef << 16 | ef << 8 | ef) | ||
9257 | } | ||
9258 | ek.format = 1 | ||
9259 | } else { | ||
9260 | for (ej = 0; ej < el; ej++) { | ||
9261 | ef = ek.pixels.getPixel(ej); | ||
9262 | eb = 77 * (ef >> 16 & 255) + 151 * (ef >> 8 & 255) + 28 * (ef & 255) >> 8; | ||
9263 | ek.pixels.setPixel(ej, ef & 4278190080 | eb << 16 | eb << 8 | eb) | ||
9264 | } | ||
9265 | } | ||
9266 | break; | ||
9267 | case 13: | ||
9268 | for (ej = 0; ej < el; ej++) { | ||
9269 | ek.pixels.setPixel(ej, ek.pixels.getPixel(ej) ^ 16777215) | ||
9270 | } | ||
9271 | break; | ||
9272 | case 15: | ||
9273 | if (eg === null) { | ||
9274 | throw "Use filter(POSTERIZE, int levels) instead of filter(POSTERIZE)" | ||
9275 | } | ||
9276 | var ep = cW.floor(eg); | ||
9277 | if (ep < 2 || ep > 255) { | ||
9278 | throw "Levels must be between 2 and 255 for filter(POSTERIZE, levels)" | ||
9279 | } | ||
9280 | var ei = ep - 1; | ||
9281 | for (ej = 0; ej < el; ej++) { | ||
9282 | var ea = ek.pixels.getPixel(ej) >> 16 & 255; | ||
9283 | var en = ek.pixels.getPixel(ej) >> 8 & 255; | ||
9284 | var ec = ek.pixels.getPixel(ej) & 255; | ||
9285 | ea = (ea * ep >> 8) * 255 / ei; | ||
9286 | en = (en * ep >> 8) * 255 / ei; | ||
9287 | ec = (ec * ep >> 8) * 255 / ei; | ||
9288 | ek.pixels.setPixel(ej, 4278190080 & ek.pixels.getPixel(ej) | ea << 16 | en << 8 | ec) | ||
9289 | } | ||
9290 | break; | ||
9291 | case 14: | ||
9292 | for (ej = 0; ej < el; ej++) { | ||
9293 | ek.pixels.setPixel(ej, ek.pixels.getPixel(ej) | 4278190080) | ||
9294 | } | ||
9295 | ek.format = 1; | ||
9296 | break; | ||
9297 | case 16: | ||
9298 | if (eg === null) { | ||
9299 | eg = 0.5 | ||
9300 | } | ||
9301 | if (eg < 0 || eg > 1) { | ||
9302 | throw "Level must be between 0 and 1 for filter(THRESHOLD, level)" | ||
9303 | } | ||
9304 | var ee = cW.floor(eg * 255); | ||
9305 | for (ej = 0; ej < el; ej++) { | ||
9306 | var eo = cW.max((ek.pixels.getPixel(ej) & 16711680) >> 16, cW.max((ek.pixels.getPixel(ej) & 65280) >> 8, ek.pixels.getPixel(ej) & 255)); | ||
9307 | ek.pixels.setPixel(ej, ek.pixels.getPixel(ej) & 4278190080 | (eo < ee ? 0 : 16777215)) | ||
9308 | } | ||
9309 | break; | ||
9310 | case 17: | ||
9311 | cf(true, ek); | ||
9312 | break; | ||
9313 | case 18: | ||
9314 | cf(false, ek); | ||
9315 | break | ||
9316 | } | ||
9317 | ek.updatePixels() | ||
9318 | }; | ||
9319 | cW.shared = { | ||
9320 | fracU: 0, | ||
9321 | ifU: 0, | ||
9322 | fracV: 0, | ||
9323 | ifV: 0, | ||
9324 | u1: 0, | ||
9325 | u2: 0, | ||
9326 | v1: 0, | ||
9327 | v2: 0, | ||
9328 | sX: 0, | ||
9329 | sY: 0, | ||
9330 | iw: 0, | ||
9331 | iw1: 0, | ||
9332 | ih1: 0, | ||
9333 | ul: 0, | ||
9334 | ll: 0, | ||
9335 | ur: 0, | ||
9336 | lr: 0, | ||
9337 | cUL: 0, | ||
9338 | cLL: 0, | ||
9339 | cUR: 0, | ||
9340 | cLR: 0, | ||
9341 | srcXOffset: 0, | ||
9342 | srcYOffset: 0, | ||
9343 | r: 0, | ||
9344 | g: 0, | ||
9345 | b: 0, | ||
9346 | a: 0, | ||
9347 | srcBuffer: null, | ||
9348 | blurRadius: 0, | ||
9349 | blurKernelSize: 0, | ||
9350 | blurKernel: null | ||
9351 | }; | ||
9352 | cW.intersect = function(ec, ej, eb, ei, en, eg, em, ef) { | ||
9353 | var el = eb - ec + 1; | ||
9354 | var ee = ei - ej + 1; | ||
9355 | var ea = em - en + 1; | ||
9356 | var eh = ef - eg + 1; | ||
9357 | if (en < ec) { | ||
9358 | ea += en - ec; | ||
9359 | if (ea > el) { | ||
9360 | ea = el | ||
9361 | } | ||
9362 | } else { | ||
9363 | var ek = el + ec - en; | ||
9364 | if (ea > ek) { | ||
9365 | ea = ek | ||
9366 | } | ||
9367 | } if (eg < ej) { | ||
9368 | eh += eg - ej; | ||
9369 | if (eh > ee) { | ||
9370 | eh = ee | ||
9371 | } | ||
9372 | } else { | ||
9373 | var ed = ee + ej - eg; | ||
9374 | if (eh > ed) { | ||
9375 | eh = ed | ||
9376 | } | ||
9377 | } | ||
9378 | return !(ea <= 0 || eh <= 0) | ||
9379 | }; | ||
9380 | var dS = {}; | ||
9381 | dS[1] = cW.modes.blend; | ||
9382 | dS[2] = cW.modes.add; | ||
9383 | dS[4] = cW.modes.subtract; | ||
9384 | dS[8] = cW.modes.lightest; | ||
9385 | dS[16] = cW.modes.darkest; | ||
9386 | dS[0] = cW.modes.replace; | ||
9387 | dS[32] = cW.modes.difference; | ||
9388 | dS[64] = cW.modes.exclusion; | ||
9389 | dS[128] = cW.modes.multiply; | ||
9390 | dS[256] = cW.modes.screen; | ||
9391 | dS[512] = cW.modes.overlay; | ||
9392 | dS[1024] = cW.modes.hard_light; | ||
9393 | dS[2048] = cW.modes.soft_light; | ||
9394 | dS[4096] = cW.modes.dodge; | ||
9395 | dS[8192] = cW.modes.burn; | ||
9396 | cW.blit_resize = function(en, ez, et, ey, es, eE, ej, er, ex, eo, ew, em, ep) { | ||
9397 | var eC, eB; | ||
9398 | if (ez < 0) { | ||
9399 | ez = 0 | ||
9400 | } | ||
9401 | if (et < 0) { | ||
9402 | et = 0 | ||
9403 | } | ||
9404 | if (ey >= en.width) { | ||
9405 | ey = en.width - 1 | ||
9406 | } | ||
9407 | if (es >= en.height) { | ||
9408 | es = en.height - 1 | ||
9409 | } | ||
9410 | var eI = ey - ez; | ||
9411 | var eN = es - et; | ||
9412 | var ea = ew - ex; | ||
9413 | var ek = em - eo; | ||
9414 | if (ea <= 0 || ek <= 0 || eI <= 0 || eN <= 0 || ex >= ej || eo >= er || ez >= en.width || et >= en.height) { | ||
9415 | return | ||
9416 | } | ||
9417 | var eh = q.floor(eI / ea * 32768); | ||
9418 | var ee = q.floor(eN / ek * 32768); | ||
9419 | var eG = cW.shared; | ||
9420 | eG.srcXOffset = q.floor(ex < 0 ? -ex * eh : ez * 32768); | ||
9421 | eG.srcYOffset = q.floor(eo < 0 ? -eo * ee : et * 32768); | ||
9422 | if (ex < 0) { | ||
9423 | ea += ex; | ||
9424 | ex = 0 | ||
9425 | } | ||
9426 | if (eo < 0) { | ||
9427 | ek += eo; | ||
9428 | eo = 0 | ||
9429 | } | ||
9430 | ea = q.min(ea, ej - ex); | ||
9431 | ek = q.min(ek, er - eo); | ||
9432 | var eu = eo * ej + ex; | ||
9433 | var eQ; | ||
9434 | eG.srcBuffer = en.imageData.data; | ||
9435 | eG.iw = en.width; | ||
9436 | eG.iw1 = en.width - 1; | ||
9437 | eG.ih1 = en.height - 1; | ||
9438 | var ev = cW.filter_bilinear, | ||
9439 | eK = cW.filter_new_scanline, | ||
9440 | ei = dS[ep], | ||
9441 | eH, eM, eF, eJ, ec, ed, eb = 4278190080, | ||
9442 | eL = 16711680, | ||
9443 | eA = 65280, | ||
9444 | eg = 255, | ||
9445 | eP = 32767, | ||
9446 | eD = 15, | ||
9447 | el = 1, | ||
9448 | eq = 9, | ||
9449 | ef = eG.srcBuffer, | ||
9450 | eO = q.min; | ||
9451 | for (eB = 0; eB < ek; eB++) { | ||
9452 | eG.sX = eG.srcXOffset; | ||
9453 | eG.fracV = eG.srcYOffset & eP; | ||
9454 | eG.ifV = eP - eG.fracV; | ||
9455 | eG.v1 = (eG.srcYOffset >> eD) * eG.iw; | ||
9456 | eG.v2 = eO((eG.srcYOffset >> eD) + 1, eG.ih1) * eG.iw; | ||
9457 | for (eC = 0; eC < ea; eC++) { | ||
9458 | eM = (eu + eC) * 4; | ||
9459 | eQ = eE[eM + 3] << 24 & eb | eE[eM] << 16 & eL | eE[eM + 1] << 8 & eA | eE[eM + 2] & eg; | ||
9460 | eG.fracU = eG.sX & eP; | ||
9461 | eG.ifU = eP - eG.fracU; | ||
9462 | eG.ul = eG.ifU * eG.ifV >> eD; | ||
9463 | eG.ll = eG.ifU * eG.fracV >> eD; | ||
9464 | eG.ur = eG.fracU * eG.ifV >> eD; | ||
9465 | eG.lr = eG.fracU * eG.fracV >> eD; | ||
9466 | eG.u1 = eG.sX >> eD; | ||
9467 | eG.u2 = eO(eG.u1 + 1, eG.iw1); | ||
9468 | eF = (eG.v1 + eG.u1) * 4; | ||
9469 | eJ = (eG.v1 + eG.u2) * 4; | ||
9470 | ec = (eG.v2 + eG.u1) * 4; | ||
9471 | ed = (eG.v2 + eG.u2) * 4; | ||
9472 | eG.cUL = ef[eF + 3] << 24 & eb | ef[eF] << 16 & eL | ef[eF + 1] << 8 & eA | ef[eF + 2] & eg; | ||
9473 | eG.cUR = ef[eJ + 3] << 24 & eb | ef[eJ] << 16 & eL | ef[eJ + 1] << 8 & eA | ef[eJ + 2] & eg; | ||
9474 | eG.cLL = ef[ec + 3] << 24 & eb | ef[ec] << 16 & eL | ef[ec + 1] << 8 & eA | ef[ec + 2] & eg; | ||
9475 | eG.cLR = ef[ed + 3] << 24 & eb | ef[ed] << 16 & eL | ef[ed + 1] << 8 & eA | ef[ed + 2] & eg; | ||
9476 | eG.r = eG.ul * ((eG.cUL & eL) >> 16) + eG.ll * ((eG.cLL & eL) >> 16) + eG.ur * ((eG.cUR & eL) >> 16) + eG.lr * ((eG.cLR & eL) >> 16) << el & eL; | ||
9477 | eG.g = eG.ul * (eG.cUL & eA) + eG.ll * (eG.cLL & eA) + eG.ur * (eG.cUR & eA) + eG.lr * (eG.cLR & eA) >>> eD & eA; | ||
9478 | eG.b = eG.ul * (eG.cUL & eg) + eG.ll * (eG.cLL & eg) + eG.ur * (eG.cUR & eg) + eG.lr * (eG.cLR & eg) >>> eD; | ||
9479 | eG.a = eG.ul * ((eG.cUL & eb) >>> 24) + eG.ll * ((eG.cLL & eb) >>> 24) + eG.ur * ((eG.cUR & eb) >>> 24) + eG.lr * ((eG.cLR & eb) >>> 24) << eq & eb; | ||
9480 | eH = ei(eQ, eG.a | eG.r | eG.g | eG.b); | ||
9481 | eE[eM] = (eH & eL) >>> 16; | ||
9482 | eE[eM + 1] = (eH & eA) >>> 8; | ||
9483 | eE[eM + 2] = eH & eg; | ||
9484 | eE[eM + 3] = (eH & eb) >>> 24; | ||
9485 | eG.sX += eh | ||
9486 | } | ||
9487 | eu += ej; | ||
9488 | eG.srcYOffset += ee | ||
9489 | } | ||
9490 | }; | ||
9491 | cW.loadFont = function(eb, ec) { | ||
9492 | if (eb === t) { | ||
9493 | throw "font name required in loadFont." | ||
9494 | } | ||
9495 | if (eb.indexOf(".svg") === -1) { | ||
9496 | if (ec === t) { | ||
9497 | ec = W.size | ||
9498 | } | ||
9499 | return H.get(eb, ec) | ||
9500 | } | ||
9501 | var ea = cW.loadGlyphs(eb); | ||
9502 | return { | ||
9503 | name: eb, | ||
9504 | css: "12px sans-serif", | ||
9505 | glyph: true, | ||
9506 | units_per_em: ea.units_per_em, | ||
9507 | horiz_adv_x: 1 / ea.units_per_em * ea.horiz_adv_x, | ||
9508 | ascent: ea.ascent, | ||
9509 | descent: ea.descent, | ||
9510 | width: function(eh) { | ||
9511 | var ef = 0; | ||
9512 | var ed = eh.length; | ||
9513 | for (var ee = 0; ee < ed; ee++) { | ||
9514 | try { | ||
9515 | ef += parseFloat(cW.glyphLook(cW.glyphTable[eb], eh[ee]).horiz_adv_x) | ||
9516 | } catch (eg) { | ||
9517 | F.debug(eg) | ||
9518 | } | ||
9519 | } | ||
9520 | return ef / cW.glyphTable[eb].units_per_em | ||
9521 | } | ||
9522 | } | ||
9523 | }; | ||
9524 | cW.createFont = function(ea, eb) { | ||
9525 | return cW.loadFont(ea, eb) | ||
9526 | }; | ||
9527 | cW.textFont = function(ea, ec) { | ||
9528 | if (ec !== t) { | ||
9529 | if (!ea.glyph) { | ||
9530 | ea = H.get(ea.name, ec) | ||
9531 | } | ||
9532 | d0 = ec | ||
9533 | } | ||
9534 | W = ea; | ||
9535 | Y = W.name; | ||
9536 | a3 = W.ascent; | ||
9537 | dA = W.descent; | ||
9538 | d7 = W.leading; | ||
9539 | var eb = dY.$ensureContext(); | ||
9540 | eb.font = W.css | ||
9541 | }; | ||
9542 | cW.textSize = function(eb) { | ||
9543 | W = H.get(Y, eb); | ||
9544 | d0 = eb; | ||
9545 | a3 = W.ascent; | ||
9546 | dA = W.descent; | ||
9547 | d7 = W.leading; | ||
9548 | var ea = dY.$ensureContext(); | ||
9549 | ea.font = W.css | ||
9550 | }; | ||
9551 | cW.textAscent = function() { | ||
9552 | return a3 | ||
9553 | }; | ||
9554 | cW.textDescent = function() { | ||
9555 | return dA | ||
9556 | }; | ||
9557 | cW.textLeading = function(ea) { | ||
9558 | d7 = ea | ||
9559 | }; | ||
9560 | cW.textAlign = function(eb, ea) { | ||
9561 | N = eb; | ||
9562 | c1 = ea || 0 | ||
9563 | }; | ||
9564 | |||
9565 | function bu(ea) { | ||
9566 | if (ea instanceof String) { | ||
9567 | return ea | ||
9568 | } | ||
9569 | if (typeof ea === "number") { | ||
9570 | if (ea === (0 | ea)) { | ||
9571 | return ea.toString() | ||
9572 | } | ||
9573 | return cW.nf(ea, 0, 3) | ||
9574 | } | ||
9575 | if (ea === null || ea === t) { | ||
9576 | return "" | ||
9577 | } | ||
9578 | return ea.toString() | ||
9579 | } | ||
9580 | bR.prototype.textWidth = function(ee) { | ||
9581 | var ea = bu(ee).split(/\r?\n/g), | ||
9582 | ec = 0; | ||
9583 | var eb, ed = ea.length; | ||
9584 | d8.font = W.css; | ||
9585 | for (eb = 0; eb < ed; ++eb) { | ||
9586 | ec = q.max(ec, W.measureTextWidth(ea[eb])) | ||
9587 | } | ||
9588 | return ec | 0 | ||
9589 | }; | ||
9590 | bB.prototype.textWidth = function(ef) { | ||
9591 | var ea = bu(ef).split(/\r?\n/g), | ||
9592 | ed = 0; | ||
9593 | var ec, ee = ea.length; | ||
9594 | if (cE === t) { | ||
9595 | cE = d.createElement("canvas") | ||
9596 | } | ||
9597 | var eb = cE.getContext("2d"); | ||
9598 | eb.font = W.css; | ||
9599 | for (ec = 0; ec < ee; ++ec) { | ||
9600 | ed = q.max(ed, eb.measureText(ea[ec]).width) | ||
9601 | } | ||
9602 | return ed | 0 | ||
9603 | }; | ||
9604 | cW.glyphLook = function(ea, eb) { | ||
9605 | try { | ||
9606 | switch (eb) { | ||
9607 | case "1": | ||
9608 | return ea.one; | ||
9609 | case "2": | ||
9610 | return ea.two; | ||
9611 | case "3": | ||
9612 | return ea.three; | ||
9613 | case "4": | ||
9614 | return ea.four; | ||
9615 | case "5": | ||
9616 | return ea.five; | ||
9617 | case "6": | ||
9618 | return ea.six; | ||
9619 | case "7": | ||
9620 | return ea.seven; | ||
9621 | case "8": | ||
9622 | return ea.eight; | ||
9623 | case "9": | ||
9624 | return ea.nine; | ||
9625 | case "0": | ||
9626 | return ea.zero; | ||
9627 | case " ": | ||
9628 | return ea.space; | ||
9629 | case "$": | ||
9630 | return ea.dollar; | ||
9631 | case "!": | ||
9632 | return ea.exclam; | ||
9633 | case '"': | ||
9634 | return ea.quotedbl; | ||
9635 | case "#": | ||
9636 | return ea.numbersign; | ||
9637 | case "%": | ||
9638 | return ea.percent; | ||
9639 | case "&": | ||
9640 | return ea.ampersand; | ||
9641 | case "'": | ||
9642 | return ea.quotesingle; | ||
9643 | case "(": | ||
9644 | return ea.parenleft; | ||
9645 | case ")": | ||
9646 | return ea.parenright; | ||
9647 | case "*": | ||
9648 | return ea.asterisk; | ||
9649 | case "+": | ||
9650 | return ea.plus; | ||
9651 | case ",": | ||
9652 | return ea.comma; | ||
9653 | case "-": | ||
9654 | return ea.hyphen; | ||
9655 | case ".": | ||
9656 | return ea.period; | ||
9657 | case "/": | ||
9658 | return ea.slash; | ||
9659 | case "_": | ||
9660 | return ea.underscore; | ||
9661 | case ":": | ||
9662 | return ea.colon; | ||
9663 | case ";": | ||
9664 | return ea.semicolon; | ||
9665 | case "<": | ||
9666 | return ea.less; | ||
9667 | case "=": | ||
9668 | return ea.equal; | ||
9669 | case ">": | ||
9670 | return ea.greater; | ||
9671 | case "?": | ||
9672 | return ea.question; | ||
9673 | case "@": | ||
9674 | return ea.at; | ||
9675 | case "[": | ||
9676 | return ea.bracketleft; | ||
9677 | case "\\": | ||
9678 | return ea.backslash; | ||
9679 | case "]": | ||
9680 | return ea.bracketright; | ||
9681 | case "^": | ||
9682 | return ea.asciicircum; | ||
9683 | case "`": | ||
9684 | return ea.grave; | ||
9685 | case "{": | ||
9686 | return ea.braceleft; | ||
9687 | case "|": | ||
9688 | return ea.bar; | ||
9689 | case "}": | ||
9690 | return ea.braceright; | ||
9691 | case "~": | ||
9692 | return ea.asciitilde; | ||
9693 | default: | ||
9694 | return ea[eb] | ||
9695 | } | ||
9696 | } catch (ec) { | ||
9697 | F.debug(ec) | ||
9698 | } | ||
9699 | }; | ||
9700 | bR.prototype.text$line = function(ei, el, ek, ej, ef) { | ||
9701 | var eh = 0, | ||
9702 | eg = 0; | ||
9703 | if (!W.glyph) { | ||
9704 | if (ei && "fillText" in d8) { | ||
9705 | if (aq) { | ||
9706 | d8.fillStyle = cW.color.toString(a1); | ||
9707 | aq = false | ||
9708 | } | ||
9709 | if (ef === 39 || ef === 3) { | ||
9710 | eh = W.measureTextWidth(ei); | ||
9711 | if (ef === 39) { | ||
9712 | eg = -eh | ||
9713 | } else { | ||
9714 | eg = -eh / 2 | ||
9715 | } | ||
9716 | } | ||
9717 | d8.fillText(ei, el + eg, ek) | ||
9718 | } | ||
9719 | } else { | ||
9720 | var ea = cW.glyphTable[Y]; | ||
9721 | aD(); | ||
9722 | d8.translate(el, ek + d0); | ||
9723 | if (ef === 39 || ef === 3) { | ||
9724 | eh = ea.width(ei); | ||
9725 | if (ef === 39) { | ||
9726 | eg = -eh | ||
9727 | } else { | ||
9728 | eg = -eh / 2 | ||
9729 | } | ||
9730 | } | ||
9731 | var em = ea.units_per_em, | ||
9732 | ee = 1 / em * d0; | ||
9733 | d8.scale(ee, ee); | ||
9734 | for (var eb = 0, ec = ei.length; eb < ec; eb++) { | ||
9735 | try { | ||
9736 | cW.glyphLook(ea, ei[eb]).draw() | ||
9737 | } catch (ed) { | ||
9738 | F.debug(ed) | ||
9739 | } | ||
9740 | } | ||
9741 | cP() | ||
9742 | } | ||
9743 | }; | ||
9744 | bB.prototype.text$line = function(eh, el, ek, ei, ef) { | ||
9745 | if (cE === t) { | ||
9746 | cE = d.createElement("canvas") | ||
9747 | } | ||
9748 | var eb = d8; | ||
9749 | d8 = cE.getContext("2d"); | ||
9750 | d8.font = W.css; | ||
9751 | var eg = W.measureTextWidth(eh); | ||
9752 | cE.width = eg; | ||
9753 | cE.height = d0; | ||
9754 | d8 = cE.getContext("2d"); | ||
9755 | d8.font = W.css; | ||
9756 | d8.textBaseline = "top"; | ||
9757 | bR.prototype.text$line(eh, 0, 0, 0, 37); | ||
9758 | var ea = cE.width / cE.height; | ||
9759 | d8 = eb; | ||
9760 | d8.bindTexture(d8.TEXTURE_2D, bS); | ||
9761 | d8.texImage2D(d8.TEXTURE_2D, 0, d8.RGBA, d8.RGBA, d8.UNSIGNED_BYTE, cE); | ||
9762 | d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_MAG_FILTER, d8.LINEAR); | ||
9763 | d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_MIN_FILTER, d8.LINEAR); | ||
9764 | d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_WRAP_T, d8.CLAMP_TO_EDGE); | ||
9765 | d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_WRAP_S, d8.CLAMP_TO_EDGE); | ||
9766 | var ee = 0; | ||
9767 | if (ef === 39) { | ||
9768 | ee = -eg | ||
9769 | } else { | ||
9770 | if (ef === 3) { | ||
9771 | ee = -eg / 2 | ||
9772 | } | ||
9773 | } | ||
9774 | var ec = new aP; | ||
9775 | var ed = d0 * 0.5; | ||
9776 | ec.translate(el + ee - ed / 2, ek - ed, ei); | ||
9777 | ec.scale(-ea * ed, -ed, ed); | ||
9778 | ec.translate(-1, -1, -1); | ||
9779 | ec.transpose(); | ||
9780 | var ej = new aP; | ||
9781 | ej.scale(1, -1, 1); | ||
9782 | ej.apply(dJ.array()); | ||
9783 | ej.transpose(); | ||
9784 | d8.useProgram(dQ); | ||
9785 | dc("aVertex2d", dQ, "aVertex", 3, cH); | ||
9786 | dc("aTextureCoord2d", dQ, "aTextureCoord", 2, ac); | ||
9787 | dZ("uSampler2d", dQ, "uSampler", [0]); | ||
9788 | dZ("uIsDrawingText2d", dQ, "uIsDrawingText", true); | ||
9789 | a9("uModel2d", dQ, "uModel", false, ec.array()); | ||
9790 | a9("uView2d", dQ, "uView", false, ej.array()); | ||
9791 | d2("uColor2d", dQ, "uColor", bo); | ||
9792 | d8.bindBuffer(d8.ELEMENT_ARRAY_BUFFER, R); | ||
9793 | d8.drawElements(d8.TRIANGLES, 6, d8.UNSIGNED_SHORT, 0) | ||
9794 | }; | ||
9795 | |||
9796 | function bi(ed, eg, ef, ee) { | ||
9797 | var ei, ec; | ||
9798 | if (ed.indexOf("\n") < 0) { | ||
9799 | ei = [ed]; | ||
9800 | ec = 1 | ||
9801 | } else { | ||
9802 | ei = ed.split(/\r?\n/g); | ||
9803 | ec = ei.length | ||
9804 | } | ||
9805 | var ea = 0; | ||
9806 | if (c1 === 101) { | ||
9807 | ea = a3 + dA | ||
9808 | } else { | ||
9809 | if (c1 === 3) { | ||
9810 | ea = a3 / 2 - (ec - 1) * d7 / 2 | ||
9811 | } else { | ||
9812 | if (c1 === 102) { | ||
9813 | ea = -(dA + (ec - 1) * d7) | ||
9814 | } | ||
9815 | } | ||
9816 | } | ||
9817 | for (var eb = 0; eb < ec; ++eb) { | ||
9818 | var eh = ei[eb]; | ||
9819 | dY.text$line(eh, eg, ef + ea, ee, N); | ||
9820 | ea += d7 | ||
9821 | } | ||
9822 | } | ||
9823 | |||
9824 | function bd(eq, el, ek, ep, en, ej) { | ||
9825 | if (eq.length === 0 || ep === 0 || en === 0) { | ||
9826 | return | ||
9827 | } | ||
9828 | if (d0 > en) { | ||
9829 | return | ||
9830 | } | ||
9831 | var em = -1; | ||
9832 | var ee = 0; | ||
9833 | var ea = 0; | ||
9834 | var eg = []; | ||
9835 | for (var ef = 0, es = eq.length; ef < es; ef++) { | ||
9836 | var eh = eq[ef]; | ||
9837 | var ev = eh === " "; | ||
9838 | var eo = W.measureTextWidth(eh); | ||
9839 | if (eh !== "\n" && ea + eo <= ep) { | ||
9840 | if (ev) { | ||
9841 | em = ef | ||
9842 | } | ||
9843 | ea += eo | ||
9844 | } else { | ||
9845 | if (em + 1 === ee) { | ||
9846 | if (ef > 0) { | ||
9847 | em = ef | ||
9848 | } else { | ||
9849 | return | ||
9850 | } | ||
9851 | } | ||
9852 | if (eh === "\n") { | ||
9853 | eg.push({ | ||
9854 | text: eq.substring(ee, ef), | ||
9855 | width: ea | ||
9856 | }); | ||
9857 | ee = ef + 1 | ||
9858 | } else { | ||
9859 | eg.push({ | ||
9860 | text: eq.substring(ee, em + 1), | ||
9861 | width: ea | ||
9862 | }); | ||
9863 | ee = em + 1 | ||
9864 | } | ||
9865 | ea = 0; | ||
9866 | ef = ee - 1 | ||
9867 | } | ||
9868 | } | ||
9869 | if (ee < es) { | ||
9870 | eg.push({ | ||
9871 | text: eq.substring(ee), | ||
9872 | width: ea | ||
9873 | }) | ||
9874 | } | ||
9875 | var eu = 1, | ||
9876 | ei = a3; | ||
9877 | if (N === 3) { | ||
9878 | eu = ep / 2 | ||
9879 | } else { | ||
9880 | if (N === 39) { | ||
9881 | eu = ep | ||
9882 | } | ||
9883 | } | ||
9884 | var er = eg.length, | ||
9885 | eb = q.min(er, q.floor(en / d7)); | ||
9886 | if (c1 === 101) { | ||
9887 | ei = a3 + dA | ||
9888 | } else { | ||
9889 | if (c1 === 3) { | ||
9890 | ei = en / 2 - d7 * (eb / 2 - 1) | ||
9891 | } else { | ||
9892 | if (c1 === 102) { | ||
9893 | ei = dA + d7 | ||
9894 | } | ||
9895 | } | ||
9896 | } | ||
9897 | var ec, ed, et; | ||
9898 | for (ec = 0; ec < er; ec++) { | ||
9899 | et = ec * d7; | ||
9900 | if (ei + et > en - dA) { | ||
9901 | break | ||
9902 | } | ||
9903 | ed = eg[ec]; | ||
9904 | dY.text$line(ed.text, el + eu, ek + ei + et, ej, N) | ||
9905 | } | ||
9906 | } | ||
9907 | cW.text = function() { | ||
9908 | if (cI === 5) { | ||
9909 | return | ||
9910 | } | ||
9911 | if (arguments.length === 3) { | ||
9912 | bi(bu(arguments[0]), arguments[1], arguments[2], 0) | ||
9913 | } else { | ||
9914 | if (arguments.length === 4) { | ||
9915 | bi(bu(arguments[0]), arguments[1], arguments[2], arguments[3]) | ||
9916 | } else { | ||
9917 | if (arguments.length === 5) { | ||
9918 | bd(bu(arguments[0]), arguments[1], arguments[2], arguments[3], arguments[4], 0) | ||
9919 | } else { | ||
9920 | if (arguments.length === 6) { | ||
9921 | bd(bu(arguments[0]), arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]) | ||
9922 | } | ||
9923 | } | ||
9924 | } | ||
9925 | } | ||
9926 | }; | ||
9927 | cW.textMode = function(ea) { | ||
9928 | cI = ea | ||
9929 | }; | ||
9930 | cW.loadGlyphs = function(eg) { | ||
9931 | var ei, eh, ee, ec, ep, eo, en, eq, ek, er, el, em = "[0-9\\-]+", | ||
9932 | ej; | ||
9933 | var ef = function(ex, ew) { | ||
9934 | var eu = 0, | ||
9935 | et = [], | ||
9936 | es, ev = new RegExp(ex, "g"); | ||
9937 | es = et[eu] = ev.exec(ew); | ||
9938 | while (es) { | ||
9939 | eu++; | ||
9940 | es = et[eu] = ev.exec(ew) | ||
9941 | } | ||
9942 | return et | ||
9943 | }; | ||
9944 | var eb = function(ex) { | ||
9945 | var ey = ef("[A-Za-z][0-9\\- ]+|Z", ex); | ||
9946 | var ew = function() { | ||
9947 | aD(); | ||
9948 | return dY.$ensureContext() | ||
9949 | }; | ||
9950 | var eu = function() { | ||
9951 | bn(); | ||
9952 | dd(); | ||
9953 | cP() | ||
9954 | }; | ||
9955 | ej = "return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();"; | ||
9956 | ei = 0; | ||
9957 | eh = 0; | ||
9958 | ee = 0; | ||
9959 | ec = 0; | ||
9960 | ep = 0; | ||
9961 | eo = 0; | ||
9962 | ex = 0; | ||
9963 | eq = 0; | ||
9964 | ek = ""; | ||
9965 | er = ey.length - 1; | ||
9966 | for (var et = 0; et < er; et++) { | ||
9967 | var es = ey[et][0], | ||
9968 | ev = ef(em, es); | ||
9969 | switch (es[0]) { | ||
9970 | case "M": | ||
9971 | ei = parseFloat(ev[0][0]); | ||
9972 | eh = parseFloat(ev[1][0]); | ||
9973 | ej += "curContext.moveTo(" + ei + "," + -eh + ");"; | ||
9974 | break; | ||
9975 | case "L": | ||
9976 | ei = parseFloat(ev[0][0]); | ||
9977 | eh = parseFloat(ev[1][0]); | ||
9978 | ej += "curContext.lineTo(" + ei + "," + -eh + ");"; | ||
9979 | break; | ||
9980 | case "H": | ||
9981 | ei = parseFloat(ev[0][0]); | ||
9982 | ej += "curContext.lineTo(" + ei + "," + -eh + ");"; | ||
9983 | break; | ||
9984 | case "V": | ||
9985 | eh = parseFloat(ev[0][0]); | ||
9986 | ej += "curContext.lineTo(" + ei + "," + -eh + ");"; | ||
9987 | break; | ||
9988 | case "T": | ||
9989 | ep = parseFloat(ev[0][0]); | ||
9990 | eo = parseFloat(ev[1][0]); | ||
9991 | if (ek === "Q" || ek === "T") { | ||
9992 | ex = q.sqrt(q.pow(ei - ee, 2) + q.pow(ec - eh, 2)); | ||
9993 | eq = q.PI + q.atan2(ee - ei, ec - eh); | ||
9994 | ee = ei + q.sin(eq) * ex; | ||
9995 | ec = eh + q.cos(eq) * ex | ||
9996 | } else { | ||
9997 | ee = ei; | ||
9998 | ec = eh | ||
9999 | } | ||
10000 | ej += "curContext.quadraticCurveTo(" + ee + "," + -ec + "," + ep + "," + -eo + ");"; | ||
10001 | ei = ep; | ||
10002 | eh = eo; | ||
10003 | break; | ||
10004 | case "Q": | ||
10005 | ee = parseFloat(ev[0][0]); | ||
10006 | ec = parseFloat(ev[1][0]); | ||
10007 | ep = parseFloat(ev[2][0]); | ||
10008 | eo = parseFloat(ev[3][0]); | ||
10009 | ej += "curContext.quadraticCurveTo(" + ee + "," + -ec + "," + ep + "," + -eo + ");"; | ||
10010 | ei = ep; | ||
10011 | eh = eo; | ||
10012 | break; | ||
10013 | case "Z": | ||
10014 | ej += "curContext.closePath();"; | ||
10015 | break | ||
10016 | } | ||
10017 | ek = es[0] | ||
10018 | } | ||
10019 | ej += "afterPathDraw();"; | ||
10020 | ej += "curContext.translate(" + el + ",0);"; | ||
10021 | ej += "}}"; | ||
10022 | return (new Function("beforePathDraw", "afterPathDraw", ej))(ew, eu) | ||
10023 | }; | ||
10024 | var ea = function(ev) { | ||
10025 | var eu = ev.getElementsByTagName("font"); | ||
10026 | cW.glyphTable[eg].horiz_adv_x = eu[0].getAttribute("horiz-adv-x"); | ||
10027 | var ex = ev.getElementsByTagName("font-face")[0]; | ||
10028 | cW.glyphTable[eg].units_per_em = parseFloat(ex.getAttribute("units-per-em")); | ||
10029 | cW.glyphTable[eg].ascent = parseFloat(ex.getAttribute("ascent")); | ||
10030 | cW.glyphTable[eg].descent = parseFloat(ex.getAttribute("descent")); | ||
10031 | var ez = ev.getElementsByTagName("glyph"), | ||
10032 | et = ez.length; | ||
10033 | for (var ey = 0; ey < et; ey++) { | ||
10034 | var es = ez[ey].getAttribute("unicode"); | ||
10035 | var ew = ez[ey].getAttribute("glyph-name"); | ||
10036 | el = ez[ey].getAttribute("horiz-adv-x"); | ||
10037 | if (el === null) { | ||
10038 | el = cW.glyphTable[eg].horiz_adv_x | ||
10039 | } | ||
10040 | en = ez[ey].getAttribute("d"); | ||
10041 | if (en !== t) { | ||
10042 | ej = eb(en); | ||
10043 | cW.glyphTable[eg][ew] = { | ||
10044 | name: ew, | ||
10045 | unicode: es, | ||
10046 | horiz_adv_x: el, | ||
10047 | draw: ej.draw | ||
10048 | } | ||
10049 | } | ||
10050 | } | ||
10051 | }; | ||
10052 | var ed = function() { | ||
10053 | var eu; | ||
10054 | try { | ||
10055 | eu = d.implementation.createDocument("", "", null) | ||
10056 | } catch (ew) { | ||
10057 | F.debug(ew.message); | ||
10058 | return | ||
10059 | } | ||
10060 | try { | ||
10061 | eu.async = false; | ||
10062 | eu.load(eg); | ||
10063 | ea(eu.getElementsByTagName("svg")[0]) | ||
10064 | } catch (et) { | ||
10065 | F.debug(et); | ||
10066 | try { | ||
10067 | var es = new D.XMLHttpRequest; | ||
10068 | es.open("GET", eg, false); | ||
10069 | es.send(null); | ||
10070 | ea(es.responseXML.documentElement) | ||
10071 | } catch (ev) { | ||
10072 | F.debug(et) | ||
10073 | } | ||
10074 | } | ||
10075 | }; | ||
10076 | cW.glyphTable[eg] = {}; | ||
10077 | ed(eg); | ||
10078 | return cW.glyphTable[eg] | ||
10079 | }; | ||
10080 | cW.param = function(ec) { | ||
10081 | var eb = "data-processing-" + ec; | ||
10082 | if (ae.hasAttribute(eb)) { | ||
10083 | return ae.getAttribute(eb) | ||
10084 | } | ||
10085 | for (var ed = 0, ea = ae.childNodes.length; ed < ea; ++ed) { | ||
10086 | var ee = ae.childNodes.item(ed); | ||
10087 | if (ee.nodeType !== 1 || ee.tagName.toLowerCase() !== "param") { | ||
10088 | continue | ||
10089 | } | ||
10090 | if (ee.getAttribute("name") === ec) { | ||
10091 | return ee.getAttribute("value") | ||
10092 | } | ||
10093 | } | ||
10094 | if (cQ.params.hasOwnProperty(ec)) { | ||
10095 | return cQ.params[ec] | ||
10096 | } | ||
10097 | return null | ||
10098 | }; | ||
10099 | |||
10100 | function cL(eb) { | ||
10101 | if (eb === "3D") { | ||
10102 | dY = new bB | ||
10103 | } else { | ||
10104 | if (eb === "2D") { | ||
10105 | dY = new bR | ||
10106 | } else { | ||
10107 | dY = new ca | ||
10108 | } | ||
10109 | } | ||
10110 | for (var ea in ca.prototype) { | ||
10111 | if (ca.prototype.hasOwnProperty(ea) && ea.indexOf("$") < 0) { | ||
10112 | cW[ea] = dY[ea] | ||
10113 | } | ||
10114 | } | ||
10115 | dY.$init() | ||
10116 | } | ||
10117 | |||
10118 | function cU(ea) { | ||
10119 | return function() { | ||
10120 | cL("2D"); | ||
10121 | return dY[ea].apply(this, arguments) | ||
10122 | } | ||
10123 | } | ||
10124 | ca.prototype.translate = cU("translate"); | ||
10125 | ca.prototype.transform = cU("transform"); | ||
10126 | ca.prototype.scale = cU("scale"); | ||
10127 | ca.prototype.pushMatrix = cU("pushMatrix"); | ||
10128 | ca.prototype.popMatrix = cU("popMatrix"); | ||
10129 | ca.prototype.resetMatrix = cU("resetMatrix"); | ||
10130 | ca.prototype.applyMatrix = cU("applyMatrix"); | ||
10131 | ca.prototype.rotate = cU("rotate"); | ||
10132 | ca.prototype.rotateZ = cU("rotateZ"); | ||
10133 | ca.prototype.shearX = cU("shearX"); | ||
10134 | ca.prototype.shearY = cU("shearY"); | ||
10135 | ca.prototype.redraw = cU("redraw"); | ||
10136 | ca.prototype.toImageData = cU("toImageData"); | ||
10137 | ca.prototype.ambientLight = cU("ambientLight"); | ||
10138 | ca.prototype.directionalLight = cU("directionalLight"); | ||
10139 | ca.prototype.lightFalloff = cU("lightFalloff"); | ||
10140 | ca.prototype.lightSpecular = cU("lightSpecular"); | ||
10141 | ca.prototype.pointLight = cU("pointLight"); | ||
10142 | ca.prototype.noLights = cU("noLights"); | ||
10143 | ca.prototype.spotLight = cU("spotLight"); | ||
10144 | ca.prototype.beginCamera = cU("beginCamera"); | ||
10145 | ca.prototype.endCamera = cU("endCamera"); | ||
10146 | ca.prototype.frustum = cU("frustum"); | ||
10147 | ca.prototype.box = cU("box"); | ||
10148 | ca.prototype.sphere = cU("sphere"); | ||
10149 | ca.prototype.ambient = cU("ambient"); | ||
10150 | ca.prototype.emissive = cU("emissive"); | ||
10151 | ca.prototype.shininess = cU("shininess"); | ||
10152 | ca.prototype.specular = cU("specular"); | ||
10153 | ca.prototype.fill = cU("fill"); | ||
10154 | ca.prototype.stroke = cU("stroke"); | ||
10155 | ca.prototype.strokeWeight = cU("strokeWeight"); | ||
10156 | ca.prototype.smooth = cU("smooth"); | ||
10157 | ca.prototype.noSmooth = cU("noSmooth"); | ||
10158 | ca.prototype.point = cU("point"); | ||
10159 | ca.prototype.vertex = cU("vertex"); | ||
10160 | ca.prototype.endShape = cU("endShape"); | ||
10161 | ca.prototype.bezierVertex = cU("bezierVertex"); | ||
10162 | ca.prototype.curveVertex = cU("curveVertex"); | ||
10163 | ca.prototype.curve = cU("curve"); | ||
10164 | ca.prototype.line = cU("line"); | ||
10165 | ca.prototype.bezier = cU("bezier"); | ||
10166 | ca.prototype.rect = cU("rect"); | ||
10167 | ca.prototype.ellipse = cU("ellipse"); | ||
10168 | ca.prototype.background = cU("background"); | ||
10169 | ca.prototype.image = cU("image"); | ||
10170 | ca.prototype.textWidth = cU("textWidth"); | ||
10171 | ca.prototype.text$line = cU("text$line"); | ||
10172 | ca.prototype.$ensureContext = cU("$ensureContext"); | ||
10173 | ca.prototype.$newPMatrix = cU("$newPMatrix"); | ||
10174 | ca.prototype.size = function(ea, ec, eb) { | ||
10175 | cL(eb === 2 ? "3D" : "2D"); | ||
10176 | cW.size(ea, ec, eb) | ||
10177 | }; | ||
10178 | ca.prototype.$init = G; | ||
10179 | bR.prototype.$init = function() { | ||
10180 | cW.size(cW.width, cW.height); | ||
10181 | d8.lineCap = "round"; | ||
10182 | cW.noSmooth(); | ||
10183 | cW.disableContextMenu() | ||
10184 | }; | ||
10185 | bB.prototype.$init = function() { | ||
10186 | cW.use3DContext = true; | ||
10187 | cW.disableContextMenu() | ||
10188 | }; | ||
10189 | ds.prototype.$ensureContext = function() { | ||
10190 | return d8 | ||
10191 | }; | ||
10192 | |||
10193 | function dy(eb, ed) { | ||
10194 | var ec = eb, | ||
10195 | ea = 0, | ||
10196 | ee = 0; | ||
10197 | cW.pmouseX = cW.mouseX; | ||
10198 | cW.pmouseY = cW.mouseY; | ||
10199 | if (ec.offsetParent) { | ||
10200 | do { | ||
10201 | ea += ec.offsetLeft; | ||
10202 | ee += ec.offsetTop | ||
10203 | } while (!!(ec = ec.offsetParent)) | ||
10204 | } | ||
10205 | ec = eb; | ||
10206 | do { | ||
10207 | ea -= ec.scrollLeft || 0; | ||
10208 | ee -= ec.scrollTop || 0 | ||
10209 | } while (!!(ec = ec.parentNode)); | ||
10210 | ea += ad; | ||
10211 | ee += dp; | ||
10212 | ea += aU; | ||
10213 | ee += bX; | ||
10214 | ea += D.pageXOffset; | ||
10215 | ee += D.pageYOffset; | ||
10216 | return { | ||
10217 | X: ea, | ||
10218 | Y: ee | ||
10219 | } | ||
10220 | } | ||
10221 | |||
10222 | function aI(ea, eb) { | ||
10223 | var ec = dy(ea, eb); | ||
10224 | cW.mouseX = eb.pageX - ec.X; | ||
10225 | cW.mouseY = eb.pageY - ec.Y | ||
10226 | } | ||
10227 | |||
10228 | function cu(eb) { | ||
10229 | var ed = dy(eb.changedTouches[0].target, eb.changedTouches[0]), | ||
10230 | ea; | ||
10231 | for (ea = 0; ea < eb.touches.length; ea++) { | ||
10232 | var ef = eb.touches[ea]; | ||
10233 | ef.offsetX = ef.pageX - ed.X; | ||
10234 | ef.offsetY = ef.pageY - ed.Y | ||
10235 | } | ||
10236 | for (ea = 0; ea < eb.targetTouches.length; ea++) { | ||
10237 | var ec = eb.targetTouches[ea]; | ||
10238 | ec.offsetX = ec.pageX - ed.X; | ||
10239 | ec.offsetY = ec.pageY - ed.Y | ||
10240 | } | ||
10241 | for (ea = 0; ea < eb.changedTouches.length; ea++) { | ||
10242 | var ee = eb.changedTouches[ea]; | ||
10243 | ee.offsetX = ee.pageX - ed.X; | ||
10244 | ee.offsetY = ee.pageY - ed.Y | ||
10245 | } | ||
10246 | return eb | ||
10247 | } | ||
10248 | bO(ae, "touchstart", function(ec) { | ||
10249 | ae.setAttribute("style", "-webkit-user-select: none"); | ||
10250 | ae.setAttribute("onclick", "void(0)"); | ||
10251 | ae.setAttribute("style", "-webkit-tap-highlight-color:rgba(0,0,0,0)"); | ||
10252 | for (var eb = 0, ea = au.length; eb < ea; eb++) { | ||
10253 | var ed = au[eb].type; | ||
10254 | if (ed === "mouseout" || ed === "mousemove" || ed === "mousedown" || ed === "mouseup" || ed === "DOMMouseScroll" || ed === "mousewheel" || ed === "touchstart") { | ||
10255 | de(au[eb]) | ||
10256 | } | ||
10257 | } | ||
10258 | if (cW.touchStart !== t || cW.touchMove !== t || cW.touchEnd !== t || cW.touchCancel !== t) { | ||
10259 | bO(ae, "touchstart", function(ee) { | ||
10260 | if (cW.touchStart !== t) { | ||
10261 | ee = cu(ee); | ||
10262 | cW.touchStart(ee) | ||
10263 | } | ||
10264 | }); | ||
10265 | bO(ae, "touchmove", function(ee) { | ||
10266 | if (cW.touchMove !== t) { | ||
10267 | ee.preventDefault(); | ||
10268 | ee = cu(ee); | ||
10269 | cW.touchMove(ee) | ||
10270 | } | ||
10271 | }); | ||
10272 | bO(ae, "touchend", function(ee) { | ||
10273 | if (cW.touchEnd !== t) { | ||
10274 | ee = cu(ee); | ||
10275 | cW.touchEnd(ee) | ||
10276 | } | ||
10277 | }); | ||
10278 | bO(ae, "touchcancel", function(ee) { | ||
10279 | if (cW.touchCancel !== t) { | ||
10280 | ee = cu(ee); | ||
10281 | cW.touchCancel(ee) | ||
10282 | } | ||
10283 | }) | ||
10284 | } else { | ||
10285 | bO(ae, "touchstart", function(ee) { | ||
10286 | aI(ae, ee.touches[0]); | ||
10287 | cW.__mousePressed = true; | ||
10288 | cW.mouseDragging = false; | ||
10289 | cW.mouseButton = 37; | ||
10290 | if (typeof cW.mousePressed === "function") { | ||
10291 | cW.mousePressed() | ||
10292 | } | ||
10293 | }); | ||
10294 | bO(ae, "touchmove", function(ee) { | ||
10295 | ee.preventDefault(); | ||
10296 | aI(ae, ee.touches[0]); | ||
10297 | if (typeof cW.mouseMoved === "function" && !cW.__mousePressed) { | ||
10298 | cW.mouseMoved() | ||
10299 | } | ||
10300 | if (typeof cW.mouseDragged === "function" && cW.__mousePressed) { | ||
10301 | cW.mouseDragged(); | ||
10302 | cW.mouseDragging = true | ||
10303 | } | ||
10304 | }); | ||
10305 | bO(ae, "touchend", function(ee) { | ||
10306 | cW.__mousePressed = false; | ||
10307 | if (typeof cW.mouseClicked === "function" && !cW.mouseDragging) { | ||
10308 | cW.mouseClicked() | ||
10309 | } | ||
10310 | if (typeof cW.mouseReleased === "function") { | ||
10311 | cW.mouseReleased() | ||
10312 | } | ||
10313 | }) | ||
10314 | } | ||
10315 | ae.dispatchEvent(ec) | ||
10316 | }); | ||
10317 | (function() { | ||
10318 | var ea = true, | ||
10319 | eb = function(ec) { | ||
10320 | ec.preventDefault(); | ||
10321 | ec.stopPropagation() | ||
10322 | }; | ||
10323 | cW.disableContextMenu = function() { | ||
10324 | if (!ea) { | ||
10325 | return | ||
10326 | } | ||
10327 | bO(ae, "contextmenu", eb); | ||
10328 | ea = false | ||
10329 | }; | ||
10330 | cW.enableContextMenu = function() { | ||
10331 | if (ea) { | ||
10332 | return | ||
10333 | } | ||
10334 | de({ | ||
10335 | elem: ae, | ||
10336 | type: "contextmenu", | ||
10337 | fn: eb | ||
10338 | }); | ||
10339 | ea = true | ||
10340 | } | ||
10341 | })(); | ||
10342 | bO(ae, "mousemove", function(ea) { | ||
10343 | aI(ae, ea); | ||
10344 | if (typeof cW.mouseMoved === "function" && !cW.__mousePressed) { | ||
10345 | cW.mouseMoved() | ||
10346 | } | ||
10347 | if (typeof cW.mouseDragged === "function" && cW.__mousePressed) { | ||
10348 | cW.mouseDragged(); | ||
10349 | cW.mouseDragging = true | ||
10350 | } | ||
10351 | }); | ||
10352 | bO(ae, "mouseout", function(ea) { | ||
10353 | if (typeof cW.mouseOut === "function") { | ||
10354 | cW.mouseOut() | ||
10355 | } | ||
10356 | }); | ||
10357 | bO(ae, "mouseover", function(ea) { | ||
10358 | aI(ae, ea); | ||
10359 | if (typeof cW.mouseOver === "function") { | ||
10360 | cW.mouseOver() | ||
10361 | } | ||
10362 | }); | ||
10363 | ae.onmousedown = function() { | ||
10364 | ae.focus(); | ||
10365 | return false | ||
10366 | }; | ||
10367 | bO(ae, "mousedown", function(ea) { | ||
10368 | cW.__mousePressed = true; | ||
10369 | cW.mouseDragging = false; | ||
10370 | switch (ea.which) { | ||
10371 | case 1: | ||
10372 | cW.mouseButton = 37; | ||
10373 | break; | ||
10374 | case 2: | ||
10375 | cW.mouseButton = 3; | ||
10376 | break; | ||
10377 | case 3: | ||
10378 | cW.mouseButton = 39; | ||
10379 | break | ||
10380 | } | ||
10381 | if (typeof cW.mousePressed === "function") { | ||
10382 | cW.mousePressed() | ||
10383 | } | ||
10384 | }); | ||
10385 | bO(ae, "mouseup", function(ea) { | ||
10386 | cW.__mousePressed = false; | ||
10387 | if (typeof cW.mouseClicked === "function" && !cW.mouseDragging) { | ||
10388 | cW.mouseClicked() | ||
10389 | } | ||
10390 | if (typeof cW.mouseReleased === "function") { | ||
10391 | cW.mouseReleased() | ||
10392 | } | ||
10393 | }); | ||
10394 | var an = function(ea) { | ||
10395 | var eb = 0; | ||
10396 | if (ea.wheelDelta) { | ||
10397 | eb = ea.wheelDelta / 120; | ||
10398 | if (D.opera) { | ||
10399 | eb = -eb | ||
10400 | } | ||
10401 | } else { | ||
10402 | if (ea.detail) { | ||
10403 | eb = -ea.detail / 3 | ||
10404 | } | ||
10405 | } | ||
10406 | cW.mouseScroll = eb; | ||
10407 | if (eb && typeof cW.mouseScrolled === "function") { | ||
10408 | cW.mouseScrolled() | ||
10409 | } | ||
10410 | }; | ||
10411 | bO(d, "DOMMouseScroll", an); | ||
10412 | bO(d, "mousewheel", an); | ||
10413 | if (!ae.getAttribute("tabindex")) { | ||
10414 | ae.setAttribute("tabindex", 0) | ||
10415 | } | ||
10416 | |||
10417 | function dD(eb) { | ||
10418 | var ea = eb.which || eb.keyCode; | ||
10419 | switch (ea) { | ||
10420 | case 13: | ||
10421 | return 10; | ||
10422 | case 91: | ||
10423 | case 93: | ||
10424 | case 224: | ||
10425 | return 157; | ||
10426 | case 57392: | ||
10427 | return 17; | ||
10428 | case 46: | ||
10429 | return 127; | ||
10430 | case 45: | ||
10431 | return 155 | ||
10432 | } | ||
10433 | return ea | ||
10434 | } | ||
10435 | |||
10436 | function cB(eb) { | ||
10437 | var ec = eb.which || eb.keyCode; | ||
10438 | var ea = eb.shiftKey || eb.ctrlKey || eb.altKey || eb.metaKey; | ||
10439 | switch (ec) { | ||
10440 | case 13: | ||
10441 | ec = ea ? 13 : 10; | ||
10442 | break; | ||
10443 | case 8: | ||
10444 | ec = ea ? 127 : 8; | ||
10445 | break | ||
10446 | } | ||
10447 | return new bP(ec) | ||
10448 | } | ||
10449 | |||
10450 | function cR(ea) { | ||
10451 | if (typeof ea.preventDefault === "function") { | ||
10452 | ea.preventDefault() | ||
10453 | } else { | ||
10454 | if (typeof ea.stopPropagation === "function") { | ||
10455 | ea.stopPropagation() | ||
10456 | } | ||
10457 | } | ||
10458 | return false | ||
10459 | } | ||
10460 | |||
10461 | function dG() { | ||
10462 | var ea; | ||
10463 | for (ea in ag) { | ||
10464 | if (ag.hasOwnProperty(ea)) { | ||
10465 | cW.__keyPressed = true; | ||
10466 | return | ||
10467 | } | ||
10468 | } | ||
10469 | cW.__keyPressed = false | ||
10470 | } | ||
10471 | |||
10472 | function cx() { | ||
10473 | cW.__keyPressed = false; | ||
10474 | ag = []; | ||
10475 | dI = null | ||
10476 | } | ||
10477 | |||
10478 | function bq(ea, eb) { | ||
10479 | ag[ea] = eb; | ||
10480 | dI = null; | ||
10481 | cW.key = eb; | ||
10482 | cW.keyCode = ea; | ||
10483 | cW.keyPressed(); | ||
10484 | cW.keyCode = 0; | ||
10485 | cW.keyTyped(); | ||
10486 | dG() | ||
10487 | } | ||
10488 | |||
10489 | function cz(eb) { | ||
10490 | var ea = dD(eb); | ||
10491 | if (ea === 127) { | ||
10492 | bq(ea, new bP(127)); | ||
10493 | return | ||
10494 | } | ||
10495 | if (dX.indexOf(ea) < 0) { | ||
10496 | dI = ea; | ||
10497 | return | ||
10498 | } | ||
10499 | var ec = new bP(65535); | ||
10500 | cW.key = ec; | ||
10501 | cW.keyCode = ea; | ||
10502 | ag[ea] = ec; | ||
10503 | cW.keyPressed(); | ||
10504 | dI = null; | ||
10505 | dG(); | ||
10506 | return cR(eb) | ||
10507 | } | ||
10508 | |||
10509 | function dv(eb) { | ||
10510 | if (dI === null) { | ||
10511 | return | ||
10512 | } | ||
10513 | var ea = dI, | ||
10514 | ec = cB(eb); | ||
10515 | bq(ea, ec); | ||
10516 | return cR(eb) | ||
10517 | } | ||
10518 | |||
10519 | function cp(eb) { | ||
10520 | var ea = dD(eb), | ||
10521 | ec = ag[ea]; | ||
10522 | if (ec === t) { | ||
10523 | return | ||
10524 | } | ||
10525 | cW.key = ec; | ||
10526 | cW.keyCode = ea; | ||
10527 | cW.keyReleased(); | ||
10528 | delete ag[ea]; | ||
10529 | dG() | ||
10530 | } | ||
10531 | if (!cV) { | ||
10532 | if (ba instanceof F.Sketch) { | ||
10533 | cQ = ba | ||
10534 | } else { | ||
10535 | if (typeof ba === "function") { | ||
10536 | cQ = new F.Sketch(ba) | ||
10537 | } else { | ||
10538 | if (!ba) { | ||
10539 | cQ = new F.Sketch(function() {}) | ||
10540 | } else { | ||
10541 | cQ = F.compile(ba) | ||
10542 | } | ||
10543 | } | ||
10544 | } | ||
10545 | cW.externals.sketch = cQ; | ||
10546 | cL(); | ||
10547 | ae.onfocus = function() { | ||
10548 | cW.focused = true | ||
10549 | }; | ||
10550 | ae.onblur = function() { | ||
10551 | cW.focused = false; | ||
10552 | if (!cQ.options.globalKeyEvents) { | ||
10553 | cx() | ||
10554 | } | ||
10555 | }; | ||
10556 | if (cQ.options.pauseOnBlur) { | ||
10557 | bO(D, "focus", function() { | ||
10558 | if (aC) { | ||
10559 | cW.loop() | ||
10560 | } | ||
10561 | }); | ||
10562 | bO(D, "blur", function() { | ||
10563 | if (aC && ax) { | ||
10564 | cW.noLoop(); | ||
10565 | aC = true | ||
10566 | } | ||
10567 | cx() | ||
10568 | }) | ||
10569 | } | ||
10570 | var aV = cQ.options.globalKeyEvents ? D : ae; | ||
10571 | bO(aV, "keydown", cz); | ||
10572 | bO(aV, "keypress", dv); | ||
10573 | bO(aV, "keyup", cp); | ||
10574 | for (var c4 in F.lib) { | ||
10575 | if (F.lib.hasOwnProperty(c4)) { | ||
10576 | if (F.lib[c4].hasOwnProperty("attach")) { | ||
10577 | F.lib[c4].attach(cW) | ||
10578 | } else { | ||
10579 | if (F.lib[c4] instanceof Function) { | ||
10580 | F.lib[c4].call(this) | ||
10581 | } | ||
10582 | } | ||
10583 | } | ||
10584 | } | ||
10585 | var dB = 100; | ||
10586 | var b6 = function(ed) { | ||
10587 | if (!(cQ.imageCache.pending || H.preloading.pending(dB))) { | ||
10588 | if (D.opera) { | ||
10589 | var ec, eb, ea = cQ.imageCache.operaCache; | ||
10590 | for (ec in ea) { | ||
10591 | if (ea.hasOwnProperty(ec)) { | ||
10592 | eb = ea[ec]; | ||
10593 | if (eb !== null) { | ||
10594 | d.body.removeChild(eb) | ||
10595 | } | ||
10596 | delete ea[ec] | ||
10597 | } | ||
10598 | } | ||
10599 | } | ||
10600 | cQ.attach(ed, g); | ||
10601 | cQ.onLoad(ed); | ||
10602 | if (ed.setup) { | ||
10603 | ed.setup(); | ||
10604 | ed.resetMatrix(); | ||
10605 | cQ.onSetup() | ||
10606 | } | ||
10607 | T(); | ||
10608 | if (ed.draw) { | ||
10609 | if (!aC) { | ||
10610 | ed.redraw() | ||
10611 | } else { | ||
10612 | ed.loop() | ||
10613 | } | ||
10614 | } | ||
10615 | } else { | ||
10616 | D.setTimeout(function() { | ||
10617 | b6(ed) | ||
10618 | }, dB) | ||
10619 | } | ||
10620 | }; | ||
10621 | a(this); | ||
10622 | b6(cW) | ||
10623 | } else { | ||
10624 | cQ = new F.Sketch; | ||
10625 | cL(); | ||
10626 | cW.size = function(ea, ec, eb) { | ||
10627 | if (eb && eb === 2) { | ||
10628 | cL("3D") | ||
10629 | } else { | ||
10630 | cL("2D") | ||
10631 | } | ||
10632 | cW.size(ea, ec, eb) | ||
10633 | } | ||
10634 | } | ||
10635 | }; | ||
10636 | F.debug = s; | ||
10637 | F.prototype = g; | ||
10638 | |||
10639 | function u() { | ||
10640 | var R = ["abs", "acos", "alpha", "ambient", "ambientLight", "append", "applyMatrix", "arc", "arrayCopy", "asin", "atan", "atan2", "background", "beginCamera", "beginDraw", "beginShape", "bezier", "bezierDetail", "bezierPoint", "bezierTangent", "bezierVertex", "binary", "blend", "blendColor", "blit_resize", "blue", "box", "breakShape", "brightness", "camera", "ceil", "Character", "color", "colorMode", "concat", "constrain", "copy", "cos", "createFont", "createGraphics", "createImage", "cursor", "curve", "curveDetail", "curvePoint", "curveTangent", "curveTightness", "curveVertex", "day", "degrees", "directionalLight", "disableContextMenu", "dist", "draw", "ellipse", "ellipseMode", "emissive", "enableContextMenu", "endCamera", "endDraw", "endShape", "exit", "exp", "expand", "externals", "fill", "filter", "floor", "focused", "frameCount", "frameRate", "frustum", "get", "glyphLook", "glyphTable", "green", "height", "hex", "hint", "hour", "hue", "image", "imageMode", "intersect", "join", "key", "keyCode", "keyPressed", "keyReleased", "keyTyped", "lerp", "lerpColor", "lightFalloff", "lights", "lightSpecular", "line", "link", "loadBytes", "loadFont", "loadGlyphs", "loadImage", "loadPixels", "loadShape", "loadXML", "loadStrings", "log", "loop", "mag", "map", "match", "matchAll", "max", "millis", "min", "minute", "mix", "modelX", "modelY", "modelZ", "modes", "month", "mouseButton", "mouseClicked", "mouseDragged", "mouseMoved", "mouseOut", "mouseOver", "mousePressed", "mouseReleased", "mouseScroll", "mouseScrolled", "mouseX", "mouseY", "name", "nf", "nfc", "nfp", "nfs", "noCursor", "noFill", "noise", "noiseDetail", "noiseSeed", "noLights", "noLoop", "norm", "normal", "noSmooth", "noStroke", "noTint", "ortho", "param", "parseBoolean", "parseByte", "parseChar", "parseFloat", "parseInt", "peg", "perspective", "PImage", "pixels", "PMatrix2D", "PMatrix3D", "PMatrixStack", "pmouseX", "pmouseY", "point", "pointLight", "popMatrix", "popStyle", "pow", "print", "printCamera", "println", "printMatrix", "printProjection", "PShape", "PShapeSVG", "pushMatrix", "pushStyle", "quad", "radians", "random", "Random", "randomSeed", "rect", "rectMode", "red", "redraw", "requestImage", "resetMatrix", "reverse", "rotate", "rotateX", "rotateY", "rotateZ", "round", "saturation", "save", "saveFrame", "saveStrings", "scale", "screenX", "screenY", "screenZ", "second", "set", "setup", "shape", "shapeMode", "shared", "shearX", "shearY", "shininess", "shorten", "sin", "size", "smooth", "sort", "specular", "sphere", "sphereDetail", "splice", "split", "splitTokens", "spotLight", "sq", "sqrt", "status", "str", "stroke", "strokeCap", "strokeJoin", "strokeWeight", "subset", "tan", "text", "textAlign", "textAscent", "textDescent", "textFont", "textLeading", "textMode", "textSize", "texture", "textureMode", "textWidth", "tint", "toImageData", "touchCancel", "touchEnd", "touchMove", "touchStart", "translate", "transform", "triangle", "trim", "unbinary", "unhex", "updatePixels", "use3DContext", "vertex", "width", "XMLElement", "XML", "year", "__contains", "__equals", "__equalsIgnoreCase", "__frameRate", "__hashCode", "__int_cast", "__instanceof", "__keyPressed", "__mousePressed", "__printStackTrace", "__replace", "__replaceAll", "__replaceFirst", "__toCharArray", "__split", "__codePointAt", "__startsWith", "__endsWith", "__matches"]; | ||
10641 | var P = {}; | ||
10642 | var Q, O; | ||
10643 | for (Q = 0, O = R.length; Q < O; ++Q) { | ||
10644 | P[R[Q]] = null | ||
10645 | } | ||
10646 | for (var S in F.lib) { | ||
10647 | if (F.lib.hasOwnProperty(S)) { | ||
10648 | if (F.lib[S].exports) { | ||
10649 | var N = F.lib[S].exports; | ||
10650 | for (Q = 0, O = N.length; Q < O; ++Q) { | ||
10651 | P[N[Q]] = null | ||
10652 | } | ||
10653 | } | ||
10654 | } | ||
10655 | } | ||
10656 | return P | ||
10657 | } | ||
10658 | |||
10659 | function c(ar) { | ||
10660 | var aX = u(); | ||
10661 | |||
10662 | function aE(bq) { | ||
10663 | var bt = []; | ||
10664 | var bv = bq.split(/([\{\[\(\)\]\}])/); | ||
10665 | var by = bv[0]; | ||
10666 | var bw = []; | ||
10667 | for (var bs = 1; bs < bv.length; bs += 2) { | ||
10668 | var bx = bv[bs]; | ||
10669 | if (bx === "[" || bx === "{" || bx === "(") { | ||
10670 | bw.push(by); | ||
10671 | by = bx | ||
10672 | } else { | ||
10673 | if (bx === "]" || bx === "}" || bx === ")") { | ||
10674 | var br = bx === "}" ? "A" : bx === ")" ? "B" : "C"; | ||
10675 | var bu = bt.length; | ||
10676 | bt.push(by + bx); | ||
10677 | by = bw.pop() + '"' + br + (bu + 1) + '"' | ||
10678 | } | ||
10679 | } | ||
10680 | by += bv[bs + 1] | ||
10681 | } | ||
10682 | bt.unshift(by); | ||
10683 | return bt | ||
10684 | } | ||
10685 | |||
10686 | function aj(br, bq) { | ||
10687 | return br.replace(/'(\d+)'/g, function(bt, bs) { | ||
10688 | var bu = bq[bs]; | ||
10689 | if (bu.charAt(0) === "/") { | ||
10690 | return bu | ||
10691 | } | ||
10692 | return /^'((?:[^'\\\n])|(?:\\.[0-9A-Fa-f]*))'$/.test(bu) ? "(new $p.Character(" + bu + "))" : bu | ||
10693 | }) | ||
10694 | } | ||
10695 | |||
10696 | function aP(bt) { | ||
10697 | var bs = /^\s*/.exec(bt), | ||
10698 | bq; | ||
10699 | if (bs[0].length === bt.length) { | ||
10700 | bq = { | ||
10701 | left: bs[0], | ||
10702 | middle: "", | ||
10703 | right: "" | ||
10704 | } | ||
10705 | } else { | ||
10706 | var br = /\s*$/.exec(bt); | ||
10707 | bq = { | ||
10708 | left: bs[0], | ||
10709 | middle: bt.substring(bs[0].length, br.index), | ||
10710 | right: br[0] | ||
10711 | } | ||
10712 | } | ||
10713 | bq.untrim = function(bu) { | ||
10714 | return this.left + bu + this.right | ||
10715 | }; | ||
10716 | return bq | ||
10717 | } | ||
10718 | |||
10719 | function a6(bq) { | ||
10720 | return bq.replace(/^\s+/, "").replace(/\s+$/, "") | ||
10721 | } | ||
10722 | |||
10723 | function av(bs, bt) { | ||
10724 | for (var br = 0, bq = bt.length; br < bq; ++br) { | ||
10725 | bs[bt[br]] = null | ||
10726 | } | ||
10727 | return bs | ||
10728 | } | ||
10729 | |||
10730 | function ba(br) { | ||
10731 | for (var bq in br) { | ||
10732 | if (br.hasOwnProperty(bq)) { | ||
10733 | return false | ||
10734 | } | ||
10735 | } | ||
10736 | return true | ||
10737 | } | ||
10738 | |||
10739 | function aQ(bq) { | ||
10740 | return bq.substring(2, bq.length - 1) | ||
10741 | } | ||
10742 | var bg = ar.replace(/\r\n?|\n\r/g, "\n"); | ||
10743 | var N = []; | ||
10744 | var a3 = bg.replace(/("(?:[^"\\\n]|\\.)*")|('(?:[^'\\\n]|\\.)*')|(([\[\(=|&!\^:?]\s*)(\/(?![*\/])(?:[^\/\\\n]|\\.)*\/[gim]*)\b)|(\/\/[^\n]*\n)|(\/\*(?:(?!\*\/)(?:.|\n))*\*\/)/g, function(by, br, bv, bw, bt, bx, bq, bs) { | ||
10745 | var bu; | ||
10746 | if (br || bv) { | ||
10747 | bu = N.length; | ||
10748 | N.push(by); | ||
10749 | return "'" + bu + "'" | ||
10750 | } | ||
10751 | if (bw) { | ||
10752 | bu = N.length; | ||
10753 | N.push(bx); | ||
10754 | return bt + "'" + bu + "'" | ||
10755 | } | ||
10756 | return bs !== "" ? " " : "\n" | ||
10757 | }); | ||
10758 | a3 = a3.replace(/__x([0-9A-F]{4})/g, function(br, bq) { | ||
10759 | return "__x005F_x" + bq | ||
10760 | }); | ||
10761 | a3 = a3.replace(/\$/g, "__x0024"); | ||
10762 | var Z; | ||
10763 | var aA = a3; | ||
10764 | var aa = function(br, bs, bq, bt) { | ||
10765 | if (!!bs || !!bt) { | ||
10766 | return br | ||
10767 | } | ||
10768 | Z = true; | ||
10769 | return "" | ||
10770 | }; | ||
10771 | do { | ||
10772 | Z = false; | ||
10773 | aA = aA.replace(/([<]?)<\s*((?:\?|[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\[\])*(?:\s+(?:extends|super)\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)?(?:\s*,\s*(?:\?|[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\[\])*(?:\s+(?:extends|super)\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)?)*)\s*>([=]?)/g, aa) | ||
10774 | } while (Z); | ||
10775 | var bk = aE(aA); | ||
10776 | var al; | ||
10777 | var aJ = {}, | ||
10778 | a9, az = 0; | ||
10779 | |||
10780 | function bc(br, bq) { | ||
10781 | var bs = bk.length; | ||
10782 | bk.push(br); | ||
10783 | return '"' + bq + bs + '"' | ||
10784 | } | ||
10785 | |||
10786 | function a7() { | ||
10787 | return "class" + ++az | ||
10788 | } | ||
10789 | |||
10790 | function bl(br, bs, bq) { | ||
10791 | br.classId = bs; | ||
10792 | br.scopeId = bq; | ||
10793 | aJ[bs] = br | ||
10794 | } | ||
10795 | var V, S, ap, aV, bi, aZ; | ||
10796 | var O = /\b((?:(?:public|private|final|protected|static|abstract)\s+)*)(class|interface)\s+([A-Za-z_$][\w$]*\b)(\s+extends\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?(\s+implements\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?\s*("A\d+")/g; | ||
10797 | var bb = /\b((?:(?:public|private|final|protected|static|abstract|synchronized)\s+)*)((?!(?:else|new|return|throw|function|public|private|protected)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+"|;)/g; | ||
10798 | var aM = /^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:else|new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*(?:"C\d+"\s*)*([=,]|$)/; | ||
10799 | var bm = /\b((?:(?:public|private|final|protected|static|abstract)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+")/g; | ||
10800 | var W = /^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*/; | ||
10801 | var au = /\bfunction(?:\s+([A-Za-z_$][\w$]*))?\s*("B\d+")\s*("A\d+")/g; | ||
10802 | |||
10803 | function ae(br) { | ||
10804 | var bq = br; | ||
10805 | bq = bq.replace(O, function(bs) { | ||
10806 | return bc(bs, "E") | ||
10807 | }); | ||
10808 | bq = bq.replace(bb, function(bs) { | ||
10809 | return bc(bs, "D") | ||
10810 | }); | ||
10811 | bq = bq.replace(au, function(bs) { | ||
10812 | return bc(bs, "H") | ||
10813 | }); | ||
10814 | return bq | ||
10815 | } | ||
10816 | |||
10817 | function bd(bs, br) { | ||
10818 | var bq = bs.replace(bm, function(bx, bu, bv, by, bw, bt) { | ||
10819 | if (bv !== br) { | ||
10820 | return bx | ||
10821 | } | ||
10822 | return bc(bx, "G") | ||
10823 | }); | ||
10824 | return bq | ||
10825 | } | ||
10826 | |||
10827 | function aH(bq) { | ||
10828 | this.name = bq | ||
10829 | } | ||
10830 | aH.prototype.toString = function() { | ||
10831 | return this.name | ||
10832 | }; | ||
10833 | |||
10834 | function ao(br, bq) { | ||
10835 | this.params = br; | ||
10836 | this.methodArgsParam = bq | ||
10837 | } | ||
10838 | ao.prototype.getNames = function() { | ||
10839 | var bs = []; | ||
10840 | for (var br = 0, bq = this.params.length; br < bq; ++br) { | ||
10841 | bs.push(this.params[br].name) | ||
10842 | } | ||
10843 | return bs | ||
10844 | }; | ||
10845 | ao.prototype.prependMethodArgs = function(bq) { | ||
10846 | if (!this.methodArgsParam) { | ||
10847 | return bq | ||
10848 | } | ||
10849 | return "{\nvar " + this.methodArgsParam.name + " = Array.prototype.slice.call(arguments, " + this.params.length + ");\n" + bq.substring(1) | ||
10850 | }; | ||
10851 | ao.prototype.toString = function() { | ||
10852 | if (this.params.length === 0) { | ||
10853 | return "()" | ||
10854 | } | ||
10855 | var bq = "("; | ||
10856 | for (var bs = 0, br = this.params.length; bs < br; ++bs) { | ||
10857 | bq += this.params[bs] + ", " | ||
10858 | } | ||
10859 | return bq.substring(0, bq.length - 2) + ")" | ||
10860 | }; | ||
10861 | |||
10862 | function aD(bw) { | ||
10863 | var bt = a6(bw.substring(1, bw.length - 1)); | ||
10864 | var bq = [], | ||
10865 | bu = null; | ||
10866 | if (bt !== "") { | ||
10867 | var br = bt.split(","); | ||
10868 | for (var bs = 0; bs < br.length; ++bs) { | ||
10869 | var bv = /\b([A-Za-z_$][\w$]*\b)(\s*"[ABC][\d]*")*\s*$/.exec(br[bs]); | ||
10870 | if (bs === br.length - 1 && br[bs].indexOf("...") >= 0) { | ||
10871 | bu = new aH(bv[1]); | ||
10872 | break | ||
10873 | } | ||
10874 | bq.push(new aH(bv[1])) | ||
10875 | } | ||
10876 | } | ||
10877 | return new ao(bq, bu) | ||
10878 | } | ||
10879 | |||
10880 | function aq(bu) { | ||
10881 | var bt = bu; | ||
10882 | bt = bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"C\d+")+\s*("A\d+")/g, function(bw, bv, bx) { | ||
10883 | return bx | ||
10884 | }); | ||
10885 | bt = bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"B\d+")\s*("A\d+")/g, function(bw, bv, bx) { | ||
10886 | return bc(bw, "F") | ||
10887 | }); | ||
10888 | bt = bt.replace(au, function(bv) { | ||
10889 | return bc(bv, "H") | ||
10890 | }); | ||
10891 | bt = bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*("C\d+"(?:\s*"C\d+")*)/g, function(bA, bz, bx) { | ||
10892 | var bw = bx.replace(/"C(\d+)"/g, function(bC, bB) { | ||
10893 | return bk[bB] | ||
10894 | }).replace(/\[\s*\]/g, "[null]").replace(/\s*\]\s*\[\s*/g, ", "); | ||
10895 | var by = "{" + bw.substring(1, bw.length - 1) + "}"; | ||
10896 | var bv = "('" + bz + "', " + bc(by, "A") + ")"; | ||
10897 | return "$p.createJavaArray" + bc(bv, "B") | ||
10898 | }); | ||
10899 | bt = bt.replace(/(\.\s*length)\s*"B\d+"/g, "$1"); | ||
10900 | bt = bt.replace(/#([0-9A-Fa-f]{6})\b/g, function(bv, bw) { | ||
10901 | return "0xFF" + bw | ||
10902 | }); | ||
10903 | bt = bt.replace(/"B(\d+)"(\s*(?:[\w$']|"B))/g, function(by, bw, bx) { | ||
10904 | var bz = bk[bw]; | ||
10905 | if (!/^\(\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\s*(?:"C\d+"\s*)*\)$/.test(bz)) { | ||
10906 | return by | ||
10907 | } | ||
10908 | if (/^\(\s*int\s*\)$/.test(bz)) { | ||
10909 | return "(int)" + bx | ||
10910 | } | ||
10911 | var bv = bz.split(/"C(\d+)"/g); | ||
10912 | if (bv.length > 1) { | ||
10913 | if (!/^\[\s*\]$/.test(bk[bv[1]])) { | ||
10914 | return by | ||
10915 | } | ||
10916 | } | ||
10917 | return "" + bx | ||
10918 | }); | ||
10919 | bt = bt.replace(/\(int\)([^,\]\)\}\?\:\*\+\-\/\^\|\%\&\~<\>\=]+)/g, function(bw, bv) { | ||
10920 | var bx = aP(bv); | ||
10921 | return bx.untrim("__int_cast(" + bx.middle + ")") | ||
10922 | }); | ||
10923 | bt = bt.replace(/\bsuper(\s*"B\d+")/g, "$$superCstr$1").replace(/\bsuper(\s*\.)/g, "$$super$1"); | ||
10924 | bt = bt.replace(/\b0+((\d*)(?:\.[\d*])?(?:[eE][\-\+]?\d+)?[fF]?)\b/, function(bx, bw, bv) { | ||
10925 | if (bw === bv) { | ||
10926 | return bx | ||
10927 | } | ||
10928 | return bv === "" ? "0" + bw : bw | ||
10929 | }); | ||
10930 | bt = bt.replace(/\b(\.?\d+\.?)[fF]\b/g, "$1"); | ||
10931 | bt = bt.replace(/([^\s])%([^=\s])/g, "$1 % $2"); | ||
10932 | bt = bt.replace(/\b(frameRate|keyPressed|mousePressed)\b(?!\s*"B)/g, "__$1"); | ||
10933 | bt = bt.replace(/\b(boolean|byte|char|float|int)\s*"B/g, function(bw, bv) { | ||
10934 | return "parse" + bv.substring(0, 1).toUpperCase() + bv.substring(1) + '"B' | ||
10935 | }); | ||
10936 | bt = bt.replace(/\bpixels\b\s*(("C(\d+)")|\.length)?(\s*=(?!=)([^,\]\)\}]+))?/g, function(bw, bA, bv, bz, by, bB) { | ||
10937 | if (bv) { | ||
10938 | var bx = bk[bz]; | ||
10939 | if (by) { | ||
10940 | return "pixels.setPixel" + bc("(" + bx.substring(1, bx.length - 1) + "," + bB + ")", "B") | ||
10941 | } | ||
10942 | return "pixels.getPixel" + bc("(" + bx.substring(1, bx.length - 1) + ")", "B") | ||
10943 | } | ||
10944 | if (bA) { | ||
10945 | return "pixels.getLength" + bc("()", "B") | ||
10946 | } | ||
10947 | if (by) { | ||
10948 | return "pixels.set" + bc("(" + bB + ")", "B") | ||
10949 | } | ||
10950 | return "pixels.toArray" + bc("()", "B") | ||
10951 | }); | ||
10952 | var bs; | ||
10953 | |||
10954 | function br(bw, bv, bA, by) { | ||
10955 | var bx = bk[by]; | ||
10956 | bs = true; | ||
10957 | var bz = aP(bx.substring(1, bx.length - 1)); | ||
10958 | return "__" + bA + (bz.middle === "" ? bc("(" + bv.replace(/\.\s*$/, "") + ")", "B") : bc("(" + bv.replace(/\.\s*$/, "") + "," + bz.middle + ")", "B")) | ||
10959 | } | ||
10960 | do { | ||
10961 | bs = false; | ||
10962 | bt = bt.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*\.\s*(?:[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*\.\s*)*)(replace|replaceAll|replaceFirst|contains|equals|equalsIgnoreCase|hashCode|toCharArray|printStackTrace|split|startsWith|endsWith|codePointAt|matches)\s*"B(\d+)"/g, br) | ||
10963 | } while (bs); | ||
10964 | |||
10965 | function bq(bx, bv, bw) { | ||
10966 | bs = true; | ||
10967 | return "__instanceof" + bc("(" + bv + ", " + bw + ")", "B") | ||
10968 | } | ||
10969 | do { | ||
10970 | bs = false; | ||
10971 | bt = bt.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*(?:\.\s*[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*)*)instanceof\s+([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)/g, bq) | ||
10972 | } while (bs); | ||
10973 | bt = bt.replace(/\bthis(\s*"B\d+")/g, "$$constr$1"); | ||
10974 | return bt | ||
10975 | } | ||
10976 | |||
10977 | function aC(br, bq) { | ||
10978 | this.baseInterfaceName = br; | ||
10979 | this.body = bq; | ||
10980 | bq.owner = this | ||
10981 | } | ||
10982 | aC.prototype.toString = function() { | ||
10983 | return "new (" + this.body + ")" | ||
10984 | }; | ||
10985 | |||
10986 | function ai(bs) { | ||
10987 | var br = (new RegExp(/\bnew\s*([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)\s*"B\d+"\s*"A(\d+)"/)).exec(bs); | ||
10988 | var bv = a9, | ||
10989 | bu = a7(); | ||
10990 | a9 = bu; | ||
10991 | var bq = br[1] + "$" + bu; | ||
10992 | var bt = new aC(bq, V(bk[br[2]], bq, "", "implements " + br[1])); | ||
10993 | bl(bt, bu, bv); | ||
10994 | a9 = bv; | ||
10995 | return bt | ||
10996 | } | ||
10997 | |||
10998 | function af(br, bs, bq) { | ||
10999 | this.name = br; | ||
11000 | this.params = bs; | ||
11001 | this.body = bq | ||
11002 | } | ||
11003 | af.prototype.toString = function() { | ||
11004 | var bs = al; | ||
11005 | var bt = av({ | ||
11006 | "this": null | ||
11007 | }, this.params.getNames()); | ||
11008 | al = function(bu) { | ||
11009 | return bt.hasOwnProperty(bu.name) ? bu.name : bs(bu) | ||
11010 | }; | ||
11011 | var br = "function"; | ||
11012 | if (this.name) { | ||
11013 | br += " " + this.name | ||
11014 | } | ||
11015 | var bq = this.params.prependMethodArgs(this.body.toString()); | ||
11016 | br += this.params + " " + bq; | ||
11017 | al = bs; | ||
11018 | return br | ||
11019 | }; | ||
11020 | |||
11021 | function aK(br) { | ||
11022 | var bq = (new RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/)).exec(br); | ||
11023 | return new af(bq[1] !== "function" ? bq[1] : null, aD(bk[bq[2]]), ap(bk[bq[3]])) | ||
11024 | } | ||
11025 | |||
11026 | function ad(bq) { | ||
11027 | this.members = bq | ||
11028 | } | ||
11029 | ad.prototype.toString = function() { | ||
11030 | var bs = al; | ||
11031 | al = function(bu) { | ||
11032 | return bu.name === "this" ? "this" : bs(bu) | ||
11033 | }; | ||
11034 | var bq = ""; | ||
11035 | for (var bt = 0, br = this.members.length; bt < br; ++bt) { | ||
11036 | if (this.members[bt].label) { | ||
11037 | bq += this.members[bt].label + ": " | ||
11038 | } | ||
11039 | bq += this.members[bt].value.toString() + ", " | ||
11040 | } | ||
11041 | al = bs; | ||
11042 | return bq.substring(0, bq.length - 2) | ||
11043 | }; | ||
11044 | |||
11045 | function aF(bt) { | ||
11046 | var bq = bt.split(","); | ||
11047 | for (var bs = 0; bs < bq.length; ++bs) { | ||
11048 | var br = bq[bs].indexOf(":"); | ||
11049 | if (br < 0) { | ||
11050 | bq[bs] = { | ||
11051 | value: aZ(bq[bs]) | ||
11052 | } | ||
11053 | } else { | ||
11054 | bq[bs] = { | ||
11055 | label: a6(bq[bs].substring(0, br)), | ||
11056 | value: aZ(a6(bq[bs].substring(br + 1))) | ||
11057 | } | ||
11058 | } | ||
11059 | } | ||
11060 | return new ad(bq) | ||
11061 | } | ||
11062 | |||
11063 | function ay(bs) { | ||
11064 | if (bs.charAt(0) === "(" || bs.charAt(0) === "[") { | ||
11065 | return bs.charAt(0) + ay(bs.substring(1, bs.length - 1)) + bs.charAt(bs.length - 1) | ||
11066 | } | ||
11067 | if (bs.charAt(0) === "{") { | ||
11068 | if (/^\{\s*(?:[A-Za-z_$][\w$]*|'\d+')\s*:/.test(bs)) { | ||
11069 | return "{" + bc(bs.substring(1, bs.length - 1), "I") + "}" | ||
11070 | } | ||
11071 | return "[" + ay(bs.substring(1, bs.length - 1)) + "]" | ||
11072 | } | ||
11073 | var br = aP(bs); | ||
11074 | var bq = aq(br.middle); | ||
11075 | bq = bq.replace(/"[ABC](\d+)"/g, function(bu, bt) { | ||
11076 | return ay(bk[bt]) | ||
11077 | }); | ||
11078 | return br.untrim(bq) | ||
11079 | } | ||
11080 | |||
11081 | function R(bq) { | ||
11082 | return bq.replace(/(\.\s*)?((?:\b[A-Za-z_]|\$)[\w$]*)(\s*\.\s*([A-Za-z_$][\w$]*)(\s*\()?)?/g, function(bt, bv, br, bx, bw, bu) { | ||
11083 | if (bv) { | ||
11084 | return bt | ||
11085 | } | ||
11086 | var bs = { | ||
11087 | name: br, | ||
11088 | member: bw, | ||
11089 | callSign: !!bu | ||
11090 | }; | ||
11091 | return al(bs) + (bx === t ? "" : bx) | ||
11092 | }) | ||
11093 | } | ||
11094 | |||
11095 | function bp(br, bq) { | ||
11096 | this.expr = br; | ||
11097 | this.transforms = bq | ||
11098 | } | ||
11099 | bp.prototype.toString = function() { | ||
11100 | var bq = this.transforms; | ||
11101 | var br = R(this.expr); | ||
11102 | return br.replace(/"!(\d+)"/g, function(bt, bs) { | ||
11103 | return bq[bs].toString() | ||
11104 | }) | ||
11105 | }; | ||
11106 | aZ = function(bs) { | ||
11107 | var br = []; | ||
11108 | var bq = ay(bs); | ||
11109 | bq = bq.replace(/"H(\d+)"/g, function(bu, bt) { | ||
11110 | br.push(aK(bk[bt])); | ||
11111 | return '"!' + (br.length - 1) + '"' | ||
11112 | }); | ||
11113 | bq = bq.replace(/"F(\d+)"/g, function(bu, bt) { | ||
11114 | br.push(ai(bk[bt])); | ||
11115 | return '"!' + (br.length - 1) + '"' | ||
11116 | }); | ||
11117 | bq = bq.replace(/"I(\d+)"/g, function(bu, bt) { | ||
11118 | br.push(aF(bk[bt])); | ||
11119 | return '"!' + (br.length - 1) + '"' | ||
11120 | }); | ||
11121 | return new bp(bq, br) | ||
11122 | }; | ||
11123 | |||
11124 | function a4(bq, bs, br) { | ||
11125 | this.name = bq; | ||
11126 | this.value = bs; | ||
11127 | this.isDefault = br | ||
11128 | } | ||
11129 | a4.prototype.toString = function() { | ||
11130 | return this.name + " = " + this.value | ||
11131 | }; | ||
11132 | |||
11133 | function ak(bu, br) { | ||
11134 | var bv = bu.indexOf("="); | ||
11135 | var bq, bt, bs; | ||
11136 | if (bv < 0) { | ||
11137 | bq = bu; | ||
11138 | bt = br; | ||
11139 | bs = true | ||
11140 | } else { | ||
11141 | bq = bu.substring(0, bv); | ||
11142 | bt = aZ(bu.substring(bv + 1)); | ||
11143 | bs = false | ||
11144 | } | ||
11145 | return new a4(a6(bq.replace(/(\s*"C\d+")+/g, "")), bt, bs) | ||
11146 | } | ||
11147 | |||
11148 | function aT(bq) { | ||
11149 | if (bq === "int" || bq === "float") { | ||
11150 | return "0" | ||
11151 | } | ||
11152 | if (bq === "boolean") { | ||
11153 | return "false" | ||
11154 | } | ||
11155 | if (bq === "color") { | ||
11156 | return "0x00000000" | ||
11157 | } | ||
11158 | return "null" | ||
11159 | } | ||
11160 | |||
11161 | function aI(br, bq) { | ||
11162 | this.definitions = br; | ||
11163 | this.varType = bq | ||
11164 | } | ||
11165 | aI.prototype.getNames = function() { | ||
11166 | var bs = []; | ||
11167 | for (var br = 0, bq = this.definitions.length; br < bq; ++br) { | ||
11168 | bs.push(this.definitions[br].name) | ||
11169 | } | ||
11170 | return bs | ||
11171 | }; | ||
11172 | aI.prototype.toString = function() { | ||
11173 | return "var " + this.definitions.join(",") | ||
11174 | }; | ||
11175 | |||
11176 | function ah(bq) { | ||
11177 | this.expression = bq | ||
11178 | } | ||
11179 | ah.prototype.toString = function() { | ||
11180 | return this.expression.toString() | ||
11181 | }; | ||
11182 | |||
11183 | function bn(bu) { | ||
11184 | if (aM.test(bu)) { | ||
11185 | var bt = W.exec(bu); | ||
11186 | var bs = bu.substring(bt[0].length).split(","); | ||
11187 | var bq = aT(bt[2]); | ||
11188 | for (var br = 0; br < bs.length; ++br) { | ||
11189 | bs[br] = ak(bs[br], bq) | ||
11190 | } | ||
11191 | return new aI(bs, bt[2]) | ||
11192 | } | ||
11193 | return new ah(aZ(bu)) | ||
11194 | } | ||
11195 | |||
11196 | function a1(bq, bs, br) { | ||
11197 | this.initStatement = bq; | ||
11198 | this.condition = bs; | ||
11199 | this.step = br | ||
11200 | } | ||
11201 | a1.prototype.toString = function() { | ||
11202 | return "(" + this.initStatement + "; " + this.condition + "; " + this.step + ")" | ||
11203 | }; | ||
11204 | |||
11205 | function aS(br, bq) { | ||
11206 | this.initStatement = br; | ||
11207 | this.container = bq | ||
11208 | } | ||
11209 | aS.prototype.toString = function() { | ||
11210 | var bq = this.initStatement.toString(); | ||
11211 | if (bq.indexOf("=") >= 0) { | ||
11212 | bq = bq.substring(0, bq.indexOf("=")) | ||
11213 | } | ||
11214 | return "(" + bq + " in " + this.container + ")" | ||
11215 | }; | ||
11216 | |||
11217 | function aY(br, bq) { | ||
11218 | this.initStatement = br; | ||
11219 | this.container = bq | ||
11220 | } | ||
11221 | aY.iteratorId = 0; | ||
11222 | aY.prototype.toString = function() { | ||
11223 | var bu = this.initStatement.toString(); | ||
11224 | var br = "$it" + aY.iteratorId++; | ||
11225 | var bt = bu.replace(/^\s*var\s*/, "").split("=")[0]; | ||
11226 | var bs = "var " + br + " = new $p.ObjectIterator(" + this.container + "), " + bt + " = void(0)"; | ||
11227 | var bq = br + ".hasNext() && ((" + bt + " = " + br + ".next()) || true)"; | ||
11228 | return "(" + bs + "; " + bq + ";)" | ||
11229 | }; | ||
11230 | |||
11231 | function Y(br) { | ||
11232 | var bq; | ||
11233 | if (/\bin\b/.test(br)) { | ||
11234 | bq = br.substring(1, br.length - 1).split(/\bin\b/g); | ||
11235 | return new aS(bn(a6(bq[0])), aZ(bq[1])) | ||
11236 | } | ||
11237 | if (br.indexOf(":") >= 0 && br.indexOf(";") < 0) { | ||
11238 | bq = br.substring(1, br.length - 1).split(":"); | ||
11239 | return new aY(bn(a6(bq[0])), aZ(bq[1])) | ||
11240 | } | ||
11241 | bq = br.substring(1, br.length - 1).split(";"); | ||
11242 | return new a1(bn(a6(bq[0])), aZ(bq[1]), aZ(bq[2])) | ||
11243 | } | ||
11244 | |||
11245 | function a2(bq) { | ||
11246 | bq.sort(function(bs, br) { | ||
11247 | return br.weight - bs.weight | ||
11248 | }) | ||
11249 | } | ||
11250 | |||
11251 | function ab(bs, bq, br) { | ||
11252 | this.name = bs; | ||
11253 | this.body = bq; | ||
11254 | this.isStatic = br; | ||
11255 | bq.owner = this | ||
11256 | } | ||
11257 | ab.prototype.toString = function() { | ||
11258 | return "" + this.body | ||
11259 | }; | ||
11260 | |||
11261 | function an(bs, bq, br) { | ||
11262 | this.name = bs; | ||
11263 | this.body = bq; | ||
11264 | this.isStatic = br; | ||
11265 | bq.owner = this | ||
11266 | } | ||
11267 | an.prototype.toString = function() { | ||
11268 | return "" + this.body | ||
11269 | }; | ||
11270 | |||
11271 | function T(bs) { | ||
11272 | var br = O.exec(bs); | ||
11273 | O.lastIndex = 0; | ||
11274 | var bt = br[1].indexOf("static") >= 0; | ||
11275 | var bq = bk[aQ(br[6])], | ||
11276 | bv; | ||
11277 | var bw = a9, | ||
11278 | bu = a7(); | ||
11279 | a9 = bu; | ||
11280 | if (br[2] === "interface") { | ||
11281 | bv = new ab(br[3], S(bq, br[3], br[4]), bt) | ||
11282 | } else { | ||
11283 | bv = new an(br[3], V(bq, br[3], br[4], br[5]), bt) | ||
11284 | } | ||
11285 | bl(bv, bu, bw); | ||
11286 | a9 = bw; | ||
11287 | return bv | ||
11288 | } | ||
11289 | |||
11290 | function ac(bs, bt, bq, br) { | ||
11291 | this.name = bs; | ||
11292 | this.params = bt; | ||
11293 | this.body = bq; | ||
11294 | this.isStatic = br | ||
11295 | } | ||
11296 | ac.prototype.toString = function() { | ||
11297 | var bt = av({}, this.params.getNames()); | ||
11298 | var bs = al; | ||
11299 | al = function(bu) { | ||
11300 | return bt.hasOwnProperty(bu.name) ? bu.name : bs(bu) | ||
11301 | }; | ||
11302 | var br = this.params.prependMethodArgs(this.body.toString()); | ||
11303 | var bq = "function " + this.methodId + this.params + " " + br + "\n"; | ||
11304 | al = bs; | ||
11305 | return bq | ||
11306 | }; | ||
11307 | |||
11308 | function P(bt) { | ||
11309 | var br = bb.exec(bt); | ||
11310 | bb.lastIndex = 0; | ||
11311 | var bs = br[1].indexOf("static") >= 0; | ||
11312 | var bq = br[6] !== ";" ? bk[aQ(br[6])] : "{}"; | ||
11313 | return new ac(br[3], aD(bk[aQ(br[4])]), ap(bq), bs) | ||
11314 | } | ||
11315 | |||
11316 | function am(bs, br, bq) { | ||
11317 | this.definitions = bs; | ||
11318 | this.fieldType = br; | ||
11319 | this.isStatic = bq | ||
11320 | } | ||
11321 | am.prototype.getNames = function() { | ||
11322 | var bs = []; | ||
11323 | for (var br = 0, bq = this.definitions.length; br < bq; ++br) { | ||
11324 | bs.push(this.definitions[br].name) | ||
11325 | } | ||
11326 | return bs | ||
11327 | }; | ||
11328 | am.prototype.toString = function() { | ||
11329 | var bx = al({ | ||
11330 | name: "[this]" | ||
11331 | }); | ||
11332 | if (this.isStatic) { | ||
11333 | var bw = this.owner.name; | ||
11334 | var bu = []; | ||
11335 | for (var bv = 0, bt = this.definitions.length; bv < bt; ++bv) { | ||
11336 | var bs = this.definitions[bv]; | ||
11337 | var bq = bs.name, | ||
11338 | by = bw + "." + bq; | ||
11339 | var br = "if(" + by + " === void(0)) {\n " + by + " = " + bs.value + "; }\n$p.defineProperty(" + bx + ", '" + bq + "', { get: function(){return " + by + ";}, set: function(val){" + by + " = val;} });\n"; | ||
11340 | bu.push(br) | ||
11341 | } | ||
11342 | return bu.join("") | ||
11343 | } | ||
11344 | return bx + "." + this.definitions.join("; " + bx + ".") | ||
11345 | }; | ||
11346 | |||
11347 | function bf(bv) { | ||
11348 | var bu = W.exec(bv); | ||
11349 | var bq = bu[1].indexOf("static") >= 0; | ||
11350 | var bt = bv.substring(bu[0].length).split(/,\s*/g); | ||
11351 | var br = aT(bu[2]); | ||
11352 | for (var bs = 0; bs < bt.length; ++bs) { | ||
11353 | bt[bs] = ak(bt[bs], br) | ||
11354 | } | ||
11355 | return new am(bt, bu[2], bq) | ||
11356 | } | ||
11357 | |||
11358 | function aN(br, bq) { | ||
11359 | this.params = br; | ||
11360 | this.body = bq | ||
11361 | } | ||
11362 | aN.prototype.toString = function() { | ||
11363 | var bt = av({}, this.params.getNames()); | ||
11364 | var br = al; | ||
11365 | al = function(bu) { | ||
11366 | return bt.hasOwnProperty(bu.name) ? bu.name : br(bu) | ||
11367 | }; | ||
11368 | var bs = "function $constr_" + this.params.params.length + this.params.toString(); | ||
11369 | var bq = this.params.prependMethodArgs(this.body.toString()); | ||
11370 | if (!/\$(superCstr|constr)\b/.test(bq)) { | ||
11371 | bq = "{\n$superCstr();\n" + bq.substring(1) | ||
11372 | } | ||
11373 | al = br; | ||
11374 | return bs + bq + "\n" | ||
11375 | }; | ||
11376 | |||
11377 | function at(bs) { | ||
11378 | var bq = (new RegExp(/"B(\d+)"\s*"A(\d+)"/)).exec(bs); | ||
11379 | var br = aD(bk[bq[1]]); | ||
11380 | return new aN(br, ap(bk[bq[2]])) | ||
11381 | } | ||
11382 | |||
11383 | function aO(bs, bv, bu, bq, bw, bx) { | ||
11384 | var bt, br; | ||
11385 | this.name = bs; | ||
11386 | this.interfacesNames = bv; | ||
11387 | this.methodsNames = bu; | ||
11388 | this.fields = bq; | ||
11389 | this.innerClasses = bw; | ||
11390 | this.misc = bx; | ||
11391 | for (bt = 0, br = bq.length; bt < br; ++bt) { | ||
11392 | bq[bt].owner = this | ||
11393 | } | ||
11394 | } | ||
11395 | aO.prototype.getMembers = function(bx, bq, bv) { | ||
11396 | if (this.owner.base) { | ||
11397 | this.owner.base.body.getMembers(bx, bq, bv) | ||
11398 | } | ||
11399 | var bu, bt, bs, br; | ||
11400 | for (bu = 0, bs = this.fields.length; bu < bs; ++bu) { | ||
11401 | var bz = this.fields[bu].getNames(); | ||
11402 | for (bt = 0, br = bz.length; bt < br; ++bt) { | ||
11403 | bx[bz[bt]] = this.fields[bu] | ||
11404 | } | ||
11405 | } | ||
11406 | for (bu = 0, bs = this.methodsNames.length; bu < bs; ++bu) { | ||
11407 | var bw = this.methodsNames[bu]; | ||
11408 | bq[bw] = true | ||
11409 | } | ||
11410 | for (bu = 0, bs = this.innerClasses.length; bu < bs; ++bu) { | ||
11411 | var by = this.innerClasses[bu]; | ||
11412 | bv[by.name] = by | ||
11413 | } | ||
11414 | }; | ||
11415 | aO.prototype.toString = function() { | ||
11416 | function br(bH) { | ||
11417 | var bG = 0; | ||
11418 | while (bH) { | ||
11419 | ++bG; | ||
11420 | bH = bH.scope | ||
11421 | } | ||
11422 | return bG | ||
11423 | } | ||
11424 | var bA = br(this.owner); | ||
11425 | var bB = this.name; | ||
11426 | var bx = ""; | ||
11427 | var bC = ""; | ||
11428 | var bE = {}, | ||
11429 | bz = {}, | ||
11430 | by = {}; | ||
11431 | this.getMembers(bE, bz, by); | ||
11432 | var bw, bu, bv, bt; | ||
11433 | if (this.owner.interfaces) { | ||
11434 | var bq = [], | ||
11435 | bs; | ||
11436 | for (bw = 0, bu = this.interfacesNames.length; bw < bu; ++bw) { | ||
11437 | if (!this.owner.interfaces[bw]) { | ||
11438 | continue | ||
11439 | } | ||
11440 | bs = al({ | ||
11441 | name: this.interfacesNames[bw] | ||
11442 | }); | ||
11443 | bq.push(bs); | ||
11444 | bx += "$p.extendInterfaceMembers(" + bB + ", " + bs + ");\n" | ||
11445 | } | ||
11446 | bC += bB + ".$interfaces = [" + bq.join(", ") + "];\n" | ||
11447 | } | ||
11448 | bC += bB + ".$isInterface = true;\n"; | ||
11449 | bC += bB + ".$methods = ['" + this.methodsNames.join("', '") + "'];\n"; | ||
11450 | a2(this.innerClasses); | ||
11451 | for (bw = 0, bu = this.innerClasses.length; bw < bu; ++bw) { | ||
11452 | var bF = this.innerClasses[bw]; | ||
11453 | if (bF.isStatic) { | ||
11454 | bx += bB + "." + bF.name + " = " + bF + ";\n" | ||
11455 | } | ||
11456 | } | ||
11457 | for (bw = 0, bu = this.fields.length; bw < bu; ++bw) { | ||
11458 | var bD = this.fields[bw]; | ||
11459 | if (bD.isStatic) { | ||
11460 | bx += bB + "." + bD.definitions.join(";\n" + bB + ".") + ";\n" | ||
11461 | } | ||
11462 | } | ||
11463 | return "(function() {\nfunction " + bB + "() { throw 'Unable to create the interface'; }\n" + bx + bC + "return " + bB + ";\n})()" | ||
11464 | }; | ||
11465 | S = function(bw, br, bB) { | ||
11466 | var bC = bw.substring(1, bw.length - 1); | ||
11467 | bC = ae(bC); | ||
11468 | bC = bd(bC, br); | ||
11469 | var bz = [], | ||
11470 | bt = []; | ||
11471 | bC = bC.replace(/"([DE])(\d+)"/g, function(bF, bE, bD) { | ||
11472 | if (bE === "D") { | ||
11473 | bz.push(bD) | ||
11474 | } else { | ||
11475 | if (bE === "E") { | ||
11476 | bt.push(bD) | ||
11477 | } | ||
11478 | } | ||
11479 | return "" | ||
11480 | }); | ||
11481 | var bx = bC.split(/;(?:\s*;)*/g); | ||
11482 | var bu; | ||
11483 | var bv, bs; | ||
11484 | if (bB !== t) { | ||
11485 | bu = bB.replace(/^\s*extends\s+(.+?)\s*$/g, "$1").split(/\s*,\s*/g) | ||
11486 | } | ||
11487 | for (bv = 0, bs = bz.length; bv < bs; ++bv) { | ||
11488 | var bq = P(bk[bz[bv]]); | ||
11489 | bz[bv] = bq.name | ||
11490 | } | ||
11491 | for (bv = 0, bs = bx.length - 1; bv < bs; ++bv) { | ||
11492 | var bA = aP(bx[bv]); | ||
11493 | bx[bv] = bf(bA.middle) | ||
11494 | } | ||
11495 | var by = bx.pop(); | ||
11496 | for (bv = 0, bs = bt.length; bv < bs; ++bv) { | ||
11497 | bt[bv] = T(bk[bt[bv]]) | ||
11498 | } | ||
11499 | return new aO(br, bu, bz, bx, bt, { | ||
11500 | tail: by | ||
11501 | }) | ||
11502 | }; | ||
11503 | |||
11504 | function aB(br, by, bx, bw, bs, bz, bA, bu, bq) { | ||
11505 | var bv, bt; | ||
11506 | this.name = br; | ||
11507 | this.baseClassName = by; | ||
11508 | this.interfacesNames = bx; | ||
11509 | this.functions = bw; | ||
11510 | this.methods = bs; | ||
11511 | this.fields = bz; | ||
11512 | this.cstrs = bA; | ||
11513 | this.innerClasses = bu; | ||
11514 | this.misc = bq; | ||
11515 | for (bv = 0, bt = bz.length; bv < bt; ++bv) { | ||
11516 | bz[bv].owner = this | ||
11517 | } | ||
11518 | } | ||
11519 | aB.prototype.getMembers = function(bx, br, bw) { | ||
11520 | if (this.owner.base) { | ||
11521 | this.owner.base.body.getMembers(bx, br, bw) | ||
11522 | } | ||
11523 | var bv, bu, bt, bs; | ||
11524 | for (bv = 0, bt = this.fields.length; bv < bt; ++bv) { | ||
11525 | var bz = this.fields[bv].getNames(); | ||
11526 | for (bu = 0, bs = bz.length; bu < bs; ++bu) { | ||
11527 | bx[bz[bu]] = this.fields[bv] | ||
11528 | } | ||
11529 | } | ||
11530 | for (bv = 0, bt = this.methods.length; bv < bt; ++bv) { | ||
11531 | var bq = this.methods[bv]; | ||
11532 | br[bq.name] = bq | ||
11533 | } | ||
11534 | for (bv = 0, bt = this.innerClasses.length; bv < bt; ++bv) { | ||
11535 | var by = this.innerClasses[bv]; | ||
11536 | bw[by.name] = by | ||
11537 | } | ||
11538 | }; | ||
11539 | aB.prototype.toString = function() { | ||
11540 | function bN(bV) { | ||
11541 | var bU = 0; | ||
11542 | while (bV) { | ||
11543 | ++bU; | ||
11544 | bV = bV.scope | ||
11545 | } | ||
11546 | return bU | ||
11547 | } | ||
11548 | var bB = bN(this.owner); | ||
11549 | var bG = "$this_" + bB; | ||
11550 | var bs = this.name; | ||
11551 | var bx = "var " + bG + " = this;\n"; | ||
11552 | var bH = ""; | ||
11553 | var bz = ""; | ||
11554 | var bS = {}, | ||
11555 | bT = {}, | ||
11556 | bJ = {}; | ||
11557 | this.getMembers(bS, bT, bJ); | ||
11558 | var bR = al; | ||
11559 | al = function(bV) { | ||
11560 | var bU = bV.name; | ||
11561 | if (bU === "this") { | ||
11562 | return bV.callSign || !bV.member ? bG + ".$self" : bG | ||
11563 | } | ||
11564 | if (bS.hasOwnProperty(bU)) { | ||
11565 | return bS[bU].isStatic ? bs + "." + bU : bG + "." + bU | ||
11566 | } | ||
11567 | if (bJ.hasOwnProperty(bU)) { | ||
11568 | return bG + "." + bU | ||
11569 | } | ||
11570 | if (bT.hasOwnProperty(bU)) { | ||
11571 | return bT[bU].isStatic ? bs + "." + bU : bG + ".$self." + bU | ||
11572 | } | ||
11573 | return bR(bV) | ||
11574 | }; | ||
11575 | var bA; | ||
11576 | if (this.baseClassName) { | ||
11577 | bA = bR({ | ||
11578 | name: this.baseClassName | ||
11579 | }); | ||
11580 | bx += "var $super = { $upcast: " + bG + " };\n"; | ||
11581 | bx += "function $superCstr(){" + bA + ".apply($super,arguments);if(!('$self' in $super)) $p.extendClassChain($super)}\n"; | ||
11582 | bz += bs + ".$base = " + bA + ";\n" | ||
11583 | } else { | ||
11584 | bx += "function $superCstr(){$p.extendClassChain(" + bG + ")}\n" | ||
11585 | } if (this.owner.base) { | ||
11586 | bH += "$p.extendStaticMembers(" + bs + ", " + bA + ");\n" | ||
11587 | } | ||
11588 | var bM, bK, bL, bI; | ||
11589 | if (this.owner.interfaces) { | ||
11590 | var bw = [], | ||
11591 | bq; | ||
11592 | for (bM = 0, bK = this.interfacesNames.length; bM < bK; ++bM) { | ||
11593 | if (!this.owner.interfaces[bM]) { | ||
11594 | continue | ||
11595 | } | ||
11596 | bq = bR({ | ||
11597 | name: this.interfacesNames[bM] | ||
11598 | }); | ||
11599 | bw.push(bq); | ||
11600 | bH += "$p.extendInterfaceMembers(" + bs + ", " + bq + ");\n" | ||
11601 | } | ||
11602 | bz += bs + ".$interfaces = [" + bw.join(", ") + "];\n" | ||
11603 | } | ||
11604 | if (this.functions.length > 0) { | ||
11605 | bx += this.functions.join("\n") + "\n" | ||
11606 | } | ||
11607 | a2(this.innerClasses); | ||
11608 | for (bM = 0, bK = this.innerClasses.length; bM < bK; ++bM) { | ||
11609 | var bD = this.innerClasses[bM]; | ||
11610 | if (bD.isStatic) { | ||
11611 | bH += bs + "." + bD.name + " = " + bD + ";\n"; | ||
11612 | bx += bG + "." + bD.name + " = " + bs + "." + bD.name + ";\n" | ||
11613 | } else { | ||
11614 | bx += bG + "." + bD.name + " = " + bD + ";\n" | ||
11615 | } | ||
11616 | } | ||
11617 | for (bM = 0, bK = this.fields.length; bM < bK; ++bM) { | ||
11618 | var br = this.fields[bM]; | ||
11619 | if (br.isStatic) { | ||
11620 | bH += bs + "." + br.definitions.join(";\n" + bs + ".") + ";\n"; | ||
11621 | for (bL = 0, bI = br.definitions.length; bL < bI; ++bL) { | ||
11622 | var bu = br.definitions[bL].name, | ||
11623 | by = bs + "." + bu; | ||
11624 | bx += "$p.defineProperty(" + bG + ", '" + bu + "', {get: function(){return " + by + "}, set: function(val){" + by + " = val}});\n" | ||
11625 | } | ||
11626 | } else { | ||
11627 | bx += bG + "." + br.definitions.join(";\n" + bG + ".") + ";\n" | ||
11628 | } | ||
11629 | } | ||
11630 | var bC = {}; | ||
11631 | for (bM = 0, bK = this.methods.length; bM < bK; ++bM) { | ||
11632 | var bt = this.methods[bM]; | ||
11633 | var bP = bC[bt.name]; | ||
11634 | var bv = bt.name + "$" + bt.params.params.length; | ||
11635 | var bF = !!bt.params.methodArgsParam; | ||
11636 | if (bP) { | ||
11637 | ++bP; | ||
11638 | bv += "_" + bP | ||
11639 | } else { | ||
11640 | bP = 1 | ||
11641 | } | ||
11642 | bt.methodId = bv; | ||
11643 | bC[bt.name] = bP; | ||
11644 | if (bt.isStatic) { | ||
11645 | bH += bt; | ||
11646 | bH += "$p.addMethod(" + bs + ", '" + bt.name + "', " + bv + ", " + bF + ");\n"; | ||
11647 | bx += "$p.addMethod(" + bG + ", '" + bt.name + "', " + bv + ", " + bF + ");\n" | ||
11648 | } else { | ||
11649 | bx += bt; | ||
11650 | bx += "$p.addMethod(" + bG + ", '" + bt.name + "', " + bv + ", " + bF + ");\n" | ||
11651 | } | ||
11652 | } | ||
11653 | bx += a6(this.misc.tail); | ||
11654 | if (this.cstrs.length > 0) { | ||
11655 | bx += this.cstrs.join("\n") + "\n" | ||
11656 | } | ||
11657 | bx += "function $constr() {\n"; | ||
11658 | var bQ = []; | ||
11659 | for (bM = 0, bK = this.cstrs.length; bM < bK; ++bM) { | ||
11660 | var bO = this.cstrs[bM].params.params.length; | ||
11661 | var bE = !!this.cstrs[bM].params.methodArgsParam; | ||
11662 | bQ.push("if(arguments.length " + (bE ? ">=" : "===") + " " + bO + ") { $constr_" + bO + ".apply(" + bG + ", arguments); }") | ||
11663 | } | ||
11664 | if (bQ.length > 0) { | ||
11665 | bx += bQ.join(" else ") + " else " | ||
11666 | } | ||
11667 | bx += "$superCstr();\n}\n"; | ||
11668 | bx += "$constr.apply(null, arguments);\n"; | ||
11669 | al = bR; | ||
11670 | return "(function() {\nfunction " + bs + "() {\n" + bx + "}\n" + bH + bz + "return " + bs + ";\n})()" | ||
11671 | }; | ||
11672 | V = function(bz, br, bq, bC) { | ||
11673 | var bE = bz.substring(1, bz.length - 1); | ||
11674 | bE = ae(bE); | ||
11675 | bE = bd(bE, br); | ||
11676 | var bs = [], | ||
11677 | bt = [], | ||
11678 | bD = [], | ||
11679 | bw = []; | ||
11680 | bE = bE.replace(/"([DEGH])(\d+)"/g, function(bH, bG, bF) { | ||
11681 | if (bG === "D") { | ||
11682 | bs.push(bF) | ||
11683 | } else { | ||
11684 | if (bG === "E") { | ||
11685 | bt.push(bF) | ||
11686 | } else { | ||
11687 | if (bG === "H") { | ||
11688 | bw.push(bF) | ||
11689 | } else { | ||
11690 | bD.push(bF) | ||
11691 | } | ||
11692 | } | ||
11693 | } | ||
11694 | return "" | ||
11695 | }); | ||
11696 | var by = bE.replace(/^(?:\s*;)+/, "").split(/;(?:\s*;)*/g); | ||
11697 | var bx, bv; | ||
11698 | var bu; | ||
11699 | if (bq !== t) { | ||
11700 | bx = bq.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g, "$1") | ||
11701 | } | ||
11702 | if (bC !== t) { | ||
11703 | bv = bC.replace(/^\s*implements\s+(.+?)\s*$/g, "$1").split(/\s*,\s*/g) | ||
11704 | } | ||
11705 | for (bu = 0; bu < bw.length; ++bu) { | ||
11706 | bw[bu] = aK(bk[bw[bu]]) | ||
11707 | } | ||
11708 | for (bu = 0; bu < bs.length; ++bu) { | ||
11709 | bs[bu] = P(bk[bs[bu]]) | ||
11710 | } | ||
11711 | for (bu = 0; bu < by.length - 1; ++bu) { | ||
11712 | var bB = aP(by[bu]); | ||
11713 | by[bu] = bf(bB.middle) | ||
11714 | } | ||
11715 | var bA = by.pop(); | ||
11716 | for (bu = 0; bu < bD.length; ++bu) { | ||
11717 | bD[bu] = at(bk[bD[bu]]) | ||
11718 | } | ||
11719 | for (bu = 0; bu < bt.length; ++bu) { | ||
11720 | bt[bu] = T(bk[bt[bu]]) | ||
11721 | } | ||
11722 | return new aB(br, bx, bv, bw, bs, by, bD, bt, { | ||
11723 | tail: bA | ||
11724 | }) | ||
11725 | }; | ||
11726 | |||
11727 | function aw(br, bq) { | ||
11728 | this.name = br; | ||
11729 | this.body = bq; | ||
11730 | bq.owner = this | ||
11731 | } | ||
11732 | aw.prototype.toString = function() { | ||
11733 | return "var " + this.name + " = " + this.body + ";\n$p." + this.name + " = " + this.name + ";\n" | ||
11734 | }; | ||
11735 | |||
11736 | function a5(br, bq) { | ||
11737 | this.name = br; | ||
11738 | this.body = bq; | ||
11739 | bq.owner = this | ||
11740 | } | ||
11741 | a5.prototype.toString = function() { | ||
11742 | return "var " + this.name + " = " + this.body + ";\n$p." + this.name + " = " + this.name + ";\n" | ||
11743 | }; | ||
11744 | |||
11745 | function bo(bs) { | ||
11746 | var br = O.exec(bs); | ||
11747 | O.lastIndex = 0; | ||
11748 | var bq = bk[aQ(br[6])]; | ||
11749 | var bv = a9, | ||
11750 | bt = a7(); | ||
11751 | a9 = bt; | ||
11752 | var bu; | ||
11753 | if (br[2] === "interface") { | ||
11754 | bu = new aw(br[3], S(bq, br[3], br[4])) | ||
11755 | } else { | ||
11756 | bu = new a5(br[3], V(bq, br[3], br[4], br[5])) | ||
11757 | } | ||
11758 | bl(bu, bt, bv); | ||
11759 | a9 = bv; | ||
11760 | return bu | ||
11761 | } | ||
11762 | |||
11763 | function aR(br, bs, bq) { | ||
11764 | this.name = br; | ||
11765 | this.params = bs; | ||
11766 | this.body = bq | ||
11767 | } | ||
11768 | aR.prototype.toString = function() { | ||
11769 | var bt = av({}, this.params.getNames()); | ||
11770 | var bs = al; | ||
11771 | al = function(bu) { | ||
11772 | return bt.hasOwnProperty(bu.name) ? bu.name : bs(bu) | ||
11773 | }; | ||
11774 | var br = this.params.prependMethodArgs(this.body.toString()); | ||
11775 | var bq = "function " + this.name + this.params + " " + br + "\n$p." + this.name + " = " + this.name + ";"; | ||
11776 | al = bs; | ||
11777 | return bq | ||
11778 | }; | ||
11779 | |||
11780 | function aW(bs) { | ||
11781 | var br = bb.exec(bs); | ||
11782 | var bq = bb.lastIndex = 0; | ||
11783 | return new aR(br[3], aD(bk[aQ(br[4])]), ap(bk[aQ(br[6])])) | ||
11784 | } | ||
11785 | |||
11786 | function ag(bq) { | ||
11787 | var br = bq; | ||
11788 | br = br.replace(/\b(catch\s*"B\d+"\s*"A\d+")(\s*catch\s*"B\d+"\s*"A\d+")+/g, "$1"); | ||
11789 | return br | ||
11790 | } | ||
11791 | |||
11792 | function aU(bq, br) { | ||
11793 | this.argument = bq; | ||
11794 | this.misc = br | ||
11795 | } | ||
11796 | aU.prototype.toString = function() { | ||
11797 | return this.misc.prefix + this.argument.toString() | ||
11798 | }; | ||
11799 | |||
11800 | function Q(bq, br) { | ||
11801 | this.argument = bq; | ||
11802 | this.misc = br | ||
11803 | } | ||
11804 | Q.prototype.toString = function() { | ||
11805 | return this.misc.prefix + this.argument.toString() | ||
11806 | }; | ||
11807 | |||
11808 | function ax(bq, br, bs) { | ||
11809 | this.name = bq; | ||
11810 | this.argument = br; | ||
11811 | this.misc = bs | ||
11812 | } | ||
11813 | ax.prototype.toString = function() { | ||
11814 | var bq = this.misc.prefix; | ||
11815 | if (this.argument !== t) { | ||
11816 | bq += this.argument.toString() | ||
11817 | } | ||
11818 | return bq | ||
11819 | }; | ||
11820 | |||
11821 | function aL(bq) { | ||
11822 | this.expr = bq | ||
11823 | } | ||
11824 | aL.prototype.toString = function() { | ||
11825 | return "case " + this.expr + ":" | ||
11826 | }; | ||
11827 | |||
11828 | function X(bq) { | ||
11829 | this.label = bq | ||
11830 | } | ||
11831 | X.prototype.toString = function() { | ||
11832 | return this.label | ||
11833 | }; | ||
11834 | aV = function(by, bz, bs) { | ||
11835 | var bD = new RegExp(/\b(catch|for|if|switch|while|with)\s*"B(\d+)"|\b(do|else|finally|return|throw|try|break|continue)\b|("[ADEH](\d+)")|\b(case)\s+([^:]+):|\b([A-Za-z_$][\w$]*\s*:)|(;)/g); | ||
11836 | var bA = []; | ||
11837 | by = ag(by); | ||
11838 | var bx = 0, | ||
11839 | bt, br; | ||
11840 | while ((bt = bD.exec(by)) !== null) { | ||
11841 | if (bt[1] !== t) { | ||
11842 | var bw = by.lastIndexOf('"B', bD.lastIndex); | ||
11843 | var bC = by.substring(bx, bw); | ||
11844 | if (bt[1] === "for") { | ||
11845 | bA.push(new aU(Y(bk[bt[2]]), { | ||
11846 | prefix: bC | ||
11847 | })) | ||
11848 | } else { | ||
11849 | if (bt[1] === "catch") { | ||
11850 | bA.push(new Q(aD(bk[bt[2]]), { | ||
11851 | prefix: bC | ||
11852 | })) | ||
11853 | } else { | ||
11854 | bA.push(new ax(bt[1], aZ(bk[bt[2]]), { | ||
11855 | prefix: bC | ||
11856 | })) | ||
11857 | } | ||
11858 | } | ||
11859 | } else { | ||
11860 | if (bt[3] !== t) { | ||
11861 | bA.push(new ax(bt[3], t, { | ||
11862 | prefix: by.substring(bx, bD.lastIndex) | ||
11863 | })) | ||
11864 | } else { | ||
11865 | if (bt[4] !== t) { | ||
11866 | br = by.substring(bx, bD.lastIndex - bt[4].length); | ||
11867 | if (a6(br).length !== 0) { | ||
11868 | continue | ||
11869 | } | ||
11870 | bA.push(br); | ||
11871 | var bu = bt[4].charAt(1), | ||
11872 | bq = bt[5]; | ||
11873 | if (bu === "D") { | ||
11874 | bA.push(bz(bk[bq])) | ||
11875 | } else { | ||
11876 | if (bu === "E") { | ||
11877 | bA.push(bs(bk[bq])) | ||
11878 | } else { | ||
11879 | if (bu === "H") { | ||
11880 | bA.push(aK(bk[bq])) | ||
11881 | } else { | ||
11882 | bA.push(ap(bk[bq])) | ||
11883 | } | ||
11884 | } | ||
11885 | } | ||
11886 | } else { | ||
11887 | if (bt[6] !== t) { | ||
11888 | bA.push(new aL(aZ(a6(bt[7])))) | ||
11889 | } else { | ||
11890 | if (bt[8] !== t) { | ||
11891 | br = by.substring(bx, bD.lastIndex - bt[8].length); | ||
11892 | if (a6(br).length !== 0) { | ||
11893 | continue | ||
11894 | } | ||
11895 | bA.push(new X(by.substring(bx, bD.lastIndex))) | ||
11896 | } else { | ||
11897 | var bB = aP(by.substring(bx, bD.lastIndex - 1)); | ||
11898 | bA.push(bB.left); | ||
11899 | bA.push(bn(bB.middle)); | ||
11900 | bA.push(bB.right + ";") | ||
11901 | } | ||
11902 | } | ||
11903 | } | ||
11904 | } | ||
11905 | } | ||
11906 | bx = bD.lastIndex | ||
11907 | } | ||
11908 | var bv = aP(by.substring(bx)); | ||
11909 | bA.push(bv.left); | ||
11910 | if (bv.middle !== "") { | ||
11911 | bA.push(bn(bv.middle)); | ||
11912 | bA.push(";" + bv.right) | ||
11913 | } | ||
11914 | return bA | ||
11915 | }; | ||
11916 | |||
11917 | function be(br) { | ||
11918 | var bs = []; | ||
11919 | for (var bt = 0, bq = br.length; bt < bq; ++bt) { | ||
11920 | var bu = br[bt]; | ||
11921 | if (bu instanceof aI) { | ||
11922 | bs = bs.concat(bu.getNames()) | ||
11923 | } else { | ||
11924 | if (bu instanceof aU && bu.argument.initStatement instanceof aI) { | ||
11925 | bs = bs.concat(bu.argument.initStatement.getNames()) | ||
11926 | } else { | ||
11927 | if (bu instanceof ab || bu instanceof an || bu instanceof aw || bu instanceof a5 || bu instanceof aR || bu instanceof af) { | ||
11928 | bs.push(bu.name) | ||
11929 | } | ||
11930 | } | ||
11931 | } | ||
11932 | } | ||
11933 | return av({}, bs) | ||
11934 | } | ||
11935 | |||
11936 | function U(bq) { | ||
11937 | this.statements = bq | ||
11938 | } | ||
11939 | U.prototype.toString = function() { | ||
11940 | var bs = be(this.statements); | ||
11941 | var br = al; | ||
11942 | if (!ba(bs)) { | ||
11943 | al = function(bt) { | ||
11944 | return bs.hasOwnProperty(bt.name) ? bt.name : br(bt) | ||
11945 | } | ||
11946 | } | ||
11947 | var bq = "{\n" + this.statements.join("") + "\n}"; | ||
11948 | al = br; | ||
11949 | return bq | ||
11950 | }; | ||
11951 | ap = function(br) { | ||
11952 | var bq = aP(br.substring(1, br.length - 1)); | ||
11953 | return new U(aV(bq.middle)) | ||
11954 | }; | ||
11955 | |||
11956 | function aG(bq) { | ||
11957 | this.statements = bq | ||
11958 | } | ||
11959 | aG.prototype.toString = function() { | ||
11960 | var bu = [], | ||
11961 | bv = [], | ||
11962 | bw; | ||
11963 | for (var bt = 0, br = this.statements.length; bt < br; ++bt) { | ||
11964 | bw = this.statements[bt]; | ||
11965 | if (bw instanceof a5 || bw instanceof aw) { | ||
11966 | bu.push(bw) | ||
11967 | } else { | ||
11968 | bv.push(bw) | ||
11969 | } | ||
11970 | } | ||
11971 | a2(bu); | ||
11972 | var bs = be(this.statements); | ||
11973 | al = function(by) { | ||
11974 | var bx = by.name; | ||
11975 | if (bs.hasOwnProperty(bx)) { | ||
11976 | return bx | ||
11977 | } | ||
11978 | if (aX.hasOwnProperty(bx) || B.hasOwnProperty(bx) || g.hasOwnProperty(bx)) { | ||
11979 | return "$p." + bx | ||
11980 | } | ||
11981 | return bx | ||
11982 | }; | ||
11983 | var bq = "// this code was autogenerated from PJS\n(function($p) {\n" + bu.join("") + "\n" + bv.join("") + "\n})"; | ||
11984 | al = null; | ||
11985 | return bq | ||
11986 | }; | ||
11987 | bi = function() { | ||
11988 | var bq = ae(bk[0]); | ||
11989 | bq = bq.replace(/\bimport\s+[^;]+;/g, ""); | ||
11990 | return new aG(aV(bq, aW, bo)) | ||
11991 | }; | ||
11992 | |||
11993 | function bj(bq) { | ||
11994 | var bu = {}; | ||
11995 | var bs, by; | ||
11996 | for (bs in aJ) { | ||
11997 | if (aJ.hasOwnProperty(bs)) { | ||
11998 | by = aJ[bs]; | ||
11999 | var bE = by.scopeId, | ||
12000 | br = by.name; | ||
12001 | if (bE) { | ||
12002 | var bD = aJ[bE]; | ||
12003 | by.scope = bD; | ||
12004 | if (bD.inScope === t) { | ||
12005 | bD.inScope = {} | ||
12006 | } | ||
12007 | bD.inScope[br] = by | ||
12008 | } else { | ||
12009 | bu[br] = by | ||
12010 | } | ||
12011 | } | ||
12012 | } | ||
12013 | |||
12014 | function bB(bF, bI) { | ||
12015 | var bL = bI.split("."); | ||
12016 | var bH = bF.scope, | ||
12017 | bK; | ||
12018 | while (bH) { | ||
12019 | if (bH.hasOwnProperty(bL[0])) { | ||
12020 | bK = bH[bL[0]]; | ||
12021 | break | ||
12022 | } | ||
12023 | bH = bH.scope | ||
12024 | } | ||
12025 | if (bK === t) { | ||
12026 | bK = bu[bL[0]] | ||
12027 | } | ||
12028 | for (var bJ = 1, bG = bL.length; bJ < bG && bK; ++bJ) { | ||
12029 | bK = bK.inScope[bL[bJ]] | ||
12030 | } | ||
12031 | return bK | ||
12032 | } | ||
12033 | for (bs in aJ) { | ||
12034 | if (aJ.hasOwnProperty(bs)) { | ||
12035 | by = aJ[bs]; | ||
12036 | var bx = by.body.baseClassName; | ||
12037 | if (bx) { | ||
12038 | var bA = bB(by, bx); | ||
12039 | if (bA) { | ||
12040 | by.base = bA; | ||
12041 | if (!bA.derived) { | ||
12042 | bA.derived = [] | ||
12043 | } | ||
12044 | bA.derived.push(by) | ||
12045 | } | ||
12046 | } | ||
12047 | var bw = by.body.interfacesNames, | ||
12048 | bC = [], | ||
12049 | bv, bt; | ||
12050 | if (bw && bw.length > 0) { | ||
12051 | for (bv = 0, bt = bw.length; bv < bt; ++bv) { | ||
12052 | var bz = bB(by, bw[bv]); | ||
12053 | bC.push(bz); | ||
12054 | if (!bz) { | ||
12055 | continue | ||
12056 | } | ||
12057 | if (!bz.derived) { | ||
12058 | bz.derived = [] | ||
12059 | } | ||
12060 | bz.derived.push(by) | ||
12061 | } | ||
12062 | if (bC.length > 0) { | ||
12063 | by.interfaces = bC | ||
12064 | } | ||
12065 | } | ||
12066 | } | ||
12067 | } | ||
12068 | } | ||
12069 | |||
12070 | function a8(bq) { | ||
12071 | var bv = [], | ||
12072 | bs = {}; | ||
12073 | var br, by, bw; | ||
12074 | for (br in aJ) { | ||
12075 | if (aJ.hasOwnProperty(br)) { | ||
12076 | bw = aJ[br]; | ||
12077 | if (!bw.inScope && !bw.derived) { | ||
12078 | bv.push(br); | ||
12079 | bw.weight = 0 | ||
12080 | } else { | ||
12081 | var bx = []; | ||
12082 | if (bw.inScope) { | ||
12083 | for (by in bw.inScope) { | ||
12084 | if (bw.inScope.hasOwnProperty(by)) { | ||
12085 | bx.push(bw.inScope[by]) | ||
12086 | } | ||
12087 | } | ||
12088 | } | ||
12089 | if (bw.derived) { | ||
12090 | bx = bx.concat(bw.derived) | ||
12091 | } | ||
12092 | bs[br] = bx | ||
12093 | } | ||
12094 | } | ||
12095 | } | ||
12096 | |||
12097 | function bz(bB, bD) { | ||
12098 | var bA = bs[bB]; | ||
12099 | if (!bA) { | ||
12100 | return false | ||
12101 | } | ||
12102 | var bC = bA.indexOf(bD); | ||
12103 | if (bC < 0) { | ||
12104 | return false | ||
12105 | } | ||
12106 | bA.splice(bC, 1); | ||
12107 | if (bA.length > 0) { | ||
12108 | return false | ||
12109 | } | ||
12110 | delete bs[bB]; | ||
12111 | return true | ||
12112 | } | ||
12113 | while (bv.length > 0) { | ||
12114 | br = bv.shift(); | ||
12115 | bw = aJ[br]; | ||
12116 | if (bw.scopeId && bz(bw.scopeId, bw)) { | ||
12117 | bv.push(bw.scopeId); | ||
12118 | aJ[bw.scopeId].weight = bw.weight + 1 | ||
12119 | } | ||
12120 | if (bw.base && bz(bw.base.classId, bw)) { | ||
12121 | bv.push(bw.base.classId); | ||
12122 | bw.base.weight = bw.weight + 1 | ||
12123 | } | ||
12124 | if (bw.interfaces) { | ||
12125 | var bu, bt; | ||
12126 | for (bu = 0, bt = bw.interfaces.length; bu < bt; ++bu) { | ||
12127 | if (!bw.interfaces[bu] || !bz(bw.interfaces[bu].classId, bw)) { | ||
12128 | continue | ||
12129 | } | ||
12130 | bv.push(bw.interfaces[bu].classId); | ||
12131 | bw.interfaces[bu].weight = bw.weight + 1 | ||
12132 | } | ||
12133 | } | ||
12134 | } | ||
12135 | } | ||
12136 | var bh = bi(); | ||
12137 | bj(bh); | ||
12138 | a8(bh); | ||
12139 | var a0 = bh.toString(); | ||
12140 | a0 = a0.replace(/\s*\n(?:[\t ]*\n)+/g, "\n\n"); | ||
12141 | a0 = a0.replace(/__x([0-9A-F]{4})/g, function(br, bq) { | ||
12142 | return String.fromCharCode(parseInt(bq, 16)) | ||
12143 | }); | ||
12144 | return aj(a0, N) | ||
12145 | } | ||
12146 | |||
12147 | function z(O, ad) { | ||
12148 | var X = (new RegExp(/\/\*\s*@pjs\s+((?:[^\*]|\*+[^\*\/])*)\*\//g)).exec(O); | ||
12149 | if (X && X.length === 2) { | ||
12150 | var N = [], | ||
12151 | Q = X.splice(1, 2)[0].replace(/\{([\s\S]*?)\}/g, function() { | ||
12152 | return function(ag, ah) { | ||
12153 | N.push(ah); | ||
12154 | return "{" + (N.length - 1) + "}" | ||
12155 | } | ||
12156 | }()).replace("\n", "").replace("\r", "").split(";"); | ||
12157 | var W = function(ag) { | ||
12158 | return ag.replace(/^\s*["']?/, "").replace(/["']?\s*$/, "") | ||
12159 | }; | ||
12160 | for (var aa = 0, Y = Q.length; aa < Y; aa++) { | ||
12161 | var U = Q[aa].split("="); | ||
12162 | if (U && U.length === 2) { | ||
12163 | var af = W(U[0]), | ||
12164 | V = W(U[1]), | ||
12165 | ae = []; | ||
12166 | if (af === "preload") { | ||
12167 | ae = V.split(","); | ||
12168 | for (var Z = 0, ab = ae.length; Z < ab; Z++) { | ||
12169 | var ac = W(ae[Z]); | ||
12170 | ad.imageCache.add(ac) | ||
12171 | } | ||
12172 | } else { | ||
12173 | if (af === "font") { | ||
12174 | ae = V.split(","); | ||
12175 | for (var R = 0, T = ae.length; R < T; R++) { | ||
12176 | var S = W(ae[R]), | ||
12177 | P = /^\{(\d*?)\}$/.exec(S); | ||
12178 | H.preloading.add(P ? JSON.parse("{" + N[P[1]] + "}") : S) | ||
12179 | } | ||
12180 | } else { | ||
12181 | if (af === "pauseOnBlur") { | ||
12182 | ad.options.pauseOnBlur = V === "true" | ||
12183 | } else { | ||
12184 | if (af === "globalKeyEvents") { | ||
12185 | ad.options.globalKeyEvents = V === "true" | ||
12186 | } else { | ||
12187 | if (af.substring(0, 6) === "param-") { | ||
12188 | ad.params[af.substring(6)] = V | ||
12189 | } else { | ||
12190 | ad.options[af] = V | ||
12191 | } | ||
12192 | } | ||
12193 | } | ||
12194 | } | ||
12195 | } | ||
12196 | } | ||
12197 | } | ||
12198 | } | ||
12199 | return O | ||
12200 | } | ||
12201 | F.compile = function(N) { | ||
12202 | var Q = new F.Sketch; | ||
12203 | var O = z(N, Q); | ||
12204 | var P = c(O); | ||
12205 | Q.sourceCode = P; | ||
12206 | return Q | ||
12207 | }; | ||
12208 | var j = function() { | ||
12209 | var T = {}, | ||
12210 | Q = "undefined", | ||
12211 | R = "function", | ||
12212 | N = !1, | ||
12213 | S = !0, | ||
12214 | O = 512, | ||
12215 | P = "log"; | ||
12216 | if (typeof tinylog !== Q && typeof tinylog[P] === R) { | ||
12217 | T[P] = tinylog[P] | ||
12218 | } else { | ||
12219 | if (typeof d !== Q && !d.fake) { | ||
12220 | (function() { | ||
12221 | var ao = d, | ||
12222 | am = "div", | ||
12223 | ac = "style", | ||
12224 | ag = "title", | ||
12225 | ab = { | ||
12226 | zIndex: 10000, | ||
12227 | position: "fixed", | ||
12228 | bottom: "0px", | ||
12229 | width: "100%", | ||
12230 | height: "15%", | ||
12231 | fontFamily: "sans-serif", | ||
12232 | color: "#ccc", | ||
12233 | backgroundColor: "black" | ||
12234 | }, | ||
12235 | ae = { | ||
12236 | position: "relative", | ||
12237 | fontFamily: "monospace", | ||
12238 | overflow: "auto", | ||
12239 | height: "100%", | ||
12240 | paddingTop: "5px" | ||
12241 | }, | ||
12242 | ai = { | ||
12243 | height: "5px", | ||
12244 | marginTop: "-5px", | ||
12245 | cursor: "n-resize", | ||
12246 | backgroundColor: "darkgrey" | ||
12247 | }, | ||
12248 | an = { | ||
12249 | position: "absolute", | ||
12250 | top: "5px", | ||
12251 | right: "20px", | ||
12252 | color: "#111", | ||
12253 | MozBorderRadius: "4px", | ||
12254 | webkitBorderRadius: "4px", | ||
12255 | borderRadius: "4px", | ||
12256 | cursor: "pointer", | ||
12257 | fontWeight: "normal", | ||
12258 | textAlign: "center", | ||
12259 | padding: "3px 5px", | ||
12260 | backgroundColor: "#333", | ||
12261 | fontSize: "12px" | ||
12262 | }, | ||
12263 | Y = { | ||
12264 | minHeight: "16px" | ||
12265 | }, | ||
12266 | af = { | ||
12267 | fontSize: "12px", | ||
12268 | margin: "0 8px 0 8px", | ||
12269 | maxWidth: "100%", | ||
12270 | whiteSpace: "pre-wrap", | ||
12271 | overflow: "auto" | ||
12272 | }, | ||
12273 | ad = ao.defaultView, | ||
12274 | al = ao.documentElement, | ||
12275 | U = al[ac], | ||
12276 | W = function() { | ||
12277 | var aq = arguments.length, | ||
12278 | ap, at, ar; | ||
12279 | while (aq--) { | ||
12280 | at = arguments[aq--]; | ||
12281 | ap = arguments[aq][ac]; | ||
12282 | for (ar in at) { | ||
12283 | if (at.hasOwnProperty(ar)) { | ||
12284 | ap[ar] = at[ar] | ||
12285 | } | ||
12286 | } | ||
12287 | } | ||
12288 | }, | ||
12289 | aj = function(ar, aq, ap) { | ||
12290 | if (ar.addEventListener) { | ||
12291 | ar.addEventListener(aq, ap, N) | ||
12292 | } else { | ||
12293 | if (ar.attachEvent) { | ||
12294 | ar.attachEvent("on" + aq, ap) | ||
12295 | } | ||
12296 | } | ||
12297 | return [ar, aq, ap] | ||
12298 | }, | ||
12299 | V = function(ar, aq, ap) { | ||
12300 | if (ar.removeEventListener) { | ||
12301 | ar.removeEventListener(aq, ap, N) | ||
12302 | } else { | ||
12303 | if (ar.detachEvent) { | ||
12304 | ar.detachEvent("on" + aq, ap) | ||
12305 | } | ||
12306 | } | ||
12307 | }, | ||
12308 | aa = function(aq) { | ||
12309 | var ap = aq.childNodes, | ||
12310 | ar = ap.length; | ||
12311 | while (ar--) { | ||
12312 | aq.removeChild(ap.item(0)) | ||
12313 | } | ||
12314 | }, | ||
12315 | ak = function(aq, ap) { | ||
12316 | return aq.appendChild(ap) | ||
12317 | }, | ||
12318 | ah = function(ap) { | ||
12319 | return ao.createElement(ap) | ||
12320 | }, | ||
12321 | Z = function(ap) { | ||
12322 | return ao.createTextNode(ap) | ||
12323 | }, | ||
12324 | X = T[P] = function(aE) { | ||
12325 | var aw, ax = U.paddingBottom, | ||
12326 | ar = ah(am), | ||
12327 | aB = ar[ac], | ||
12328 | aC = ak(ar, ah(am)), | ||
12329 | au = ak(ar, ah(am)), | ||
12330 | at = ak(ar, ah(am)), | ||
12331 | aD = N, | ||
12332 | av = N, | ||
12333 | aq = N, | ||
12334 | ay = 0, | ||
12335 | ap = function() { | ||
12336 | U.paddingBottom = ar.clientHeight + "px" | ||
12337 | }, | ||
12338 | aA = function(aF) { | ||
12339 | var aG = ad.innerHeight, | ||
12340 | aH = aC.clientHeight; | ||
12341 | if (aF < 0) { | ||
12342 | aF = 0 | ||
12343 | } else { | ||
12344 | if (aF + aH > aG) { | ||
12345 | aF = aG - aH | ||
12346 | } | ||
12347 | } | ||
12348 | aB.height = aF / aG * 100 + "%"; | ||
12349 | ap() | ||
12350 | }, | ||
12351 | az = [aj(ao, "mousemove", function(aF) { | ||
12352 | if (aD) { | ||
12353 | aA(ad.innerHeight - aF.clientY); | ||
12354 | au.scrollTop = aq | ||
12355 | } | ||
12356 | }), aj(ao, "mouseup", function() { | ||
12357 | if (aD) { | ||
12358 | aD = aq = N | ||
12359 | } | ||
12360 | }), aj(aC, "dblclick", function(aF) { | ||
12361 | aF.preventDefault(); | ||
12362 | if (av) { | ||
12363 | aA(av); | ||
12364 | av = N | ||
12365 | } else { | ||
12366 | av = ar.clientHeight; | ||
12367 | aB.height = "0px" | ||
12368 | } | ||
12369 | }), aj(aC, "mousedown", function(aF) { | ||
12370 | aF.preventDefault(); | ||
12371 | aD = S; | ||
12372 | aq = au.scrollTop | ||
12373 | }), aj(aC, "contextmenu", function() { | ||
12374 | aD = N | ||
12375 | }), aj(at, "click", function() { | ||
12376 | aw() | ||
12377 | })]; | ||
12378 | aw = function() { | ||
12379 | var aF = az.length; | ||
12380 | while (aF--) { | ||
12381 | V.apply(T, az[aF]) | ||
12382 | } | ||
12383 | al.removeChild(ar); | ||
12384 | U.paddingBottom = ax; | ||
12385 | aa(au); | ||
12386 | aa(ar); | ||
12387 | T[P] = X | ||
12388 | }; | ||
12389 | W(ar, ab, au, ae, aC, ai, at, an); | ||
12390 | at[ag] = "Close Log"; | ||
12391 | ak(at, Z("\u2716")); | ||
12392 | aC[ag] = "Double-click to toggle log minimization"; | ||
12393 | al.insertBefore(ar, al.firstChild); | ||
12394 | T[P] = function(aH) { | ||
12395 | if (ay === O) { | ||
12396 | au.removeChild(au.firstChild) | ||
12397 | } else { | ||
12398 | ay++ | ||
12399 | } | ||
12400 | var aG = ak(au, ah(am)), | ||
12401 | aF = ak(aG, ah(am)); | ||
12402 | aG[ag] = (new Date).toLocaleTimeString(); | ||
12403 | W(aG, Y, aF, af); | ||
12404 | ak(aF, Z(aH)); | ||
12405 | au.scrollTop = au.scrollHeight | ||
12406 | }; | ||
12407 | T[P](aE); | ||
12408 | ap() | ||
12409 | } | ||
12410 | })() | ||
12411 | } else { | ||
12412 | if (typeof print === R) { | ||
12413 | T[P] = print | ||
12414 | } | ||
12415 | } | ||
12416 | } | ||
12417 | return T | ||
12418 | }(); | ||
12419 | F.logger = j; | ||
12420 | F.version = "1.4.1"; | ||
12421 | F.lib = {}; | ||
12422 | F.registerLibrary = function(N, O) { | ||
12423 | F.lib[N] = O; | ||
12424 | if (O.hasOwnProperty("init")) { | ||
12425 | O.init(g) | ||
12426 | } | ||
12427 | }; | ||
12428 | F.instances = k; | ||
12429 | F.getInstanceById = function(N) { | ||
12430 | return k[J[N]] | ||
12431 | }; | ||
12432 | F.Sketch = function(N) { | ||
12433 | this.attachFunction = N; | ||
12434 | this.options = { | ||
12435 | pauseOnBlur: false, | ||
12436 | globalKeyEvents: false | ||
12437 | }; | ||
12438 | this.onLoad = G; | ||
12439 | this.onSetup = G; | ||
12440 | this.onPause = G; | ||
12441 | this.onLoop = G; | ||
12442 | this.onFrameStart = G; | ||
12443 | this.onFrameEnd = G; | ||
12444 | this.onExit = G; | ||
12445 | this.params = {}; | ||
12446 | this.imageCache = { | ||
12447 | pending: 0, | ||
12448 | images: {}, | ||
12449 | operaCache: {}, | ||
12450 | add: function(P, O) { | ||
12451 | if (this.images[P]) { | ||
12452 | return | ||
12453 | } | ||
12454 | if (!n) { | ||
12455 | this.images[P] = null | ||
12456 | } | ||
12457 | if (!O) { | ||
12458 | O = new Image; | ||
12459 | O.onload = function(R) { | ||
12460 | return function() { | ||
12461 | R.pending-- | ||
12462 | } | ||
12463 | }(this); | ||
12464 | this.pending++; | ||
12465 | O.src = P | ||
12466 | } | ||
12467 | this.images[P] = O; | ||
12468 | if (D.opera) { | ||
12469 | var Q = d.createElement("div"); | ||
12470 | Q.appendChild(O); | ||
12471 | Q.style.position = "absolute"; | ||
12472 | Q.style.opacity = 0; | ||
12473 | Q.style.width = "1px"; | ||
12474 | Q.style.height = "1px"; | ||
12475 | if (!this.operaCache[P]) { | ||
12476 | d.body.appendChild(Q); | ||
12477 | this.operaCache[P] = Q | ||
12478 | } | ||
12479 | } | ||
12480 | } | ||
12481 | }; | ||
12482 | this.sourceCode = undefined; | ||
12483 | this.attach = function(P) { | ||
12484 | if (typeof this.attachFunction === "function") { | ||
12485 | this.attachFunction(P) | ||
12486 | } else { | ||
12487 | if (this.sourceCode) { | ||
12488 | var O = (new Function("return (" + this.sourceCode + ");"))(); | ||
12489 | O(P); | ||
12490 | this.attachFunction = O | ||
12491 | } else { | ||
12492 | throw "Unable to attach sketch to the processing instance" | ||
12493 | } | ||
12494 | } | ||
12495 | }; | ||
12496 | this.toString = function() { | ||
12497 | var O; | ||
12498 | var P = "((function(Sketch) {\n"; | ||
12499 | P += "var sketch = new Sketch(\n" + this.sourceCode + ");\n"; | ||
12500 | for (O in this.options) { | ||
12501 | if (this.options.hasOwnProperty(O)) { | ||
12502 | var Q = this.options[O]; | ||
12503 | P += "sketch.options." + O + " = " + (typeof Q === "string" ? '"' + Q + '"' : "" + Q) + ";\n" | ||
12504 | } | ||
12505 | } | ||
12506 | for (O in this.imageCache) { | ||
12507 | if (this.options.hasOwnProperty(O)) { | ||
12508 | P += 'sketch.imageCache.add("' + O + '");\n' | ||
12509 | } | ||
12510 | } | ||
12511 | P += "return sketch;\n})(Processing.Sketch))"; | ||
12512 | return P | ||
12513 | } | ||
12514 | }; | ||
12515 | var v = function(Q, N) { | ||
12516 | var O = [], | ||
12517 | U = [], | ||
12518 | V = N.length, | ||
12519 | S = 0; | ||
12520 | |||
12521 | function T(W, Y) { | ||
12522 | var X = new XMLHttpRequest; | ||
12523 | X.onreadystatechange = function() { | ||
12524 | if (X.readyState === 4) { | ||
12525 | var Z; | ||
12526 | if (X.status !== 200 && X.status !== 0) { | ||
12527 | Z = "Invalid XHR status " + X.status | ||
12528 | } else { | ||
12529 | if (X.responseText === "") { | ||
12530 | if ("withCredentials" in new XMLHttpRequest && (new XMLHttpRequest).withCredentials === false && D.location.protocol === "file:") { | ||
12531 | Z = "XMLHttpRequest failure, possibly due to a same-origin policy violation. You can try loading this page in another browser, or load it from http://localhost using a local webserver. See the Processing.js README for a more detailed explanation of this problem and solutions." | ||
12532 | } else { | ||
12533 | Z = "File is empty." | ||
12534 | } | ||
12535 | } | ||
12536 | } | ||
12537 | Y(X.responseText, Z) | ||
12538 | } | ||
12539 | }; | ||
12540 | X.open("GET", W, true); | ||
12541 | if (X.overrideMimeType) { | ||
12542 | X.overrideMimeType("application/json") | ||
12543 | } | ||
12544 | X.setRequestHeader("If-Modified-Since", "Fri, 01 Jan 1960 00:00:00 GMT"); | ||
12545 | X.send(null) | ||
12546 | } | ||
12547 | |||
12548 | function P(X, W) { | ||
12549 | function Z(ac, aa) { | ||
12550 | O[X] = ac; | ||
12551 | ++S; | ||
12552 | if (aa) { | ||
12553 | U.push(W + " ==> " + aa) | ||
12554 | } | ||
12555 | if (S === V) { | ||
12556 | if (U.length === 0) { | ||
12557 | try { | ||
12558 | return new F(Q, O.join("\n")) | ||
12559 | } catch (ab) { | ||
12560 | throw "Processing.js: Unable to execute pjs sketch: " + ab | ||
12561 | } | ||
12562 | } else { | ||
12563 | throw "Processing.js: Unable to load pjs sketch files: " + U.join("\n") | ||
12564 | } | ||
12565 | } | ||
12566 | } | ||
12567 | if (W.charAt(0) === "#") { | ||
12568 | var Y = d.getElementById(W.substring(1)); | ||
12569 | if (Y) { | ||
12570 | Z(Y.text || Y.textContent) | ||
12571 | } else { | ||
12572 | Z("", "Unable to load pjs sketch: element with id '" + W.substring(1) + "' was not found") | ||
12573 | } | ||
12574 | return | ||
12575 | } | ||
12576 | T(W, Z) | ||
12577 | } | ||
12578 | for (var R = 0; R < V; ++R) { | ||
12579 | P(R, N[R]) | ||
12580 | } | ||
12581 | }; | ||
12582 | var I = function() { | ||
12583 | d.removeEventListener("DOMContentLoaded", I, false); | ||
12584 | k = []; | ||
12585 | var O = d.getElementsByTagName("canvas"), | ||
12586 | U; | ||
12587 | for (var T = 0, P = O.length; T < P; T++) { | ||
12588 | var W = O[T].getAttribute("data-processing-sources"); | ||
12589 | if (W === null) { | ||
12590 | W = O[T].getAttribute("data-src"); | ||
12591 | if (W === null) { | ||
12592 | W = O[T].getAttribute("datasrc") | ||
12593 | } | ||
12594 | } | ||
12595 | if (W) { | ||
12596 | U = W.split(/\s+/g); | ||
12597 | for (var S = 0; S < U.length;) { | ||
12598 | if (U[S]) { | ||
12599 | S++ | ||
12600 | } else { | ||
12601 | U.splice(S, 1) | ||
12602 | } | ||
12603 | } | ||
12604 | v(O[T], U) | ||
12605 | } | ||
12606 | } | ||
12607 | var ac, aa, N, Z, ab = d.getElementsByTagName("script"), | ||
12608 | Q = []; | ||
12609 | for (ac = ab.length - 1; ac >= 0; ac--) { | ||
12610 | Q.push(ab[ac]) | ||
12611 | } | ||
12612 | for (ac = 0, aa = Q.length; ac < aa; ac++) { | ||
12613 | var Y = Q[ac]; | ||
12614 | if (!Y.getAttribute) { | ||
12615 | continue | ||
12616 | } | ||
12617 | var X = Y.getAttribute("type"); | ||
12618 | if (X && (X.toLowerCase() === "text/processing" || X.toLowerCase() === "application/processing")) { | ||
12619 | var V = Y.getAttribute("data-processing-target"); | ||
12620 | O = t; | ||
12621 | if (V) { | ||
12622 | O = d.getElementById(V) | ||
12623 | } else { | ||
12624 | var R = Y.nextSibling; | ||
12625 | while (R && R.nodeType !== 1) { | ||
12626 | R = R.nextSibling | ||
12627 | } | ||
12628 | if (R && R.nodeName.toLowerCase() === "canvas") { | ||
12629 | O = R | ||
12630 | } | ||
12631 | } if (O) { | ||
12632 | if (Y.getAttribute("src")) { | ||
12633 | U = Y.getAttribute("src").split(/\s+/); | ||
12634 | v(O, U); | ||
12635 | continue | ||
12636 | } | ||
12637 | N = Y.textContent || Y.text; | ||
12638 | Z = new F(O, N) | ||
12639 | } | ||
12640 | } | ||
12641 | } | ||
12642 | }; | ||
12643 | F.reload = function() { | ||
12644 | if (k.length > 0) { | ||
12645 | for (var N = k.length - 1; N >= 0; N--) { | ||
12646 | if (k[N]) { | ||
12647 | k[N].exit() | ||
12648 | } | ||
12649 | } | ||
12650 | } | ||
12651 | I() | ||
12652 | }; | ||
12653 | F.loadSketchFromSources = v; | ||
12654 | F.disableInit = function() { | ||
12655 | if (n) { | ||
12656 | d.removeEventListener("DOMContentLoaded", I, false) | ||
12657 | } | ||
12658 | }; | ||
12659 | if (n) { | ||
12660 | D.Processing = F; | ||
12661 | d.addEventListener("DOMContentLoaded", I, false) | ||
12662 | } else { | ||
12663 | this.Processing = F | ||
12664 | } | ||
12665 | })(window, window.document, Math); \ No newline at end of file | ||
diff --git a/deprecated/ZJW/javascripts/site.js b/deprecated/ZJW/javascripts/site.js new file mode 100644 index 0000000..5570df0 --- /dev/null +++ b/deprecated/ZJW/javascripts/site.js | |||
@@ -0,0 +1,12 @@ | |||
1 | (function() { | ||
2 | var canvas; | ||
3 | |||
4 | canvas = $('#processing'); | ||
5 | |||
6 | $(window).on("load", function() { | ||
7 | canvas.width = window.innerWidth; | ||
8 | canvas.height = window.innerHeight; | ||
9 | return console.log(canvas.width, canvas.height); | ||
10 | }); | ||
11 | |||
12 | }).call(this); | ||
diff --git a/deprecated/ZJW/javascripts/viz.pde b/deprecated/ZJW/javascripts/viz.pde new file mode 100644 index 0000000..4084708 --- /dev/null +++ b/deprecated/ZJW/javascripts/viz.pde | |||
@@ -0,0 +1,81 @@ | |||
1 | ArrayList particles; | ||
2 | int maxParticles = 255; | ||
3 | |||
4 | void setup() { | ||
5 | size(window.innerWidth, window.innerHeight); | ||
6 | particles = new ArrayList(); | ||
7 | rectMode(CENTER); | ||
8 | } | ||
9 | |||
10 | void draw() { | ||
11 | background(21, 32, 46); | ||
12 | |||
13 | if(particles.size() < maxParticles) { | ||
14 | x = random(0, width); | ||
15 | y = random(0, height); | ||
16 | PVector l = new PVector(x, y); | ||
17 | Particle particle = new Particle(l); | ||
18 | particles.add(particle); | ||
19 | } | ||
20 | |||
21 | |||
22 | for(int i=0; i<particles.size(); i++) { | ||
23 | Particle p = (Particle) particles.get(i); | ||
24 | Particle next; | ||
25 | |||
26 | if(i>1) { | ||
27 | next = (Particle) particles.get(i-1); | ||
28 | stroke(57,219,255,10); | ||
29 | line(next.location.x, next.location.x, p.location.x, p.location.y) | ||
30 | } | ||
31 | |||
32 | |||
33 | // Run the particle | ||
34 | p.run(); | ||
35 | |||
36 | if(p.isDead()) { | ||
37 | particles.remove(i); | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | |||
42 | class Particle { | ||
43 | PVector location; | ||
44 | PVector velocity; | ||
45 | PVector acceleration; | ||
46 | float lifespan; | ||
47 | float rectSize; | ||
48 | |||
49 | Particle(PVector l) { | ||
50 | location = l.get(); | ||
51 | velocity = new PVector(random(0,0.05),random(0.02, 0.8)); | ||
52 | acceleration = new PVector(random(0, 0.01),random(0,0.01)); | ||
53 | lifespan = 255.0; | ||
54 | rectSize = 5; | ||
55 | } | ||
56 | |||
57 | void run() { | ||
58 | display(); | ||
59 | update(); | ||
60 | } | ||
61 | |||
62 | void display() { | ||
63 | noStroke(); | ||
64 | fill(73, 219, 255, lifespan/5); | ||
65 | rect(location.x, location.y, rectSize, rectSize); | ||
66 | } | ||
67 | |||
68 | void update() { | ||
69 | lifespan -= 2; | ||
70 | velocity.add(acceleration); | ||
71 | location.add(velocity); | ||
72 | } | ||
73 | |||
74 | boolean isDead() { | ||
75 | if (lifespan < 0) { | ||
76 | return true; | ||
77 | } else { | ||
78 | return false; | ||
79 | } | ||
80 | } | ||
81 | } | ||
diff --git a/deprecated/ZJW/javascripts/webflow.js b/deprecated/ZJW/javascripts/webflow.js new file mode 100644 index 0000000..b048709 --- /dev/null +++ b/deprecated/ZJW/javascripts/webflow.js | |||
@@ -0,0 +1,4445 @@ | |||
1 | /*! | ||
2 | * ---------------------------------------------------------------------- | ||
3 | * Webflow: Front-end site library | ||
4 | * @license MIT | ||
5 | * Other scripts may access this api using an async handler: | ||
6 | * var Webflow = Webflow || []; | ||
7 | * Webflow.push(readyFunction); | ||
8 | * ---------------------------------------------------------------------- | ||
9 | */ | ||
10 | var Webflow = { | ||
11 | w: Webflow | ||
12 | }; | ||
13 | Webflow.init = function() { | ||
14 | 'use strict'; | ||
15 | |||
16 | var $ = window.$; | ||
17 | var api = {}; | ||
18 | var modules = {}; | ||
19 | var primary = []; | ||
20 | var secondary = this.w || []; | ||
21 | var $win = $(window); | ||
22 | var _ = api._ = underscore(); | ||
23 | var domready = false; | ||
24 | var tram = window.tram; | ||
25 | var Modernizr = window.Modernizr; | ||
26 | var noop = function() {}; | ||
27 | tram.config.hideBackface = false; | ||
28 | tram.config.keepInherited = true; | ||
29 | |||
30 | /** | ||
31 | * Webflow.define() - Define a webflow.js module | ||
32 | * @param {string} name | ||
33 | * @param {function} factory | ||
34 | */ | ||
35 | api.define = function(name, factory) { | ||
36 | var module = modules[name] = factory($, _); | ||
37 | if (!module) return; | ||
38 | // If running in Webflow app, subscribe to design/preview events | ||
39 | if (api.env()) { | ||
40 | $.isFunction(module.design) && window.addEventListener('__wf_design', module.design); | ||
41 | $.isFunction(module.preview) && window.addEventListener('__wf_preview', module.preview); | ||
42 | } | ||
43 | // Subscribe to module front-end events | ||
44 | $.isFunction(module.destroy) && $win.on('__wf_destroy', module.destroy); | ||
45 | // Look for a ready method on module | ||
46 | if (module.ready && $.isFunction(module.ready)) { | ||
47 | // If domready has already happened, call ready method | ||
48 | if (domready) module.ready(); | ||
49 | // Otherwise push ready method into primary queue | ||
50 | else primary.push(module.ready); | ||
51 | } | ||
52 | }; | ||
53 | |||
54 | /** | ||
55 | * Webflow.require() - Load a Webflow.js module | ||
56 | * @param {string} name | ||
57 | * @return {object} | ||
58 | */ | ||
59 | api.require = function(name) { | ||
60 | return modules[name]; | ||
61 | }; | ||
62 | |||
63 | /** | ||
64 | * Webflow.push() - Add a ready handler into secondary queue | ||
65 | * @param {function} ready Callback to invoke on domready | ||
66 | */ | ||
67 | api.push = function(ready) { | ||
68 | // If domready has already happened, invoke handler | ||
69 | if (domready) { | ||
70 | $.isFunction(ready) && ready(); | ||
71 | return; | ||
72 | } | ||
73 | // Otherwise push into secondary queue | ||
74 | secondary.push(ready); | ||
75 | }; | ||
76 | |||
77 | /** | ||
78 | * Webflow.env() - Get the state of the Webflow app | ||
79 | * @param {string} mode [optional] | ||
80 | * @return {boolean} | ||
81 | */ | ||
82 | api.env = function(mode) { | ||
83 | var designFlag = window.__wf_design; | ||
84 | var inApp = typeof designFlag != 'undefined'; | ||
85 | if (!mode) return inApp; | ||
86 | if (mode == 'design') return inApp && designFlag; | ||
87 | if (mode == 'preview') return inApp && !designFlag; | ||
88 | if (mode == 'slug') return inApp && window.__wf_slug; | ||
89 | }; | ||
90 | |||
91 | // Feature detects + browser sniffs ಠ_ಠ| ||
92 | var userAgent = navigator.userAgent.toLowerCase(); | ||
93 | var appVersion = navigator.appVersion.toLowerCase(); | ||
94 | api.env.touch = ('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch; | ||
95 | var chrome = api.env.chrome = (window.chrome || /chrome/.test(userAgent)) && parseInt(appVersion.match(/chrome\/(\d+)\./)[1], 10); | ||
96 | var ios = api.env.ios = Modernizr && Modernizr.ios; | ||
97 | api.env.safari = /safari/.test(userAgent) && !chrome && !ios; | ||
98 | |||
99 | /** | ||
100 | * Webflow.resize, Webflow.scroll - throttled event proxies | ||
101 | */ | ||
102 | var resizeEvents = 'resize.webflow orientationchange.webflow load.webflow'; | ||
103 | var scrollEvents = 'scroll.webflow ' + resizeEvents; | ||
104 | api.resize = eventProxy($win, resizeEvents); | ||
105 | api.scroll = eventProxy($win, scrollEvents); | ||
106 | api.redraw = eventProxy(); | ||
107 | |||
108 | // Create a proxy instance for throttled events | ||
109 | function eventProxy(target, types) { | ||
110 | |||
111 | // Set up throttled method (using custom frame-based _.throttle) | ||
112 | var handlers = []; | ||
113 | var proxy = {}; | ||
114 | proxy.up = _.throttle(function(evt) { | ||
115 | _.each(handlers, function(h) { | ||
116 | h(evt); | ||
117 | }); | ||
118 | }); | ||
119 | |||
120 | // Bind events to target | ||
121 | if (target && types) target.on(types, proxy.up); | ||
122 | |||
123 | /** | ||
124 | * Add an event handler | ||
125 | * @param {function} handler | ||
126 | */ | ||
127 | proxy.on = function(handler) { | ||
128 | if (typeof handler != 'function') return; | ||
129 | if (_.contains(handlers, handler)) return; | ||
130 | handlers.push(handler); | ||
131 | }; | ||
132 | |||
133 | /** | ||
134 | * Remove an event handler | ||
135 | * @param {function} handler | ||
136 | */ | ||
137 | proxy.off = function(handler) { | ||
138 | handlers = _.filter(handlers, function(h) { | ||
139 | return h !== handler; | ||
140 | }); | ||
141 | }; | ||
142 | return proxy; | ||
143 | } | ||
144 | |||
145 | // Provide optional IX events to components | ||
146 | api.ixEvents = function() { | ||
147 | var ix = api.require('ix'); | ||
148 | return (ix && ix.events) || { | ||
149 | reset: noop, | ||
150 | intro: noop, | ||
151 | outro: noop | ||
152 | }; | ||
153 | }; | ||
154 | |||
155 | // Webflow.location() - Wrap window.location in api | ||
156 | api.location = function(url) { | ||
157 | window.location = url; | ||
158 | }; | ||
159 | |||
160 | // Webflow.app - Designer-specific methods | ||
161 | api.app = api.env() ? {} : null; | ||
162 | if (api.app) { | ||
163 | |||
164 | // Trigger redraw for specific elements | ||
165 | var Event = window.Event; | ||
166 | var redraw = new Event('__wf_redraw'); | ||
167 | api.app.redrawElement = function(i, el) { | ||
168 | el.dispatchEvent(redraw); | ||
169 | }; | ||
170 | |||
171 | // Webflow.location - Re-route location change to trigger an event | ||
172 | api.location = function(url) { | ||
173 | window.dispatchEvent(new CustomEvent('__wf_location', { | ||
174 | detail: url | ||
175 | })); | ||
176 | }; | ||
177 | } | ||
178 | |||
179 | // Webflow.ready() - Call primary and secondary handlers | ||
180 | api.ready = function() { | ||
181 | domready = true; | ||
182 | $.each(primary.concat(secondary), function(index, value) { | ||
183 | $.isFunction(value) && value(); | ||
184 | }); | ||
185 | // Trigger resize | ||
186 | api.resize.up(); | ||
187 | }; | ||
188 | |||
189 | // Webflow.destroy() - Trigger a cleanup event for all modules | ||
190 | api.destroy = function() { | ||
191 | $win.triggerHandler('__wf_destroy'); | ||
192 | }; | ||
193 | |||
194 | // Listen for domready | ||
195 | $(api.ready); | ||
196 | |||
197 | /*! | ||
198 | * Webflow._ (aka) Underscore.js 1.6.0 (custom build) | ||
199 | * _.each | ||
200 | * _.map | ||
201 | * _.find | ||
202 | * _.filter | ||
203 | * _.any | ||
204 | * _.contains | ||
205 | * _.delay | ||
206 | * _.defer | ||
207 | * _.throttle (webflow) | ||
208 | * _.debounce | ||
209 | * _.keys | ||
210 | * _.has | ||
211 | * _.now | ||
212 | * | ||
213 | * http://underscorejs.org | ||
214 | * (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
215 | * Underscore may be freely distributed under the MIT license. | ||
216 | */ | ||
217 | function underscore() { | ||
218 | var _ = {}; | ||
219 | |||
220 | // Current version. | ||
221 | _.VERSION = '1.6.0-Webflow'; | ||
222 | |||
223 | // Establish the object that gets returned to break out of a loop iteration. | ||
224 | var breaker = {}; | ||
225 | |||
226 | // Save bytes in the minified (but not gzipped) version: | ||
227 | var ArrayProto = Array.prototype, | ||
228 | ObjProto = Object.prototype, | ||
229 | FuncProto = Function.prototype; | ||
230 | |||
231 | // Create quick reference variables for speed access to core prototypes. | ||
232 | var | ||
233 | push = ArrayProto.push, | ||
234 | slice = ArrayProto.slice, | ||
235 | concat = ArrayProto.concat, | ||
236 | toString = ObjProto.toString, | ||
237 | hasOwnProperty = ObjProto.hasOwnProperty; | ||
238 | |||
239 | // All **ECMAScript 5** native function implementations that we hope to use | ||
240 | // are declared here. | ||
241 | var | ||
242 | nativeForEach = ArrayProto.forEach, | ||
243 | nativeMap = ArrayProto.map, | ||
244 | nativeReduce = ArrayProto.reduce, | ||
245 | nativeReduceRight = ArrayProto.reduceRight, | ||
246 | nativeFilter = ArrayProto.filter, | ||
247 | nativeEvery = ArrayProto.every, | ||
248 | nativeSome = ArrayProto.some, | ||
249 | nativeIndexOf = ArrayProto.indexOf, | ||
250 | nativeLastIndexOf = ArrayProto.lastIndexOf, | ||
251 | nativeIsArray = Array.isArray, | ||
252 | nativeKeys = Object.keys, | ||
253 | nativeBind = FuncProto.bind; | ||
254 | |||
255 | // Collection Functions | ||
256 | // -------------------- | ||
257 | |||
258 | // The cornerstone, an `each` implementation, aka `forEach`. | ||
259 | // Handles objects with the built-in `forEach`, arrays, and raw objects. | ||
260 | // Delegates to **ECMAScript 5**'s native `forEach` if available. | ||
261 | var each = _.each = _.forEach = function(obj, iterator, context) { | ||
262 | /* jshint shadow:true */ | ||
263 | if (obj == null) return obj; | ||
264 | if (nativeForEach && obj.forEach === nativeForEach) { | ||
265 | obj.forEach(iterator, context); | ||
266 | } else if (obj.length === +obj.length) { | ||
267 | for (var i = 0, length = obj.length; i < length; i++) { | ||
268 | if (iterator.call(context, obj[i], i, obj) === breaker) return; | ||
269 | } | ||
270 | } else { | ||
271 | var keys = _.keys(obj); | ||
272 | for (var i = 0, length = keys.length; i < length; i++) { | ||
273 | if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return; | ||
274 | } | ||
275 | } | ||
276 | return obj; | ||
277 | }; | ||
278 | |||
279 | // Return the results of applying the iterator to each element. | ||
280 | // Delegates to **ECMAScript 5**'s native `map` if available. | ||
281 | _.map = _.collect = function(obj, iterator, context) { | ||
282 | var results = []; | ||
283 | if (obj == null) return results; | ||
284 | if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); | ||
285 | each(obj, function(value, index, list) { | ||
286 | results.push(iterator.call(context, value, index, list)); | ||
287 | }); | ||
288 | return results; | ||
289 | }; | ||
290 | |||
291 | // Return the first value which passes a truth test. Aliased as `detect`. | ||
292 | _.find = _.detect = function(obj, predicate, context) { | ||
293 | var result; | ||
294 | any(obj, function(value, index, list) { | ||
295 | if (predicate.call(context, value, index, list)) { | ||
296 | result = value; | ||
297 | return true; | ||
298 | } | ||
299 | }); | ||
300 | return result; | ||
301 | }; | ||
302 | |||
303 | // Return all the elements that pass a truth test. | ||
304 | // Delegates to **ECMAScript 5**'s native `filter` if available. | ||
305 | // Aliased as `select`. | ||
306 | _.filter = _.select = function(obj, predicate, context) { | ||
307 | var results = []; | ||
308 | if (obj == null) return results; | ||
309 | if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context); | ||
310 | each(obj, function(value, index, list) { | ||
311 | if (predicate.call(context, value, index, list)) results.push(value); | ||
312 | }); | ||
313 | return results; | ||
314 | }; | ||
315 | |||
316 | // Determine if at least one element in the object matches a truth test. | ||
317 | // Delegates to **ECMAScript 5**'s native `some` if available. | ||
318 | // Aliased as `any`. | ||
319 | var any = _.some = _.any = function(obj, predicate, context) { | ||
320 | predicate || (predicate = _.identity); | ||
321 | var result = false; | ||
322 | if (obj == null) return result; | ||
323 | if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context); | ||
324 | each(obj, function(value, index, list) { | ||
325 | if (result || (result = predicate.call(context, value, index, list))) return breaker; | ||
326 | }); | ||
327 | return !!result; | ||
328 | }; | ||
329 | |||
330 | // Determine if the array or object contains a given value (using `===`). | ||
331 | // Aliased as `include`. | ||
332 | _.contains = _.include = function(obj, target) { | ||
333 | if (obj == null) return false; | ||
334 | if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1; | ||
335 | return any(obj, function(value) { | ||
336 | return value === target; | ||
337 | }); | ||
338 | }; | ||
339 | |||
340 | // Function (ahem) Functions | ||
341 | // -------------------- | ||
342 | |||
343 | // Delays a function for the given number of milliseconds, and then calls | ||
344 | // it with the arguments supplied. | ||
345 | _.delay = function(func, wait) { | ||
346 | var args = slice.call(arguments, 2); | ||
347 | return setTimeout(function() { | ||
348 | return func.apply(null, args); | ||
349 | }, wait); | ||
350 | }; | ||
351 | |||
352 | // Defers a function, scheduling it to run after the current call stack has | ||
353 | // cleared. | ||
354 | _.defer = function(func) { | ||
355 | return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1))); | ||
356 | }; | ||
357 | |||
358 | // Returns a function, that, when invoked, will only be triggered once every | ||
359 | // browser animation frame - using tram's requestAnimationFrame polyfill. | ||
360 | _.throttle = function(func) { | ||
361 | var wait, args, context; | ||
362 | return function() { | ||
363 | if (wait) return; | ||
364 | wait = true; | ||
365 | args = arguments; | ||
366 | context = this; | ||
367 | tram.frame(function() { | ||
368 | wait = false; | ||
369 | func.apply(context, args); | ||
370 | }); | ||
371 | }; | ||
372 | }; | ||
373 | |||
374 | // Returns a function, that, as long as it continues to be invoked, will not | ||
375 | // be triggered. The function will be called after it stops being called for | ||
376 | // N milliseconds. If `immediate` is passed, trigger the function on the | ||
377 | // leading edge, instead of the trailing. | ||
378 | _.debounce = function(func, wait, immediate) { | ||
379 | var timeout, args, context, timestamp, result; | ||
380 | |||
381 | var later = function() { | ||
382 | var last = _.now() - timestamp; | ||
383 | if (last < wait) { | ||
384 | timeout = setTimeout(later, wait - last); | ||
385 | } else { | ||
386 | timeout = null; | ||
387 | if (!immediate) { | ||
388 | result = func.apply(context, args); | ||
389 | context = args = null; | ||
390 | } | ||
391 | } | ||
392 | }; | ||
393 | |||
394 | return function() { | ||
395 | context = this; | ||
396 | args = arguments; | ||
397 | timestamp = _.now(); | ||
398 | var callNow = immediate && !timeout; | ||
399 | if (!timeout) { | ||
400 | timeout = setTimeout(later, wait); | ||
401 | } | ||
402 | if (callNow) { | ||
403 | result = func.apply(context, args); | ||
404 | context = args = null; | ||
405 | } | ||
406 | |||
407 | return result; | ||
408 | }; | ||
409 | }; | ||
410 | |||
411 | // Object Functions | ||
412 | // ---------------- | ||
413 | |||
414 | // Retrieve the names of an object's properties. | ||
415 | // Delegates to **ECMAScript 5**'s native `Object.keys` | ||
416 | _.keys = function(obj) { | ||
417 | if (!_.isObject(obj)) return []; | ||
418 | if (nativeKeys) return nativeKeys(obj); | ||
419 | var keys = []; | ||
420 | for (var key in obj) | ||
421 | if (_.has(obj, key)) keys.push(key); | ||
422 | return keys; | ||
423 | }; | ||
424 | |||
425 | // Shortcut function for checking if an object has a given property directly | ||
426 | // on itself (in other words, not on a prototype). | ||
427 | _.has = function(obj, key) { | ||
428 | return hasOwnProperty.call(obj, key); | ||
429 | }; | ||
430 | |||
431 | // Is a given variable an object? | ||
432 | _.isObject = function(obj) { | ||
433 | return obj === Object(obj); | ||
434 | }; | ||
435 | |||
436 | // Utility Functions | ||
437 | // ----------------- | ||
438 | |||
439 | // A (possibly faster) way to get the current timestamp as an integer. | ||
440 | _.now = Date.now || function() { | ||
441 | return new Date().getTime(); | ||
442 | }; | ||
443 | |||
444 | // Export underscore | ||
445 | return _; | ||
446 | } | ||
447 | |||
448 | // Export api | ||
449 | Webflow = api; | ||
450 | }; | ||
451 | /*! | ||
452 | * ---------------------------------------------------------------------- | ||
453 | * Webflow: 3rd party plugins | ||
454 | */ | ||
455 | /* jshint ignore:start */ | ||
456 | /*! | ||
457 | * tram.js v0.8.1-global | ||
458 | * Cross-browser CSS3 transitions in JavaScript | ||
459 | * https://github.com/bkwld/tram | ||
460 | * MIT License | ||
461 | */ | ||
462 | window.tram = function(a) { | ||
463 | function b(a, b) { | ||
464 | var c = new L.Bare; | ||
465 | return c.init(a, b) | ||
466 | } | ||
467 | |||
468 | function c(a) { | ||
469 | return a.replace(/[A-Z]/g, function(a) { | ||
470 | return "-" + a.toLowerCase() | ||
471 | }) | ||
472 | } | ||
473 | |||
474 | function d(a) { | ||
475 | var b = parseInt(a.slice(1), 16), | ||
476 | c = b >> 16 & 255, | ||
477 | d = b >> 8 & 255, | ||
478 | e = 255 & b; | ||
479 | return [c, d, e] | ||
480 | } | ||
481 | |||
482 | function e(a, b, c) { | ||
483 | return "#" + (1 << 24 | a << 16 | b << 8 | c).toString(16).slice(1) | ||
484 | } | ||
485 | |||
486 | function f() {} | ||
487 | |||
488 | function g(a, b) { | ||
489 | _("Type warning: Expected: [" + a + "] Got: [" + typeof b + "] " + b) | ||
490 | } | ||
491 | |||
492 | function h(a, b, c) { | ||
493 | _("Units do not match [" + a + "]: " + b + ", " + c) | ||
494 | } | ||
495 | |||
496 | function i(a, b, c) { | ||
497 | if (void 0 !== b && (c = b), void 0 === a) return c; | ||
498 | var d = c; | ||
499 | return Z.test(a) || !$.test(a) ? d = parseInt(a, 10) : $.test(a) && (d = 1e3 * parseFloat(a)), 0 > d && (d = 0), d === d ? d : c | ||
500 | } | ||
501 | |||
502 | function j(a) { | ||
503 | for (var b = -1, c = a ? a.length : 0, d = []; ++b < c;) { | ||
504 | var e = a[b]; | ||
505 | e && d.push(e) | ||
506 | } | ||
507 | return d | ||
508 | } | ||
509 | var k = function(a, b, c) { | ||
510 | function d(a) { | ||
511 | return "object" == typeof a | ||
512 | } | ||
513 | |||
514 | function e(a) { | ||
515 | return "function" == typeof a | ||
516 | } | ||
517 | |||
518 | function f() {} | ||
519 | |||
520 | function g(h, i) { | ||
521 | function j() { | ||
522 | var a = new k; | ||
523 | return e(a.init) && a.init.apply(a, arguments), a | ||
524 | } | ||
525 | |||
526 | function k() {} | ||
527 | i === c && (i = h, h = Object), j.Bare = k; | ||
528 | var l, m = f[a] = h[a], | ||
529 | n = k[a] = j[a] = new f; | ||
530 | return n.constructor = j, j.mixin = function(b) { | ||
531 | return k[a] = j[a] = g(j, b)[a], j | ||
532 | }, j.open = function(a) { | ||
533 | if (l = {}, e(a) ? l = a.call(j, n, m, j, h) : d(a) && (l = a), d(l)) | ||
534 | for (var c in l) b.call(l, c) && (n[c] = l[c]); | ||
535 | return e(n.init) || (n.init = h), j | ||
536 | }, j.open(i) | ||
537 | } | ||
538 | return g | ||
539 | }("prototype", {}.hasOwnProperty), | ||
540 | l = { | ||
541 | ease: ["ease", | ||
542 | function(a, b, c, d) { | ||
543 | var e = (a /= d) * a, | ||
544 | f = e * a; | ||
545 | return b + c * (-2.75 * f * e + 11 * e * e + -15.5 * f + 8 * e + .25 * a) | ||
546 | } | ||
547 | ], | ||
548 | "ease-in": ["ease-in", | ||
549 | function(a, b, c, d) { | ||
550 | var e = (a /= d) * a, | ||
551 | f = e * a; | ||
552 | return b + c * (-1 * f * e + 3 * e * e + -3 * f + 2 * e) | ||
553 | } | ||
554 | ], | ||
555 | "ease-out": ["ease-out", | ||
556 | function(a, b, c, d) { | ||
557 | var e = (a /= d) * a, | ||
558 | f = e * a; | ||
559 | return b + c * (.3 * f * e + -1.6 * e * e + 2.2 * f + -1.8 * e + 1.9 * a) | ||
560 | } | ||
561 | ], | ||
562 | "ease-in-out": ["ease-in-out", | ||
563 | function(a, b, c, d) { | ||
564 | var e = (a /= d) * a, | ||
565 | f = e * a; | ||
566 | return b + c * (2 * f * e + -5 * e * e + 2 * f + 2 * e) | ||
567 | } | ||
568 | ], | ||
569 | linear: ["linear", | ||
570 | function(a, b, c, d) { | ||
571 | return c * a / d + b | ||
572 | } | ||
573 | ], | ||
574 | "ease-in-quad": ["cubic-bezier(0.550, 0.085, 0.680, 0.530)", | ||
575 | function(a, b, c, d) { | ||
576 | return c * (a /= d) * a + b | ||
577 | } | ||
578 | ], | ||
579 | "ease-out-quad": ["cubic-bezier(0.250, 0.460, 0.450, 0.940)", | ||
580 | function(a, b, c, d) { | ||
581 | return -c * (a /= d) * (a - 2) + b | ||
582 | } | ||
583 | ], | ||
584 | "ease-in-out-quad": ["cubic-bezier(0.455, 0.030, 0.515, 0.955)", | ||
585 | function(a, b, c, d) { | ||
586 | return (a /= d / 2) < 1 ? c / 2 * a * a + b : -c / 2 * (--a * (a - 2) - 1) + b | ||
587 | } | ||
588 | ], | ||
589 | "ease-in-cubic": ["cubic-bezier(0.550, 0.055, 0.675, 0.190)", | ||
590 | function(a, b, c, d) { | ||
591 | return c * (a /= d) * a * a + b | ||
592 | } | ||
593 | ], | ||
594 | "ease-out-cubic": ["cubic-bezier(0.215, 0.610, 0.355, 1)", | ||
595 | function(a, b, c, d) { | ||
596 | return c * ((a = a / d - 1) * a * a + 1) + b | ||
597 | } | ||
598 | ], | ||
599 | "ease-in-out-cubic": ["cubic-bezier(0.645, 0.045, 0.355, 1)", | ||
600 | function(a, b, c, d) { | ||
601 | return (a /= d / 2) < 1 ? c / 2 * a * a * a + b : c / 2 * ((a -= 2) * a * a + 2) + b | ||
602 | } | ||
603 | ], | ||
604 | "ease-in-quart": ["cubic-bezier(0.895, 0.030, 0.685, 0.220)", | ||
605 | function(a, b, c, d) { | ||
606 | return c * (a /= d) * a * a * a + b | ||
607 | } | ||
608 | ], | ||
609 | "ease-out-quart": ["cubic-bezier(0.165, 0.840, 0.440, 1)", | ||
610 | function(a, b, c, d) { | ||
611 | return -c * ((a = a / d - 1) * a * a * a - 1) + b | ||
612 | } | ||
613 | ], | ||
614 | "ease-in-out-quart": ["cubic-bezier(0.770, 0, 0.175, 1)", | ||
615 | function(a, b, c, d) { | ||
616 | return (a /= d / 2) < 1 ? c / 2 * a * a * a * a + b : -c / 2 * ((a -= 2) * a * a * a - 2) + b | ||
617 | } | ||
618 | ], | ||
619 | "ease-in-quint": ["cubic-bezier(0.755, 0.050, 0.855, 0.060)", | ||
620 | function(a, b, c, d) { | ||
621 | return c * (a /= d) * a * a * a * a + b | ||
622 | } | ||
623 | ], | ||
624 | "ease-out-quint": ["cubic-bezier(0.230, 1, 0.320, 1)", | ||
625 | function(a, b, c, d) { | ||
626 | return c * ((a = a / d - 1) * a * a * a * a + 1) + b | ||
627 | } | ||
628 | ], | ||
629 | "ease-in-out-quint": ["cubic-bezier(0.860, 0, 0.070, 1)", | ||
630 | function(a, b, c, d) { | ||
631 | return (a /= d / 2) < 1 ? c / 2 * a * a * a * a * a + b : c / 2 * ((a -= 2) * a * a * a * a + 2) + b | ||
632 | } | ||
633 | ], | ||
634 | "ease-in-sine": ["cubic-bezier(0.470, 0, 0.745, 0.715)", | ||
635 | function(a, b, c, d) { | ||
636 | return -c * Math.cos(a / d * (Math.PI / 2)) + c + b | ||
637 | } | ||
638 | ], | ||
639 | "ease-out-sine": ["cubic-bezier(0.390, 0.575, 0.565, 1)", | ||
640 | function(a, b, c, d) { | ||
641 | return c * Math.sin(a / d * (Math.PI / 2)) + b | ||
642 | } | ||
643 | ], | ||
644 | "ease-in-out-sine": ["cubic-bezier(0.445, 0.050, 0.550, 0.950)", | ||
645 | function(a, b, c, d) { | ||
646 | return -c / 2 * (Math.cos(Math.PI * a / d) - 1) + b | ||
647 | } | ||
648 | ], | ||
649 | "ease-in-expo": ["cubic-bezier(0.950, 0.050, 0.795, 0.035)", | ||
650 | function(a, b, c, d) { | ||
651 | return 0 === a ? b : c * Math.pow(2, 10 * (a / d - 1)) + b | ||
652 | } | ||
653 | ], | ||
654 | "ease-out-expo": ["cubic-bezier(0.190, 1, 0.220, 1)", | ||
655 | function(a, b, c, d) { | ||
656 | return a === d ? b + c : c * (-Math.pow(2, -10 * a / d) + 1) + b | ||
657 | } | ||
658 | ], | ||
659 | "ease-in-out-expo": ["cubic-bezier(1, 0, 0, 1)", | ||
660 | function(a, b, c, d) { | ||
661 | return 0 === a ? b : a === d ? b + c : (a /= d / 2) < 1 ? c / 2 * Math.pow(2, 10 * (a - 1)) + b : c / 2 * (-Math.pow(2, -10 * --a) + 2) + b | ||
662 | } | ||
663 | ], | ||
664 | "ease-in-circ": ["cubic-bezier(0.600, 0.040, 0.980, 0.335)", | ||
665 | function(a, b, c, d) { | ||
666 | return -c * (Math.sqrt(1 - (a /= d) * a) - 1) + b | ||
667 | } | ||
668 | ], | ||
669 | "ease-out-circ": ["cubic-bezier(0.075, 0.820, 0.165, 1)", | ||
670 | function(a, b, c, d) { | ||
671 | return c * Math.sqrt(1 - (a = a / d - 1) * a) + b | ||
672 | } | ||
673 | ], | ||
674 | "ease-in-out-circ": ["cubic-bezier(0.785, 0.135, 0.150, 0.860)", | ||
675 | function(a, b, c, d) { | ||
676 | return (a /= d / 2) < 1 ? -c / 2 * (Math.sqrt(1 - a * a) - 1) + b : c / 2 * (Math.sqrt(1 - (a -= 2) * a) + 1) + b | ||
677 | } | ||
678 | ], | ||
679 | "ease-in-back": ["cubic-bezier(0.600, -0.280, 0.735, 0.045)", | ||
680 | function(a, b, c, d, e) { | ||
681 | return void 0 === e && (e = 1.70158), c * (a /= d) * a * ((e + 1) * a - e) + b | ||
682 | } | ||
683 | ], | ||
684 | "ease-out-back": ["cubic-bezier(0.175, 0.885, 0.320, 1.275)", | ||
685 | function(a, b, c, d, e) { | ||
686 | return void 0 === e && (e = 1.70158), c * ((a = a / d - 1) * a * ((e + 1) * a + e) + 1) + b | ||
687 | } | ||
688 | ], | ||
689 | "ease-in-out-back": ["cubic-bezier(0.680, -0.550, 0.265, 1.550)", | ||
690 | function(a, b, c, d, e) { | ||
691 | return void 0 === e && (e = 1.70158), (a /= d / 2) < 1 ? c / 2 * a * a * (((e *= 1.525) + 1) * a - e) + b : c / 2 * ((a -= 2) * a * (((e *= 1.525) + 1) * a + e) + 2) + b | ||
692 | } | ||
693 | ] | ||
694 | }, | ||
695 | m = { | ||
696 | "ease-in-back": "cubic-bezier(0.600, 0, 0.735, 0.045)", | ||
697 | "ease-out-back": "cubic-bezier(0.175, 0.885, 0.320, 1)", | ||
698 | "ease-in-out-back": "cubic-bezier(0.680, 0, 0.265, 1)" | ||
699 | }, | ||
700 | n = document, | ||
701 | o = window, | ||
702 | p = "bkwld-tram", | ||
703 | q = /[\-\.0-9]/g, | ||
704 | r = /[A-Z]/, | ||
705 | s = "number", | ||
706 | t = /^(rgb|#)/, | ||
707 | u = /(em|cm|mm|in|pt|pc|px)$/, | ||
708 | v = /(em|cm|mm|in|pt|pc|px|%)$/, | ||
709 | w = /(deg|rad|turn)$/, | ||
710 | x = "unitless", | ||
711 | y = /(all|none) 0s ease 0s/, | ||
712 | z = /^(width|height)$/, | ||
713 | A = " ", | ||
714 | B = n.createElement("a"), | ||
715 | C = ["Webkit", "Moz", "O", "ms"], | ||
716 | D = ["-webkit-", "-moz-", "-o-", "-ms-"], | ||
717 | E = function(a) { | ||
718 | if (a in B.style) return { | ||
719 | dom: a, | ||
720 | css: a | ||
721 | }; | ||
722 | var b, c, d = "", | ||
723 | e = a.split("-"); | ||
724 | for (b = 0; b < e.length; b++) d += e[b].charAt(0).toUpperCase() + e[b].slice(1); | ||
725 | for (b = 0; b < C.length; b++) | ||
726 | if (c = C[b] + d, c in B.style) return { | ||
727 | dom: c, | ||
728 | css: D[b] + a | ||
729 | } | ||
730 | }, | ||
731 | F = b.support = { | ||
732 | bind: Function.prototype.bind, | ||
733 | transform: E("transform"), | ||
734 | transition: E("transition"), | ||
735 | backface: E("backface-visibility"), | ||
736 | timing: E("transition-timing-function") | ||
737 | }; | ||
738 | if (F.transition) { | ||
739 | var G = F.timing.dom; | ||
740 | if (B.style[G] = l["ease-in-back"][0], !B.style[G]) | ||
741 | for (var H in m) l[H][0] = m[H] | ||
742 | } | ||
743 | var I = b.frame = function() { | ||
744 | var a = o.requestAnimationFrame || o.webkitRequestAnimationFrame || o.mozRequestAnimationFrame || o.oRequestAnimationFrame || o.msRequestAnimationFrame; | ||
745 | return a && F.bind ? a.bind(o) : function(a) { | ||
746 | o.setTimeout(a, 16) | ||
747 | } | ||
748 | }(), | ||
749 | J = b.now = function() { | ||
750 | var a = o.performance, | ||
751 | b = a && (a.now || a.webkitNow || a.msNow || a.mozNow); | ||
752 | return b && F.bind ? b.bind(a) : Date.now || function() { | ||
753 | return +new Date | ||
754 | } | ||
755 | }(), | ||
756 | K = k(function(b) { | ||
757 | function d(a, b) { | ||
758 | var c = j(("" + a).split(A)), | ||
759 | d = c[0]; | ||
760 | b = b || {}; | ||
761 | var e = X[d]; | ||
762 | if (!e) return _("Unsupported property: " + d); | ||
763 | if (!b.weak || !this.props[d]) { | ||
764 | var f = e[0], | ||
765 | g = this.props[d]; | ||
766 | return g || (g = this.props[d] = new f.Bare), g.init(this.$el, c, e, b), g | ||
767 | } | ||
768 | } | ||
769 | |||
770 | function e(a, b, c) { | ||
771 | if (a) { | ||
772 | var e = typeof a; | ||
773 | if (b || (this.timer && this.timer.destroy(), this.queue = [], this.active = !1), "number" == e && b) return this.timer = new R({ | ||
774 | duration: a, | ||
775 | context: this, | ||
776 | complete: h | ||
777 | }), void(this.active = !0); | ||
778 | if ("string" == e && b) { | ||
779 | switch (a) { | ||
780 | case "hide": | ||
781 | n.call(this); | ||
782 | break; | ||
783 | case "stop": | ||
784 | k.call(this); | ||
785 | break; | ||
786 | case "redraw": | ||
787 | o.call(this); | ||
788 | break; | ||
789 | default: | ||
790 | d.call(this, a, c && c[1]) | ||
791 | } | ||
792 | return h.call(this) | ||
793 | } | ||
794 | if ("function" == e) return void a.call(this, this); | ||
795 | if ("object" == e) { | ||
796 | var f = 0; | ||
797 | t.call(this, a, function(a, b) { | ||
798 | a.span > f && (f = a.span), a.stop(), a.animate(b) | ||
799 | }, function(a) { | ||
800 | "wait" in a && (f = i(a.wait, 0)) | ||
801 | }), s.call(this), f > 0 && (this.timer = new R({ | ||
802 | duration: f, | ||
803 | context: this | ||
804 | }), this.active = !0, b && (this.timer.complete = h)); | ||
805 | var g = this, | ||
806 | j = !1, | ||
807 | l = {}; | ||
808 | I(function() { | ||
809 | t.call(g, a, function(a) { | ||
810 | a.active && (j = !0, l[a.name] = a.nextStyle) | ||
811 | }), j && g.$el.css(l) | ||
812 | }) | ||
813 | } | ||
814 | } | ||
815 | } | ||
816 | |||
817 | function f(a) { | ||
818 | a = i(a, 0), this.active ? this.queue.push({ | ||
819 | options: a | ||
820 | }) : (this.timer = new R({ | ||
821 | duration: a, | ||
822 | context: this, | ||
823 | complete: h | ||
824 | }), this.active = !0) | ||
825 | } | ||
826 | |||
827 | function g(a) { | ||
828 | return this.active ? (this.queue.push({ | ||
829 | options: a, | ||
830 | args: arguments | ||
831 | }), void(this.timer.complete = h)) : _("No active transition timer. Use start() or wait() before then().") | ||
832 | } | ||
833 | |||
834 | function h() { | ||
835 | if (this.timer && this.timer.destroy(), this.active = !1, this.queue.length) { | ||
836 | var a = this.queue.shift(); | ||
837 | e.call(this, a.options, !0, a.args) | ||
838 | } | ||
839 | } | ||
840 | |||
841 | function k(a) { | ||
842 | this.timer && this.timer.destroy(), this.queue = [], this.active = !1; | ||
843 | var b; | ||
844 | "string" == typeof a ? (b = {}, b[a] = 1) : b = "object" == typeof a && null != a ? a : this.props, t.call(this, b, u), s.call(this) | ||
845 | } | ||
846 | |||
847 | function l(a) { | ||
848 | k.call(this, a), t.call(this, a, v, w) | ||
849 | } | ||
850 | |||
851 | function m(a) { | ||
852 | "string" != typeof a && (a = "block"), this.el.style.display = a | ||
853 | } | ||
854 | |||
855 | function n() { | ||
856 | k.call(this), this.el.style.display = "none" | ||
857 | } | ||
858 | |||
859 | function o() { | ||
860 | this.el.offsetHeight | ||
861 | } | ||
862 | |||
863 | function q() { | ||
864 | k.call(this), a.removeData(this.el, p), this.$el = this.el = null | ||
865 | } | ||
866 | |||
867 | function s() { | ||
868 | var a, b, c = []; | ||
869 | this.upstream && c.push(this.upstream); | ||
870 | for (a in this.props) b = this.props[a], b.active && c.push(b.string); | ||
871 | c = c.join(","), this.style !== c && (this.style = c, this.el.style[F.transition.dom] = c) | ||
872 | } | ||
873 | |||
874 | function t(a, b, e) { | ||
875 | var f, g, h, i, j = b !== u, | ||
876 | k = {}; | ||
877 | for (f in a) h = a[f], f in Y ? (k.transform || (k.transform = {}), k.transform[f] = h) : (r.test(f) && (f = c(f)), f in X ? k[f] = h : (i || (i = {}), i[f] = h)); | ||
878 | for (f in k) { | ||
879 | if (h = k[f], g = this.props[f], !g) { | ||
880 | if (!j) continue; | ||
881 | g = d.call(this, f) | ||
882 | } | ||
883 | b.call(this, g, h) | ||
884 | } | ||
885 | e && i && e.call(this, i) | ||
886 | } | ||
887 | |||
888 | function u(a) { | ||
889 | a.stop() | ||
890 | } | ||
891 | |||
892 | function v(a, b) { | ||
893 | a.set(b) | ||
894 | } | ||
895 | |||
896 | function w(a) { | ||
897 | this.$el.css(a) | ||
898 | } | ||
899 | |||
900 | function x(a, c) { | ||
901 | b[a] = function() { | ||
902 | return this.children ? z.call(this, c, arguments) : (this.el && c.apply(this, arguments), this) | ||
903 | } | ||
904 | } | ||
905 | |||
906 | function z(a, b) { | ||
907 | var c, d = this.children.length; | ||
908 | for (c = 0; d > c; c++) a.apply(this.children[c], b); | ||
909 | return this | ||
910 | } | ||
911 | b.init = function(b) { | ||
912 | if (this.$el = a(b), this.el = this.$el[0], this.props = {}, this.queue = [], this.style = "", this.active = !1, T.keepInherited && !T.fallback) { | ||
913 | var c = V(this.el, "transition"); | ||
914 | c && !y.test(c) && (this.upstream = c) | ||
915 | } | ||
916 | F.backface && T.hideBackface && U(this.el, F.backface.css, "hidden") | ||
917 | }, x("add", d), x("start", e), x("wait", f), x("then", g), x("next", h), x("stop", k), x("set", l), x("show", m), x("hide", n), x("redraw", o), x("destroy", q) | ||
918 | }), | ||
919 | L = k(K, function(b) { | ||
920 | function c(b, c) { | ||
921 | var d = a.data(b, p) || a.data(b, p, new K.Bare); | ||
922 | return d.el || d.init(b), c ? d.start(c) : d | ||
923 | } | ||
924 | b.init = function(b, d) { | ||
925 | var e = a(b); | ||
926 | if (!e.length) return this; | ||
927 | if (1 === e.length) return c(e[0], d); | ||
928 | var f = []; | ||
929 | return e.each(function(a, b) { | ||
930 | f.push(c(b, d)) | ||
931 | }), this.children = f, this | ||
932 | } | ||
933 | }), | ||
934 | M = k(function(a) { | ||
935 | function b() { | ||
936 | var a = this.get(); | ||
937 | this.update("auto"); | ||
938 | var b = this.get(); | ||
939 | return this.update(a), b | ||
940 | } | ||
941 | |||
942 | function c(a, b, c) { | ||
943 | return void 0 !== b && (c = b), a in l ? a : c | ||
944 | } | ||
945 | |||
946 | function d(a) { | ||
947 | var b = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(a); | ||
948 | return (b ? e(b[1], b[2], b[3]) : a).replace(/#(\w)(\w)(\w)$/, "#$1$1$2$2$3$3") | ||
949 | } | ||
950 | var f = { | ||
951 | duration: 500, | ||
952 | ease: "ease", | ||
953 | delay: 0 | ||
954 | }; | ||
955 | a.init = function(a, b, d, e) { | ||
956 | this.$el = a, this.el = a[0]; | ||
957 | var g = b[0]; | ||
958 | d[2] && (g = d[2]), W[g] && (g = W[g]), this.name = g, this.type = d[1], this.duration = i(b[1], this.duration, f.duration), this.ease = c(b[2], this.ease, f.ease), this.delay = i(b[3], this.delay, f.delay), this.span = this.duration + this.delay, this.active = !1, this.nextStyle = null, this.auto = z.test(this.name), this.unit = e.unit || this.unit || T.defaultUnit, this.angle = e.angle || this.angle || T.defaultAngle, T.fallback || e.fallback ? this.animate = this.fallback : (this.animate = this.transition, this.string = this.name + A + this.duration + "ms" + ("ease" != this.ease ? A + l[this.ease][0] : "") + (this.delay ? A + this.delay + "ms" : "")) | ||
959 | }, a.set = function(a) { | ||
960 | a = this.convert(a, this.type), this.update(a), this.redraw() | ||
961 | }, a.transition = function(a) { | ||
962 | this.active = !0, a = this.convert(a, this.type), this.auto && ("auto" == this.el.style[this.name] && (this.update(this.get()), this.redraw()), "auto" == a && (a = b.call(this))), this.nextStyle = a | ||
963 | }, a.fallback = function(a) { | ||
964 | var c = this.el.style[this.name] || this.convert(this.get(), this.type); | ||
965 | a = this.convert(a, this.type), this.auto && ("auto" == c && (c = this.convert(this.get(), this.type)), "auto" == a && (a = b.call(this))), this.tween = new Q({ | ||
966 | from: c, | ||
967 | to: a, | ||
968 | duration: this.duration, | ||
969 | delay: this.delay, | ||
970 | ease: this.ease, | ||
971 | update: this.update, | ||
972 | context: this | ||
973 | }) | ||
974 | }, a.get = function() { | ||
975 | return V(this.el, this.name) | ||
976 | }, a.update = function(a) { | ||
977 | U(this.el, this.name, a) | ||
978 | }, a.stop = function() { | ||
979 | (this.active || this.nextStyle) && (this.active = !1, this.nextStyle = null, U(this.el, this.name, this.get())); | ||
980 | var a = this.tween; | ||
981 | a && a.context && a.destroy() | ||
982 | }, a.convert = function(a, b) { | ||
983 | if ("auto" == a && this.auto) return a; | ||
984 | var c, e = "number" == typeof a, | ||
985 | f = "string" == typeof a; | ||
986 | switch (b) { | ||
987 | case s: | ||
988 | if (e) return a; | ||
989 | if (f && "" === a.replace(q, "")) return +a; | ||
990 | c = "number(unitless)"; | ||
991 | break; | ||
992 | case t: | ||
993 | if (f) { | ||
994 | if ("" === a && this.original) return this.original; | ||
995 | if (b.test(a)) return "#" == a.charAt(0) && 7 == a.length ? a : d(a) | ||
996 | } | ||
997 | c = "hex or rgb string"; | ||
998 | break; | ||
999 | case u: | ||
1000 | if (e) return a + this.unit; | ||
1001 | if (f && b.test(a)) return a; | ||
1002 | c = "number(px) or string(unit)"; | ||
1003 | break; | ||
1004 | case v: | ||
1005 | if (e) return a + this.unit; | ||
1006 | if (f && b.test(a)) return a; | ||
1007 | c = "number(px) or string(unit or %)"; | ||
1008 | break; | ||
1009 | case w: | ||
1010 | if (e) return a + this.angle; | ||
1011 | if (f && b.test(a)) return a; | ||
1012 | c = "number(deg) or string(angle)"; | ||
1013 | break; | ||
1014 | case x: | ||
1015 | if (e) return a; | ||
1016 | if (f && v.test(a)) return a; | ||
1017 | c = "number(unitless) or string(unit or %)" | ||
1018 | } | ||
1019 | return g(c, a), a | ||
1020 | }, a.redraw = function() { | ||
1021 | this.el.offsetHeight | ||
1022 | } | ||
1023 | }), | ||
1024 | N = k(M, function(a, b) { | ||
1025 | a.init = function() { | ||
1026 | b.init.apply(this, arguments), this.original || (this.original = this.convert(this.get(), t)) | ||
1027 | } | ||
1028 | }), | ||
1029 | O = k(M, function(a, b) { | ||
1030 | a.init = function() { | ||
1031 | b.init.apply(this, arguments), this.animate = this.fallback | ||
1032 | }, a.get = function() { | ||
1033 | return this.$el[this.name]() | ||
1034 | }, a.update = function(a) { | ||
1035 | this.$el[this.name](a) | ||
1036 | } | ||
1037 | }), | ||
1038 | P = k(M, function(a, b) { | ||
1039 | function c(a, b) { | ||
1040 | var c, d, e, f, g; | ||
1041 | for (c in a) f = Y[c], e = f[0], d = f[1] || c, g = this.convert(a[c], e), b.call(this, d, g, e) | ||
1042 | } | ||
1043 | a.init = function() { | ||
1044 | b.init.apply(this, arguments), this.current || (this.current = {}, Y.perspective && T.perspective && (this.current.perspective = T.perspective, U(this.el, this.name, this.style(this.current)), this.redraw())) | ||
1045 | }, a.set = function(a) { | ||
1046 | c.call(this, a, function(a, b) { | ||
1047 | this.current[a] = b | ||
1048 | }), U(this.el, this.name, this.style(this.current)), this.redraw() | ||
1049 | }, a.transition = function(a) { | ||
1050 | var b = this.values(a); | ||
1051 | this.tween = new S({ | ||
1052 | current: this.current, | ||
1053 | values: b, | ||
1054 | duration: this.duration, | ||
1055 | delay: this.delay, | ||
1056 | ease: this.ease | ||
1057 | }); | ||
1058 | var c, d = {}; | ||
1059 | for (c in this.current) d[c] = c in b ? b[c] : this.current[c]; | ||
1060 | this.active = !0, this.nextStyle = this.style(d) | ||
1061 | }, a.fallback = function(a) { | ||
1062 | var b = this.values(a); | ||
1063 | this.tween = new S({ | ||
1064 | current: this.current, | ||
1065 | values: b, | ||
1066 | duration: this.duration, | ||
1067 | delay: this.delay, | ||
1068 | ease: this.ease, | ||
1069 | update: this.update, | ||
1070 | context: this | ||
1071 | }) | ||
1072 | }, a.update = function() { | ||
1073 | U(this.el, this.name, this.style(this.current)) | ||
1074 | }, a.style = function(a) { | ||
1075 | var b, c = ""; | ||
1076 | for (b in a) c += b + "(" + a[b] + ") "; | ||
1077 | return c | ||
1078 | }, a.values = function(a) { | ||
1079 | var b, d = {}; | ||
1080 | return c.call(this, a, function(a, c, e) { | ||
1081 | d[a] = c, void 0 === this.current[a] && (b = 0, ~a.indexOf("scale") && (b = 1), this.current[a] = this.convert(b, e)) | ||
1082 | }), d | ||
1083 | } | ||
1084 | }), | ||
1085 | Q = k(function(b) { | ||
1086 | function c(a) { | ||
1087 | 1 === n.push(a) && I(g) | ||
1088 | } | ||
1089 | |||
1090 | function g() { | ||
1091 | var a, b, c, d = n.length; | ||
1092 | if (d) | ||
1093 | for (I(g), b = J(), a = d; a--;) c = n[a], c && c.render(b) | ||
1094 | } | ||
1095 | |||
1096 | function i(b) { | ||
1097 | var c, d = a.inArray(b, n); | ||
1098 | d >= 0 && (c = n.slice(d + 1), n.length = d, c.length && (n = n.concat(c))) | ||
1099 | } | ||
1100 | |||
1101 | function j(a) { | ||
1102 | return Math.round(a * o) / o | ||
1103 | } | ||
1104 | |||
1105 | function k(a, b, c) { | ||
1106 | return e(a[0] + c * (b[0] - a[0]), a[1] + c * (b[1] - a[1]), a[2] + c * (b[2] - a[2])) | ||
1107 | } | ||
1108 | var m = { | ||
1109 | ease: l.ease[1], | ||
1110 | from: 0, | ||
1111 | to: 1 | ||
1112 | }; | ||
1113 | b.init = function(a) { | ||
1114 | this.duration = a.duration || 0, this.delay = a.delay || 0; | ||
1115 | var b = a.ease || m.ease; | ||
1116 | l[b] && (b = l[b][1]), "function" != typeof b && (b = m.ease), this.ease = b, this.update = a.update || f, this.complete = a.complete || f, this.context = a.context || this, this.name = a.name; | ||
1117 | var c = a.from, | ||
1118 | d = a.to; | ||
1119 | void 0 === c && (c = m.from), void 0 === d && (d = m.to), this.unit = a.unit || "", "number" == typeof c && "number" == typeof d ? (this.begin = c, this.change = d - c) : this.format(d, c), this.value = this.begin + this.unit, this.start = J(), a.autoplay !== !1 && this.play() | ||
1120 | }, b.play = function() { | ||
1121 | this.active || (this.start || (this.start = J()), this.active = !0, c(this)) | ||
1122 | }, b.stop = function() { | ||
1123 | this.active && (this.active = !1, i(this)) | ||
1124 | }, b.render = function(a) { | ||
1125 | var b, c = a - this.start; | ||
1126 | if (this.delay) { | ||
1127 | if (c <= this.delay) return; | ||
1128 | c -= this.delay | ||
1129 | } | ||
1130 | if (c < this.duration) { | ||
1131 | var d = this.ease(c, 0, 1, this.duration); | ||
1132 | return b = this.startRGB ? k(this.startRGB, this.endRGB, d) : j(this.begin + d * this.change), this.value = b + this.unit, void this.update.call(this.context, this.value) | ||
1133 | } | ||
1134 | b = this.endHex || this.begin + this.change, this.value = b + this.unit, this.update.call(this.context, this.value), this.complete.call(this.context), this.destroy() | ||
1135 | }, b.format = function(a, b) { | ||
1136 | if (b += "", a += "", "#" == a.charAt(0)) return this.startRGB = d(b), this.endRGB = d(a), this.endHex = a, this.begin = 0, void(this.change = 1); | ||
1137 | if (!this.unit) { | ||
1138 | var c = b.replace(q, ""), | ||
1139 | e = a.replace(q, ""); | ||
1140 | c !== e && h("tween", b, a), this.unit = c | ||
1141 | } | ||
1142 | b = parseFloat(b), a = parseFloat(a), this.begin = this.value = b, this.change = a - b | ||
1143 | }, b.destroy = function() { | ||
1144 | this.stop(), this.context = null, this.ease = this.update = this.complete = f | ||
1145 | }; | ||
1146 | var n = [], | ||
1147 | o = 1e3 | ||
1148 | }), | ||
1149 | R = k(Q, function(a) { | ||
1150 | a.init = function(a) { | ||
1151 | this.duration = a.duration || 0, this.complete = a.complete || f, this.context = a.context, this.play() | ||
1152 | }, a.render = function(a) { | ||
1153 | var b = a - this.start; | ||
1154 | b < this.duration || (this.complete.call(this.context), this.destroy()) | ||
1155 | } | ||
1156 | }), | ||
1157 | S = k(Q, function(a, b) { | ||
1158 | a.init = function(a) { | ||
1159 | this.context = a.context, this.update = a.update, this.tweens = [], this.current = a.current; | ||
1160 | var b, c; | ||
1161 | for (b in a.values) c = a.values[b], this.current[b] !== c && this.tweens.push(new Q({ | ||
1162 | name: b, | ||
1163 | from: this.current[b], | ||
1164 | to: c, | ||
1165 | duration: a.duration, | ||
1166 | delay: a.delay, | ||
1167 | ease: a.ease, | ||
1168 | autoplay: !1 | ||
1169 | })); | ||
1170 | this.play() | ||
1171 | }, a.render = function(a) { | ||
1172 | var b, c, d = this.tweens.length, | ||
1173 | e = !1; | ||
1174 | for (b = d; b--;) c = this.tweens[b], c.context && (c.render(a), this.current[c.name] = c.value, e = !0); | ||
1175 | return e ? void(this.update && this.update.call(this.context)) : this.destroy() | ||
1176 | }, a.destroy = function() { | ||
1177 | if (b.destroy.call(this), this.tweens) { | ||
1178 | var a, c = this.tweens.length; | ||
1179 | for (a = c; a--;) this.tweens[a].destroy(); | ||
1180 | this.tweens = null, this.current = null | ||
1181 | } | ||
1182 | } | ||
1183 | }), | ||
1184 | T = b.config = { | ||
1185 | defaultUnit: "px", | ||
1186 | defaultAngle: "deg", | ||
1187 | keepInherited: !1, | ||
1188 | hideBackface: !1, | ||
1189 | perspective: "", | ||
1190 | fallback: !F.transition, | ||
1191 | agentTests: [] | ||
1192 | }; | ||
1193 | b.fallback = function(a) { | ||
1194 | if (!F.transition) return T.fallback = !0; | ||
1195 | T.agentTests.push("(" + a + ")"); | ||
1196 | var b = new RegExp(T.agentTests.join("|"), "i"); | ||
1197 | T.fallback = b.test(navigator.userAgent) | ||
1198 | }, b.fallback("6.0.[2-5] Safari"), b.tween = function(a) { | ||
1199 | return new Q(a) | ||
1200 | }, b.delay = function(a, b, c) { | ||
1201 | return new R({ | ||
1202 | complete: b, | ||
1203 | duration: a, | ||
1204 | context: c | ||
1205 | }) | ||
1206 | }, a.fn.tram = function(a) { | ||
1207 | return b.call(null, this, a) | ||
1208 | }; | ||
1209 | var U = a.style, | ||
1210 | V = a.css, | ||
1211 | W = { | ||
1212 | transform: F.transform && F.transform.css | ||
1213 | }, | ||
1214 | X = { | ||
1215 | color: [N, t], | ||
1216 | background: [N, t, "background-color"], | ||
1217 | "outline-color": [N, t], | ||
1218 | "border-color": [N, t], | ||
1219 | "border-top-color": [N, t], | ||
1220 | "border-right-color": [N, t], | ||
1221 | "border-bottom-color": [N, t], | ||
1222 | "border-left-color": [N, t], | ||
1223 | "border-width": [M, u], | ||
1224 | "border-top-width": [M, u], | ||
1225 | "border-right-width": [M, u], | ||
1226 | "border-bottom-width": [M, u], | ||
1227 | "border-left-width": [M, u], | ||
1228 | "border-spacing": [M, u], | ||
1229 | "letter-spacing": [M, u], | ||
1230 | margin: [M, u], | ||
1231 | "margin-top": [M, u], | ||
1232 | "margin-right": [M, u], | ||
1233 | "margin-bottom": [M, u], | ||
1234 | "margin-left": [M, u], | ||
1235 | padding: [M, u], | ||
1236 | "padding-top": [M, u], | ||
1237 | "padding-right": [M, u], | ||
1238 | "padding-bottom": [M, u], | ||
1239 | "padding-left": [M, u], | ||
1240 | "outline-width": [M, u], | ||
1241 | opacity: [M, s], | ||
1242 | top: [M, v], | ||
1243 | right: [M, v], | ||
1244 | bottom: [M, v], | ||
1245 | left: [M, v], | ||
1246 | "font-size": [M, v], | ||
1247 | "text-indent": [M, v], | ||
1248 | "word-spacing": [M, v], | ||
1249 | width: [M, v], | ||
1250 | "min-width": [M, v], | ||
1251 | "max-width": [M, v], | ||
1252 | height: [M, v], | ||
1253 | "min-height": [M, v], | ||
1254 | "max-height": [M, v], | ||
1255 | "line-height": [M, x], | ||
1256 | "scroll-top": [O, s, "scrollTop"], | ||
1257 | "scroll-left": [O, s, "scrollLeft"] | ||
1258 | }, | ||
1259 | Y = {}; | ||
1260 | F.transform && (X.transform = [P], Y = { | ||
1261 | x: [v, "translateX"], | ||
1262 | y: [v, "translateY"], | ||
1263 | rotate: [w], | ||
1264 | rotateX: [w], | ||
1265 | rotateY: [w], | ||
1266 | scale: [s], | ||
1267 | scaleX: [s], | ||
1268 | scaleY: [s], | ||
1269 | skew: [w], | ||
1270 | skewX: [w], | ||
1271 | skewY: [w] | ||
1272 | }), F.transform && F.backface && (Y.z = [v, "translateZ"], Y.rotateZ = [w], Y.scaleZ = [s], Y.perspective = [u]); | ||
1273 | var Z = /ms/, | ||
1274 | $ = /s|\./, | ||
1275 | _ = function() { | ||
1276 | var a = "warn", | ||
1277 | b = window.console; | ||
1278 | return b && b[a] ? function(c) { | ||
1279 | b[a](c) | ||
1280 | } : f | ||
1281 | }(); | ||
1282 | return a.tram = b | ||
1283 | }(window.jQuery); | ||
1284 | /*! | ||
1285 | * jQuery-ajaxTransport-XDomainRequest - v1.0.1 - 2013-10-17 | ||
1286 | * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest | ||
1287 | * Copyright (c) 2013 Jason Moon (@JSONMOON) | ||
1288 | * Licensed MIT (/blob/master/LICENSE.txt) | ||
1289 | */ | ||
1290 | (function($) { | ||
1291 | if (!$.support.cors && $.ajaxTransport && window.XDomainRequest) { | ||
1292 | var n = /^https?:\/\//i; | ||
1293 | var o = /^get|post$/i; | ||
1294 | var p = new RegExp('^' + location.protocol, 'i'); | ||
1295 | var q = /text\/html/i; | ||
1296 | var r = /\/json/i; | ||
1297 | var s = /\/xml/i; | ||
1298 | $.ajaxTransport('* text html xml json', function(i, j, k) { | ||
1299 | if (i.crossDomain && i.async && o.test(i.type) && n.test(i.url) && p.test(i.url)) { | ||
1300 | var l = null; | ||
1301 | var m = (j.dataType || '').toLowerCase(); | ||
1302 | return { | ||
1303 | send: function(f, g) { | ||
1304 | l = new XDomainRequest(); | ||
1305 | if (/^\d+$/.test(j.timeout)) { | ||
1306 | l.timeout = j.timeout | ||
1307 | } | ||
1308 | l.ontimeout = function() { | ||
1309 | g(500, 'timeout') | ||
1310 | }; | ||
1311 | l.onload = function() { | ||
1312 | var a = 'Content-Length: ' + l.responseText.length + '\r\nContent-Type: ' + l.contentType; | ||
1313 | var b = { | ||
1314 | code: 200, | ||
1315 | message: 'success' | ||
1316 | }; | ||
1317 | var c = { | ||
1318 | text: l.responseText | ||
1319 | }; | ||
1320 | try { | ||
1321 | if (m === 'html' || q.test(l.contentType)) { | ||
1322 | c.html = l.responseText | ||
1323 | } else if (m === 'json' || (m !== 'text' && r.test(l.contentType))) { | ||
1324 | try { | ||
1325 | c.json = $.parseJSON(l.responseText) | ||
1326 | } catch (e) { | ||
1327 | b.code = 500; | ||
1328 | b.message = 'parseerror' | ||
1329 | } | ||
1330 | } else if (m === 'xml' || (m !== 'text' && s.test(l.contentType))) { | ||
1331 | var d = new ActiveXObject('Microsoft.XMLDOM'); | ||
1332 | d.async = false; | ||
1333 | try { | ||
1334 | d.loadXML(l.responseText) | ||
1335 | } catch (e) { | ||
1336 | d = undefined | ||
1337 | } | ||
1338 | if (!d || !d.documentElement || d.getElementsByTagName('parsererror').length) { | ||
1339 | b.code = 500; | ||
1340 | b.message = 'parseerror'; | ||
1341 | throw 'Invalid XML: ' + l.responseText; | ||
1342 | } | ||
1343 | c.xml = d | ||
1344 | } | ||
1345 | } catch (parseMessage) { | ||
1346 | throw parseMessage; | ||
1347 | } finally { | ||
1348 | g(b.code, b.message, c, a) | ||
1349 | } | ||
1350 | }; | ||
1351 | l.onprogress = function() {}; | ||
1352 | l.onerror = function() { | ||
1353 | g(500, 'error', { | ||
1354 | text: l.responseText | ||
1355 | }) | ||
1356 | }; | ||
1357 | var h = ''; | ||
1358 | if (j.data) { | ||
1359 | h = ($.type(j.data) === 'string') ? j.data : $.param(j.data) | ||
1360 | } | ||
1361 | l.open(i.type, i.url); | ||
1362 | l.send(h) | ||
1363 | }, | ||
1364 | abort: function() { | ||
1365 | if (l) { | ||
1366 | l.abort() | ||
1367 | } | ||
1368 | } | ||
1369 | } | ||
1370 | } | ||
1371 | }) | ||
1372 | } | ||
1373 | })(jQuery); | ||
1374 | /* jshint ignore:end */ | ||
1375 | /** | ||
1376 | * ---------------------------------------------------------------------- | ||
1377 | * Init lib after plugins | ||
1378 | */ | ||
1379 | Webflow.init(); | ||
1380 | /** | ||
1381 | * ---------------------------------------------------------------------- | ||
1382 | * Webflow: Interactions | ||
1383 | */ | ||
1384 | Webflow.define('ix', function($, _) { | ||
1385 | 'use strict'; | ||
1386 | |||
1387 | var api = {}; | ||
1388 | var designer; | ||
1389 | var $win = $(window); | ||
1390 | var namespace = '.w-ix'; | ||
1391 | var tram = window.tram; | ||
1392 | var env = Webflow.env; | ||
1393 | var ios = env.ios; | ||
1394 | var inApp = env(); | ||
1395 | var emptyFix = env.chrome && env.chrome < 35; | ||
1396 | var transNone = 'none 0s ease 0s'; | ||
1397 | var introEvent = 'w-ix-intro' + namespace; | ||
1398 | var outroEvent = 'w-ix-outro' + namespace; | ||
1399 | var fallbackProps = /width|height/; | ||
1400 | var eventQueue = []; | ||
1401 | var $subs = $(); | ||
1402 | var config = {}; | ||
1403 | var anchors = []; | ||
1404 | var loads = []; | ||
1405 | var readys = []; | ||
1406 | var unique = 0; | ||
1407 | var store; | ||
1408 | |||
1409 | // Component types and proxy selectors | ||
1410 | var components = { | ||
1411 | tabs: '.w-tab-link, .w-tab-pane', | ||
1412 | dropdown: '.w-dropdown', | ||
1413 | slider: '.w-slide', | ||
1414 | navbar: '.w-nav' | ||
1415 | }; | ||
1416 | |||
1417 | // ----------------------------------- | ||
1418 | // Module methods | ||
1419 | |||
1420 | api.init = function(list) { | ||
1421 | setTimeout(function() { | ||
1422 | init(list); | ||
1423 | }, 1); | ||
1424 | }; | ||
1425 | |||
1426 | api.preview = function() { | ||
1427 | designer = false; | ||
1428 | setTimeout(function() { | ||
1429 | init(window.__wf_ix); | ||
1430 | }, 1); | ||
1431 | }; | ||
1432 | |||
1433 | api.design = function() { | ||
1434 | designer = true; | ||
1435 | $subs.each(teardown); | ||
1436 | Webflow.scroll.off(scroll); | ||
1437 | asyncEvents(); | ||
1438 | anchors = []; | ||
1439 | loads = []; | ||
1440 | readys = []; | ||
1441 | }; | ||
1442 | |||
1443 | api.run = run; | ||
1444 | api.events = {}; | ||
1445 | api.style = inApp ? styleApp : stylePub; | ||
1446 | |||
1447 | // ----------------------------------- | ||
1448 | // Private methods | ||
1449 | |||
1450 | function init(list) { | ||
1451 | if (!list) return; | ||
1452 | store = {}; | ||
1453 | |||
1454 | // Map all interactions to a hash using slug as key. | ||
1455 | config = {}; | ||
1456 | _.each(list, function(item) { | ||
1457 | config[item.slug] = item.value; | ||
1458 | }); | ||
1459 | |||
1460 | // Build each element's interaction keying from data attribute | ||
1461 | var els = $('[data-ix]'); | ||
1462 | if (!els.length) return; | ||
1463 | els.each(teardown); | ||
1464 | els.each(build); | ||
1465 | |||
1466 | // Listen for scroll events if any anchors exist | ||
1467 | if (anchors.length) { | ||
1468 | Webflow.scroll.on(scroll); | ||
1469 | setTimeout(scroll, 1); | ||
1470 | } | ||
1471 | |||
1472 | // Handle loads or readys if they exist | ||
1473 | if (loads.length) $win.on('load', runLoads); | ||
1474 | if (readys.length) setTimeout(runReadys, 1); | ||
1475 | |||
1476 | // Init module events | ||
1477 | initEvents(); | ||
1478 | } | ||
1479 | |||
1480 | function build(i, el) { | ||
1481 | var $el = $(el); | ||
1482 | var id = $el.attr('data-ix'); | ||
1483 | var ix = config[id]; | ||
1484 | if (!ix) return; | ||
1485 | var triggers = ix.triggers; | ||
1486 | if (!triggers) return; | ||
1487 | var state = store[id] || (store[id] = {}); | ||
1488 | |||
1489 | // Set initial styles, unless we detect an iOS device + any non-iOS triggers | ||
1490 | var setStyles = !(ios && _.any(triggers, isNonIOS)); | ||
1491 | if (setStyles) api.style($el, ix.style); | ||
1492 | |||
1493 | _.each(triggers, function(trigger) { | ||
1494 | var type = trigger.type; | ||
1495 | var stepsB = trigger.stepsB && trigger.stepsB.length; | ||
1496 | |||
1497 | function runA() { | ||
1498 | run(trigger, $el, { | ||
1499 | group: 'A' | ||
1500 | }); | ||
1501 | } | ||
1502 | |||
1503 | function runB() { | ||
1504 | run(trigger, $el, { | ||
1505 | group: 'B' | ||
1506 | }); | ||
1507 | } | ||
1508 | |||
1509 | if (type == 'load') { | ||
1510 | (trigger.preload && !inApp) ? loads.push(runA) : readys.push(runA); | ||
1511 | return; | ||
1512 | } | ||
1513 | |||
1514 | if (type == 'click') { | ||
1515 | var stateKey = 'click:' + unique++; | ||
1516 | if (trigger.descend) stateKey += ':descend'; | ||
1517 | if (trigger.siblings) stateKey += ':siblings'; | ||
1518 | if (trigger.selector) stateKey += ':' + trigger.selector; | ||
1519 | |||
1520 | $el.on('click' + namespace, function(evt) { | ||
1521 | if ($el.attr('href') === '#') evt.preventDefault(); | ||
1522 | |||
1523 | run(trigger, $el, { | ||
1524 | group: state[stateKey] ? 'B' : 'A' | ||
1525 | }); | ||
1526 | if (stepsB) state[stateKey] = !state[stateKey]; | ||
1527 | }); | ||
1528 | $subs = $subs.add($el); | ||
1529 | return; | ||
1530 | } | ||
1531 | |||
1532 | if (type == 'hover') { | ||
1533 | $el.on('mouseenter' + namespace, runA); | ||
1534 | $el.on('mouseleave' + namespace, runB); | ||
1535 | $subs = $subs.add($el); | ||
1536 | return; | ||
1537 | } | ||
1538 | |||
1539 | // Check for a component proxy selector | ||
1540 | var proxy = components[type]; | ||
1541 | if (proxy) { | ||
1542 | var $proxy = $el.closest(proxy); | ||
1543 | $proxy.on(introEvent, runA).on(outroEvent, runB); | ||
1544 | $subs = $subs.add($proxy); | ||
1545 | return; | ||
1546 | } | ||
1547 | |||
1548 | // Ignore the following triggers on iOS devices | ||
1549 | if (ios) return; | ||
1550 | |||
1551 | if (type == 'scroll') { | ||
1552 | anchors.push({ | ||
1553 | el: $el, | ||
1554 | trigger: trigger, | ||
1555 | state: { | ||
1556 | active: false | ||
1557 | }, | ||
1558 | offsetTop: convert(trigger.offsetTop), | ||
1559 | offsetBot: convert(trigger.offsetBot) | ||
1560 | }); | ||
1561 | return; | ||
1562 | } | ||
1563 | }); | ||
1564 | } | ||
1565 | |||
1566 | function isNonIOS(trigger) { | ||
1567 | return trigger.type == 'scroll'; | ||
1568 | } | ||
1569 | |||
1570 | function convert(offset) { | ||
1571 | if (!offset) return 0; | ||
1572 | offset = offset + ''; | ||
1573 | var result = parseInt(offset, 10); | ||
1574 | if (result !== result) return 0; | ||
1575 | if (offset.indexOf('%') > 0) { | ||
1576 | result = result / 100; | ||
1577 | if (result >= 1) result = 0.999; | ||
1578 | } | ||
1579 | return result; | ||
1580 | } | ||
1581 | |||
1582 | function teardown(i, el) { | ||
1583 | $(el).off(namespace); | ||
1584 | } | ||
1585 | |||
1586 | function scroll() { | ||
1587 | var viewTop = $win.scrollTop(); | ||
1588 | var viewHeight = $win.height(); | ||
1589 | |||
1590 | // Check each anchor for a valid scroll trigger | ||
1591 | var count = anchors.length; | ||
1592 | for (var i = 0; i < count; i++) { | ||
1593 | var anchor = anchors[i]; | ||
1594 | var $el = anchor.el; | ||
1595 | var trigger = anchor.trigger; | ||
1596 | var stepsB = trigger.stepsB && trigger.stepsB.length; | ||
1597 | var state = anchor.state; | ||
1598 | var top = $el.offset().top; | ||
1599 | var height = $el.outerHeight(); | ||
1600 | var offsetTop = anchor.offsetTop; | ||
1601 | var offsetBot = anchor.offsetBot; | ||
1602 | if (offsetTop < 1 && offsetTop > 0) offsetTop *= viewHeight; | ||
1603 | if (offsetBot < 1 && offsetBot > 0) offsetBot *= viewHeight; | ||
1604 | var active = (top + height - offsetTop >= viewTop && top + offsetBot <= viewTop + viewHeight); | ||
1605 | if (active === state.active) continue; | ||
1606 | if (active === false && !stepsB) continue; | ||
1607 | state.active = active; | ||
1608 | run(trigger, $el, { | ||
1609 | group: active ? 'A' : 'B' | ||
1610 | }); | ||
1611 | } | ||
1612 | } | ||
1613 | |||
1614 | function runLoads() { | ||
1615 | var count = loads.length; | ||
1616 | for (var i = 0; i < count; i++) { | ||
1617 | loads[i](); | ||
1618 | } | ||
1619 | } | ||
1620 | |||
1621 | function runReadys() { | ||
1622 | var count = readys.length; | ||
1623 | for (var i = 0; i < count; i++) { | ||
1624 | readys[i](); | ||
1625 | } | ||
1626 | } | ||
1627 | |||
1628 | function run(trigger, $el, opts, replay) { | ||
1629 | opts = opts || {}; | ||
1630 | var done = opts.done; | ||
1631 | |||
1632 | // Do not run in designer unless forced | ||
1633 | if (designer && !opts.force) return; | ||
1634 | |||
1635 | // Operate on a set of grouped steps | ||
1636 | var group = opts.group || 'A'; | ||
1637 | var loop = trigger['loop' + group]; | ||
1638 | var steps = trigger['steps' + group]; | ||
1639 | if (!steps || !steps.length) return; | ||
1640 | if (steps.length < 2) loop = false; | ||
1641 | |||
1642 | // One-time init before any loops | ||
1643 | if (!replay) { | ||
1644 | |||
1645 | // Find selector within element descendants, siblings, or query whole document | ||
1646 | var selector = trigger.selector; | ||
1647 | if (selector) { | ||
1648 | $el = ( | ||
1649 | trigger.descend ? $el.find(selector) : | ||
1650 | trigger.siblings ? $el.siblings(selector) : | ||
1651 | $(selector) | ||
1652 | ); | ||
1653 | if (inApp) $el.attr('data-ix-affect', 1); | ||
1654 | } | ||
1655 | |||
1656 | // Apply empty fix for certain Chrome versions | ||
1657 | if (emptyFix) $el.addClass('w-ix-emptyfix'); | ||
1658 | } | ||
1659 | |||
1660 | var _tram = tram($el); | ||
1661 | |||
1662 | // Add steps | ||
1663 | var meta = {}; | ||
1664 | for (var i = 0; i < steps.length; i++) { | ||
1665 | addStep(_tram, steps[i], meta); | ||
1666 | } | ||
1667 | |||
1668 | function fin() { | ||
1669 | // Run trigger again if looped | ||
1670 | if (loop) return run(trigger, $el, opts, true); | ||
1671 | |||
1672 | // Reset any 'auto' values | ||
1673 | if (meta.width == 'auto') _tram.set({ | ||
1674 | width: 'auto' | ||
1675 | }); | ||
1676 | if (meta.height == 'auto') _tram.set({ | ||
1677 | height: 'auto' | ||
1678 | }); | ||
1679 | |||
1680 | // Run callback | ||
1681 | done && done(); | ||
1682 | } | ||
1683 | |||
1684 | // Add final step to queue if tram has started | ||
1685 | meta.start ? _tram.then(fin) : fin(); | ||
1686 | } | ||
1687 | |||
1688 | function addStep(_tram, step, meta) { | ||
1689 | var addMethod = 'add'; | ||
1690 | var startMethod = 'start'; | ||
1691 | |||
1692 | // Once the transition has started, we will always use then() to add to the queue. | ||
1693 | if (meta.start) addMethod = startMethod = 'then'; | ||
1694 | |||
1695 | // Parse transitions string on the current step | ||
1696 | var transitions = step.transition; | ||
1697 | if (transitions) { | ||
1698 | transitions = transitions.split(','); | ||
1699 | for (var i = 0; i < transitions.length; i++) { | ||
1700 | var transition = transitions[i]; | ||
1701 | var options = fallbackProps.test(transition) ? { | ||
1702 | fallback: true | ||
1703 | } : null; | ||
1704 | _tram[addMethod](transition, options); | ||
1705 | } | ||
1706 | } | ||
1707 | |||
1708 | // Build a clean object to pass to the tram method | ||
1709 | var clean = tramify(step) || {}; | ||
1710 | |||
1711 | // Store last width and height values | ||
1712 | if (clean.width != null) meta.width = clean.width; | ||
1713 | if (clean.height != null) meta.height = clean.height; | ||
1714 | |||
1715 | // When transitions are not present, set values immediately and continue queue. | ||
1716 | if (transitions == null) { | ||
1717 | |||
1718 | // If we have started, wrap set() in then() and reset queue | ||
1719 | if (meta.start) { | ||
1720 | _tram.then(function() { | ||
1721 | var queue = this.queue; | ||
1722 | this.set(clean); | ||
1723 | if (clean.display) { | ||
1724 | _tram.redraw(); | ||
1725 | Webflow.redraw.up(); | ||
1726 | } | ||
1727 | this.queue = queue; | ||
1728 | this.next(); | ||
1729 | }); | ||
1730 | } else { | ||
1731 | _tram.set(clean); | ||
1732 | |||
1733 | // Always redraw after setting display | ||
1734 | if (clean.display) { | ||
1735 | _tram.redraw(); | ||
1736 | Webflow.redraw.up(); | ||
1737 | } | ||
1738 | } | ||
1739 | |||
1740 | // Use the wait() method to kick off queue in absence of transitions. | ||
1741 | var wait = clean.wait; | ||
1742 | if (wait != null) { | ||
1743 | _tram.wait(wait); | ||
1744 | meta.start = true; | ||
1745 | } | ||
1746 | |||
1747 | // Otherwise, when transitions are present | ||
1748 | } else { | ||
1749 | |||
1750 | // If display is present, handle it separately | ||
1751 | if (clean.display) { | ||
1752 | var display = clean.display; | ||
1753 | delete clean.display; | ||
1754 | |||
1755 | // If we've already started, we need to wrap it in a then() | ||
1756 | if (meta.start) { | ||
1757 | _tram.then(function() { | ||
1758 | var queue = this.queue; | ||
1759 | this.set({ | ||
1760 | display: display | ||
1761 | }).redraw(); | ||
1762 | Webflow.redraw.up(); | ||
1763 | this.queue = queue; | ||
1764 | this.next(); | ||
1765 | }); | ||
1766 | } else { | ||
1767 | _tram.set({ | ||
1768 | display: display | ||
1769 | }).redraw(); | ||
1770 | Webflow.redraw.up(); | ||
1771 | } | ||
1772 | } | ||
1773 | |||
1774 | // Otherwise, start a transition using the current start method. | ||
1775 | _tram[startMethod](clean); | ||
1776 | meta.start = true; | ||
1777 | } | ||
1778 | } | ||
1779 | |||
1780 | // (In app) Set styles immediately and manage upstream transition | ||
1781 | function styleApp(el, data) { | ||
1782 | var _tram = tram(el); | ||
1783 | |||
1784 | // Get computed transition value | ||
1785 | el.css('transition', ''); | ||
1786 | var computed = el.css('transition'); | ||
1787 | |||
1788 | // If computed is disabled, clear upstream | ||
1789 | if (computed === transNone) computed = _tram.upstream = null; | ||
1790 | |||
1791 | // Disable upstream temporarily | ||
1792 | _tram.upstream = transNone; | ||
1793 | |||
1794 | // Set values immediately | ||
1795 | _tram.set(tramify(data)); | ||
1796 | |||
1797 | // Only restore upstream in preview mode | ||
1798 | _tram.upstream = computed; | ||
1799 | } | ||
1800 | |||
1801 | // (Published) Set styles immediately on specified jquery element | ||
1802 | function stylePub(el, data) { | ||
1803 | tram(el).set(tramify(data)); | ||
1804 | } | ||
1805 | |||
1806 | // Build a clean object for tram | ||
1807 | function tramify(obj) { | ||
1808 | var result = {}; | ||
1809 | var found = false; | ||
1810 | for (var x in obj) { | ||
1811 | if (x === 'transition') continue; | ||
1812 | result[x] = obj[x]; | ||
1813 | found = true; | ||
1814 | } | ||
1815 | // If empty, return null for tram.set/stop compliance | ||
1816 | return found ? result : null; | ||
1817 | } | ||
1818 | |||
1819 | // Events used by other webflow modules | ||
1820 | var events = { | ||
1821 | reset: function(i, el) { | ||
1822 | el.__wf_intro = null; | ||
1823 | }, | ||
1824 | intro: function(i, el) { | ||
1825 | if (el.__wf_intro) return; | ||
1826 | el.__wf_intro = true; | ||
1827 | $(el).triggerHandler(introEvent); | ||
1828 | }, | ||
1829 | outro: function(i, el) { | ||
1830 | if (!el.__wf_intro) return; | ||
1831 | el.__wf_intro = null; | ||
1832 | $(el).triggerHandler(outroEvent); | ||
1833 | } | ||
1834 | }; | ||
1835 | |||
1836 | // Trigger events in queue + point to sync methods | ||
1837 | function initEvents() { | ||
1838 | var count = eventQueue.length; | ||
1839 | for (var i = 0; i < count; i++) { | ||
1840 | var memo = eventQueue[i]; | ||
1841 | memo[0](0, memo[1]); | ||
1842 | } | ||
1843 | eventQueue = []; | ||
1844 | $.extend(api.events, events); | ||
1845 | } | ||
1846 | |||
1847 | // Replace events with async methods prior to init | ||
1848 | function asyncEvents() { | ||
1849 | _.each(events, function(func, name) { | ||
1850 | api.events[name] = function(i, el) { | ||
1851 | eventQueue.push([func, el]); | ||
1852 | }; | ||
1853 | }); | ||
1854 | } | ||
1855 | |||
1856 | asyncEvents(); | ||
1857 | |||
1858 | // Export module | ||
1859 | return api; | ||
1860 | }); | ||
1861 | /** | ||
1862 | * ---------------------------------------------------------------------- | ||
1863 | * Webflow: Touch events | ||
1864 | */ | ||
1865 | Webflow.define('touch', function($, _) { | ||
1866 | 'use strict'; | ||
1867 | |||
1868 | var api = {}; | ||
1869 | var fallback = !document.addEventListener; | ||
1870 | var getSelection = window.getSelection; | ||
1871 | |||
1872 | // Fallback to click events in old IE | ||
1873 | if (fallback) { | ||
1874 | $.event.special.tap = { | ||
1875 | bindType: 'click', | ||
1876 | delegateType: 'click' | ||
1877 | }; | ||
1878 | } | ||
1879 | |||
1880 | api.init = function(el) { | ||
1881 | if (fallback) return null; | ||
1882 | el = typeof el === 'string' ? $(el).get(0) : el; | ||
1883 | return el ? new Touch(el) : null; | ||
1884 | }; | ||
1885 | |||
1886 | function Touch(el) { | ||
1887 | var active = false; | ||
1888 | var dirty = false; | ||
1889 | var useTouch = false; | ||
1890 | var thresholdX = Math.min(Math.round(window.innerWidth * 0.04), 40); | ||
1891 | var startX, startY, lastX; | ||
1892 | var _move = _.throttle(move); | ||
1893 | |||
1894 | el.addEventListener('touchstart', start, false); | ||
1895 | el.addEventListener('touchmove', _move, false); | ||
1896 | el.addEventListener('touchend', end, false); | ||
1897 | el.addEventListener('touchcancel', cancel, false); | ||
1898 | el.addEventListener('mousedown', start, false); | ||
1899 | el.addEventListener('mousemove', _move, false); | ||
1900 | el.addEventListener('mouseup', end, false); | ||
1901 | el.addEventListener('mouseout', cancel, false); | ||
1902 | |||
1903 | function start(evt) { | ||
1904 | // We don’t handle multi-touch events yet. | ||
1905 | var touches = evt.touches; | ||
1906 | if (touches && touches.length > 1) { | ||
1907 | return; | ||
1908 | } | ||
1909 | |||
1910 | active = true; | ||
1911 | dirty = false; | ||
1912 | |||
1913 | if (touches) { | ||
1914 | useTouch = true; | ||
1915 | startX = touches[0].clientX; | ||
1916 | startY = touches[0].clientY; | ||
1917 | } else { | ||
1918 | startX = evt.clientX; | ||
1919 | startY = evt.clientY; | ||
1920 | } | ||
1921 | |||
1922 | lastX = startX; | ||
1923 | } | ||
1924 | |||
1925 | function move(evt) { | ||
1926 | if (!active) return; | ||
1927 | |||
1928 | if (useTouch && evt.type === 'mousemove') { | ||
1929 | evt.preventDefault(); | ||
1930 | evt.stopPropagation(); | ||
1931 | return; | ||
1932 | } | ||
1933 | |||
1934 | var touches = evt.touches; | ||
1935 | var x = touches ? touches[0].clientX : evt.clientX; | ||
1936 | var y = touches ? touches[0].clientY : evt.clientY; | ||
1937 | |||
1938 | var velocityX = x - lastX; | ||
1939 | lastX = x; | ||
1940 | |||
1941 | // Allow swipes while pointer is down, but prevent them during text selection | ||
1942 | if (Math.abs(velocityX) > thresholdX && getSelection && getSelection() + '' === '') { | ||
1943 | triggerEvent('swipe', evt, { | ||
1944 | direction: velocityX > 0 ? 'right' : 'left' | ||
1945 | }); | ||
1946 | cancel(); | ||
1947 | } | ||
1948 | |||
1949 | // If pointer moves more than 10px flag to cancel tap | ||
1950 | if (Math.abs(x - startX) > 10 || Math.abs(y - startY) > 10) { | ||
1951 | dirty = true; | ||
1952 | } | ||
1953 | } | ||
1954 | |||
1955 | function end(evt) { | ||
1956 | if (!active) return; | ||
1957 | active = false; | ||
1958 | |||
1959 | if (useTouch && evt.type === 'mouseup') { | ||
1960 | evt.preventDefault(); | ||
1961 | evt.stopPropagation(); | ||
1962 | useTouch = false; | ||
1963 | return; | ||
1964 | } | ||
1965 | |||
1966 | if (!dirty) triggerEvent('tap', evt); | ||
1967 | } | ||
1968 | |||
1969 | function cancel(evt) { | ||
1970 | active = false; | ||
1971 | } | ||
1972 | |||
1973 | function destroy() { | ||
1974 | el.removeEventListener('touchstart', start, false); | ||
1975 | el.removeEventListener('touchmove', _move, false); | ||
1976 | el.removeEventListener('touchend', end, false); | ||
1977 | el.removeEventListener('touchcancel', cancel, false); | ||
1978 | el.removeEventListener('mousedown', start, false); | ||
1979 | el.removeEventListener('mousemove', _move, false); | ||
1980 | el.removeEventListener('mouseup', end, false); | ||
1981 | el.removeEventListener('mouseout', cancel, false); | ||
1982 | el = null; | ||
1983 | } | ||
1984 | |||
1985 | // Public instance methods | ||
1986 | this.destroy = destroy; | ||
1987 | } | ||
1988 | |||
1989 | // Wrap native event to supoprt preventdefault + stopPropagation | ||
1990 | function triggerEvent(type, evt, data) { | ||
1991 | var newEvent = $.Event(type, { | ||
1992 | originalEvent: evt | ||
1993 | }); | ||
1994 | $(evt.target).trigger(newEvent, data); | ||
1995 | } | ||
1996 | |||
1997 | // Listen for touch events on all nodes by default. | ||
1998 | api.instance = api.init(document); | ||
1999 | |||
2000 | // Export module | ||
2001 | return api; | ||
2002 | }); | ||
2003 | /** | ||
2004 | * ---------------------------------------------------------------------- | ||
2005 | * Webflow: Forms | ||
2006 | */ | ||
2007 | Webflow.define('forms', function($, _) { | ||
2008 | 'use strict'; | ||
2009 | |||
2010 | var api = {}; | ||
2011 | var $doc = $(document); | ||
2012 | var $forms; | ||
2013 | var loc = window.location; | ||
2014 | var retro = window.XDomainRequest && !window.atob; | ||
2015 | var namespace = '.w-form'; | ||
2016 | var siteId; | ||
2017 | var emailField = /e(\-)?mail/i; | ||
2018 | var emailValue = /^\S+@\S+$/; | ||
2019 | var alert = window.alert; | ||
2020 | var listening; | ||
2021 | |||
2022 | // MailChimp domains: list-manage.com + mirrors | ||
2023 | var chimpRegex = /list-manage[1-9]?.com/i; | ||
2024 | |||
2025 | api.ready = function() { | ||
2026 | // Init forms | ||
2027 | init(); | ||
2028 | |||
2029 | // Wire document events once | ||
2030 | if (!listening) addListeners(); | ||
2031 | }; | ||
2032 | |||
2033 | api.preview = api.design = function() { | ||
2034 | init(); | ||
2035 | }; | ||
2036 | |||
2037 | function init() { | ||
2038 | siteId = $('html').attr('data-wf-site'); | ||
2039 | |||
2040 | $forms = $(namespace + ' form'); | ||
2041 | if (!$forms.length) return; | ||
2042 | $forms.each(build); | ||
2043 | } | ||
2044 | |||
2045 | function build(i, el) { | ||
2046 | // Store form state using namespace | ||
2047 | var $el = $(el); | ||
2048 | var data = $.data(el, namespace); | ||
2049 | if (!data) data = $.data(el, namespace, { | ||
2050 | form: $el | ||
2051 | }); // data.form | ||
2052 | |||
2053 | reset(data); | ||
2054 | var wrap = $el.closest('div.w-form'); | ||
2055 | data.done = wrap.find('> .w-form-done'); | ||
2056 | data.fail = wrap.find('> .w-form-fail'); | ||
2057 | |||
2058 | var action = data.action = $el.attr('action'); | ||
2059 | data.handler = null; | ||
2060 | data.redirect = $el.attr('data-redirect'); | ||
2061 | |||
2062 | // MailChimp form | ||
2063 | if (chimpRegex.test(action)) { | ||
2064 | data.handler = submitMailChimp; | ||
2065 | return; | ||
2066 | } | ||
2067 | |||
2068 | // Custom form action | ||
2069 | if (action) return; | ||
2070 | |||
2071 | // Webflow form | ||
2072 | if (siteId) { | ||
2073 | data.handler = submitWebflow; | ||
2074 | return; | ||
2075 | } | ||
2076 | |||
2077 | // Alert for disconnected Webflow forms | ||
2078 | disconnected(); | ||
2079 | } | ||
2080 | |||
2081 | function addListeners() { | ||
2082 | listening = true; | ||
2083 | |||
2084 | // Handle form submission for Webflow forms | ||
2085 | $doc.on('submit', namespace + ' form', function(evt) { | ||
2086 | var data = $.data(this, namespace); | ||
2087 | if (data.handler) { | ||
2088 | data.evt = evt; | ||
2089 | data.handler(data); | ||
2090 | } | ||
2091 | }); | ||
2092 | } | ||
2093 | |||
2094 | // Reset data common to all submit handlers | ||
2095 | function reset(data) { | ||
2096 | var btn = data.btn = data.form.find(':input[type="submit"]'); | ||
2097 | data.wait = data.btn.attr('data-wait') || null; | ||
2098 | data.success = false; | ||
2099 | btn.prop('disabled', false); | ||
2100 | data.label && btn.val(data.label); | ||
2101 | } | ||
2102 | |||
2103 | // Disable submit button | ||
2104 | function disableBtn(data) { | ||
2105 | var btn = data.btn; | ||
2106 | var wait = data.wait; | ||
2107 | btn.prop('disabled', true); | ||
2108 | // Show wait text and store previous label | ||
2109 | if (wait) { | ||
2110 | data.label = btn.val(); | ||
2111 | btn.val(wait); | ||
2112 | } | ||
2113 | } | ||
2114 | |||
2115 | // Find form fields, validate, and set value pairs | ||
2116 | function findFields(form, result) { | ||
2117 | var status = null; | ||
2118 | result = result || {}; | ||
2119 | |||
2120 | // The ":input" selector is a jQuery shortcut to select all inputs, selects, textareas | ||
2121 | form.find(':input:not([type="submit"])').each(function(i, el) { | ||
2122 | var field = $(el); | ||
2123 | var type = field.attr('type'); | ||
2124 | var name = field.attr('data-name') || field.attr('name') || ('Field ' + (i + 1)); | ||
2125 | var value = field.val(); | ||
2126 | |||
2127 | if (type == 'checkbox') { | ||
2128 | value = field.is(':checked'); | ||
2129 | } | ||
2130 | if (type == 'radio') { | ||
2131 | // Radio group value already processed | ||
2132 | if (result[name] === null || typeof result[name] == 'string') { | ||
2133 | return; | ||
2134 | } | ||
2135 | |||
2136 | value = form.find('input[name="' + field.attr('name') + '"]:checked').val() || null; | ||
2137 | } | ||
2138 | |||
2139 | if (typeof value == 'string') value = $.trim(value); | ||
2140 | result[name] = value; | ||
2141 | status = status || getStatus(field, name, value); | ||
2142 | }); | ||
2143 | |||
2144 | return status; | ||
2145 | } | ||
2146 | |||
2147 | function getStatus(field, name, value) { | ||
2148 | var status = null; | ||
2149 | if (!field.attr('required')) return null; | ||
2150 | if (!value) status = 'Please fill out the required field: ' + name; | ||
2151 | else if (emailField.test(name) || emailField.test(field.attr('type'))) { | ||
2152 | if (!emailValue.test(value)) status = 'Please enter a valid email address for: ' + name; | ||
2153 | } | ||
2154 | return status; | ||
2155 | } | ||
2156 | |||
2157 | // Submit form to Webflow | ||
2158 | function submitWebflow(data) { | ||
2159 | reset(data); | ||
2160 | |||
2161 | var form = data.form; | ||
2162 | var payload = { | ||
2163 | name: form.attr('data-name') || form.attr('name') || 'Untitled Form', | ||
2164 | source: loc.href, | ||
2165 | test: Webflow.env(), | ||
2166 | fields: {} | ||
2167 | }; | ||
2168 | |||
2169 | preventDefault(data); | ||
2170 | |||
2171 | // Find & populate all fields | ||
2172 | var status = findFields(form, payload.fields); | ||
2173 | if (status) return alert(status); | ||
2174 | |||
2175 | // Disable submit button | ||
2176 | disableBtn(data); | ||
2177 | |||
2178 | // Read site ID | ||
2179 | // NOTE: If this site is exported, the HTML tag must retain the data-wf-site attribute for forms to work | ||
2180 | if (!siteId) { | ||
2181 | afterSubmit(data); | ||
2182 | return; | ||
2183 | } | ||
2184 | var url = 'https://webflow.com/api/v1/form/' + siteId; | ||
2185 | |||
2186 | // Work around same-protocol IE XDR limitation | ||
2187 | if (retro && url.indexOf('https://webflow.com') >= 0) { | ||
2188 | url = url.replace('https://webflow.com/', 'http://data.webflow.com/'); | ||
2189 | } | ||
2190 | |||
2191 | $.ajax({ | ||
2192 | url: url, | ||
2193 | type: 'POST', | ||
2194 | data: payload, | ||
2195 | dataType: 'json', | ||
2196 | crossDomain: true | ||
2197 | }).done(function() { | ||
2198 | data.success = true; | ||
2199 | afterSubmit(data); | ||
2200 | }).fail(function() { | ||
2201 | afterSubmit(data); | ||
2202 | }); | ||
2203 | } | ||
2204 | |||
2205 | // Submit form to MailChimp | ||
2206 | function submitMailChimp(data) { | ||
2207 | reset(data); | ||
2208 | |||
2209 | var form = data.form; | ||
2210 | var payload = {}; | ||
2211 | |||
2212 | // Skip Ajax submission if http/s mismatch, fallback to POST instead | ||
2213 | if (/^https/.test(loc.href) && !/^https/.test(data.action)) { | ||
2214 | form.attr('method', 'post'); | ||
2215 | return; | ||
2216 | } | ||
2217 | |||
2218 | preventDefault(data); | ||
2219 | |||
2220 | // Find & populate all fields | ||
2221 | var status = findFields(form, payload); | ||
2222 | if (status) return alert(status); | ||
2223 | |||
2224 | // Disable submit button | ||
2225 | disableBtn(data); | ||
2226 | |||
2227 | // Use special format for MailChimp params | ||
2228 | var fullName; | ||
2229 | _.each(payload, function(value, key) { | ||
2230 | if (emailField.test(key)) payload.EMAIL = value; | ||
2231 | if (/^((full[ _-]?)?name)$/i.test(key)) fullName = value; | ||
2232 | if (/^(first[ _-]?name)$/i.test(key)) payload.FNAME = value; | ||
2233 | if (/^(last[ _-]?name)$/i.test(key)) payload.LNAME = value; | ||
2234 | }); | ||
2235 | |||
2236 | if (fullName && !payload.FNAME) { | ||
2237 | fullName = fullName.split(' '); | ||
2238 | payload.FNAME = fullName[0]; | ||
2239 | payload.LNAME = payload.LNAME || fullName[1]; | ||
2240 | } | ||
2241 | |||
2242 | // Use the (undocumented) MailChimp jsonp api | ||
2243 | var url = data.action.replace('/post?', '/post-json?') + '&c=?'; | ||
2244 | // Add special param to prevent bot signups | ||
2245 | var userId = url.indexOf('u=') + 2; | ||
2246 | userId = url.substring(userId, url.indexOf('&', userId)); | ||
2247 | var listId = url.indexOf('id=') + 3; | ||
2248 | listId = url.substring(listId, url.indexOf('&', listId)); | ||
2249 | payload['b_' + userId + '_' + listId] = ''; | ||
2250 | |||
2251 | $.ajax({ | ||
2252 | url: url, | ||
2253 | data: payload, | ||
2254 | dataType: 'jsonp' | ||
2255 | }).done(function(resp) { | ||
2256 | data.success = (resp.result == 'success' || /already/.test(resp.msg)); | ||
2257 | if (!data.success) console.info('MailChimp error: ' + resp.msg); | ||
2258 | afterSubmit(data); | ||
2259 | }).fail(function() { | ||
2260 | afterSubmit(data); | ||
2261 | }); | ||
2262 | } | ||
2263 | |||
2264 | // Common callback which runs after all Ajax submissions | ||
2265 | function afterSubmit(data) { | ||
2266 | var form = data.form; | ||
2267 | var wrap = form.closest('div.w-form'); | ||
2268 | var redirect = data.redirect; | ||
2269 | var success = data.success; | ||
2270 | |||
2271 | // Redirect to a success url if defined | ||
2272 | if (success && redirect) { | ||
2273 | Webflow.location(redirect); | ||
2274 | return; | ||
2275 | } | ||
2276 | |||
2277 | // Show or hide status divs | ||
2278 | data.done.toggle(success); | ||
2279 | data.fail.toggle(!success); | ||
2280 | |||
2281 | // Hide form on success | ||
2282 | form.toggle(!success); | ||
2283 | |||
2284 | // Reset data and enable submit button | ||
2285 | reset(data); | ||
2286 | } | ||
2287 | |||
2288 | function preventDefault(data) { | ||
2289 | data.evt && data.evt.preventDefault(); | ||
2290 | data.evt = null; | ||
2291 | } | ||
2292 | |||
2293 | var disconnected = _.debounce(function() { | ||
2294 | alert('Oops! This page has a form that is powered by Webflow, but important code was removed that is required to make the form work. Please contact [email protected] to fix this issue.'); | ||
2295 | }, 100); | ||
2296 | |||
2297 | // Export module | ||
2298 | return api; | ||
2299 | }); | ||
2300 | /** | ||
2301 | * ---------------------------------------------------------------------- | ||
2302 | * Webflow: Smooth scroll | ||
2303 | */ | ||
2304 | Webflow.define('scroll', function($) { | ||
2305 | 'use strict'; | ||
2306 | |||
2307 | var $doc = $(document); | ||
2308 | var win = window; | ||
2309 | var loc = win.location; | ||
2310 | var history = win.history; | ||
2311 | var validHash = /^[a-zA-Z][\w:.-]*$/; | ||
2312 | |||
2313 | function ready() { | ||
2314 | // If hash is already present on page load, scroll to it right away | ||
2315 | if (loc.hash) { | ||
2316 | findEl(loc.hash.substring(1)); | ||
2317 | } | ||
2318 | |||
2319 | // When clicking on a link, check if it links to another part of the page | ||
2320 | $doc.on('click', 'a', function(e) { | ||
2321 | if (Webflow.env('design')) { | ||
2322 | return; | ||
2323 | } | ||
2324 | |||
2325 | // Ignore links being used by jQuery mobile | ||
2326 | if (window.$.mobile && $(e.currentTarget).hasClass('ui-link')) return; | ||
2327 | |||
2328 | var hash = this.hash ? this.hash.substring(1) : null; | ||
2329 | if (hash) { | ||
2330 | findEl(hash, e); | ||
2331 | } | ||
2332 | }); | ||
2333 | } | ||
2334 | |||
2335 | function findEl(hash, e) { | ||
2336 | if (!validHash.test(hash)) return; | ||
2337 | |||
2338 | var el = $('#' + hash); | ||
2339 | if (!el.length) { | ||
2340 | return; | ||
2341 | } | ||
2342 | |||
2343 | if (e) { | ||
2344 | e.preventDefault(); | ||
2345 | e.stopPropagation(); | ||
2346 | } | ||
2347 | |||
2348 | // Push new history state | ||
2349 | if (loc.hash !== hash && history && history.pushState) { | ||
2350 | var oldHash = history.state && history.state.hash; | ||
2351 | if (oldHash !== hash) { | ||
2352 | history.pushState({ | ||
2353 | hash: hash | ||
2354 | }, '', '#' + hash); | ||
2355 | } | ||
2356 | } | ||
2357 | |||
2358 | // If a fixed header exists, offset for the height | ||
2359 | var header = $('header, body > .header, body > .w-nav'); | ||
2360 | var offset = header.css('position') === 'fixed' ? header.outerHeight() : 0; | ||
2361 | |||
2362 | win.setTimeout(function() { | ||
2363 | scroll(el, offset); | ||
2364 | }, e ? 0 : 300); | ||
2365 | } | ||
2366 | |||
2367 | function scroll(el, offset) { | ||
2368 | var start = $(win).scrollTop(); | ||
2369 | var end = el.offset().top - offset; | ||
2370 | |||
2371 | // If specified, scroll so that the element ends up in the middle of the viewport | ||
2372 | if (el.data('scroll') == 'mid') { | ||
2373 | var available = $(win).height() - offset; | ||
2374 | var elHeight = el.outerHeight(); | ||
2375 | if (elHeight < available) { | ||
2376 | end -= Math.round((available - elHeight) / 2); | ||
2377 | } | ||
2378 | } | ||
2379 | |||
2380 | var mult = 1; | ||
2381 | |||
2382 | // Check for custom time multiplier on the body and the element | ||
2383 | $('body').add(el).each(function(i) { | ||
2384 | var time = parseFloat($(this).attr('data-scroll-time'), 10); | ||
2385 | if (!isNaN(time) && (time === 0 || time > 0)) { | ||
2386 | mult = time; | ||
2387 | } | ||
2388 | }); | ||
2389 | |||
2390 | // Shim for IE8 and below | ||
2391 | if (!Date.now) { | ||
2392 | Date.now = function() { | ||
2393 | return new Date().getTime(); | ||
2394 | }; | ||
2395 | } | ||
2396 | |||
2397 | var clock = Date.now(); | ||
2398 | var animate = win.requestAnimationFrame || win.mozRequestAnimationFrame || win.webkitRequestAnimationFrame || function(fn) { | ||
2399 | win.setTimeout(fn, 15); | ||
2400 | }; | ||
2401 | var duration = (472.143 * Math.log(Math.abs(start - end) + 125) - 2000) * mult; | ||
2402 | |||
2403 | var step = function() { | ||
2404 | var elapsed = Date.now() - clock; | ||
2405 | win.scroll(0, getY(start, end, elapsed, duration)); | ||
2406 | |||
2407 | if (elapsed <= duration) { | ||
2408 | animate(step); | ||
2409 | } | ||
2410 | }; | ||
2411 | |||
2412 | step(); | ||
2413 | } | ||
2414 | |||
2415 | function getY(start, end, elapsed, duration) { | ||
2416 | if (elapsed > duration) { | ||
2417 | return end; | ||
2418 | } | ||
2419 | |||
2420 | return start + (end - start) * ease(elapsed / duration); | ||
2421 | } | ||
2422 | |||
2423 | function ease(t) { | ||
2424 | return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; | ||
2425 | } | ||
2426 | |||
2427 | // Export module | ||
2428 | return { | ||
2429 | ready: ready | ||
2430 | }; | ||
2431 | }); | ||
2432 | /** | ||
2433 | * ---------------------------------------------------------------------- | ||
2434 | * Webflow: Auto-select links to current page or section | ||
2435 | */ | ||
2436 | Webflow.define('links', function($, _) { | ||
2437 | 'use strict'; | ||
2438 | |||
2439 | var api = {}; | ||
2440 | var $win = $(window); | ||
2441 | var designer; | ||
2442 | var inApp = Webflow.env(); | ||
2443 | var location = window.location; | ||
2444 | var linkCurrent = 'w--current'; | ||
2445 | var validHash = /^#[a-zA-Z][\w:.-]*$/; | ||
2446 | var indexPage = /index\.(html|php)$/; | ||
2447 | var dirList = /\/$/; | ||
2448 | var anchors; | ||
2449 | var slug; | ||
2450 | |||
2451 | // ----------------------------------- | ||
2452 | // Module methods | ||
2453 | |||
2454 | api.ready = api.design = api.preview = init; | ||
2455 | |||
2456 | // ----------------------------------- | ||
2457 | // Private methods | ||
2458 | |||
2459 | function init() { | ||
2460 | designer = inApp && Webflow.env('design'); | ||
2461 | slug = Webflow.env('slug') || location.pathname || ''; | ||
2462 | |||
2463 | // Reset scroll listener, init anchors | ||
2464 | Webflow.scroll.off(scroll); | ||
2465 | anchors = []; | ||
2466 | |||
2467 | // Test all links for a selectable href | ||
2468 | var links = document.links; | ||
2469 | for (var i = 0; i < links.length; ++i) { | ||
2470 | select(links[i]); | ||
2471 | } | ||
2472 | |||
2473 | // Listen for scroll if any anchors exist | ||
2474 | if (anchors.length) { | ||
2475 | Webflow.scroll.on(scroll); | ||
2476 | scroll(); | ||
2477 | } | ||
2478 | } | ||
2479 | |||
2480 | function select(link) { | ||
2481 | var href = link.getAttribute('href'); | ||
2482 | |||
2483 | // Ignore any hrefs with a colon to safely avoid all uri schemes | ||
2484 | if (href.indexOf(':') >= 0) return; | ||
2485 | |||
2486 | var $link = $(link); | ||
2487 | |||
2488 | // Check for valid hash links w/ sections and use scroll anchor | ||
2489 | if (href.indexOf('#') === 0 && validHash.test(href)) { | ||
2490 | // Ignore #edit anchors | ||
2491 | if (href === '#edit') return; | ||
2492 | var $section = $(href); | ||
2493 | $section.length && anchors.push({ | ||
2494 | link: $link, | ||
2495 | sec: $section, | ||
2496 | active: false | ||
2497 | }); | ||
2498 | return; | ||
2499 | } | ||
2500 | |||
2501 | // Determine whether the link should be selected | ||
2502 | var match = (link.href === location.href) || (href === slug) || (indexPage.test(href) && dirList.test(slug)); | ||
2503 | setClass($link, linkCurrent, match); | ||
2504 | } | ||
2505 | |||
2506 | function scroll() { | ||
2507 | var viewTop = $win.scrollTop(); | ||
2508 | var viewHeight = $win.height(); | ||
2509 | |||
2510 | // Check each anchor for a section in view | ||
2511 | _.each(anchors, function(anchor) { | ||
2512 | var $link = anchor.link; | ||
2513 | var $section = anchor.sec; | ||
2514 | var top = $section.offset().top; | ||
2515 | var height = $section.outerHeight(); | ||
2516 | var offset = viewHeight * 0.5; | ||
2517 | var active = ($section.is(':visible') && | ||
2518 | top + height - offset >= viewTop && | ||
2519 | top + offset <= viewTop + viewHeight); | ||
2520 | if (anchor.active === active) return; | ||
2521 | anchor.active = active; | ||
2522 | setClass($link, linkCurrent, active); | ||
2523 | if (designer) $link[0].__wf_current = active; | ||
2524 | }); | ||
2525 | } | ||
2526 | |||
2527 | function setClass($elem, className, add) { | ||
2528 | var exists = $elem.hasClass(className); | ||
2529 | if (add && exists) return; | ||
2530 | if (!add && !exists) return; | ||
2531 | add ? $elem.addClass(className) : $elem.removeClass(className); | ||
2532 | } | ||
2533 | |||
2534 | // Export module | ||
2535 | return api; | ||
2536 | }); | ||
2537 | /** | ||
2538 | * ---------------------------------------------------------------------- | ||
2539 | * Webflow: Slider component | ||
2540 | */ | ||
2541 | Webflow.define('slider', function($, _) { | ||
2542 | 'use strict'; | ||
2543 | |||
2544 | var api = {}; | ||
2545 | var tram = window.tram; | ||
2546 | var $doc = $(document); | ||
2547 | var $sliders; | ||
2548 | var designer; | ||
2549 | var inApp = Webflow.env(); | ||
2550 | var namespace = '.w-slider'; | ||
2551 | var dot = '<div class="w-slider-dot" data-wf-ignore />'; | ||
2552 | var ix = Webflow.ixEvents(); | ||
2553 | var fallback; | ||
2554 | var redraw; | ||
2555 | |||
2556 | // ----------------------------------- | ||
2557 | // Module methods | ||
2558 | |||
2559 | api.ready = function() { | ||
2560 | init(); | ||
2561 | }; | ||
2562 | |||
2563 | api.design = function() { | ||
2564 | designer = true; | ||
2565 | init(); | ||
2566 | }; | ||
2567 | |||
2568 | api.preview = function() { | ||
2569 | designer = false; | ||
2570 | init(); | ||
2571 | }; | ||
2572 | |||
2573 | api.redraw = function() { | ||
2574 | redraw = true; | ||
2575 | init(); | ||
2576 | }; | ||
2577 | |||
2578 | api.destroy = removeListeners; | ||
2579 | |||
2580 | // ----------------------------------- | ||
2581 | // Private methods | ||
2582 | |||
2583 | function init() { | ||
2584 | // Find all sliders on the page | ||
2585 | $sliders = $doc.find(namespace); | ||
2586 | if (!$sliders.length) return; | ||
2587 | $sliders.filter(':visible').each(build); | ||
2588 | redraw = null; | ||
2589 | if (fallback) return; | ||
2590 | |||
2591 | // Wire events | ||
2592 | removeListeners(); | ||
2593 | addListeners(); | ||
2594 | } | ||
2595 | |||
2596 | function removeListeners() { | ||
2597 | Webflow.resize.off(renderAll); | ||
2598 | Webflow.redraw.off(api.redraw); | ||
2599 | } | ||
2600 | |||
2601 | function addListeners() { | ||
2602 | Webflow.resize.on(renderAll); | ||
2603 | Webflow.redraw.on(api.redraw); | ||
2604 | } | ||
2605 | |||
2606 | function renderAll() { | ||
2607 | $sliders.filter(':visible').each(render); | ||
2608 | } | ||
2609 | |||
2610 | function build(i, el) { | ||
2611 | var $el = $(el); | ||
2612 | |||
2613 | // Store slider state in data | ||
2614 | var data = $.data(el, namespace); | ||
2615 | if (!data) data = $.data(el, namespace, { | ||
2616 | index: 0, | ||
2617 | depth: 1, | ||
2618 | el: $el, | ||
2619 | config: {} | ||
2620 | }); | ||
2621 | data.mask = $el.children('.w-slider-mask'); | ||
2622 | data.left = $el.children('.w-slider-arrow-left'); | ||
2623 | data.right = $el.children('.w-slider-arrow-right'); | ||
2624 | data.nav = $el.children('.w-slider-nav'); | ||
2625 | data.slides = data.mask.children('.w-slide'); | ||
2626 | data.slides.each(ix.reset); | ||
2627 | if (redraw) data.maskWidth = 0; | ||
2628 | |||
2629 | // Disable in old browsers | ||
2630 | if (!tram.support.transform) { | ||
2631 | data.left.hide(); | ||
2632 | data.right.hide(); | ||
2633 | data.nav.hide(); | ||
2634 | fallback = true; | ||
2635 | return; | ||
2636 | } | ||
2637 | |||
2638 | // Remove old events | ||
2639 | data.el.off(namespace); | ||
2640 | data.left.off(namespace); | ||
2641 | data.right.off(namespace); | ||
2642 | data.nav.off(namespace); | ||
2643 | |||
2644 | // Set config from data attributes | ||
2645 | configure(data); | ||
2646 | |||
2647 | // Add events based on mode | ||
2648 | if (designer) { | ||
2649 | data.el.on('setting' + namespace, handler(data)); | ||
2650 | stopTimer(data); | ||
2651 | data.hasTimer = false; | ||
2652 | } else { | ||
2653 | data.el.on('swipe' + namespace, handler(data)); | ||
2654 | data.left.on('tap' + namespace, previous(data)); | ||
2655 | data.right.on('tap' + namespace, next(data)); | ||
2656 | |||
2657 | // Start timer if autoplay is true, only once | ||
2658 | if (data.config.autoplay && !data.hasTimer) { | ||
2659 | data.hasTimer = true; | ||
2660 | data.timerCount = 1; | ||
2661 | startTimer(data); | ||
2662 | } | ||
2663 | } | ||
2664 | |||
2665 | // Listen to nav events | ||
2666 | data.nav.on('tap' + namespace, '> div', handler(data)); | ||
2667 | |||
2668 | // Remove gaps from formatted html (for inline-blocks) | ||
2669 | if (!inApp) { | ||
2670 | data.mask.contents().filter(function() { | ||
2671 | return this.nodeType === 3; | ||
2672 | }).remove(); | ||
2673 | } | ||
2674 | |||
2675 | // Run first render | ||
2676 | render(i, el); | ||
2677 | } | ||
2678 | |||
2679 | function configure(data) { | ||
2680 | var config = {}; | ||
2681 | |||
2682 | config.crossOver = 0; | ||
2683 | |||
2684 | // Set config options from data attributes | ||
2685 | config.animation = data.el.attr('data-animation') || 'slide'; | ||
2686 | if (config.animation == 'outin') { | ||
2687 | config.animation = 'cross'; | ||
2688 | config.crossOver = 0.5; | ||
2689 | } | ||
2690 | config.easing = data.el.attr('data-easing') || 'ease'; | ||
2691 | |||
2692 | var duration = data.el.attr('data-duration'); | ||
2693 | config.duration = duration != null ? +duration : 500; | ||
2694 | |||
2695 | if (+data.el.attr('data-infinite')) config.infinite = true; | ||
2696 | |||
2697 | if (+data.el.attr('data-hide-arrows')) { | ||
2698 | config.hideArrows = true; | ||
2699 | } else if (data.config.hideArrows) { | ||
2700 | data.left.show(); | ||
2701 | data.right.show(); | ||
2702 | } | ||
2703 | |||
2704 | if (+data.el.attr('data-autoplay')) { | ||
2705 | config.autoplay = true; | ||
2706 | config.delay = +data.el.attr('data-delay') || 2000; | ||
2707 | config.timerMax = +data.el.attr('data-autoplay-limit'); | ||
2708 | // Disable timer on first touch or mouse down | ||
2709 | var touchEvents = 'mousedown' + namespace + ' touchstart' + namespace; | ||
2710 | if (!designer) data.el.off(touchEvents).one(touchEvents, function() { | ||
2711 | stopTimer(data); | ||
2712 | }); | ||
2713 | } | ||
2714 | |||
2715 | // Use edge buffer to help calculate page count | ||
2716 | var arrowWidth = data.right.width(); | ||
2717 | config.edge = arrowWidth ? arrowWidth + 40 : 100; | ||
2718 | |||
2719 | // Store config in data | ||
2720 | data.config = config; | ||
2721 | } | ||
2722 | |||
2723 | function previous(data) { | ||
2724 | return function(evt) { | ||
2725 | change(data, { | ||
2726 | index: data.index - 1, | ||
2727 | vector: -1 | ||
2728 | }); | ||
2729 | }; | ||
2730 | } | ||
2731 | |||
2732 | function next(data) { | ||
2733 | return function(evt) { | ||
2734 | change(data, { | ||
2735 | index: data.index + 1, | ||
2736 | vector: 1 | ||
2737 | }); | ||
2738 | }; | ||
2739 | } | ||
2740 | |||
2741 | function select(data, value) { | ||
2742 | // Select page based on slide element index | ||
2743 | var found = null; | ||
2744 | if (value === data.slides.length) { | ||
2745 | init(); | ||
2746 | layout(data); // Rebuild and find new slides | ||
2747 | } | ||
2748 | _.each(data.anchors, function(anchor, index) { | ||
2749 | $(anchor.els).each(function(i, el) { | ||
2750 | if ($(el).index() === value) found = index; | ||
2751 | }); | ||
2752 | }); | ||
2753 | if (found != null) change(data, { | ||
2754 | index: found, | ||
2755 | immediate: true | ||
2756 | }); | ||
2757 | } | ||
2758 | |||
2759 | function startTimer(data) { | ||
2760 | stopTimer(data); | ||
2761 | var config = data.config; | ||
2762 | var timerMax = config.timerMax; | ||
2763 | if (timerMax && data.timerCount++ > timerMax) return; | ||
2764 | data.timerId = window.setTimeout(function() { | ||
2765 | if (data.timerId == null || designer) return; | ||
2766 | next(data)(); | ||
2767 | startTimer(data); | ||
2768 | }, config.delay); | ||
2769 | } | ||
2770 | |||
2771 | function stopTimer(data) { | ||
2772 | window.clearTimeout(data.timerId); | ||
2773 | data.timerId = null; | ||
2774 | } | ||
2775 | |||
2776 | function handler(data) { | ||
2777 | return function(evt, options) { | ||
2778 | options = options || {}; | ||
2779 | |||
2780 | // Designer settings | ||
2781 | if (designer && evt.type == 'setting') { | ||
2782 | if (options.select == 'prev') return previous(data)(); | ||
2783 | if (options.select == 'next') return next(data)(); | ||
2784 | configure(data); | ||
2785 | layout(data); | ||
2786 | if (options.select == null) return; | ||
2787 | select(data, options.select); | ||
2788 | return; | ||
2789 | } | ||
2790 | |||
2791 | // Swipe event | ||
2792 | if (evt.type == 'swipe') { | ||
2793 | if (options.direction == 'left') return next(data)(); | ||
2794 | if (options.direction == 'right') return previous(data)(); | ||
2795 | return; | ||
2796 | } | ||
2797 | |||
2798 | // Page buttons | ||
2799 | if (data.nav.has(evt.target).length) { | ||
2800 | change(data, { | ||
2801 | index: $(evt.target).index() | ||
2802 | }); | ||
2803 | } | ||
2804 | }; | ||
2805 | } | ||
2806 | |||
2807 | function change(data, options) { | ||
2808 | options = options || {}; | ||
2809 | var config = data.config; | ||
2810 | var anchors = data.anchors; | ||
2811 | |||
2812 | // Set new index | ||
2813 | data.previous = data.index; | ||
2814 | var index = options.index; | ||
2815 | var shift = {}; | ||
2816 | if (index < 0) { | ||
2817 | index = anchors.length - 1; | ||
2818 | if (config.infinite) { | ||
2819 | // Shift first slide to the end | ||
2820 | shift.x = -data.endX; | ||
2821 | shift.from = 0; | ||
2822 | shift.to = anchors[0].width; | ||
2823 | } | ||
2824 | } else if (index >= anchors.length) { | ||
2825 | index = 0; | ||
2826 | if (config.infinite) { | ||
2827 | // Shift last slide to the start | ||
2828 | shift.x = anchors[anchors.length - 1].width; | ||
2829 | shift.from = -anchors[anchors.length - 1].x; | ||
2830 | shift.to = shift.from - shift.x; | ||
2831 | } | ||
2832 | } | ||
2833 | data.index = index; | ||
2834 | |||
2835 | // Select page nav | ||
2836 | var active = data.nav.children().eq(data.index).addClass('w-active'); | ||
2837 | data.nav.children().not(active).removeClass('w-active'); | ||
2838 | |||
2839 | // Hide arrows | ||
2840 | if (config.hideArrows) { | ||
2841 | data.index === anchors.length - 1 ? data.right.hide() : data.right.show(); | ||
2842 | data.index === 0 ? data.left.hide() : data.left.show(); | ||
2843 | } | ||
2844 | |||
2845 | // Get page offset from anchors | ||
2846 | var lastOffsetX = data.offsetX || 0; | ||
2847 | var offsetX = data.offsetX = -anchors[data.index].x; | ||
2848 | var resetConfig = { | ||
2849 | x: offsetX, | ||
2850 | opacity: 1, | ||
2851 | visibility: '' | ||
2852 | }; | ||
2853 | |||
2854 | // Transition slides | ||
2855 | var targets = $(anchors[data.index].els); | ||
2856 | var previous = $(anchors[data.previous] && anchors[data.previous].els); | ||
2857 | var others = data.slides.not(targets); | ||
2858 | var animation = config.animation; | ||
2859 | var easing = config.easing; | ||
2860 | var duration = Math.round(config.duration); | ||
2861 | var vector = options.vector || (data.index > data.previous ? 1 : -1); | ||
2862 | var fadeRule = 'opacity ' + duration + 'ms ' + easing; | ||
2863 | var slideRule = 'transform ' + duration + 'ms ' + easing; | ||
2864 | |||
2865 | // Trigger IX events | ||
2866 | if (!designer) { | ||
2867 | targets.each(ix.intro); | ||
2868 | others.each(ix.outro); | ||
2869 | } | ||
2870 | |||
2871 | // Set immediately after layout changes (but not during redraw) | ||
2872 | if (options.immediate && !redraw) { | ||
2873 | tram(targets).set(resetConfig); | ||
2874 | resetOthers(); | ||
2875 | return; | ||
2876 | } | ||
2877 | |||
2878 | // Exit early if index is unchanged | ||
2879 | if (data.index == data.previous) return; | ||
2880 | |||
2881 | // Cross Fade / Out-In | ||
2882 | if (animation == 'cross') { | ||
2883 | var reduced = Math.round(duration - duration * config.crossOver); | ||
2884 | var wait = Math.round(duration - reduced); | ||
2885 | fadeRule = 'opacity ' + reduced + 'ms ' + easing; | ||
2886 | tram(previous) | ||
2887 | .set({ | ||
2888 | visibility: '' | ||
2889 | }) | ||
2890 | .add(fadeRule) | ||
2891 | .start({ | ||
2892 | opacity: 0 | ||
2893 | }); | ||
2894 | tram(targets) | ||
2895 | .set({ | ||
2896 | visibility: '', | ||
2897 | x: offsetX, | ||
2898 | opacity: 0, | ||
2899 | zIndex: data.depth++ | ||
2900 | }) | ||
2901 | .add(fadeRule) | ||
2902 | .wait(wait) | ||
2903 | .then({ | ||
2904 | opacity: 1 | ||
2905 | }) | ||
2906 | .then(resetOthers); | ||
2907 | return; | ||
2908 | } | ||
2909 | |||
2910 | // Fade Over | ||
2911 | if (animation == 'fade') { | ||
2912 | tram(previous) | ||
2913 | .set({ | ||
2914 | visibility: '' | ||
2915 | }) | ||
2916 | .stop(); | ||
2917 | tram(targets) | ||
2918 | .set({ | ||
2919 | visibility: '', | ||
2920 | x: offsetX, | ||
2921 | opacity: 0, | ||
2922 | zIndex: data.depth++ | ||
2923 | }) | ||
2924 | .add(fadeRule) | ||
2925 | .start({ | ||
2926 | opacity: 1 | ||
2927 | }) | ||
2928 | .then(resetOthers); | ||
2929 | return; | ||
2930 | } | ||
2931 | |||
2932 | // Slide Over | ||
2933 | if (animation == 'over') { | ||
2934 | resetConfig = { | ||
2935 | x: data.endX | ||
2936 | }; | ||
2937 | tram(previous) | ||
2938 | .set({ | ||
2939 | visibility: '' | ||
2940 | }) | ||
2941 | .stop(); | ||
2942 | tram(targets) | ||
2943 | .set({ | ||
2944 | visibility: '', | ||
2945 | zIndex: data.depth++, | ||
2946 | x: offsetX + anchors[data.index].width * vector | ||
2947 | }) | ||
2948 | .add(slideRule) | ||
2949 | .start({ | ||
2950 | x: offsetX | ||
2951 | }) | ||
2952 | .then(resetOthers); | ||
2953 | return; | ||
2954 | } | ||
2955 | |||
2956 | // Slide - infinite scroll | ||
2957 | if (config.infinite && shift.x) { | ||
2958 | tram(data.slides.not(previous)) | ||
2959 | .set({ | ||
2960 | visibility: '', | ||
2961 | x: shift.x | ||
2962 | }) | ||
2963 | .add(slideRule) | ||
2964 | .start({ | ||
2965 | x: offsetX | ||
2966 | }); | ||
2967 | tram(previous) | ||
2968 | .set({ | ||
2969 | visibility: '', | ||
2970 | x: shift.from | ||
2971 | }) | ||
2972 | .add(slideRule) | ||
2973 | .start({ | ||
2974 | x: shift.to | ||
2975 | }); | ||
2976 | data.shifted = previous; | ||
2977 | |||
2978 | } else { | ||
2979 | if (config.infinite && data.shifted) { | ||
2980 | tram(data.shifted).set({ | ||
2981 | visibility: '', | ||
2982 | x: lastOffsetX | ||
2983 | }); | ||
2984 | data.shifted = null; | ||
2985 | } | ||
2986 | |||
2987 | // Slide - basic scroll | ||
2988 | tram(data.slides) | ||
2989 | .set({ | ||
2990 | visibility: '' | ||
2991 | }) | ||
2992 | .add(slideRule) | ||
2993 | .start({ | ||
2994 | x: offsetX | ||
2995 | }); | ||
2996 | } | ||
2997 | |||
2998 | // Helper to move others out of view | ||
2999 | function resetOthers() { | ||
3000 | var targets = $(anchors[data.index].els); | ||
3001 | var others = data.slides.not(targets); | ||
3002 | if (animation != 'slide') resetConfig.visibility = 'hidden'; | ||
3003 | tram(others).set(resetConfig); | ||
3004 | } | ||
3005 | } | ||
3006 | |||
3007 | function render(i, el) { | ||
3008 | var data = $.data(el, namespace); | ||
3009 | if (maskChanged(data)) return layout(data); | ||
3010 | if (designer && slidesChanged(data)) layout(data); | ||
3011 | } | ||
3012 | |||
3013 | function layout(data) { | ||
3014 | // Determine page count from width of slides | ||
3015 | var pages = 1; | ||
3016 | var offset = 0; | ||
3017 | var anchor = 0; | ||
3018 | var width = 0; | ||
3019 | data.anchors = [{ | ||
3020 | els: [], | ||
3021 | x: 0, | ||
3022 | width: 0 | ||
3023 | }]; | ||
3024 | data.slides.each(function(i, el) { | ||
3025 | if (anchor - offset > data.maskWidth - data.config.edge) { | ||
3026 | pages++; | ||
3027 | offset += data.maskWidth; | ||
3028 | // Store page anchor for transition | ||
3029 | data.anchors[pages - 1] = { | ||
3030 | els: [], | ||
3031 | x: anchor, | ||
3032 | width: 0 | ||
3033 | }; | ||
3034 | } | ||
3035 | // Set next anchor using current width + margin | ||
3036 | width = $(el).outerWidth(true); | ||
3037 | anchor += width; | ||
3038 | data.anchors[pages - 1].width += width; | ||
3039 | data.anchors[pages - 1].els.push(el); | ||
3040 | }); | ||
3041 | data.endX = anchor; | ||
3042 | |||
3043 | // Build dots if nav exists and needs updating | ||
3044 | if (designer) data.pages = null; | ||
3045 | if (data.nav.length && data.pages !== pages) { | ||
3046 | data.pages = pages; | ||
3047 | buildNav(data); | ||
3048 | } | ||
3049 | |||
3050 | // Make sure index is still within range and call change handler | ||
3051 | var index = data.index; | ||
3052 | if (index >= pages) index = pages - 1; | ||
3053 | change(data, { | ||
3054 | immediate: true, | ||
3055 | index: index | ||
3056 | }); | ||
3057 | } | ||
3058 | |||
3059 | function buildNav(data) { | ||
3060 | var dots = []; | ||
3061 | var $dot; | ||
3062 | var spacing = data.el.attr('data-nav-spacing'); | ||
3063 | if (spacing) spacing = parseFloat(spacing) + 'px'; | ||
3064 | for (var i = 0; i < data.pages; i++) { | ||
3065 | $dot = $(dot); | ||
3066 | if (data.nav.hasClass('w-num')) $dot.text(i + 1); | ||
3067 | if (spacing != null) $dot.css({ | ||
3068 | 'margin-left': spacing, | ||
3069 | 'margin-right': spacing | ||
3070 | }); | ||
3071 | dots.push($dot); | ||
3072 | } | ||
3073 | data.nav.empty().append(dots); | ||
3074 | } | ||
3075 | |||
3076 | function maskChanged(data) { | ||
3077 | var maskWidth = data.mask.width(); | ||
3078 | if (data.maskWidth !== maskWidth) { | ||
3079 | data.maskWidth = maskWidth; | ||
3080 | return true; | ||
3081 | } | ||
3082 | return false; | ||
3083 | } | ||
3084 | |||
3085 | function slidesChanged(data) { | ||
3086 | var slidesWidth = 0; | ||
3087 | data.slides.each(function(i, el) { | ||
3088 | slidesWidth += $(el).outerWidth(true); | ||
3089 | }); | ||
3090 | if (data.slidesWidth !== slidesWidth) { | ||
3091 | data.slidesWidth = slidesWidth; | ||
3092 | return true; | ||
3093 | } | ||
3094 | return false; | ||
3095 | } | ||
3096 | |||
3097 | // Export module | ||
3098 | return api; | ||
3099 | }); | ||
3100 | /** | ||
3101 | * ---------------------------------------------------------------------- | ||
3102 | * Webflow: Lightbox component | ||
3103 | */ | ||
3104 | var lightbox = (function(window, document, $, tram, undefined) { | ||
3105 | 'use strict'; | ||
3106 | |||
3107 | var isArray = Array.isArray; | ||
3108 | var namespace = 'w-lightbox'; | ||
3109 | var prefix = namespace + '-'; | ||
3110 | var prefixRegex = /(^|\s+)/g; | ||
3111 | var matchMedia = window.matchMedia || function(media) { | ||
3112 | // IE9 polyfill | ||
3113 | return { | ||
3114 | matches: window.styleMedia.matchMedium(media) | ||
3115 | }; | ||
3116 | }; | ||
3117 | var pixelRatio = window.devicePixelRatio || 1; | ||
3118 | var breakpoint = '(min-width: 1025px)'; | ||
3119 | |||
3120 | // Array of objects describing items to be displayed. | ||
3121 | var items = []; | ||
3122 | |||
3123 | // Index of the currently displayed item. | ||
3124 | var currentIndex; | ||
3125 | |||
3126 | // Object holding references to jQuery wrapped nodes. | ||
3127 | var $refs; | ||
3128 | |||
3129 | // Instance of Spinner | ||
3130 | var spinner; | ||
3131 | |||
3132 | function lightbox(thing, index) { | ||
3133 | items = isArray(thing) ? thing : [thing]; | ||
3134 | |||
3135 | if (!$refs) { | ||
3136 | lightbox.build(); | ||
3137 | } | ||
3138 | |||
3139 | if (items.length > 1) { | ||
3140 | $refs.items = $refs.empty; | ||
3141 | |||
3142 | items.forEach(function(item) { | ||
3143 | var $thumbnail = dom('thumbnail'); | ||
3144 | var $item = dom('item').append($thumbnail); | ||
3145 | |||
3146 | $refs.items = $refs.items.add($item); | ||
3147 | |||
3148 | loadImage(item.url, function($image) { | ||
3149 | if ($image.prop('width') > $image.prop('height')) { | ||
3150 | addClass($image, 'wide'); | ||
3151 | } else { | ||
3152 | addClass($image, 'tall'); | ||
3153 | } | ||
3154 | $thumbnail.append(addClass($image, 'thumbnail-image')); | ||
3155 | }); | ||
3156 | }); | ||
3157 | |||
3158 | $refs.strip.empty().append($refs.items); | ||
3159 | addClass($refs.content, 'group'); | ||
3160 | } | ||
3161 | |||
3162 | tram( | ||
3163 | // Focus the lightbox to receive keyboard events. | ||
3164 | removeClass($refs.lightbox, 'hide').focus() | ||
3165 | ) | ||
3166 | .add('opacity .3s') | ||
3167 | .start({ | ||
3168 | opacity: 1 | ||
3169 | }); | ||
3170 | |||
3171 | // Prevent document from scrolling while lightbox is active. | ||
3172 | addClass($refs.html, 'noscroll'); | ||
3173 | |||
3174 | return lightbox.show(index || 0); | ||
3175 | } | ||
3176 | |||
3177 | /** | ||
3178 | * Creates the DOM structure required by the lightbox. | ||
3179 | */ | ||
3180 | lightbox.build = function() { | ||
3181 | // In case `build` is called more than once. | ||
3182 | lightbox.destroy(); | ||
3183 | |||
3184 | $refs = { | ||
3185 | html: $(document.documentElement), | ||
3186 | // Empty jQuery object can be used to build new ones using `.add`. | ||
3187 | empty: $() | ||
3188 | }; | ||
3189 | |||
3190 | $refs.arrowLeft = dom('control left inactive'); | ||
3191 | $refs.arrowRight = dom('control right inactive'); | ||
3192 | $refs.close = dom('control close'); | ||
3193 | $refs.controls = $refs.empty.add($refs.arrowLeft).add($refs.arrowRight).add($refs.close); | ||
3194 | |||
3195 | $refs.spinner = dom('spinner'); | ||
3196 | $refs.strip = dom('strip'); | ||
3197 | |||
3198 | spinner = new Spinner($refs.spinner, prefixed('hide')); | ||
3199 | |||
3200 | $refs.content = dom('content') | ||
3201 | .append($refs.spinner, $refs.controls); | ||
3202 | |||
3203 | $refs.container = dom('container') | ||
3204 | .append($refs.content, $refs.strip); | ||
3205 | |||
3206 | $refs.lightbox = dom('backdrop hide') | ||
3207 | .append($refs.container); | ||
3208 | |||
3209 | // We are delegating events for performance reasons and also | ||
3210 | // to not have to reattach handlers when images change. | ||
3211 | $refs.strip.on('tap', selector('item'), itemTapHandler); | ||
3212 | $refs.content | ||
3213 | .on('swipe', swipeHandler) | ||
3214 | .on('tap', selector('left'), preventDefaultAnd(lightbox.prev)) | ||
3215 | .on('tap', selector('right'), preventDefaultAnd(lightbox.next)) | ||
3216 | .on('tap', selector('close'), preventDefaultAnd(lightbox.hide)) | ||
3217 | .on('tap', selector('image, caption'), toggleControlsOr(lightbox.next)); | ||
3218 | $refs.container.on( | ||
3219 | 'tap', selector('view, strip'), toggleControlsOr(lightbox.hide) | ||
3220 | ) | ||
3221 | // Prevent images from being dragged around. | ||
3222 | .on('dragstart', selector('img'), preventDefault); | ||
3223 | $refs.lightbox | ||
3224 | .on('keydown', keyHandler) | ||
3225 | // While visible, prevent lightbox from loosing focus to other nodes. | ||
3226 | // IE looses focus without letting us know. | ||
3227 | .on('focusin', focusThis) | ||
3228 | // Unfortunately setTimeout is needed because of a 14 year old | ||
3229 | // Firefox bug (https://bugzilla.mozilla.org/show_bug.cgi?id=53579#c4). | ||
3230 | .on('blur', function() { | ||
3231 | setTimeout(focusThis.bind(this), 0); | ||
3232 | }); | ||
3233 | |||
3234 | // The `tabindex` attribute is needed to enable non-input elements | ||
3235 | // to receive keyboard events. | ||
3236 | $('body').append($refs.lightbox.prop('tabIndex', 0)); | ||
3237 | |||
3238 | return lightbox; | ||
3239 | }; | ||
3240 | |||
3241 | /** | ||
3242 | * Dispose of DOM nodes created by the lightbox. | ||
3243 | */ | ||
3244 | lightbox.destroy = function() { | ||
3245 | if (!$refs) { | ||
3246 | return; | ||
3247 | } | ||
3248 | |||
3249 | // Event handlers are also removed. | ||
3250 | $refs.lightbox.remove(); | ||
3251 | $refs = undefined; | ||
3252 | }; | ||
3253 | |||
3254 | /** | ||
3255 | * Show a specific item. | ||
3256 | */ | ||
3257 | lightbox.show = function(index) { | ||
3258 | // Bail if we are already showing this item. | ||
3259 | if (index === currentIndex) { | ||
3260 | return; | ||
3261 | } | ||
3262 | |||
3263 | var item = items[index]; | ||
3264 | var previousIndex = currentIndex; | ||
3265 | currentIndex = index; | ||
3266 | spinner.show(); | ||
3267 | |||
3268 | // For videos, load an empty SVG with the video dimensions to preserve | ||
3269 | // the video’s aspect ratio while being responsive. | ||
3270 | var url = item.html && svgDataUri(item.width, item.height) || item.url; | ||
3271 | loadImage(url, function($image) { | ||
3272 | // Make sure this is the last item requested to be shown since | ||
3273 | // images can finish loading in a different order than they were | ||
3274 | // requested in. | ||
3275 | if (index != currentIndex) { | ||
3276 | return; | ||
3277 | } | ||
3278 | |||
3279 | var $figure = dom('figure', 'figure').append(addClass($image, 'image')); | ||
3280 | var $frame = dom('frame').append($figure); | ||
3281 | var $newView = dom('view').append($frame); | ||
3282 | |||
3283 | if (item.html) { | ||
3284 | $figure.append(addClass($(item.html), 'embed')); | ||
3285 | } | ||
3286 | |||
3287 | if (item.caption) { | ||
3288 | $figure.append(dom('caption', 'figcaption').text(item.caption)); | ||
3289 | } | ||
3290 | |||
3291 | spinner.hide(); | ||
3292 | |||
3293 | toggleClass($refs.arrowLeft, 'inactive', index <= 0); | ||
3294 | toggleClass($refs.arrowRight, 'inactive', index >= items.length - 1); | ||
3295 | |||
3296 | $refs.spinner.before($newView); | ||
3297 | |||
3298 | if ($refs.view) { | ||
3299 | tram($refs.view) | ||
3300 | .add('opacity .3s') | ||
3301 | .start({ | ||
3302 | opacity: 0 | ||
3303 | }) | ||
3304 | .then(remover($refs.view)); | ||
3305 | |||
3306 | tram($newView) | ||
3307 | .add('opacity .3s') | ||
3308 | .add('transform .3s') | ||
3309 | .set({ | ||
3310 | opacity: 0, | ||
3311 | x: index > previousIndex ? '80px' : '-80px' | ||
3312 | }) | ||
3313 | .start({ | ||
3314 | opacity: 1, | ||
3315 | x: 0 | ||
3316 | }); | ||
3317 | } | ||
3318 | |||
3319 | $refs.view = $newView; | ||
3320 | |||
3321 | if ($refs.items) { | ||
3322 | // Mark proper thumbnail as active | ||
3323 | addClass(removeClass($refs.items, 'active').eq(index), 'active'); | ||
3324 | } | ||
3325 | }); | ||
3326 | |||
3327 | return lightbox; | ||
3328 | }; | ||
3329 | |||
3330 | /** | ||
3331 | * Hides the lightbox. | ||
3332 | */ | ||
3333 | lightbox.hide = function() { | ||
3334 | tram($refs.lightbox) | ||
3335 | .add('opacity .3s') | ||
3336 | .start({ | ||
3337 | opacity: 0 | ||
3338 | }) | ||
3339 | .then(hideLightbox); | ||
3340 | |||
3341 | return lightbox; | ||
3342 | }; | ||
3343 | |||
3344 | lightbox.prev = function() { | ||
3345 | if (currentIndex > 0) { | ||
3346 | lightbox.show(currentIndex - 1); | ||
3347 | } | ||
3348 | }; | ||
3349 | |||
3350 | lightbox.next = function() { | ||
3351 | if (currentIndex < items.length - 1) { | ||
3352 | lightbox.show(currentIndex + 1); | ||
3353 | } | ||
3354 | }; | ||
3355 | |||
3356 | function toggleControlsOr(callback) { | ||
3357 | return function(event) { | ||
3358 | // We only care about events triggered directly on the bound selectors. | ||
3359 | if (this != event.target) { | ||
3360 | return; | ||
3361 | } | ||
3362 | |||
3363 | event.stopPropagation(); | ||
3364 | event.preventDefault(); | ||
3365 | |||
3366 | if (matchMedia(breakpoint).matches) { | ||
3367 | callback(); | ||
3368 | } else { | ||
3369 | toggleClass($refs.controls, 'visible'); | ||
3370 | } | ||
3371 | }; | ||
3372 | } | ||
3373 | |||
3374 | var itemTapHandler = function(event) { | ||
3375 | var index = $(this).index(); | ||
3376 | |||
3377 | event.preventDefault(); | ||
3378 | lightbox.show(index); | ||
3379 | }; | ||
3380 | |||
3381 | var swipeHandler = function(event, data) { | ||
3382 | // Prevent scrolling. | ||
3383 | event.preventDefault(); | ||
3384 | |||
3385 | if (data.direction == 'left') { | ||
3386 | lightbox.next(); | ||
3387 | } else if (data.direction == 'right') { | ||
3388 | lightbox.prev(); | ||
3389 | } | ||
3390 | }; | ||
3391 | |||
3392 | function preventDefaultAnd(action) { | ||
3393 | return function(event) { | ||
3394 | // Prevents click events and zooming. | ||
3395 | event.preventDefault(); | ||
3396 | action(); | ||
3397 | }; | ||
3398 | } | ||
3399 | |||
3400 | var focusThis = function() { | ||
3401 | this.focus(); | ||
3402 | }; | ||
3403 | |||
3404 | function preventDefault(event) { | ||
3405 | event.preventDefault(); | ||
3406 | } | ||
3407 | |||
3408 | function keyHandler(event) { | ||
3409 | var keyCode = event.keyCode; | ||
3410 | |||
3411 | // [esc] | ||
3412 | if (keyCode == 27) { | ||
3413 | lightbox.hide(); | ||
3414 | } | ||
3415 | |||
3416 | // [â—€] | ||
3417 | else if (keyCode == 37) { | ||
3418 | lightbox.prev(); | ||
3419 | } | ||
3420 | |||
3421 | // [â–¶] | ||
3422 | else if (keyCode == 39) { | ||
3423 | lightbox.next(); | ||
3424 | } | ||
3425 | } | ||
3426 | |||
3427 | function hideLightbox() { | ||
3428 | removeClass($refs.html, 'noscroll'); | ||
3429 | addClass($refs.lightbox, 'hide'); | ||
3430 | $refs.strip.empty(); | ||
3431 | $refs.view && $refs.view.remove(); | ||
3432 | |||
3433 | // Reset some stuff | ||
3434 | removeClass($refs.content, 'group'); | ||
3435 | removeClass($refs.controls, 'visible'); | ||
3436 | addClass($refs.arrowLeft, 'inactive'); | ||
3437 | addClass($refs.arrowRight, 'inactive'); | ||
3438 | |||
3439 | currentIndex = $refs.view = undefined; | ||
3440 | } | ||
3441 | |||
3442 | function loadImage(url, callback) { | ||
3443 | var $image = dom('img', 'img'); | ||
3444 | |||
3445 | $image.one('load', function() { | ||
3446 | callback($image); | ||
3447 | }); | ||
3448 | |||
3449 | // Start loading image. | ||
3450 | $image.attr('src', url); | ||
3451 | |||
3452 | return $image; | ||
3453 | } | ||
3454 | |||
3455 | function remover($element) { | ||
3456 | return function() { | ||
3457 | $element.remove(); | ||
3458 | }; | ||
3459 | } | ||
3460 | |||
3461 | /** | ||
3462 | * Spinner | ||
3463 | */ | ||
3464 | function Spinner($spinner, className, delay) { | ||
3465 | this.$element = $spinner; | ||
3466 | this.className = className; | ||
3467 | this.delay = delay || 200; | ||
3468 | this.hide(); | ||
3469 | } | ||
3470 | |||
3471 | Spinner.prototype.show = function() { | ||
3472 | var spinner = this; | ||
3473 | |||
3474 | // Bail if we are already showing the spinner. | ||
3475 | if (spinner.timeoutId) { | ||
3476 | return; | ||
3477 | } | ||
3478 | |||
3479 | spinner.timeoutId = setTimeout(function() { | ||
3480 | spinner.$element.removeClass(spinner.className); | ||
3481 | delete spinner.timeoutId; | ||
3482 | }, spinner.delay); | ||
3483 | }; | ||
3484 | |||
3485 | Spinner.prototype.hide = function() { | ||
3486 | var spinner = this; | ||
3487 | if (spinner.timeoutId) { | ||
3488 | clearTimeout(spinner.timeoutId); | ||
3489 | delete spinner.timeoutId; | ||
3490 | return; | ||
3491 | } | ||
3492 | |||
3493 | spinner.$element.addClass(spinner.className); | ||
3494 | }; | ||
3495 | |||
3496 | function prefixed(string, isSelector) { | ||
3497 | return string.replace(prefixRegex, (isSelector ? ' .' : ' ') + prefix); | ||
3498 | } | ||
3499 | |||
3500 | function selector(string) { | ||
3501 | return prefixed(string, true); | ||
3502 | } | ||
3503 | |||
3504 | /** | ||
3505 | * jQuery.addClass with auto-prefixing | ||
3506 | * @param {jQuery} Element to add class to | ||
3507 | * @param {string} Class name that will be prefixed and added to element | ||
3508 | * @return {jQuery} | ||
3509 | */ | ||
3510 | function addClass($element, className) { | ||
3511 | return $element.addClass(prefixed(className)); | ||
3512 | } | ||
3513 | |||
3514 | /** | ||
3515 | * jQuery.removeClass with auto-prefixing | ||
3516 | * @param {jQuery} Element to remove class from | ||
3517 | * @param {string} Class name that will be prefixed and removed from element | ||
3518 | * @return {jQuery} | ||
3519 | */ | ||
3520 | function removeClass($element, className) { | ||
3521 | return $element.removeClass(prefixed(className)); | ||
3522 | } | ||
3523 | |||
3524 | /** | ||
3525 | * jQuery.toggleClass with auto-prefixing | ||
3526 | * @param {jQuery} Element where class will be toggled | ||
3527 | * @param {string} Class name that will be prefixed and toggled | ||
3528 | * @param {boolean} Optional boolean that determines if class will be added or removed | ||
3529 | * @return {jQuery} | ||
3530 | */ | ||
3531 | function toggleClass($element, className, shouldAdd) { | ||
3532 | return $element.toggleClass(prefixed(className), shouldAdd); | ||
3533 | } | ||
3534 | |||
3535 | /** | ||
3536 | * Create a new DOM element wrapped in a jQuery object, | ||
3537 | * decorated with our custom methods. | ||
3538 | * @param {string} className | ||
3539 | * @param {string} [tag] | ||
3540 | * @return {jQuery} | ||
3541 | */ | ||
3542 | function dom(className, tag) { | ||
3543 | return addClass($(document.createElement(tag || 'div')), className); | ||
3544 | } | ||
3545 | |||
3546 | function isObject(value) { | ||
3547 | return typeof value == 'object' && null != value && !isArray(value); | ||
3548 | } | ||
3549 | |||
3550 | function svgDataUri(width, height) { | ||
3551 | var svg = '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '"/>'; | ||
3552 | return 'data:image/svg+xml;charset=utf-8,' + encodeURI(svg); | ||
3553 | } | ||
3554 | |||
3555 | // Compute some dimensions manually for iOS, because of buggy support for VH. | ||
3556 | // Also, Android built-in browser does not support viewport units. | ||
3557 | (function() { | ||
3558 | var ua = window.navigator.userAgent; | ||
3559 | var iOS = /(iPhone|iPod|iPad).+AppleWebKit/i.test(ua); | ||
3560 | var android = ua.indexOf('Android ') > -1 && ua.indexOf('Chrome') == -1; | ||
3561 | |||
3562 | if (!iOS && !android) { | ||
3563 | return; | ||
3564 | } | ||
3565 | |||
3566 | var styleNode = document.createElement('style'); | ||
3567 | document.head.appendChild(styleNode); | ||
3568 | window.addEventListener('orientationchange', refresh, true); | ||
3569 | |||
3570 | function refresh() { | ||
3571 | var vh = window.innerHeight; | ||
3572 | var vw = window.innerWidth; | ||
3573 | var content = | ||
3574 | '.w-lightbox-content, .w-lightbox-view, .w-lightbox-view:before {' + | ||
3575 | 'height:' + vh + 'px' + | ||
3576 | '}' + | ||
3577 | '.w-lightbox-view {' + | ||
3578 | 'width:' + vw + 'px' + | ||
3579 | '}' + | ||
3580 | '.w-lightbox-group, .w-lightbox-group .w-lightbox-view, .w-lightbox-group .w-lightbox-view:before {' + | ||
3581 | 'height:' + (0.86 * vh) + 'px' + | ||
3582 | '}' + | ||
3583 | '.w-lightbox-image {' + | ||
3584 | 'max-width:' + vw + 'px;' + | ||
3585 | 'max-height:' + vh + 'px' + | ||
3586 | '}' + | ||
3587 | '.w-lightbox-group .w-lightbox-image {' + | ||
3588 | 'max-height:' + (0.86 * vh) + 'px' + | ||
3589 | '}' + | ||
3590 | '.w-lightbox-strip {' + | ||
3591 | 'padding: 0 ' + (0.01 * vh) + 'px' + | ||
3592 | '}' + | ||
3593 | '.w-lightbox-item {' + | ||
3594 | 'width:' + (0.1 * vh) + 'px;' + | ||
3595 | 'padding:' + (0.02 * vh) + 'px ' + (0.01 * vh) + 'px' + | ||
3596 | '}' + | ||
3597 | '.w-lightbox-thumbnail {' + | ||
3598 | 'height:' + (0.1 * vh) + 'px' + | ||
3599 | '}'; | ||
3600 | |||
3601 | styleNode.textContent = content; | ||
3602 | } | ||
3603 | |||
3604 | refresh(); | ||
3605 | })(); | ||
3606 | |||
3607 | return lightbox; | ||
3608 | })(window, document, jQuery, window.tram); | ||
3609 | |||
3610 | Webflow.define('lightbox', function($, _) { | ||
3611 | 'use strict'; | ||
3612 | |||
3613 | var api = {}; | ||
3614 | var $doc = $(document); | ||
3615 | var $body; | ||
3616 | var $lightboxes; | ||
3617 | var designer; | ||
3618 | var inApp = Webflow.env(); | ||
3619 | var namespace = '.w-lightbox'; | ||
3620 | var groups; | ||
3621 | |||
3622 | // ----------------------------------- | ||
3623 | // Module methods | ||
3624 | |||
3625 | api.ready = api.design = api.preview = init; | ||
3626 | |||
3627 | // ----------------------------------- | ||
3628 | // Private methods | ||
3629 | |||
3630 | function init() { | ||
3631 | designer = inApp && Webflow.env('design'); | ||
3632 | $body = $(document.body); | ||
3633 | |||
3634 | // Reset Lightbox | ||
3635 | lightbox.destroy(); | ||
3636 | |||
3637 | // Reset groups | ||
3638 | groups = {}; | ||
3639 | |||
3640 | // Find all instances on the page | ||
3641 | $lightboxes = $doc.find(namespace); | ||
3642 | $lightboxes.each(build); | ||
3643 | } | ||
3644 | |||
3645 | function build(i, el) { | ||
3646 | var $el = $(el); | ||
3647 | |||
3648 | // Store state in data | ||
3649 | var data = $.data(el, namespace); | ||
3650 | if (!data) data = $.data(el, namespace, { | ||
3651 | el: $el, | ||
3652 | mode: 'images', | ||
3653 | images: [], | ||
3654 | embed: '' | ||
3655 | }); | ||
3656 | |||
3657 | // Remove old events | ||
3658 | data.el.off(namespace); | ||
3659 | |||
3660 | // Set config from json script tag | ||
3661 | configure(data); | ||
3662 | |||
3663 | // Add events based on mode | ||
3664 | if (designer) { | ||
3665 | data.el.on('setting' + namespace, configure.bind(null, data)); | ||
3666 | } else { | ||
3667 | data.el | ||
3668 | .on('tap' + namespace, tapHandler(data)) | ||
3669 | // Prevent page scrolling to top when clicking on lightbox triggers. | ||
3670 | .on('click' + namespace, function(e) { | ||
3671 | e.preventDefault(); | ||
3672 | }); | ||
3673 | } | ||
3674 | } | ||
3675 | |||
3676 | function configure(data) { | ||
3677 | var json = data.el.children('.w-json').html(); | ||
3678 | var groupId, group; | ||
3679 | |||
3680 | if (!json) { | ||
3681 | data.images = []; | ||
3682 | return; | ||
3683 | } | ||
3684 | |||
3685 | try { | ||
3686 | json = JSON.parse(json); | ||
3687 | data.mode = json.mode; | ||
3688 | |||
3689 | if (json.mode == 'video') { | ||
3690 | data.embed = json.embed; | ||
3691 | } else { | ||
3692 | groupId = json.groupId; | ||
3693 | if (groupId) { | ||
3694 | group = groups[groupId]; | ||
3695 | if (!group) { | ||
3696 | group = groups[groupId] = []; | ||
3697 | } | ||
3698 | |||
3699 | data.images = group; | ||
3700 | |||
3701 | if (json.images.length) { | ||
3702 | data.index = group.length; | ||
3703 | group.push.apply(group, json.images); | ||
3704 | } | ||
3705 | } else { | ||
3706 | data.images = json.images; | ||
3707 | } | ||
3708 | } | ||
3709 | } catch (e) { | ||
3710 | console.error('Malformed lightbox JSON configuration.', e.message); | ||
3711 | } | ||
3712 | } | ||
3713 | |||
3714 | function tapHandler(data) { | ||
3715 | return function() { | ||
3716 | if (data.mode == 'video') { | ||
3717 | data.embed && lightbox(data.embed); | ||
3718 | } else { | ||
3719 | data.images.length && lightbox(data.images, data.index || 0); | ||
3720 | } | ||
3721 | }; | ||
3722 | } | ||
3723 | |||
3724 | // Export module | ||
3725 | return api; | ||
3726 | }); | ||
3727 | /** | ||
3728 | * ---------------------------------------------------------------------- | ||
3729 | * Webflow: Navbar component | ||
3730 | */ | ||
3731 | Webflow.define('navbar', function($, _) { | ||
3732 | 'use strict'; | ||
3733 | |||
3734 | var api = {}; | ||
3735 | var tram = window.tram; | ||
3736 | var $win = $(window); | ||
3737 | var $doc = $(document); | ||
3738 | var $body; | ||
3739 | var $navbars; | ||
3740 | var designer; | ||
3741 | var inApp = Webflow.env(); | ||
3742 | var overlay = '<div class="w-nav-overlay" data-wf-ignore />'; | ||
3743 | var namespace = '.w-nav'; | ||
3744 | var buttonOpen = 'w--open'; | ||
3745 | var menuOpen = 'w--nav-menu-open'; | ||
3746 | var linkOpen = 'w--nav-link-open'; | ||
3747 | var ix = Webflow.ixEvents(); | ||
3748 | |||
3749 | // ----------------------------------- | ||
3750 | // Module methods | ||
3751 | |||
3752 | api.ready = api.design = api.preview = init; | ||
3753 | api.destroy = removeListeners; | ||
3754 | |||
3755 | // ----------------------------------- | ||
3756 | // Private methods | ||
3757 | |||
3758 | function init() { | ||
3759 | designer = inApp && Webflow.env('design'); | ||
3760 | $body = $(document.body); | ||
3761 | |||
3762 | // Find all instances on the page | ||
3763 | $navbars = $doc.find(namespace); | ||
3764 | if (!$navbars.length) return; | ||
3765 | $navbars.each(build); | ||
3766 | |||
3767 | // Wire events | ||
3768 | removeListeners(); | ||
3769 | addListeners(); | ||
3770 | } | ||
3771 | |||
3772 | function removeListeners() { | ||
3773 | Webflow.resize.off(resizeAll); | ||
3774 | } | ||
3775 | |||
3776 | function addListeners() { | ||
3777 | Webflow.resize.on(resizeAll); | ||
3778 | } | ||
3779 | |||
3780 | function resizeAll() { | ||
3781 | $navbars.each(resize); | ||
3782 | } | ||
3783 | |||
3784 | function build(i, el) { | ||
3785 | var $el = $(el); | ||
3786 | |||
3787 | // Store state in data | ||
3788 | var data = $.data(el, namespace); | ||
3789 | if (!data) data = $.data(el, namespace, { | ||
3790 | open: false, | ||
3791 | el: $el, | ||
3792 | config: {} | ||
3793 | }); | ||
3794 | data.menu = $el.find('.w-nav-menu'); | ||
3795 | data.links = data.menu.find('.w-nav-link'); | ||
3796 | data.dropdowns = data.menu.find('.w-dropdown'); | ||
3797 | data.button = $el.find('.w-nav-button'); | ||
3798 | data.container = $el.find('.w-container'); | ||
3799 | data.outside = outside(data); | ||
3800 | |||
3801 | // Remove old events | ||
3802 | data.el.off(namespace); | ||
3803 | data.button.off(namespace); | ||
3804 | data.menu.off(namespace); | ||
3805 | |||
3806 | // Set config from data attributes | ||
3807 | configure(data); | ||
3808 | |||
3809 | // Add events based on mode | ||
3810 | if (designer) { | ||
3811 | removeOverlay(data); | ||
3812 | data.el.on('setting' + namespace, handler(data)); | ||
3813 | } else { | ||
3814 | addOverlay(data); | ||
3815 | data.button.on('tap' + namespace, toggle(data)); | ||
3816 | data.menu.on('tap' + namespace, 'a', navigate(data)); | ||
3817 | } | ||
3818 | |||
3819 | // Trigger initial resize | ||
3820 | resize(i, el); | ||
3821 | } | ||
3822 | |||
3823 | function removeOverlay(data) { | ||
3824 | if (!data.overlay) return; | ||
3825 | close(data, true); | ||
3826 | data.overlay.remove(); | ||
3827 | data.overlay = null; | ||
3828 | } | ||
3829 | |||
3830 | function addOverlay(data) { | ||
3831 | if (data.overlay) return; | ||
3832 | data.overlay = $(overlay).appendTo(data.el); | ||
3833 | data.parent = data.menu.parent(); | ||
3834 | close(data, true); | ||
3835 | } | ||
3836 | |||
3837 | function configure(data) { | ||
3838 | var config = {}; | ||
3839 | var old = data.config || {}; | ||
3840 | |||
3841 | // Set config options from data attributes | ||
3842 | var animation = config.animation = data.el.attr('data-animation') || 'default'; | ||
3843 | config.animOver = /^over/.test(animation); | ||
3844 | config.animDirect = /left$/.test(animation) ? -1 : 1; | ||
3845 | |||
3846 | // Re-open menu if the animation type changed | ||
3847 | if (old.animation != animation) { | ||
3848 | data.open && _.defer(reopen, data); | ||
3849 | } | ||
3850 | |||
3851 | config.easing = data.el.attr('data-easing') || 'ease'; | ||
3852 | config.easing2 = data.el.attr('data-easing2') || 'ease'; | ||
3853 | |||
3854 | var duration = data.el.attr('data-duration'); | ||
3855 | config.duration = duration != null ? +duration : 400; | ||
3856 | |||
3857 | config.docHeight = data.el.attr('data-doc-height'); | ||
3858 | |||
3859 | // Store config in data | ||
3860 | data.config = config; | ||
3861 | } | ||
3862 | |||
3863 | function handler(data) { | ||
3864 | return function(evt, options) { | ||
3865 | options = options || {}; | ||
3866 | var winWidth = $win.width(); | ||
3867 | configure(data); | ||
3868 | options.open === true && open(data, true); | ||
3869 | options.open === false && close(data, true); | ||
3870 | // Reopen if media query changed after setting | ||
3871 | data.open && _.defer(function() { | ||
3872 | if (winWidth != $win.width()) reopen(data); | ||
3873 | }); | ||
3874 | }; | ||
3875 | } | ||
3876 | |||
3877 | function closeEach(i, el) { | ||
3878 | var data = $.data(el, namespace); | ||
3879 | data.open && close(data); | ||
3880 | } | ||
3881 | |||
3882 | function reopen(data) { | ||
3883 | if (!data.open) return; | ||
3884 | close(data, true); | ||
3885 | open(data, true); | ||
3886 | } | ||
3887 | |||
3888 | function toggle(data) { | ||
3889 | return _.debounce(function(evt) { | ||
3890 | data.open ? close(data) : open(data); | ||
3891 | }); | ||
3892 | } | ||
3893 | |||
3894 | function navigate(data) { | ||
3895 | return function(evt) { | ||
3896 | var link = $(this); | ||
3897 | var href = link.attr('href'); | ||
3898 | |||
3899 | // Close when navigating to an in-page anchor | ||
3900 | if (href && href.indexOf('#') === 0 && data.open) { | ||
3901 | // Avoid empty hash links | ||
3902 | if (href.length === 1) evt.preventDefault(); | ||
3903 | close(data); | ||
3904 | } | ||
3905 | }; | ||
3906 | } | ||
3907 | |||
3908 | function outside(data) { | ||
3909 | // Unbind previous tap handler if it exists | ||
3910 | if (data.outside) $doc.off('tap' + namespace, data.outside); | ||
3911 | |||
3912 | // Close menu when tapped outside | ||
3913 | return _.debounce(function(evt) { | ||
3914 | if (!data.open) return; | ||
3915 | var menu = $(evt.target).closest('.w-nav-menu'); | ||
3916 | if (!data.menu.is(menu)) { | ||
3917 | close(data); | ||
3918 | } | ||
3919 | }); | ||
3920 | } | ||
3921 | |||
3922 | function resize(i, el) { | ||
3923 | var data = $.data(el, namespace); | ||
3924 | // Check for collapsed state based on button display | ||
3925 | var collapsed = data.collapsed = data.button.css('display') != 'none'; | ||
3926 | // Close menu if button is no longer visible (and not in designer) | ||
3927 | if (data.open && !collapsed && !designer) close(data, true); | ||
3928 | // Set max-width of links + dropdowns to match container | ||
3929 | if (data.container.length) { | ||
3930 | var updateEachMax = updateMax(data); | ||
3931 | data.links.each(updateEachMax); | ||
3932 | data.dropdowns.each(updateEachMax); | ||
3933 | } | ||
3934 | // If currently open, update height to match body | ||
3935 | if (data.open) { | ||
3936 | setOverlayHeight(data); | ||
3937 | } | ||
3938 | } | ||
3939 | |||
3940 | var maxWidth = 'max-width'; | ||
3941 | |||
3942 | function updateMax(data) { | ||
3943 | // Set max-width of each element to match container | ||
3944 | var containMax = data.container.css(maxWidth); | ||
3945 | if (containMax == 'none') containMax = ''; | ||
3946 | return function(i, link) { | ||
3947 | link = $(link); | ||
3948 | link.css(maxWidth, ''); | ||
3949 | // Don't set the max-width if an upstream value exists | ||
3950 | if (link.css(maxWidth) == 'none') link.css(maxWidth, containMax); | ||
3951 | }; | ||
3952 | } | ||
3953 | |||
3954 | function open(data, immediate) { | ||
3955 | if (data.open) return; | ||
3956 | data.open = true; | ||
3957 | data.menu.addClass(menuOpen); | ||
3958 | data.links.addClass(linkOpen); | ||
3959 | data.button.addClass(buttonOpen); | ||
3960 | var config = data.config; | ||
3961 | var animation = config.animation; | ||
3962 | if (animation == 'none' || !tram.support.transform) immediate = true; | ||
3963 | var bodyHeight = setOverlayHeight(data); | ||
3964 | var menuHeight = data.menu.outerHeight(true); | ||
3965 | var menuWidth = data.menu.outerWidth(true); | ||
3966 | var navHeight = data.el.height(); | ||
3967 | var navbarEl = data.el[0]; | ||
3968 | resize(0, navbarEl); | ||
3969 | ix.intro(0, navbarEl); | ||
3970 | |||
3971 | // Listen for tap outside events | ||
3972 | if (!designer) $doc.on('tap' + namespace, data.outside); | ||
3973 | |||
3974 | // No transition for immediate | ||
3975 | if (immediate) return; | ||
3976 | |||
3977 | var transConfig = 'transform ' + config.duration + 'ms ' + config.easing; | ||
3978 | |||
3979 | // Add menu to overlay | ||
3980 | if (data.overlay) { | ||
3981 | data.overlay.show().append(data.menu); | ||
3982 | } | ||
3983 | |||
3984 | // Over left/right | ||
3985 | if (config.animOver) { | ||
3986 | tram(data.menu) | ||
3987 | .add(transConfig) | ||
3988 | .set({ | ||
3989 | x: config.animDirect * menuWidth, | ||
3990 | height: bodyHeight | ||
3991 | }).start({ | ||
3992 | x: 0 | ||
3993 | }); | ||
3994 | data.overlay && data.overlay.width(menuWidth); | ||
3995 | return; | ||
3996 | } | ||
3997 | |||
3998 | // Drop Down | ||
3999 | var offsetY = navHeight + menuHeight; | ||
4000 | tram(data.menu) | ||
4001 | .add(transConfig) | ||
4002 | .set({ | ||
4003 | y: -offsetY | ||
4004 | }).start({ | ||
4005 | y: 0 | ||
4006 | }); | ||
4007 | } | ||
4008 | |||
4009 | function setOverlayHeight(data) { | ||
4010 | var config = data.config; | ||
4011 | var bodyHeight = config.docHeight ? $doc.height() : $body.height(); | ||
4012 | if (config.animOver) { | ||
4013 | data.menu.height(bodyHeight); | ||
4014 | } else if (data.el.css('position') != 'fixed') { | ||
4015 | bodyHeight -= data.el.height(); | ||
4016 | } | ||
4017 | data.overlay && data.overlay.height(bodyHeight); | ||
4018 | return bodyHeight; | ||
4019 | } | ||
4020 | |||
4021 | function close(data, immediate) { | ||
4022 | if (!data.open) return; | ||
4023 | data.open = false; | ||
4024 | data.button.removeClass(buttonOpen); | ||
4025 | var config = data.config; | ||
4026 | if (config.animation == 'none' || !tram.support.transform) immediate = true; | ||
4027 | var animation = config.animation; | ||
4028 | ix.outro(0, data.el[0]); | ||
4029 | |||
4030 | // Stop listening for tap outside events | ||
4031 | $doc.off('tap' + namespace, data.outside); | ||
4032 | |||
4033 | if (immediate) { | ||
4034 | tram(data.menu).stop(); | ||
4035 | complete(); | ||
4036 | return; | ||
4037 | } | ||
4038 | |||
4039 | var transConfig = 'transform ' + config.duration + 'ms ' + config.easing2; | ||
4040 | var menuHeight = data.menu.outerHeight(true); | ||
4041 | var menuWidth = data.menu.outerWidth(true); | ||
4042 | var navHeight = data.el.height(); | ||
4043 | |||
4044 | // Over left/right | ||
4045 | if (config.animOver) { | ||
4046 | tram(data.menu) | ||
4047 | .add(transConfig) | ||
4048 | .start({ | ||
4049 | x: menuWidth * config.animDirect | ||
4050 | }).then(complete); | ||
4051 | return; | ||
4052 | } | ||
4053 | |||
4054 | // Drop Down | ||
4055 | var offsetY = navHeight + menuHeight; | ||
4056 | tram(data.menu) | ||
4057 | .add(transConfig) | ||
4058 | .start({ | ||
4059 | y: -offsetY | ||
4060 | }).then(complete); | ||
4061 | |||
4062 | function complete() { | ||
4063 | data.menu.height(''); | ||
4064 | tram(data.menu).set({ | ||
4065 | x: 0, | ||
4066 | y: 0 | ||
4067 | }); | ||
4068 | data.menu.removeClass(menuOpen); | ||
4069 | data.links.removeClass(linkOpen); | ||
4070 | if (data.overlay && data.overlay.children().length) { | ||
4071 | // Move menu back to parent | ||
4072 | data.menu.appendTo(data.parent); | ||
4073 | data.overlay.attr('style', '').hide(); | ||
4074 | } | ||
4075 | |||
4076 | // Trigger event so other components can hook in (dropdown) | ||
4077 | data.el.triggerHandler('w-close'); | ||
4078 | } | ||
4079 | } | ||
4080 | |||
4081 | // Export module | ||
4082 | return api; | ||
4083 | }); | ||
4084 | /** | ||
4085 | * ---------------------------------------------------------------------- | ||
4086 | * Webflow: Dropdown component | ||
4087 | */ | ||
4088 | Webflow.define('dropdown', function($, _) { | ||
4089 | 'use strict'; | ||
4090 | |||
4091 | var api = {}; | ||
4092 | var tram = window.tram; | ||
4093 | var $doc = $(document); | ||
4094 | var $dropdowns; | ||
4095 | var designer; | ||
4096 | var inApp = Webflow.env(); | ||
4097 | var namespace = '.w-dropdown'; | ||
4098 | var stateOpen = 'w--open'; | ||
4099 | var closeEvent = 'w-close' + namespace; | ||
4100 | var ix = Webflow.ixEvents(); | ||
4101 | |||
4102 | // ----------------------------------- | ||
4103 | // Module methods | ||
4104 | |||
4105 | api.ready = api.design = api.preview = init; | ||
4106 | |||
4107 | // ----------------------------------- | ||
4108 | // Private methods | ||
4109 | |||
4110 | function init() { | ||
4111 | designer = inApp && Webflow.env('design'); | ||
4112 | |||
4113 | // Find all instances on the page | ||
4114 | $dropdowns = $doc.find(namespace); | ||
4115 | $dropdowns.each(build); | ||
4116 | } | ||
4117 | |||
4118 | function build(i, el) { | ||
4119 | var $el = $(el); | ||
4120 | |||
4121 | // Store state in data | ||
4122 | var data = $.data(el, namespace); | ||
4123 | if (!data) data = $.data(el, namespace, { | ||
4124 | open: false, | ||
4125 | el: $el, | ||
4126 | config: {} | ||
4127 | }); | ||
4128 | data.list = $el.children('.w-dropdown-list'); | ||
4129 | data.toggle = $el.children('.w-dropdown-toggle'); | ||
4130 | data.links = data.list.children('.w-dropdown-link'); | ||
4131 | data.outside = outside(data); | ||
4132 | data.complete = complete(data); | ||
4133 | |||
4134 | // Remove old events | ||
4135 | $el.off(namespace); | ||
4136 | data.toggle.off(namespace); | ||
4137 | |||
4138 | // Set config from data attributes | ||
4139 | configure(data); | ||
4140 | |||
4141 | if (data.nav) data.nav.off(namespace); | ||
4142 | data.nav = $el.closest('.w-nav'); | ||
4143 | data.nav.on(closeEvent, handler(data)); | ||
4144 | |||
4145 | // Add events based on mode | ||
4146 | if (designer) { | ||
4147 | $el.on('setting' + namespace, handler(data)); | ||
4148 | } else { | ||
4149 | data.toggle.on('tap' + namespace, toggle(data)); | ||
4150 | $el.on(closeEvent, handler(data)); | ||
4151 | // Close in preview mode | ||
4152 | inApp && close(data); | ||
4153 | } | ||
4154 | } | ||
4155 | |||
4156 | function configure(data) { | ||
4157 | data.config = { | ||
4158 | hover: +data.el.attr('data-hover'), | ||
4159 | delay: +data.el.attr('data-delay') || 0 | ||
4160 | }; | ||
4161 | } | ||
4162 | |||
4163 | function handler(data) { | ||
4164 | return function(evt, options) { | ||
4165 | options = options || {}; | ||
4166 | |||
4167 | if (evt.type == 'w-close') { | ||
4168 | return close(data); | ||
4169 | } | ||
4170 | |||
4171 | if (evt.type == 'setting') { | ||
4172 | configure(data); | ||
4173 | options.open === true && open(data, true); | ||
4174 | options.open === false && close(data, true); | ||
4175 | return; | ||
4176 | } | ||
4177 | }; | ||
4178 | } | ||
4179 | |||
4180 | function toggle(data) { | ||
4181 | return _.debounce(function(evt) { | ||
4182 | data.open ? close(data) : open(data); | ||
4183 | }); | ||
4184 | } | ||
4185 | |||
4186 | function open(data, immediate) { | ||
4187 | if (data.open) return; | ||
4188 | closeOthers(data); | ||
4189 | data.open = true; | ||
4190 | data.list.addClass(stateOpen); | ||
4191 | data.toggle.addClass(stateOpen); | ||
4192 | ix.intro(0, data.el[0]); | ||
4193 | |||
4194 | // Listen for tap outside events | ||
4195 | if (!designer) $doc.on('tap' + namespace, data.outside); | ||
4196 | |||
4197 | // Clear previous delay | ||
4198 | window.clearTimeout(data.delayId); | ||
4199 | } | ||
4200 | |||
4201 | function close(data, immediate) { | ||
4202 | if (!data.open) return; | ||
4203 | data.open = false; | ||
4204 | var config = data.config; | ||
4205 | ix.outro(0, data.el[0]); | ||
4206 | |||
4207 | // Stop listening for tap outside events | ||
4208 | $doc.off('tap' + namespace, data.outside); | ||
4209 | |||
4210 | // Clear previous delay | ||
4211 | window.clearTimeout(data.delayId); | ||
4212 | |||
4213 | // Skip delay during immediate | ||
4214 | if (!config.delay || immediate) return data.complete(); | ||
4215 | |||
4216 | // Optionally wait for delay before close | ||
4217 | data.delayId = window.setTimeout(data.complete, config.delay); | ||
4218 | } | ||
4219 | |||
4220 | function closeOthers(data) { | ||
4221 | var self = data.el[0]; | ||
4222 | $dropdowns.each(function(i, other) { | ||
4223 | var $other = $(other); | ||
4224 | if ($other.is(self) || $other.has(self).length) return; | ||
4225 | $other.triggerHandler(closeEvent); | ||
4226 | }); | ||
4227 | } | ||
4228 | |||
4229 | function outside(data) { | ||
4230 | // Unbind previous tap handler if it exists | ||
4231 | if (data.outside) $doc.off('tap' + namespace, data.outside); | ||
4232 | |||
4233 | // Close menu when tapped outside | ||
4234 | return _.debounce(function(evt) { | ||
4235 | if (!data.open) return; | ||
4236 | var $target = $(evt.target); | ||
4237 | if ($target.closest('.w-dropdown-toggle').length) return; | ||
4238 | if (!data.el.is($target.closest(namespace))) { | ||
4239 | close(data); | ||
4240 | } | ||
4241 | }); | ||
4242 | } | ||
4243 | |||
4244 | function complete(data) { | ||
4245 | return function() { | ||
4246 | data.list.removeClass(stateOpen); | ||
4247 | data.toggle.removeClass(stateOpen); | ||
4248 | }; | ||
4249 | } | ||
4250 | |||
4251 | // Export module | ||
4252 | return api; | ||
4253 | }); | ||
4254 | /** | ||
4255 | * ---------------------------------------------------------------------- | ||
4256 | * Webflow: Tabs component | ||
4257 | */ | ||
4258 | Webflow.define('tabs', function($, _) { | ||
4259 | 'use strict'; | ||
4260 | |||
4261 | var api = {}; | ||
4262 | var tram = window.tram; | ||
4263 | var $win = $(window); | ||
4264 | var $doc = $(document); | ||
4265 | var $tabs; | ||
4266 | var design; | ||
4267 | var env = Webflow.env; | ||
4268 | var safari = env.safari; | ||
4269 | var inApp = env(); | ||
4270 | var tabAttr = 'data-w-tab'; | ||
4271 | var namespace = '.w-tabs'; | ||
4272 | var linkCurrent = 'w--current'; | ||
4273 | var tabActive = 'w--tab-active'; | ||
4274 | var ix = Webflow.ixEvents(); | ||
4275 | |||
4276 | // ----------------------------------- | ||
4277 | // Module methods | ||
4278 | |||
4279 | api.ready = api.design = api.preview = init; | ||
4280 | |||
4281 | // ----------------------------------- | ||
4282 | // Private methods | ||
4283 | |||
4284 | function init() { | ||
4285 | design = inApp && Webflow.env('design'); | ||
4286 | |||
4287 | // Find all instances on the page | ||
4288 | $tabs = $doc.find(namespace); | ||
4289 | if (!$tabs.length) return; | ||
4290 | $tabs.each(build); | ||
4291 | } | ||
4292 | |||
4293 | function build(i, el) { | ||
4294 | var $el = $(el); | ||
4295 | |||
4296 | // Store state in data | ||
4297 | var data = $.data(el, namespace); | ||
4298 | if (!data) data = $.data(el, namespace, { | ||
4299 | el: $el, | ||
4300 | config: {} | ||
4301 | }); | ||
4302 | data.current = null; | ||
4303 | data.menu = $el.children('.w-tab-menu'); | ||
4304 | data.links = data.menu.children('.w-tab-link'); | ||
4305 | data.content = $el.children('.w-tab-content'); | ||
4306 | data.panes = data.content.children('.w-tab-pane'); | ||
4307 | |||
4308 | // Remove old events | ||
4309 | data.el.off(namespace); | ||
4310 | data.links.off(namespace); | ||
4311 | |||
4312 | // Set config from data attributes | ||
4313 | configure(data); | ||
4314 | |||
4315 | // Wire up events when not in design mode | ||
4316 | if (!design) { | ||
4317 | data.links.on('click' + namespace, linkSelect(data)); | ||
4318 | |||
4319 | // Trigger first intro event from current tab | ||
4320 | var $link = data.links.filter('.' + linkCurrent); | ||
4321 | var tab = $link.attr(tabAttr); | ||
4322 | tab && changeTab(data, { | ||
4323 | tab: tab, | ||
4324 | immediate: true | ||
4325 | }); | ||
4326 | } | ||
4327 | } | ||
4328 | |||
4329 | function configure(data) { | ||
4330 | var config = {}; | ||
4331 | var old = data.config || {}; | ||
4332 | |||
4333 | // Set config options from data attributes | ||
4334 | config.easing = data.el.attr('data-easing') || 'ease'; | ||
4335 | |||
4336 | var intro = +data.el.attr('data-duration-in'); | ||
4337 | intro = config.intro = intro === intro ? intro : 0; | ||
4338 | |||
4339 | var outro = +data.el.attr('data-duration-out'); | ||
4340 | outro = config.outro = outro === outro ? outro : 0; | ||
4341 | |||
4342 | config.immediate = !intro && !outro; | ||
4343 | |||
4344 | // Store config in data | ||
4345 | data.config = config; | ||
4346 | } | ||
4347 | |||
4348 | function linkSelect(data) { | ||
4349 | return function(evt) { | ||
4350 | var tab = evt.currentTarget.getAttribute(tabAttr); | ||
4351 | tab && changeTab(data, { | ||
4352 | tab: tab | ||
4353 | }); | ||
4354 | }; | ||
4355 | } | ||
4356 | |||
4357 | function changeTab(data, options) { | ||
4358 | options = options || {}; | ||
4359 | |||
4360 | var config = data.config; | ||
4361 | var easing = config.easing; | ||
4362 | var tab = options.tab; | ||
4363 | |||
4364 | // Don't select the same tab twice | ||
4365 | if (tab === data.current) return; | ||
4366 | data.current = tab; | ||
4367 | |||
4368 | // Select the current link | ||
4369 | data.links.each(function(i, el) { | ||
4370 | var $el = $(el); | ||
4371 | if (el.getAttribute(tabAttr) === tab) $el.addClass(linkCurrent).each(ix.intro); | ||
4372 | else if ($el.hasClass(linkCurrent)) $el.removeClass(linkCurrent).each(ix.outro); | ||
4373 | }); | ||
4374 | |||
4375 | // Find the new tab panes and keep track of previous | ||
4376 | var targets = []; | ||
4377 | var previous = []; | ||
4378 | data.panes.each(function(i, el) { | ||
4379 | var $el = $(el); | ||
4380 | if (el.getAttribute(tabAttr) === tab) { | ||
4381 | targets.push(el); | ||
4382 | } else if ($el.hasClass(tabActive)) { | ||
4383 | previous.push(el); | ||
4384 | } | ||
4385 | }); | ||
4386 | |||
4387 | var $targets = $(targets); | ||
4388 | var $previous = $(previous); | ||
4389 | |||
4390 | // Switch tabs immediately and bypass transitions | ||
4391 | if (options.immediate || config.immediate) { | ||
4392 | $targets.addClass(tabActive).each(ix.intro); | ||
4393 | $previous.removeClass(tabActive); | ||
4394 | Webflow.redraw.up(); | ||
4395 | return; | ||
4396 | } | ||
4397 | |||
4398 | // Fade out the currently active tab before intro | ||
4399 | if ($previous.length && config.outro) { | ||
4400 | $previous.each(ix.outro); | ||
4401 | tram($previous) | ||
4402 | .add('opacity ' + config.outro + 'ms ' + easing, { | ||
4403 | fallback: safari | ||
4404 | }) | ||
4405 | .start({ | ||
4406 | opacity: 0 | ||
4407 | }) | ||
4408 | .then(intro); | ||
4409 | } else { | ||
4410 | // Skip the outro and play intro | ||
4411 | intro(); | ||
4412 | } | ||
4413 | |||
4414 | // Fade in the new target | ||
4415 | function intro() { | ||
4416 | // Clear previous active class + inline style | ||
4417 | $previous.removeClass(tabActive).removeAttr('style'); | ||
4418 | |||
4419 | // Add active class to new target | ||
4420 | $targets.addClass(tabActive).each(ix.intro); | ||
4421 | Webflow.redraw.up(); | ||
4422 | |||
4423 | // Set opacity immediately if intro is zero | ||
4424 | if (!config.intro) return tram($targets).set({ | ||
4425 | opacity: 1 | ||
4426 | }); | ||
4427 | |||
4428 | // Otherwise fade in opacity | ||
4429 | tram($targets) | ||
4430 | .set({ | ||
4431 | opacity: 0 | ||
4432 | }) | ||
4433 | .redraw() | ||
4434 | .add('opacity ' + config.intro + 'ms ' + easing, { | ||
4435 | fallback: safari | ||
4436 | }) | ||
4437 | .start({ | ||
4438 | opacity: 1 | ||
4439 | }); | ||
4440 | } | ||
4441 | } | ||
4442 | |||
4443 | // Export module | ||
4444 | return api; | ||
4445 | }); \ No newline at end of file | ||
diff --git a/deprecated/ZJW/javascripts/webfont.js b/deprecated/ZJW/javascripts/webfont.js new file mode 100644 index 0000000..8518477 --- /dev/null +++ b/deprecated/ZJW/javascripts/webfont.js | |||
@@ -0,0 +1,828 @@ | |||
1 | /* | ||
2 | * Copyright 2013 Small Batch, Inc. | ||
3 | * | ||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
5 | * use this file except in compliance with the License. You may obtain a copy of | ||
6 | * the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
13 | * License for the specific language governing permissions and limitations under | ||
14 | * the License. | ||
15 | */ | ||
16 | ; | ||
17 | (function(window, document, undefined) { | ||
18 | var j = void 0, | ||
19 | k = !0, | ||
20 | l = null, | ||
21 | p = !1; | ||
22 | |||
23 | function q(a) { | ||
24 | return function() { | ||
25 | return this[a] | ||
26 | } | ||
27 | } | ||
28 | var aa = this; | ||
29 | |||
30 | function ba(a, b) { | ||
31 | var c = a.split("."), | ||
32 | d = aa; | ||
33 | !(c[0] in d) && d.execScript && d.execScript("var " + c[0]); | ||
34 | for (var e; c.length && (e = c.shift());)!c.length && b !== j ? d[e] = b : d = d[e] ? d[e] : d[e] = {} | ||
35 | } | ||
36 | aa.Ba = k; | ||
37 | |||
38 | function ca(a, b, c) { | ||
39 | return a.call.apply(a.bind, arguments) | ||
40 | } | ||
41 | |||
42 | function da(a, b, c) { | ||
43 | if (!a) throw Error(); | ||
44 | if (2 < arguments.length) { | ||
45 | var d = Array.prototype.slice.call(arguments, 2); | ||
46 | return function() { | ||
47 | var c = Array.prototype.slice.call(arguments); | ||
48 | Array.prototype.unshift.apply(c, d); | ||
49 | return a.apply(b, c) | ||
50 | } | ||
51 | } | ||
52 | return function() { | ||
53 | return a.apply(b, arguments) | ||
54 | } | ||
55 | } | ||
56 | |||
57 | function s(a, b, c) { | ||
58 | s = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? ca : da; | ||
59 | return s.apply(l, arguments) | ||
60 | } | ||
61 | var ea = Date.now || function() { | ||
62 | return +new Date | ||
63 | }; | ||
64 | |||
65 | function fa(a, b) { | ||
66 | this.G = a; | ||
67 | this.u = b || a; | ||
68 | this.z = this.u.document; | ||
69 | this.R = j | ||
70 | } | ||
71 | fa.prototype.createElement = function(a, b, c) { | ||
72 | a = this.z.createElement(a); | ||
73 | if (b) | ||
74 | for (var d in b) | ||
75 | if (b.hasOwnProperty(d)) | ||
76 | if ("style" == d) { | ||
77 | var e = a, | ||
78 | f = b[d]; | ||
79 | ga(this) ? e.setAttribute("style", f) : e.style.cssText = f | ||
80 | } else a.setAttribute(d, b[d]); | ||
81 | c && a.appendChild(this.z.createTextNode(c)); | ||
82 | return a | ||
83 | }; | ||
84 | |||
85 | function t(a, b, c) { | ||
86 | a = a.z.getElementsByTagName(b)[0]; | ||
87 | a || (a = document.documentElement); | ||
88 | a && a.lastChild && a.insertBefore(c, a.lastChild) | ||
89 | } | ||
90 | |||
91 | function u(a, b) { | ||
92 | return a.createElement("link", { | ||
93 | rel: "stylesheet", | ||
94 | href: b | ||
95 | }) | ||
96 | } | ||
97 | |||
98 | function ha(a, b) { | ||
99 | return a.createElement("script", { | ||
100 | src: b | ||
101 | }) | ||
102 | } | ||
103 | |||
104 | function v(a, b) { | ||
105 | for (var c = a.className.split(/\s+/), d = 0, e = c.length; d < e; d++) | ||
106 | if (c[d] == b) return; | ||
107 | c.push(b); | ||
108 | a.className = c.join(" ").replace(/\s+/g, " ").replace(/^\s+|\s+$/, "") | ||
109 | } | ||
110 | |||
111 | function w(a, b) { | ||
112 | for (var c = a.className.split(/\s+/), d = [], e = 0, f = c.length; e < f; e++) c[e] != b && d.push(c[e]); | ||
113 | a.className = d.join(" ").replace(/\s+/g, " ").replace(/^\s+|\s+$/, "") | ||
114 | } | ||
115 | |||
116 | function ia(a, b) { | ||
117 | for (var c = a.className.split(/\s+/), d = 0, e = c.length; d < e; d++) | ||
118 | if (c[d] == b) return k; | ||
119 | return p | ||
120 | } | ||
121 | |||
122 | function ga(a) { | ||
123 | if (a.R === j) { | ||
124 | var b = a.z.createElement("p"); | ||
125 | b.innerHTML = '<a style="top:1px;">w</a>'; | ||
126 | a.R = /top/.test(b.getElementsByTagName("a")[0].getAttribute("style")) | ||
127 | } | ||
128 | return a.R | ||
129 | } | ||
130 | |||
131 | function x(a) { | ||
132 | var b = a.u.location.protocol; | ||
133 | "about:" == b && (b = a.G.location.protocol); | ||
134 | return "https:" == b ? "https:" : "http:" | ||
135 | }; | ||
136 | |||
137 | function y(a, b, c) { | ||
138 | this.w = a; | ||
139 | this.T = b; | ||
140 | this.Aa = c | ||
141 | } | ||
142 | ba("webfont.BrowserInfo", y); | ||
143 | y.prototype.qa = q("w"); | ||
144 | y.prototype.hasWebFontSupport = y.prototype.qa; | ||
145 | y.prototype.ra = q("T"); | ||
146 | y.prototype.hasWebKitFallbackBug = y.prototype.ra; | ||
147 | y.prototype.sa = q("Aa"); | ||
148 | y.prototype.hasWebKitMetricsBug = y.prototype.sa; | ||
149 | |||
150 | function z(a, b, c, d) { | ||
151 | this.e = a != l ? a : l; | ||
152 | this.o = b != l ? b : l; | ||
153 | this.ba = c != l ? c : l; | ||
154 | this.f = d != l ? d : l | ||
155 | } | ||
156 | var ja = /^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/; | ||
157 | z.prototype.toString = function() { | ||
158 | return [this.e, this.o || "", this.ba || "", this.f || ""].join("") | ||
159 | }; | ||
160 | |||
161 | function A(a) { | ||
162 | a = ja.exec(a); | ||
163 | var b = l, | ||
164 | c = l, | ||
165 | d = l, | ||
166 | e = l; | ||
167 | a && (a[1] !== l && a[1] && (b = parseInt(a[1], 10)), a[2] !== l && a[2] && (c = parseInt(a[2], 10)), a[3] !== l && a[3] && (d = parseInt(a[3], 10)), a[4] !== l && a[4] && (e = /^[0-9]+$/.test(a[4]) ? parseInt(a[4], 10) : a[4])); | ||
168 | return new z(b, c, d, e) | ||
169 | }; | ||
170 | |||
171 | function B(a, b, c, d, e, f, g, h, n, m, r) { | ||
172 | this.J = a; | ||
173 | this.Ha = b; | ||
174 | this.za = c; | ||
175 | this.ga = d; | ||
176 | this.Fa = e; | ||
177 | this.fa = f; | ||
178 | this.xa = g; | ||
179 | this.Ga = h; | ||
180 | this.wa = n; | ||
181 | this.ea = m; | ||
182 | this.k = r | ||
183 | } | ||
184 | ba("webfont.UserAgent", B); | ||
185 | B.prototype.getName = q("J"); | ||
186 | B.prototype.getName = B.prototype.getName; | ||
187 | B.prototype.pa = q("za"); | ||
188 | B.prototype.getVersion = B.prototype.pa; | ||
189 | B.prototype.la = q("ga"); | ||
190 | B.prototype.getEngine = B.prototype.la; | ||
191 | B.prototype.ma = q("fa"); | ||
192 | B.prototype.getEngineVersion = B.prototype.ma; | ||
193 | B.prototype.na = q("xa"); | ||
194 | B.prototype.getPlatform = B.prototype.na; | ||
195 | B.prototype.oa = q("wa"); | ||
196 | B.prototype.getPlatformVersion = B.prototype.oa; | ||
197 | B.prototype.ka = q("ea"); | ||
198 | B.prototype.getDocumentMode = B.prototype.ka; | ||
199 | B.prototype.ja = q("k"); | ||
200 | B.prototype.getBrowserInfo = B.prototype.ja; | ||
201 | |||
202 | function C(a, b) { | ||
203 | this.a = a; | ||
204 | this.H = b | ||
205 | } | ||
206 | var ka = new B("Unknown", new z, "Unknown", "Unknown", new z, "Unknown", "Unknown", new z, "Unknown", j, new y(p, p, p)); | ||
207 | C.prototype.parse = function() { | ||
208 | var a; | ||
209 | if (-1 != this.a.indexOf("MSIE")) { | ||
210 | a = D(this); | ||
211 | var b = E(this), | ||
212 | c = A(b), | ||
213 | d = F(this.a, /MSIE ([\d\w\.]+)/, 1), | ||
214 | e = A(d); | ||
215 | a = new B("MSIE", e, d, "MSIE", e, d, a, c, b, G(this.H), new y("Windows" == a && 6 <= e.e || "Windows Phone" == a && 8 <= c.e, p, p)) | ||
216 | } else if (-1 != this.a.indexOf("Opera")) a: { | ||
217 | a = "Unknown"; | ||
218 | var b = F(this.a, /Presto\/([\d\w\.]+)/, 1), | ||
219 | c = A(b), | ||
220 | d = E(this), | ||
221 | e = A(d), | ||
222 | f = G(this.H); | ||
223 | c.e !== l ? a = "Presto" : (-1 != this.a.indexOf("Gecko") && (a = "Gecko"), b = F(this.a, /rv:([^\)]+)/, 1), c = A(b)); | ||
224 | if (-1 != this.a.indexOf("Opera Mini/")) { | ||
225 | var g = | ||
226 | F(this.a, /Opera Mini\/([\d\.]+)/, 1), | ||
227 | h = A(g); | ||
228 | a = new B("OperaMini", h, g, a, c, b, D(this), e, d, f, new y(p, p, p)) | ||
229 | } else { | ||
230 | if (-1 != this.a.indexOf("Version/") && (g = F(this.a, /Version\/([\d\.]+)/, 1), h = A(g), h.e !== l)) { | ||
231 | a = new B("Opera", h, g, a, c, b, D(this), e, d, f, new y(10 <= h.e, p, p)); | ||
232 | break a | ||
233 | } | ||
234 | g = F(this.a, /Opera[\/ ]([\d\.]+)/, 1); | ||
235 | h = A(g); | ||
236 | a = h.e !== l ? new B("Opera", h, g, a, c, b, D(this), e, d, f, new y(10 <= h.e, p, p)) : new B("Opera", new z, "Unknown", a, c, b, D(this), e, d, f, new y(p, p, p)) | ||
237 | } | ||
238 | } else if (/AppleWeb(K|k)it/.test(this.a)) { | ||
239 | a = D(this); | ||
240 | var b = E(this), | ||
241 | c = A(b), | ||
242 | d = F(this.a, /AppleWeb(?:K|k)it\/([\d\.\+]+)/, 1), | ||
243 | e = A(d), | ||
244 | f = "Unknown", | ||
245 | g = new z, | ||
246 | h = "Unknown", | ||
247 | n = p; - 1 != this.a.indexOf("Chrome") || -1 != this.a.indexOf("CrMo") || -1 != this.a.indexOf("CriOS") ? f = "Chrome" : /Silk\/\d/.test(this.a) ? f = "Silk" : "BlackBerry" == a || "Android" == a ? f = "BuiltinBrowser" : -1 != this.a.indexOf("Safari") ? f = "Safari" : -1 != this.a.indexOf("AdobeAIR") && (f = "AdobeAIR"); | ||
248 | "BuiltinBrowser" == f ? h = "Unknown" : "Silk" == f ? h = F(this.a, /Silk\/([\d\._]+)/, 1) : "Chrome" == f ? h = F(this.a, /(Chrome|CrMo|CriOS)\/([\d\.]+)/, 2) : -1 != | ||
249 | this.a.indexOf("Version/") ? h = F(this.a, /Version\/([\d\.\w]+)/, 1) : "AdobeAIR" == f && (h = F(this.a, /AdobeAIR\/([\d\.]+)/, 1)); | ||
250 | g = A(h); | ||
251 | n = "AdobeAIR" == f ? 2 < g.e || 2 == g.e && 5 <= g.o : "BlackBerry" == a ? 10 <= c.e : "Android" == a ? 2 < c.e || 2 == c.e && 1 < c.o : 526 <= e.e || 525 <= e.e && 13 <= e.o; | ||
252 | a = new B(f, g, h, "AppleWebKit", e, d, a, c, b, G(this.H), new y(n, 536 > e.e || 536 == e.e && 11 > e.o, "iPhone" == a || "iPad" == a || "iPod" == a || "Macintosh" == a)) | ||
253 | } else -1 != this.a.indexOf("Gecko") ? (a = "Unknown", b = new z, c = "Unknown", d = E(this), e = A(d), f = p, -1 != this.a.indexOf("Firefox") ? (a = | ||
254 | "Firefox", c = F(this.a, /Firefox\/([\d\w\.]+)/, 1), b = A(c), f = 3 <= b.e && 5 <= b.o) : -1 != this.a.indexOf("Mozilla") && (a = "Mozilla"), g = F(this.a, /rv:([^\)]+)/, 1), h = A(g), f || (f = 1 < h.e || 1 == h.e && 9 < h.o || 1 == h.e && 9 == h.o && 2 <= h.ba || g.match(/1\.9\.1b[123]/) != l || g.match(/1\.9\.1\.[\d\.]+/) != l), a = new B(a, b, c, "Gecko", h, g, D(this), e, d, G(this.H), new y(f, p, p))) : a = ka; | ||
255 | return a | ||
256 | }; | ||
257 | |||
258 | function D(a) { | ||
259 | var b = F(a.a, /(iPod|iPad|iPhone|Android|Windows Phone|BB\d{2}|BlackBerry)/, 1); | ||
260 | if ("" != b) return /BB\d{2}/.test(b) && (b = "BlackBerry"), b; | ||
261 | a = F(a.a, /(Linux|Mac_PowerPC|Macintosh|Windows|CrOS)/, 1); | ||
262 | return "" != a ? ("Mac_PowerPC" == a && (a = "Macintosh"), a) : "Unknown" | ||
263 | } | ||
264 | |||
265 | function E(a) { | ||
266 | var b = F(a.a, /(OS X|Windows NT|Android) ([^;)]+)/, 2); | ||
267 | if (b || (b = F(a.a, /Windows Phone( OS)? ([^;)]+)/, 2)) || (b = F(a.a, /(iPhone )?OS ([\d_]+)/, 2))) return b; | ||
268 | if (b = F(a.a, /(?:Linux|CrOS) ([^;)]+)/, 1)) | ||
269 | for (var b = b.split(/\s/), c = 0; c < b.length; c += 1) | ||
270 | if (/^[\d\._]+$/.test(b[c])) return b[c]; | ||
271 | return (a = F(a.a, /(BB\d{2}|BlackBerry).*?Version\/([^\s]*)/, 2)) ? a : "Unknown" | ||
272 | } | ||
273 | |||
274 | function F(a, b, c) { | ||
275 | return (a = a.match(b)) && a[c] ? a[c] : "" | ||
276 | } | ||
277 | |||
278 | function G(a) { | ||
279 | if (a.documentMode) return a.documentMode | ||
280 | }; | ||
281 | |||
282 | function la(a) { | ||
283 | this.va = a || "-" | ||
284 | } | ||
285 | la.prototype.f = function(a) { | ||
286 | for (var b = [], c = 0; c < arguments.length; c++) b.push(arguments[c].replace(/[\W_]+/g, "").toLowerCase()); | ||
287 | return b.join(this.va) | ||
288 | }; | ||
289 | |||
290 | function H(a, b) { | ||
291 | this.J = a; | ||
292 | this.U = 4; | ||
293 | this.K = "n"; | ||
294 | var c = (b || "n4").match(/^([nio])([1-9])$/i); | ||
295 | c && (this.K = c[1], this.U = parseInt(c[2], 10)) | ||
296 | } | ||
297 | H.prototype.getName = q("J"); | ||
298 | |||
299 | function I(a) { | ||
300 | return a.K + a.U | ||
301 | } | ||
302 | |||
303 | function ma(a) { | ||
304 | var b = 4, | ||
305 | c = "n", | ||
306 | d = l; | ||
307 | a && ((d = a.match(/(normal|oblique|italic)/i)) && d[1] && (c = d[1].substr(0, 1).toLowerCase()), (d = a.match(/([1-9]00|normal|bold)/i)) && d[1] && (/bold/i.test(d[1]) ? b = 7 : /[1-9]00/.test(d[1]) && (b = parseInt(d[1].substr(0, 1), 10)))); | ||
308 | return c + b | ||
309 | }; | ||
310 | |||
311 | function na(a, b, c) { | ||
312 | this.c = a; | ||
313 | this.h = b; | ||
314 | this.M = c; | ||
315 | this.j = "wf"; | ||
316 | this.g = new la("-") | ||
317 | } | ||
318 | |||
319 | function pa(a) { | ||
320 | v(a.h, a.g.f(a.j, "loading")); | ||
321 | J(a, "loading") | ||
322 | } | ||
323 | |||
324 | function K(a) { | ||
325 | w(a.h, a.g.f(a.j, "loading")); | ||
326 | ia(a.h, a.g.f(a.j, "active")) || v(a.h, a.g.f(a.j, "inactive")); | ||
327 | J(a, "inactive") | ||
328 | } | ||
329 | |||
330 | function J(a, b, c) { | ||
331 | if (a.M[b]) | ||
332 | if (c) a.M[b](c.getName(), I(c)); | ||
333 | else a.M[b]() | ||
334 | }; | ||
335 | |||
336 | function L(a, b) { | ||
337 | this.c = a; | ||
338 | this.C = b; | ||
339 | this.s = this.c.createElement("span", { | ||
340 | "aria-hidden": "true" | ||
341 | }, this.C) | ||
342 | } | ||
343 | |||
344 | function M(a, b) { | ||
345 | var c = a.s, | ||
346 | d; | ||
347 | d = []; | ||
348 | for (var e = b.J.split(/,\s*/), f = 0; f < e.length; f++) { | ||
349 | var g = e[f].replace(/['"]/g, ""); - 1 == g.indexOf(" ") ? d.push(g) : d.push("'" + g + "'") | ||
350 | } | ||
351 | d = d.join(","); | ||
352 | e = "normal"; | ||
353 | f = b.U + "00"; | ||
354 | "o" === b.K ? e = "oblique" : "i" === b.K && (e = "italic"); | ||
355 | d = "position:absolute;top:-999px;left:-999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:" + d + ";" + ("font-style:" + e + ";font-weight:" + f + ";"); | ||
356 | ga(a.c) ? c.setAttribute("style", d) : c.style.cssText = | ||
357 | d | ||
358 | } | ||
359 | |||
360 | function N(a) { | ||
361 | t(a.c, "body", a.s) | ||
362 | } | ||
363 | L.prototype.remove = function() { | ||
364 | var a = this.s; | ||
365 | a.parentNode && a.parentNode.removeChild(a) | ||
366 | }; | ||
367 | |||
368 | function qa(a, b, c, d, e, f, g, h) { | ||
369 | this.V = a; | ||
370 | this.ta = b; | ||
371 | this.c = c; | ||
372 | this.q = d; | ||
373 | this.C = h || "BESbswy"; | ||
374 | this.k = e; | ||
375 | this.F = {}; | ||
376 | this.S = f || 5E3; | ||
377 | this.Z = g || l; | ||
378 | this.B = this.A = l; | ||
379 | a = new L(this.c, this.C); | ||
380 | N(a); | ||
381 | for (var n in O) O.hasOwnProperty(n) && (M(a, new H(O[n], I(this.q))), this.F[O[n]] = a.s.offsetWidth); | ||
382 | a.remove() | ||
383 | } | ||
384 | var O = { | ||
385 | Ea: "serif", | ||
386 | Da: "sans-serif", | ||
387 | Ca: "monospace" | ||
388 | }; | ||
389 | qa.prototype.start = function() { | ||
390 | this.A = new L(this.c, this.C); | ||
391 | N(this.A); | ||
392 | this.B = new L(this.c, this.C); | ||
393 | N(this.B); | ||
394 | this.ya = ea(); | ||
395 | M(this.A, new H(this.q.getName() + ",serif", I(this.q))); | ||
396 | M(this.B, new H(this.q.getName() + ",sans-serif", I(this.q))); | ||
397 | ra(this) | ||
398 | }; | ||
399 | |||
400 | function sa(a, b, c) { | ||
401 | for (var d in O) | ||
402 | if (O.hasOwnProperty(d) && b === a.F[O[d]] && c === a.F[O[d]]) return k; | ||
403 | return p | ||
404 | } | ||
405 | |||
406 | function ra(a) { | ||
407 | var b = a.A.s.offsetWidth, | ||
408 | c = a.B.s.offsetWidth; | ||
409 | b === a.F.serif && c === a.F["sans-serif"] || a.k.T && sa(a, b, c) ? ea() - a.ya >= a.S ? a.k.T && sa(a, b, c) && (a.Z === l || a.Z.hasOwnProperty(a.q.getName())) ? P(a, a.V) : P(a, a.ta) : setTimeout(s(function() { | ||
410 | ra(this) | ||
411 | }, a), 25) : P(a, a.V) | ||
412 | } | ||
413 | |||
414 | function P(a, b) { | ||
415 | a.A.remove(); | ||
416 | a.B.remove(); | ||
417 | b(a.q) | ||
418 | }; | ||
419 | |||
420 | function R(a, b, c, d) { | ||
421 | this.c = b; | ||
422 | this.t = c; | ||
423 | this.N = 0; | ||
424 | this.ca = this.Y = p; | ||
425 | this.S = d; | ||
426 | this.k = a.k | ||
427 | } | ||
428 | |||
429 | function ta(a, b, c, d, e) { | ||
430 | if (0 === b.length && e) K(a.t); | ||
431 | else { | ||
432 | a.N += b.length; | ||
433 | e && (a.Y = e); | ||
434 | for (e = 0; e < b.length; e++) { | ||
435 | var f = b[e], | ||
436 | g = c[f.getName()], | ||
437 | h = a.t, | ||
438 | n = f; | ||
439 | v(h.h, h.g.f(h.j, n.getName(), I(n).toString(), "loading")); | ||
440 | J(h, "fontloading", n); | ||
441 | (new qa(s(a.ha, a), s(a.ia, a), a.c, f, a.k, a.S, d, g)).start() | ||
442 | } | ||
443 | } | ||
444 | } | ||
445 | R.prototype.ha = function(a) { | ||
446 | var b = this.t; | ||
447 | w(b.h, b.g.f(b.j, a.getName(), I(a).toString(), "loading")); | ||
448 | w(b.h, b.g.f(b.j, a.getName(), I(a).toString(), "inactive")); | ||
449 | v(b.h, b.g.f(b.j, a.getName(), I(a).toString(), "active")); | ||
450 | J(b, "fontactive", a); | ||
451 | this.ca = k; | ||
452 | ua(this) | ||
453 | }; | ||
454 | R.prototype.ia = function(a) { | ||
455 | var b = this.t; | ||
456 | w(b.h, b.g.f(b.j, a.getName(), I(a).toString(), "loading")); | ||
457 | ia(b.h, b.g.f(b.j, a.getName(), I(a).toString(), "active")) || v(b.h, b.g.f(b.j, a.getName(), I(a).toString(), "inactive")); | ||
458 | J(b, "fontinactive", a); | ||
459 | ua(this) | ||
460 | }; | ||
461 | |||
462 | function ua(a) { | ||
463 | 0 == --a.N && a.Y && (a.ca ? (a = a.t, w(a.h, a.g.f(a.j, "loading")), w(a.h, a.g.f(a.j, "inactive")), v(a.h, a.g.f(a.j, "active")), J(a, "active")) : K(a.t)) | ||
464 | }; | ||
465 | |||
466 | function S(a, b, c) { | ||
467 | this.G = a; | ||
468 | this.W = b; | ||
469 | this.a = c; | ||
470 | this.O = this.P = 0 | ||
471 | } | ||
472 | |||
473 | function T(a, b) { | ||
474 | U.W.$[a] = b | ||
475 | } | ||
476 | S.prototype.load = function(a) { | ||
477 | var b = a.context || this.G; | ||
478 | this.c = new fa(this.G, b); | ||
479 | b = new na(this.c, b.document.documentElement, a); | ||
480 | if (this.a.k.w) { | ||
481 | var c = this.W, | ||
482 | d = this.c, | ||
483 | e = [], | ||
484 | f; | ||
485 | for (f in a) | ||
486 | if (a.hasOwnProperty(f)) { | ||
487 | var g = c.$[f]; | ||
488 | g && e.push(g(a[f], d)) | ||
489 | } | ||
490 | a = a.timeout; | ||
491 | this.O = this.P = e.length; | ||
492 | a = new R(this.a, this.c, b, a); | ||
493 | f = 0; | ||
494 | for (c = e.length; f < c; f++) d = e[f], d.v(this.a, s(this.ua, this, d, b, a)) | ||
495 | } else K(b) | ||
496 | }; | ||
497 | S.prototype.ua = function(a, b, c, d) { | ||
498 | var e = this; | ||
499 | d ? a.load(function(a, d, h) { | ||
500 | var n = 0 == --e.P; | ||
501 | n && pa(b); | ||
502 | setTimeout(function() { | ||
503 | ta(c, a, d || {}, h || l, n) | ||
504 | }, 0) | ||
505 | }) : (a = 0 == --this.P, this.O--, a && (0 == this.O ? K(b) : pa(b)), ta(c, [], {}, l, a)) | ||
506 | }; | ||
507 | var va = window, | ||
508 | wa = (new C(navigator.userAgent, document)).parse(), | ||
509 | U = va.WebFont = new S(window, new function() { | ||
510 | this.$ = {} | ||
511 | }, wa); | ||
512 | U.load = U.load; | ||
513 | |||
514 | function V(a, b) { | ||
515 | this.c = a; | ||
516 | this.d = b | ||
517 | } | ||
518 | V.prototype.load = function(a) { | ||
519 | var b, c, d = this.d.urls || [], | ||
520 | e = this.d.families || []; | ||
521 | b = 0; | ||
522 | for (c = d.length; b < c; b++) t(this.c, "head", u(this.c, d[b])); | ||
523 | d = []; | ||
524 | b = 0; | ||
525 | for (c = e.length; b < c; b++) { | ||
526 | var f = e[b].split(":"); | ||
527 | if (f[1]) | ||
528 | for (var g = f[1].split(","), h = 0; h < g.length; h += 1) d.push(new H(f[0], g[h])); | ||
529 | else d.push(new H(f[0])) | ||
530 | } | ||
531 | a(d) | ||
532 | }; | ||
533 | V.prototype.v = function(a, b) { | ||
534 | return b(a.k.w) | ||
535 | }; | ||
536 | T("custom", function(a, b) { | ||
537 | return new V(b, a) | ||
538 | }); | ||
539 | |||
540 | function W(a, b) { | ||
541 | this.c = a; | ||
542 | this.d = b | ||
543 | } | ||
544 | var xa = { | ||
545 | regular: "n4", | ||
546 | bold: "n7", | ||
547 | italic: "i4", | ||
548 | bolditalic: "i7", | ||
549 | r: "n4", | ||
550 | b: "n7", | ||
551 | i: "i4", | ||
552 | bi: "i7" | ||
553 | }; | ||
554 | W.prototype.v = function(a, b) { | ||
555 | return b(a.k.w) | ||
556 | }; | ||
557 | W.prototype.load = function(a) { | ||
558 | t(this.c, "head", u(this.c, x(this.c) + "//webfonts.fontslive.com/css/" + this.d.key + ".css")); | ||
559 | for (var b = this.d.families, c = [], d = 0, e = b.length; d < e; d++) c.push.apply(c, ya(b[d])); | ||
560 | a(c) | ||
561 | }; | ||
562 | |||
563 | function ya(a) { | ||
564 | var b = a.split(":"); | ||
565 | a = b[0]; | ||
566 | if (b[1]) { | ||
567 | for (var c = b[1].split(","), b = [], d = 0, e = c.length; d < e; d++) { | ||
568 | var f = c[d]; | ||
569 | if (f) { | ||
570 | var g = xa[f]; | ||
571 | b.push(g ? g : f) | ||
572 | } | ||
573 | } | ||
574 | c = []; | ||
575 | for (d = 0; d < b.length; d += 1) c.push(new H(a, b[d])); | ||
576 | return c | ||
577 | } | ||
578 | return [new H(a)] | ||
579 | } | ||
580 | T("ascender", function(a, b) { | ||
581 | return new W(b, a) | ||
582 | }); | ||
583 | |||
584 | function X(a, b, c) { | ||
585 | this.a = a; | ||
586 | this.c = b; | ||
587 | this.d = c; | ||
588 | this.m = [] | ||
589 | } | ||
590 | X.prototype.v = function(a, b) { | ||
591 | var c = this, | ||
592 | d = c.d.projectId, | ||
593 | e = c.d.version; | ||
594 | if (d) { | ||
595 | var f = c.c.u, | ||
596 | g = c.c.createElement("script"); | ||
597 | g.id = "__MonotypeAPIScript__" + d; | ||
598 | var h = p; | ||
599 | g.onload = g.onreadystatechange = function() { | ||
600 | if (!h && (!this.readyState || "loaded" === this.readyState || "complete" === this.readyState)) { | ||
601 | h = k; | ||
602 | if (f["__mti_fntLst" + d]) { | ||
603 | var e = f["__mti_fntLst" + d](); | ||
604 | if (e) | ||
605 | for (var m = 0; m < e.length; m++) c.m.push(new H(e[m].fontfamily)) | ||
606 | } | ||
607 | b(a.k.w); | ||
608 | g.onload = g.onreadystatechange = l | ||
609 | } | ||
610 | }; | ||
611 | g.src = c.D(d, e); | ||
612 | t(this.c, "head", g) | ||
613 | } else b(k) | ||
614 | }; | ||
615 | X.prototype.D = function(a, b) { | ||
616 | var c = x(this.c), | ||
617 | d = (this.d.api || "fast.fonts.com/jsapi").replace(/^.*http(s?):(\/\/)?/, ""); | ||
618 | return c + "//" + d + "/" + a + ".js" + (b ? "?v=" + b : "") | ||
619 | }; | ||
620 | X.prototype.load = function(a) { | ||
621 | a(this.m) | ||
622 | }; | ||
623 | T("monotype", function(a, b) { | ||
624 | var c = (new C(navigator.userAgent, document)).parse(); | ||
625 | return new X(c, b, a) | ||
626 | }); | ||
627 | |||
628 | function Y(a, b) { | ||
629 | this.c = a; | ||
630 | this.d = b; | ||
631 | this.m = [] | ||
632 | } | ||
633 | Y.prototype.D = function(a) { | ||
634 | var b = x(this.c); | ||
635 | return (this.d.api || b + "//use.typekit.net") + "/" + a + ".js" | ||
636 | }; | ||
637 | Y.prototype.v = function(a, b) { | ||
638 | var c = this.d.id, | ||
639 | d = this.d, | ||
640 | e = this.c.u, | ||
641 | f = this; | ||
642 | c ? (e.__webfonttypekitmodule__ || (e.__webfonttypekitmodule__ = {}), e.__webfonttypekitmodule__[c] = function(c) { | ||
643 | c(a, d, function(a, c, d) { | ||
644 | for (var e = 0; e < c.length; e += 1) { | ||
645 | var g = d[c[e]]; | ||
646 | if (g) | ||
647 | for (var Q = 0; Q < g.length; Q += 1) f.m.push(new H(c[e], g[Q])); | ||
648 | else f.m.push(new H(c[e])) | ||
649 | } | ||
650 | b(a) | ||
651 | }) | ||
652 | }, c = ha(this.c, this.D(c)), t(this.c, "head", c)) : b(k) | ||
653 | }; | ||
654 | Y.prototype.load = function(a) { | ||
655 | a(this.m) | ||
656 | }; | ||
657 | T("typekit", function(a, b) { | ||
658 | return new Y(b, a) | ||
659 | }); | ||
660 | |||
661 | function za(a, b, c) { | ||
662 | this.L = a ? a : b + Aa; | ||
663 | this.p = []; | ||
664 | this.Q = []; | ||
665 | this.da = c || "" | ||
666 | } | ||
667 | var Aa = "//fonts.googleapis.com/css"; | ||
668 | za.prototype.f = function() { | ||
669 | if (0 == this.p.length) throw Error("No fonts to load !"); | ||
670 | if (-1 != this.L.indexOf("kit=")) return this.L; | ||
671 | for (var a = this.p.length, b = [], c = 0; c < a; c++) b.push(this.p[c].replace(/ /g, "+")); | ||
672 | a = this.L + "?family=" + b.join("%7C"); | ||
673 | 0 < this.Q.length && (a += "&subset=" + this.Q.join(",")); | ||
674 | 0 < this.da.length && (a += "&text=" + encodeURIComponent(this.da)); | ||
675 | return a | ||
676 | }; | ||
677 | |||
678 | function Ba(a) { | ||
679 | this.p = a; | ||
680 | this.aa = []; | ||
681 | this.I = {} | ||
682 | } | ||
683 | var Ca = { | ||
684 | latin: "BESbswy", | ||
685 | cyrillic: "йяЖ", | ||
686 | greek: "αβΣ", | ||
687 | khmer: "កខគ", | ||
688 | Hanuman: "កខគ" | ||
689 | }, | ||
690 | Da = { | ||
691 | thin: "1", | ||
692 | extralight: "2", | ||
693 | "extra-light": "2", | ||
694 | ultralight: "2", | ||
695 | "ultra-light": "2", | ||
696 | light: "3", | ||
697 | regular: "4", | ||
698 | book: "4", | ||
699 | medium: "5", | ||
700 | "semi-bold": "6", | ||
701 | semibold: "6", | ||
702 | "demi-bold": "6", | ||
703 | demibold: "6", | ||
704 | bold: "7", | ||
705 | "extra-bold": "8", | ||
706 | extrabold: "8", | ||
707 | "ultra-bold": "8", | ||
708 | ultrabold: "8", | ||
709 | black: "9", | ||
710 | heavy: "9", | ||
711 | l: "3", | ||
712 | r: "4", | ||
713 | b: "7" | ||
714 | }, | ||
715 | Ea = { | ||
716 | i: "i", | ||
717 | italic: "i", | ||
718 | n: "n", | ||
719 | normal: "n" | ||
720 | }, | ||
721 | Fa = RegExp("^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$"); | ||
722 | Ba.prototype.parse = function() { | ||
723 | for (var a = this.p.length, b = 0; b < a; b++) { | ||
724 | var c = this.p[b].split(":"), | ||
725 | d = c[0].replace(/\+/g, " "), | ||
726 | e = ["n4"]; | ||
727 | if (2 <= c.length) { | ||
728 | var f; | ||
729 | var g = c[1]; | ||
730 | f = []; | ||
731 | if (g) | ||
732 | for (var g = g.split(","), h = g.length, n = 0; n < h; n++) { | ||
733 | var m; | ||
734 | m = g[n]; | ||
735 | if (m.match(/^[\w]+$/)) { | ||
736 | m = Fa.exec(m.toLowerCase()); | ||
737 | var r = j; | ||
738 | if (m == l) r = ""; | ||
739 | else { | ||
740 | r = j; | ||
741 | r = m[1]; | ||
742 | if (r == l || "" == r) r = "4"; | ||
743 | else var oa = Da[r], | ||
744 | r = oa ? oa : isNaN(r) ? "4" : r.substr(0, 1); | ||
745 | r = [m[2] == l || "" == m[2] ? "n" : Ea[m[2]], r].join("") | ||
746 | } | ||
747 | m = r | ||
748 | } else m = ""; | ||
749 | m && f.push(m) | ||
750 | } | ||
751 | 0 < f.length && (e = f); | ||
752 | 3 == c.length && (c = c[2], | ||
753 | f = [], c = !c ? f : c.split(","), 0 < c.length && (c = Ca[c[0]]) && (this.I[d] = c)) | ||
754 | } | ||
755 | this.I[d] || (c = Ca[d]) && (this.I[d] = c); | ||
756 | for (c = 0; c < e.length; c += 1) this.aa.push(new H(d, e[c])) | ||
757 | } | ||
758 | }; | ||
759 | |||
760 | function Z(a, b, c) { | ||
761 | this.a = a; | ||
762 | this.c = b; | ||
763 | this.d = c | ||
764 | } | ||
765 | var Ga = { | ||
766 | Arimo: k, | ||
767 | Cousine: k, | ||
768 | Tinos: k | ||
769 | }; | ||
770 | Z.prototype.v = function(a, b) { | ||
771 | b(a.k.w) | ||
772 | }; | ||
773 | Z.prototype.load = function(a) { | ||
774 | var b = this.c; | ||
775 | if ("MSIE" == this.a.getName() && this.d.blocking != k) { | ||
776 | var c = s(this.X, this, a), | ||
777 | d = function() { | ||
778 | b.z.body ? c() : setTimeout(d, 0) | ||
779 | }; | ||
780 | d() | ||
781 | } else this.X(a) | ||
782 | }; | ||
783 | Z.prototype.X = function(a) { | ||
784 | for (var b = this.c, c = new za(this.d.api, x(b), this.d.text), d = this.d.families, e = d.length, f = 0; f < e; f++) { | ||
785 | var g = d[f].split(":"); | ||
786 | 3 == g.length && c.Q.push(g.pop()); | ||
787 | var h = ""; | ||
788 | 2 == g.length && "" != g[1] && (h = ":"); | ||
789 | c.p.push(g.join(h)) | ||
790 | } | ||
791 | d = new Ba(d); | ||
792 | d.parse(); | ||
793 | t(b, "head", u(b, c.f())); | ||
794 | a(d.aa, d.I, Ga) | ||
795 | }; | ||
796 | T("google", function(a, b) { | ||
797 | var c = (new C(navigator.userAgent, document)).parse(); | ||
798 | return new Z(c, b, a) | ||
799 | }); | ||
800 | |||
801 | function $(a, b) { | ||
802 | this.c = a; | ||
803 | this.d = b; | ||
804 | this.m = [] | ||
805 | } | ||
806 | $.prototype.D = function(a) { | ||
807 | return x(this.c) + (this.d.api || "//f.fontdeck.com/s/css/js/") + (this.c.u.location.hostname || this.c.G.location.hostname) + "/" + a + ".js" | ||
808 | }; | ||
809 | $.prototype.v = function(a, b) { | ||
810 | var c = this.d.id, | ||
811 | d = this.c.u, | ||
812 | e = this; | ||
813 | c ? (d.__webfontfontdeckmodule__ || (d.__webfontfontdeckmodule__ = {}), d.__webfontfontdeckmodule__[c] = function(a, c) { | ||
814 | for (var d = 0, n = c.fonts.length; d < n; ++d) { | ||
815 | var m = c.fonts[d]; | ||
816 | e.m.push(new H(m.name, ma("font-weight:" + m.weight + ";font-style:" + m.style))) | ||
817 | } | ||
818 | b(a) | ||
819 | }, c = ha(this.c, this.D(c)), t(this.c, "head", c)) : b(k) | ||
820 | }; | ||
821 | $.prototype.load = function(a) { | ||
822 | a(this.m) | ||
823 | }; | ||
824 | T("fontdeck", function(a, b) { | ||
825 | return new $(b, a) | ||
826 | }); | ||
827 | window.WebFontConfig && U.load(window.WebFontConfig); | ||
828 | })(this, document); \ No newline at end of file | ||