From 23769c2c3b51e07eb489fdc12bdad5c93a6b0263 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Tue, 9 Nov 2010 23:48:00 +0800 Subject: [PATCH 01/25] added more docs --- README | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/README b/README index 108c1eb..ea088e7 100644 --- a/README +++ b/README @@ -51,4 +51,68 @@ Yes and no. Yes, the previous version of library perfectly works in complex appl But here is the development snapshot if new, completely rewritten version. It's highly unstable. So, if you like an idea, you're welcome to experiment with it, report bugs, suggest improvements, and write plug-ins. -I need one week or so in order to make it reliable. \ No newline at end of file +I need one week or so in order to test it and make it stable. + +Current Features +================ +Since include.js is wrapper on top of require.js, it can include require.js modules. However, it adds a number of improvements in usability... + +1. Better API for require.js functionality +------------------------------------------ +require.js: + require( [ 'mod/one', 'mod/two', 'mod/three' ], + function( first, second, third ){ // try to make a change in this dependency list without mistake. + ... + return what_we_have_defined; // there are the mess of 'returns' in JS code - which one is export? + }); + +include.js: + include({ + first : 'mod/one', + second : 'mod/two', + third : 'mod/three' + }) + .define( function( _ ){ + // you can refer to dependencies as _.first, _.second, _.third + _.exports = what_we_have_defined; // you may use this instead of return. + }); + +require.js: + require(["a.js", "b.js", "some/module"], function() { // Loading mix of plain .js files and 'modules'. + //interesting detail - what will happen with our module arguments? Have an idea? + }); + +include.js: + include( + "a.js", + "b.js", + { + module : "some/module" + } + ).define( function( _ ){ + // In this case it's clear, isn't it? + }); + +require.js: // load three modules in order... + require(["order!one.js", "order!two.js", "order!three.js"], function () { + //This callback is called after the three scripts finish loading. + }); + +include.js: + include( + [ "one.js", "two.js", "three.js" ], // feel the difference? + { + module : "some/module" // and you still can do this. + } + ).define( function( _ ){ + //... + }); + +Yep, require.js is really the great library. Unfortunately, I can't use their API. Thingers refuse to type, man. :) + +More features description coming soon... +---------------------------------------- + +Planned Features +================ +Coming soon... \ No newline at end of file From aeaeab772a5822ede404d0acaafb0635d84974d8 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Tue, 9 Nov 2010 23:49:30 +0800 Subject: [PATCH 02/25] fixed typos --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index ea088e7..50f5aad 100644 --- a/README +++ b/README @@ -108,7 +108,7 @@ include.js: //... }); -Yep, require.js is really the great library. Unfortunately, I can't use their API. Thingers refuse to type, man. :) +Yep, require.js is really the great library. Unfortunately, I can't use their API. Fingers refusing to type, man. :) More features description coming soon... ---------------------------------------- From 5fe19cbf343493cfd7bdc8da5eb554e9eea8ef5f Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Wed, 10 Nov 2010 00:15:59 +0800 Subject: [PATCH 03/25] fixed typos --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 50f5aad..0ca5b8a 100644 --- a/README +++ b/README @@ -67,7 +67,7 @@ require.js: }); include.js: - include({ + $.include({ first : 'mod/one', second : 'mod/two', third : 'mod/three' @@ -83,7 +83,7 @@ require.js: }); include.js: - include( + $.include( "a.js", "b.js", { @@ -99,7 +99,7 @@ require.js: // load three modules in order... }); include.js: - include( + $.include( [ "one.js", "two.js", "three.js" ], // feel the difference? { module : "some/module" // and you still can do this. From a856307977750b650acf3304ac08900d4d961479 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Wed, 10 Nov 2010 17:44:41 +0800 Subject: [PATCH 04/25] added haml plugin --- plugins/haml.js | 516 +++++++++++++++++++++++++++++++++++++++++++ plugins/templates.js | 4 +- 2 files changed, 518 insertions(+), 2 deletions(-) create mode 100644 plugins/haml.js diff --git a/plugins/haml.js b/plugins/haml.js new file mode 100644 index 0000000..0a47abf --- /dev/null +++ b/plugins/haml.js @@ -0,0 +1,516 @@ +$.include.plugins.haml = (function () { + + var matchers, self_close_tags, embedder, forceXML; + + function html_escape(text) { + return (text + ""). + replace(/&/g, "&"). + replace(//g, ">"). + replace(/\"/g, """); + } + + function render_attribs(attribs) { + var key, value, result = []; + for (key in attribs) { + if (key !== '_content' && attribs.hasOwnProperty(key)) { + switch (attribs[key]) { + case 'undefined': + case 'false': + case 'null': + case '""': + break; + default: + try { + value = JSON.parse("[" + attribs[key] +"]")[0]; + if (value === true) { + value = key; + } else if (typeof value === 'string' && embedder.test(value)) { + value = '" +\n' + parse_interpol(html_escape(value)) + ' +\n"'; + } else { + value = html_escape(value); + } + result.push(" " + key + '=\\"' + value + '\\"'); + } catch (e) { + result.push(" " + key + '=\\"" + html_escape(' + attribs[key] + ') + "\\"'); + } + } + } + } + return result.join(""); + } + + // Parse the attribute block using a state machine + function parse_attribs(line) { + var attributes = {}, + l = line.length, + i, c, + count = 1, + quote = false, + skip = false, + open, close, joiner, seperator, + pair = { + start: 1, + middle: null, + end: null + }; + + if (!(l > 0 && (line.charAt(0) === '{' || line.charAt(0) === '('))) { + return { + _content: line[0] === ' ' ? line.substr(1, l) : line + }; + } + open = line.charAt(0); + close = (open === '{') ? '}' : ')'; + joiner = (open === '{') ? ':' : '='; + seperator = (open === '{') ? ',' : ' '; + + function process_pair() { + if (typeof pair.start === 'number' && + typeof pair.middle === 'number' && + typeof pair.end === 'number') { + var key = line.substr(pair.start, pair.middle - pair.start).trim(), + value = line.substr(pair.middle + 1, pair.end - pair.middle - 1).trim(); + attributes[key] = value; + } + pair = { + start: null, + middle: null, + end: null + }; + } + + for (i = 1; count > 0; i += 1) { + + // If we reach the end of the line, then there is a problem + if (i > l) { + throw "Malformed attribute block"; + } + + c = line.charAt(i); + if (skip) { + skip = false; + } else { + if (quote) { + if (c === '\\') { + skip = true; + } + if (c === quote) { + quote = false; + } + } else { + if (c === '"' || c === "'") { + quote = c; + } + + if (count === 1) { + if (c === joiner) { + pair.middle = i; + } + if (c === seperator || c === close) { + pair.end = i; + process_pair(); + if (c === seperator) { + pair.start = i + 1; + } + } + } + + if (c === open || c === "(") { + count += 1; + } + if (c === close || (count > 1 && c === ")")) { + count -= 1; + } + } + } + } + attributes._content = line.substr(i, line.length); + return attributes; + } + + // Split interpolated strings into an array of literals and code fragments. + function parse_interpol(value) { + var items = [], + pos = 0, + next = 0, + match; + while (true) { + // Match up to embedded string + next = value.substr(pos).search(embedder); + if (next < 0) { + if (pos < value.length) { + items.push(JSON.stringify(value.substr(pos))); + } + break; + } + items.push(JSON.stringify(value.substr(pos, next))); + pos += next; + + // Match embedded string + match = value.substr(pos).match(embedder); + next = match[0].length; + if (next < 0) { break; } + items.push(match[1] || match[2]); + pos += next; + } + return items.filter(function (part) { return part && part.length > 0}).join(" +\n"); + } + + // Used to find embedded code in interpolated strings. + embedder = /\#\{([^}]*)\}/; + + self_close_tags = ["meta", "img", "link", "br", "hr", "input", "area", "base"]; + + // All matchers' regexps should capture leading whitespace in first capture + // and trailing content in last capture + matchers = [ + // html tags + { + regexp: /^(\s*)((?:[.#%][a-z_\-][a-z0-9_:\-]*)+)(.*)$/i, + process: function () { + var tag, classes, ids, attribs, content; + tag = this.matches[2]; + classes = tag.match(/\.([a-z_\-][a-z0-9_\-]*)/gi); + ids = tag.match(/\#([a-z_\-][a-z0-9_\-]*)/gi); + tag = tag.match(/\%([a-z_\-][a-z0-9_:\-]*)/gi); + + // Default to
tag + tag = tag ? tag[0].substr(1, tag[0].length) : 'div'; + + attribs = this.matches[3]; + if (attribs) { + attribs = parse_attribs(attribs); + if (attribs._content) { + this.contents.unshift(attribs._content.trim()); + delete(attribs._content); + } + } else { + attribs = {}; + } + + if (classes) { + classes = classes.map(function (klass) { + return klass.substr(1, klass.length); + }).join(' '); + if (attribs['class']) { + try { + attribs['class'] = JSON.stringify(classes + " " + JSON.parse(attribs['class'])); + } catch (e) { + attribs['class'] = JSON.stringify(classes + " ") + " + " + attribs['class']; + } + } else { + attribs['class'] = JSON.stringify(classes); + } + } + if (ids) { + ids = ids.map(function (id) { + return id.substr(1, id.length); + }).join(' '); + if (attribs.id) { + attribs.id = JSON.stringify(ids + " ") + attribs.id; + } else { + attribs.id = JSON.stringify(ids); + } + } + + attribs = render_attribs(attribs); + + content = this.render_contents(); + if (content === '""') { + content = ''; + } + + if (forceXML ? content.length > 0 : self_close_tags.indexOf(tag) == -1) { + return '"<' + tag + attribs + '>"' + + (content.length > 0 ? ' + \n' + content : "") + + ' + \n""'; + } else { + return '"<' + tag + attribs + ' />"'; + } + } + }, + + // each loops + { + regexp: /^(\s*)(?::for|:each)\s+(?:([a-z_][a-z_\-]*),\s*)?([a-z_][a-z_\-]*)\s+in\s+(.*)(\s*)$/i, + process: function () { + var ivar = this.matches[2] || '__key__', // index + vvar = this.matches[3], // value + avar = this.matches[4], // array + rvar = '__result__'; // results + + if (this.matches[5]) { + this.contents.unshift(this.matches[5]); + } + return '(function () { ' + + 'var ' + rvar + ' = [], ' + ivar + ', ' + vvar + '; ' + + 'for (' + ivar + ' in ' + avar + ') { ' + + 'if (' + avar + '.hasOwnProperty(' + ivar + ')) { ' + + vvar + ' = ' + avar + '[' + ivar + ']; ' + + rvar + '.push(\n' + (this.render_contents() || "''") + '\n); ' + + '} } return ' + rvar + '.join(""); }).call(this)'; + } + }, + + // if statements + { + regexp: /^(\s*):if\s+(.*)\s*$/i, + process: function () { + var condition = this.matches[2]; + return '(function () { ' + + 'if (' + condition + ') { ' + + 'return (\n' + (this.render_contents() || '') + '\n);' + + '} else { return ""; } }).call(this)'; + } + }, + + // declarations + { + regexp: /^()!!!(?:\s*(.*))\s*$/, + process: function () { + var line = ''; + switch ((this.matches[2] || '').toLowerCase()) { + case '': + // XHTML 1.0 Transitional + line = ''; + break; + case 'strict': + case '1.0': + // XHTML 1.0 Strict + line = ''; + break; + case 'frameset': + // XHTML 1.0 Frameset + line = ''; + break; + case '5': + // XHTML 5 + line = ''; + break; + case '1.1': + // XHTML 1.1 + line = ''; + break; + case 'basic': + // XHTML Basic 1.1 + line = ''; + break; + case 'mobile': + // XHTML Mobile 1.2 + line = ''; + break; + case 'xml': + // XML + line = ""; + break; + case 'xml iso-8859-1': + // XML iso-8859-1 + line = ""; + break; + } + return JSON.stringify(line + "\n"); + } + }, + + // Embedded markdown. Needs to be added to exports externally. + { + regexp: /^(\s*):markdown\s*$/i, + process: function () { + return parse_interpol(exports.Markdown.encode(this.contents.join("\n"))); + } + }, + + // script blocks + { + regexp: /^(\s*):(?:java)?script\s*$/, + process: function () { + return parse_interpol('\n\n"); + } + }, + + // css blocks + { + regexp: /^(\s*):css\s*$/, + process: function () { + return JSON.stringify('\n\n"); + } + }, + + ]; + + function compile(lines) { + var block = false, + output = []; + + // If lines is a string, turn it into an array + if (typeof lines === 'string') { + lines = lines.trim().replace(/\n\r|\r/g, '\n').split('\n'); + } + + lines.forEach(function(line) { + var match, found = false; + + // Collect all text as raw until outdent + if (block) { + match = block.check_indent(line); + if (match) { + block.contents.push(match[1] || ""); + return; + } else { + output.push(block.process()); + block = false; + } + } + + matchers.forEach(function (matcher) { + if (!found) { + match = matcher.regexp(line); + if (match) { + block = { + contents: [], + matches: match, + check_indent: new RegExp("^(?:\\s*|" + match[1] + " (.*))$"), + process: matcher.process, + render_contents: function () { + return compile(this. contents); + } + }; + found = true; + } + } + }); + + // Match plain text + if (!found) { + output.push(function () { + // Escaped plain text + if (line[0] === '\\') { + return parse_interpol(line.substr(1, line.length)); + } + + // Plain variable data + if (line[0] === '=') { + line = line.substr(1, line.length).trim(); + try { + return parse_interpol(JSON.parse(line)); + } catch (e) { + return line; + } + } + + // HTML escape variable data + if (line.substr(0, 2) === "&=") { + line = line.substr(2, line.length).trim(); + try { + return JSON.stringify(html_escape(JSON.parse(line))); + } catch (e2) { + return 'html_escape(' + line + ')'; + } + } + + // Plain text + return parse_interpol(line); + }()); + } + + }); + if (block) { + output.push(block.process()); + } + return output.filter(function (part) { return part && part.length > 0}).join(" +\n"); + }; + + function optimize(js) { + var new_js = [], buffer = [], part, end; + + function flush() { + if (buffer.length > 0) { + new_js.push(JSON.stringify(buffer.join("")) + end); + buffer = []; + } + } + js.replace(/\n\r|\r/g, '\n').split('\n').forEach(function (line) { + part = line.match(/^(\".*\")(\s*\+\s*)?$/); + if (!part) { + flush(); + new_js.push(line); + return; + } + end = part[2] || ""; + part = part[1]; + try { + buffer.push(JSON.parse(part)); + } catch (e) { + flush(); + new_js.push(line); + } + }); + flush(); + return new_js.join("\n"); + }; + + function render(text, options) { + options = options || {}; + text = text || ""; + var js = compile(text); + if (options.optimize) { + js = Haml.optimize(js); + } + return execute(js, options.context || Haml, options.locals); + }; + + function execute(js, self, locals) { + return (function () { + with(locals || {}) { + try { + return eval("(" + js + ")"); + } catch (e) { + return "\n
" + html_escape(e.stack) + "
\n"; + } + + } + }).call(self); + }; + + Haml = function Haml(haml, xml) { + forceXML = xml; + var js = optimize(compile(haml)); + return new Function("locals", + html_escape + "\n" + + "with(locals || {}) {\n" + + " try {\n" + + " return (" + js + ");\n" + + " } catch (e) {\n" + + " return \"\\n
\" + html_escape(e.stack) + \"
\\n\";\n" + + " }\n" + + "}"); + } + + Haml.compile = compile; + Haml.optimize = optimize; + Haml.render = render; + Haml.execute = execute; + + return function( a_path ){ + // handle path... + var _root = ""; + + if( $.include.settings && $.include.settings.haml ){ + _root = $.include.settings.haml.root; + } + + var _path = "text!" + _root + a_path; + + this.path = function(){ return _path; } + + this.content = function( a_text ){ + return Haml( a_text ); + }; + }; +}()); \ No newline at end of file diff --git a/plugins/templates.js b/plugins/templates.js index 54a128b..0a6fa2d 100644 --- a/plugins/templates.js +++ b/plugins/templates.js @@ -71,8 +71,8 @@ $.include.plugins.html = function(){ if( $.include.settings && $.include.settings.html ){ _root = $.include.settings.html.root; } - - //TODO: set extension to .html if not present + + var _path = "text!" + _root + a_path; this.path = function(){ return _path; } From efef4cb58bc5632faaf0798cdfe50d81decdb8e8 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Wed, 10 Nov 2010 21:37:43 +0800 Subject: [PATCH 05/25] jQuery support in templates is back. In form of renderTo( $where, context ) call; --- include-bootstrap.js | 451 +++++++++++++++++++++++++++++++++++++++++++ plugins/templates.js | 8 +- test.html | 2 +- 3 files changed, 459 insertions(+), 2 deletions(-) create mode 100644 include-bootstrap.js diff --git a/include-bootstrap.js b/include-bootstrap.js new file mode 100644 index 0000000..f9ecc93 --- /dev/null +++ b/include-bootstrap.js @@ -0,0 +1,451 @@ +/* + IncludeJS Copyright 2010, Vlad Balin aka "Gaperton". + Dual licensed under the MIT or GPL Version 2 licenses. + + RequireJS Copyright (c) 2010, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details + RequireJS i18n Copyright (c) 2010, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details + RequireJS text Copyright (c) 2010, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details + RequireJS jsonp Copyright (c) 2010, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details + RequireJS order Copyright (c) 2010, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details + + jQuery JavaScript Library v1.4.3 + http://jquery.com/ + + Copyright 2010, John Resig + Dual licensed under the MIT or GPL Version 2 licenses. + http://jquery.org/license + + Includes Sizzle.js + http://sizzlejs.com/ + Copyright 2010, The Dojo Foundation + Released under the MIT, BSD, and GPL Licenses. + + Date: Thu Oct 14 23:10:06 2010 -0400 +*/ +var require,define; +(function(){function R(j){return Ba.call(j)==="[object Function]"}function C(j,l,s){var q=y.plugins.defined[j];if(q)q[s.name].apply(null,s.args);else{q=y.plugins.waiting[j]||(y.plugins.waiting[j]=[]);q.push(s);z(["require/"+j],l.contextName)}}function da(j,l){Ca.apply(z,j);l.loaded[j[0]]=true}function H(j,l,s){var q,v,D;for(q=0;D=l[q];q++){D=typeof D==="string"?{name:D}:D;v=D.location;if(s&&(!v||v.indexOf("/")!==0&&v.indexOf(":")===-1))D.location=s+"/"+(D.location||D.name);D.location=D.location|| +D.name;D.lib=D.lib||"lib";D.main=D.main||"main";j[D.name]=D}}function x(j){var l=true,s=j.config.priorityWait,q,v;if(s){for(v=0;q=s[v];v++)if(!j.loaded[q]){l=false;break}l&&delete j.config.priorityWait}return l}function E(j){var l,s=y.paused;if(j.scriptCount<=0){for(j.scriptCount=0;wa.length;){l=wa.shift();l[0]===null?z.onError(new Error("Mismatched anonymous require.def modules")):da(l,j)}if(!(j.config.priorityWait&&!x(j))){if(s.length)for(j=0;l=s[j];j++)z.checkDeps.apply(z,l);z.checkLoaded(y.ctxName)}}} +function P(j,l){var s=y.plugins.callbacks[j]=[];y.plugins[j]=function(){for(var q=0,v;v=s[q];q++)if(v.apply(null,arguments)===true&&l)return true;return false}}function J(j,l){if(!j.jQuery)if((l=l||(typeof jQuery!=="undefined"?jQuery:null))&&"readyWait"in l){j.jQuery=l;if(!j.defined.jquery&&!j.jQueryDef)j.defined.jquery=l;if(j.scriptCount){l.readyWait+=1;j.jQueryIncremented=true}}}function O(j){return function(l){j.exports=l}}function Z(j,l,s){return function(){var q=[].concat(Da.call(arguments,0)); +q.push(l,s);return(j?require[j]:require).apply(null,q)}}function $(j,l){var s=j.contextName,q=Z(null,s,l);z.mixin(q,{modify:Z("modify",s,l),def:Z("def",s,l),get:Z("get",s,l),nameToUrl:Z("nameToUrl",s,l),ready:z.ready,context:j,config:j.config,isBrowser:y.isBrowser});return q}var W={},y,X,Y=[],ta,la,B,c,Ea,ua={},Fa,Ga=/^(complete|loaded)$/,Ma=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,Na=/require\(["']([\w-_\.\/]+)["']\)/g,Ca,pa=!!(typeof window!=="undefined"&&navigator&&document),Ka=!pa&&typeof importScripts!== +"undefined",Ba=Object.prototype.toString,xa=Array.prototype,Da=xa.slice,Ha,z,ya,wa=[],Ia=false,za;if(typeof require!=="undefined")if(R(require))return;else ua=require;z=require=function(j,l,s,q,v){var D;if(typeof j==="string"&&!R(l))return require.get(j,l,s,q);if(!require.isArray(j)){D=j;if(require.isArray(l)){j=l;l=s;s=q;q=v}else j=[]}Ca(null,j,l,D,s,q);(j=y.contexts[s||D&&D.context||y.ctxName])&&j.scriptCount===0&&E(j)};z.onError=function(j){throw j;};define=z.def=function(j,l,s,q){var v,D,I=za; +if(typeof j!=="string"){q=s;s=l;l=j;j=null}if(!z.isArray(l)){q=s;s=l;l=[]}if(!j&&!l.length&&z.isFunction(s)){s.toString().replace(Ma,"").replace(Na,function(L,aa){l.push(aa)});l=["require","exports","module"].concat(l)}if(!j&&Ia){v=document.getElementsByTagName("script");for(j=v.length-1;j>-1&&(D=v[j]);j--)if(D.readyState==="interactive"){I=D;break}I||z.onError(new Error("ERROR: No matching script interactive for "+s));j=I.getAttribute("data-requiremodule")}if(typeof j==="string")y.contexts[y.ctxName].jQueryDef= +j==="jquery";wa.push([j,l,s,null,q])};Ca=function(j,l,s,q,v,D){var I,L,aa,ba,V;v=v?v:q&&q.context?q.context:y.ctxName;I=y.contexts[v];if(j){L=j.indexOf("!");if(L!==-1){aa=j.substring(0,L);j=j.substring(L+1,j.length)}else aa=I.defPlugin[j];L=I.waiting[j];if(I&&(I.defined[j]||L&&L!==xa[j]))return}if(v!==y.ctxName){L=y.contexts[y.ctxName]&&y.contexts[y.ctxName].loaded;ba=true;if(L)for(V in L)if(!(V in W))if(!L[V]){ba=false;break}if(ba)y.ctxName=v}if(!I){I={contextName:v,config:{waitSeconds:7,baseUrl:y.baseUrl|| +"./",paths:{},packages:{}},waiting:[],specified:{require:true,exports:true,module:true},loaded:{},scriptCount:0,urlFetched:{},defPlugin:{},defined:{},modifiers:{}};y.plugins.newContext&&y.plugins.newContext(I);I=y.contexts[v]=I}if(q){if(q.baseUrl)if(q.baseUrl.charAt(q.baseUrl.length-1)!=="/")q.baseUrl+="/";ba=I.config.paths;L=I.config.packages;z.mixin(I.config,q,true);if(q.paths){for(V in q.paths)V in W||(ba[V]=q.paths[V]);I.config.paths=ba}if((ba=q.packagePaths)||q.packages){if(ba)for(V in ba)V in +W||H(L,ba[V],V);q.packages&&H(L,q.packages);I.config.packages=L}if(q.priority){z(q.priority);I.config.priorityWait=q.priority}if(q.deps||q.callback)z(q.deps||[],q.callback);q.ready&&z.ready(q.ready);if(!l)return}if(l){V=l;l=[];for(q=0;q0;L--){I=q.slice(0,L).join("/");if(v[I]){q.splice(0,L,v[I]);break}else if(I=D[I]){v= +I.location+"/"+I.lib;if(j===I.name)v+="/"+I.main;q.splice(0,L,v);break}}j=q.join("/")+(l||".js");j=(j.charAt(0)==="/"||j.match(/^\w+:/)?"":s.baseUrl)+j}return s.urlArgs?j+((j.indexOf("?")===-1?"?":"&")+s.urlArgs):j};z.checkLoaded=function(j){var l=y.contexts[j||y.ctxName],s=l.config.waitSeconds*1E3,q=s&&l.startTime+s<(new Date).getTime(),v,D=l.defined,I=l.modifiers,L="",aa=false,ba=false,V,ja=y.plugins.isWaiting,qa=y.plugins.orderDeps;if(!l.isCheckLoaded){if(l.config.priorityWait)if(x(l))E(l);else return; +l.isCheckLoaded=true;s=l.waiting;v=l.loaded;for(V in v)if(!(V in W)){aa=true;if(!v[V])if(q)L+=V+" ";else{ba=true;break}}if(!aa&&!s.length&&(!ja||!ja(l)))l.isCheckLoaded=false;else{if(q&&L){v=new Error("require.js load timeout for modules: "+L);v.requireType="timeout";v.requireModules=L;z.onError(v)}if(ba){l.isCheckLoaded=false;if(pa||Ka)setTimeout(function(){z.checkLoaded(j)},50)}else{l.waiting=[];l.loaded={};qa&&qa(l);for(V in I)V in W||D[V]&&z.execModifiers(V,{},s,l);for(v=0;D=s[v];v++)z.exec(D, +{},s,l);l.isCheckLoaded=false;if(l.waiting.length||ja&&ja(l))z.checkLoaded(j);else if(Y.length){v=l.loaded;l=true;for(V in v)if(!(V in W))if(!v[V]){l=false;break}if(l){y.ctxName=Y[0][1];V=Y;Y=[];for(v=0;l=V[v];v++)z.load.apply(z,l)}}else{y.ctxName="_";y.isDone=true;z.callReady&&z.callReady()}}}}};z.exec=function(j,l,s,q){if(j){var v=j.name,D=j.callback;D=j.deps;var I,L,aa=q.defined,ba,V=[],ja,qa=false;if(v){if(l[v]||v in aa)return aa[v];l[v]=true}if(D)for(I=0;L=D[I];I++){L=L.name;if(L==="require")L= +$(q,v);else if(L==="exports"){L=aa[v]={};qa=true}else if(L==="module"){ja=L={id:v,uri:v?z.nameToUrl(v,null,q.contextName):undefined};ja.setExports=O(ja)}else L=L in aa?aa[L]:l[L]?undefined:z.exec(s[s[L]],l,s,q);V.push(L)}if((D=j.callback)&&z.isFunction(D)){ba=z.execCb(v,D,V);if(v)if(qa&&ba===undefined&&(!ja||!("exports"in ja)))ba=aa[v];else if(ja&&"exports"in ja)ba=aa[v]=ja.exports;else{v in aa&&!qa&&z.onError(new Error(v+" has already been defined"));aa[v]=ba}}z.execModifiers(v,l,s,q);return ba}}; +z.execCb=function(j,l,s){return l.apply(null,s)};z.execModifiers=function(j,l,s,q){var v=q.modifiers,D=v[j],I,L;if(D){for(L=0;L-1&&(la=ta[X]);X--){if(!y.head)y.head=la.parentNode;if(!ua.deps)if(c=la.getAttribute("data-main"))ua.deps=[c];if((c=la.src)&&!y.baseUrl)if(Ea=c.match(B)){y.baseUrl=c.substring(0,Ea.index);break}}}z.pageLoaded=function(){if(!y.isPageLoaded){y.isPageLoaded= +true;Ha&&clearInterval(Ha);if(Fa)document.readyState="complete";z.callReady()}};z.callReady=function(){var j=y.readyCalls,l,s,q;if(y.isPageLoaded&&y.isDone){if(j.length){y.readyCalls=[];for(l=0;s=j[l];l++)s()}j=y.contexts;for(q in j)if(!(q in W)){l=j[q];if(l.jQueryIncremented){l.jQuery.readyWait-=1;l.jQueryIncremented=false}}}};z.ready=function(j){y.isPageLoaded&&y.isDone?j():y.readyCalls.push(j);return z};if(pa){if(document.addEventListener){document.addEventListener("DOMContentLoaded",z.pageLoaded, +false);window.addEventListener("load",z.pageLoaded,false);if(!document.readyState){Fa=true;document.readyState="loading"}}else if(window.attachEvent){window.attachEvent("onload",z.pageLoaded);if(self===self.top)Ha=setInterval(function(){try{if(document.body){document.documentElement.doScroll("left");z.pageLoaded()}}catch(j){}},30)}document.readyState==="complete"&&z.pageLoaded()}z(ua);typeof setTimeout!=="undefined"&&setTimeout(function(){var j=y.contexts[ua.context||"_"];J(j);E(j)},0)})(); +(function(){function R(x,E){E=E.nlsWaiting;return E[x]||(E[x]=E[E.push({_name:x})-1])}function C(x,E,P,J){var O,Z,$,W,y,X,Y="root";Z=P.split("-");$=[];W=R(x,J);for(O=Z.length;O>-1;O--){y=O?Z.slice(0,O).join("-"):"root";if(X=E[y]){if(P===J.config.locale&&!W._match)W._match=y;if(Y==="root")Y=y;W[y]=y;if(X===true){X=x.split("/");X.splice(-1,0,y);X=X.join("/");if(!J.specified[X]&&!(X in J.loaded)&&!J.defined[X]){J.defPlugin[X]="i18n";$.push(X)}}}}if(Y!==P)if(J.defined[Y])J.defined[P]=J.defined[Y];else W[P]= +Y;$.length&&require($,J.contextName)}var da=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/,H={};require.plugin({prefix:"i18n",require:function(x,E,P,J){var O,Z=J.defined[x];O=da.exec(x);if(O[5]){x=O[1]+O[5];E=R(x,J);E[O[4]]=O[4];E=J.nls[x];if(!E){J.defPlugin[x]="i18n";require([x],J.contextName);E=J.nls[x]={}}E[O[4]]=P}else{if(E=J.nls[x])require.mixin(E,Z);else E=J.nls[x]=Z;J.nlsRootLoaded[x]=true;if(O=J.nlsToLoad[x]){delete J.nlsToLoad[x];for(P=0;P0;P--){la=$.slice(0,P).join("-");la!=="root"&& +Z[la]&&require.mixin(y,Z[la])}Z.root&&require.mixin(y,Z.root);x.defined[X+"/"+Y+"/"+W]=y}x.defined[J]=x.defined[X+"/"+ta+"/"+W];if(c)for(Y in c)Y in H||(x.defined[X+"/"+Y+"/"+W]=x.defined[X+"/"+c[Y]+"/"+W])}}})})(); +(function(){var R=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],C=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,da=/]*>\s*([\s\S]+)\s*<\/body>/im;if(!require.textStrip)require.textStrip=function(H){if(H){H=H.replace(C,"");var x=H.match(da);if(x)H=x[1]}else H="";return H};if(!require.getXhr)require.getXhr=function(){var H,x,E;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else for(x=0;x<3;x++){E=R[x];try{H=new ActiveXObject(E)}catch(P){}if(H){R= +[E];break}}if(!H)throw new Error("require.getXhr(): XMLHttpRequest not available");return H};if(!require.fetchText)require.fetchText=function(H,x){var E=require.getXhr();E.open("GET",H,true);E.onreadystatechange=function(){E.readyState===4&&x(E.responseText)};E.send(null)};require.plugin({prefix:"text",require:function(){},newContext:function(H){require.mixin(H,{text:{},textWaiting:[]})},load:function(H,x){var E=false,P=null,J,O=H.indexOf("."),Z=H.substring(0,O),$=H.substring(O+1,H.length),W=require.s.contexts[x], +y=W.textWaiting;O=$.indexOf("!");if(O!==-1){E=$.substring(O+1,$.length);$=$.substring(0,O);O=E.indexOf("!");if(O!==-1&&E.substring(0,O)==="strip"){P=E.substring(O+1,E.length);E="strip"}else if(E!=="strip"){P=E;E=null}}J=Z+"!"+$;O=E?J+"!"+E:J;if(P!==null&&!W.text[J])W.defined[H]=W.text[J]=P;else if(!W.text[J]&&!W.textWaiting[J]&&!W.textWaiting[O]){y[O]||(y[O]=y[y.push({name:H,key:J,fullKey:O,strip:!!E})-1]);x=require.nameToUrl(Z,"."+$,x);W.loaded[H]=false;require.fetchText(x,function(X){W.text[J]= +X;W.loaded[H]=true})}},checkDeps:function(){},isWaiting:function(H){return!!H.textWaiting.length},orderDeps:function(H){var x,E,P,J=H.textWaiting;H.textWaiting=[];for(x=0;E=J[x];x++){P=H.text[E.key];H.defined[E.name]=E.strip?require.textStrip(P):P}}})})(); +(function(){var R=0;require._jsonp={};require.plugin({prefix:"jsonp",require:function(){},newContext:function(C){require.mixin(C,{jsonpWaiting:[]})},load:function(C,da){var H=C.indexOf("?"),x=C.substring(0,H);H=C.substring(H+1,C.length);var E=require.s.contexts[da],P={name:C},J="f"+R++,O=require.s.head,Z=O.ownerDocument.createElement("script");require._jsonp[J]=function($){P.value=$;E.loaded[C]=true;setTimeout(function(){O.removeChild(Z);delete require._jsonp[J]},15)};E.jsonpWaiting.push(P);x=require.nameToUrl(x, +"?",da);x+=(x.indexOf("?")===-1?"?":"")+H.replace("?","require._jsonp."+J);E.loaded[C]=false;Z.type="text/javascript";Z.charset="utf-8";Z.src=x;Z.async=true;O.appendChild(Z)},checkDeps:function(){},isWaiting:function(C){return!!C.jsonpWaiting.length},orderDeps:function(C){var da,H,x=C.jsonpWaiting;C.jsonpWaiting=[];for(da=0;H=x[da];da++)C.defined[H.name]=H.value}})})(); +(function(){function R(H){var x=H.currentTarget||H.srcElement,E,P,J,O;if(H.type==="load"||da.test(x.readyState)){P=x.getAttribute("data-requirecontext");E=x.getAttribute("data-requiremodule");H=require.s.contexts[P];J=H.orderWaiting;O=H.orderCached;O[E]=true;for(E=0;O[J[E]];E++);E>0&&require(J.splice(0,E),P);if(!J.length)H.orderCached={};setTimeout(function(){x.parentNode.removeChild(x)},15)}}var C=window.opera&&Object.prototype.toString.call(window.opera)==="[object Opera]"||"MozAppearance"in document.documentElement.style, +da=/^(complete|loaded)$/;require.plugin({prefix:"order",require:function(){},newContext:function(H){require.mixin(H,{orderWaiting:[],orderCached:{}})},load:function(H,x){var E=require.s.contexts[x],P=require.nameToUrl(H,null,x);require.s.skipAsync[P]=true;if(C)require([H],x);else{E.orderWaiting.push(H);E.loaded[H]=false;require.attach(P,x,H,R,"script/cache")}},checkDeps:function(){},isWaiting:function(H){return!!H.orderWaiting.length},orderDeps:function(){}})})(); +(function(R,C){function da(){return false}function H(){return true}function x(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function E(a){var b,d,e=[],g=[],h,m,n,p,A,F,Q,S;m=c.data(this,this.nodeType?"events":"__events__");if(typeof m==="function")m=m.events;if(!(a.liveFired===this||!m||!m.live||a.button&&a.type==="click")){if(a.namespace)S=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var ea=m.live.slice(0);for(p=0;pd)break;a.currentTarget=g.elem;a.data=g.handleObj.data; +a.handleObj=g.handleObj;S=g.handleObj.origHandler.apply(g.elem,arguments);if(S===false||a.isPropagationStopped()){d=g.level;if(S===false)b=false}}return b}}function P(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(z,"&")}function J(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b,d){if(c.isFunction(b))return c.grep(a,function(g,h){return!!b.call(g,h,g)===d});else if(b.nodeType)return c.grep(a,function(g){return g===b===d});else if(typeof b==="string"){var e=c.grep(a, +function(g){return g.nodeType===1});if(aa.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(g){return c.inArray(g,b)>=0===d})}function Z(a){return c.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function $(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),g=c.data(this,e);if(e=e&&e.events){delete g.handle;g.events={};for(var h in e)for(var m in e[h])c.event.add(this, +h,e[h][m],e[h][m].data)}}})}function W(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function y(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?$a:ab,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function X(a, +b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(g,h){d||bb.test(a)?e(a,h):X(a+"["+(typeof h==="object"||c.isArray(h)?g:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(g,h){X(a+"["+g+"]",h,d,e)});else e(a,b)}function Y(a,b){var d={};c.each(Ra.concat.apply([],Ra.slice(0,b)),function(){d[this]=a});return d}function ta(a){if(!Oa[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";Oa[a]=d}return Oa[a]} +function la(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var B=R.document,c=function(){function a(){if(!b.isReady){try{B.documentElement.doScroll("left")}catch(k){setTimeout(a,1);return}b.ready()}}var b=function(k,u){return new b.fn.init(k,u)},d=R.jQuery,e=R.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,m=/\S/,n=/^\s+/,p=/\s+$/,A=/\W/,F=/\d/,Q=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,S=/^[\],:{}\s]*$/,ea=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,K=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, +ca=/(?:^|:|,)(?:\s*\[)+/g,ma=/(webkit)[ \/]([\w.]+)/,f=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,r=navigator.userAgent,t=false,w=[],G,M=Object.prototype.toString,T=Object.prototype.hasOwnProperty,ra=Array.prototype.push,na=Array.prototype.slice,va=String.prototype.trim,sa=Array.prototype.indexOf,ka={};b.fn=b.prototype={init:function(k,u){var N,U;if(!k)return this;if(k.nodeType){this.context=this[0]=k;this.length=1;return this}if(k==="body"&&!u&&B.body){this.context= +B;this[0]=B.body;this.selector="body";this.length=1;return this}if(typeof k==="string")if((N=h.exec(k))&&(N[1]||!u))if(N[1]){U=u?u.ownerDocument||u:B;if(k=Q.exec(k))if(b.isPlainObject(u)){k=[B.createElement(k[1])];b.fn.attr.call(k,u,true)}else k=[U.createElement(k[1])];else{k=b.buildFragment([N[1]],[U]);k=(k.cacheable?k.fragment.cloneNode(true):k.fragment).childNodes}return b.merge(this,k)}else{if((u=B.getElementById(N[2]))&&u.parentNode){if(u.id!==N[2])return g.find(k);this.length=1;this[0]=u}this.context= +B;this.selector=k;return this}else if(!u&&!A.test(k)){this.selector=k;this.context=B;k=B.getElementsByTagName(k);return b.merge(this,k)}else return!u||u.jquery?(u||g).find(k):b(u).find(k);else if(b.isFunction(k))return g.ready(k);if(k.selector!==C){this.selector=k.selector;this.context=k.context}return b.makeArray(k,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return na.call(this,0)},get:function(k){return k==null?this.toArray():k<0?this.slice(k)[0]: +this[k]},pushStack:function(k,u,N){var U=b();b.isArray(k)?ra.apply(U,k):b.merge(U,k);U.prevObject=this;U.context=this.context;if(u==="find")U.selector=this.selector+(this.selector?" ":"")+N;else if(u)U.selector=this.selector+"."+u+"("+N+")";return U},each:function(k,u){return b.each(this,k,u)},ready:function(k){b.bindReady();if(b.isReady)k.call(B,b);else w&&w.push(k);return this},eq:function(k){return k===-1?this.slice(k):this.slice(k,+k+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)}, +slice:function(){return this.pushStack(na.apply(this,arguments),"slice",na.call(arguments).join(","))},map:function(k){return this.pushStack(b.map(this,function(u,N){return k.call(u,N,u)}))},end:function(){return this.prevObject||b(null)},push:ra,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var k=arguments[0]||{},u=1,N=arguments.length,U=false,fa,ga,ia,ha,Pa;if(typeof k==="boolean"){U=k;k=arguments[1]||{};u=2}if(typeof k!=="object"&&!b.isFunction(k))k={}; +if(N===u){k=this;--u}for(;u0)){if(w){for(var u=0;k=w[u++];)k.call(B,b);w=null}b.fn.triggerHandler&&b(B).triggerHandler("ready")}}},bindReady:function(){if(!t){t=true;if(B.readyState==="complete")return setTimeout(b.ready,1);if(B.addEventListener){B.addEventListener("DOMContentLoaded",G,false);R.addEventListener("load",b.ready,false)}else if(B.attachEvent){B.attachEvent("onreadystatechange",G);R.attachEvent("onload",b.ready);var k=false;try{k=R.frameElement==null}catch(u){}B.documentElement.doScroll&& +k&&a()}}},isFunction:function(k){return b.type(k)==="function"},isArray:Array.isArray||function(k){return b.type(k)==="array"},isWindow:function(k){return k&&typeof k==="object"&&"setInterval"in k},isNaN:function(k){return k==null||!F.test(k)||isNaN(k)},type:function(k){return k==null?String(k):ka[M.call(k)]||"object"},isPlainObject:function(k){if(!k||b.type(k)!=="object"||k.nodeType||b.isWindow(k))return false;if(k.constructor&&!T.call(k,"constructor")&&!T.call(k.constructor.prototype,"isPrototypeOf"))return false; +var u;for(u in k);return u===C||T.call(k,u)},isEmptyObject:function(k){for(var u in k)return false;return true},error:function(k){throw k;},parseJSON:function(k){if(typeof k!=="string"||!k)return null;k=b.trim(k);if(S.test(k.replace(ea,"@").replace(K,"]").replace(ca,"")))return R.JSON&&R.JSON.parse?R.JSON.parse(k):(new Function("return "+k))();else b.error("Invalid JSON: "+k)},noop:function(){},globalEval:function(k){if(k&&m.test(k)){var u=B.getElementsByTagName("head")[0]||B.documentElement,N=B.createElement("script"); +N.type="text/javascript";if(b.support.scriptEval)N.appendChild(B.createTextNode(k));else N.text=k;u.insertBefore(N,u.firstChild);u.removeChild(N)}},nodeName:function(k,u){return k.nodeName&&k.nodeName.toUpperCase()===u.toUpperCase()},each:function(k,u,N){var U,fa=0,ga=k.length,ia=ga===C||b.isFunction(k);if(N)if(ia)for(U in k){if(u.apply(k[U],N)===false)break}else for(;fa
a";var g=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],m=B.createElement("select"), +n=m.appendChild(B.createElement("option"));if(!(!g||!g.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:n.selected,optDisabled:false,checkClone:false,scriptEval:false, +noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};m.disabled=true;c.support.optDisabled=!n.disabled;b.type="text/javascript";try{b.appendChild(B.createTextNode("window."+e+"=1;"))}catch(p){}a.insertBefore(b,a.firstChild);if(R[e]){c.support.scriptEval=true;delete R[e]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function A(){c.support.noCloneEvent=false;d.detachEvent("onclick",A)});d.cloneNode(true).fireEvent("onclick")}d= +B.createElement("div");d.innerHTML="";a=B.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var A=B.createElement("div");A.style.width=A.style.paddingLeft="1px";B.body.appendChild(A);c.boxModel=c.support.boxModel=A.offsetWidth===2;if("zoom"in A.style){A.style.display="inline";A.style.zoom=1;c.support.inlineBlockNeedsLayout=A.offsetWidth===2;A.style.display= +"";A.innerHTML="
";c.support.shrinkWrapBlocks=A.offsetWidth!==2}A.innerHTML="
t
";var F=A.getElementsByTagName("td");c.support.reliableHiddenOffsets=F[0].offsetHeight===0;F[0].style.display="";F[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&F[0].offsetHeight===0;A.innerHTML="";B.body.removeChild(A).style.display="none"});a=function(A){var F=B.createElement("div"); +A="on"+A;var Q=A in F;if(!Q){F.setAttribute(A,"return;");Q=typeof F[A]==="function"}return Q};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=g=h=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var Ea={},ua=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true, +object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==R?Ea:a;var e=a.nodeType,g=e?a[c.expando]:null,h=c.cache;if(!(e&&!g&&typeof b==="string"&&d===C)){if(e)g||(a[c.expando]=g=++c.uuid);else h=a;if(typeof b==="object")if(e)h[g]=c.extend(h[g],b);else c.extend(h,b);else if(e&&!h[g])h[g]={};a=e?h[g]:h;if(d!==C)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==R?Ea:a;var d=a.nodeType,e=d?a[c.expando]:a, +g=c.cache,h=d?g[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);else if(d)delete g[e];else for(var m in a)delete a[m]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){if(typeof a==="undefined")return this.length?c.data(this[0]):null;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===C){var e=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(e===C&&this.length){e=c.data(this[0],a);if(e===C&&this[0].nodeType===1){e=this[0].getAttribute("data-"+a);if(typeof e==="string")try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):ua.test(e)?c.parseJSON(e):e}catch(g){}else e=C}}return e===C&&d[1]?this.data(d[0]):e}else return this.each(function(){var h=c(this), +m=[d[0],b];h.triggerHandler("setData"+d[1]+"!",m);c.data(this,a,b);h.triggerHandler("changeData"+d[1]+"!",m)})},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 e=c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a, +function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===C)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 Fa=/[\n\t]/g,Ga=/\s+/,Ma=/\r/g,Na=/^(?:href|src|style)$/,Ca=/^(?:button|input)$/i,pa=/^(?:button|input|object|select|textarea)$/i,Ka=/^a(?:rea)?$/i,Ba=/^(?:radio|checkbox)$/i;c.fn.extend({attr:function(a,b){return c.access(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(A){var F=c(this);F.addClass(a.call(this,A,F.attr("class")))});if(a&&typeof a=== +"string")for(var b=(a||"").split(Ga),d=0,e=this.length;d-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value: +b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var g=b.options;b=b.type==="select-one";if(e<0)return null;var h=b?e:0;for(e=b?e+1:g.length;h=0;else if(c.nodeName(this,"select")){var Q=c.makeArray(F);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),Q)>=0});if(!Q.length)this.selectedIndex=-1}else this.value=F}})}});c.extend({attrFn:{val:true, +css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return C;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var g=d!==C;b=e&&c.props[b]||b;if(a.nodeType===1){var h=Na.test(b);if((b in a||a[b]!==C)&&e&&!h){if(g){b==="type"&&Ca.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else 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:pa.test(a.nodeName)||Ka.test(a.nodeName)&&a.href?0:C;return a[b]}if(!c.support.style&&e&&b==="style"){if(g)a.style.cssText=""+d;return a.style.cssText}g&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return C;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?C:a}}});var xa=/\.(.*)$/,Da=/^(?:textarea|input|select)$/i,Ha=/\./g,z=/ /g,ya=/[^\w\s.|`]/g, +wa=function(a){return a.replace(ya,"\\$&")},Ia={focusin:0,focusout:0};c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==R&&!a.frameElement)a=R;if(d===false)d=da;var g,h;if(d.handler){g=d;d=g.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var m=a.nodeType?"events":"__events__",n=h[m],p=h.handle;if(typeof n==="function"){p=n.handle;n=n.events}else if(!n){a.nodeType||(h[m]=h=function(){});h.events=n={}}if(!p)h.handle=p=function(){return typeof c!=="undefined"&& +!c.event.triggered?c.event.handle.apply(p.elem,arguments):C};p.elem=a;b=b.split(" ");for(var A=0,F;m=b[A++];){h=g?c.extend({},g):{handler:d,data:e};if(m.indexOf(".")>-1){F=m.split(".");m=F.shift();h.namespace=F.slice(0).sort().join(".")}else{F=[];h.namespace=""}h.type=m;if(!h.guid)h.guid=d.guid;var Q=n[m],S=c.event.special[m]||{};if(!Q){Q=n[m]=[];if(!S.setup||S.setup.call(a,e,F,p)===false)if(a.addEventListener)a.addEventListener(m,p,false);else a.attachEvent&&a.attachEvent("on"+m,p)}if(S.add){S.add.call(a, +h);if(!h.handler.guid)h.handler.guid=d.guid}Q.push(h);c.event.global[m]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=da;var g,h,m=0,n,p,A,F,Q,S,ea=a.nodeType?"events":"__events__",K=c.data(a),ca=K&&K[ea];if(K&&ca){if(typeof ca==="function"){K=ca;ca=ca.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(g in ca)c.event.remove(a,g+b)}else{for(b=b.split(" ");g=b[m++];){F=g;n=g.indexOf(".")<0;p= +[];if(!n){p=g.split(".");g=p.shift();A=new RegExp("(^|\\.)"+c.map(p.slice(0).sort(),wa).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(Q=ca[g])if(d){F=c.event.special[g]||{};for(h=e||0;h=0){a.type=g=g.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[g]&&c.each(c.cache,function(){this.events&&this.events[g]&&c.event.trigger(a, +b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return C;a.result=C;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+g]&&d["on"+g].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){e=a.target; +var m,n=g.replace(xa,""),p=c.nodeName(e,"a")&&n==="click",A=c.event.special[n]||{};if((!A._default||A._default.call(d,a)===false)&&!p&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[n]){if(m=e["on"+n])e["on"+n]=null;c.event.triggered=true;e[n]()}}catch(F){}if(m)e["on"+n]=m;c.event.triggered=false}}},handle:function(a){var b,d,e;d=[];var g,h=c.makeArray(arguments);a=h[0]=c.event.fix(a||R.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type= +e.shift();d=e.slice(0).sort();e=new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");g=c.data(this,this.nodeType?"events":"__events__");if(typeof g==="function")g=g.events;d=(g||{})[a.type];if(g&&d){d=d.slice(0);g=0;for(var m=d.length;g-1?c.map(a.options, +function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},q=function(a,b){var d=a.target,e,g;if(!(!Da.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");g=s(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",g);if(!(e===C||g===e))if(e!=null||g){a.type="change";a.liveFired=C;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:q,beforedeactivate:q,click:function(a){var b=a.target,d=b.type;if(d=== +"radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return q.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 q.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",s(a))}},setup:function(){if(this.type==="file")return false;for(var a in l)c.event.add(this,a+".specialChange",l[a]);return Da.test(this.nodeName)},teardown:function(){c.event.remove(this, +".specialChange");return Da.test(this.nodeName)}};l=c.event.special.change.filters;l.focus=l.beforeactivate}B.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){Ia[b]++===0&&B.addEventListener(a,d,true)},teardown:function(){--Ia[b]===0&&B.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,g){if(typeof d==="object"){for(var h in d)this[b](h, +e,d[h],g);return this}if(c.isFunction(e)||e===false){g=e;e=C}var m=b==="one"?c.proxy(g,function(p){c(this).unbind(p,m);return g.apply(this,arguments)}):g;if(d==="unload"&&b!=="one")this.one(d,e,g);else{h=0;for(var n=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});R.attachEvent&&!R.addEventListener&&c(R).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});(function(){function a(f,i,o,r,t,w){t=0;for(var G=r.length;t0){T=M;break}}M=M[f]}r[t]=T}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,g=Object.prototype.toString,h=false,m=true;[0,0].sort(function(){m=false;return 0});var n=function(f,i,o,r){o=o||[];var t=i=i||B;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!f||typeof f!=="string")return o;var w=[],G,M,T,ra,na=true,va=n.isXML(i),sa=f,ka;do{d.exec("");if(G=d.exec(sa)){sa=G[3];w.push(G[1]);if(G[2]){ra=G[3];break}}}while(G);if(w.length>1&&A.exec(f))if(w.length===2&&p.relative[w[0]])M=ma(w[0]+w[1],i);else for(M=p.relative[w[0]]?[i]:n(w.shift(),i);w.length;){f=w.shift();if(p.relative[f])f+= +w.shift();M=ma(f,M)}else{if(!r&&w.length>1&&i.nodeType===9&&!va&&p.match.ID.test(w[0])&&!p.match.ID.test(w[w.length-1])){G=n.find(w.shift(),i,va);i=G.expr?n.filter(G.expr,G.set)[0]:G.set[0]}if(i){G=r?{expr:w.pop(),set:S(r)}:n.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&i.parentNode?i.parentNode:i,va);M=G.expr?n.filter(G.expr,G.set):G.set;if(w.length>0)T=S(M);else na=false;for(;w.length;){G=ka=w.pop();if(p.relative[ka])G=w.pop();else ka="";if(G==null)G=i;p.relative[ka](T,G,va)}}else T=[]}T|| +(T=M);T||n.error(ka||f);if(g.call(T)==="[object Array]")if(na)if(i&&i.nodeType===1)for(f=0;T[f]!=null;f++){if(T[f]&&(T[f]===true||T[f].nodeType===1&&n.contains(i,T[f])))o.push(M[f])}else for(f=0;T[f]!=null;f++)T[f]&&T[f].nodeType===1&&o.push(M[f]);else o.push.apply(o,T);else S(T,o);if(ra){n(ra,t,o,r);n.uniqueSort(o)}return o};n.uniqueSort=function(f){if(K){h=m;f.sort(K);if(h)for(var i=1;i0};n.find=function(f,i,o){var r;if(!f)return[];for(var t=0,w=p.order.length;t":function(f,i){var o= +typeof i==="string",r,t=0,w=f.length;if(o&&!/\W/.test(i))for(i=i.toLowerCase();t=0))o||r.push(G);else if(o)i[w]=false;return false},ID:function(f){return f[1].replace(/\\/g,"")},TAG:function(f){return f[1].toLowerCase()},CHILD:function(f){if(f[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(f[2]==="even"&&"2n"||f[2]==="odd"&&"2n+1"||!/\D/.test(f[2])&&"0n+"+f[2]||f[2]);f[2]=i[1]+(i[2]||1)-0;f[3]=i[3]-0}f[0]=e++;return f},ATTR:function(f,i,o,r,t,w){i=f[1].replace(/\\/g,"");if(!w&&p.attrMap[i])f[1]=p.attrMap[i]; +if(f[2]==="~=")f[4]=" "+f[4]+" ";return f},PSEUDO:function(f,i,o,r,t){if(f[1]==="not")if((d.exec(f[3])||"").length>1||/^\w/.test(f[3]))f[3]=n(f[3],null,null,i);else{f=n.filter(f[3],i,o,true^t);o||r.push.apply(r,f);return false}else if(p.match.POS.test(f[0])||p.match.CHILD.test(f[0]))return true;return f},POS:function(f){f.unshift(true);return f}},filters:{enabled:function(f){return f.disabled===false&&f.type!=="hidden"},disabled:function(f){return f.disabled===true},checked:function(f){return f.checked=== +true},selected:function(f){return f.selected===true},parent:function(f){return!!f.firstChild},empty:function(f){return!f.firstChild},has:function(f,i,o){return!!n(o[3],f).length},header:function(f){return/h\d/i.test(f.nodeName)},text:function(f){return"text"===f.type},radio:function(f){return"radio"===f.type},checkbox:function(f){return"checkbox"===f.type},file:function(f){return"file"===f.type},password:function(f){return"password"===f.type},submit:function(f){return"submit"===f.type},image:function(f){return"image"=== +f.type},reset:function(f){return"reset"===f.type},button:function(f){return"button"===f.type||f.nodeName.toLowerCase()==="button"},input:function(f){return/input|select|textarea|button/i.test(f.nodeName)}},setFilters:{first:function(f,i){return i===0},last:function(f,i,o,r){return i===r.length-1},even:function(f,i){return i%2===0},odd:function(f,i){return i%2===1},lt:function(f,i,o){return io[3]-0},nth:function(f,i,o){return o[3]-0===i},eq:function(f,i,o){return o[3]- +0===i}},filter:{PSEUDO:function(f,i,o,r){var t=i[1],w=p.filters[t];if(w)return w(f,o,i,r);else if(t==="contains")return(f.textContent||f.innerText||n.getText([f])||"").indexOf(i[3])>=0;else if(t==="not"){i=i[3];o=0;for(r=i.length;o=0}},ID:function(f,i){return f.nodeType===1&&f.getAttribute("id")===i},TAG:function(f,i){return i==="*"&&f.nodeType===1||f.nodeName.toLowerCase()===i},CLASS:function(f,i){return(" "+ +(f.className||f.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(f,i){var o=i[1];f=p.attrHandle[o]?p.attrHandle[o](f):f[o]!=null?f[o]:f.getAttribute(o);o=f+"";var r=i[2];i=i[4];return f==null?r==="!=":r==="="?o===i:r==="*="?o.indexOf(i)>=0:r==="~="?(" "+o+" ").indexOf(i)>=0:!i?o&&f!==false:r==="!="?o!==i:r==="^="?o.indexOf(i)===0:r==="$="?o.substr(o.length-i.length)===i:r==="|="?o===i||o.substr(0,i.length+1)===i+"-":false},POS:function(f,i,o,r){var t=p.setFilters[i[2]];if(t)return t(f,o,i, +r)}}},A=p.match.POS,F=function(f,i){return"\\"+(i-0+1)};for(var Q in p.match){p.match[Q]=new RegExp(p.match[Q].source+/(?![^\[]*\])(?![^\(]*\))/.source);p.leftMatch[Q]=new RegExp(/(^(?:.|\r|\n)*?)/.source+p.match[Q].source.replace(/\\(\d+)/g,F))}var S=function(f,i){f=Array.prototype.slice.call(f,0);if(i){i.push.apply(i,f);return i}return f};try{Array.prototype.slice.call(B.documentElement.childNodes,0)}catch(ea){S=function(f,i){i=i||[];var o=0;if(g.call(f)==="[object Array]")Array.prototype.push.apply(i, +f);else if(typeof f.length==="number")for(var r=f.length;o";var o=B.documentElement;o.insertBefore(f,o.firstChild);if(B.getElementById(i)){p.find.ID=function(r,t,w){if(typeof t.getElementById!=="undefined"&&!w)return(t=t.getElementById(r[1]))?t.id===r[1]||typeof t.getAttributeNode!=="undefined"&&t.getAttributeNode("id").nodeValue===r[1]?[t]:C:[]};p.filter.ID=function(r,t){var w=typeof r.getAttributeNode!=="undefined"&&r.getAttributeNode("id");return r.nodeType===1&&w&&w.nodeValue===t}}o.removeChild(f); +o=f=null})();(function(){var f=B.createElement("div");f.appendChild(B.createComment(""));if(f.getElementsByTagName("*").length>0)p.find.TAG=function(i,o){o=o.getElementsByTagName(i[1]);if(i[1]==="*"){i=[];for(var r=0;o[r];r++)o[r].nodeType===1&&i.push(o[r]);o=i}return o};f.innerHTML="";if(f.firstChild&&typeof f.firstChild.getAttribute!=="undefined"&&f.firstChild.getAttribute("href")!=="#")p.attrHandle.href=function(i){return i.getAttribute("href",2)};f=null})();B.querySelectorAll&& +function(){var f=n,i=B.createElement("div");i.innerHTML="

";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){n=function(r,t,w,G){t=t||B;if(!G&&!n.isXML(t))if(t.nodeType===9)try{return S(t.querySelectorAll(r),w)}catch(M){}else if(t.nodeType===1&&t.nodeName.toLowerCase()!=="object"){var T=t.id,ra=t.id="__sizzle__";try{return S(t.querySelectorAll("#"+ra+" "+r),w)}catch(na){}finally{if(T)t.id=T;else t.removeAttribute("id")}}return f(r,t,w,G)};for(var o in f)n[o]=f[o]; +i=null}}();(function(){var f=B.documentElement,i=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.msMatchesSelector,o=false;try{i.call(B.documentElement,":sizzle")}catch(r){o=true}if(i)n.matchesSelector=function(t,w){try{if(o||!p.match.PSEUDO.test(w))return i.call(t,w)}catch(G){}return n(w,null,null,[t]).length>0}})();(function(){var f=B.createElement("div");f.innerHTML="
";if(!(!f.getElementsByClassName||f.getElementsByClassName("e").length=== +0)){f.lastChild.className="e";if(f.getElementsByClassName("e").length!==1){p.order.splice(1,0,"CLASS");p.find.CLASS=function(i,o,r){if(typeof o.getElementsByClassName!=="undefined"&&!r)return o.getElementsByClassName(i[1])};f=null}}})();n.contains=B.documentElement.contains?function(f,i){return f!==i&&(f.contains?f.contains(i):true)}:function(f,i){return!!(f.compareDocumentPosition(i)&16)};n.isXML=function(f){return(f=(f?f.ownerDocument||f:0).documentElement)?f.nodeName!=="HTML":false};var ma=function(f, +i){var o=[],r="",t;for(i=i.nodeType?[i]:i;t=p.match.PSEUDO.exec(f);){r+=t[0];f=f.replace(p.match.PSEUDO,"")}f=p.relative[f]?f+"*":f;t=0;for(var w=i.length;t0)for(var h=d;h0},closest:function(a, +b){var d=[],e,g,h=this[0];if(c.isArray(a)){var m={},n,p=1;if(h&&a.length){e=0;for(g=a.length;e-1:c(h).is(a))d.push({selector:n,elem:h,level:p})}h=h.parentNode;p++}}return d}m=V.test(a)?c(a,b||this.context):null;e=0;for(g=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument|| +h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="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(J(a[0])||J(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",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")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var g=c.map(this,b,d);D.test(a)||(e=d);if(e&&typeof e==="string")g=c.filter(e,g);g=this.length>1?c.unique(g):g;if((this.length>1||L.test(e))&&I.test(a))g=g.reverse();return this.pushStack(g,a,ba.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length=== +1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===C||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===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,qa=/^\s+/,Sa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, +Ta=/<([\w:]+)/,cb=/\s]+\/)>/g,oa={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};oa.optgroup=oa.option; +oa.tbody=oa.tfoot=oa.colgroup=oa.caption=oa.thead;oa.th=oa.td;if(!c.support.htmlSerialize)oa._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==C)return this.empty().append((this[0]&&this[0].ownerDocument||B).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},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)})},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,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,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&& +e.parentNode.removeChild(e)}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);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(ja,"").replace(eb,'="$1">').replace(qa,"")],e)[0]}else return this.cloneNode(true)}); +if(a===true){$(this,b);$(this.find("*"),b.find("*"))}return b},html:function(a){if(a===C)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ja,""):null;else if(typeof a==="string"&&!Ua.test(a)&&(c.support.leadingWhitespace||!qa.test(a))&&!oa[(Ta.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Sa,"<$1>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?n.cloneNode(true):n)}m.length&&c.each(m,W)}return this}});c.buildFragment=function(a,b,d){var e,g,h;b=b&&b[0]?b[0].ownerDocument||b[0]:B;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===B&&!Ua.test(a[0])&&(c.support.checkClone||!Va.test(a[0]))){g=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(g)c.fragments[a[0]]= +h?e:1;return{fragment:e,cacheable:g}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{g=0;for(var h=d.length;g0?this.clone(true):this).get();c(d[g])[b](m);e=e.concat(m)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a, +b,d,e){b=b||B;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||B;for(var g=[],h=0,m;(m=a[h])!=null;h++){if(typeof m==="number")m+="";if(m){if(typeof m==="string"&&!db.test(m))m=b.createTextNode(m);else if(typeof m==="string"){m=m.replace(Sa,"<$1>");var n=(Ta.exec(m)||["",""])[1].toLowerCase(),p=oa[n]||oa._default,A=p[0],F=b.createElement("div");for(F.innerHTML=p[1]+m+p[2];A--;)F=F.lastChild;if(!c.support.tbody){A=cb.test(m);n=n==="table"&&!A?F.firstChild&& +F.firstChild.childNodes:p[1]===""&&!A?F.childNodes:[];for(p=n.length-1;p>=0;--p)c.nodeName(n[p],"tbody")&&!n[p].childNodes.length&&n[p].parentNode.removeChild(n[p])}!c.support.leadingWhitespace&&qa.test(m)&&F.insertBefore(b.createTextNode(qa.exec(m)[0]),F.firstChild);m=F.childNodes}if(m.nodeType)g.push(m);else g=c.merge(g,m)}}if(d)for(h=0;g[h];h++)if(e&&c.nodeName(g[h],"script")&&(!g[h].type||g[h].type.toLowerCase()==="text/javascript"))e.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]): +g[h]);else{g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(c.makeArray(g[h].getElementsByTagName("script"))));d.appendChild(g[h])}return g},cleanData:function(a){for(var b,d,e=c.cache,g=c.event.special,h=c.support.deleteExpando,m=0,n;(n=a[m])!=null;m++)if(!(n.nodeName&&c.noData[n.nodeName.toLowerCase()]))if(d=n[c.expando]){if((b=e[d])&&b.events)for(var p in b.events)g[p]?c.event.remove(n,p):c.removeEvent(n,p,b.handle);if(h)delete n[c.expando];else n.removeAttribute&&n.removeAttribute(c.expando); +delete e[d]}}});var Wa=/alpha\([^)]*\)/i,fb=/opacity=([^)]*)/,gb=/-([a-z])/ig,hb=/([A-Z])/g,Xa=/^-?\d+(?:px)?$/i,ib=/^-?\d/,jb={position:"absolute",visibility:"hidden",display:"block"},$a=["Left","Right"],ab=["Top","Bottom"],Ja,kb=B.defaultView&&B.defaultView.getComputedStyle,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===C)return this;return c.access(this,a,b,true,function(d,e,g){return g!==C?c.style(d,e,g):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a, +b){if(b){a=Ja(a,"opacity","opacity");return a===""?"1":a}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var g,h=c.camelCase(b),m=a.style,n=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==C){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!n||!("set"in n)||(d= +n.set(a,d))!==C)try{m[b]=d}catch(p){}}}else{if(n&&"get"in n&&(g=n.get(a,false,e))!==C)return g;return m[b]}}},css:function(a,b,d){var e,g=c.camelCase(b),h=c.cssHooks[g];b=c.cssProps[g]||g;if(h&&"get"in h&&(e=h.get(a,true,d))!==C)return e;else if(Ja)return Ja(a,b,g)},swap:function(a,b,d){var e={};for(var g in b){e[g]=a.style[g];a.style[g]=b[g]}d.call(a);for(g in b)a.style[g]=e[g]},camelCase:function(a){return a.replace(gb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]= +{get:function(d,e,g){var h;if(e){if(d.offsetWidth!==0)h=y(d,b,g);else c.swap(d,jb,function(){h=y(d,b,g)});return h+"px"}},set:function(d,e){if(Xa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return fb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){a=a.style;a.zoom=1;b=c.isNaN(b)?"":"alpha(opacity="+b*100+")";var d=a.filter||"";a.filter=Wa.test(d)? +d.replace(Wa,b):a.filter+" "+b}};if(kb)Ja=function(a,b,d){var e;d=d.replace(hb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return C;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};else if(B.documentElement.currentStyle)Ja=function(a,b){var d,e,g=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Xa.test(g)&&ib.test(g)){d=h.left;e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left= +b==="fontSize"?"1em":g||0;g=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return g};if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/)<[^<]*)*<\/script>/gi,ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, +qb=/^(?:GET|HEAD|DELETE)$/,bb=/\[\]$/,Aa=/\=\?(&|$)/,Qa=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ya=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ya)return Ya.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html", +data:b,complete:function(m,n){if(n==="success"||n==="notmodified")h.html(g?c("
").append(m.responseText.replace(nb,"")).find(g):m.responseText);d&&h.each(d,[m.responseText,n,m])}});return this},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||ob.test(this.nodeName)||pb.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(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},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,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new R.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}}, +ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,g,h=b.type.toUpperCase(),m=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")Aa.test(b.url)||(b.url+=(Qa.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||!Aa.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&& +(b.data&&Aa.test(b.data)||Aa.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(Aa,"="+d+"$1");b.url=b.url.replace(Aa,"="+d+"$1");b.dataType="script";var n=R[d];R[d]=function(r){g=r;c.handleSuccess(b,K,e,g);c.handleComplete(b,K,e,g);if(c.isFunction(n))n(r);else{R[d]=C;try{delete R[d]}catch(t){}}F&&F.removeChild(Q)}}if(b.dataType==="script"&&b.cache===null)b.cache=false;if(b.cache===false&&h==="GET"){var p=c.now(),A=b.url.replace(rb,"$1_="+p);b.url=A+(A===b.url?(Qa.test(b.url)? +"&":"?")+"_="+p:"")}if(b.data&&h==="GET")b.url+=(Qa.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");p=(p=sb.exec(b.url))&&(p[1]&&p[1]!==location.protocol||p[2]!==location.host);if(b.dataType==="script"&&h==="GET"&&p){var F=B.getElementsByTagName("head")[0]||B.documentElement,Q=B.createElement("script");if(b.scriptCharset)Q.charset=b.scriptCharset;Q.src=b.url;if(!d){var S=false;Q.onload=Q.onreadystatechange=function(){if(!S&&(!this.readyState||this.readyState==="loaded"|| +this.readyState==="complete")){S=true;c.handleSuccess(b,K,e,g);c.handleComplete(b,K,e,g);Q.onload=Q.onreadystatechange=null;F&&Q.parentNode&&F.removeChild(Q)}}}F.insertBefore(Q,F.firstChild);return C}var ea=false,K=b.xhr();if(K){b.username?K.open(h,b.url,b.async,b.username,b.password):K.open(h,b.url,b.async);try{if(b.data!=null&&!m||a&&a.contentType)K.setRequestHeader("Content-Type",b.contentType);if(b.ifModified){c.lastModified[b.url]&&K.setRequestHeader("If-Modified-Since",c.lastModified[b.url]); +c.etag[b.url]&&K.setRequestHeader("If-None-Match",c.etag[b.url])}p||K.setRequestHeader("X-Requested-With","XMLHttpRequest");K.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(ca){}if(b.beforeSend&&b.beforeSend.call(b.context,K,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");K.abort();return false}b.global&&c.triggerGlobal(b,"ajaxSend",[K,b]);var ma=K.onreadystatechange=function(r){if(!K||K.readyState===0|| +r==="abort"){ea||c.handleComplete(b,K,e,g);ea=true;if(K)K.onreadystatechange=c.noop}else if(!ea&&K&&(K.readyState===4||r==="timeout")){ea=true;K.onreadystatechange=c.noop;e=r==="timeout"?"timeout":!c.httpSuccess(K)?"error":b.ifModified&&c.httpNotModified(K,b.url)?"notmodified":"success";var t;if(e==="success")try{g=c.httpData(K,b.dataType,b)}catch(w){e="parsererror";t=w}if(e==="success"||e==="notmodified")d||c.handleSuccess(b,K,e,g);else c.handleError(b,K,e,t);d||c.handleComplete(b,K,e,g);r==="timeout"&& +K.abort();if(b.async)K=null}};try{var f=K.abort;K.abort=function(){K&&f.call&&f.call(K);ma("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){K&&!ea&&ma("timeout")},b.timeout);try{K.send(m||b.data==null?null:b.data)}catch(o){c.handleError(b,K,null,o);c.handleComplete(b,K,e,g)}b.async||ma();return K}},param:function(a,b){var d=[],e=function(h,m){m=c.isFunction(m)?m():m;d[d.length]=encodeURIComponent(h)+"="+encodeURIComponent(m)};if(b===C)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a, +function(){e(this.name,this.value)});else for(var g in a)X(g,a[g],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete", +[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a, +b,d){var e=a.getResponseHeader("content-type")||"",g=b==="xml"||!b&&e.indexOf("xml")>=0;a=g?a.responseXML:a.responseText;g&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});if(R.ActiveXObject)c.ajaxSettings.xhr=function(){if(R.location.protocol!=="file:")try{return new R.XMLHttpRequest}catch(a){}try{return new R.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}; +c.support.ajax=!!c.ajaxSettings.xhr();var Oa={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,La,Ra=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(Y("show",3),a,b,d);else{a=0;for(b=this.length;a=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:Y("show",1),slideUp:Y("hide",1),slideToggle:Y("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,e,g){return this.animate(b,d,e,g)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&& +!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*Math.PI)/2+0.5)*e+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]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-10000?a:0},custom:function(a,b,d){function e(h){return g.step(h)}this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;var g=this;a=c.fx;e.elem=this.elem; +if(e()&&c.timers.push(e)&&!La)La=setInterval(a.tick,a.interval)},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=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1; +this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var g=this.elem,h=this.options;c.each(["","X","Y"],function(n,p){g.style["overflow"+p]=h.overflow[n]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var m in this.options.curAnim)c.style(this.elem,m,this.options.orig[m]);this.options.complete.call(this.elem)}return false}else{a= +b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; +a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;g=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=g.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b); +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.css(a,"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var g=c(a),h=g.offset(),m=c.css(a,"top"),n=c.css(a,"left"),p=e==="absolute"&&c.inArray("auto",[m,n])>-1;e={};var A={};if(p)A=g.position();m=p?A.top:parseInt(m, +10)||0;n=p?A.left:parseInt(n,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+m;if(b.left!=null)e.left=b.left-h.left+n;"using"in b?b.using.call(a,e):g.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Za.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0], +"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||B.body;a&&!Za.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(e){var g=this[0],h;if(!g)return null;if(e!==C)return this.each(function(){if(h=la(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=la(g))?"pageXOffset"in +h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:g[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var g=this[0];if(!g)return e==null?null:this;if(c.isFunction(e))return this.each(function(h){var m=c(this);m[d](e.call(this, +h,m[d]()))});return c.isWindow(g)?g.document.compatMode==="CSS1Compat"&&g.document.documentElement["client"+b]||g.document.body["client"+b]:g.nodeType===9?Math.max(g.documentElement["client"+b],g.body["scroll"+b],g.documentElement["scroll"+b],g.body["offset"+b],g.documentElement["offset"+b]):e===C?parseFloat(c.css(g,d)):this.css(d,typeof e==="string"?e:e+"px")}});typeof define!=="undefined"&&define("jquery",[],function(){return c})})(window); + +// Copyright 2010, Vlad Balin aka "Gaperton". +// Dual licensed under the MIT or GPL Version 2 licenses. + +// Include.js wrapper for require.js +//================================== +$.include = function() { + // Content plugin interface + // ------------------------ + function DummyPlugIn( a_path ){ + // translate resource address + this.path = function(){ return a_path; } + } + // content transformation... + DummyPlugIn.prototype.content = function( a_content ){ return a_content; }; + + // Helper class to handle require.js interaction + // --------------------------------------------- + function Context(){ + var _context = {}; + + // module's path array for require.js 'define' call + this.paths = []; + + // handler's array to create the context for include.js body function + var _args = []; + + // add new variable to context, and take care of plugins... + this.add = function( a_name, a_path, a_subname ){ + var plugin = a_name in $.include.plugins ? + new $.include.plugins[ a_name ]( a_path ) + : new DummyPlugIn( a_path ); + + this.paths.push( plugin.path() ); + + _args.push( function( a_value ){ + // transform value, if plugin is present... + var value = plugin.content( a_value ); + + // assign value to the context... + if( a_subname ){ + _context[ a_name ][ a_subname ] = value; + }else{ + _context[ a_name ] = value; + } + }); + } + + // create callback for require.js define function + this.on_load = function( a_body_f ){ + return function() { + // fill context... + for( var i = 0; i < _args.length; i++ ){ + _args[ i ]( arguments[ i ] ); + } + + // call module's body... + _context.exports = {}; + var res = a_body_f( _context ); + return res ? res : _context.exports; + }; + } + } + + // Include interface function definition + // ------------------------------------- + function include() { + // initialize plugins at the first run... + var _scripts = []; + var _context = new Context(); + + // loop through include's arguments... + for( var i = 0; i < arguments.length; i++ ) { + var arg = arguments[ i ]; + + if( arg instanceof Array ){ + // Ordered load of plain js scripts... + for( var j in arg ) { + _scripts.push( "order!" + arg[ j ] ); + } + } + else if( typeof arg == "string" ){ + // Unordered load of plain js scripts... + _scripts.push( arg ); + }else{ + // Load require.js modules & other content... + for( var name in arg ) { + var path = arg[ name ]; + + if( typeof path == "string" ){ + _context.add( name, path ); + }else{ + for( var subname in path ){ + _context.add( name, path[ subname ], subname ); + } + } + } + } + } + + // create paths array for require.js + var _paths = _context.paths.concat( _scripts ); + + return { + main: function( a_body_f ) { + $(function(){ //TODO: detect if jQuery is not used... + if( $.include.settings ) + require( include.settings, _paths, _context.on_load( a_body_f ) ); + else + define( _paths, _context.on_load( a_body_f ) ) + }); + }, + define: function( a_body_f ){ + return define( _paths, _context.on_load( a_body_f ) ); + } + }; + } + + include.plugins = {}; + + return include; +}(); + +// Copyright 2010, Vlad Balin aka "Gaperton". +// Dual licensed under the MIT or GPL Version 2 licenses. + +// Core Templates plugin +// ===================================== +// Mustache and ASP styles are natively supported. +// {{ expr }} or <%= expr %> - inline result of expression +// {- code -} or <% code %> - inject arbitrary JavaScript +// {-- section_name --} or <%@ section_name %> +// - define template's section + +// Please, do NOT add more template markup to this plug-in. +// It's intended to be the base for other plug-ins. + +$.include.plugins.html = function(){ + // ASP-style template compiler + //------------------------------------ + function compileSection( a_str ){ + var fun = "var $1=_$1?_$1:{};var p=[],print=function(){p.push.apply(p,arguments);};" + + "with($1){p.push('" + + a_str + .replace( /[\r\t\n]/g, " " ) + .replace( /'(?=[^%]*%>)/g, "\t" ) + .split( "'" ).join( "\\'" ) + .split( "\t" ).join( "'" ) + .replace( /<%=(.+?)%>/g, "',$1,'" ) + .split( "<%" ).join( "');" ) + .split( "%>" ).join( "p.push('" ) + + "');}return p.join('');"; + + return new Function( "_$1,$2,$3", fun ); + } + + function renderTo_f( $this, a_context ){ + return $this.html( this( a_context ) ); + } + + function trim_spaces( a_string ){ + return a_string.replace( /^\s*/, "").replace( /\s*$/, "" ); + } + // Template object with section's support + //--------------------------------------- + function createTemplate( a_string ){ + // parse sections... + var x = a_string.split( /<%@(.+?)%>/ ); + + function template( a_data ){ + return template.__default_section( a_data ); + } + + // parse default section... + template.__default_section = compileSection( x[ 0 ] ); + template.renderTo = renderTo_f; + + // for each section... + for( var i = 1; i < x.length; i += 2 ){ + + // create template function... + var section_f = compileSection( x[ i + 1 ] ); + section_f.renderTo = renderTo_f; + + // add section template to the object... + var name = x[ i ].replace( /^\s*/, "").replace( /\s*$/, "" ); + template[ name ] = section_f; + } + + return template; + } + + // Define core templates plug-in... + //--------------------------------- + function PlugIn( a_path ){ + // handle path... + var _root = ""; + + if( $.include.settings && $.include.settings.html ){ + _root = $.include.settings.html.root; + } + + + var _path = "text!" + _root + a_path; + + this.path = function(){ return _path; } + }; + + // mustache to ASP template style compiler... + //------------------------------------------- + function mustache2asp( a_text ){ + return a_text + .replace( /{--(.+?)--}/g, "<%@$1%>" ) + .replace( /{-(.+?)-}/g, "<%$1%>" ) + replace( /{{(.+?)}}/, "<%=$1%>" ); + } + + PlugIn.prototype.content = function( a_text ){ + return createTemplate( mustache2asp( a_text ) ); + }; + + // make core template functionality available for other plug-ins... + PlugIn.compileModule = createTemplate; + PlugIn.compileSection = compileSection; + PlugIn.mustache2asp = mustache2asp; + return PlugIn; +}(); \ No newline at end of file diff --git a/plugins/templates.js b/plugins/templates.js index 0a6fa2d..9754868 100644 --- a/plugins/templates.js +++ b/plugins/templates.js @@ -32,6 +32,10 @@ $.include.plugins.html = function(){ return new Function( "_$1,$2,$3", fun ); } + function renderTo_f( $this, a_context ){ + return $this.html( this( a_context ) ); + } + function trim_spaces( a_string ){ return a_string.replace( /^\s*/, "").replace( /\s*$/, "" ); } @@ -47,13 +51,15 @@ $.include.plugins.html = function(){ // parse default section... template.__default_section = compileSection( x[ 0 ] ); + template.renderTo = renderTo_f; // for each section... for( var i = 1; i < x.length; i += 2 ){ // create template function... var section_f = compileSection( x[ i + 1 ] ); - + section_f.renderTo = renderTo_f; + // add section template to the object... var name = x[ i ].replace( /^\s*/, "").replace( /\s*$/, "" ); template[ name ] = section_f; diff --git a/test.html b/test.html index 4eef254..c031811 100644 --- a/test.html +++ b/test.html @@ -20,7 +20,7 @@ view : 'views/main' }) .main( function( _ ){ - _.view().appendTo( 'body' ); + _.view().$body.appendTo( 'body' ); }); From 3d431f8bf0807fb1ec42bcc114bc214c0136638f Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 06:38:52 +0800 Subject: [PATCH 06/25] --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 0ca5b8a..2daf6bc 100644 --- a/README +++ b/README @@ -1,3 +1,5 @@ +Please, hold on... Critical errors found. + What is it? =========== include.js is javascript library, intended to simplify development of ajax and offline web applications. From d1babe433e2c134bb756f53661056057b929c276 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 07:02:14 +0800 Subject: [PATCH 07/25] Fixed defects: - missing $.define declaration - mistakes in mustache-style to APS template translation. - fixed defects in closures in templates.js --- include-bootstrap.js | 24 +++++++++++++++++------- include.js | 12 +++++++++++- plugins/templates.js | 24 +++++++++++++++--------- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/include-bootstrap.js b/include-bootstrap.js index f9ecc93..47e07d6 100644 --- a/include-bootstrap.js +++ b/include-bootstrap.js @@ -345,6 +345,16 @@ $.include = function() { return include; }(); +$.define = function( a_body_f ){ + function on_load(){ + var _context = { exports: {} }; + var res = a_body_f( _context ); + return res ? res : _context.exports; + } + + return define( a_body_f ); +}; + // Copyright 2010, Vlad Balin aka "Gaperton". // Dual licensed under the MIT or GPL Version 2 licenses. @@ -377,10 +387,6 @@ $.include.plugins.html = function(){ return new Function( "_$1,$2,$3", fun ); } - - function renderTo_f( $this, a_context ){ - return $this.html( this( a_context ) ); - } function trim_spaces( a_string ){ return a_string.replace( /^\s*/, "").replace( /\s*$/, "" ); @@ -394,17 +400,21 @@ $.include.plugins.html = function(){ function template( a_data ){ return template.__default_section( a_data ); } + + function render_f( $this, a_context ){ + return $this.html( this.call( template, a_context ) ); + } // parse default section... template.__default_section = compileSection( x[ 0 ] ); - template.renderTo = renderTo_f; + template.renderTo = render_f; // for each section... for( var i = 1; i < x.length; i += 2 ){ // create template function... var section_f = compileSection( x[ i + 1 ] ); - section_f.renderTo = renderTo_f; + section_f.renderTo = render_f; // add section template to the object... var name = x[ i ].replace( /^\s*/, "").replace( /\s*$/, "" ); @@ -436,7 +446,7 @@ $.include.plugins.html = function(){ return a_text .replace( /{--(.+?)--}/g, "<%@$1%>" ) .replace( /{-(.+?)-}/g, "<%$1%>" ) - replace( /{{(.+?)}}/, "<%=$1%>" ); + .replace( /{{(.+?)}}/g, "<%=$1%>" ); } PlugIn.prototype.content = function( a_text ){ diff --git a/include.js b/include.js index e748f92..c386a73 100644 --- a/include.js +++ b/include.js @@ -118,4 +118,14 @@ $.include = function() { include.plugins = {}; return include; -}(); \ No newline at end of file +}(); + +$.define = function( a_body_f ){ + function on_load(){ + var _context = { exports: {} }; + var res = a_body_f( _context ); + return res ? res : _context.exports; + } + + return define( a_body_f ); +}; \ No newline at end of file diff --git a/plugins/templates.js b/plugins/templates.js index 9754868..485f292 100644 --- a/plugins/templates.js +++ b/plugins/templates.js @@ -12,7 +12,6 @@ // Please, do NOT add more template markup to this plug-in. // It's intended to be the base for other plug-ins. -// TODO: add default section support! $.include.plugins.html = function(){ // ASP-style template compiler //------------------------------------ @@ -31,10 +30,6 @@ $.include.plugins.html = function(){ return new Function( "_$1,$2,$3", fun ); } - - function renderTo_f( $this, a_context ){ - return $this.html( this( a_context ) ); - } function trim_spaces( a_string ){ return a_string.replace( /^\s*/, "").replace( /\s*$/, "" ); @@ -48,17 +43,21 @@ $.include.plugins.html = function(){ function template( a_data ){ return template.__default_section( a_data ); } + + function render_f( $this, a_context ){ + return $this.html( this.call( template, a_context ) ); + } // parse default section... template.__default_section = compileSection( x[ 0 ] ); - template.renderTo = renderTo_f; + template.renderTo = render_f; // for each section... for( var i = 1; i < x.length; i += 2 ){ // create template function... var section_f = compileSection( x[ i + 1 ] ); - section_f.renderTo = renderTo_f; + section_f.renderTo = render_f; // add section template to the object... var name = x[ i ].replace( /^\s*/, "").replace( /\s*$/, "" ); @@ -90,7 +89,7 @@ $.include.plugins.html = function(){ return a_text .replace( /{--(.+?)--}/g, "<%@$1%>" ) .replace( /{-(.+?)-}/g, "<%$1%>" ) - replace( /{{(.+?)}}/, "<%=$1%>" ); + .replace( /{{(.+?)}}/g, "<%=$1%>" ); } PlugIn.prototype.content = function( a_text ){ @@ -102,4 +101,11 @@ $.include.plugins.html = function(){ PlugIn.compileSection = compileSection; PlugIn.mustache2asp = mustache2asp; return PlugIn; -}(); \ No newline at end of file +}(); + +// Initial jQuery support for templates. +// $( something ).render( templateOrSection, context ) +// should render template in the given context inside given jQuery element. +$.fn.render = function( a_template, a_data ){ + return a_template.renderTo( this, a_data ); +} \ No newline at end of file From 91a728932518d98af23ac2a5c14eca8bf8403836 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 07:13:51 +0800 Subject: [PATCH 08/25] --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 2daf6bc..30aa8ec 100644 --- a/README +++ b/README @@ -1,4 +1,5 @@ Please, hold on... Critical errors found. +UPD: Should be ok now, but you have warned. This is APLHA release. Please, wait 1-2 days until I test it in my project. What is it? =========== From 32f45e54fb8ca72898005b52dfca93299d9beff9 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 17:34:55 +0800 Subject: [PATCH 09/25] fixed defects --- include-bootstrap.js | 1 + plugins/templates.js | 1 + 2 files changed, 2 insertions(+) diff --git a/include-bootstrap.js b/include-bootstrap.js index 47e07d6..9dda3e2 100644 --- a/include-bootstrap.js +++ b/include-bootstrap.js @@ -444,6 +444,7 @@ $.include.plugins.html = function(){ //------------------------------------------- function mustache2asp( a_text ){ return a_text + .replace( /[\r\t\n]/g, " " ) .replace( /{--(.+?)--}/g, "<%@$1%>" ) .replace( /{-(.+?)-}/g, "<%$1%>" ) .replace( /{{(.+?)}}/g, "<%=$1%>" ); diff --git a/plugins/templates.js b/plugins/templates.js index 485f292..0b255d3 100644 --- a/plugins/templates.js +++ b/plugins/templates.js @@ -87,6 +87,7 @@ $.include.plugins.html = function(){ //------------------------------------------- function mustache2asp( a_text ){ return a_text + .replace( /[\r\t\n]/g, " " ) .replace( /{--(.+?)--}/g, "<%@$1%>" ) .replace( /{-(.+?)-}/g, "<%$1%>" ) .replace( /{{(.+?)}}/g, "<%=$1%>" ); From 888a36bdb1c31379f79d7c4f6f8e31788df9f3fc Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 17:38:07 +0800 Subject: [PATCH 10/25] Status message added --- README | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README b/README index 30aa8ec..86ea403 100644 --- a/README +++ b/README @@ -1,5 +1,4 @@ -Please, hold on... Critical errors found. -UPD: Should be ok now, but you have warned. This is APLHA release. Please, wait 1-2 days until I test it in my project. +STATUS: It should be reasonably stable now. I have tested it in my production project (haml support have not been tested). I will add tests, programming examples, and update docs later today. What is it? =========== From f1a2795a42754a1d10d6ad209b3b4cb287bb00dc Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 19:22:12 +0800 Subject: [PATCH 11/25] added templates test and description --- core templates.html | 32 +++++++++++++++ html/main.html | 96 +++++++++++++++++++++++++++++++++++++++++++-- views/main.js | 28 ++++++++++--- 3 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 core templates.html diff --git a/core templates.html b/core templates.html new file mode 100644 index 0000000..897f5d8 --- /dev/null +++ b/core templates.html @@ -0,0 +1,32 @@ + + + + + + Include.js test + + + + + + + + + + + diff --git a/html/main.html b/html/main.html index 549ee58..4ee218d 100644 --- a/html/main.html +++ b/html/main.html @@ -1,4 +1,94 @@ -<%@ main %>

-Hello World! -

\ No newline at end of file +This is the template. + +

The basics

+

Include.js Core Templates plugin support simple yet comprehensive template language, based on JavaScript inlining. You can use two templating tag styles - "mustache" and "ASP-style".

+ +Here's a list of Core Templates tags: +{{ this.core_tags( $1, tags ) }} +Yep, that's it. By the way, the table above is generated with these tags, and is the test. Please, take a look inside html/main.html + +You include template with name 'html', and it gets automatically compiled to JS function. You can call this function in your code with context object, and it will evaluate template with its embeeded JS in the given context, and return text. That's simple. Like this: + +
+var html = _.html( { a: 5, b: "dsdsd" } );
+
+ +Or, if you're using jQuery, you can do this: + +
+_.html.renderTo( $('#holder'), { a: 5, b: "dsdsd" } ).click( function(){ alert('Yahooo!');});
+
+ +Or this: + +
+$('#holder').render( _.html, { a: 5, b: "dsdsd" } ).click( function(){ alert('Yahooo!');});
+
+ +And template will be rendered to #holder tag, erasing all previously existing inner HTML. And that's it. + +Oh, year, there are third tag, which represent the most interesting feature of Core Templates. Sections. + +

Sections

+Section - it's just the named subtemplate declaration you can put in you document, and use it from main section, or JS module. Or from the other section. Sections allow you to split large HTML document to the number of reusable parts. How it looks like? Well, have you opened this template (html/main.html)? :) It's good example. + +Defining section is easy. +{{ this.core_tags( $1, sections ) }} + +Sections are translated to template functions in _.html namespace. For example, table with tags above can be accessible as _.html.core_tags from .js file, or - as this.core_tags from inside of this template. + +When you want to directly inline section in the template, you need to pass parameters to this function call. First parameter is context, and it can be referred as $1. In addition, you can pass secons $2 and third $3 parameters. + +Sections are extremily useful feature. Some use cases: +
    +
  1. Fight the complexity of deep HTML trees. In case if HTML tree becomes hard to understand, you can take parts out of it and move them to the sections.
  2. +
  3. Similar patterns in the document. Move them to the sections, and you will remove the pain.
  4. +
+ +

Rationale

+{{ this.why_such_templates( $1 ) }} + +{-- core_tags --} + +{- for( var i in $2 ){-} + <% var tag = $2[ i ]; %> + + +{-}-} +
{{ tag.desc }} + <%= tag.mustache %> + {{ $2[ i ].asp }} +
+ +{-- why_such_templates --} +

Now let me explain, why templates looks like they looks:

+
    +
  1. I believe that there's no real reason to introduce templating DSLs, while we have JS already. +
      +
    1. JS have necessary control structures.
    2. +
    3. JS is more powerful, than any of templating DSLs. With emedded JS capabilities you're sure, that you can do _everything_ you need.
    4. +
    5. Templates with embedded JS can be easily compiled to JS, and they are FAST
    6. +
    7. And there's one important thing - you already know and unrestand JS, and there's nothing to learn.
    8. +
    +
  2. + +
  3. You might have different point of view - and that's fine. I suspected that, and specially designed the system in the way, allowing you to easily extend templating system. I mean, it's _really_ easy. +
      +
    1. All 'smart' content modules are handled through plug-ins
    2. +
    3. Core Templates itself is the plugin.
    4. +
    5. Plugins can call each other
    6. +
    7. You can translate your favorite template syntax to Core Templates one, and pass the result to 'html' plugin, to do the rest of magic.
    8. +
    9. ???
    10. +
    11. PROFIT! Actually, this is the major reason for Core Templates to be minimalistic. It's degined to be the basis for more complicated templating DSLs.
    12. +
    +
  4. + +
  5. Why I's using so strange JS-inline tags in 'mustache' case? It's so complicated to count JS backets when inserting if-s and for-s... +
      +
    1. Because I hate counting brackets. You don't need to do it with mustache style.
    2. +
    3. The right way - to count {{ block }} and {{end}} patterns. Its so easy, that when you get used to it, you will not need DSLs, cause embedded JS will looks just fine.
    4. +
    +
  6. +
+ diff --git a/views/main.js b/views/main.js index be6d60f..529583e 100644 --- a/views/main.js +++ b/views/main.js @@ -1,8 +1,26 @@ -$.include({ - html : "main.html" +$.include({ // include... + html : "main.html" // ...html template for main page. + // Since html root is set in $.include.settings object, + // it will take the file from html/ dir. }) -.define( function( _ ){ - _.exports = function(){ - return $( _.html.main() ); +.define( function( _ ){ // define module... + _.exports = function( $this ){ // ...which exports function, taking jQuery object as parameter... + _.html.renderTo( $this, { + tags : [ + { desc: 'Inline result of JS expression', + mustache: '{{ expression }}', + asp: '<%= expression %>' }, + { desc: 'Insert arbitrary JS code', + mustache: '{- code; code; code; -}', + asp: '<% code; code; code; %>' } + ], + + sections : [ + { desc: 'Define template section', + mustache: '{-- name --}', + asp: '<%@ name %>' } + ], + block: '{-}', end: '{-}-}' + });// ...rendering template to the content of $this parameter. } }); \ No newline at end of file From dfcb34b2ac871c1e67a0edc380945f08a253ca44 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 19:24:51 +0800 Subject: [PATCH 12/25] README --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 86ea403..cb2c333 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -STATUS: It should be reasonably stable now. I have tested it in my production project (haml support have not been tested). I will add tests, programming examples, and update docs later today. +STATUS: It should be reasonably stable now. I have tested it in my production project (haml support have not been tested). To see the description of Core Templates, please execute test.html. I will add tests, programming examples, and update docs later. What is it? =========== From 29e52a654e3173bcd3436b1cfb32f6aab179c390 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 19:26:20 +0800 Subject: [PATCH 13/25] README --- README | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README b/README index cb2c333..86198ae 100644 --- a/README +++ b/README @@ -1,4 +1,6 @@ -STATUS: It should be reasonably stable now. I have tested it in my production project (haml support have not been tested). To see the description of Core Templates, please execute test.html. I will add tests, programming examples, and update docs later. +STATUS: It should be reasonably stable now. I have tested it in my production project (haml support have not been tested). To see the description of Core Templates, please open core templates.html. It's basic example and introduction. + +I will add more tests, programming examples, and update docs later. What is it? =========== From a3e13f9c8163b5ffca567698a9afabda0c38c69c Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Thu, 11 Nov 2010 19:33:50 +0800 Subject: [PATCH 14/25] README --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 86198ae..9813047 100644 --- a/README +++ b/README @@ -1,5 +1,7 @@ STATUS: It should be reasonably stable now. I have tested it in my production project (haml support have not been tested). To see the description of Core Templates, please open core templates.html. It's basic example and introduction. +USAGE: To start evaluating the library - just replace your jquery.min.js with include-bootstrap.js from the root directory. + I will add more tests, programming examples, and update docs later. What is it? From 1c9c8ef53f32bae2cd8ed6c4eeda46e002961858 Mon Sep 17 00:00:00 2001 From: Kirill Zaborsky Date: Fri, 12 Nov 2010 11:24:14 +0300 Subject: [PATCH 15/25] Fixed error with nested includes --- include.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include.js b/include.js index c386a73..29b763b 100644 --- a/include.js +++ b/include.js @@ -38,7 +38,10 @@ $.include = function() { // assign value to the context... if( a_subname ){ - _context[ a_name ][ a_subname ] = value; + if( !_context[ a_name ] ){ + _context[ a_name ] = {}; + } + _context[ a_name ][ a_subname ] = value; }else{ _context[ a_name ] = value; } From fdac2e15fd3ee6a1f2ebb2620325d0b3c362a5c2 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Sun, 14 Nov 2010 05:28:49 +0800 Subject: [PATCH 16/25] updated README... --- README | 94 +++++++++++++++++++++++++++------------------------------- 1 file changed, 44 insertions(+), 50 deletions(-) diff --git a/README b/README index 9813047..2338305 100644 --- a/README +++ b/README @@ -1,18 +1,49 @@ -STATUS: It should be reasonably stable now. I have tested it in my production project (haml support have not been tested). To see the description of Core Templates, please open core templates.html. It's basic example and introduction. +What is it? +=========== +include.js is javascript library, intended to simplify development of ajax and offline web applications. It makes MVC-pattern trivial, and provides widely wanted browser-side 'include' directive. It's using approach which is different from common MVC frameworks, and its approach is a lot easier to understand and use. It relies on dynamically loadable modules, and HTML templates is the first-class module type. -USAGE: To start evaluating the library - just replace your jquery.min.js with include-bootstrap.js from the root directory. +Yes, you can include plain JS files, JS modules without garbaging global namespace, HTML templates, HAML templates (not tested), and (soon) CSS files. -I will add more tests, programming examples, and update docs later. +And - it can include any custom content you want if you write corresponding plug-in. HTML Templates support is written as plugin, so you already have an example. And, yes - plugins can call each other, so it's _really_ easy to write support for your own templating engine. -What is it? -=========== -include.js is javascript library, intended to simplify development of ajax and offline web applications. +include.js relies on excellent require.js library as the backend. -It provides comprehensive asynchronous modules API working in web browser, supporting JavaScript *and* first-class client-side HTML template modules. +Features didgest +================ +1. Complete backward compatibility with CommonJS Asynchronous modules, packages, and require.js modules. Since it;s based on require.js. +2. New module API, which is far easier to understand and use than original require.js one. Module definitions looks like module definitions, and inclide looks like traditional include. +3. Plig-in API for custom modules with content of any type. +4. Plug-ins included: +- HTML Templates, supporting ASP and mustache style tags, and JS embedding. +- HAML Templates. I'm using github implementation, and it have not been tested yet. But - it was straightforward to add. +- TODO: CSS files. I can add templating capabilities to the, too, if you request. +- TODO: Inline CSS in HTML Temapltes. +5. Straightforward MVC pattern impementation, allowing to decompose your AJAX application into hierarchy of HTML+JS(+CSS) components. In case you're looking for the way to do MVC - this is an easies way ever. +6. jQuery support. You can think of include.js as of the easy way to define more advanced widgets: + +$.include({ + html: "my_template.html" // include template from file... +}) +.define( function( _ ){ // define module... + _.exports = function widget( $this, a_data, a_events ){ // exporting function... + _.html.renderTo( $this, a_data ); // which expands template inside of $this. + + $this.find( "#ok").click( a_events.on_click ); // throw event up to the caller... + $this.find( "#refresh").click( function(){ + widget( $this, a_data, a_events ); // ...and update ourself. Yep, in that easy way. + }); + } +}); + +It's said, that Dojo Toolikit have better instruments for writing large AJAX applications, than jQuery. What I could say, as an author of large-scale inhouse jQuery ajax application? That used to be true, until the moment of include.js release. -It's compact and extensible. Developers can add they own custom module content types using clean and simple plug-ins API. +How can I try it? +================= +First - see an example. This example show you complete explanation of core templates language, if you execute it. Just put the files in include.js directory under your web root, and open 'core templates.html'. -include.js relies on excellent require.js library as the backend. It means, that it's backward compatible with CommonJS and require.js modules. +In order to evaluate it in your jquery project you need to include 'include-bootstrap' instead of your jquery.min.js, and read an exampe in order to understand, how to start the library. + +Don't panic, and say 'hello' to complicated frameworks. It's is not this case. The code is really short, friendly, and easy to read. Why? ==== @@ -30,41 +61,8 @@ Frameworks like Dojo solve these problem, but they have quite tough learning cur I believe that there are no real reasons for things to be so complicated. That's why I have created this library. -Please, show me the code! -========================= - -$.include( - 'plain.script.js', // load plain .js script. - 'jquery.widget.definition.js', // load plain .js script in parallel with previous one. - [ 'one.js', 'tho.js', 'three.js' ], // load these three .js scripts in listed order. - {// this is module context & dependency declaration. - some_module : 'logic/module', // JS module. Just like this one. - some_other_module : 'logic/other', - html : 'template.html' // HTML template will be loaded & compiled to the JS function. - } -).define( function( _ ){ // this function will be called with context, filled with actual values - _.export = function( a_events ){ - var x = _.some_module( _.some_other_module ); - var $this = $( _.html( x ) ); - $this.find( 'button.ok' ).click( a_events.on_ok ); - return $this; - } -}); - -Does it actually work? -====================== -Yes and no. Yes, the previous version of library perfectly works in complex application. - -But here is the development snapshot if new, completely rewritten version. It's highly unstable. So, if you like an idea, you're welcome to experiment with it, report bugs, suggest improvements, and write plug-ins. - -I need one week or so in order to test it and make it stable. - -Current Features -================ -Since include.js is wrapper on top of require.js, it can include require.js modules. However, it adds a number of improvements in usability... - -1. Better API for require.js functionality ------------------------------------------- +Comparison with require.js API +============================== require.js: require( [ 'mod/one', 'mod/two', 'mod/three' ], function( first, second, third ){ // try to make a change in this dependency list without mistake. @@ -116,9 +114,5 @@ include.js: Yep, require.js is really the great library. Unfortunately, I can't use their API. Fingers refusing to type, man. :) -More features description coming soon... ----------------------------------------- - -Planned Features -================ -Coming soon... \ No newline at end of file +That was basic API. features description coming soon... +------------------------------------------------------- \ No newline at end of file From 966a97b2fa86ec603cd30497f6e48d1f5d410629 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Sun, 14 Nov 2010 05:32:14 +0800 Subject: [PATCH 17/25] --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 2338305..1f9edd7 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ include.js is javascript library, intended to simplify development of ajax and o Yes, you can include plain JS files, JS modules without garbaging global namespace, HTML templates, HAML templates (not tested), and (soon) CSS files. -And - it can include any custom content you want if you write corresponding plug-in. HTML Templates support is written as plugin, so you already have an example. And, yes - plugins can call each other, so it's _really_ easy to write support for your own templating engine. +And - it can include any custom content you want if you write corresponding plug-in. HTML Templates support is written as plugin, so you already have an example. And, yes - plugins can call each other, so it's _really_ easy to write support for your own templating engine, which you wanted but afraid to implement. Just compile your language to ASP Core Templates style (which is easy to do with .replace), and that's it. include.js relies on excellent require.js library as the backend. From a0def5bcd4211a86122d6de55a9f917a0477c922 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Sun, 14 Nov 2010 05:34:27 +0800 Subject: [PATCH 18/25] --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 1f9edd7..727ff80 100644 --- a/README +++ b/README @@ -16,7 +16,7 @@ Features didgest 4. Plug-ins included: - HTML Templates, supporting ASP and mustache style tags, and JS embedding. - HAML Templates. I'm using github implementation, and it have not been tested yet. But - it was straightforward to add. -- TODO: CSS files. I can add templating capabilities to the, too, if you request. +- TODO: CSS files. I can add templating capabilities to CSS content too, if you request. - TODO: Inline CSS in HTML Temapltes. 5. Straightforward MVC pattern impementation, allowing to decompose your AJAX application into hierarchy of HTML+JS(+CSS) components. In case you're looking for the way to do MVC - this is an easies way ever. 6. jQuery support. You can think of include.js as of the easy way to define more advanced widgets: From d0127f7ce8b913fe731810dece8338024c8ff18d Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Sun, 14 Nov 2010 05:36:19 +0800 Subject: [PATCH 19/25] --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 727ff80..2c44bf6 100644 --- a/README +++ b/README @@ -19,7 +19,7 @@ Features didgest - TODO: CSS files. I can add templating capabilities to CSS content too, if you request. - TODO: Inline CSS in HTML Temapltes. 5. Straightforward MVC pattern impementation, allowing to decompose your AJAX application into hierarchy of HTML+JS(+CSS) components. In case you're looking for the way to do MVC - this is an easies way ever. -6. jQuery support. You can think of include.js as of the easy way to define more advanced widgets: +6. jQuery support. You can think of include.js as an easy way to define more advanced widgets: $.include({ html: "my_template.html" // include template from file... From fab9a9badd1f64ccc0972fd21439d4769072c6e2 Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Sun, 14 Nov 2010 05:37:09 +0800 Subject: [PATCH 20/25] --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 2c44bf6..921f0eb 100644 --- a/README +++ b/README @@ -43,7 +43,7 @@ First - see an example. This example show you complete explanation of core templ In order to evaluate it in your jquery project you need to include 'include-bootstrap' instead of your jquery.min.js, and read an exampe in order to understand, how to start the library. -Don't panic, and say 'hello' to complicated frameworks. It's is not this case. The code is really short, friendly, and easy to read. +Don't panic, and say 'bye' to complicated frameworks. It's is not this case. The code is really short, friendly, and easy to read. Why? ==== From 7574060c1b17c5c6af025a849ee27890ac3c096d Mon Sep 17 00:00:00 2001 From: Vlad Balin Date: Sun, 14 Nov 2010 05:38:44 +0800 Subject: [PATCH 21/25] --- README | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/README b/README index 921f0eb..a4930b8 100644 --- a/README +++ b/README @@ -37,29 +37,6 @@ $.include({ It's said, that Dojo Toolikit have better instruments for writing large AJAX applications, than jQuery. What I could say, as an author of large-scale inhouse jQuery ajax application? That used to be true, until the moment of include.js release. -How can I try it? -================= -First - see an example. This example show you complete explanation of core templates language, if you execute it. Just put the files in include.js directory under your web root, and open 'core templates.html'. - -In order to evaluate it in your jquery project you need to include 'include-bootstrap' instead of your jquery.min.js, and read an exampe in order to understand, how to start the library. - -Don't panic, and say 'bye' to complicated frameworks. It's is not this case. The code is really short, friendly, and easy to read. - -Why? -==== -In short - because it's great to feel the kind of PHP development simplicity when working in browser. - -Development of ajax and offline web applications is painful. Such application lives in the single HTML page, and there are no any standard way to hierarchically decompose large application to the number of small and reusable building blocks, incorporating parts of HTML *and* related JS. - - +