Skip to content
Browse files

merging

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92557 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 46b0f0c commit dca8c0cb6f87054a3446a11ff9bd70498464bfd1 @chillu chillu committed
Showing with 17,927 additions and 370 deletions.
  1. +1 −7 forms/CalendarDateField.php
  2. +1 −1 forms/ComplexTableField.php
  3. +1 −7 forms/TabSet.php
  4. +11 −12 javascript/CalendarDateField.js
  5. +13 −11 javascript/TabSet.js
  6. +1 −7 security/Security.php
  7. BIN thirdparty/jquery-concrete/.DS_Store
  8. +2 −2 thirdparty/jquery-concrete/.piston.yml
  9. +56 −8 thirdparty/jquery-concrete/README.textile
  10. +54 −0 thirdparty/jquery-concrete/build.sh
  11. +1,490 −0 thirdparty/jquery-concrete/dist/jquery.concrete-0.9.js
  12. +1,490 −0 thirdparty/jquery-concrete/dist/jquery.concrete-latest.js
  13. +30 −0 thirdparty/jquery-concrete/spec/spec-dist.html
  14. +72 −0 thirdparty/jquery-concrete/spec/spec.concrete.basics.js
  15. +68 −0 thirdparty/jquery-concrete/spec/spec.concrete.ctors.js
  16. +68 −0 thirdparty/jquery-concrete/spec/spec.concrete.events.js
  17. +246 −0 thirdparty/jquery-concrete/spec/spec.concrete.namespaces.js
  18. +77 −0 thirdparty/jquery-concrete/spec/spec.concrete.properties.js
  19. +54 −0 thirdparty/jquery-concrete/spec/spec.concrete.super.js
  20. +38 −0 thirdparty/jquery-concrete/spec/spec.html
  21. +102 −0 thirdparty/jquery-concrete/src/jquery.concrete.ctors.js
  22. +64 −0 thirdparty/jquery-concrete/src/jquery.concrete.dommaybechanged.js
  23. +169 −0 thirdparty/jquery-concrete/src/jquery.concrete.events.js
  24. +180 −315 thirdparty/jquery-concrete/src/jquery.concrete.js
  25. +77 −0 thirdparty/jquery-concrete/src/jquery.concrete.properties.js
  26. +49 −0 thirdparty/jquery-concrete/src/jquery.focusinout.js
  27. +105 −0 thirdparty/jquery-concrete/vendor/firebug_lite/ChangeLog
  28. BIN thirdparty/jquery-concrete/vendor/firebug_lite/errorIcon.png
  29. +214 −0 thirdparty/jquery-concrete/vendor/firebug_lite/firebug-lite.css
  30. +2,518 −0 thirdparty/jquery-concrete/vendor/firebug_lite/firebug-lite.js
  31. BIN thirdparty/jquery-concrete/vendor/firebug_lite/firebug.gif
  32. BIN thirdparty/jquery-concrete/vendor/firebug_lite/firebug_logo.png
  33. BIN thirdparty/jquery-concrete/vendor/firebug_lite/infoIcon.png
  34. BIN thirdparty/jquery-concrete/vendor/firebug_lite/progress.gif
  35. BIN thirdparty/jquery-concrete/vendor/firebug_lite/spacer.gif
  36. BIN thirdparty/jquery-concrete/vendor/firebug_lite/tree_close.gif
  37. BIN thirdparty/jquery-concrete/vendor/firebug_lite/tree_open.gif
  38. BIN thirdparty/jquery-concrete/vendor/firebug_lite/warningIcon.png
  39. +4,376 −0 thirdparty/jquery-concrete/vendor/jquery-1.3.2.js
  40. +75 −0 thirdparty/jquery-concrete/vendor/jquery.selector/jquery.class.js
  41. +188 −0 thirdparty/jquery-concrete/vendor/jquery.selector/jquery.selector.js
  42. +353 −0 thirdparty/jquery-concrete/vendor/jquery.selector/jquery.selector.matches.js
  43. +42 −0 thirdparty/jquery-concrete/vendor/jquery.selector/jquery.selector.specifity.js
  44. +8 −0 thirdparty/jquery-concrete/vendor/jspec/.piston.yml
  45. +473 −0 thirdparty/jquery-concrete/vendor/jspec/History.rdoc
  46. +50 −0 thirdparty/jquery-concrete/vendor/jspec/Manifest
  47. +724 −0 thirdparty/jquery-concrete/vendor/jspec/README.rdoc
  48. +73 −0 thirdparty/jquery-concrete/vendor/jspec/Rakefile
  49. +182 −0 thirdparty/jquery-concrete/vendor/jspec/bin/jspec
  50. +38 −0 thirdparty/jquery-concrete/vendor/jspec/jspec.gemspec
  51. BIN thirdparty/jquery-concrete/vendor/jspec/lib/images/bg.png
  52. BIN thirdparty/jquery-concrete/vendor/jspec/lib/images/hr.png
  53. BIN thirdparty/jquery-concrete/vendor/jspec/lib/images/loading.gif
  54. BIN thirdparty/jquery-concrete/vendor/jspec/lib/images/sprites.bg.png
  55. BIN thirdparty/jquery-concrete/vendor/jspec/lib/images/sprites.png
  56. BIN thirdparty/jquery-concrete/vendor/jspec/lib/images/vr.png
  57. +145 −0 thirdparty/jquery-concrete/vendor/jspec/lib/jspec.css
  58. +70 −0 thirdparty/jquery-concrete/vendor/jspec/lib/jspec.jquery.js
  59. +1,715 −0 thirdparty/jquery-concrete/vendor/jspec/lib/jspec.js
  60. +173 −0 thirdparty/jquery-concrete/vendor/jspec/lib/jspec.xhr.js
  61. +16 −0 thirdparty/jquery-concrete/vendor/jspec/server/browsers.rb
  62. +100 −0 thirdparty/jquery-concrete/vendor/jspec/server/server.rb
  63. +1 −0 thirdparty/jquery-concrete/vendor/jspec/spec/async
  64. +695 −0 thirdparty/jquery-concrete/vendor/jspec/spec/env.js
  65. +1 −0 thirdparty/jquery-concrete/vendor/jspec/spec/fixtures/test.html
  66. +1 −0 thirdparty/jquery-concrete/vendor/jspec/spec/fixtures/test.json
  67. +5 −0 thirdparty/jquery-concrete/vendor/jspec/spec/fixtures/test.xml
  68. +42 −0 thirdparty/jquery-concrete/vendor/jspec/spec/modules.js
  69. +33 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.dom.html
  70. +18 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.fixtures.js
  71. +34 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.grammar-less.js
  72. +218 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.grammar.js
  73. +173 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.jquery.js
  74. +35 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.jquery.xhr.js
  75. +127 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.js
  76. +492 −0 thirdparty/jquery-concrete/vendor/jspec/spec/spec.matchers.js
Sorry, we could not display the entire diff because it was too big.
View
8 forms/CalendarDateField.php
@@ -28,13 +28,7 @@ function Field() {
}
- // javascript: concrete
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.class.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.specifity.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.matches.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/src/jquery.dat.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/src/jquery.concrete.js');
+ Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/dist/jquery.concrete-latest.js');
// javascript: custom
Requirements::javascript(SAPPHIRE_DIR . '/javascript/CalendarDateField.js');
View
2 forms/ComplexTableField.php
@@ -1073,7 +1073,7 @@ function forTemplate() {
Requirements::css(CMS_DIR . '/css/typography.css');
Requirements::css(CMS_DIR . '/css/cms_right.css');
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/prototype/prototype.js");
- Requirements::javascript(SAPPHIRE_dir . "/thirdparty/behaviour/behaviour.js");
+ Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
Requirements::javascript(SAPPHIRE_DIR . "/javascript/prototype_improvements.js");
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/scriptaculous.js");
Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/scriptaculous/scriptaculous/controls.js");
View
8 forms/TabSet.php
@@ -58,13 +58,7 @@ public function FieldHolder() {
Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/ui.all.css');
Requirements::css(SAPPHIRE_DIR . '/thirdparty/jquery-ui-themes/smoothness/ui.tabs.css');
- // concrete
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.class.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.specifity.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.matches.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/src/jquery.dat.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/src/jquery.concrete.js');
+ Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/dist/jquery.concrete-latest.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TabSet.js');
View
23 javascript/CalendarDateField.js
@@ -1,22 +1,21 @@
(function($) {
- /**
- * Formats a <input type="text"> field with a jQuery UI datepicker.
- *
- * Requires: concrete, ui.datepicker, jquery.metadata
- *
- * @author Ingo Schommer, SilverStripe Ltd.
- */
- $('.calendardate').concrete('ss', function($){
- return {
+ $.concrete('ss', function($){
+ /**
+ * Formats a <input type="text"> field with a jQuery UI datepicker.
+ *
+ * Requires: concrete, ui.datepicker, jquery.metadata
+ *
+ * @author Ingo Schommer, SilverStripe Ltd.
+ */
+ $('.calendardate').concrete({
onmatch: function() {
this.find('input').each(function() {
var conf = $(this).metadata();
if(conf.minDate) conf.minDate = new Date(Date.parse(conf.minDate));
-
- //
+
$(this).datepicker(conf);
});
}
- };
+ });
});
}(jQuery));
View
24 javascript/TabSet.js
@@ -1,13 +1,13 @@
(function($){
- /**
- * Lightweight wrapper around jQuery UI tabs.
- * Ensures that anchor links are set properly,
- * and any nested tabs are scrolled if they have
- * their height explicitly set. This is important
- * for forms inside the CMS layout.
- */
- $('.ss-tabset').concrete('ss', function($){
- return {
+ $.concrete('ss', function($){
+ /**
+ * Lightweight wrapper around jQuery UI tabs.
+ * Ensures that anchor links are set properly,
+ * and any nested tabs are scrolled if they have
+ * their height explicitly set. This is important
+ * for forms inside the CMS layout.
+ */
+ $('.ss-tabset').concrete({
onmatch: function() {
this.rewriteHashlinks();
@@ -15,8 +15,10 @@
this.tabs({
cookie: $.cookie ? { expires: 30, path: '/', name: 'ui-tabs-' + this.attr('id') } : false
});
+
+ this._super();
},
-
+
/**
* Replace prefixes for all hashlinks in tabs.
* SSViewer rewrites them from "#Root_MyTab" to
@@ -29,6 +31,6 @@
if(href) $(this).attr('href', href);
});
}
- };
+ });
});
})(jQuery);
View
8 security/Security.php
@@ -342,13 +342,7 @@ public function login() {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.core.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-ui/ui.tabs.js');
- // concrete
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.class.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.specifity.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-selector/src/jquery.selector.matches.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/src/jquery.dat.js');
- Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/src/jquery.concrete.js');
+ Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-concrete/dist/jquery.concrete-latest.js');
Requirements::css(THIRDPARTY_DIR . '/jquery/themes/smoothness/ui.all.css');
Requirements::css(THIRDPARTY_DIR . '/jquery/themes/smoothness/ui.tabs.css');
View
BIN thirdparty/jquery-concrete/.DS_Store
Binary file not shown.
View
4 thirdparty/jquery-concrete/.piston.yml
@@ -1,8 +1,8 @@
---
format: 1
handler:
- commit: c857ed5d684031115a2bb369f601c7147a2c69bc
+ commit: 488376e8aa3c046cbf60adf43c42c76b5031fe20
branch: master
lock: false
-repository_url: git://github.com/hafriedlander/jquery.concrete.git
repository_class: Piston::Git::Repository
+repository_url: git://github.com/hafriedlander/jquery.concrete.git
View
64 thirdparty/jquery-concrete/README.textile
@@ -1,8 +1,16 @@
h1. Concrete - Support for ConcreteUI programming in jQuery
-A basic desire for jQuery programming is some sort of OO or other organisational method for code. For your consideration,
-we provide a library for ConcreteUI style programming. In ConcreteUI you attach behavioral code to DOM objects. Concrete extends this
-concept beyond what is provided by other libraries to provide a very easy to use system with class like, ploymorphic, namespaced properties
+By Hamish Friedlander, with thanks to "SilverStripe":http://www.silverstripe.com/
+
+Concrete tries to provide a new model of code organisation - a replacement for Object Oriented programming that is focused on adding functions to groups of DOM elements based on the structure and contents of those DOM elements. It's a merging of the model and view layer that initially seems weird, but can give very powerful results.
+
+We're standing on the shoulders of giants here - combining ideas from Prototype's behaviour & lowpro and jQuery's effen & livequery (who themselves stole ideals from Self's Morphic UI and others), but extending & combining the concepts presented in those tools to provide a complete alternative to traditional OO concepts - self-aware methods, inheritance, polymorphisim and namespacing without a single class definition.
+
+h2. Getting Started
+
+* Walk through the "Tutorial":http://hafriedlander.github.com/jquery.concrete/tutorial/
+* Watch the "Screencast":http://www.vimeo.com/6353390 (shot during a introductory developer meeting at SilverStripe)
+* Join the "Google Group":http://groups.google.com/group/jquery-concrete and let us know what you think, or what other features you'd like to see
h2. Basic use
@@ -226,17 +234,46 @@ And the concrete definitions
Then doing $('div').bar(); will _not_ display b. Even though the span rule could never match a div, because baz is defined for some rule in the foo namespace, the base namespace will never be checked
-h4. Forcing base
+h4. Cleaner namespace blocks
-In some situations (such as the last example) you may want to force using the base namespace. In this case you can call concrete without any arguments. For example, if the first definition in the previous example was
+When declaring a lot of namespaces, you can declare the namespace seperately from the concrete definitions, like so
+
+<pre><code>
+ $.concrete('foo', function($){
+ $('div').concrete({
+ bar: function() { .. }
+ })
+ })
+</code></pre>
+
+You can also nest declarations. In this next example, we're defining the functions $().concrete('zap').bar() and $().concrete('zap.pow').baz()
+
+<pre><code>
+ $.concrete('zap', function($){
+ $('div').concrete({
+ bar: function() { .. }
+ })
+ $.concrete('pow', function($){
+ $('div').concrete({
+ baz: function() { .. }
+ })
+ })
+ })
+</code></pre>
+
+h4. Calling to another namespace (and forcing base)
+
+Inside a namespace, namespace lookups are by default relative to the current namespace.
+
+In some situations (such as the last example) you may want to force using the base namespace. In this case you can call concrete with the first argument being the base namespace code '.'. For example, if the first definition in the previous example was
<pre><code>
$('div').concrete('foo', {
- bar: function() { this.concrete().baz(); }
+ bar: function() { this.concrete('.').baz(); }
})
</code></pre>
-Then b _would_ be output to the console. It is up to the developer to decide when they need to be explicit about using the base namespace
+Then b _would_ be output to the console.
h4. Using
@@ -252,8 +289,19 @@ Sometimes a block outside of a namespace will need to refer to that namespace re
});
</code></pre>
-This equivilent to /with/ in javascript, and just like /with/, care should be taken to only use this construct in situations that merit it.
+This equivalent to /with/ in javascript, and just like /with/, care should be taken to only use this construct in situations that merit it.
+
+h2. License
+
+Copyright (C) 2009 Hamish Friedlander (hamish@silverstripe.com) and SilverStripe Limited (www.silverstripe.com). All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ * Neither the name of Hamish Friedlander nor SilverStripe nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
54 thirdparty/jquery-concrete/build.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+VER=$1
+
+# Get the version - a tag if possible, otherwise a short ref (not well tested code)
+if [ "$VER " = " " ] ; then \
+ VER=`git rev-parse --abbrev-ref=strict HEAD`
+fi
+if [ "$VER" = "master" ] ; then \
+ VER=`git show --pretty=format:"%h" --quiet`
+fi
+
+# Specify the output file's name
+FILE="dist/jquery.concrete-$VER.js"
+
+mkdir -p dist
+rm dist/*.js
+
+echo "/* jQuery.Concrete - Copyright 2009 Hamish Friedlander and SilverStripe. Version $VER. */" > $FILE
+
+for x in \
+ vendor/jquery.selector/jquery.class.js \
+ vendor/jquery.selector/jquery.selector.js \
+ vendor/jquery.selector/jquery.selector.specifity.js \
+ vendor/jquery.selector/jquery.selector.matches.js \
+ src/jquery.focusinout.js \
+ src/jquery.concrete.js \
+ src/jquery.concrete.dommaybechanged.js \
+ src/jquery.concrete.events.js \
+ src/jquery.concrete.ctors.js \
+ src/jquery.concrete.properties.js
+do \
+ echo >> $FILE
+ echo "/* $x */" >> $FILE
+ echo >> $FILE
+ cat $x >> $FILE
+ echo ';' >> $FILE
+ echo >> $FILE
+done
+
+ln -s `basename "$FILE"` dist/jquery.concrete-latest.js
+
+# cp LICENSE /tmp/
+# cp $FILE /tmp/
+
+# git checkout dist
+# mv /tmp/$FILE .
+# mv /tmp/LICENSE .
+
+# git add $FILE
+# git add LICENSE
+# git commit -m "Update dist to master version $VER"
+
+# git checkout master
View
1,490 thirdparty/jquery-concrete/dist/jquery.concrete-0.9.js
@@ -0,0 +1,1490 @@
+/* jQuery.Concrete - Copyright 2009 Hamish Friedlander and SilverStripe. Version 0.9. */
+
+/* vendor/jquery.selector/jquery.class.js */
+
+/**
+ * Very basic Class utility. Based on base and jquery.class.
+ *
+ * Class definition: var Foo = Base.extend({ init: function(){ Constructor }; method_name: function(){ Method } });
+ *
+ * Inheritance: var Bar = Foo.extend({ method_name: function(){ this._super(); } });
+ *
+ * new-less Constructor: new Foo(arg) <-same as-> Foo(arg)
+ */
+
+var Base;
+
+(function(){
+
+ var marker = {}, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
+
+ // The base Class implementation (does nothing)
+ Base = function(){};
+
+ Base.addMethod = function(name, func) {
+ var _super = this._super;
+ if (_super && fnTest.test(func)) {
+ this.prototype[name] = function(){
+ var tmp = this._super;
+ this._super = _super[name];
+ try {
+ var ret = func.apply(this, arguments);
+ }
+ finally {
+ this._super = tmp;
+ }
+ return ret;
+ }
+ }
+ else this.prototype[name] = func;
+ }
+
+ Base.addMethods = function(props) {
+ for (var name in props) {
+ if (typeof props[name] == 'function') this.addMethod(name, props[name]);
+ else this.prototype[name] = props[name];
+ }
+ }
+
+ // Create a new Class that inherits from this class
+ Base.extend = function(props) {
+
+ // The dummy class constructor
+ var Kls = function() {
+ if (arguments[0] === marker) return;
+
+ if (this instanceof Kls) {
+ if (this.init) this.init.apply(this, arguments);
+ }
+ else {
+ var ret = new Kls(marker); if (ret.init) ret.init.apply(ret, arguments); return ret;
+ }
+ }
+
+ // Add the common class variables and methods
+ Kls.constructor = Kls;
+ Kls.extend = Base.extend;
+ Kls.addMethod = Base.addMethod;
+ Kls.addMethods = Base.addMethods;
+ Kls._super = this.prototype;
+
+ // Attach the parent object to the inheritance chain
+ Kls.prototype = new this(marker);
+
+ // Copy the properties over onto the new prototype
+ Kls.addMethods(props);
+
+ return Kls;
+ };
+})();;
+
+
+/* vendor/jquery.selector/jquery.selector.js */
+
+(function($){
+
+ var tokens = {
+ UNICODE: /\\[0-9a-f]{1,6}(?:\r\n|[ \n\r\t\f])?/,
+ ESCAPE: /(?:UNICODE)|\\[^\n\r\f0-9a-f]/,
+ NONASCII: /[^\x00-\x7F]/,
+ NMSTART: /[_a-z]|(?:NONASCII)|(?:ESCAPE)/,
+ NMCHAR: /[_a-z0-9-]|(?:NONASCII)|(?:ESCAPE)/,
+ IDENT: /-?(?:NMSTART)(?:NMCHAR)*/,
+
+ NL: /\n|\r\n|\r|\f/,
+
+ STRING: /(?:STRING1)|(?:STRING2)|(?:STRINGBARE)/,
+ STRING1: /"(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\"])*"/,
+ STRING2: /'(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\'])*'/,
+ STRINGBARE: /(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\]])*/,
+
+ FUNCTION: /(?:IDENT)\(\)/,
+
+ INTEGER: /[0-9]+/,
+
+ WITHN: /([-+])?(INTEGER)?(n)\s*(?:([-+])\s*(INTEGER))?/,
+ WITHOUTN: /([-+])?(INTEGER)/
+ }
+
+ var rx = {
+ not: /:not\(/,
+ not_end: /\)/,
+
+ tag: /((?:IDENT)|\*)/,
+ id: /#(IDENT)/,
+ cls: /\.(IDENT)/,
+ attr: /\[\s*(IDENT)\s*(?:([^=]?=)\s*(STRING)\s*)?\]/,
+ pseudo_el: /(?::(first-line|first-letter|before|after))|(?:::((?:FUNCTION)|(?:IDENT)))/,
+ pseudo_cls_nth: /:nth-child\(\s*(?:(?:WITHN)|(?:WITHOUTN)|(odd|even))\s*\)/,
+ pseudo_cls: /:(IDENT)/,
+
+ comb: /\s*(\+|~|>)\s*|\s+/,
+ comma: /\s*,\s*/,
+ important: /\s+!important\s*$/
+ }
+
+ /* Replace placeholders with actual regex, and mark all as case insensitive */
+ var token = /[A-Z][A-Z0-9]+/;
+ for (var k in rx) {
+ var src = rx[k].source;
+ while (m = src.match(token)) src = src.replace(m[0], tokens[m[0]].source);
+ rx[k] = new RegExp(src, 'gi');
+ }
+
+ /**
+ * A string that matches itself against regexii, and keeps track of how much of itself has been matched
+ */
+ var ConsumableString = Base.extend({
+ init: function(str) {
+ this.str = str;
+ this.pos = 0;
+ },
+ match: function(rx) {
+ var m;
+ rx.lastIndex = this.pos;
+ if ((m = rx.exec(this.str)) && m.index == this.pos ) {
+ this.pos = rx.lastIndex ? rx.lastIndex : this.str.length ;
+ return m;
+ }
+ return null;
+ },
+ peek: function(rx) {
+ var m;
+ rx.lastIndex = this.pos;
+ if ((m = rx.exec(this.str)) && m.index == this.pos ) return m;
+ return null;
+ },
+ showpos: function() {
+ return this.str.slice(0,this.pos)+'<HERE>' + this.str.slice(this.pos);
+ },
+ done: function() {
+ return this.pos == this.str.length;
+ }
+ })
+
+ /* A base class that all Selectors inherit off */
+ var SelectorBase = Base.extend({});
+
+ /**
+ * A class representing a Simple Selector, as per the CSS3 selector spec
+ */
+ var SimpleSelector = SelectorBase.extend({
+ init: function() {
+ this.tag = null;
+ this.id = null;
+ this.classes = [];
+ this.attrs = [];
+ this.nots = [];
+ this.pseudo_classes = [];
+ this.pseudo_els = [];
+ },
+ parse: function(selector) {
+ var m;
+
+ /* Pull out the initial tag first, if there is one */
+ if (m = selector.match(rx.tag)) this.tag = m[1];
+
+ /* Then for each selection type, try and find a match */
+ do {
+ if (m = selector.match(rx.not)) {
+ this.nots[this.nots.length] = SelectorsGroup().parse(selector)
+ if (!(m = selector.match(rx.not_end))) {
+ throw 'Invalid :not term in selector';
+ }
+ }
+ else if (m = selector.match(rx.id)) this.id = m[1];
+ else if (m = selector.match(rx.cls)) this.classes[this.classes.length] = m[1];
+ else if (m = selector.match(rx.attr)) this.attrs[this.attrs.length] = [ m[1], m[2], m[3] ];
+ else if (m = selector.match(rx.pseudo_el)) this.pseudo_els[this.pseudo_els.length] = m[1] || m[2];
+ else if (m = selector.match(rx.pseudo_cls_nth)) {
+ if (m[3]) {
+ var a = parseInt((m[1]||'')+(m[2]||'1'));
+ var b = parseInt((m[4]||'')+(m[5]||'0'));
+ }
+ else {
+ var a = m[8] ? 2 : 0;
+ var b = m[8] ? (4-m[8].length) : parseInt((m[6]||'')+m[7]);
+ }
+ this.pseudo_classes[this.pseudo_classes.length] = ['nth-child', [a, b]];
+ }
+ else if (m = selector.match(rx.pseudo_cls)) this.pseudo_classes[this.pseudo_classes.length] = [m[1]];
+
+ } while(m && !selector.done());
+
+ return this;
+ }
+ })
+
+ /**
+ * A class representing a Selector, as per the CSS3 selector spec
+ */
+ var Selector = SelectorBase.extend({
+ init: function(){
+ this.parts = [];
+ },
+ parse: function(cons){
+ this.parts[this.parts.length] = SimpleSelector().parse(cons);
+
+ while (!cons.done() && !cons.peek(rx.comma) && (m = cons.match(rx.comb))) {
+ this.parts[this.parts.length] = m[1] || ' ';
+ this.parts[this.parts.length] = SimpleSelector().parse(cons);
+ }
+
+ return this.parts.length == 1 ? this.parts[0] : this;
+ }
+ });
+
+ /**
+ * A class representing a sequence of selectors, as per the CSS3 selector spec
+ */
+ var SelectorsGroup = SelectorBase.extend({
+ init: function(){
+ this.parts = [];
+ },
+ parse: function(cons){
+ this.parts[this.parts.length] = Selector().parse(cons);
+
+ while (!cons.done() && (m = cons.match(rx.comma))) {
+ this.parts[this.parts.length] = Selector().parse(cons);
+ }
+
+ return this.parts.length == 1 ? this.parts[0] : this;
+ }
+ });
+
+
+ $.selector = function(s){
+ var cons = ConsumableString(s);
+ var res = SelectorsGroup().parse(cons);
+
+ res.selector = s;
+
+ if (!cons.done()) throw 'Could not parse selector - ' + cons.showpos() ;
+ else return res;
+ }
+
+ $.selector.SelectorBase = SelectorBase;
+ $.selector.SimpleSelector = SimpleSelector;
+ $.selector.Selector = Selector;
+ $.selector.SelectorsGroup = SelectorsGroup;
+
+})(jQuery)
+;
+
+
+/* vendor/jquery.selector/jquery.selector.specifity.js */
+
+(function($) {
+
+ $.selector.SimpleSelector.addMethod('specifity', function() {
+ if (this.spec) return this.spec;
+
+ var spec = [
+ this.id ? 1 : 0,
+ this.classes.length + this.attrs.length + this.pseudo_classes.length,
+ ((this.tag && this.tag != '*') ? 1 : 0) + this.pseudo_els.length
+ ];
+ $.each(this.nots, function(i,not){
+ var ns = not.specifity(); spec[0] += ns[0]; spec[1] += ns[1]; spec[2] += ns[2];
+ });
+
+ return this.spec = spec;
+ })
+
+ $.selector.Selector.addMethod('specifity', function(){
+ if (this.spec) return this.spec;
+
+ var spec = [0,0,0];
+ $.each(this.parts, function(i,part){
+ if (i%2) return;
+ var ps = part.specifity(); spec[0] += ps[0]; spec[1] += ps[1]; spec[2] += ps[2];
+ });
+
+ return this.spec = spec;
+ })
+
+ $.selector.SelectorsGroup.addMethod('specifity', function(){
+ if (this.spec) return this.spec;
+
+ var spec = [0,0,0];
+ $.each(this.parts, function(i,part){
+ var ps = part.specifity(); spec[0] += ps[0]; spec[1] += ps[1]; spec[2] += ps[2];
+ });
+
+ return this.spec = spec;
+ })
+
+
+})(jQuery);
+;
+
+
+/* vendor/jquery.selector/jquery.selector.matches.js */
+
+/*
+This attempts to do the opposite of Sizzle.
+Sizzle is good for finding elements for a selector, but not so good for telling if an individual element matches a selector
+*/
+
+(function($) {
+
+ /**** CAPABILITY TESTS ****/
+ var div = document.createElement('div');
+ div.innerHTML = '<form id="test"><input name="id" type="text"/></form>';
+
+ // In IE 6-7, getAttribute often does the wrong thing (returns similar to el.attr), so we need to use getAttributeNode on that browser
+ var getAttributeDodgy = div.firstChild.getAttribute('id') !== 'test';
+
+ // Does browser support Element.firstElementChild, Element.previousElementSibling, etc.
+ var hasElementTraversal = div.firstElementChild && div.firstElementChild.tagName == 'FORM';
+
+ // Does browser support Element.children
+ var hasChildren = div.children && div.children[0].tagName == 'FORM';
+
+ var FUNC_IN = /^\s*function\s*\([^)]*\)\s*{/;
+ var FUNC_OUT = /}\s*$/;
+
+ var funcToString = function(f) {
+ return (''+f).replace(FUNC_IN,'').replace(FUNC_OUT,'');
+ }
+
+ // Can we use Function#toString ?
+ try {
+ var testFunc = function(){ return 'good' };
+ if ((new Function('',funcToString(testFunc)))() != 'good') funcToString = false;
+ }
+ catch(e) { funcToString = false; console.log(e.message);/*pass*/ }
+
+ /**** INTRO ****/
+
+ var GOOD = /GOOD/g;
+ var BAD = /BAD/g;
+
+ var STARTS_WITH_QUOTES = /^['"]/g;
+
+ var join = function(js) {
+ return js.join('\n');
+ }
+
+ var join_complex = function(js) {
+ code = new String(js.join('\n')); // String objects can have properties set. strings can't
+ code.complex = true;
+ return code;
+ }
+
+ /**** ATTRIBUTE ACCESSORS ****/
+
+ var getAttr;
+
+ // Good browsers
+ if (!getAttributeDodgy) {
+ getAttr = function(attr){ return 'var _'+attr+' = el.getAttribute("'+attr+'");' ; }
+ }
+ // IE 6, 7
+ else {
+ // On IE 6 + 7, getAttribute still has to be called with DOM property mirror name, not attribute name. Map attributes to those names
+ var getAttrIEMap = { 'class': 'className', 'for': 'htmlFor' };
+
+ getAttr = function(attr) {
+ var ieattr = getAttrIEMap[attr] || attr;
+ return 'var _'+attr+' = el.getAttribute("'+ieattr+'",2) || (el.getAttributeNode("'+attr+'")||{}).nodeValue;';
+ }
+ }
+
+ /**** ATTRIBUTE COMPARITORS ****/
+
+ var attrchecks = {
+ '-': '!_K',
+ '=': '_K != "V"',
+ '!=': '_K == "V"',
+ '~=': '__K.indexOf(" V ") == -1',
+ '^=': '!_K || _K.indexOf("V") != 0',
+ '*=': '!_K || _K.indexOf("V") == -1',
+ '$=': '!_K || _K.substr(_K.length-"V".length) != "V"'
+ }
+
+ /**** STATE TRACKER ****/
+
+ var State = $.selector.State = Base.extend({
+ init: function(){
+ this.reset();
+ },
+ reset: function() {
+ this.attrs = {}; this.wsattrs = {};
+ },
+
+ prev: function(){
+ this.reset();
+ if (hasElementTraversal) return 'el = el.previousElementSibling';
+ return 'while((el = el.previousSibling) && el.nodeType != 1) {}';
+ },
+ next: function() {
+ this.reset();
+ if (hasElementTraversal) return 'el = el.nextElementSibling';
+ return 'while((el = el.nextSibling) && el.nodeType != 1) {}';
+ },
+ prevLoop: function(body){
+ this.reset();
+ if (hasElementTraversal) return join([ 'while(el = el.previousElementSibling){', body]);
+ return join([
+ 'while(el = el.previousSibling){',
+ 'if (el.nodeType != 1) continue;',
+ body,
+ ]);
+ },
+ parent: function() {
+ this.reset();
+ return 'el = el.parentNode;';
+ },
+ parentLoop: function(body) {
+ this.reset();
+ return join([
+ 'while((el = el.parentNode) && el.nodeType == 1){',
+ body,
+ '}'
+ ]);
+ },
+
+ uses_attr: function(attr) {
+ if (this.attrs[attr]) return;
+ this.attrs[attr] = true;
+ return getAttr(attr);
+ },
+ uses_wsattr: function(attr) {
+ if (this.wsattrs[attr]) return;
+ this.wsattrs[attr] = true;
+ return join([this.uses_attr(attr), 'var __'+attr+' = " "+_'+attr+'+" ";']);
+ },
+
+ save: function(lbl) {
+ return 'var el'+lbl+' = el;';
+ },
+ restore: function(lbl) {
+ this.reset();
+ return 'el = el'+lbl+';';
+ }
+ });
+
+ /**** PSEUDO-CLASS DETAILS ****/
+
+ var pseudoclschecks = {
+ 'first-child': join([
+ 'var cel = el;',
+ 'while(cel = cel.previousSibling){ if (cel.nodeType === 1) BAD; }',
+ ]),
+ 'last-child': join([
+ 'var cel = el;',
+ 'while(cel = cel.nextSibling){ if (cel.nodeType === 1) BAD; }'
+ ]),
+ 'nth-child': function(a,b) {
+ var get_i = join([
+ 'var i = 1, cel = el;',
+ 'while(cel = cel.previousSibling){',
+ 'if (cel.nodeType === 1) i++;',
+ '}',
+ ]);
+
+ if (a == 0) return join([
+ get_i,
+ 'if (i- '+b+' != 0) BAD;'
+ ]);
+ else if (b == 0 && a >= 0) return join([
+ get_i,
+ 'if (i%'+a+' != 0 || i/'+a+' < 0) BAD;'
+ ]);
+ else if (b == 0 && a < 0) return join([
+ 'BAD;'
+ ]);
+ else return join([
+ get_i,
+ 'if ((i- '+b+')%'+a+' != 0 || (i- '+b+')/'+a+' < 0) BAD;'
+ ]);
+ }
+ };
+
+ // Needs to refence contents of object, so must be injected after definition
+ pseudoclschecks['only-child'] = join([
+ pseudoclschecks['first-child'],
+ pseudoclschecks['last-child']
+ ]);
+
+ /**** SimpleSelector ****/
+
+ $.selector.SimpleSelector.addMethod('compile', function(el) {
+ var js = [];
+
+ /* Check against element name */
+ if (this.tag && this.tag != '*') {
+ js[js.length] = 'if (el.tagName != "'+this.tag.toUpperCase()+'") BAD;';
+ }
+
+ /* Check against ID */
+ if (this.id) {
+ js[js.length] = el.uses_attr('id');
+ js[js.length] = 'if (_id !== "'+this.id+'") BAD;';
+ }
+
+ /* Build className checking variable */
+ if (this.classes.length) {
+ js[js.length] = el.uses_wsattr('class');
+
+ /* Check against class names */
+ $.each(this.classes, function(i, cls){
+ js[js.length] = 'if (__class.indexOf(" '+cls+' ") == -1) BAD;';
+ })
+ }
+
+ /* Check against attributes */
+ $.each(this.attrs, function(i, attr){
+ js[js.length] = (attr[1] == '~=') ? el.uses_wsattr(attr[0]) : el.uses_attr(attr[0]);
+ var check = attrchecks[ attr[1] || '-' ];
+ check = check.replace( /K/g, attr[0]).replace( /V/g, attr[2] && attr[2].match(STARTS_WITH_QUOTES) ? attr[2].slice(1,-1) : attr[2] );
+ js[js.length] = 'if ('+check+') BAD;';
+ });
+
+ /* Check against nots */
+ $.each(this.nots, function(i, not){
+ var lbl = ++lbl_id;
+ var func = join([
+ 'l'+lbl+':{',
+ not.compile(el).replace(BAD, 'break l'+lbl).replace(GOOD, 'BAD'),
+ '}'
+ ]);
+
+ if (!(not instanceof $.selector.SimpleSelector)) func = join([
+ el.save(lbl),
+ func,
+ el.restore(lbl)
+ ])
+
+ js[js.length] = func;
+ });
+
+ /* Check against pseudo-classes */
+ $.each(this.pseudo_classes, function(i, pscls){
+ var check = pseudoclschecks[pscls[0]];
+ if (check) {
+ js[js.length] = ( typeof check == 'function' ? check.apply(this, pscls[1]) : check );
+ }
+ else if (check = $.find.selectors.filters[pscls[0]]) {
+ if (funcToString) {
+ js[js.length] = funcToString(check).replace(/elem/g,'el').replace(/return([^;]+);/,'if (!($1)) BAD;');
+ }
+ else {
+ js[js.length] = 'if (!$.find.selectors.filters.'+pscls[0]+'(el)) BAD;'
+ }
+ }
+ });
+
+ js[js.length] = 'GOOD';
+
+ /* Pass */
+ return join(js);
+ });
+
+ var lbl_id = 0;
+ /** Turns an compiled fragment into the first part of a combination */
+ function as_subexpr(f) {
+ if (f.complex)
+ return join([
+ 'l'+(++lbl_id)+':{',
+ f.replace(GOOD, 'break l'+lbl_id),
+ '}',
+ ]);
+ else
+ return f.replace(GOOD, '');
+ }
+
+ var combines = {
+ ' ': function(el, f1, f2) {
+ return join_complex([
+ f2,
+ 'while(true){',
+ el.parent(),
+ 'if (!el || el.nodeType !== 1) BAD;',
+ f1.compile(el).replace(BAD, 'continue'),
+ '}'
+ ]);
+ },
+
+ '>': function(el, f1, f2) {
+ return join([
+ f2,
+ el.parent(),
+ 'if (!el || el.nodeType !== 1) BAD;',
+ f1.compile(el)
+ ]);
+ },
+
+ '~': function(el, f1, f2) {
+ return join_complex([
+ f2,
+ el.prevLoop(),
+ f1.compile(el).replace(BAD, 'continue'),
+ '}',
+ 'BAD;'
+ ]);
+ },
+
+ '+': function(el, f1, f2) {
+ return join([
+ f2,
+ el.prev(),
+ 'if (!el) BAD;',
+ f1.compile(el)
+ ]);
+ }
+ };
+
+ $.selector.Selector.addMethod('compile', function(el) {
+ l = this.parts.length;
+
+ expr = this.parts[--l].compile(el);
+ while (l) {
+ combinator = this.parts[--l];
+ expr = combines[combinator](el, this.parts[--l], as_subexpr(expr));
+ }
+
+ return expr;
+ });
+
+ $.selector.SelectorsGroup.addMethod('compile', function(el) {
+ var expr = [], lbl = ++lbl_id;
+
+ for (var i=0; i < this.parts.length; i++) {
+ expr[expr.length] = join([
+ i == 0 ? el.save(lbl) : el.restore(lbl),
+ 'l'+lbl+'_'+i+':{',
+ this.parts[i].compile(el).replace(BAD, 'break l'+lbl+'_'+i),
+ '}'
+ ]);
+ }
+
+ expr[expr.length] = 'BAD;';
+ return join(expr);
+ });
+
+ $.selector.SelectorBase.addMethod('matches', function(el){
+ this.matches = new Function('el', join([
+ 'if (!el) return false;',
+ this.compile(new State()).replace(BAD, 'return false').replace(GOOD, 'return true')
+ ]));
+ return this.matches(el);
+ });
+
+})(jQuery);
+
+;
+
+
+/* src/jquery.focusinout.js */
+
+(function($){
+
+ /**
+ * Add focusin and focusout support to bind and live for browers other than IE. Designed to be usable in a delegated fashion (like $.live)
+ * Copyright (c) 2007 Jörn Zaefferer
+ */
+ $.support.focusInOut = !!($.browser.msie);
+ if (!$.support.focusInOut) {
+ // Emulate focusin and focusout by binding focus and blur in capturing mode
+ $.each({focus: 'focusin', blur: 'focusout'}, function(original, fix){
+ $.event.special[fix] = {
+ setup: function(){
+ if (!this.addEventListener) return false;
+ this.addEventListener(original, $.event.special[fix].handler, true);
+ },
+ teardown: function(){
+ if (!this.removeEventListener) return false;
+ this.removeEventListener(original, $.event.special[fix].handler, true);
+ },
+ handler: function(e){
+ arguments[0] = $.event.fix(e);
+ arguments[0].type = fix;
+ return $.event.handle.apply(this, arguments);
+ }
+ };
+ });
+ }
+
+ (function(){
+ //IE has some trouble with focusout with select and keyboard navigation
+ var activeFocus = null;
+
+ $(document)
+ .bind('focusin', function(e){
+ var target = e.realTarget || e.target;
+ if (activeFocus && activeFocus !== target) {
+ e.type = 'focusout';
+ $(activeFocus).trigger(e);
+ e.type = 'focusin';
+ e.target = target;
+ }
+ activeFocus = target;
+ })
+ .bind('focusout', function(e){
+ activeFocus = null;
+ });
+ })();
+
+})(jQuery);;
+
+
+/* src/jquery.concrete.js */
+
+var console;
+
+(function($) {
+
+ var namespaces = {};
+
+ $.concrete = function() {
+ $.fn.concrete.apply(null, arguments);
+ }
+
+ /**
+ * A couple of utility functions for accessing the store outside of this closure, and for making things
+ * operate in a little more easy-to-test manner
+ */
+ $.extend($.concrete, {
+ /**
+ * Get all the namespaces. Useful for introspection? Internal interface of Namespace not guaranteed consistant
+ */
+ namespaces: namespaces,
+
+ /**
+ * Remove all concrete rules
+ */
+ clear_all_rules: function() {
+ // Remove proxy functions
+ for (var k in $.fn) { if ($.fn[k].concrete) delete $.fn[k] ; }
+ // Remove namespaces, and start over again
+ namespaces = $.concrete.namespaces = {};
+ },
+
+ WARN_LEVEL_NONE: 0,
+ WARN_LEVEL_IMPORTANT: 1,
+ WARN_LEVEL_BESTPRACTISE: 2,
+
+ /**
+ * Warning level. Set to a higher level to get warnings dumped to console.
+ */
+ warningLevel: 0,
+
+ /** Utility to optionally display warning messages depending on level */
+ warn: function(message, level) {
+ if (level <= $.concrete.warningLevel && console && console.log) {
+ console.warn(message);
+ if (console.trace) console.trace();
+ }
+ }
+ });
+
+
+ /** Stores a count of definitions, so that we can sort identical selectors by definition order */
+ var rulecount = 0;
+
+ var Rule = Base.extend({
+ init: function(selector, name) {
+ this.selector = selector;
+ this.specifity = selector.specifity();
+ this.important = 0;
+ this.name = name;
+ this.rulecount = rulecount++;
+ }
+ });
+
+ Rule.compare = function(a, b) {
+ var as = a.specifity, bs = b.specifity;
+
+ return (a.important - b.important) ||
+ (as[0] - bs[0]) ||
+ (as[1] - bs[1]) ||
+ (as[2] - bs[2]) ||
+ (a.rulecount - b.rulecount) ;
+ }
+
+ $.concrete.RuleList = function() {
+ var list = [];
+
+ list.addRule = function(selector, name){
+ var rule = Rule(selector, name);
+
+ list[list.length] = rule;
+ list.sort(Rule.compare);
+
+ return rule;
+ };
+
+ return list;
+ }
+
+ var handlers = [];
+
+ /**
+ * A Namespace holds all the information needed for adding concrete methods to a namespace (including the _null_ namespace)
+ */
+ $.concrete.Namespace = Base.extend({
+ init: function(name){
+ if (name && !name.match(/^[A-Za-z0-9.]+$/)) $.concrete.warn('Concrete namespace '+name+' is not formatted as period seperated identifiers', $.concrete.WARN_LEVEL_BESTPRACTISE);
+ name = name || '__base';
+
+ this.name = name;
+ this.store = {};
+
+ namespaces[name] = this;
+
+ if (name == "__base") {
+ this.injectee = $.fn
+ this.$ = $;
+ }
+ else {
+ // We're in a namespace, so we build a Class that subclasses the jQuery Object Class to inject namespace functions into
+ var subfn = function(){}
+ this.injectee = subfn.prototype = new $();
+
+ // And then we provide an overriding $ that returns objects of our new Class, and an overriding pushStack to catch further selection building
+ var bound$ = this.$ = function(a) {
+ // Try the simple way first
+ var jq = $.fn.init.apply(new subfn(), arguments);
+ if (jq instanceof subfn) return jq;
+
+ // That didn't return a bound object, so now we need to copy it
+ var rv = new subfn();
+ rv.selector = jq.selector; rv.context = jq.context; var i = rv.length = jq.length;
+ while (i--) rv[i] = jq[i];
+ return rv;
+ }
+ this.injectee.pushStack = function(elems, name, selector){
+ var ret = bound$(elems);
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ if ( name === "find" ) ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ else if ( name ) ret.selector = this.selector + "." + name + "(" + selector + ")";
+
+ // Return the newly-formed element set
+ return ret;
+ }
+
+ // Copy static functions through from $ to this.$ so e.g. $.ajax still works
+ // @bug, @cantfix: Any class functions added to $ after this call won't get mirrored through
+ $.extend(this.$, $);
+
+ // We override concrete to inject the name of this namespace when defining blocks inside this namespace
+ var concrete_wrapper = this.injectee.concrete = function(spacename) {
+ var args = arguments;
+
+ if (!spacename || typeof spacename != 'string') { args = $.makeArray(args); args.unshift(name); }
+ else if (spacename.charAt(0) != '.') args[0] = name+'.'+spacename;
+
+ return $.fn.concrete.apply(this, args);
+ }
+
+ this.$.concrete = function() {
+ concrete_wrapper.apply(null, arguments);
+ }
+
+ for (var i = 0; i < handlers.length; i++) {
+ var handler = handlers[i], builder;
+
+ // Inject jQuery object method overrides
+ if (builder = handler.namespaceMethodOverrides) {
+ var overrides = builder(this);
+ for (var k in overrides) this.injectee[k] = overrides[k];
+ }
+
+ // Inject $.concrete function overrides
+ if (builder = handler.namespaceStaticOverrides) {
+ var overrides = builder(this);
+ for (var k in overrides) this.$.concrete[k] = overrides[k];
+ }
+ }
+ }
+ },
+
+ /**
+ * Returns a function that does selector matching against the function list for a function name
+ * Used by proxy for all calls, and by ctorProxy to handle _super calls
+ * @param {String} name - name of the function as passed in the construction object
+ * @param {String} funcprop - the property on the Rule object that gives the actual function to call
+ */
+ one: function(name, funcprop) {
+ var namespace = this;
+ var funcs = this.store[name];
+
+ var one = function(el, args, i){
+ if (i === undefined) i = funcs.length;
+ while (i--) {
+ if (funcs[i].selector.matches(el)) {
+ var ret, tmp_i = el.i, tmp_f = el.f;
+ el.i = i; el.f = one;
+ try { ret = funcs[i][funcprop].apply(namespace.$(el), args); }
+ finally { el.i = tmp_i; el.f = tmp_f; }
+ return ret;
+ }
+ }
+ }
+
+ return one;
+ },
+
+ /**
+ * A proxy is a function attached to a callable object (either the base jQuery.fn or a subspace object) which handles
+ * finding and calling the correct function for each member of the current jQuery context
+ * @param {String} name - name of the function as passed in the construction object
+ */
+ build_proxy: function(name) {
+ var one = this.one(name, 'func');
+
+ var prxy = function() {
+ var rv, ctx = $(this);
+
+ var i = ctx.length;
+ while (i--) rv = one(ctx[i], arguments);
+ return rv;
+ };
+
+ return prxy;
+ },
+
+ bind_proxy: function(selector, name, func) {
+ var rulelist = this.store[name] || (this.store[name] = $.concrete.RuleList());
+
+ var rule = rulelist.addRule(selector, name); rule.func = func;
+
+ if (!this.injectee.hasOwnProperty(name)) {
+ this.injectee[name] = this.build_proxy(name);
+ this.injectee[name].concrete = true;
+ }
+
+ if (!this.injectee[name].concrete) {
+ $.concrete.warn('Warning: Concrete function '+name+' clashes with regular jQuery function - concrete function will not be callable directly on jQuery object', $.concrete.WARN_LEVEL_IMPORTANT);
+ }
+ },
+
+ add: function(selector, data) {
+ // For every item in the hash, try ever method handler, until one returns true
+ for (var k in data) {
+ var v = data[k];
+
+ for (var i = 0; i < handlers.length; i++) {
+ if (handlers[i].bind && handlers[i].bind.call(this, selector, k, v)) break;
+ }
+ }
+ },
+
+ has: function(ctx, name) {
+ var rulelist = this.store[name];
+ if (!rulelist) return false;
+
+ /* We go forward this time, since low specifity is likely to knock out a bunch of elements quickly */
+ for (var i = 0 ; i < rulelist.length; i++) {
+ ctx = ctx.not(rulelist[i].selector);
+ if (!ctx.length) return true;
+ }
+ return false;
+ }
+ });
+
+ /**
+ * A handler is some javascript code that adds support for some time of key / value pair passed in the hash to the Namespace add method.
+ * The default handlers provided (and included by default) are event, ctor and properties
+ */
+ $.concrete.Namespace.addHandler = function(handler) {
+ for (var i = 0; i < handlers.length && handlers[i].order < handler.order; i++) { /* Pass */ }
+ handlers.splice(i, 0, handler);
+ }
+
+ $.concrete.Namespace.addHandler({
+ order: 50,
+
+ bind: function(selector, k, v){
+ if ($.isFunction(v)) {
+ this.bind_proxy(selector, k, v);
+ return true;
+ }
+ }
+ });
+
+ $.extend($.fn, {
+ /**
+ * Main concrete function. Used for new definitions, calling into a namespace (or forcing the base namespace) and entering a using block
+ *
+ */
+ concrete: function(spacename) {
+ var i = 0;
+ var selector = this.selector ? $.selector(this.selector) : null;
+
+ /* By default we operator on the base namespace */
+ var namespace = namespaces.__base || $.concrete.Namespace();
+
+ /* If the first argument is a string, then it's the name of a namespace. Look it up */
+ if (typeof spacename == 'string') {
+ if (spacename.charAt('0') == '.') spacename = spacename.substr(1);
+ if (spacename) namespace = namespaces[spacename] || $.concrete.Namespace(spacename);
+ i=1;
+ }
+
+ /* All remaining arguments should either be using blocks or definition hashs */
+ while (i < arguments.length) {
+ var res = arguments[i++];
+
+ // If it's a function, call it - either it's a using block or it's a namespaced concrete definition
+ if ($.isFunction(res)) {
+ if (res.length != 1) $.concrete.warn('Function block inside concrete definition does not take $ argument properly', $.concrete.WARN_LEVEL_IMPORTANT);
+ res = res.call(namespace.$(this), namespace.$);
+ }
+
+ // If we have a concrete definition hash, inject it into namespace
+ if (res) {
+ if (selector) namespace.add(selector, res);
+ else $.concrete.warn('Concrete block given to concrete call without selector. Make sure you call $(selector).concrete when defining blocks', $.concrete.WARN_LEVEL_IMPORTANT);
+ }
+
+
+ }
+
+ /* Finally, return the jQuery object 'this' refers to, wrapped in the new namespace */
+ return namespace.$(this);
+ },
+
+ /**
+ * Calls the next most specific version of the current concrete method
+ */
+ _super: function(){
+ var rv, i = this.length;
+ while (i--) {
+ var el = this[0];
+ rv = el.f(el, arguments, el.i);
+ }
+ return rv;
+ }
+ });
+
+})(jQuery);
+;
+
+
+/* src/jquery.concrete.dommaybechanged.js */
+
+(function($){
+
+ /** What to call to run a function 'soon'. Normally setTimeout, but for syncronous mode we override so soon === now */
+ var runSoon = window.setTimeout;
+
+ /** The timer handle for the asyncronous matching call */
+ var check_id = null;
+
+ /** Fire the change event. Only fires on the document node, so bind to that */
+ var triggerEvent = function() {
+ $(document).triggerHandler('DOMMaybeChanged');
+ check_id = null;
+ }
+
+ $.extend($.concrete, {
+ /**
+ * Make onmatch and onunmatch work in synchronous mode - that is, new elements will be detected immediately after
+ * the DOM manipulation that made them match. This is only really useful for during testing, since it's pretty slow
+ * (otherwise we'd make it the default).
+ */
+ synchronous_mode: function() {
+ if (check_id) clearTimeout(check_id); check_id = null;
+ runSoon = function(func, delay){ func.call(this); return null; }
+ },
+
+ /**
+ * Trigger onmatch and onunmatch now - usefull for after DOM manipulation by methods other than through jQuery.
+ * Called automatically on document.ready
+ */
+ triggerMatching: function() {
+ matching();
+ }
+ });
+
+ function registerMutateFunction() {
+ $.each(arguments, function(i,func){
+ var old = $.fn[func];
+ $.fn[func] = function() {
+ var rv = old.apply(this, arguments);
+ if (!check_id) check_id = runSoon(triggerEvent, 100);
+ return rv;
+ }
+ })
+ }
+
+ function registerSetterGetterFunction() {
+ $.each(arguments, function(i,func){
+ var old = $.fn[func];
+ $.fn[func] = function(a, b) {
+ var rv = old.apply(this, arguments);
+ if (!check_id && (b !== undefined || typeof a != 'string')) check_id = runSoon(triggerEvent, 100);
+ return rv;
+ }
+ })
+ }
+
+ // Register core DOM manipulation methods
+ registerMutateFunction('append', 'prepend', 'after', 'before', 'wrap', 'removeAttr', 'addClass', 'removeClass', 'toggleClass', 'empty', 'remove');
+ registerSetterGetterFunction('attr');
+
+ // And on DOM ready, trigger matching once
+ $(function(){ triggerEvent(); })
+
+})(jQuery);;
+
+
+/* src/jquery.concrete.events.js */
+
+(function($) {
+
+ /* If we are any browser other than IE or Safari, we don't have to do anything special to handle
+ * onchange delegation */
+ $.support.bubblingChange = !($.browser.msie || $.browser.safari);
+
+ /* Return true if node b is the same as, or is a descendant of, node a */
+ if (document.compareDocumentPosition) {
+ var is_or_contains = function(a, b) {
+ return a && b && (a == b || !!(a.compareDocumentPosition(b) & 16));
+ }
+ }
+ else {
+ var is_or_contains = function(a, b) {
+ return a && b && (a == b || (a.contains ? a.contains(b) : true));
+ }
+ }
+
+ /* Add the methods to handle event binding to the Namespace class */
+ $.concrete.Namespace.addMethods({
+ build_event_proxy: function(name) {
+ var one = this.one(name, 'func');
+
+ var prxy = function(e, originalevent) {
+ e = originalevent || e;
+
+ var el = e.target;
+ while (el && el != document && !e.isPropagationStopped()) {
+ one(el, arguments);
+ el = el.parentNode;
+ }
+ };
+
+ return prxy;
+ },
+
+ build_mouseenterleave_proxy: function(name) {
+ var one = this.one(name, 'func');
+
+ var prxy = function(e) {
+ var el = e.target;
+ var rel = e.relatedTarget;
+
+ while (el && el != document && !e.isPropagationStopped()) {
+ /* We know el contained target. If it also contains relatedTarget then we didn't mouseenter / leave. What's more, every ancestor will also
+ contan el and rel, and so we can just stop bubbling */
+ if (is_or_contains(el, rel)) break;
+
+ one(el, arguments);
+ el = el.parentNode;
+ }
+ };
+
+ return prxy;
+ },
+
+ build_change_proxy: function(name) {
+ var one = this.one(name, 'func');
+
+ var prxy = function(e) {
+ var el = e.target;
+ // If this is a keydown event, only worry about the enter key, since browsers only trigger onchange on enter or focus loss
+ if (e.type === 'keydown' && e.keyCode !== 13) return;
+ // Make sure this is event is for an input type we're interested in
+ if (el.tagName !== 'INPUT' && el.tagName !== 'TEXTAREA' && el.tagName !== 'SELECT') return;
+
+ var $el = $(el), nowVal, oldVal = $el.data('changeVal');
+
+ // Detect changes on checkboxes & radiobuttons, which have different value logic. We don't use el.value, since el is part
+ // of a set, and we only want to raise onchange once for a single user action.
+ if (el.type == 'checkbox' || el.type == 'radio') {
+ if (!el.disabled && e.type === 'click') {
+ nowVal = el.checked;
+ // If radio, we get two changes - the activation, and the deactivation. We only want to fire one change though
+ if ((el.type === 'checkbox' || nowVal === true) && oldVal !== nowVal) e.type = 'change';
+ }
+ }
+ // Detect changes on other input types. In this case value is OK.
+ else {
+ nowVal = el.value;
+ if (oldVal !== undefined && oldVal !== nowVal) e.type = 'change';
+ }
+
+ // Save the current value for next time
+ if (nowVal !== undefined) $el.data('changeVal', nowVal);
+
+ // And if we decided that a change happened, do the actual triggering
+ if (e.type == 'change') {
+ while (el && el != document && !e.isPropagationStopped()) {
+ one(el, arguments);
+ el = el.parentNode;
+ }
+ }
+ };
+
+ return prxy;
+ },
+
+ bind_event: function(selector, name, func, event) {
+ var funcs = this.store[name] || (this.store[name] = $.concrete.RuleList()) ;
+ var proxies = funcs.proxies || (funcs.proxies = {});
+
+ var rule = funcs.addRule(selector, name); rule.func = func;
+
+ if (!proxies[name]) {
+ switch (name) {
+ case 'onmouseenter':
+ proxies[name] = this.build_mouseenterleave_proxy(name);
+ event = 'mouseover';
+ break;
+ case 'onmouseleave':
+ proxies[name] = this.build_mouseenterleave_proxy(name);
+ event = 'mouseout';
+ break;
+ case 'onchange':
+ if (!$.support.bubblingChange) {
+ proxies[name] = this.build_change_proxy(name);
+ event = 'click focusin focusout keydown';
+ }
+ break;
+ case 'onsubmit':
+ event = 'delegated_submit';
+ case 'onfocus':
+ case 'onblur':
+ $.concrete.warn('Event '+event+' not supported - using focusin / focusout instead', $.concrete.WARN_LEVEL_IMPORTANT);
+ }
+
+ if (!proxies[name]) proxies[name] = this.build_event_proxy(name);
+ $(document).bind(event, proxies[name]);
+ }
+ }
+ });
+
+ $.concrete.Namespace.addHandler({
+ order: 40,
+
+ bind: function(selector, k, v){
+ if ($.isFunction(v) && (match = k.match(/^on(.*)/))) {
+ event = match[1];
+ this.bind_event(selector, k, v, event);
+ return true;
+ }
+ }
+ });
+
+ // Find all forms and bind onsubmit to trigger on the document too. This is the only event that can't be grabbed via delegation.
+
+ var form_binding_cache = $([]); // A cache for already-handled form elements
+ var delegate_submit = function(e){ $(document).triggerHandler('delegated_submit', e); } // The function that handles the delegation
+
+ $(document).bind('DOMMaybeChanged', function(){
+ var forms = $('form');
+ // Only bind to forms we haven't processed yet
+ forms.not(form_binding_cache).bind('submit', delegate_submit);
+ // Then remember the current set of forms
+ form_binding_cache = forms;
+ });
+
+})(jQuery);
+ ;
+
+
+/* src/jquery.concrete.ctors.js */
+
+(function($) {
+
+ /* Add the methods to handle constructor & destructor binding to the Namespace class */
+ $.concrete.Namespace.addMethods({
+ bind_condesc: function(selector, name, func) {
+ var ctors = this.store.ctors || (this.store.ctors = $.concrete.RuleList()) ;
+
+ var rule;
+ for (var i = 0 ; i < ctors.length; i++) {
+ if (ctors[i].selector.selector == selector.selector) {
+ rule = ctors[i]; break;
+ }
+ }
+ if (!rule) {
+ rule = ctors.addRule(selector, 'ctors');
+ }
+
+ rule[name] = func;
+
+ if (!ctors[name+'proxy']) {
+ var one = this.one('ctors', name);
+ var namespace = this;
+
+ var proxy = function(els, i, func) {
+ var j = els.length;
+ while (j--) {
+ var el = els[j];
+
+ var tmp_i = el.i, tmp_f = el.f;
+ el.i = i; el.f = one;
+ try { func.call(namespace.$(el)); }
+ catch(e) { el.i = tmp_i; el.f = tmp_f; }
+ }
+ }
+
+ ctors[name+'proxy'] = proxy;
+ }
+ }
+ });
+
+ $.concrete.Namespace.addHandler({
+ order: 30,
+
+ bind: function(selector, k, v) {
+ if ($.isFunction(v) && (k == 'onmatch' || k == 'onunmatch')) {
+ this.bind_condesc(selector, k, v);
+ return true;
+ }
+ }
+ });
+
+ /**
+ * Finds all the elements that now match a different rule (or have been removed) and call onmatch on onunmatch as appropriate
+ *
+ * Because this has to scan the DOM, and is therefore fairly slow, this is normally triggered off a short timeout, so that
+ * a series of DOM manipulations will only trigger this once.
+ *
+ * The downside of this is that things like:
+ * $('#foo').addClass('tabs'); $('#foo').tabFunctionBar();
+ * won't work.
+ */
+ $(document).bind('DOMMaybeChanged', function(){
+ // For every namespace
+ for (var k in $.concrete.namespaces) {
+ // That has constructors or destructors
+ var ctors = $.concrete.namespaces[k].store.ctors;
+ if (ctors) {
+
+ // Keep a record of elements that have matched already
+ var matched = $([]), match, add, rem;
+ // Stepping through each selector from most to least specific
+ var j = ctors.length;
+ while (j--) {
+ // Build some quick-acccess variables
+ var sel = ctors[j].selector.selector, ctor = ctors[j].onmatch; dtor = ctors[j].onunmatch;
+ // Get the list of elements that match this selector, that haven't yet matched a more specific selector
+ res = add = $(sel).not(matched);
+
+ // If this selector has a list of elements it matched against last time
+ if (ctors[j].cache) {
+ // Find the ones that are extra this time
+ add = res.not(ctors[j].cache);
+ // Find the ones that are gone this time
+ rem = ctors[j].cache.not(res);
+ // And call the desctructor on them
+ if (rem.length && dtor) ctors.onunmatchproxy(rem, j, dtor);
+ }
+
+ // Call the constructor on the newly matched ones
+ if (add.length && ctor) ctors.onmatchproxy(add, j, ctor);
+
+ // Add these matched ones to the list tracking all elements matched so far
+ matched = matched.add(res);
+ // And remember this list of matching elements again this selector, so next matching we can find the unmatched ones
+ ctors[j].cache = res;
+ }
+ }
+ }
+ })
+
+
+})(jQuery);
+;
+
+
+/* src/jquery.concrete.properties.js */
+
+(function($) {
+
+ var concrete_prepend = '__concrete!';
+
+ var getConcreteData = function(el, namespace, property) {
+ return el.data(concrete_prepend + namespace + '!' + property);
+ }
+
+ var setConcreteData = function(el, namespace, property, value) {
+ return el.data(concrete_prepend + namespace + '!' + property, value);
+ }
+
+ var getConcreteDataAsHash = function(el, namespace) {
+ var hash = {};
+ var id = jQuery.data(el[0]);
+
+ var matchstr = concrete_prepend + namespace + '!';
+ var matchlen = matchstr.length;
+
+ var cache = jQuery.cache[id];
+ for (var k in cache) {
+ if (k.substr(0,matchlen) == matchstr) hash[k.substr(matchlen)] = cache[k];
+ }
+
+ return hash;
+ }
+
+ var setConcreteDataFromHash = function(el, namespace, hash) {
+ for (var k in hash) setConcreteData(namespace, k, hash[k]);
+ }
+
+ var concreteData = function(el, namespace, args) {
+ switch (args.length) {
+ case 0:
+ return getConcreteDataAsHash(el, namespace);
+ case 1:
+ if (typeof args[0] == 'string') return getConcreteData(el, namespace, args[0]);
+ else return setConcreteDataFromHash(el, namespace, args[0]);
+ default:
+ return setConcreteData(el, namespace, args[0], args[1]);
+ }
+ }
+
+ $.extend($.fn, {
+ concreteData: function() {
+ return concreteData(this, '__base', arguments);
+ }
+ });
+
+ $.concrete.Namespace.addHandler({
+ order: 60,
+
+ bind: function(selector, k, v) {
+ if (k.charAt(0) != k.charAt(0).toUpperCase()) $.concrete.warn('Concrete property '+k+' does not start with a capital letter', $.concrete.WARN_LEVEL_BESTPRACTISE);
+
+ var namespace = this;
+ g = function() { return this.concreteData(k) || v ; }
+ s = function(v){ return this.concreteData(k, v); }
+
+ g.pname = s.pname = k;
+
+ this.bind_proxy(selector, 'get'+k, g);
+ this.bind_proxy(selector, 'set'+k, s);
+
+ return true;
+ },
+
+ namespaceMethodOverrides: function(namespace){
+ return {
+ concreteData: function() {
+ return concreteData(this, namespace.name, arguments);
+ }
+ };
+ }
+ });
+
+})(jQuery);
+;
+
View
1,490 thirdparty/jquery-concrete/dist/jquery.concrete-latest.js
@@ -0,0 +1,1490 @@
+/* jQuery.Concrete - Copyright 2009 Hamish Friedlander and SilverStripe. Version 0.9. */
+
+/* vendor/jquery.selector/jquery.class.js */
+
+/**
+ * Very basic Class utility. Based on base and jquery.class.
+ *
+ * Class definition: var Foo = Base.extend({ init: function(){ Constructor }; method_name: function(){ Method } });
+ *
+ * Inheritance: var Bar = Foo.extend({ method_name: function(){ this._super(); } });
+ *
+ * new-less Constructor: new Foo(arg) <-same as-> Foo(arg)
+ */
+
+var Base;
+
+(function(){
+
+ var marker = {}, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
+
+ // The base Class implementation (does nothing)
+ Base = function(){};
+
+ Base.addMethod = function(name, func) {
+ var _super = this._super;
+ if (_super && fnTest.test(func)) {
+ this.prototype[name] = function(){
+ var tmp = this._super;
+ this._super = _super[name];
+ try {
+ var ret = func.apply(this, arguments);
+ }
+ finally {
+ this._super = tmp;
+ }
+ return ret;
+ }
+ }
+ else this.prototype[name] = func;
+ }
+
+ Base.addMethods = function(props) {
+ for (var name in props) {
+ if (typeof props[name] == 'function') this.addMethod(name, props[name]);
+ else this.prototype[name] = props[name];
+ }
+ }
+
+ // Create a new Class that inherits from this class
+ Base.extend = function(props) {
+
+ // The dummy class constructor
+ var Kls = function() {
+ if (arguments[0] === marker) return;
+
+ if (this instanceof Kls) {
+ if (this.init) this.init.apply(this, arguments);
+ }
+ else {
+ var ret = new Kls(marker); if (ret.init) ret.init.apply(ret, arguments); return ret;
+ }
+ }
+
+ // Add the common class variables and methods
+ Kls.constructor = Kls;
+ Kls.extend = Base.extend;
+ Kls.addMethod = Base.addMethod;
+ Kls.addMethods = Base.addMethods;
+ Kls._super = this.prototype;
+
+ // Attach the parent object to the inheritance chain
+ Kls.prototype = new this(marker);
+
+ // Copy the properties over onto the new prototype
+ Kls.addMethods(props);
+
+ return Kls;
+ };
+})();;
+
+
+/* vendor/jquery.selector/jquery.selector.js */
+
+(function($){
+
+ var tokens = {
+ UNICODE: /\\[0-9a-f]{1,6}(?:\r\n|[ \n\r\t\f])?/,
+ ESCAPE: /(?:UNICODE)|\\[^\n\r\f0-9a-f]/,
+ NONASCII: /[^\x00-\x7F]/,
+ NMSTART: /[_a-z]|(?:NONASCII)|(?:ESCAPE)/,
+ NMCHAR: /[_a-z0-9-]|(?:NONASCII)|(?:ESCAPE)/,
+ IDENT: /-?(?:NMSTART)(?:NMCHAR)*/,
+
+ NL: /\n|\r\n|\r|\f/,
+
+ STRING: /(?:STRING1)|(?:STRING2)|(?:STRINGBARE)/,
+ STRING1: /"(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\"])*"/,
+ STRING2: /'(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\'])*'/,
+ STRINGBARE: /(?:(?:ESCAPE)|\\(?:NL)|[^\n\r\f\]])*/,
+
+ FUNCTION: /(?:IDENT)\(\)/,
+
+ INTEGER: /[0-9]+/,
+
+ WITHN: /([-+])?(INTEGER)?(n)\s*(?:([-+])\s*(INTEGER))?/,
+ WITHOUTN: /([-+])?(INTEGER)/
+ }
+
+ var rx = {
+ not: /:not\(/,
+ not_end: /\)/,
+
+ tag: /((?:IDENT)|\*)/,
+ id: /#(IDENT)/,
+ cls: /\.(IDENT)/,
+ attr: /\[\s*(IDENT)\s*(?:([^=]?=)\s*(STRING)\s*)?\]/,
+ pseudo_el: /(?::(first-line|first-letter|before|after))|(?:::((?:FUNCTION)|(?:IDENT)))/,
+ pseudo_cls_nth: /:nth-child\(\s*(?:(?:WITHN)|(?:WITHOUTN)|(odd|even))\s*\)/,
+ pseudo_cls: /:(IDENT)/,
+
+ comb: /\s*(\+|~|>)\s*|\s+/,
+ comma: /\s*,\s*/,
+ important: /\s+!important\s*$/
+ }
+
+ /* Replace placeholders with actual regex, and mark all as case insensitive */
+ var token = /[A-Z][A-Z0-9]+/;
+ for (var k in rx) {
+ var src = rx[k].source;
+ while (m = src.match(token)) src = src.replace(m[0], tokens[m[0]].source);
+ rx[k] = new RegExp(src, 'gi');
+ }
+
+ /**
+ * A string that matches itself against regexii, and keeps track of how much of itself has been matched
+ */
+ var ConsumableString = Base.extend({
+ init: function(str) {
+ this.str = str;
+ this.pos = 0;
+ },
+ match: function(rx) {
+ var m;
+ rx.lastIndex = this.pos;
+ if ((m = rx.exec(this.str)) && m.index == this.pos ) {
+ this.pos = rx.lastIndex ? rx.lastIndex : this.str.length ;
+ return m;
+ }
+ return null;
+ },
+ peek: function(rx) {
+ var m;
+ rx.lastIndex = this.pos;
+ if ((m = rx.exec(this.str)) && m.index == this.pos ) return m;
+ return null;
+ },
+ showpos: function() {
+ return this.str.slice(0,this.pos)+'<HERE>' + this.str.slice(this.pos);
+ },
+ done: function() {
+ return this.pos == this.str.length;
+ }
+ })
+
+ /* A base class that all Selectors inherit off */
+ var SelectorBase = Base.extend({});
+
+ /**
+ * A class representing a Simple Selector, as per the CSS3 selector spec
+ */
+ var SimpleSelector = SelectorBase.extend({
+ init: function() {
+ this.tag = null;
+ this.id = null;
+ this.classes = [];
+ this.attrs = [];
+ this.nots = [];
+ this.pseudo_classes = [];
+ this.pseudo_els = [];
+ },
+ parse: function(selector) {
+ var m;
+
+ /* Pull out the initial tag first, if there is one */
+ if (m = selector.match(rx.tag)) this.tag = m[1];
+
+ /* Then for each selection type, try and find a match */
+ do {
+ if (m = selector.match(rx.not)) {
+ this.nots[this.nots.length] = SelectorsGroup().parse(selector)
+ if (!(m = selector.match(rx.not_end))) {
+ throw 'Invalid :not term in selector';
+ }
+ }
+ else if (m = selector.match(rx.id)) this.id = m[1];
+ else if (m = selector.match(rx.cls)) this.classes[this.classes.length] = m[1];
+ else if (m = selector.match(rx.attr)) this.attrs[this.attrs.length] = [ m[1], m[2], m[3] ];
+ else if (m = selector.match(rx.pseudo_el)) this.pseudo_els[this.pseudo_els.length] = m[1] || m[2];
+ else if (m = selector.match(rx.pseudo_cls_nth)) {
+ if (m[3]) {
+ var a = parseInt((m[1]||'')+(m[2]||'1'));
+ var b = parseInt((m[4]||'')+(m[5]||'0'));
+ }
+ else {
+ var a = m[8] ? 2 : 0;
+ var b = m[8] ? (4-m[8].length) : parseInt((m[6]||'')+m[7]);
+ }
+ this.pseudo_classes[this.pseudo_classes.length] = ['nth-child', [a, b]];
+ }
+ else if (m = selector.match(rx.pseudo_cls)) this.pseudo_classes[this.pseudo_classes.length] = [m[1]];
+
+ } while(m && !selector.done());
+
+ return this;
+ }
+ })
+
+ /**
+ * A class representing a Selector, as per the CSS3 selector spec
+ */
+ var Selector = SelectorBase.extend({
+ init: function(){
+ this.parts = [];
+ },
+ parse: function(cons){
+ this.parts[this.parts.length] = SimpleSelector().parse(cons);
+
+ while (!cons.done() && !cons.peek(rx.comma) && (m = cons.match(rx.comb))) {
+ this.parts[this.parts.length] = m[1] || ' ';
+ this.parts[this.parts.length] = SimpleSelector().parse(cons);
+ }
+
+ return this.parts.length == 1 ? this.parts[0] : this;
+ }
+ });
+
+ /**
+ * A class representing a sequence of selectors, as per the CSS3 selector spec
+ */
+ var SelectorsGroup = SelectorBase.extend({
+ init: function(){
+ this.parts = [];
+ },
+ parse: function(cons){
+ this.parts[this.parts.length] = Selector().parse(cons);
+
+ while (!cons.done() && (m = cons.match(rx.comma))) {
+ this.parts[this.parts.length] = Selector().parse(cons);
+ }
+
+ return this.parts.length == 1 ? this.parts[0] : this;
+ }
+ });
+
+
+ $.selector = function(s){
+ var cons = ConsumableString(s);
+ var res = SelectorsGroup().parse(cons);
+
+ res.selector = s;
+
+ if (!cons.done()) throw 'Could not parse selector - ' + cons.showpos() ;
+ else return res;
+ }
+
+ $.selector.SelectorBase = SelectorBase;
+ $.selector.SimpleSelector = SimpleSelector;
+ $.selector.Selector = Selector;
+ $.selector.SelectorsGroup = SelectorsGroup;
+
+})(jQuery)
+;
+
+
+/* vendor/jquery.selector/jquery.selector.specifity.js */
+
+(function($) {
+
+ $.selector.SimpleSelector.addMethod('specifity', function() {
+ if (this.spec) return this.spec;
+
+ var spec = [
+ this.id ? 1 : 0,
+ this.classes.length + this.attrs.length + this.pseudo_classes.length,
+ ((this.tag && this.tag != '*') ? 1 : 0) + this.pseudo_els.length
+ ];
+ $.each(this.nots, function(i,not){
+ var ns = not.specifity(); spec[0] += ns[0]; spec[1] += ns[1]; spec[2] += ns[2];
+ });
+
+ return this.spec = spec;
+ })
+
+ $.selector.Selector.addMethod('specifity', function(){
+ if (this.spec) return this.spec;
+
+ var spec = [0,0,0];
+