├── .gitignore ├── app.yaml ├── static ├── tests │ ├── data.xml │ ├── index.html │ └── tests.js ├── license.txt ├── jquery-json.js ├── jstorage.min.js ├── jstorage.js ├── mootools.js └── jquery.js ├── index.yaml ├── views ├── riiframe.html ├── test2.html ├── iframe.html ├── pubsub.html ├── test.html └── main.html └── main.py /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /app.yaml: -------------------------------------------------------------------------------- 1 | application: jstorage-info 2 | version: 1 3 | runtime: python 4 | api_version: 1 5 | 6 | handlers: 7 | 8 | - url: /static 9 | static_dir: static 10 | 11 | - url: .* 12 | script: main.py 13 | -------------------------------------------------------------------------------- /static/tests/data.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Pealkiri 6 | Lingi nimi 7 | Kirjeldus 8 | et 9 | 10 | -------------------------------------------------------------------------------- /index.yaml: -------------------------------------------------------------------------------- 1 | indexes: 2 | 3 | # AUTOGENERATED 4 | 5 | # This index.yaml is automatically updated whenever the dev_appserver 6 | # detects that a new type of query is run. If you want to manage the 7 | # index.yaml file manually, remove the above marker line (the line 8 | # saying "# AUTOGENERATED"). If you want to manage some indexes 9 | # manually, move them above the marker line. The index.yaml file is 10 | # automatically uploaded to the admin console when you next deploy 11 | # your application using appcfg.py. 12 | -------------------------------------------------------------------------------- /static/tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jStorage » QUnit test runner 6 | 7 | 8 | 9 |
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /views/riiframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jStorage - simple JavaScript plugin to store data locally 5 | 6 | 7 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | -------------------------------------------------------------------------------- /static/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Andris Reinman 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 12 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 13 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 14 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 15 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 16 | SOFTWARE. -------------------------------------------------------------------------------- /views/test2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jStorage - simple JavaScript plugin to store data locally 5 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 68 |
DATA SAVED
Current backend: not set
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
Legend:
OKNOT OK
67 |
69 | 70 | 71 | -------------------------------------------------------------------------------- /views/iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jStorage - simple JavaScript plugin to store data locally 5 | 6 | 7 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
AVAILABLE
STRING
OBJECT
XML
INDEX
FLUSH
TEST STORAGE: ? bytes
REINIT
LISTEN (TAKES TIME)
32 | 33 | 34 | 35 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /views/pubsub.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jStorage - simple JavaScript plugin to store data locally 5 | 6 | 7 | 58 | 59 | 60 | 61 | 62 | 63 | 71 | 72 | 73 | 77 | 80 | 81 | 82 | 83 | 84 | 85 |
86 | 87 |

Interactive test - publish/subscribe

88 | 89 |

Open the same page in other tabs or windows of the same browser

90 | 91 |

92 |

93 | 94 | 95 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Google Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | 19 | 20 | 21 | import wsgiref.handlers 22 | from google.appengine.ext import webapp 23 | import os 24 | from google.appengine.ext.webapp import template 25 | 26 | 27 | class MainHandler(webapp.RequestHandler): 28 | 29 | def get(self): 30 | template_values = {} 31 | path = os.path.join(os.path.dirname(__file__), 'views/main.html') 32 | self.response.out.write(template.render(path, template_values)) 33 | 34 | 35 | class AssTestHandler(webapp.RequestHandler): 36 | 37 | def get(self): 38 | template_values = {} 39 | path = os.path.join(os.path.dirname(__file__), 'views/test2.html') 40 | self.response.out.write(template.render(path, template_values)) 41 | 42 | class PubSubHandler(webapp.RequestHandler): 43 | 44 | def get(self): 45 | template_values = {} 46 | path = os.path.join(os.path.dirname(__file__), 'views/pubsub.html') 47 | self.response.out.write(template.render(path, template_values)) 48 | 49 | class IframeHandler(webapp.RequestHandler): 50 | 51 | def get(self): 52 | template_values = {} 53 | path = os.path.join(os.path.dirname(__file__), 'views/iframe.html') 54 | self.response.out.write(template.render(path, template_values)) 55 | 56 | class RIIframeHandler(webapp.RequestHandler): 57 | 58 | def get(self): 59 | template_values = {} 60 | path = os.path.join(os.path.dirname(__file__), 'views/riiframe.html') 61 | self.response.out.write(template.render(path, template_values)) 62 | 63 | class TestHandler(webapp.RequestHandler): 64 | 65 | def get(self): 66 | type = self.request.get("type", "prototype") 67 | if type=="prototype": 68 | curlib = "Prototype 1.6.1" 69 | if type=="mootools": 70 | curlib = "MooTools 1.2.4" 71 | if type=="jquery": 72 | curlib = "jQuery 1.4.2 + jquery-json 2.1" 73 | 74 | template_values = { 75 | "type": type, 76 | "curlib": curlib 77 | } 78 | path = os.path.join(os.path.dirname(__file__), 'views/test.html') 79 | self.response.out.write(template.render(path, template_values)) 80 | 81 | 82 | def main(): 83 | application = webapp.WSGIApplication([('/', MainHandler), 84 | ('/test', TestHandler), 85 | ('/objtest', AssTestHandler), 86 | ('/iframe', IframeHandler), 87 | ('/pubsub', PubSubHandler), 88 | ('/riiframe', RIIframeHandler)], 89 | debug=True) 90 | wsgiref.handlers.CGIHandler().run(application) 91 | 92 | 93 | if __name__ == '__main__': 94 | main() 95 | -------------------------------------------------------------------------------- /views/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jStorage - simple JavaScript plugin to store data locally 5 | 6 | 7 | 58 | 59 | {% ifequal type "mootools" %} 60 | 61 | {% endifequal %}{% ifequal type "jquery" %} 62 | 63 | 64 | {% endifequal %}{% ifequal type "prototype" %} 65 | 66 | {% endifequal %} 67 | 68 | 69 | 70 | 128 | 129 | 130 | 134 | 137 | 138 | 139 | 140 | 141 | 142 |
143 | 144 |

Interactive test

145 |

Add some values and refresh the page - if your browser supports storing local data, then the values should survive the page refresh.

146 | 147 |

Currently using: {{curlib}}
148 | Click to change: Prototype, MooTools or jQuery

149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 |
KEYVALUE 
ADD
Clicking "GET" alerts the value for provided key with the method $.jStorage.get(key)GET
170 | 171 | 172 | -------------------------------------------------------------------------------- /static/tests/tests.js: -------------------------------------------------------------------------------- 1 | test( "backend" , function(){ 2 | ok(!!$.jStorage.currentBackend(), $.jStorage.currentBackend()) 3 | }); 4 | 5 | test( "flush/index", function() { 6 | ok($.jStorage.flush()); 7 | $.jStorage.set("test", "value"); 8 | deepEqual($.jStorage.index(), ["test"]); 9 | ok($.jStorage.flush()); 10 | deepEqual($.jStorage.index(), []); 11 | ok(!$.jStorage.get("test")); 12 | }); 13 | 14 | module( "set" ); 15 | 16 | test("missing", function() { 17 | ok($.jStorage.get("test") === null); 18 | $.jStorage.flush(); 19 | }); 20 | 21 | test("use default", function() { 22 | $.jStorage.set("value exists", "value"); 23 | ok($.jStorage.get("no value", "def") === "def"); 24 | ok($.jStorage.get("value exists", "def") === "value"); 25 | $.jStorage.flush(); 26 | }); 27 | 28 | test("string", function() { 29 | ok($.jStorage.set("test", "value") == "value"); 30 | ok($.jStorage.get("test") == "value"); 31 | $.jStorage.flush(); 32 | }); 33 | 34 | test("boolean", function() { 35 | ok($.jStorage.set("test true", true) === true); 36 | ok($.jStorage.get("test true") === true); 37 | ok($.jStorage.set("test false", false) === false); 38 | ok($.jStorage.get("test false") === false); 39 | $.jStorage.flush(); 40 | }); 41 | 42 | test("number", function() { 43 | ok($.jStorage.set("test", 10.01) === 10.01); 44 | ok($.jStorage.get("test") === 10.01); 45 | $.jStorage.flush(); 46 | }); 47 | 48 | test("obejct", function() { 49 | var testObj = {arr:[1,2,3]}; 50 | deepEqual($.jStorage.set("test", testObj), testObj); 51 | deepEqual($.jStorage.get("test"), testObj); 52 | ok($.jStorage.get("test") != testObj); 53 | $.jStorage.flush(); 54 | }); 55 | 56 | asyncTest( "XML", function() { 57 | var xmlhttp; 58 | 59 | expect(3); 60 | 61 | if (window.XMLHttpRequest){ 62 | xmlhttp = new XMLHttpRequest(); 63 | }else{ 64 | xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 65 | } 66 | 67 | xmlhttp.onreadystatechange=function(){ 68 | if(xmlhttp.readyState==4 && xmlhttp.status==200){ 69 | ok($.jStorage.set("jskey_xml", xmlhttp.responseXML)); 70 | ok($.jStorage.get("jskey_xml") != xmlhttp.responseXML); 71 | ok($.jStorage.get("jskey_xml").getElementsByTagName("title")[0].firstChild.nodeValue == "Pealkiri"); 72 | $.jStorage.flush(); 73 | start(); 74 | } 75 | } 76 | xmlhttp.open("GET","data.xml",true); 77 | xmlhttp.send(); 78 | }); 79 | 80 | asyncTest("TTL", function() { 81 | expect(2); 82 | $.jStorage.set("ttlkey", "value", {TTL:500}); 83 | setTimeout(function(){ 84 | ok($.jStorage.get("ttlkey") == "value"); 85 | setTimeout(function(){ 86 | ok($.jStorage.get("ttlkey") === null); 87 | $.jStorage.flush(); 88 | start(); 89 | }, 500); 90 | }, 250); 91 | }); 92 | 93 | module(); 94 | 95 | asyncTest("setTTL", function() { 96 | expect(2); 97 | $.jStorage.set("ttlkey", "value"); 98 | $.jStorage.setTTL("ttlkey", 500); 99 | setTimeout(function(){ 100 | ok($.jStorage.get("ttlkey") == "value"); 101 | setTimeout(function(){ 102 | ok($.jStorage.get("ttlkey") === null); 103 | $.jStorage.flush(); 104 | start(); 105 | }, 500); 106 | }, 250); 107 | }); 108 | 109 | asyncTest("getTTL", function() { 110 | expect(2); 111 | $.jStorage.set("ttlkey", "value", {TTL: 500}); 112 | setTimeout(function(){ 113 | ok($.jStorage.getTTL("ttlkey") > 0); 114 | setTimeout(function(){ 115 | ok($.jStorage.getTTL("ttlkey") === 0); 116 | $.jStorage.flush(); 117 | start(); 118 | }, 500); 119 | }, 250); 120 | }); 121 | 122 | test("deleteKey", function() { 123 | deepEqual($.jStorage.index(), []); 124 | $.jStorage.set("test", "value"); 125 | deepEqual($.jStorage.index(), ["test"]); 126 | ok($.jStorage.deleteKey("test")); 127 | ok(!$.jStorage.deleteKey("test")); 128 | deepEqual($.jStorage.index(), []); 129 | $.jStorage.flush(); 130 | }); 131 | 132 | asyncTest("publish/subscribe", function() { 133 | expect(2); 134 | $.jStorage.subscribe("testchannel", function(channel, payload){ 135 | ok(channel == "testchannel"); 136 | deepEqual(payload, {arr: [1,2,3]}); 137 | $.jStorage.flush(); 138 | start(); 139 | }); 140 | 141 | setTimeout(function(){ 142 | $.jStorage.publish("testchannel", {arr: [1,2,3]}); 143 | }, 100); 144 | }); 145 | 146 | module("listenKeyChange"); 147 | 148 | asyncTest("specific key - updated", function() { 149 | $.jStorage.listenKeyChange("testkey", function(key, action){ 150 | ok(key == "testkey"); 151 | ok(action == "updated"); 152 | $.jStorage.stopListening("testkey"); 153 | start(); 154 | }); 155 | 156 | setTimeout(function(){ 157 | $.jStorage.set("testkey", "value"); 158 | }, 100); 159 | }); 160 | 161 | asyncTest("specific key - deleted", function() { 162 | $.jStorage.listenKeyChange("testkey", function(key, action){ 163 | ok(key == "testkey"); 164 | ok(action == "deleted"); 165 | $.jStorage.stopListening("testkey"); 166 | $.jStorage.flush(); 167 | start(); 168 | }); 169 | 170 | setTimeout(function(){ 171 | $.jStorage.deleteKey("testkey"); 172 | }, 100); 173 | }); 174 | 175 | asyncTest("all keys - updated", function() { 176 | $.jStorage.listenKeyChange("*", function(key, action){ 177 | ok(key == "testkey"); 178 | ok(action == "updated"); 179 | $.jStorage.stopListening("*"); 180 | start(); 181 | }); 182 | 183 | setTimeout(function(){ 184 | $.jStorage.set("testkey", "value"); 185 | }, 100); 186 | }); 187 | 188 | asyncTest("specific key - deleted", function() { 189 | $.jStorage.listenKeyChange("*", function(key, action){ 190 | ok(key == "testkey"); 191 | ok(action == "deleted"); 192 | $.jStorage.stopListening("*"); 193 | $.jStorage.flush(); 194 | start(); 195 | }); 196 | 197 | setTimeout(function(){ 198 | $.jStorage.deleteKey("testkey"); 199 | }, 100); 200 | }); 201 | -------------------------------------------------------------------------------- /static/jquery-json.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery JSON Plugin 3 | * version: 2.1 (2009-08-14) 4 | * 5 | * This document is licensed as free software under the terms of the 6 | * MIT License: http://www.opensource.org/licenses/mit-license.php 7 | * 8 | * Brantley Harris wrote this plugin. It is based somewhat on the JSON.org 9 | * website's http://www.json.org/json2.js, which proclaims: 10 | * "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that 11 | * I uphold. 12 | * 13 | * It is also influenced heavily by MochiKit's serializeJSON, which is 14 | * copyrighted 2005 by Bob Ippolito. 15 | */ 16 | 17 | (function($) { 18 | /** jQuery.toJSON( json-serializble ) 19 | Converts the given argument into a JSON respresentation. 20 | 21 | If an object has a "toJSON" function, that will be used to get the representation. 22 | Non-integer/string keys are skipped in the object, as are keys that point to a function. 23 | 24 | json-serializble: 25 | The *thing* to be converted. 26 | **/ 27 | $.toJSON = function(o) 28 | { 29 | if (typeof(JSON) == 'object' && JSON.stringify) 30 | return JSON.stringify(o); 31 | 32 | var type = typeof(o); 33 | 34 | if (o === null) 35 | return "null"; 36 | 37 | if (type == "undefined") 38 | return undefined; 39 | 40 | if (type == "number" || type == "boolean") 41 | return o + ""; 42 | 43 | if (type == "string") 44 | return $.quoteString(o); 45 | 46 | if (type == 'object') 47 | { 48 | if (typeof o.toJSON == "function") 49 | return $.toJSON( o.toJSON() ); 50 | 51 | if (o.constructor === Date) 52 | { 53 | var month = o.getUTCMonth() + 1; 54 | if (month < 10) month = '0' + month; 55 | 56 | var day = o.getUTCDate(); 57 | if (day < 10) day = '0' + day; 58 | 59 | var year = o.getUTCFullYear(); 60 | 61 | var hours = o.getUTCHours(); 62 | if (hours < 10) hours = '0' + hours; 63 | 64 | var minutes = o.getUTCMinutes(); 65 | if (minutes < 10) minutes = '0' + minutes; 66 | 67 | var seconds = o.getUTCSeconds(); 68 | if (seconds < 10) seconds = '0' + seconds; 69 | 70 | var milli = o.getUTCMilliseconds(); 71 | if (milli < 100) milli = '0' + milli; 72 | if (milli < 10) milli = '0' + milli; 73 | 74 | return '"' + year + '-' + month + '-' + day + 'T' + 75 | hours + ':' + minutes + ':' + seconds + 76 | '.' + milli + 'Z"'; 77 | } 78 | 79 | if (o.constructor === Array) 80 | { 81 | var ret = []; 82 | for (var i = 0; i < o.length; i++) 83 | ret.push( $.toJSON(o[i]) || "null" ); 84 | 85 | return "[" + ret.join(",") + "]"; 86 | } 87 | 88 | var pairs = []; 89 | for (var k in o) { 90 | var name; 91 | var type = typeof k; 92 | 93 | if (type == "number") 94 | name = '"' + k + '"'; 95 | else if (type == "string") 96 | name = $.quoteString(k); 97 | else 98 | continue; //skip non-string or number keys 99 | 100 | if (typeof o[k] == "function") 101 | continue; //skip pairs where the value is a function. 102 | 103 | var val = $.toJSON(o[k]); 104 | 105 | pairs.push(name + ":" + val); 106 | } 107 | 108 | return "{" + pairs.join(", ") + "}"; 109 | } 110 | }; 111 | 112 | /** jQuery.evalJSON(src) 113 | Evaluates a given piece of json source. 114 | **/ 115 | $.evalJSON = function(src) 116 | { 117 | if (typeof(JSON) == 'object' && JSON.parse) 118 | return JSON.parse(src); 119 | return eval("(" + src + ")"); 120 | }; 121 | 122 | /** jQuery.secureEvalJSON(src) 123 | Evals JSON in a way that is *more* secure. 124 | **/ 125 | $.secureEvalJSON = function(src) 126 | { 127 | if (typeof(JSON) == 'object' && JSON.parse) 128 | return JSON.parse(src); 129 | 130 | var filtered = src; 131 | filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@'); 132 | filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); 133 | filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); 134 | 135 | if (/^[\],:{}\s]*$/.test(filtered)) 136 | return eval("(" + src + ")"); 137 | else 138 | throw new SyntaxError("Error parsing JSON, source is not valid."); 139 | }; 140 | 141 | /** jQuery.quoteString(string) 142 | Returns a string-repr of a string, escaping quotes intelligently. 143 | Mostly a support function for toJSON. 144 | 145 | Examples: 146 | >>> jQuery.quoteString("apple") 147 | "apple" 148 | 149 | >>> jQuery.quoteString('"Where are we going?", she asked.') 150 | "\"Where are we going?\", she asked." 151 | **/ 152 | $.quoteString = function(string) 153 | { 154 | if (string.match(_escapeable)) 155 | { 156 | return '"' + string.replace(_escapeable, function (a) 157 | { 158 | var c = _meta[a]; 159 | if (typeof c === 'string') return c; 160 | c = a.charCodeAt(); 161 | return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); 162 | }) + '"'; 163 | } 164 | return '"' + string + '"'; 165 | }; 166 | 167 | var _escapeable = /["\\\x00-\x1f\x7f-\x9f]/g; 168 | 169 | var _meta = { 170 | '\b': '\\b', 171 | '\t': '\\t', 172 | '\n': '\\n', 173 | '\f': '\\f', 174 | '\r': '\\r', 175 | '"' : '\\"', 176 | '\\': '\\\\' 177 | }; 178 | })(jQuery); 179 | -------------------------------------------------------------------------------- /static/jstorage.min.js: -------------------------------------------------------------------------------- 1 | // jStorage v0.4.7 2 | (function(){function D(){var a="{}";if("userDataBehavior"==k){d.load("jStorage");try{a=d.getAttribute("jStorage")}catch(b){}try{r=d.getAttribute("jStorage_update")}catch(c){}h.jStorage=a}E();x();F()}function u(){var a;clearTimeout(G);G=setTimeout(function(){if("localStorage"==k||"globalStorage"==k)a=h.jStorage_update;else if("userDataBehavior"==k){d.load("jStorage");try{a=d.getAttribute("jStorage_update")}catch(b){}}if(a&&a!=r){r=a;var l=m.parse(m.stringify(c.__jstorage_meta.CRC32)),p;D();p=m.parse(m.stringify(c.__jstorage_meta.CRC32)); 3 | var e,z=[],f=[];for(e in l)l.hasOwnProperty(e)&&(p[e]?l[e]!=p[e]&&"2."==String(l[e]).substr(0,2)&&z.push(e):f.push(e));for(e in p)p.hasOwnProperty(e)&&(l[e]||z.push(e));s(z,"updated");s(f,"deleted")}},25)}function s(a,b){a=[].concat(a||[]);if("flushed"==b){a=[];for(var c in g)g.hasOwnProperty(c)&&a.push(c);b="deleted"}c=0;for(var p=a.length;cB){var l=b[0],d=b[1];b=b[2];if(t[d])for(var e=0,h=t[d].length;e>>16)&65535)<<16),n^=n>>>24,n=1540483477*(n&65535)+((1540483477*(n>>>16)&65535)<<16),f=1540483477*(f&65535)+((1540483477*(f>>>16)&65535)<<16)^n,k-=4,++g;switch(k){case 3:f^=(e.charCodeAt(g+2)&255)<<16;case 2:f^=(e.charCodeAt(g+1)&255)<<8;case 1:f^=e.charCodeAt(g)&255,f=1540483477*(f&65535)+((1540483477*(f>>>16)&65535)<<16)}f^=f>>>13;f=1540483477*(f&65535)+((1540483477*(f>>>16)& 11 | 65535)<<16);h[a]="2."+((f^f>>>15)>>>0);this.setTTL(a,d.TTL||0);s(a,"updated");return b},get:function(a,b){q(a);return a in c?c[a]&&"object"==typeof c[a]&&c[a]._is_xml?C.decode(c[a].xml):c[a]:"undefined"==typeof b?null:b},deleteKey:function(a){q(a);return a in c?(delete c[a],"object"==typeof c.__jstorage_meta.TTL&&a in c.__jstorage_meta.TTL&&delete c.__jstorage_meta.TTL[a],delete c.__jstorage_meta.CRC32[a],w(),v(),s(a,"deleted"),!0):!1},setTTL:function(a,b){var d=+new Date;q(a);b=Number(b)||0;return a in 12 | c?(c.__jstorage_meta.TTL||(c.__jstorage_meta.TTL={}),0 2 | 3 | 4 | jStorage - simple JavaScript plugin to store data locally 5 | 6 | 7 | 76 | 77 | 78 | 79 | 80 | 136 | 137 | 138 | 142 | 145 | 146 | 147 | 148 | 149 | 150 |
151 | 152 |

jStorage - store data locally with JavaScript

153 | 154 |

jStorage is a cross-browser key-value store database to store data locally in the browser - jStorage supports all major browsers, both in desktop (yes - even Internet Explorer 6) and in mobile.

155 | 156 |

Additionally jStorage is library agnostic, it works well with any other JavaScript library on the same webpage, be it jQuery, Prototype, MooTools or something else. Though you still need to have either a third party library (Prototype, MooTools) or JSON2 on the page to support older IE versions.

157 | 158 |

jStorage supports storing Strings, Numbers, JavaScript objects, Arrays and even native XML nodes. jStorage also supports setting TTL values for auto expiring stored keys and - best of all - notifying other tabs/windows when a key has been changed or publishing/subscribing to events from the same or another tab/window, which makes jStorage also a local PubSub platform for web applications.

159 | 160 |

jStorage is pretty small, about 7kB when minified and 4kB gzipped.

161 | 162 |

Donate

163 | 164 |

Support jStorage development

165 | 166 |

Donate to author

167 | 168 |

Index

169 |
    170 |
  1. Basics
  2. 171 |
  3. Download
  4. 172 |
  5. Interactive test
  6. 173 |
  7. Browser support
  8. 174 |
  9. Usage
  10. 175 |
  11. Function reference
  12. 176 |
  13. Usage example
  14. 177 |
  15. Issues
  16. 178 |
  17. Contact and Copyright
  18. 179 |
180 | 181 |
182 | 190 | 191 |
192 | 193 |

1. Basics

194 | 195 |

jStorage makes use of HTML5 local storage where available and userData behavior in Internet Explorer older versions.

196 | 197 |

Current availability: jStorage supports all major browsers - Internet Explorer 6+, Firefox 2+, Safari 4+, Chrome 4+, Opera 10.50+

198 | 199 |

If the browser doesn't support data caching, then no exceptions are raised - jStorage can still be used by the script but nothing is actually stored.

200 | 201 |

jStorage is really small, just about 7kB when minified (4kB when gzipped)!

202 | 203 |

2. Download

204 | 205 |

jStorage can be downloaded at github (direct download link)

206 | 207 | 208 |

3. Interactive test

209 |

Add some values and refresh the page - if your browser supports storing local data, then the values should survive the page refresh.

210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 |
KEYVALUE 
ADD
Clicking "GET" alerts the value for provided key with the method $.jStorage.get(key)GET
 Clear all saved dataFLUSH
234 | 235 |

Test Publish/Subscribe

236 |

Test this functionality with a specific library

237 |

Unit tests

238 | 239 | 240 |

4. Browser support

241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 |
BrowserStorage supportSurvives browser restartSurvives browser crashStorage size
Chrome 4 + + + 5 MB
Firefox 3.6 + + + 5 MB
Firefox 3 + + + 5 MB
Firefox 2 + + + 5 MB
IE8 + + + 10 MB
IE7 + + + 128 kB
IE6 + + + 128 kB
Opera 10.50 + + - 5 MB
Opera 10.10 - N/A N/A N/A
Safari 4 + + + 5 MB
Iphone Safari + + + 5 MB
Safari 3 - N/A N/A N/A
267 | 268 |

5. Usage

269 | 270 |

jStorage requires Prototype, MooTools or jQuery + jQuery-JSON or JSON2. Either way, the syntax stays the same.

271 | 272 |

Simple setup to support jStorage with JSON2

273 | 274 |
<script src="//cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
275 | <script src="https://raw.github.com/andris9/jStorage/master/jstorage.js"></script>
276 | <script> /* $.jStorage is now available */ </script>
277 | 278 |

Setup with jQuery2

279 | 280 |
<script src="//cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
281 | <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
282 | <script src="https://raw.github.com/andris9/jStorage/master/jstorage.js"></script>
283 | <script> /* $.jStorage is now available */ </script>
284 | 285 |

6. Function reference

286 | 287 |

set(key, value[, options])

288 | 289 |
$.jStorage.set(key, value, options)
290 | 291 |

Saves a value to local storage. key needs to be string otherwise an exception is thrown. value can be any JSONeable value, including objects and arrays or a XML node.
Currently XML nodes can't be nested inside other objects: $.jStorage.set("xml", xml_node) is OK but $.jStorage.set("xml", {xml: xml_node}) is not.

292 | 293 |

Options is an optional options object. Currently only available option is options.TTL which can be used to set the TTL value to the key ($.jStorage.set(key, value, {TTL: 1000});). NB - if no TTL option value has been set, any currently used TTL value for the key will be removed.

294 | 295 |

get(key[, default])

296 | 297 |
value = $.jStorage.get(key)
298 | value = $.jStorage.get(key, "default value")
299 | 	
300 | 301 |

get retrieves the value if key exists, or default if it doesn't. key needs to be string otherwise an exception is thrown. default can be any value.

302 | 303 |

deleteKey(key)

304 | 305 |
$.jStorage.deleteKey(key)
306 | 307 |

Removes a key from the storage. key needs to be string otherwise an exception is thrown.

308 | 309 |

setTTL(key, ttl)

310 | 311 |
$.jStorage.set("mykey", "keyvalue");
312 | $.jStorage.setTTL("mykey", 3000); // expires in 3 seconds
313 | 314 |

Sets a TTL (in milliseconds) for an existing key. Use 0 or negative value to clear TTL.

315 | 316 |

getTTL(key)

317 | 318 |
ttl = $.jStorage.getTTL("mykey"); // TTL in milliseconds or 0
319 | 320 |

Gets remaining TTL (in milliseconds) for a key or 0 if not TTL has been set.

321 | 322 |

flush()

323 | 324 |
$.jStorage.flush()
325 | 326 |

Clears the cache.

327 | 328 |

index()

329 | 330 |
$.jStorage.index()
331 | 332 |

Returns all the keys currently in use as an array.
333 | var index = $.jStorage.index();
console.log(index); // ["key1","key2","key3"]

334 | 335 |

storageSize()

336 | 337 |
$.jStorage.storageSize()
338 | 339 |

Returns the size of the stored data in bytes

340 | 341 |

currentBackend()

342 | 343 |
$.jStorage.currentBackend()
344 | 345 |

Returns the storage engine currently in use or false if none

346 | 347 |

reInit()

348 | 349 |
$.jStorage.reInit()
350 | 351 |

Reloads the data from browser storage

352 | 353 |

storageAvailable()

354 | 355 |
$.jStorage.storageAvailable()
356 | 357 |

Returns true if storage is available

358 | 359 |

subscribe(channel, callback)

360 | 361 |
$.jStorage.subscribe("ch1", function(channel, payload){
362 |     console.log(payload+ " from " + channel);
363 | });
364 | 365 |

Subscribes to a Publish/Subscribe channel (see demo)

366 | 367 |

publish(channel, payload)

368 | 369 |
$.jStorage.publish("ch1", "data");
370 | 371 |

Publishes payload to a Publish/Subscribe channel (see demo)

372 | 373 |

listenKeyChange(key, callback)

374 | 375 |
$.jStorage.listenKeyChange("mykey", function(key, action){
376 |     console.log(key + " has been " + action);
377 | });
378 | 379 |

Listens for updates for selected key. NB! even updates made in other 380 | windows/tabs are reflected, so this feature can also be used for some kind 381 | of publish/subscribe service.

382 | 383 |

stopListening(key[, callback])

384 | 385 |
$.jStorage.stopListening("mykey"); // cancel all listeners for "mykey" change
386 | 387 |

Stops listening for key change. If callback is set, only the used callback will be cleared, otherwise all listeners will be dropped.

388 | 389 |

7. Usage example

390 | 391 |

jQuery

392 | 393 |

jQuery doesn't come with built in JSON encoder/decoder so if you need to support IE6/IE7 you should include one yourselt like in the example

394 | 395 |
<script src="//cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
396 | <script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
397 | <script src="jstorage.js"></script>
398 | <script>
399 | // Check if "key" exists in the storage
400 | var value = $.jStorage.get("key");
401 | if(!value){
402 | 	// if not - load the data from the server
403 |  	value = load_data_from_server()
404 |  	// and save it
405 | 	$.jStorage.set("key",value);
406 | }
407 | </script>
408 | 409 |

Prototype

410 | 411 |
<script src="//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
412 | <script src="jstorage.js"></script>
413 | <script>
414 | // Check if "key" exists in the storage
415 | var value = $.jStorage.get("key");
416 | if(!value){
417 | 	// if not - load the data from the server
418 |  	value = load_data_from_server()
419 |  	// and save it
420 | 	$.jStorage.set("key",value);
421 | }
422 | </script>
423 | 424 |

8. Issues

425 |
    426 |
  • Why would you want to use jStorage when cookies work already in every browser?
    427 | Cookies are not meant to save large quantities of data locally - they are meant to pass around ID values to keep track of users. Internet Explorer allows to use up to 20 cookies per domain with the payload of 4kB per cookie. It isn't very much, especially considering the need to chunk larger data into smaller bits. The fact that the data (max. 80 kB) is sent to the server with *every* call doesn't sound much of a good idea either. 428 |
  • 429 |
430 | 431 |

9. Contact and Copyright

432 | 433 |

© 2010 - 2012 Andris Reinman, andris.reinman@gmail.com
jStorage is licensed under Unlicense, so basically you can do whatever you want to do with it.

434 | 435 |
436 | 437 | 438 | 439 | 443 | 449 | 450 | -------------------------------------------------------------------------------- /static/jstorage.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ----------------------------- JSTORAGE ------------------------------------- 3 | * Simple local storage wrapper to save data on the browser side, supporting 4 | * all major browsers - IE6+, Firefox2+, Safari4+, Chrome4+ and Opera 10.5+ 5 | * 6 | * Copyright (c) 2010 - 2012 Andris Reinman, andris.reinman@gmail.com 7 | * Project homepage: www.jstorage.info 8 | * 9 | * Licensed under Unlicense: 10 | * 11 | * This is free and unencumbered software released into the public domain. 12 | * 13 | * Anyone is free to copy, modify, publish, use, compile, sell, or 14 | * distribute this software, either in source code form or as a compiled 15 | * binary, for any purpose, commercial or non-commercial, and by any 16 | * means. 17 | * 18 | * In jurisdictions that recognize copyright laws, the author or authors 19 | * of this software dedicate any and all copyright interest in the 20 | * software to the public domain. We make this dedication for the benefit 21 | * of the public at large and to the detriment of our heirs and 22 | * successors. We intend this dedication to be an overt act of 23 | * relinquishment in perpetuity of all present and future rights to this 24 | * software under copyright law. 25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 29 | * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 30 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 31 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 32 | * OTHER DEALINGS IN THE SOFTWARE. 33 | * 34 | * For more information, please refer to 35 | */ 36 | 37 | (function(){ 38 | var 39 | /* jStorage version */ 40 | JSTORAGE_VERSION = "0.4.7", 41 | 42 | /* detect a dollar object or create one if not found */ 43 | $ = window.jQuery || window.$ || (window.$ = {}), 44 | 45 | /* check for a JSON handling support */ 46 | JSON = { 47 | parse: 48 | window.JSON && (window.JSON.parse || window.JSON.decode) || 49 | String.prototype.evalJSON && function(str){return String(str).evalJSON();} || 50 | $.parseJSON || 51 | $.evalJSON, 52 | stringify: 53 | Object.toJSON || 54 | window.JSON && (window.JSON.stringify || window.JSON.encode) || 55 | $.toJSON 56 | }; 57 | 58 | // Break if no JSON support was found 59 | if(!("parse" in JSON) || !("stringify" in JSON)){ 60 | throw new Error("No JSON support found, include //cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js to page"); 61 | } 62 | 63 | var 64 | /* This is the object, that holds the cached values */ 65 | _storage = {__jstorage_meta:{CRC32:{}}}, 66 | 67 | /* Actual browser storage (localStorage or globalStorage["domain"]) */ 68 | _storage_service = {jStorage:"{}"}, 69 | 70 | /* DOM element for older IE versions, holds userData behavior */ 71 | _storage_elm = null, 72 | 73 | /* How much space does the storage take */ 74 | _storage_size = 0, 75 | 76 | /* which backend is currently used */ 77 | _backend = false, 78 | 79 | /* onchange observers */ 80 | _observers = {}, 81 | 82 | /* timeout to wait after onchange event */ 83 | _observer_timeout = false, 84 | 85 | /* last update time */ 86 | _observer_update = 0, 87 | 88 | /* pubsub observers */ 89 | _pubsub_observers = {}, 90 | 91 | /* skip published items older than current timestamp */ 92 | _pubsub_last = +new Date(), 93 | 94 | /* Next check for TTL */ 95 | _ttl_timeout, 96 | 97 | /** 98 | * XML encoding and decoding as XML nodes can't be JSON'ized 99 | * XML nodes are encoded and decoded if the node is the value to be saved 100 | * but not if it's as a property of another object 101 | * Eg. - 102 | * $.jStorage.set("key", xmlNode); // IS OK 103 | * $.jStorage.set("key", {xml: xmlNode}); // NOT OK 104 | */ 105 | _XMLService = { 106 | 107 | /** 108 | * Validates a XML node to be XML 109 | * based on jQuery.isXML function 110 | */ 111 | isXML: function(elm){ 112 | var documentElement = (elm ? elm.ownerDocument || elm : 0).documentElement; 113 | return documentElement ? documentElement.nodeName !== "HTML" : false; 114 | }, 115 | 116 | /** 117 | * Encodes a XML node to string 118 | * based on http://www.mercurytide.co.uk/news/article/issues-when-working-ajax/ 119 | */ 120 | encode: function(xmlNode) { 121 | if(!this.isXML(xmlNode)){ 122 | return false; 123 | } 124 | try{ // Mozilla, Webkit, Opera 125 | return new XMLSerializer().serializeToString(xmlNode); 126 | }catch(E1) { 127 | try { // IE 128 | return xmlNode.xml; 129 | }catch(E2){} 130 | } 131 | return false; 132 | }, 133 | 134 | /** 135 | * Decodes a XML node from string 136 | * loosely based on http://outwestmedia.com/jquery-plugins/xmldom/ 137 | */ 138 | decode: function(xmlString){ 139 | var dom_parser = ("DOMParser" in window && (new DOMParser()).parseFromString) || 140 | (window.ActiveXObject && function(_xmlString) { 141 | var xml_doc = new ActiveXObject("Microsoft.XMLDOM"); 142 | xml_doc.async = "false"; 143 | xml_doc.loadXML(_xmlString); 144 | return xml_doc; 145 | }), 146 | resultXML; 147 | if(!dom_parser){ 148 | return false; 149 | } 150 | resultXML = dom_parser.call("DOMParser" in window && (new DOMParser()) || window, xmlString, "text/xml"); 151 | return this.isXML(resultXML)?resultXML:false; 152 | } 153 | }; 154 | 155 | 156 | ////////////////////////// PRIVATE METHODS //////////////////////// 157 | 158 | /** 159 | * Initialization function. Detects if the browser supports DOM Storage 160 | * or userData behavior and behaves accordingly. 161 | */ 162 | function _init(){ 163 | /* Check if browser supports localStorage */ 164 | var localStorageReallyWorks = false; 165 | if("localStorage" in window){ 166 | try { 167 | window.localStorage.setItem("_tmptest", "tmpval"); 168 | localStorageReallyWorks = true; 169 | window.localStorage.removeItem("_tmptest"); 170 | } catch(BogusQuotaExceededErrorOnIos5) { 171 | // Thanks be to iOS5 Private Browsing mode which throws 172 | // QUOTA_EXCEEDED_ERRROR DOM Exception 22. 173 | } 174 | } 175 | 176 | if(localStorageReallyWorks){ 177 | try { 178 | if(window.localStorage) { 179 | _storage_service = window.localStorage; 180 | _backend = "localStorage"; 181 | _observer_update = _storage_service.jStorage_update; 182 | } 183 | } catch(E3) {/* Firefox fails when touching localStorage and cookies are disabled */} 184 | } 185 | /* Check if browser supports globalStorage */ 186 | else if("globalStorage" in window){ 187 | try { 188 | if(window.globalStorage) { 189 | if(window.location.hostname == "localhost"){ 190 | _storage_service = window.globalStorage["localhost.localdomain"]; 191 | } 192 | else{ 193 | _storage_service = window.globalStorage[window.location.hostname]; 194 | } 195 | _backend = "globalStorage"; 196 | _observer_update = _storage_service.jStorage_update; 197 | } 198 | } catch(E4) {/* Firefox fails when touching localStorage and cookies are disabled */} 199 | } 200 | /* Check if browser supports userData behavior */ 201 | else { 202 | _storage_elm = document.createElement("link"); 203 | if(_storage_elm.addBehavior){ 204 | 205 | /* Use a DOM element to act as userData storage */ 206 | _storage_elm.style.behavior = "url(#default#userData)"; 207 | 208 | /* userData element needs to be inserted into the DOM! */ 209 | document.getElementsByTagName("head")[0].appendChild(_storage_elm); 210 | 211 | try{ 212 | _storage_elm.load("jStorage"); 213 | }catch(E){ 214 | // try to reset cache 215 | _storage_elm.setAttribute("jStorage", "{}"); 216 | _storage_elm.save("jStorage"); 217 | _storage_elm.load("jStorage"); 218 | } 219 | 220 | var data = "{}"; 221 | try{ 222 | data = _storage_elm.getAttribute("jStorage"); 223 | }catch(E5){} 224 | 225 | try{ 226 | _observer_update = _storage_elm.getAttribute("jStorage_update"); 227 | }catch(E6){} 228 | 229 | _storage_service.jStorage = data; 230 | _backend = "userDataBehavior"; 231 | }else{ 232 | _storage_elm = null; 233 | return; 234 | } 235 | } 236 | 237 | // Load data from storage 238 | _load_storage(); 239 | 240 | // remove dead keys 241 | _handleTTL(); 242 | 243 | // start listening for changes 244 | _setupObserver(); 245 | 246 | // initialize publish-subscribe service 247 | _handlePubSub(); 248 | 249 | // handle cached navigation 250 | if("addEventListener" in window){ 251 | window.addEventListener("pageshow", function(event){ 252 | if(event.persisted){ 253 | _storageObserver(); 254 | } 255 | }, false); 256 | } 257 | } 258 | 259 | /** 260 | * Reload data from storage when needed 261 | */ 262 | function _reloadData(){ 263 | var data = "{}"; 264 | 265 | if(_backend == "userDataBehavior"){ 266 | _storage_elm.load("jStorage"); 267 | 268 | try{ 269 | data = _storage_elm.getAttribute("jStorage"); 270 | }catch(E5){} 271 | 272 | try{ 273 | _observer_update = _storage_elm.getAttribute("jStorage_update"); 274 | }catch(E6){} 275 | 276 | _storage_service.jStorage = data; 277 | } 278 | 279 | _load_storage(); 280 | 281 | // remove dead keys 282 | _handleTTL(); 283 | 284 | _handlePubSub(); 285 | } 286 | 287 | /** 288 | * Sets up a storage change observer 289 | */ 290 | function _setupObserver(){ 291 | if(_backend == "localStorage" || _backend == "globalStorage"){ 292 | if("addEventListener" in window){ 293 | window.addEventListener("storage", _storageObserver, false); 294 | }else{ 295 | document.attachEvent("onstorage", _storageObserver); 296 | } 297 | }else if(_backend == "userDataBehavior"){ 298 | setInterval(_storageObserver, 1000); 299 | } 300 | } 301 | 302 | /** 303 | * Fired on any kind of data change, needs to check if anything has 304 | * really been changed 305 | */ 306 | function _storageObserver(){ 307 | var updateTime; 308 | // cumulate change notifications with timeout 309 | clearTimeout(_observer_timeout); 310 | _observer_timeout = setTimeout(function(){ 311 | 312 | if(_backend == "localStorage" || _backend == "globalStorage"){ 313 | updateTime = _storage_service.jStorage_update; 314 | }else if(_backend == "userDataBehavior"){ 315 | _storage_elm.load("jStorage"); 316 | try{ 317 | updateTime = _storage_elm.getAttribute("jStorage_update"); 318 | }catch(E5){} 319 | } 320 | 321 | if(updateTime && updateTime != _observer_update){ 322 | _observer_update = updateTime; 323 | _checkUpdatedKeys(); 324 | } 325 | 326 | }, 25); 327 | } 328 | 329 | /** 330 | * Reloads the data and checks if any keys are changed 331 | */ 332 | function _checkUpdatedKeys(){ 333 | var oldCrc32List = JSON.parse(JSON.stringify(_storage.__jstorage_meta.CRC32)), 334 | newCrc32List; 335 | 336 | _reloadData(); 337 | newCrc32List = JSON.parse(JSON.stringify(_storage.__jstorage_meta.CRC32)); 338 | 339 | var key, 340 | updated = [], 341 | removed = []; 342 | 343 | for(key in oldCrc32List){ 344 | if(oldCrc32List.hasOwnProperty(key)){ 345 | if(!newCrc32List[key]){ 346 | removed.push(key); 347 | continue; 348 | } 349 | if(oldCrc32List[key] != newCrc32List[key] && String(oldCrc32List[key]).substr(0,2) == "2."){ 350 | updated.push(key); 351 | } 352 | } 353 | } 354 | 355 | for(key in newCrc32List){ 356 | if(newCrc32List.hasOwnProperty(key)){ 357 | if(!oldCrc32List[key]){ 358 | updated.push(key); 359 | } 360 | } 361 | } 362 | 363 | _fireObservers(updated, "updated"); 364 | _fireObservers(removed, "deleted"); 365 | } 366 | 367 | /** 368 | * Fires observers for updated keys 369 | * 370 | * @param {Array|String} keys Array of key names or a key 371 | * @param {String} action What happened with the value (updated, deleted, flushed) 372 | */ 373 | function _fireObservers(keys, action){ 374 | keys = [].concat(keys || []); 375 | if(action == "flushed"){ 376 | keys = []; 377 | for(var key in _observers){ 378 | if(_observers.hasOwnProperty(key)){ 379 | keys.push(key); 380 | } 381 | } 382 | action = "deleted"; 383 | } 384 | for(var i=0, len = keys.length; i=0; i--){ 528 | pubelm = _storage.__jstorage_meta.PubSub[i]; 529 | if(pubelm[0] > _pubsub_last){ 530 | _pubsubCurrent = pubelm[0]; 531 | _fireSubscribers(pubelm[1], pubelm[2]); 532 | } 533 | } 534 | 535 | _pubsub_last = _pubsubCurrent; 536 | } 537 | 538 | /** 539 | * Fires all subscriber listeners for a pubsub channel 540 | * 541 | * @param {String} channel Channel name 542 | * @param {Mixed} payload Payload data to deliver 543 | */ 544 | function _fireSubscribers(channel, payload){ 545 | if(_pubsub_observers[channel]){ 546 | for(var i=0, len = _pubsub_observers[channel].length; iGary Court 606 | * @see http://github.com/garycourt/murmurhash-js 607 | * @author Austin Appleby 608 | * @see http://sites.google.com/site/murmurhash/ 609 | * 610 | * @param {string} str ASCII only 611 | * @param {number} seed Positive integer only 612 | * @return {number} 32-bit positive integer hash 613 | */ 614 | 615 | function murmurhash2_32_gc(str, seed) { 616 | var 617 | l = str.length, 618 | h = seed ^ l, 619 | i = 0, 620 | k; 621 | 622 | while (l >= 4) { 623 | k = 624 | ((str.charCodeAt(i) & 0xff)) | 625 | ((str.charCodeAt(++i) & 0xff) << 8) | 626 | ((str.charCodeAt(++i) & 0xff) << 16) | 627 | ((str.charCodeAt(++i) & 0xff) << 24); 628 | 629 | k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16)); 630 | k ^= k >>> 24; 631 | k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16)); 632 | 633 | h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k; 634 | 635 | l -= 4; 636 | ++i; 637 | } 638 | 639 | switch (l) { 640 | case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16; 641 | case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8; 642 | case 1: h ^= (str.charCodeAt(i) & 0xff); 643 | h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)); 644 | } 645 | 646 | h ^= h >>> 13; 647 | h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)); 648 | h ^= h >>> 15; 649 | 650 | return h >>> 0; 651 | } 652 | 653 | ////////////////////////// PUBLIC INTERFACE ///////////////////////// 654 | 655 | $.jStorage = { 656 | /* Version number */ 657 | version: JSTORAGE_VERSION, 658 | 659 | /** 660 | * Sets a key's value. 661 | * 662 | * @param {String} key Key to set. If this value is not set or not 663 | * a string an exception is raised. 664 | * @param {Mixed} value Value to set. This can be any value that is JSON 665 | * compatible (Numbers, Strings, Objects etc.). 666 | * @param {Object} [options] - possible options to use 667 | * @param {Number} [options.TTL] - optional TTL value 668 | * @return {Mixed} the used value 669 | */ 670 | set: function(key, value, options){ 671 | _checkKey(key); 672 | 673 | options = options || {}; 674 | 675 | // undefined values are deleted automatically 676 | if(typeof value == "undefined"){ 677 | this.deleteKey(key); 678 | return value; 679 | } 680 | 681 | if(_XMLService.isXML(value)){ 682 | value = {_is_xml:true,xml:_XMLService.encode(value)}; 683 | }else if(typeof value == "function"){ 684 | return undefined; // functions can't be saved! 685 | }else if(value && typeof value == "object"){ 686 | // clone the object before saving to _storage tree 687 | value = JSON.parse(JSON.stringify(value)); 688 | } 689 | 690 | _storage[key] = value; 691 | 692 | _storage.__jstorage_meta.CRC32[key] = "2." + murmurhash2_32_gc(JSON.stringify(value), 0x9747b28c); 693 | 694 | this.setTTL(key, options.TTL || 0); // also handles saving and _publishChange 695 | 696 | _fireObservers(key, "updated"); 697 | return value; 698 | }, 699 | 700 | /** 701 | * Looks up a key in cache 702 | * 703 | * @param {String} key - Key to look up. 704 | * @param {mixed} def - Default value to return, if key didn't exist. 705 | * @return {Mixed} the key value, default value or null 706 | */ 707 | get: function(key, def){ 708 | _checkKey(key); 709 | if(key in _storage){ 710 | if(_storage[key] && typeof _storage[key] == "object" && _storage[key]._is_xml) { 711 | return _XMLService.decode(_storage[key].xml); 712 | }else{ 713 | return _storage[key]; 714 | } 715 | } 716 | return typeof(def) == "undefined" ? null : def; 717 | }, 718 | 719 | /** 720 | * Deletes a key from cache. 721 | * 722 | * @param {String} key - Key to delete. 723 | * @return {Boolean} true if key existed or false if it didn't 724 | */ 725 | deleteKey: function(key){ 726 | _checkKey(key); 727 | if(key in _storage){ 728 | delete _storage[key]; 729 | // remove from TTL list 730 | if(typeof _storage.__jstorage_meta.TTL == "object" && 731 | key in _storage.__jstorage_meta.TTL){ 732 | delete _storage.__jstorage_meta.TTL[key]; 733 | } 734 | 735 | delete _storage.__jstorage_meta.CRC32[key]; 736 | 737 | _save(); 738 | _publishChange(); 739 | _fireObservers(key, "deleted"); 740 | return true; 741 | } 742 | return false; 743 | }, 744 | 745 | /** 746 | * Sets a TTL for a key, or remove it if ttl value is 0 or below 747 | * 748 | * @param {String} key - key to set the TTL for 749 | * @param {Number} ttl - TTL timeout in milliseconds 750 | * @return {Boolean} true if key existed or false if it didn't 751 | */ 752 | setTTL: function(key, ttl){ 753 | var curtime = +new Date(); 754 | _checkKey(key); 755 | ttl = Number(ttl) || 0; 756 | if(key in _storage){ 757 | 758 | if(!_storage.__jstorage_meta.TTL){ 759 | _storage.__jstorage_meta.TTL = {}; 760 | } 761 | 762 | // Set TTL value for the key 763 | if(ttl>0){ 764 | _storage.__jstorage_meta.TTL[key] = curtime + ttl; 765 | }else{ 766 | delete _storage.__jstorage_meta.TTL[key]; 767 | } 768 | 769 | _save(); 770 | 771 | _handleTTL(); 772 | 773 | _publishChange(); 774 | return true; 775 | } 776 | return false; 777 | }, 778 | 779 | /** 780 | * Gets remaining TTL (in milliseconds) for a key or 0 when no TTL has been set 781 | * 782 | * @param {String} key Key to check 783 | * @return {Number} Remaining TTL in milliseconds 784 | */ 785 | getTTL: function(key){ 786 | var curtime = +new Date(), ttl; 787 | _checkKey(key); 788 | if(key in _storage && _storage.__jstorage_meta.TTL && _storage.__jstorage_meta.TTL[key]){ 789 | ttl = _storage.__jstorage_meta.TTL[key] - curtime; 790 | return ttl || 0; 791 | } 792 | return 0; 793 | }, 794 | 795 | /** 796 | * Deletes everything in cache. 797 | * 798 | * @return {Boolean} Always true 799 | */ 800 | flush: function(){ 801 | _storage = {__jstorage_meta:{CRC32:{}}}; 802 | _save(); 803 | _publishChange(); 804 | _fireObservers(null, "flushed"); 805 | return true; 806 | }, 807 | 808 | /** 809 | * Returns a read-only copy of _storage 810 | * 811 | * @return {Object} Read-only copy of _storage 812 | */ 813 | storageObj: function(){ 814 | function F() {} 815 | F.prototype = _storage; 816 | return new F(); 817 | }, 818 | 819 | /** 820 | * Returns an index of all used keys as an array 821 | * ["key1", "key2",.."keyN"] 822 | * 823 | * @return {Array} Used keys 824 | */ 825 | index: function(){ 826 | var index = [], i; 827 | for(i in _storage){ 828 | if(_storage.hasOwnProperty(i) && i != "__jstorage_meta"){ 829 | index.push(i); 830 | } 831 | } 832 | return index; 833 | }, 834 | 835 | /** 836 | * How much space in bytes does the storage take? 837 | * 838 | * @return {Number} Storage size in chars (not the same as in bytes, 839 | * since some chars may take several bytes) 840 | */ 841 | storageSize: function(){ 842 | return _storage_size; 843 | }, 844 | 845 | /** 846 | * Which backend is currently in use? 847 | * 848 | * @return {String} Backend name 849 | */ 850 | currentBackend: function(){ 851 | return _backend; 852 | }, 853 | 854 | /** 855 | * Test if storage is available 856 | * 857 | * @return {Boolean} True if storage can be used 858 | */ 859 | storageAvailable: function(){ 860 | return !!_backend; 861 | }, 862 | 863 | /** 864 | * Register change listeners 865 | * 866 | * @param {String} key Key name 867 | * @param {Function} callback Function to run when the key changes 868 | */ 869 | listenKeyChange: function(key, callback){ 870 | _checkKey(key); 871 | if(!_observers[key]){ 872 | _observers[key] = []; 873 | } 874 | _observers[key].push(callback); 875 | }, 876 | 877 | /** 878 | * Remove change listeners 879 | * 880 | * @param {String} key Key name to unregister listeners against 881 | * @param {Function} [callback] If set, unregister the callback, if not - unregister all 882 | */ 883 | stopListening: function(key, callback){ 884 | _checkKey(key); 885 | 886 | if(!_observers[key]){ 887 | return; 888 | } 889 | 890 | if(!callback){ 891 | delete _observers[key]; 892 | return; 893 | } 894 | 895 | for(var i = _observers[key].length - 1; i>=0; i--){ 896 | if(_observers[key][i] == callback){ 897 | _observers[key].splice(i,1); 898 | } 899 | } 900 | }, 901 | 902 | /** 903 | * Subscribe to a Publish/Subscribe event stream 904 | * 905 | * @param {String} channel Channel name 906 | * @param {Function} callback Function to run when the something is published to the channel 907 | */ 908 | subscribe: function(channel, callback){ 909 | channel = (channel || "").toString(); 910 | if(!channel){ 911 | throw new TypeError("Channel not defined"); 912 | } 913 | if(!_pubsub_observers[channel]){ 914 | _pubsub_observers[channel] = []; 915 | } 916 | _pubsub_observers[channel].push(callback); 917 | }, 918 | 919 | /** 920 | * Publish data to an event stream 921 | * 922 | * @param {String} channel Channel name 923 | * @param {Mixed} payload Payload to deliver 924 | */ 925 | publish: function(channel, payload){ 926 | channel = (channel || "").toString(); 927 | if(!channel){ 928 | throw new TypeError("Channel not defined"); 929 | } 930 | 931 | _publish(channel, payload); 932 | }, 933 | 934 | /** 935 | * Reloads the data from browser storage 936 | */ 937 | reInit: function(){ 938 | _reloadData(); 939 | }, 940 | 941 | /** 942 | * Removes reference from global objects and saves it as jStorage 943 | * 944 | * @param {Boolean} option if needed to save object as simple "jStorage" in windows context 945 | */ 946 | noConflict: function( saveInGlobal ) { 947 | delete window.$.jStorage 948 | 949 | if ( saveInGlobal ) { 950 | window.jStorage = this; 951 | } 952 | 953 | return this; 954 | } 955 | }; 956 | 957 | // Initialize jStorage 958 | _init(); 959 | 960 | })(); 961 | -------------------------------------------------------------------------------- /static/mootools.js: -------------------------------------------------------------------------------- 1 | //MooTools, , My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, , MIT Style License. 2 | 3 | var MooTools={version:"1.2.4",build:"0d9113241a90b9cd5643b926795852a2026710d4"};var Native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect; 4 | var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterImplement||function(){};var d=f||i;h=h!==false;d.constructor=Native;d.$family={name:"native"}; 5 | if(i&&f){d.prototype=i.prototype;}d.prototype.constructor=d;if(a){var e=a.toLowerCase();d.prototype.$family={name:e};Native.typize(d,e);}var j=function(n,l,o,m){if(!b||m||!n.prototype[l]){n.prototype[l]=o; 6 | }if(h){Native.genericize(n,l,b);}g.call(n,l,o);return n;};d.alias=function(n,l,p){if(typeof n=="string"){var o=this.prototype[n];if((n=o)){return j(this,l,n,p); 7 | }}for(var m in n){this.alias(m,n[m],l);}return this;};d.implement=function(m,l,o){if(typeof m=="string"){return j(this,m,l,o);}for(var n in m){j(this,n,m[n],l); 8 | }return this;};if(c){d.implement(c);}return d;};Native.genericize=function(b,c,a){if((!a||!b[c])&&typeof b.prototype[c]=="function"){b[c]=function(){var d=Array.prototype.slice.call(arguments); 9 | return b.prototype[c].apply(d.shift(),d);};}};Native.implement=function(d,c){for(var b=0,a=d.length;b-1:this.indexOf(a)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim(); 66 | },camelCase:function(){return this.replace(/-\D/g,function(a){return a.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase()); 67 | });},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1"); 68 | },toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(b){var a=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); 69 | return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHex(b):null;},stripScripts:function(b){var a=""; 70 | var c=this.replace(/]*>([\s\S]*?)<\/script>/gi,function(){a+=arguments[1]+"\n";return"";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c); 71 | }}return c;},substitute:function(a,b){return this.replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:""; 72 | });}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){for(var a in this){if(this.hasOwnProperty(a)&&this[a]===b){return a;}}return null; 73 | },hasValue:function(a){return(Hash.keyOf(this,a)!==null);},extend:function(a){Hash.each(a||{},function(c,b){Hash.set(this,b,c);},this);return this;},combine:function(a){Hash.each(a||{},function(c,b){Hash.include(this,b,c); 74 | },this);return this;},erase:function(a){if(this.hasOwnProperty(a)){delete this[a];}return this;},get:function(a){return(this.hasOwnProperty(a))?this[a]:null; 75 | },set:function(a,b){if(!this[a]||this.hasOwnProperty(a)){this[a]=b;}return this;},empty:function(){Hash.each(this,function(b,a){delete this[a];},this); 76 | return this;},include:function(a,b){if(this[a]==undefined){this[a]=b;}return this;},map:function(b,c){var a=new Hash;Hash.each(this,function(e,d){a.set(d,b.call(c,e,d,this)); 77 | },this);return a;},filter:function(b,c){var a=new Hash;Hash.each(this,function(e,d){if(b.call(c,e,d,this)){a.set(d,e);}},this);return a;},every:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&!b.call(c,this[a],a)){return false; 78 | }}return true;},some:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&b.call(c,this[a],a)){return true;}}return false;},getKeys:function(){var a=[]; 79 | Hash.each(this,function(c,b){a.push(b);});return a;},getValues:function(){var a=[];Hash.each(this,function(b){a.push(b);});return a;},toQueryString:function(a){var b=[]; 80 | Hash.each(this,function(f,e){if(a){e=a+"["+e+"]";}var d;switch($type(f)){case"object":d=Hash.toQueryString(f,e);break;case"array":var c={};f.each(function(h,g){c[g]=h; 81 | });d=Hash.toQueryString(c,e);break;default:d=e+"="+encodeURIComponent(f);}if(f!=undefined){b.push(d);}});return b.join("&");}});Hash.alias({keyOf:"indexOf",hasValue:"contains"}); 82 | var Event=new Native({name:"Event",initialize:function(a,f){f=f||window;var k=f.document;a=a||f.event;if(a.$extended){return a;}this.$extended=true;var j=a.type; 83 | var g=a.target||a.srcElement;while(g&&g.nodeType==3){g=g.parentNode;}if(j.test(/key/)){var b=a.which||a.keyCode;var m=Event.Keys.keyOf(b);if(j=="keydown"){var d=b-111; 84 | if(d>0&&d<13){m="f"+d;}}m=m||String.fromCharCode(b).toLowerCase();}else{if(j.match(/(click|mouse|menu)/i)){k=(!k.compatMode||k.compatMode=="CSS1Compat")?k.html:k.body; 85 | var i={x:a.pageX||a.clientX+k.scrollLeft,y:a.pageY||a.clientY+k.scrollTop};var c={x:(a.pageX)?a.pageX-f.pageXOffset:a.clientX,y:(a.pageY)?a.pageY-f.pageYOffset:a.clientY}; 86 | if(j.match(/DOMMouseScroll|mousewheel/)){var h=(a.wheelDelta)?a.wheelDelta/120:-(a.detail||0)/3;}var e=(a.which==3)||(a.button==2);var l=null;if(j.match(/over|out/)){switch(j){case"mouseover":l=a.relatedTarget||a.fromElement; 87 | break;case"mouseout":l=a.relatedTarget||a.toElement;}if(!(function(){while(l&&l.nodeType==3){l=l.parentNode;}return true;}).create({attempt:Browser.Engine.gecko})()){l=false; 88 | }}}}return $extend(this,{event:a,type:j,page:i,client:c,rightClick:e,wheel:h,relatedTarget:l,target:g,code:b,key:m,shift:a.shiftKey,control:a.ctrlKey,alt:a.altKey,meta:a.metaKey}); 89 | }});Event.Keys=new Hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Event.implement({stop:function(){return this.stopPropagation().preventDefault(); 90 | },stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault(); 91 | }else{this.event.returnValue=false;}return this;}});function Class(b){if(b instanceof Function){b={initialize:b};}var a=function(){Object.reset(this);if(a._prototyping){return this; 92 | }this._current=$empty;var c=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return c;}.extend(this); 93 | a.implement(b);a.constructor=Class;a.prototype.constructor=a;return a;}Function.prototype.protect=function(){this._protected=true;return this;};Object.reset=function(a,c){if(c==null){for(var e in a){Object.reset(a,e); 94 | }return a;}delete a[c];switch($type(a[c])){case"object":var d=function(){};d.prototype=a[c];var b=new d;a[c]=Object.reset(b);break;case"array":a[c]=$unlink(a[c]); 95 | break;}return a;};new Native({name:"Class",initialize:Class}).extend({instantiate:function(b){b._prototyping=true;var a=new b;delete b._prototyping;return a; 96 | },wrap:function(a,b,c){if(c._origin){c=c._origin;}return function(){if(c._protected&&this._current==null){throw new Error('The method "'+b+'" cannot be called.'); 97 | }var e=this.caller,f=this._current;this.caller=f;this._current=arguments.callee;var d=c.apply(this,arguments);this._current=f;this.caller=e;return d;}.extend({_owner:a,_origin:c,_name:b}); 98 | }});Class.implement({implement:function(a,d){if($type(a)=="object"){for(var e in a){this.implement(e,a[e]);}return this;}var f=Class.Mutators[a];if(f){d=f.call(this,d); 99 | if(d==null){return this;}}var c=this.prototype;switch($type(d)){case"function":if(d._hidden){return this;}c[a]=Class.wrap(this,a,d);break;case"object":var b=c[a]; 100 | if($type(b)=="object"){$mixin(b,d);}else{c[a]=$unlink(d);}break;case"array":c[a]=$unlink(d);break;default:c[a]=d;}return this;}});Class.Mutators={Extends:function(a){this.parent=a; 101 | this.prototype=Class.instantiate(a);this.implement("parent",function(){var b=this.caller._name,c=this.caller._owner.parent.prototype[b];if(!c){throw new Error('The method "'+b+'" has no parent.'); 102 | }return c.apply(this,arguments);}.protect());},Implements:function(a){$splat(a).each(function(b){if(b instanceof Function){b=Class.instantiate(b);}this.implement(b); 103 | },this);}};var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false; 104 | },clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(c,b,a){c=Events.removeOn(c);if(b!=$empty){this.$events[c]=this.$events[c]||[]; 105 | this.$events[c].include(b);if(a){b.internal=true;}}return this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this;},fireEvent:function(c,b,a){c=Events.removeOn(c); 106 | if(!this.$events||!this.$events[c]){return this;}this.$events[c].each(function(d){d.create({bind:this,delay:a,"arguments":b})();},this);return this;},removeEvent:function(b,a){b=Events.removeOn(b); 107 | if(!this.$events[b]){return this;}if(!a.internal){this.$events[b].erase(a);}return this;},removeEvents:function(c){var d;if($type(c)=="object"){for(d in c){this.removeEvent(d,c[d]); 108 | }return this;}if(c){c=Events.removeOn(c);}for(d in this.$events){if(c&&c!=d){continue;}var b=this.$events[d];for(var a=b.length;a--;a){this.removeEvent(d,b[a]); 109 | }}return this;}});Events.removeOn=function(a){return a.replace(/^on([A-Z])/,function(b,c){return c.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments)); 110 | if(!this.addEvent){return this;}for(var a in this.options){if($type(this.options[a])!="function"||!(/^on[A-Z]/).test(a)){continue;}this.addEvent(a,this.options[a]); 111 | delete this.options[a];}return this;}});var Element=new Native({name:"Element",legacy:window.Element,initialize:function(a,b){var c=Element.Constructors.get(a); 112 | if(c){return c(b);}if(typeof a=="string"){return document.newElement(a,b);}return document.id(a).set(b);},afterImplement:function(a,b){Element.Prototype[a]=b; 113 | if(Array[a]){return;}Elements.implement(a,function(){var c=[],g=true;for(var e=0,d=this.length;e";}return document.id(this.createElement(a)).set(b);},newTextNode:function(a){return this.createTextNode(a); 123 | },getDocument:function(){return this;},getWindow:function(){return this.window;},id:(function(){var a={string:function(d,c,b){d=b.getElementById(d);return(d)?a.element(d,c):null; 124 | },element:function(b,e){$uid(b);if(!e&&!b.$family&&!(/^object|embed$/i).test(b.tagName)){var c=Element.Prototype;for(var d in c){b[d]=c[d];}}return b;},object:function(c,d,b){if(c.toElement){return a.element(c.toElement(b),d); 125 | }return null;}};a.textnode=a.whitespace=a.window=a.document=$arguments(0);return function(c,e,d){if(c&&c.$family&&c.uid){return c;}var b=$type(c);return(a[b])?a[b](c,e,d||document):null; 126 | };})()});if(window.$==null){Window.implement({$:function(a,b){return document.id(a,b,this.document);}});}Window.implement({$$:function(a){if(arguments.length==1&&typeof a=="string"){return this.document.getElements(a); 127 | }var f=[];var c=Array.flatten(arguments);for(var d=0,b=c.length;d1);a.each(function(e){var f=this.getElementsByTagName(e.trim());(b)?c.extend(f):c=f; 130 | },this);return new Elements(c,{ddup:b,cash:!d});}});(function(){var h={},f={};var i={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"}; 131 | var c=function(l){return(f[l]||(f[l]={}));};var g=function(n,l){if(!n){return;}var m=n.uid;if(Browser.Engine.trident){if(n.clearAttributes){var q=l&&n.cloneNode(false); 132 | n.clearAttributes();if(q){n.mergeAttributes(q);}}else{if(n.removeEvents){n.removeEvents();}}if((/object/i).test(n.tagName)){for(var o in n){if(typeof n[o]=="function"){n[o]=$empty; 133 | }}Element.dispose(n);}}if(!m){return;}h[m]=f[m]=null;};var d=function(){Hash.each(h,g);if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(g); 134 | }if(window.CollectGarbage){CollectGarbage();}h=f=null;};var j=function(n,l,s,m,p,r){var o=n[s||l];var q=[];while(o){if(o.nodeType==1&&(!m||Element.match(o,m))){if(!p){return document.id(o,r); 135 | }q.push(o);}o=o[l];}return(p)?new Elements(q,{ddup:false,cash:!r}):null;};var e={html:"innerHTML","class":"className","for":"htmlFor",defaultValue:"defaultValue",text:(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?"innerText":"textContent"}; 136 | var b=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];var k=["value","type","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"]; 137 | b=b.associate(b);Hash.extend(e,b);Hash.extend(e,k.associate(k.map(String.toLowerCase)));var a={before:function(m,l){if(l.parentNode){l.parentNode.insertBefore(m,l); 138 | }},after:function(m,l){if(!l.parentNode){return;}var n=l.nextSibling;(n)?l.parentNode.insertBefore(m,n):l.parentNode.appendChild(m);},bottom:function(m,l){l.appendChild(m); 139 | },top:function(m,l){var n=l.firstChild;(n)?l.insertBefore(m,n):l.appendChild(m);}};a.inside=a.bottom;Hash.each(a,function(l,m){m=m.capitalize();Element.implement("inject"+m,function(n){l(this,document.id(n,true)); 140 | return this;});Element.implement("grab"+m,function(n){l(document.id(n,true),this);return this;});});Element.implement({set:function(o,m){switch($type(o)){case"object":for(var n in o){this.set(n,o[n]); 141 | }break;case"string":var l=Element.Properties.get(o);(l&&l.set)?l.set.apply(this,Array.slice(arguments,1)):this.setProperty(o,m);}return this;},get:function(m){var l=Element.Properties.get(m); 142 | return(l&&l.get)?l.get.apply(this,Array.slice(arguments,1)):this.getProperty(m);},erase:function(m){var l=Element.Properties.get(m);(l&&l.erase)?l.erase.apply(this):this.removeProperty(m); 143 | return this;},setProperty:function(m,n){var l=e[m];if(n==undefined){return this.removeProperty(m);}if(l&&b[m]){n=!!n;}(l)?this[l]=n:this.setAttribute(m,""+n); 144 | return this;},setProperties:function(l){for(var m in l){this.setProperty(m,l[m]);}return this;},getProperty:function(m){var l=e[m];var n=(l)?this[l]:this.getAttribute(m,2); 145 | return(b[m])?!!n:(l)?n:n||null;},getProperties:function(){var l=$A(arguments);return l.map(this.getProperty,this).associate(l);},removeProperty:function(m){var l=e[m]; 146 | (l)?this[l]=(l&&b[m])?false:"":this.removeAttribute(m);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this; 147 | },hasClass:function(l){return this.className.contains(l," ");},addClass:function(l){if(!this.hasClass(l)){this.className=(this.className+" "+l).clean(); 148 | }return this;},removeClass:function(l){this.className=this.className.replace(new RegExp("(^|\\s)"+l+"(?:\\s|$)"),"$1");return this;},toggleClass:function(l){return this.hasClass(l)?this.removeClass(l):this.addClass(l); 149 | },adopt:function(){Array.flatten(arguments).each(function(l){l=document.id(l,true);if(l){this.appendChild(l);}},this);return this;},appendText:function(m,l){return this.grab(this.getDocument().newTextNode(m),l); 150 | },grab:function(m,l){a[l||"bottom"](document.id(m,true),this);return this;},inject:function(m,l){a[l||"bottom"](this,document.id(m,true));return this;},replaces:function(l){l=document.id(l,true); 151 | l.parentNode.replaceChild(this,l);return this;},wraps:function(m,l){m=document.id(m,true);return this.replaces(m).grab(m,l);},getPrevious:function(l,m){return j(this,"previousSibling",null,l,false,m); 152 | },getAllPrevious:function(l,m){return j(this,"previousSibling",null,l,true,m);},getNext:function(l,m){return j(this,"nextSibling",null,l,false,m);},getAllNext:function(l,m){return j(this,"nextSibling",null,l,true,m); 153 | },getFirst:function(l,m){return j(this,"nextSibling","firstChild",l,false,m);},getLast:function(l,m){return j(this,"previousSibling","lastChild",l,false,m); 154 | },getParent:function(l,m){return j(this,"parentNode",null,l,false,m);},getParents:function(l,m){return j(this,"parentNode",null,l,true,m);},getSiblings:function(l,m){return this.getParent().getChildren(l,m).erase(this); 155 | },getChildren:function(l,m){return j(this,"nextSibling","firstChild",l,true,m);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument; 156 | },getElementById:function(o,n){var m=this.ownerDocument.getElementById(o);if(!m){return null;}for(var l=m.parentNode;l!=this;l=l.parentNode){if(!l){return null; 157 | }}return document.id(m,n);},getSelected:function(){return new Elements($A(this.options).filter(function(l){return l.selected;}));},getComputedStyle:function(m){if(this.currentStyle){return this.currentStyle[m.camelCase()]; 158 | }var l=this.getDocument().defaultView.getComputedStyle(this,null);return(l)?l.getPropertyValue([m.hyphenate()]):null;},toQueryString:function(){var l=[]; 159 | this.getElements("input, select, textarea",true).each(function(m){if(!m.name||m.disabled||m.type=="submit"||m.type=="reset"||m.type=="file"){return;}var n=(m.tagName.toLowerCase()=="select")?Element.getSelected(m).map(function(o){return o.value; 160 | }):((m.type=="radio"||m.type=="checkbox")&&!m.checked)?null:m.value;$splat(n).each(function(o){if(typeof o!="undefined"){l.push(m.name+"="+encodeURIComponent(o)); 161 | }});});return l.join("&");},clone:function(o,l){o=o!==false;var r=this.cloneNode(o);var n=function(v,u){if(!l){v.removeAttribute("id");}if(Browser.Engine.trident){v.clearAttributes(); 162 | v.mergeAttributes(u);v.removeAttribute("uid");if(v.options){var w=v.options,s=u.options;for(var t=w.length;t--;){w[t].selected=s[t].selected;}}}var x=i[u.tagName.toLowerCase()]; 163 | if(x&&u[x]){v[x]=u[x];}};if(o){var p=r.getElementsByTagName("*"),q=this.getElementsByTagName("*");for(var m=p.length;m--;){n(p[m],q[m]);}}n(r,this);return document.id(r); 164 | },destroy:function(){Element.empty(this);Element.dispose(this);g(this,true);return null;},empty:function(){$A(this.childNodes).each(function(l){Element.destroy(l); 165 | });return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(l){l=document.id(l,true);if(!l){return false; 166 | }if(Browser.Engine.webkit&&Browser.Engine.version<420){return $A(this.getElementsByTagName(l.tagName)).contains(l);}return(this.contains)?(this!=l&&this.contains(l)):!!(this.compareDocumentPosition(l)&16); 167 | },match:function(l){return(!l||(l==this)||(Element.get(this,"tag")==l));}});Native.implement([Element,Window,Document],{addListener:function(o,n){if(o=="unload"){var l=n,m=this; 168 | n=function(){m.removeListener("unload",n);l();};}else{h[this.uid]=this;}if(this.addEventListener){this.addEventListener(o,n,false);}else{this.attachEvent("on"+o,n); 169 | }return this;},removeListener:function(m,l){if(this.removeEventListener){this.removeEventListener(m,l,false);}else{this.detachEvent("on"+m,l);}return this; 170 | },retrieve:function(m,l){var o=c(this.uid),n=o[m];if(l!=undefined&&n==undefined){n=o[m]=l;}return $pick(n);},store:function(m,l){var n=c(this.uid);n[m]=l; 171 | return this;},eliminate:function(l){var m=c(this.uid);delete m[l];return this;}});window.addListener("unload",d);})();Element.Properties=new Hash;Element.Properties.style={set:function(a){this.style.cssText=a; 172 | },get:function(){return this.style.cssText;},erase:function(){this.style.cssText="";}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase(); 173 | }};Element.Properties.html=(function(){var c=document.createElement("div");var a={table:[1,"","
"],select:[1,""],tbody:[2,"","
"],tr:[3,"","
"]}; 174 | a.thead=a.tfoot=a.tbody;var b={set:function(){var e=Array.flatten(arguments).join("");var f=Browser.Engine.trident&&a[this.get("tag")];if(f){var g=c;g.innerHTML=f[1]+e+f[2]; 175 | for(var d=f[0];d--;){g=g.firstChild;}this.empty().adopt(g.childNodes);}else{this.innerHTML=e;}}};b.erase=b.set;return b;})();if(Browser.Engine.webkit&&Browser.Engine.version<420){Element.Properties.text={get:function(){if(this.innerText){return this.innerText; 176 | }var a=this.ownerDocument.newElement("div",{html:this.innerHTML}).inject(this.ownerDocument.body);var b=a.innerText;a.destroy();return b;}};}Element.Properties.events={set:function(a){this.addEvents(a); 177 | }};Native.implement([Element,Window,Document],{addEvent:function(e,g){var h=this.retrieve("events",{});h[e]=h[e]||{keys:[],values:[]};if(h[e].keys.contains(g)){return this; 178 | }h[e].keys.push(g);var f=e,a=Element.Events.get(e),c=g,i=this;if(a){if(a.onAdd){a.onAdd.call(this,g);}if(a.condition){c=function(j){if(a.condition.call(this,j)){return g.call(this,j); 179 | }return true;};}f=a.base||f;}var d=function(){return g.call(i);};var b=Element.NativeEvents[f];if(b){if(b==2){d=function(j){j=new Event(j,i.getWindow()); 180 | if(c.call(i,j)===false){j.stop();}};}this.addListener(f,d);}h[e].values.push(d);return this;},removeEvent:function(c,b){var a=this.retrieve("events");if(!a||!a[c]){return this; 181 | }var f=a[c].keys.indexOf(b);if(f==-1){return this;}a[c].keys.splice(f,1);var e=a[c].values.splice(f,1)[0];var d=Element.Events.get(c);if(d){if(d.onRemove){d.onRemove.call(this,b); 182 | }c=d.base||c;}return(Element.NativeEvents[c])?this.removeListener(c,e):this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this; 183 | },removeEvents:function(a){var c;if($type(a)=="object"){for(c in a){this.removeEvent(c,a[c]);}return this;}var b=this.retrieve("events");if(!b){return this; 184 | }if(!a){for(c in b){this.removeEvents(c);}this.eliminate("events");}else{if(b[a]){while(b[a].keys[0]){this.removeEvent(a,b[a].keys[0]);}b[a]=null;}}return this; 185 | },fireEvent:function(d,b,a){var c=this.retrieve("events");if(!c||!c[d]){return this;}c[d].keys.each(function(e){e.create({bind:this,delay:a,"arguments":b})(); 186 | },this);return this;},cloneEvents:function(d,a){d=document.id(d);var c=d.retrieve("events");if(!c){return this;}if(!a){for(var b in c){this.cloneEvents(d,b); 187 | }}else{if(c[a]){c[a].keys.each(function(e){this.addEvent(a,e);},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1}; 188 | (function(){var a=function(b){var c=b.relatedTarget;if(c==undefined){return true;}if(c===false){return false;}return($type(this)!="document"&&c!=this&&c.prefix!="xul"&&!this.hasChild(c)); 189 | };Element.Events=new Hash({mouseenter:{base:"mouseover",condition:a},mouseleave:{base:"mouseout",condition:a},mousewheel:{base:(Browser.Engine.gecko)?"DOMMouseScroll":"mousewheel"}}); 190 | })();Element.Properties.styles={set:function(a){this.setStyles(a);}};Element.Properties.opacity={set:function(a,b){if(!b){if(a==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden"; 191 | }}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;}if(Browser.Engine.trident){this.style.filter=(a==1)?"":"alpha(opacity="+a*100+")"; 192 | }this.style.opacity=a;this.store("opacity",a);},get:function(){return this.retrieve("opacity",1);}};Element.implement({setOpacity:function(a){return this.set("opacity",a,true); 193 | },getOpacity:function(){return this.get("opacity");},setStyle:function(b,a){switch(b){case"opacity":return this.set("opacity",parseFloat(a));case"float":b=(Browser.Engine.trident)?"styleFloat":"cssFloat"; 194 | }b=b.camelCase();if($type(a)!="string"){var c=(Element.Styles.get(b)||"@").split(" ");a=$splat(a).map(function(e,d){if(!c[d]){return"";}return($type(e)=="number")?c[d].replace("@",Math.round(e)):e; 195 | }).join(" ");}else{if(a==String(Number(a))){a=Math.round(a);}}this.style[b]=a;return this;},getStyle:function(g){switch(g){case"opacity":return this.get("opacity"); 196 | case"float":g=(Browser.Engine.trident)?"styleFloat":"cssFloat";}g=g.camelCase();var a=this.style[g];if(!$chk(a)){a=[];for(var f in Element.ShortStyles){if(g!=f){continue; 197 | }for(var e in Element.ShortStyles[f]){a.push(this.getStyle(e));}return a.join(" ");}a=this.getComputedStyle(g);}if(a){a=String(a);var c=a.match(/rgba?\([\d\s,]+\)/); 198 | if(c){a=a.replace(c[0],c[0].rgbToHex());}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(a,10)))){if(g.test(/^(height|width)$/)){var b=(g=="width")?["left","right"]:["top","bottom"],d=0; 199 | b.each(function(h){d+=this.getStyle("border-"+h+"-width").toInt()+this.getStyle("padding-"+h).toInt();},this);return this["offset"+g.capitalize()]-d+"px"; 200 | }if((Browser.Engine.presto)&&String(a).test("px")){return a;}if(g.test(/(border(.+)Width|margin|padding)/)){return"0px";}}return a;},setStyles:function(b){for(var a in b){this.setStyle(a,b[a]); 201 | }return this;},getStyles:function(){var a={};Array.flatten(arguments).each(function(b){a[b]=this.getStyle(b);},this);return a;}});Element.Styles=new Hash({left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"}); 202 | Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(g){var f=Element.ShortStyles; 203 | var b=Element.Styles;["margin","padding"].each(function(h){var i=h+g;f[h][i]=b[i]="@px";});var e="border"+g;f.border[e]=b[e]="@px @ rgb(@, @, @)";var d=e+"Width",a=e+"Style",c=e+"Color"; 204 | f[e]={};f.borderWidth[d]=f[e][d]=b[d]="@px";f.borderStyle[a]=f[e][a]=b[a]="@";f.borderColor[c]=f[e][c]=b[c]="rgb(@, @, @)";});(function(){Element.implement({scrollTo:function(h,i){if(b(this)){this.getWindow().scrollTo(h,i); 205 | }else{this.scrollLeft=h;this.scrollTop=i;}return this;},getSize:function(){if(b(this)){return this.getWindow().getSize();}return{x:this.offsetWidth,y:this.offsetHeight}; 206 | },getScrollSize:function(){if(b(this)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(b(this)){return this.getWindow().getScroll(); 207 | }return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var i=this,h={x:0,y:0};while(i&&!b(i)){h.x+=i.scrollLeft;h.y+=i.scrollTop;i=i.parentNode; 208 | }return h;},getOffsetParent:function(){var h=this;if(b(h)){return null;}if(!Browser.Engine.trident){return h.offsetParent;}while((h=h.parentNode)&&!b(h)){if(d(h,"position")!="static"){return h; 209 | }}return null;},getOffsets:function(){if(this.getBoundingClientRect){var j=this.getBoundingClientRect(),m=document.id(this.getDocument().documentElement),p=m.getScroll(),k=this.getScrolls(),i=this.getScroll(),h=(d(this,"position")=="fixed"); 210 | return{x:j.left.toInt()+k.x-i.x+((h)?0:p.x)-m.clientLeft,y:j.top.toInt()+k.y-i.y+((h)?0:p.y)-m.clientTop};}var l=this,n={x:0,y:0};if(b(this)){return n; 211 | }while(l&&!b(l)){n.x+=l.offsetLeft;n.y+=l.offsetTop;if(Browser.Engine.gecko){if(!f(l)){n.x+=c(l);n.y+=g(l);}var o=l.parentNode;if(o&&d(o,"overflow")!="visible"){n.x+=c(o); 212 | n.y+=g(o);}}else{if(l!=this&&Browser.Engine.webkit){n.x+=c(l);n.y+=g(l);}}l=l.offsetParent;}if(Browser.Engine.gecko&&!f(this)){n.x-=c(this);n.y-=g(this); 213 | }return n;},getPosition:function(k){if(b(this)){return{x:0,y:0};}var l=this.getOffsets(),i=this.getScrolls();var h={x:l.x-i.x,y:l.y-i.y};var j=(k&&(k=document.id(k)))?k.getPosition():{x:0,y:0}; 214 | return{x:h.x-j.x,y:h.y-j.y};},getCoordinates:function(j){if(b(this)){return this.getWindow().getCoordinates();}var h=this.getPosition(j),i=this.getSize(); 215 | var k={left:h.x,top:h.y,width:i.x,height:i.y};k.right=k.left+k.width;k.bottom=k.top+k.height;return k;},computePosition:function(h){return{left:h.x-e(this,"margin-left"),top:h.y-e(this,"margin-top")}; 216 | },setPosition:function(h){return this.setStyles(this.computePosition(h));}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var i=this.getWindow(); 217 | return{x:i.innerWidth,y:i.innerHeight};}var h=a(this);return{x:h.clientWidth,y:h.clientHeight};},getScroll:function(){var i=this.getWindow(),h=a(this); 218 | return{x:i.pageXOffset||h.scrollLeft,y:i.pageYOffset||h.scrollTop};},getScrollSize:function(){var i=a(this),h=this.getSize();return{x:Math.max(i.scrollWidth,h.x),y:Math.max(i.scrollHeight,h.y)}; 219 | },getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var h=this.getSize();return{top:0,left:0,bottom:h.y,right:h.x,height:h.y,width:h.x}; 220 | }});var d=Element.getComputedStyle;function e(h,i){return d(h,i).toInt()||0;}function f(h){return d(h,"-moz-box-sizing")=="border-box";}function g(h){return e(h,"border-top-width"); 221 | }function c(h){return e(h,"border-left-width");}function b(h){return(/^(?:body|html)$/i).test(h.tagName);}function a(h){var i=h.getDocument();return(!i.compatMode||i.compatMode=="CSS1Compat")?i.html:i.body; 222 | }})();Element.alias("setPosition","position");Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x; 223 | },getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y; 224 | },getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x; 225 | }});Native.implement([Document,Element],{getElements:function(h,g){h=h.split(",");var c,e={};for(var d=0,b=h.length;d1),cash:!g});}});Element.implement({match:function(b){if(!b||(b==this)){return true; 227 | }var d=Selectors.Utils.parseTagAndID(b);var a=d[0],e=d[1];if(!Selectors.Filters.byID(this,e)||!Selectors.Filters.byTag(this,a)){return false;}var c=Selectors.Utils.parseSelector(b); 228 | return(c)?Selectors.Utils.filter(this,c,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)}; 229 | Selectors.Utils={chk:function(b,c){if(!c){return true;}var a=$uid(b);if(!c[a]){return c[a]=true;}return false;},parseNthArgument:function(h){if(Selectors.Cache.nth[h]){return Selectors.Cache.nth[h]; 230 | }var e=h.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!e){return false;}var g=parseInt(e[1],10);var d=(g||g===0)?g:1;var f=e[2]||false;var c=parseInt(e[3],10)||0; 231 | if(d!=0){c--;while(c<1){c+=d;}while(c>=d){c-=d;}}else{d=c;f="index";}switch(f){case"n":e={a:d,b:c,special:"n"};break;case"odd":e={a:2,b:0,special:"n"}; 232 | break;case"even":e={a:2,b:1,special:"n"};break;case"first":e={a:0,special:"index"};break;case"last":e={special:"last-child"};break;case"only":e={special:"only-child"}; 233 | break;default:e={a:(d-1),special:"index"};}return Selectors.Cache.nth[h]=e;},parseSelector:function(e){if(Selectors.Cache.parsed[e]){return Selectors.Cache.parsed[e]; 234 | }var d,h={classes:[],pseudos:[],attributes:[]};while((d=Selectors.RegExps.combined.exec(e))){var i=d[1],g=d[2],f=d[3],b=d[5],c=d[6],j=d[7];if(i){h.classes.push(i); 235 | }else{if(c){var a=Selectors.Pseudo.get(c);if(a){h.pseudos.push({parser:a,argument:j});}else{h.attributes.push({name:c,operator:"=",value:j});}}else{if(g){h.attributes.push({name:g,operator:f,value:b}); 236 | }}}}if(!h.classes.length){delete h.classes;}if(!h.attributes.length){delete h.attributes;}if(!h.pseudos.length){delete h.pseudos;}if(!h.classes&&!h.attributes&&!h.pseudos){h=null; 237 | }return Selectors.Cache.parsed[e]=h;},parseTagAndID:function(b){var a=b.match(Selectors.RegExps.tag);var c=b.match(Selectors.RegExps.id);return[(a)?a[1]:"*",(c)?c[1]:false]; 238 | },filter:function(f,c,e){var d;if(c.classes){for(d=c.classes.length;d--;d){var g=c.classes[d];if(!Selectors.Filters.byClass(f,g)){return false;}}}if(c.attributes){for(d=c.attributes.length; 239 | d--;d){var b=c.attributes[d];if(!Selectors.Filters.byAttribute(f,b.name,b.operator,b.value)){return false;}}}if(c.pseudos){for(d=c.pseudos.length;d--;d){var a=c.pseudos[d]; 240 | if(!Selectors.Filters.byPseudo(f,a.parser,a.argument,e)){return false;}}}return true;},getByTagAndID:function(b,a,d){if(d){var c=(b.getElementById)?b.getElementById(d,true):Element.getElementById(b,d,true); 241 | return(c&&Selectors.Filters.byTag(c,a))?[c]:[];}else{return b.getElementsByTagName(a);}},search:function(o,h,t){var b=[];var c=h.trim().replace(Selectors.RegExps.splitter,function(k,j,i){b.push(j); 242 | return":)"+i;}).split(":)");var p,e,A;for(var z=0,v=c.length;z":function(h,g,j,a,f){var c=Selectors.Utils.getByTagAndID(g,j,a);for(var e=0,d=c.length;ea){return false;}}return(c==a);},even:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n+1",a); 260 | },odd:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n",a);},selected:function(){return this.selected;},enabled:function(){return(this.disabled===false); 261 | }});Element.Events.domready={onAdd:function(a){if(Browser.loaded){a.call(this);}}};(function(){var b=function(){if(Browser.loaded){return;}Browser.loaded=true; 262 | window.fireEvent("domready");document.fireEvent("domready");};window.addEvent("load",b);if(Browser.Engine.trident){var a=document.createElement("div"); 263 | (function(){($try(function(){a.doScroll();return document.id(a).inject(document.body).set("html","temp").dispose();}))?b():arguments.callee.delay(50);})(); 264 | }else{if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(["loaded","complete"].contains(document.readyState))?b():arguments.callee.delay(50); 265 | })();}else{document.addEvent("DOMContentLoaded",b);}}})();var JSON=new Hash(this.JSON&&{stringify:JSON.stringify,parse:JSON.parse}).extend({$specialChars:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},$replaceChars:function(a){return JSON.$specialChars[a]||"\\u00"+Math.floor(a.charCodeAt()/16).toString(16)+(a.charCodeAt()%16).toString(16); 266 | },encode:function(b){switch($type(b)){case"string":return'"'+b.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(b.map(JSON.encode).clean())+"]"; 267 | case"object":case"hash":var a=[];Hash.each(b,function(e,d){var c=JSON.encode(e);if(c){a.push(JSON.encode(d)+":"+c);}});return"{"+a+"}";case"number":case"boolean":return String(b); 268 | case false:return"null";}return null;},decode:function(string,secure){if($type(string)!="string"||!string.length){return null;}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null; 269 | }return eval("("+string+")");}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Cookie=new Class({Implements:Options,options:{path:false,domain:false,duration:false,secure:false,document:document},initialize:function(b,a){this.key=b; 270 | this.setOptions(a);},write:function(b){b=encodeURIComponent(b);if(this.options.domain){b+="; domain="+this.options.domain;}if(this.options.path){b+="; path="+this.options.path; 271 | }if(this.options.duration){var a=new Date();a.setTime(a.getTime()+this.options.duration*24*60*60*1000);b+="; expires="+a.toGMTString();}if(this.options.secure){b+="; secure"; 272 | }this.options.document.cookie=this.key+"="+b;return this;},read:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)"); 273 | return(a)?decodeURIComponent(a[1]):null;},dispose:function(){new Cookie(this.key,$merge(this.options,{duration:-1})).write("");return this;}});Cookie.write=function(b,c,a){return new Cookie(b,a).write(c); 274 | };Cookie.read=function(a){return new Cookie(a).read();};Cookie.dispose=function(b,a){return new Cookie(b,a).dispose();};var Swiff=new Class({Implements:[Options],options:{id:null,height:1,width:1,container:null,properties:{},params:{quality:"high",allowScriptAccess:"always",wMode:"transparent",swLiveConnect:true},callBacks:{},vars:{}},toElement:function(){return this.object; 275 | },initialize:function(l,m){this.instance="Swiff_"+$time();this.setOptions(m);m=this.options;var b=this.id=m.id||this.instance;var a=document.id(m.container); 276 | Swiff.CallBacks[this.instance]={};var e=m.params,g=m.vars,f=m.callBacks;var h=$extend({height:m.height,width:m.width},m.properties);var k=this;for(var d in f){Swiff.CallBacks[this.instance][d]=(function(n){return function(){return n.apply(k.object,arguments); 277 | };})(f[d]);g[d]="Swiff.CallBacks."+this.instance+"."+d;}e.flashVars=Hash.toQueryString(g);if(Browser.Engine.trident){h.classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"; 278 | e.movie=l;}else{h.type="application/x-shockwave-flash";h.data=l;}var j=''; 279 | }}j+="";this.object=((a)?a.empty():new Element("div")).set("html",j).firstChild;},replaces:function(a){a=document.id(a,true);a.parentNode.replaceChild(this.toElement(),a); 280 | return this;},inject:function(a){document.id(a,true).appendChild(this.toElement());return this;},remote:function(){return Swiff.remote.apply(Swiff,[this.toElement()].extend(arguments)); 281 | }});Swiff.CallBacks={};Swiff.remote=function(obj,fn){var rs=obj.CallFunction(''+__flash__argumentsToXML(arguments,2)+""); 282 | return eval(rs);};var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore"},initialize:function(a){this.subject=this.subject||this; 283 | this.setOptions(a);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var b=this.options.wait;if(b===false){this.options.link="cancel"; 284 | }},getTransition:function(){return function(a){return -(Math.cos(Math.PI*a)-1)/2;};},step:function(){var a=$time();if(a=(7-4*d)/11){e=c*c-Math.pow((11-6*d-11*f)/4,2); 325 | break;}}return e;},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,[a+2]); 326 | });});var Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,noCache:false},initialize:function(a){this.xhr=new Browser.Request(); 327 | this.setOptions(a);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running){return; 328 | }this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));this.xhr.onreadystatechange=$empty;if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML}; 329 | this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}},isSuccess:function(){return((this.status>=200)&&(this.status<300)); 330 | },processScripts:function(a){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(a);}return a.stripScripts(this.options.evalScripts); 331 | },success:function(b,a){this.onSuccess(this.processScripts(b),a);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain(); 332 | },failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},setHeader:function(a,b){this.headers.set(a,b); 333 | return this;},getHeader:function(a){return $try(function(){return this.xhr.getResponseHeader(a);}.bind(this));},check:function(){if(!this.running){return true; 334 | }switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));return false;}return false;},send:function(k){if(!this.check(k)){return this; 335 | }this.running=true;var i=$type(k);if(i=="string"||i=="element"){k={data:k};}var d=this.options;k=$extend({data:d.data,url:d.url,method:d.method},k);var g=k.data,b=String(k.url),a=k.method.toLowerCase(); 336 | switch($type(g)){case"element":g=document.id(g).toQueryString();break;case"object":case"hash":g=Hash.toQueryString(g);}if(this.options.format){var j="format="+this.options.format; 337 | g=(g)?j+"&"+g:j;}if(this.options.emulation&&!["get","post"].contains(a)){var h="_method="+a;g=(g)?h+"&"+g:h;a="post";}if(this.options.urlEncoded&&a=="post"){var c=(this.options.encoding)?"; charset="+this.options.encoding:""; 338 | this.headers.set("Content-type","application/x-www-form-urlencoded"+c);}if(this.options.noCache){var f="noCache="+new Date().getTime();g=(g)?f+"&"+g:f; 339 | }var e=b.lastIndexOf("/");if(e>-1&&(e=b.indexOf("#"))>-1){b=b.substr(0,e);}if(g&&a=="get"){b=b+(b.contains("?")?"&":"?")+g;g=null;}this.xhr.open(a.toUpperCase(),b,this.options.async); 340 | this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(m,l){try{this.xhr.setRequestHeader(l,m);}catch(n){this.fireEvent("exception",[l,m]); 341 | }},this);this.fireEvent("request");this.xhr.send(g);if(!this.options.async){this.onStateChange();}return this;},cancel:function(){if(!this.running){return this; 342 | }this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});(function(){var a={}; 343 | ["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(b){a[b]=function(){var c=Array.link(arguments,{url:String.type,data:$defined}); 344 | return this.send($extend(c,{method:b}));};});Request.implement(a);})();Element.Properties.send={set:function(a){var b=this.retrieve("send");if(b){b.cancel(); 345 | }return this.eliminate("send").store("send:options",$extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},a));},get:function(a){if(a||!this.retrieve("send")){if(a||!this.retrieve("send:options")){this.set("send",a); 346 | }this.store("send",new Request(this.retrieve("send:options")));}return this.retrieve("send");}};Element.implement({send:function(a){var b=this.get("send"); 347 | b.send({data:this,url:a||b.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(c){var b=c.match(/]*>([\s\S]*?)<\/body>/i); 348 | c=(b)?b[1]:c;var a=new Element("div");return $try(function(){var d=""+c+"",g;if(Browser.Engine.trident){g=new ActiveXObject("Microsoft.XMLDOM"); 349 | g.async=false;g.loadXML(d);}else{g=new DOMParser().parseFromString(d,"text/xml");}d=g.getElementsByTagName("root")[0];if(!d){return null;}for(var f=0,e=d.childNodes.length; 350 | f)[^>]*$|^#([\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
a"; 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="";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-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=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=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-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;j0){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":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=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 hl[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=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";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=""; 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="

";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="
";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=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},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-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=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_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
","
"];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;b0||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;e0?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]===""&&!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=//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("
").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").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=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
"; 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); 155 | 156 | --------------------------------------------------------------------------------