right-rails 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.rdoc +1 -1
  3. data/Rakefile +1 -1
  4. data/init.rb +1 -0
  5. data/lib/generators/right_rails/right_rails_generator.rb +15 -6
  6. data/lib/right_rails.rb +1 -1
  7. data/lib/right_rails/controller_extensions.rb +28 -15
  8. data/lib/right_rails/helpers/misc.rb +38 -38
  9. data/lib/right_rails/helpers/rails.rb +50 -7
  10. data/lib/rjs_renderer.rb +26 -0
  11. data/spec/lib/right_rails/controller_extensions_spec.rb +25 -14
  12. data/spec/lib/right_rails/helpers/forms_spec.rb +6 -6
  13. data/spec/lib/right_rails/helpers/rails_spec.rb +44 -45
  14. data/vendor/assets/images/rightjs-ui/rte.png +0 -0
  15. data/vendor/assets/javascripts/right-safe-src.js +2 -2
  16. data/vendor/assets/javascripts/right-safe.js +2 -2
  17. data/vendor/assets/javascripts/right-src.js +386 -100
  18. data/vendor/assets/javascripts/right.js +2 -2
  19. data/vendor/assets/javascripts/right/calendar-src.js +19 -3
  20. data/vendor/assets/javascripts/right/calendar.js +2 -2
  21. data/vendor/assets/javascripts/right/colorpicker-src.js +59 -20
  22. data/vendor/assets/javascripts/right/colorpicker.js +2 -2
  23. data/vendor/assets/javascripts/right/i18n/de.js +43 -42
  24. data/vendor/assets/javascripts/right/i18n/es.js +1 -0
  25. data/vendor/assets/javascripts/right/i18n/fi.js +1 -0
  26. data/vendor/assets/javascripts/right/i18n/fr.js +1 -0
  27. data/vendor/assets/javascripts/right/i18n/hu.js +1 -0
  28. data/vendor/assets/javascripts/right/i18n/it.js +1 -0
  29. data/vendor/assets/javascripts/right/i18n/jp.js +1 -0
  30. data/vendor/assets/javascripts/right/i18n/lt.js +96 -0
  31. data/vendor/assets/javascripts/right/i18n/nl.js +1 -0
  32. data/vendor/assets/javascripts/right/i18n/pt-br.js +1 -0
  33. data/vendor/assets/javascripts/right/i18n/ru.js +1 -0
  34. data/vendor/assets/javascripts/right/i18n/ua.js +1 -0
  35. data/vendor/assets/javascripts/right/jquerysh-src.js +4 -4
  36. data/vendor/assets/javascripts/right/jquerysh.js +2 -2
  37. data/vendor/assets/javascripts/right/rails-src.js +51 -15
  38. data/vendor/assets/javascripts/right/rails.js +2 -2
  39. data/vendor/assets/javascripts/right/resizable-src.js +11 -11
  40. data/vendor/assets/javascripts/right/rte-src.js +33 -13
  41. data/vendor/assets/javascripts/right/rte.js +2 -2
  42. data/vendor/assets/javascripts/right/slider-src.js +137 -28
  43. data/vendor/assets/javascripts/right/slider.js +2 -2
  44. metadata +24 -126
  45. data/generators/right_rails/right_rails_generator.rb +0 -46
  46. data/generators/right_rails/templates/iframed.html.erb +0 -10
  47. data/generators/right_scaffold/right_scaffold_generator.rb +0 -53
  48. data/generators/right_scaffold/templates/controller.rb +0 -99
  49. data/generators/right_scaffold/templates/helper.rb +0 -2
  50. data/generators/right_scaffold/templates/layout.html.erb +0 -18
  51. data/generators/right_scaffold/templates/style.css +0 -54
  52. data/generators/right_scaffold/templates/view__form.html.erb +0 -16
  53. data/generators/right_scaffold/templates/view__item.html.erb +0 -13
  54. data/generators/right_scaffold/templates/view_edit.html.erb +0 -6
  55. data/generators/right_scaffold/templates/view_index.html.erb +0 -9
  56. data/generators/right_scaffold/templates/view_new.html.erb +0 -5
  57. data/generators/right_scaffold/templates/view_show.html.erb +0 -10
  58. data/lib/generators/right_rails/templates/iframed.html.erb +0 -10
  59. data/public/images/rightjs-ui/colorpicker.png +0 -0
  60. data/public/images/rightjs-ui/resizable.png +0 -0
  61. data/public/images/rightjs-ui/rte.png +0 -0
  62. data/public/javascripts/right-olds-src.js +0 -652
  63. data/public/javascripts/right-olds.js +0 -9
  64. data/public/javascripts/right-safe-src.js +0 -68
  65. data/public/javascripts/right-safe.js +0 -7
  66. data/public/javascripts/right-src.js +0 -6014
  67. data/public/javascripts/right.js +0 -7
  68. data/public/javascripts/right/autocompleter-src.js +0 -625
  69. data/public/javascripts/right/autocompleter.js +0 -7
  70. data/public/javascripts/right/billboard-src.js +0 -564
  71. data/public/javascripts/right/billboard.js +0 -7
  72. data/public/javascripts/right/calendar-src.js +0 -1464
  73. data/public/javascripts/right/calendar.js +0 -7
  74. data/public/javascripts/right/casting-src.js +0 -183
  75. data/public/javascripts/right/casting.js +0 -7
  76. data/public/javascripts/right/colorpicker-src.js +0 -981
  77. data/public/javascripts/right/colorpicker.js +0 -7
  78. data/public/javascripts/right/dialog-src.js +0 -768
  79. data/public/javascripts/right/dialog.js +0 -7
  80. data/public/javascripts/right/dnd-src.js +0 -591
  81. data/public/javascripts/right/dnd.js +0 -7
  82. data/public/javascripts/right/effects-src.js +0 -508
  83. data/public/javascripts/right/effects.js +0 -7
  84. data/public/javascripts/right/i18n/de.js +0 -95
  85. data/public/javascripts/right/i18n/en-us.js +0 -11
  86. data/public/javascripts/right/i18n/es.js +0 -95
  87. data/public/javascripts/right/i18n/fi.js +0 -96
  88. data/public/javascripts/right/i18n/fr.js +0 -95
  89. data/public/javascripts/right/i18n/hu.js +0 -100
  90. data/public/javascripts/right/i18n/it.js +0 -95
  91. data/public/javascripts/right/i18n/jp.js +0 -99
  92. data/public/javascripts/right/i18n/nl.js +0 -95
  93. data/public/javascripts/right/i18n/pt-br.js +0 -95
  94. data/public/javascripts/right/i18n/ru.js +0 -95
  95. data/public/javascripts/right/i18n/ua.js +0 -99
  96. data/public/javascripts/right/in-edit-src.js +0 -373
  97. data/public/javascripts/right/in-edit.js +0 -7
  98. data/public/javascripts/right/jquerysh-src.js +0 -362
  99. data/public/javascripts/right/jquerysh.js +0 -7
  100. data/public/javascripts/right/json-src.js +0 -147
  101. data/public/javascripts/right/json.js +0 -7
  102. data/public/javascripts/right/keys-src.js +0 -87
  103. data/public/javascripts/right/keys.js +0 -7
  104. data/public/javascripts/right/lightbox-src.js +0 -931
  105. data/public/javascripts/right/lightbox.js +0 -7
  106. data/public/javascripts/right/rails-src.js +0 -402
  107. data/public/javascripts/right/rails.js +0 -7
  108. data/public/javascripts/right/rater-src.js +0 -384
  109. data/public/javascripts/right/rater.js +0 -7
  110. data/public/javascripts/right/resizable-src.js +0 -465
  111. data/public/javascripts/right/resizable.js +0 -7
  112. data/public/javascripts/right/rte-src.js +0 -2685
  113. data/public/javascripts/right/rte.js +0 -7
  114. data/public/javascripts/right/selectable-src.js +0 -725
  115. data/public/javascripts/right/selectable.js +0 -7
  116. data/public/javascripts/right/sizzle-src.js +0 -1132
  117. data/public/javascripts/right/sizzle.js +0 -7
  118. data/public/javascripts/right/slider-src.js +0 -395
  119. data/public/javascripts/right/slider.js +0 -7
  120. data/public/javascripts/right/sortable-src.js +0 -430
  121. data/public/javascripts/right/sortable.js +0 -7
  122. data/public/javascripts/right/table-src.js +0 -176
  123. data/public/javascripts/right/table.js +0 -7
  124. data/public/javascripts/right/tabs-src.js +0 -1157
  125. data/public/javascripts/right/tabs.js +0 -7
  126. data/public/javascripts/right/tags-src.js +0 -745
  127. data/public/javascripts/right/tags.js +0 -7
  128. data/public/javascripts/right/tooltips-src.js +0 -331
  129. data/public/javascripts/right/tooltips.js +0 -7
  130. data/public/javascripts/right/uploader-src.js +0 -302
  131. data/public/javascripts/right/uploader.js +0 -7
@@ -1,7 +0,0 @@
1
- /**
2
- * RightJS-UI Selectable v2.2.2
3
- * http://rightjs.org/ui/selectable
4
- *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
6
- */
7
- var Selectable=RightJS.Selectable=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d={assignTo:function(b){var c=e(function(a,b){(a=f(a))&&a[a.setValue?"setValue":"update"](b.target.getValue())}).curry(b),d=e(function(a,b){a=f(a),a&&a.onChange&&a.onChange(e(function(){this.setValue(a.value())}).bind(b))}).curry(b);f(b)?(c({target:this}),d(this)):f(a).onReady(e(function(){c({target:this}),d(this)}.bind(this)));return this.onChange(c)}},e=b,f=b.$,g=b.$$,h=b.$w,i=b.$E,j=b.$A,k=b.Object,l=b.isHash,m=b.isArray,n=b.isString,o=b.isNumber,p=b.defined,q=b.Input,r=b.Element,s=new c("UL",{include:d,extend:{version:"2.2.2",EVENTS:h("change select unselect disable enable hover leave show hide"),Options:{options:null,selected:null,disabled:null,multiple:!0,fxName:"slide",fxDuration:"short",update:null,parseIds:!1,limit:null,hCont:"&bull;"},rescan:function(b){f(b||a).find(".rui-selectable").each(function(a){a instanceof s||new s(a)})}},initialize:function(){var a=j(arguments).compact(),b=a.pop(),c=a.pop(),d;if(!l(b)||b instanceof r)c=f(c||b),b=null;c&&(c=f(c))instanceof q&&(this.selectbox=d=c,b=k.merge(this.harvestOptions(c),b),c=null),this.$super("selectable",c).setOptions(b).on({mousedown:this._mousedown,mouseover:this._mouseover,mouseout:this._mouseout,mouseup:this._mouseup,click:this._click,select:this._change,unselect:this._change}),this.empty()&&this.build(),b=this.options;if(!b.multiple||this.hasClass("rui-selectable-single"))this.isSingle=!0,this.addClass("rui-selectable-single"),this.buildSingle(),b.selected===null&&this.select(this.items()[0]);b.disabled&&this.disable(b.disabled),b.selected&&this.select(b.selected),b.update&&this.assignTo(b.update),d&&(this.assignTo(d).insertTo(d,"before"),d.wrap(i("div",{style:"position:absolute;z-index:-1;visibility:hidden;width:0;height:0;overflow:hidden"})))},setValue:function(a){n(a)&&(a=a.split(",").map("trim").filter(function(a){return!a.blank()})),this.items().each("removeClass","rui-selectable-selected");return this.select(a)},getValue:function(){if(this.isSingle){var a=this.items().first("hasClass","rui-selectable-selected");return a?this.itemValue(a):null}return this.items().filter("hasClass","rui-selectable-selected").map(function(a){return this.itemValue(a)},this)},disable:function(a){this.mapOrAll(a).each(function(a){this.fire("disable",a.addClass("rui-selectable-disabled"))},this);return this},enable:function(a){this.mapOrAll(a).each(function(a){this.fire("enable",a.removeClass("rui-selectable-disabled"))},this);return this},disabled:function(a){return this.mapOrAll(a).every("hasClass","rui-selectable-disabled")},select:function(a){var b=this.mapEnabled(a),c="rui-selectable-selected";this.isSingle&&b&&(this.items().each("removeClass",c),b=e([b[0]]));if(!this.isSingle&&this.options.limit){var d=this.items().filter("hasClass",c),f=[];while(b.length&&d.length+f.length<this.options.limit){var g=b.shift();d.include(g)||f.push(g)}b=f}b.compact().each(function(a){this.fire("select",a.addClass(c))},this);return this},unselect:function(a){var b=this.getValue();this.mapEnabled(a).each(function(a){this.fire("unselect",a.removeClass("rui-selectable-selected"))},this);return this},selected:function(a){return this.mapEnabled(a).every("hasClass","rui-selectable-selected")},insertTo:function(a,b){this.$super.call(this.isSingle?this.container:this,a,b);return this},remove:function(){this.$super.call(this.isSingle?this.container:this);return this},fire:function(a,b){b&&b instanceof r?this.$super(a,{item:b,index:this.items().indexOf(b)}):this.$super.apply(this,arguments);return this},itemValue:function(a){var b=e([a._value,a.get("id")||a.get("val")]).compact()[0];return b!==undefined?this.options.parseIds?b.match(/\d+/):b:this.items().indexOf(a)},items:function(){return this.find("li")},mapOrAll:function(a){var b=this.items();p(a)&&(m(a)||(a=[a]),b=e(a).map(function(a){var c=n(a)&&/^\d+$/.test(a)?parseInt(a,10):a,d=a;o(c)?d=b[c]:n(a)&&(d=b.first(function(b){return b.id==a||b.val==a}));return d},this).compact());return b},mapEnabled:function(a){return this.mapOrAll(a).filter(function(a){return!a.hasClass("rui-selectable-disabled")},this)},_mousedown:function(a){a.stop();var b=a.target,c=this.items();if(c.include(b)&&!this.disabled(b)){this.isSingle?this.select(b):this.selected(b)?(this.unselect(b),this._massRemove=!0):(this.select(b),this._massSelect=!0);if((a.shiftKey||a.metaKey)&&this._prevItem){var d=c.indexOf(this._prevItem),e=c.indexOf(b);if(d!=e){if(d>e){var f=d;d=e,e=d}for(var g=d;g<e;g++)this[this._prevItem.hasClass("rui-selectable-selected")?"select":"unselect"](c[g])}}this._prevItem=b}},_mouseup:function(a){a.stop(),this._massRemove=this._massSelect=!1},_mouseover:function(a){var b=a.target;this.fire("hover",b),this.isSingle||(this._massSelect?this.select(b):this._massRemove&&this.unselect(b))},_mouseout:function(a){this.fire("leave",a.target)},_click:function(a){a.stop()},_change:function(){""+this.value!=""+this.getValue()&&(this.value=this.getValue(),this.fire("change"))},build:function(){var a=this.options.options,b=e([]);if(m(a))a.each(function(a){b.push(m(a)?a:[a,a])});else for(var c in a)b.push([a[c],c]);b.each(function(a){var b=i("li",{val:a[1],html:a[0]});b._value=a[1],this.insert(b)},this);return this},buildSingle:function(){this.container=i("div",{"class":"rui-selectable-container"}).insert([this.trigger=i("div",{html:this.options.hCont,"class":"rui-selectable-handle"}),this.display=i("ul",{"class":"rui-selectable-display"})]).onClick(e(this.toggleList).bind(this)),this.parent()&&this.container.insertTo(this,"instead"),this.container.insert(this),f(a).onClick(e(this.hideList).bind(this));return this.onSelect("showItem").onSelect("hideList").addClass("rui-dd-menu")},toggleList:function(a){a.stop();return this.visible()?this.hideList():this.showList(a)},showList:function(a){a.stop(),g(".rui-selectable-single").without(this).each("hide");var b=this.container.dimensions(),c=this.container.position();this.setStyle({top:b.top+b.height-c.y-1+"px",left:b.left-c.x+"px",width:b.width+"px"}).show(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"show",this)}),this.options.fxName||this.fire("show",this)},hideList:function(){this.isSingle&&this.visible()&&(this.hide(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"hide")}),this.options.fxName||this.fire("hide"))},showItem:function(){var a=this.items().first("hasClass","rui-selectable-selected")||this.items().first();this.display.html("<li>"+(a?a.html():"&nbsp;")+"</li>")},harvestOptions:function(a){var b=(new Function("return "+a.get("data-selectable")))()||{};b.multiple=a._.type=="select-multiple",b.options=e([]),b.selected=e([]),b.disabled=e([]),j(a._.getElementsByTagName("OPTION")).each(function(c,d){var e=c.innerHTML,f=c.getAttribute("value");b.options.push([e,f===null?e:f]),c.selected&&!a._.disabled&&b.selected.push(d),(c.disabled||a._.disabled)&&b.disabled.push(d)}),b.selected.empty()&&(b.selected=0);return b}});f(a).onReady(function(){s.rescan()});var t=a.createElement("style"),u=a.createTextNode("*.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em} *.rui-selectable, *.rui-selectable li, *.rui-selectable dt, *.rui-selectable dd, *.rui-selectable ul,div.rui-selectable-container ul.rui-selectable-display,div.rui-selectable-container ul.rui-selectable-display li{margin:0;padding:0;border:none;background:none;list-style:none} *.rui-selectable{border:1px solid #CCC;border-bottom:none;display:inline-block; *display:inline; *zoom:1;min-width:10em;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-selectable li{padding:.3em 1em;cursor:pointer;border-bottom:1px solid #CCC} *.rui-selectable li:hover{background:#EEE} *.rui-selectable li.rui-selectable-selected{font-weight:bold;background:#DDD} *.rui-selectable li.rui-selectable-disabled, *.rui-selectable li.rui-selectable-disabled:hover{background:#CCC;color:#777;cursor:default}dl.rui-selectable dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE;border-bottom:1px solid #CCC}dl.rui-selectable dd li{padding-left:1.5em} *.rui-selectable-single{background:#FFF;display:none} *.rui-selectable-single li{overflow:hidden}div.rui-selectable-container{border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;display:inline-block; *display:inline; *zoom:1; *width:10em;vertical-align:middle;min-width:10em;cursor:pointer;height:1.6em;position:relative}div.rui-selectable-container div.rui-selectable-handle{font-family:Arial;position:absolute;right:0;width:0.8em;background:#DDD;text-align:center;height:100%;line-height:0.8em;font-size:200%;color:#888;border-left:1px solid #CCC}div.rui-selectable-container:hover div.rui-selectable-handle{color:#666}div.rui-selectable-container ul.rui-selectable-display{display:block;width:auto;overflow:hidden;margin-right:2em}div.rui-selectable-container ul.rui-selectable-display li{line-height:1.6em;padding:0 .5em;overflow:hidden;width:100%;white-space:nowrap}select.rui-selectable{visibility:hidden}");t.type="text/css",a.getElementsByTagName("head")[0].appendChild(t),t.styleSheet?t.styleSheet.cssText=u.nodeValue:t.appendChild(u);return s}(document,RightJS)
@@ -1,1132 +0,0 @@
1
- /**
2
- * Sizzle Engine Support v2.2.0
3
- * http://rightjs.org/plugins/sizzle
4
- *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
6
- */
7
- /**
8
- * sizzle initialization script
9
- *
10
- * Copyright (C) 2010-2011 Nikolay Nemshilov
11
- */
12
-
13
- RightJS.Sizzle = {
14
- version: '2.2.0'
15
- };
16
-
17
-
18
-
19
-
20
- /*!
21
- * Sizzle CSS Selector Engine - v1.0
22
- * Copyright 2009, The Dojo Foundation
23
- * Released under the MIT, BSD, and GPL Licenses.
24
- * More information: http://sizzlejs.com/
25
- */
26
- (function(){
27
-
28
- var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
29
- done = 0,
30
- toString = Object.prototype.toString,
31
- hasDuplicate = false,
32
- baseHasDuplicate = true;
33
-
34
- // Here we check if the JavaScript engine is using some sort of
35
- // optimization where it does not always call our comparision
36
- // function. If that is the case, discard the hasDuplicate value.
37
- // Thus far that includes Google Chrome.
38
- [0, 0].sort(function(){
39
- baseHasDuplicate = false;
40
- return 0;
41
- });
42
-
43
- var Sizzle = function(selector, context, results, seed) {
44
- results = results || [];
45
- context = context || document;
46
-
47
- var origContext = context;
48
-
49
- if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
50
- return [];
51
- }
52
-
53
- if ( !selector || typeof selector !== "string" ) {
54
- return results;
55
- }
56
-
57
- var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),
58
- soFar = selector, ret, cur, pop, i;
59
-
60
- // Reset the position of the chunker regexp (start from head)
61
- do {
62
- chunker.exec("");
63
- m = chunker.exec(soFar);
64
-
65
- if ( m ) {
66
- soFar = m[3];
67
-
68
- parts.push( m[1] );
69
-
70
- if ( m[2] ) {
71
- extra = m[3];
72
- break;
73
- }
74
- }
75
- } while ( m );
76
-
77
- if ( parts.length > 1 && origPOS.exec( selector ) ) {
78
- if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
79
- set = posProcess( parts[0] + parts[1], context );
80
- } else {
81
- set = Expr.relative[ parts[0] ] ?
82
- [ context ] :
83
- Sizzle( parts.shift(), context );
84
-
85
- while ( parts.length ) {
86
- selector = parts.shift();
87
-
88
- if ( Expr.relative[ selector ] ) {
89
- selector += parts.shift();
90
- }
91
-
92
- set = posProcess( selector, set );
93
- }
94
- }
95
- } else {
96
- // Take a shortcut and set the context if the root selector is an ID
97
- // (but not if it'll be faster if the inner selector is an ID)
98
- if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
99
- Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
100
- ret = Sizzle.find( parts.shift(), context, contextXML );
101
- context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
102
- }
103
-
104
- if ( context ) {
105
- ret = seed ?
106
- { expr: parts.pop(), set: makeArray(seed) } :
107
- Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
108
- set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
109
-
110
- if ( parts.length > 0 ) {
111
- checkSet = makeArray(set);
112
- } else {
113
- prune = false;
114
- }
115
-
116
- while ( parts.length ) {
117
- cur = parts.pop();
118
- pop = cur;
119
-
120
- if ( !Expr.relative[ cur ] ) {
121
- cur = "";
122
- } else {
123
- pop = parts.pop();
124
- }
125
-
126
- if ( pop == null ) {
127
- pop = context;
128
- }
129
-
130
- Expr.relative[ cur ]( checkSet, pop, contextXML );
131
- }
132
- } else {
133
- checkSet = parts = [];
134
- }
135
- }
136
-
137
- if ( !checkSet ) {
138
- checkSet = set;
139
- }
140
-
141
- if ( !checkSet ) {
142
- Sizzle.error( cur || selector );
143
- }
144
-
145
- if ( toString.call(checkSet) === "[object Array]" ) {
146
- if ( !prune ) {
147
- results.push.apply( results, checkSet );
148
- } else if ( context && context.nodeType === 1 ) {
149
- for ( i = 0; checkSet[i] != null; i++ ) {
150
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
151
- results.push( set[i] );
152
- }
153
- }
154
- } else {
155
- for ( i = 0; checkSet[i] != null; i++ ) {
156
- if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
157
- results.push( set[i] );
158
- }
159
- }
160
- }
161
- } else {
162
- makeArray( checkSet, results );
163
- }
164
-
165
- if ( extra ) {
166
- Sizzle( extra, origContext, results, seed );
167
- Sizzle.uniqueSort( results );
168
- }
169
-
170
- return results;
171
- };
172
-
173
- Sizzle.uniqueSort = function(results){
174
- if ( sortOrder ) {
175
- hasDuplicate = baseHasDuplicate;
176
- results.sort(sortOrder);
177
-
178
- if ( hasDuplicate ) {
179
- for ( var i = 1; i < results.length; i++ ) {
180
- if ( results[i] === results[i-1] ) {
181
- results.splice(i--, 1);
182
- }
183
- }
184
- }
185
- }
186
-
187
- return results;
188
- };
189
-
190
- Sizzle.matches = function(expr, set){
191
- return Sizzle(expr, null, null, set);
192
- };
193
-
194
- Sizzle.find = function(expr, context, isXML){
195
- var set;
196
-
197
- if ( !expr ) {
198
- return [];
199
- }
200
-
201
- for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
202
- var type = Expr.order[i], match;
203
-
204
- if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
205
- var left = match[1];
206
- match.splice(1,1);
207
-
208
- if ( left.substr( left.length - 1 ) !== "\\" ) {
209
- match[1] = (match[1] || "").replace(/\\/g, "");
210
- set = Expr.find[ type ]( match, context, isXML );
211
- if ( set != null ) {
212
- expr = expr.replace( Expr.match[ type ], "" );
213
- break;
214
- }
215
- }
216
- }
217
- }
218
-
219
- if ( !set ) {
220
- set = context.getElementsByTagName("*");
221
- }
222
-
223
- return {set: set, expr: expr};
224
- };
225
-
226
- Sizzle.filter = function(expr, set, inplace, not){
227
- var old = expr, result = [], curLoop = set, match, anyFound,
228
- isXMLFilter = set && set[0] && Sizzle.isXML(set[0]);
229
-
230
- while ( expr && set.length ) {
231
- for ( var type in Expr.filter ) {
232
- if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
233
- var filter = Expr.filter[ type ], found, item, left = match[1];
234
- anyFound = false;
235
-
236
- match.splice(1,1);
237
-
238
- if ( left.substr( left.length - 1 ) === "\\" ) {
239
- continue;
240
- }
241
-
242
- if ( curLoop === result ) {
243
- result = [];
244
- }
245
-
246
- if ( Expr.preFilter[ type ] ) {
247
- match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
248
-
249
- if ( !match ) {
250
- anyFound = found = true;
251
- } else if ( match === true ) {
252
- continue;
253
- }
254
- }
255
-
256
- if ( match ) {
257
- for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
258
- if ( item ) {
259
- found = filter( item, match, i, curLoop );
260
- var pass = not ^ !!found;
261
-
262
- if ( inplace && found != null ) {
263
- if ( pass ) {
264
- anyFound = true;
265
- } else {
266
- curLoop[i] = false;
267
- }
268
- } else if ( pass ) {
269
- result.push( item );
270
- anyFound = true;
271
- }
272
- }
273
- }
274
- }
275
-
276
- if ( found !== undefined ) {
277
- if ( !inplace ) {
278
- curLoop = result;
279
- }
280
-
281
- expr = expr.replace( Expr.match[ type ], "" );
282
-
283
- if ( !anyFound ) {
284
- return [];
285
- }
286
-
287
- break;
288
- }
289
- }
290
- }
291
-
292
- // Improper expression
293
- if ( expr === old ) {
294
- if ( anyFound == null ) {
295
- Sizzle.error( expr );
296
- } else {
297
- break;
298
- }
299
- }
300
-
301
- old = expr;
302
- }
303
-
304
- return curLoop;
305
- };
306
-
307
- Sizzle.error = function( msg ) {
308
- throw "Syntax error, unrecognized expression: " + msg;
309
- };
310
-
311
- var Expr = Sizzle.selectors = {
312
- order: [ "ID", "NAME", "TAG" ],
313
- match: {
314
- ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
315
- CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
316
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
317
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
318
- TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
319
- CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
320
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
321
- PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
322
- },
323
- leftMatch: {},
324
- attrMap: {
325
- "class": "className",
326
- "for": "htmlFor"
327
- },
328
- attrHandle: {
329
- href: function(elem){
330
- return elem.getAttribute("href");
331
- }
332
- },
333
- relative: {
334
- "+": function(checkSet, part){
335
- var isPartStr = typeof part === "string",
336
- isTag = isPartStr && !/\W/.test(part),
337
- isPartStrNotTag = isPartStr && !isTag;
338
-
339
- if ( isTag ) {
340
- part = part.toLowerCase();
341
- }
342
-
343
- for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
344
- if ( (elem = checkSet[i]) ) {
345
- while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
346
-
347
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
348
- elem || false :
349
- elem === part;
350
- }
351
- }
352
-
353
- if ( isPartStrNotTag ) {
354
- Sizzle.filter( part, checkSet, true );
355
- }
356
- },
357
- ">": function(checkSet, part){
358
- var isPartStr = typeof part === "string",
359
- elem, i = 0, l = checkSet.length;
360
-
361
- if ( isPartStr && !/\W/.test(part) ) {
362
- part = part.toLowerCase();
363
-
364
- for ( ; i < l; i++ ) {
365
- elem = checkSet[i];
366
- if ( elem ) {
367
- var parent = elem.parentNode;
368
- checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
369
- }
370
- }
371
- } else {
372
- for ( ; i < l; i++ ) {
373
- elem = checkSet[i];
374
- if ( elem ) {
375
- checkSet[i] = isPartStr ?
376
- elem.parentNode :
377
- elem.parentNode === part;
378
- }
379
- }
380
-
381
- if ( isPartStr ) {
382
- Sizzle.filter( part, checkSet, true );
383
- }
384
- }
385
- },
386
- "": function(checkSet, part, isXML){
387
- var doneName = done++, checkFn = dirCheck, nodeCheck;
388
-
389
- if ( typeof part === "string" && !/\W/.test(part) ) {
390
- part = part.toLowerCase();
391
- nodeCheck = part;
392
- checkFn = dirNodeCheck;
393
- }
394
-
395
- checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
396
- },
397
- "~": function(checkSet, part, isXML){
398
- var doneName = done++, checkFn = dirCheck, nodeCheck;
399
-
400
- if ( typeof part === "string" && !/\W/.test(part) ) {
401
- part = part.toLowerCase();
402
- nodeCheck = part;
403
- checkFn = dirNodeCheck;
404
- }
405
-
406
- checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
407
- }
408
- },
409
- find: {
410
- ID: function(match, context, isXML){
411
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
412
- var m = context.getElementById(match[1]);
413
- // Check parentNode to catch when Blackberry 4.6 returns
414
- // nodes that are no longer in the document #6963
415
- return m && m.parentNode ? [m] : [];
416
- }
417
- },
418
- NAME: function(match, context){
419
- if ( typeof context.getElementsByName !== "undefined" ) {
420
- var ret = [], results = context.getElementsByName(match[1]);
421
-
422
- for ( var i = 0, l = results.length; i < l; i++ ) {
423
- if ( results[i].getAttribute("name") === match[1] ) {
424
- ret.push( results[i] );
425
- }
426
- }
427
-
428
- return ret.length === 0 ? null : ret;
429
- }
430
- },
431
- TAG: function(match, context){
432
- return context.getElementsByTagName(match[1]);
433
- }
434
- },
435
- preFilter: {
436
- CLASS: function(match, curLoop, inplace, result, not, isXML){
437
- match = " " + match[1].replace(/\\/g, "") + " ";
438
-
439
- if ( isXML ) {
440
- return match;
441
- }
442
-
443
- for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
444
- if ( elem ) {
445
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
446
- if ( !inplace ) {
447
- result.push( elem );
448
- }
449
- } else if ( inplace ) {
450
- curLoop[i] = false;
451
- }
452
- }
453
- }
454
-
455
- return false;
456
- },
457
- ID: function(match){
458
- return match[1].replace(/\\/g, "");
459
- },
460
- TAG: function(match, curLoop){
461
- return match[1].toLowerCase();
462
- },
463
- CHILD: function(match){
464
- if ( match[1] === "nth" ) {
465
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
466
- var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
467
- match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
468
- !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
469
-
470
- // calculate the numbers (first)n+(last) including if they are negative
471
- match[2] = (test[1] + (test[2] || 1)) - 0;
472
- match[3] = test[3] - 0;
473
- }
474
-
475
- // TODO: Move to normal caching system
476
- match[0] = done++;
477
-
478
- return match;
479
- },
480
- ATTR: function(match, curLoop, inplace, result, not, isXML){
481
- var name = match[1].replace(/\\/g, "");
482
-
483
- if ( !isXML && Expr.attrMap[name] ) {
484
- match[1] = Expr.attrMap[name];
485
- }
486
-
487
- if ( match[2] === "~=" ) {
488
- match[4] = " " + match[4] + " ";
489
- }
490
-
491
- return match;
492
- },
493
- PSEUDO: function(match, curLoop, inplace, result, not){
494
- if ( match[1] === "not" ) {
495
- // If we're dealing with a complex expression, or a simple one
496
- if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
497
- match[3] = Sizzle(match[3], null, null, curLoop);
498
- } else {
499
- var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
500
- if ( !inplace ) {
501
- result.push.apply( result, ret );
502
- }
503
- return false;
504
- }
505
- } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
506
- return true;
507
- }
508
-
509
- return match;
510
- },
511
- POS: function(match){
512
- match.unshift( true );
513
- return match;
514
- }
515
- },
516
- filters: {
517
- enabled: function(elem){
518
- return elem.disabled === false && elem.type !== "hidden";
519
- },
520
- disabled: function(elem){
521
- return elem.disabled === true;
522
- },
523
- checked: function(elem){
524
- return elem.checked === true;
525
- },
526
- selected: function(elem){
527
- // Accessing this property makes selected-by-default
528
- // options in Safari work properly
529
- elem.parentNode.selectedIndex;
530
- return elem.selected === true;
531
- },
532
- parent: function(elem){
533
- return !!elem.firstChild;
534
- },
535
- empty: function(elem){
536
- return !elem.firstChild;
537
- },
538
- has: function(elem, i, match){
539
- return !!Sizzle( match[3], elem ).length;
540
- },
541
- header: function(elem){
542
- return (/h\d/i).test( elem.nodeName );
543
- },
544
- text: function(elem){
545
- return "text" === elem.type;
546
- },
547
- radio: function(elem){
548
- return "radio" === elem.type;
549
- },
550
- checkbox: function(elem){
551
- return "checkbox" === elem.type;
552
- },
553
- file: function(elem){
554
- return "file" === elem.type;
555
- },
556
- password: function(elem){
557
- return "password" === elem.type;
558
- },
559
- submit: function(elem){
560
- return "submit" === elem.type;
561
- },
562
- image: function(elem){
563
- return "image" === elem.type;
564
- },
565
- reset: function(elem){
566
- return "reset" === elem.type;
567
- },
568
- button: function(elem){
569
- return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
570
- },
571
- input: function(elem){
572
- return (/input|select|textarea|button/i).test(elem.nodeName);
573
- }
574
- },
575
- setFilters: {
576
- first: function(elem, i){
577
- return i === 0;
578
- },
579
- last: function(elem, i, match, array){
580
- return i === array.length - 1;
581
- },
582
- even: function(elem, i){
583
- return i % 2 === 0;
584
- },
585
- odd: function(elem, i){
586
- return i % 2 === 1;
587
- },
588
- lt: function(elem, i, match){
589
- return i < match[3] - 0;
590
- },
591
- gt: function(elem, i, match){
592
- return i > match[3] - 0;
593
- },
594
- nth: function(elem, i, match){
595
- return match[3] - 0 === i;
596
- },
597
- eq: function(elem, i, match){
598
- return match[3] - 0 === i;
599
- }
600
- },
601
- filter: {
602
- PSEUDO: function(elem, match, i, array){
603
- var name = match[1], filter = Expr.filters[ name ];
604
-
605
- if ( filter ) {
606
- return filter( elem, i, match, array );
607
- } else if ( name === "contains" ) {
608
- return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
609
- } else if ( name === "not" ) {
610
- var not = match[3];
611
-
612
- for ( var j = 0, l = not.length; j < l; j++ ) {
613
- if ( not[j] === elem ) {
614
- return false;
615
- }
616
- }
617
-
618
- return true;
619
- } else {
620
- Sizzle.error( "Syntax error, unrecognized expression: " + name );
621
- }
622
- },
623
- CHILD: function(elem, match){
624
- var type = match[1], node = elem;
625
- switch (type) {
626
- case 'only':
627
- case 'first':
628
- while ( (node = node.previousSibling) ) {
629
- if ( node.nodeType === 1 ) {
630
- return false;
631
- }
632
- }
633
- if ( type === "first" ) {
634
- return true;
635
- }
636
- node = elem;
637
- case 'last':
638
- while ( (node = node.nextSibling) ) {
639
- if ( node.nodeType === 1 ) {
640
- return false;
641
- }
642
- }
643
- return true;
644
- case 'nth':
645
- var first = match[2], last = match[3];
646
-
647
- if ( first === 1 && last === 0 ) {
648
- return true;
649
- }
650
-
651
- var doneName = match[0],
652
- parent = elem.parentNode;
653
-
654
- if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
655
- var count = 0;
656
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
657
- if ( node.nodeType === 1 ) {
658
- node.nodeIndex = ++count;
659
- }
660
- }
661
- parent.sizcache = doneName;
662
- }
663
-
664
- var diff = elem.nodeIndex - last;
665
- if ( first === 0 ) {
666
- return diff === 0;
667
- } else {
668
- return ( diff % first === 0 && diff / first >= 0 );
669
- }
670
- }
671
- },
672
- ID: function(elem, match){
673
- return elem.nodeType === 1 && elem.getAttribute("id") === match;
674
- },
675
- TAG: function(elem, match){
676
- return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
677
- },
678
- CLASS: function(elem, match){
679
- return (" " + (elem.className || elem.getAttribute("class")) + " ")
680
- .indexOf( match ) > -1;
681
- },
682
- ATTR: function(elem, match){
683
- var name = match[1],
684
- result = Expr.attrHandle[ name ] ?
685
- Expr.attrHandle[ name ]( elem ) :
686
- elem[ name ] != null ?
687
- elem[ name ] :
688
- elem.getAttribute( name ),
689
- value = result + "",
690
- type = match[2],
691
- check = match[4];
692
-
693
- return result == null ?
694
- type === "!=" :
695
- type === "=" ?
696
- value === check :
697
- type === "*=" ?
698
- value.indexOf(check) >= 0 :
699
- type === "~=" ?
700
- (" " + value + " ").indexOf(check) >= 0 :
701
- !check ?
702
- value && result !== false :
703
- type === "!=" ?
704
- value !== check :
705
- type === "^=" ?
706
- value.indexOf(check) === 0 :
707
- type === "$=" ?
708
- value.substr(value.length - check.length) === check :
709
- type === "|=" ?
710
- value === check || value.substr(0, check.length + 1) === check + "-" :
711
- false;
712
- },
713
- POS: function(elem, match, i, array){
714
- var name = match[2], filter = Expr.setFilters[ name ];
715
-
716
- if ( filter ) {
717
- return filter( elem, i, match, array );
718
- }
719
- }
720
- }
721
- };
722
-
723
- var origPOS = Expr.match.POS,
724
- fescape = function(all, num){
725
- return "\\" + (num - 0 + 1);
726
- };
727
-
728
- for ( var type in Expr.match ) {
729
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
730
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
731
- }
732
-
733
- var makeArray = function(array, results) {
734
- array = Array.prototype.slice.call( array, 0 );
735
-
736
- if ( results ) {
737
- results.push.apply( results, array );
738
- return results;
739
- }
740
-
741
- return array;
742
- };
743
-
744
- // Perform a simple check to determine if the browser is capable of
745
- // converting a NodeList to an array using builtin methods.
746
- // Also verifies that the returned array holds DOM nodes
747
- // (which is not the case in the Blackberry browser)
748
- try {
749
- Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
750
-
751
- // Provide a fallback method if it does not work
752
- } catch(e){
753
- makeArray = function(array, results) {
754
- var ret = results || [], i = 0;
755
-
756
- if ( toString.call(array) === "[object Array]" ) {
757
- Array.prototype.push.apply( ret, array );
758
- } else {
759
- if ( typeof array.length === "number" ) {
760
- for ( var l = array.length; i < l; i++ ) {
761
- ret.push( array[i] );
762
- }
763
- } else {
764
- for ( ; array[i]; i++ ) {
765
- ret.push( array[i] );
766
- }
767
- }
768
- }
769
-
770
- return ret;
771
- };
772
- }
773
-
774
- var sortOrder, siblingCheck;
775
-
776
- if ( document.documentElement.compareDocumentPosition ) {
777
- sortOrder = function( a, b ) {
778
- if ( a === b ) {
779
- hasDuplicate = true;
780
- return 0;
781
- }
782
-
783
- if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
784
- return a.compareDocumentPosition ? -1 : 1;
785
- }
786
-
787
- return a.compareDocumentPosition(b) & 4 ? -1 : 1;
788
- };
789
- } else {
790
- sortOrder = function( a, b ) {
791
- var ap = [], bp = [], aup = a.parentNode, bup = b.parentNode,
792
- cur = aup, al, bl;
793
-
794
- // The nodes are identical, we can exit early
795
- if ( a === b ) {
796
- hasDuplicate = true;
797
- return 0;
798
-
799
- // If the nodes are siblings (or identical) we can do a quick check
800
- } else if ( aup === bup ) {
801
- return siblingCheck( a, b );
802
-
803
- // If no parents were found then the nodes are disconnected
804
- } else if ( !aup ) {
805
- return -1;
806
-
807
- } else if ( !bup ) {
808
- return 1;
809
- }
810
-
811
- // Otherwise they're somewhere else in the tree so we need
812
- // to build up a full list of the parentNodes for comparison
813
- while ( cur ) {
814
- ap.unshift( cur );
815
- cur = cur.parentNode;
816
- }
817
-
818
- cur = bup;
819
-
820
- while ( cur ) {
821
- bp.unshift( cur );
822
- cur = cur.parentNode;
823
- }
824
-
825
- al = ap.length;
826
- bl = bp.length;
827
-
828
- // Start walking down the tree looking for a discrepancy
829
- for ( var i = 0; i < al && i < bl; i++ ) {
830
- if ( ap[i] !== bp[i] ) {
831
- return siblingCheck( ap[i], bp[i] );
832
- }
833
- }
834
-
835
- // We ended someplace up the tree so do a sibling check
836
- return i === al ?
837
- siblingCheck( a, bp[i], -1 ) :
838
- siblingCheck( ap[i], b, 1 );
839
- };
840
-
841
- siblingCheck = function( a, b, ret ) {
842
- if ( a === b ) {
843
- return ret;
844
- }
845
-
846
- var cur = a.nextSibling;
847
-
848
- while ( cur ) {
849
- if ( cur === b ) {
850
- return -1;
851
- }
852
-
853
- cur = cur.nextSibling;
854
- }
855
-
856
- return 1;
857
- };
858
- }
859
-
860
- // Utility function for retreiving the text value of an array of DOM nodes
861
- Sizzle.getText = function( elems ) {
862
- var ret = "", elem;
863
-
864
- for ( var i = 0; elems[i]; i++ ) {
865
- elem = elems[i];
866
-
867
- // Get the text from text nodes and CDATA nodes
868
- if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
869
- ret += elem.nodeValue;
870
-
871
- // Traverse everything else, except comment nodes
872
- } else if ( elem.nodeType !== 8 ) {
873
- ret += Sizzle.getText( elem.childNodes );
874
- }
875
- }
876
-
877
- return ret;
878
- };
879
-
880
- // Check to see if the browser returns elements by name when
881
- // querying by getElementById (and provide a workaround)
882
- (function(){
883
- // We're going to inject a fake input element with a specified name
884
- var form = document.createElement("div"),
885
- id = "script" + (new Date()).getTime();
886
- form.innerHTML = "<a name='" + id + "'/>";
887
-
888
- // Inject it into the root element, check its status, and remove it quickly
889
- var root = document.documentElement;
890
- root.insertBefore( form, root.firstChild );
891
-
892
- // The workaround has to do additional checks after a getElementById
893
- // Which slows things down for other browsers (hence the branching)
894
- if ( document.getElementById( id ) ) {
895
- Expr.find.ID = function(match, context, isXML){
896
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
897
- var m = context.getElementById(match[1]);
898
- return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
899
- }
900
- };
901
-
902
- Expr.filter.ID = function(elem, match){
903
- var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
904
- return elem.nodeType === 1 && node && node.nodeValue === match;
905
- };
906
- }
907
-
908
- root.removeChild( form );
909
- root = form = null; // release memory in IE
910
- })();
911
-
912
- (function(){
913
- // Check to see if the browser returns only elements
914
- // when doing getElementsByTagName("*")
915
-
916
- // Create a fake element
917
- var div = document.createElement("div");
918
- div.appendChild( document.createComment("") );
919
-
920
- // Make sure no comments are found
921
- if ( div.getElementsByTagName("*").length > 0 ) {
922
- Expr.find.TAG = function(match, context){
923
- var results = context.getElementsByTagName(match[1]);
924
-
925
- // Filter out possible comments
926
- if ( match[1] === "*" ) {
927
- var tmp = [];
928
-
929
- for ( var i = 0; results[i]; i++ ) {
930
- if ( results[i].nodeType === 1 ) {
931
- tmp.push( results[i] );
932
- }
933
- }
934
-
935
- results = tmp;
936
- }
937
-
938
- return results;
939
- };
940
- }
941
-
942
- // Check to see if an attribute returns normalized href attributes
943
- div.innerHTML = "<a href='#'></a>";
944
- if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
945
- div.firstChild.getAttribute("href") !== "#" ) {
946
- Expr.attrHandle.href = function(elem){
947
- return elem.getAttribute("href", 2);
948
- };
949
- }
950
-
951
- div = null; // release memory in IE
952
- })();
953
-
954
- if ( document.querySelectorAll ) {
955
- (function(){
956
- var oldSizzle = Sizzle, div = document.createElement("div");
957
- div.innerHTML = "<p class='TEST'></p>";
958
-
959
- // Safari can't handle uppercase or unicode characters when
960
- // in quirks mode.
961
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
962
- return;
963
- }
964
-
965
- Sizzle = function(query, context, extra, seed){
966
- context = context || document;
967
-
968
- // Only use querySelectorAll on non-XML documents
969
- // (ID selectors don't work in non-HTML documents)
970
- if ( !seed && context.nodeType === 9 && !Sizzle.isXML(context) ) {
971
- try {
972
- return makeArray( context.querySelectorAll(query), extra );
973
- } catch(e){}
974
- }
975
-
976
- return oldSizzle(query, context, extra, seed);
977
- };
978
-
979
- for ( var prop in oldSizzle ) {
980
- Sizzle[ prop ] = oldSizzle[ prop ];
981
- }
982
-
983
- div = null; // release memory in IE
984
- })();
985
- }
986
-
987
- (function(){
988
- var div = document.createElement("div");
989
-
990
- div.innerHTML = "<div class='test e'></div><div class='test'></div>";
991
-
992
- // Opera can't find a second classname (in 9.6)
993
- // Also, make sure that getElementsByClassName actually exists
994
- if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
995
- return;
996
- }
997
-
998
- // Safari caches class attributes, doesn't catch changes (in 3.2)
999
- div.lastChild.className = "e";
1000
-
1001
- if ( div.getElementsByClassName("e").length === 1 ) {
1002
- return;
1003
- }
1004
-
1005
- Expr.order.splice(1, 0, "CLASS");
1006
- Expr.find.CLASS = function(match, context, isXML) {
1007
- if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
1008
- return context.getElementsByClassName(match[1]);
1009
- }
1010
- };
1011
-
1012
- div = null; // release memory in IE
1013
- })();
1014
-
1015
- function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
1016
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1017
- var elem = checkSet[i];
1018
- if ( elem ) {
1019
- elem = elem[dir];
1020
- var match = false;
1021
-
1022
- while ( elem ) {
1023
- if ( elem.sizcache === doneName ) {
1024
- match = checkSet[elem.sizset];
1025
- break;
1026
- }
1027
-
1028
- if ( elem.nodeType === 1 && !isXML ){
1029
- elem.sizcache = doneName;
1030
- elem.sizset = i;
1031
- }
1032
-
1033
- if ( elem.nodeName.toLowerCase() === cur ) {
1034
- match = elem;
1035
- break;
1036
- }
1037
-
1038
- elem = elem[dir];
1039
- }
1040
-
1041
- checkSet[i] = match;
1042
- }
1043
- }
1044
- }
1045
-
1046
- function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
1047
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
1048
- var elem = checkSet[i];
1049
- if ( elem ) {
1050
- elem = elem[dir];
1051
- var match = false;
1052
-
1053
- while ( elem ) {
1054
- if ( elem.sizcache === doneName ) {
1055
- match = checkSet[elem.sizset];
1056
- break;
1057
- }
1058
-
1059
- if ( elem.nodeType === 1 ) {
1060
- if ( !isXML ) {
1061
- elem.sizcache = doneName;
1062
- elem.sizset = i;
1063
- }
1064
- if ( typeof cur !== "string" ) {
1065
- if ( elem === cur ) {
1066
- match = true;
1067
- break;
1068
- }
1069
-
1070
- } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
1071
- match = elem;
1072
- break;
1073
- }
1074
- }
1075
-
1076
- elem = elem[dir];
1077
- }
1078
-
1079
- checkSet[i] = match;
1080
- }
1081
- }
1082
- }
1083
-
1084
- Sizzle.contains = document.compareDocumentPosition ? function(a, b){
1085
- return !!(a.compareDocumentPosition(b) & 16);
1086
- } : function(a, b){
1087
- return a !== b && (a.contains ? a.contains(b) : true);
1088
- };
1089
-
1090
- Sizzle.isXML = function(elem){
1091
- // documentElement is verified for cases where it doesn't yet exist
1092
- // (such as loading iframes in IE - #4833)
1093
- var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
1094
- return documentElement ? documentElement.nodeName !== "HTML" : false;
1095
- };
1096
-
1097
- var posProcess = function(selector, context){
1098
- var tmpSet = [], later = "", match,
1099
- root = context.nodeType ? [context] : context;
1100
-
1101
- // Position selectors must be done after the filter
1102
- // And so must :not(positional) so we move all PSEUDOs to the end
1103
- while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
1104
- later += match[0];
1105
- selector = selector.replace( Expr.match.PSEUDO, "" );
1106
- }
1107
-
1108
- selector = Expr.relative[selector] ? selector + "*" : selector;
1109
-
1110
- for ( var i = 0, l = root.length; i < l; i++ ) {
1111
- Sizzle( selector, root[i], tmpSet );
1112
- }
1113
-
1114
- return Sizzle.filter( later, tmpSet );
1115
- };
1116
-
1117
- // EXPOSE
1118
-
1119
- window.Sizzle = Sizzle;
1120
-
1121
- })();
1122
-
1123
-
1124
- RightJS([RightJS.Document, RightJS.Element]).each('include', {
1125
- first: function(rule) {
1126
- return this.find(rule)[0];
1127
- },
1128
-
1129
- find: function(rule) {
1130
- return RightJS(Sizzle(rule, this._)).map(RightJS.$);
1131
- }
1132
- });