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 v2.2.3 - http://rightjs.org
3
- * Released under the terms of MIT license
4
- *
5
- * Copyright (C) 2008-2011 Nikolay Nemshilov
6
- */
7
- var RightJS=function(a,b,c,d,e,f,g,h,i){function cH(a,b,c,d){var e={},f=a.marginLeft.toFloat()||0,g=a.marginTop.toFloat()||0,h=c==="right",i=c==="bottom",j=c==="top"||i;d==="out"?(e[j?"height":"width"]="0px",h?e.marginLeft=f+b.x+"px":i&&(e.marginTop=g+b.y+"px")):(j?(e.height=b.y+"px",a.height="0px"):(e.width=b.x+"px",a.width="0px"),h?(e.marginLeft=f+"px",a.marginLeft=f+b.x+"px"):i&&(e.marginTop=g+"px",a.marginTop=g+b.y+"px"));return e}function cG(a,b,c){var d=a.clone().setStyle("position:absolute;z-index:-1;visibility:hidden").setWidth(a.size().x).setStyle(b),e;a.parent()&&a.insert(d,"before"),e=cF(d,c),d.remove();return e}function cF(a,b){var c=0,d=b.length,e=a.computedStyles(),f={},g;for(;c<d;c++)g=b[c],g in e&&(f[g]=""+e[g],g==="opacity"&&(f[g]=f[g].replace(",",".")));return f}function cE(a,b,c){var d;for(d in c)(d=="width"||d=="height")&&b[d]=="auto"&&(b[d]=a._["offset"+d.capitalize()]+"px");bt&&c.filter&&!b.filter&&(b.filter="alpha(opacity=100)"),cC(a,b,c);for(d in c){if(c[d]!==b[d]&&/color/i.test(d)){bp&&(c[d]=c[d].replace(/"/g,""),b[d]=b[d].replace(/"/g,"")),cB(c[d])||(c[d]=c[d].toRgb()),cB(b[d])||(b[d]=b[d].toRgb());if(!c[d]||!b[d])c[d]=b[d]=""}/\d/.test(c[d])&&!/\d/.test(b[d])&&(b[d]=c[d].replace(/[\d\.\-]+/g,"0"));if(c[d]===b[d]||!/\d/.test(b[d])||!/\d/.test(c[d]))delete c[d],delete b[d]}}function cD(a){var b={},c=/[\d\.\-]+/g,d,e,f,g;for(e in a){d=a[e].match(c),f=d.map("toFloat"),f.t=a[e].split(c),f.r=f.t[0]==="rgb(",f.t.length==1&&f.t.unshift("");for(g=0;g<f.length;g++)f.t.splice(g*2+1,0,f[g]);b[e]=f}return b}function cC(a,b,c){for(var d=0;d<4;d++){var e="border"+cy[d]+"Style",f="border"+cy[d]+"Width",g="border"+cy[d]+"Color";if(e in b&&b[e]!=c[e]){var h=a._.style;b[e]=="none"&&(h[f]="0px"),h[e]=c[e],cB(b[g])&&(h[g]=a.getStyle("Color"))}}}function cB(a){return a==="transparent"||a==="rgba(0, 0, 0, 0)"}function cA(a){var b=[],c=["Style","Color","Width"],d,e,f;for(d in a)if(d.startsWith("border"))for(e=0;e<3;e++)for(f=0;f<4;f++)b.push("border"+cy[f]+c[e]);else d==="margin"||d==="padding"?cz(b,d,cy):d.startsWith("background")?cz(b,"background",["Color","Position","PositionX","PositionY"]):d==="opacity"&&bt?b.push("filter"):b.push(d);return b}function cz(a,b,c){for(var d=0;d<c.length;d++)a.push(b+c[d])}function cx(a){function g(){for(var a in f)e[a]=f[a]}var b=this.options,d=this.element,e=d._.style,f=c.only(d.computedStyles(),ct,cu,cv);this.onFinish(g).onCancel(function(){e[ct]="none",setTimeout(g,1)}),e[ct]="all",e[cu]=(cf.Durations[b.duration]||b.duration)+"ms",e[cv]=cw[b.transition]||b.transition,setTimeout(function(){d.setStyle(a)},0)}function cq(a,b,c){var d=J(c).compact(),e=A(d.last())?d.pop():{},f=new(cf[b.capitalize()])(a,e);f.start.apply(f,d);return a}function cp(a){a._timer&&clearInterval(a._timer)}function co(a,b,c,d){var e=1;a._timer=setInterval(function(){e>d?a.finish():(a.render(b(e/d)),e++)},c)}function cn(a){var b=I(a._);(ch[b]||[]).each("cancel"),(cg[b]||[]).splice(0)}function cm(a){var b=a.ch,c=b.shift();if(c=b[0])c[1].$ch=!0,c[1].start.apply(c[1],c[0])}function cl(a){var b=a.cr;b&&b.splice(b.indexOf(a),1)}function ck(a){a.cr&&a.cr.push(a)}function cj(a,b){var c=a.ch,d=a.options.queue;if(!c||a.$ch)return a.$ch=!1;d&&c.push([b,a]);return d&&c[0][1]!==a}function ci(a){var b=I((a.element||{})._||{});a.ch=cg[b]=cg[b]||[],a.cr=ch[b]=ch[b]||[]}function ce(a,b){a.stop(),this.send(b)}function cb(a,b){var d=a[0],e,f,g=ca(a),h=!c.keys(g).length;return(b.$listeners||[]).filter(function(a){return a.dr&&a.n===d&&(h||function(){for(var b in g)if(a.dr===b)for(e=0,f=g[b];e<f.length;e++)if(!f[e].length||f[e][0]===a.dc)return!0;return!1}())})}function ca(a){var b=J(a),c=b[1]||{},d={},e;y(c)?(d[c]=b.slice(2),B(d[c][0])&&(d[c]=d[c][0].map(N))):d=c;for(e in d)d[e]=N(d[e]),d[e]=B(d[e][0])?d[e]:[d[e]];return d}function b_(a,b,c){var d=J(b),e=d.shift();return function(b){var c=b.find(a);return c===i?c:typeof e==="string"?c[e].apply(c,d):e.apply(c,[b].concat(d))}}function b$(){bW&&(bW=!1,bq?(b.attachEvent("onmouseover",bY),a.attachEvent("blur",bZ)):(b.addEventListener("mouseover",bY,!1),a.addEventListener("blur",bZ,!1)))}function bZ(a){bV.each(function(b,c){b&&q[c]&&bX(a,q[c]._,c,!1)})}function bY(a){var b=a.target||a.srcElement,c=a.relatedTarget||a.fromElement,d=b,e=!1,f=[],g,h;while(d.nodeType===1)g=I(d),bV[g]===i&&bX(a,d,g,bV[g]=!0),d===c&&(e=!0),f.push(d),d=d.parentNode;if(c&&!e)while(c!==null&&c.nodeType===1&&f.indexOf(c)===-1)g=I(c),bV[g]!==i&&bX(a,c,g,bV[g]=i),c=c.parentNode}function bX(a,b,c,d){var e=new bD(a);e.type=d===!0?"mouseenter":"mouseleave",e.bubbles=!1,e.stopped=!0,e.target=bz(b),e.find=function(a){return F(a,!0).indexOf(this.target._)===-1?i:this.target},e.target.fire(e),bB.fire(e)}function bU(a){var b=new bD(a),c=b.target,d=c.parent&&c.parent();b.type=a.type==="focusin"||a.type==="focus"?"focus":"blur",d&&d.fire(b)}function bR(a){a=H(a),bE=bE.concat(a),bl(bF.prototype,a),bl(bA.prototype,a)}function bQ(a,b){b=b.camelize();if(b==="opacity")return bt?(/opacity=(\d+)/i.exec(a.filter||"")||["","100"])[1].toInt()/100+"":a[b].replace(",",".");b==="float"&&(b=bq?"styleFloat":"cssFloat");var c=a[b];bp&&/color/i.test(b)&&c&&(c=c.replace(/"/g,""));return c}function bP(a,b){if(typeof b==="string"){var c=a.tagName,d=bO,e=c in bM?bM[c]:["","",1],f=e[2];d.innerHTML=e[0]+"<"+c+">"+b+"</"+c+">"+e[1];while(f--!==0)d=d.firstChild;b=d.childNodes;while(b.length!==0)bN.appendChild(b[0])}else for(var g=0,h=b.length,i;g<h;g++)i=b[b.length===h?g:0],bN.appendChild(i instanceof bF?i._:i);return bN}function bK(a,b,c){var d=a._,e=[],f=0,g=!c;while(d=d[b])d.nodeType===1&&(g||bz(d).match(c))&&(e[f++]=bz(d));return e}function bJ(a,b,c){if(typeof b==="string"){a._=bI(b,c);if(c!==i)for(var d in c)switch(d){case"id":a._.id=c[d];break;case"html":a._.innerHTML=c[d];break;case"class":a._.className=c[d];break;case"on":a.on(c[d]);break;default:a.set(d,c[d])}}else a._=b}function bz(a){if(a!=null){var b=r in a?q[a[r]]:i;if(b!==i)return b;if(a.nodeType===1)return new bF(a);if(a.nodeType===9)return new bA(a);if(a.window==a)return new bC(a);if(C(a.target)||C(a.srcElement))return new bD(a)}return a}function by(a,b){typeof a==="string"&&(a=s({type:a},b),this.stopped=a.bubbles===!1,A(b)&&s(this,b)),this._=a,this.type=a.type,this.which=a.which,this.keyCode=a.keyCode,this.target=bz(a.target!=null&&"nodeType"in a.target&&a.target.nodeType===3?a.target.parentNode:a.target),this.currentTarget=bz(a.currentTarget),this.relatedTarget=bz(a.relatedTarget),this.pageX=a.pageX,this.pageY=a.pageY;if(bs&&"srcElement"in a){this.which=a.button===2?3:a.button===4?2:1,this.target=bz(a.srcElement)||b,this.relatedTarget=this.target._===a.fromElement?bz(a.toElement):this.target,this.currentTarget=b;var c=this.target.win().scrolls();this.pageX=a.clientX+c.x,this.pageY=a.clientY+c.y}}function bx(a,b){bJ(this,a,b);var c=this,d=c._,e=bv.Cast(d),f=r in d?d[r]:d[r]=p++;e!==i&&(c=new e(d,b),"$listeners"in this&&(c.$listeners=this.$listeners)),q[f]=c;return c}function bw(){return function(a,b){bh(this),this.initialize.apply(this,arguments);var c=this._,d=r in c?c[r]:c[r]=(c.nodeType===1?1:-1)*p++;q[d]=this}}function bn(a,b,c,d){if(A(b))for(var e in b)a.stopObserving(e,b[e]);else y(b)||(c=b,b=null),y(c)&&(c=a[c]),a.$listeners=(a.$listeners||[]).filter(function(a){var e=b&&c?a.e!==b||a.f!==c:b?a.e!==b:a.f!==c;e||d(a);return e})}function bm(a,b,c){var d=n.call(b,2),e=b[0],f=b[1],g=!1;if(y(e))switch(typeof f){case"string":g=f,f=f in a?a[f]:function(){};case"function":("$listeners"in a?a.$listeners:a.$listeners=[]).push(c({e:e,f:f,a:d,r:g||!1,t:a}));break;default:if(B(f))for(var h=0;h<f.length;h++)a.on.apply(a,[e].concat(N(f[h])).concat(d))}else{d=n.call(b,1);for(g in e)a.on.apply(a,[g].concat(N(e[g])).concat(d))}}function bh(a){"prebind"in a&&B(a.prebind)&&a.prebind.each(function(b){a[b]=a[b].bind(a)})}function bg(a,b){var c=b.toUpperCase(),d=a.constructor,e=[a,d].concat(d.ancestors||[]),f=0;for(l=e.length;f<l;f++){if(c in e[f])return e[f][c];if(b in e[f])return e[f][b]}return null}function bf(a,b,c){(b[bd[c?0:2]]||b[bd[c?1:3]]||function(){}).call(b,a)}function be(a,b){return c.without.apply(c,[a].concat(bd.concat(b?H("prototype parent ancestors"):["constructor"])))}function ba(a,b){return a>b?1:a<b?-1:0}function _(a){return!!a}function $(a,b,c){try{return a.apply(b,Y(c,b))}catch(d){if(!(d instanceof Z))throw d}return i}function Z(){}function Y(a,b){var c=a[0],d=n.call(a,1),e=b,f;typeof c==="string"?(f=c,b.length!==0&&typeof b[0][f]==="function"?c=function(a){return a[f].apply(a,d)}:c=function(a){return a[f]}):e=d[0];return[c,e]}function N(a){return B(a)?a:[a]}function K(a){return s(a,{Methods:{},include:function(){for(var b=0,c=arguments.length;b<c;b++)A(arguments[b])&&(s(a.prototype,arguments[b]),s(a.Methods,arguments[b]))}})}var j=function(a){return a};j.version="2.2.3",j.modules=["core","dom","form","events","xhr","fx","cookie"];var k=d.prototype,m=c.prototype.toString,n=k.slice,o=b.documentElement,p=1,q=[],r="uniqueNumber",s=j.$ext=function(a,b,c){var d=b||{},e;for(e in d)if(!c||!(e in a))a[e]=d[e];return a},t=j.$eval=function(b){b&&("execScript"in a?bB.win()._.execScript(b):G("script",{text:b}).insertTo(o))},u=j.$break=function(){throw new Z},v=j.$alias=function(a,b){for(var c in b)a[c]=a[b[c]];return a},w=j.defined=function(a){return typeof a!=="undefined"},x=j.isFunction=function(a){return typeof a==="function"},y=j.isString=function(a){return typeof a==="string"},z=j.isNumber=function(a){return typeof a==="number"},A=j.isHash=function(a){return m.call(a)==="[object Object]"},B=j.isArray=function(a){return m.call(a)==="[object Array]"},C=j.isElement=function(a){return a!=null&&a.nodeType===1},D=j.isNode=function(a){return a!=null&&a.nodeType!=null},E=j.$=function(a){if(a instanceof bv)return a;typeof a==="string"&&(a=b.getElementById(a));return bz(a)},F=j.$$=function(a,b){return bB.find(a,b)},G=j.$E=function(a,b){return new bF(a,b)},H=j.$w=function(a){return a.trim().split(/\s+/)},I=j.$uid=function(a){return r in a?a[r]:a[r]=p++},J=j.$A=function(a){return n.call(a,0)};k.map||(J=j.$A=function(a){try{return n.call(a,0)}catch(b){for(var c=[],d=0,e=a.length;d<e;d++)c[d]=a[d];return c}}),A(o)&&(A=j.isHash=function(a){return m.call(a)==="[object Object]"&&a!=null&&a.hasOwnProperty!=null});for(var L=0,M="Array Function Number String Date RegExp".split(" ");L<M.length;L++)j[M[L]]=K((new f("return "+M[L]))());j.Object=c,j.Math=h,s(c,{keys:function(a){var b=[],c;for(c in a)b.push(c);return b},values:function(a){var b=[],c;for(c in a)b.push(a[c]);return b},each:function(a,b,c){for(var d in a)b.call(c,d,a[d]);return a},empty:function(a){for(var b in a)return!1;return!0},clone:function(a){return c.merge(a)},without:function(){var a=J(arguments),b=a.shift(),c={},d;for(d in b)a.include(d)||(c[d]=b[d]);return c},only:function(){var a=J(arguments),b=a.shift(),c={},d=0,e=a.length;for(;d<e;d++)a[d]in b&&(c[a[d]]=b[a[d]]);return c},merge:function(){var a={},b=0,d=arguments,e;for(l=d.length;b<l;b++)if(A(d[b]))for(e in d[b])a[e]=A(d[b][e])&&!(d[b][e]instanceof bb)?c.merge(e in a?a[e]:{},d[b][e]):d[b][e];return a},toQueryString:function(a){var b=[],c,d,e=encodeURIComponent;for(c in a){d=N(a[c]);for(var f=0,g=d.length;f<g;f++)b.push(e(c)+"="+e(d[f]))}return b.join("&")}},!0);var O=h.random;h.random=function(a,b){if(arguments.length===0)return O();arguments.length===1&&(b=a,a=0);return~~(O()*(b-a+1)+~~a)};var P=k.sort,Q=k.forEach||function(a,b){for(var c=0,d=this.length;c<d;c++)a.call(b,this[c],c,this)},R=k.filter||function(a,b){for(var c=[],d=0,e=0,f=this.length;e<f;e++)a.call(b,this[e],e,this)&&(c[d++]=this[e]);return c},S=function(a,b){for(var c=[],d=0,e=0,f=this.length;e<f;e++)a.call(b,this[e],e,this)||(c[d++]=this[e]);return c},T=k.map||function(a,b){for(var c=[],d=0,e=this.length;d<e;d++)c[d]=a.call(b,this[d],d,this);return c},U=k.some||function(a,b){for(var c=0,d=this.length;c<d;c++)if(a.call(b,this[c],c,this))return!0;return!1},V=k.every||function(a,b){for(var c=0,d=this.length;c<d;c++)if(!a.call(b,this[c],c,this))return!1;return!0},W=function(a,b){for(var c=0,d=this.length;c<d;c++)if(a.call(b,this[c],c,this))return this[c];return i},X=function(a,b){for(var c=this.length-1;c>-1;c--)if(a.call(b,this[c],c,this))return this[c];return i};d.include({indexOf:k.indexOf||function(a,b){for(var c=b<0?h.max(0,this.length+b):b||0,d=this.length;c<d;c++)if(this[c]===a)return c;return-1},lastIndexOf:k.lastIndexOf||function(a){for(var b=this.length-1;b>-1;b--)if(this[b]===a)return b;return-1},first:function(){return arguments.length?$(W,this,arguments):this[0]},last:function(){return arguments.length?$(X,this,arguments):this[this.length-1]},random:function(){return this.length===0?i:this[h.random(this.length-1)]},size:function(){return this.length},clean:function(){this.length=0;return this},empty:function(){return this.length===0},clone:function(){return this.slice(0)},each:function(){$(Q,this,arguments);return this},forEach:Q,map:function(){return $(T,this,arguments)},filter:function(){return $(R,this,arguments)},reject:function(){return $(S,this,arguments)},some:function(a){return $(U,this,a?arguments:[_])},every:function(a){return $(V,this,a?arguments:[_])},walk:function(){this.map.apply(this,arguments).forEach(function(a,b){this[b]=a},this);return this},merge:function(){for(var a=this.clone(),b,c=0;c<arguments.length;c++){b=N(arguments[c]);for(var d=0;d<b.length;d++)a.indexOf(b[d])==-1&&a.push(b[d])}return a},flatten:function(){var a=[];this.forEach(function(b){B(b)?a=a.concat(b.flatten()):a.push(b)});return a},compact:function(){return this.without(null,i)},uniq:function(){return[].merge(this)},includes:function(){for(var a=0;a<arguments.length;a++)if(this.indexOf(arguments[a])===-1)return!1;return!0},without:function(){var a=n.call(arguments);return this.filter(function(b){return a.indexOf(b)===-1})},shuffle:function(){var a=this.clone(),b,c,d=a.length;for(;d>0;b=h.random(d-1),c=a[--d],a[d]=a[b],a[b]=c){}return a},sort:function(a){return P.apply(this,a||!z(this[0])?arguments:[ba])},sortBy:function(){var a=Y(arguments,this);return this.sort(function(b,c){return ba(a[0].call(a[1],b),a[0].call(a[1],c))})},min:function(){return h.min.apply(h,this)},max:function(){return h.max.apply(h,this)},sum:function(){for(var a=0,b=0,c=this.length;b<c;a+=this[b++]){}return a}}),k.include=k.includes,e.include({empty:function(){return this==""},blank:function(){return this==!1},trim:e.prototype.trim||function(){var a=this.replace(/^\s\s*/,""),b=a.length;while(/\s/.test(a.charAt(--b))){}return a.slice(0,b+1)},stripTags:function(){return this.replace(/<\/?[^>]+>/ig,"")},stripScripts:function(a){var b="",c=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/img,function(a,c){b+=c+"\n";return""});a===!0?t(b):x(a)&&a(b,c);return c},extractScripts:function(){var a="";this.stripScripts(function(b){a=b});return a},evalScripts:function(){this.stripScripts(!0);return this},camelize:function(){return this.replace(/(\-|_)+(.)?/g,function(a,b,c){return c?c.toUpperCase():""})},underscored:function(){return this.replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/\-/g,"_").toLowerCase()},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},includes:function(a){return this.indexOf(a)!=-1},startsWith:function(a,b){return(b!==!0?this.indexOf(a):this.toLowerCase().indexOf(a.toLowerCase()))===0},endsWith:function(a,b){return this.length-(b!==!0?this.lastIndexOf(a):this.toLowerCase().lastIndexOf(a.toLowerCase()))===a.length},toInt:function(a){return parseInt(this,a===i?10:a)},toFloat:function(a){return parseFloat(a===!0?this:this.replace(",",".").replace(/(\d)-(\d)/,"$1.$2"))}}),e.prototype.include=e.prototype.includes,f.include({bind:function(){var a=J(arguments),b=a.shift(),c=this;return function(){return c.apply(b,a.length!==0||arguments.length!==0?a.concat(J(arguments)):a)}},bindAsEventListener:function(){var a=J(arguments),b=a.shift(),c=this;return function(d){return c.apply(b,[d].concat(a).concat(J(arguments)))}},curry:function(){return this.bind.apply(this,[this].concat(J(arguments)))},rcurry:function(){var a=J(arguments),b=this;return function(){return b.apply(b,J(arguments).concat(a))}},delay:function(){var a=J(arguments),b=a.shift(),c=new g(setTimeout(this.bind.apply(this,[this].concat(a)),b));c.cancel=function(){clearTimeout(this)};return c},periodical:function(){var a=J(arguments),b=a.shift(),c=new g(setInterval(this.bind.apply(this,[this].concat(a)),b));c.stop=function(){clearInterval(this)};return c},chain:function(){var a=J(arguments),b=a.shift(),c=this;return function(){var d=c.apply(c,arguments);b.apply(b,a);return d}}}),g.include({times:function(a,b){for(var c=0;c<this;c++)a.call(b,c);return this},upto:function(a,b,c){for(var d=this+0;d<=a;d++)b.call(c,d);return this},downto:function(a,b,c){for(var d=this+0;d>=a;d--)b.call(c,d);return this},abs:function(){return h.abs(this)},round:function(a){return a?parseFloat(this.toFixed(a)):h.round(this)},ceil:function(){return h.ceil(this)},floor:function(){return h.floor(this)},min:function(a){return this<a?a:this+0},max:function(a){return this>a?a:this+0}}),RegExp.escape=function(a){return(""+a).replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1")};var bb=j.Class=function(){var a=J(arguments).slice(0,2),b=a.pop()||{},c=a.pop(),d=arguments[2],e=function(){};!a.length&&!A(b)&&(c=b,b={}),!d&&c&&(c===bv||c.ancestors.include(bv))&&(d=bw()),d=s(d||function(){bh(this);return"initialize"in this?this.initialize.apply(this,arguments):this},bc),c=c||bb,e.prototype=c.prototype,d.prototype=new e,d.parent=c,d.prototype.constructor=d,d.ancestors=[];while(c)d.ancestors.push(c),c=c.parent;["extend","include"].each(function(a){a in b&&d[a].apply(d,N(b[a]))});return d.include(b)},bc={extend:function(){J(arguments).filter(A).each(function(a){s(this,be(a,!0)),bf(this,a,!0)},this);return this},include:function(){var a=[this].concat(this.ancestors);J(arguments).filter(A).each(function(b){c.each(be(b,!1),function(b,c){for(var d,e=0,f=a.length;e<f;e++)if(b in a[e].prototype){d=a[e].prototype[b];break}this.prototype[b]=x(c)&&x(d)?function(){this.$super=d;return c.apply(this,arguments)}:c},this),bf(this,b,!1)},this);return this}},bd=H("selfExtended self_extended selfIncluded self_included extend include");s(bb,bc),bb.prototype.$super=i;var bi=j.Options={setOptions:function(a){var b=this.options=s(s({},c.clone(bg(this,"Options"))),a),d,e;if(x(this.on))for(e in b)if(d=e.match(/on([A-Z][A-Za-z]+)/))this.on(d[1].toLowerCase(),b[e]),delete b[e];return this},cutOptions:function(a){var b=J(a);this.setOptions(A(b.last())?b.pop():{});return b}},bj=j.Observer=new bb({include:bi,initialize:function(a){this.setOptions(a),bl(this,bg(this,"Events"));return this},on:function(){bm(this,arguments,function(a){return a});return this},observes:function(a,b){y(a)||(b=a,a=null),y(b)&&(b=b in this?this[b]:null);return(this.$listeners||[]).some(function(c){return a&&b?c.e===a&&c.f===b:a?c.e===a:c.f===b})},stopObserving:function(a,b){bn(this,a,b,function(){});return this},listeners:function(a){return(this.$listeners||[]).filter(function(b){return!a||b.e===a}).map(function(a){return a.f}).uniq()},fire:function(){var a=J(arguments),b=a.shift();(this.$listeners||[]).each(function(c){c.e===b&&c.f.apply(this,c.a.concat(a))},this);return this}}),bk=bj.create=function(a,b){s(a,c.without(bj.prototype,"initialize","setOptions"),!0);return bl(a,b||bg(a,"Events"))},bl=bj.createShortcuts=function(a,b){(b||[]).each(function(b){var c="on"+b.replace(/(^|_|:)([a-z])/g,function(a,b,c){return c.toUpperCase()});c in a||(a[c]=function(){return this.on.apply(this,[b].concat(J(arguments)))})});return a},bo=navigator.userAgent,bp="opera"in a,bq="attachEvent"in a&&!bp,br=j.Browser={IE:bq,Opera:bp,WebKit:bo.include("AppleWebKit/"),Gecko:bo.include("Gecko")&&!bo.include("KHTML"),MobileSafari:/Apple.*Mobile.*Safari/.test(bo),Konqueror:bo.include("Konqueror"),OLD:!b.querySelector,IE8L:!1},bs=!1,bt=!("opacity"in o.style)&&"filter"in o.style;try{b.createElement("<input/>"),br.OLD=br.IE8L=bs=!0}catch(bu){}var bv=j.Wrapper=new bb({_:i,initialize:function(a){this._=a}});bv.Cache=q,bv.Cast=function(a){return a.tagName in bG?bG[a.tagName]:i};var bA=j.Document=new bb(bv,{win:function(){return bz(this._.defaultView||this._.parentWindow)}}),bB=bz(b),bC=j.Window=new bb(bv,{win:function(){return this},size:function(){var a=this._,b=a.document.documentElement;return a.innerWidth?{x:a.innerWidth,y:a.innerHeight}:{x:b.clientWidth,y:b.clientHeight}},scrolls:function(){var a=this._,b=a.document,c=b.body,d=b.documentElement;return a.pageXOffset||a.pageYOffset?{x:a.pageXOffset,y:a.pageYOffset}:c&&(c.scrollLeft||c.scrollTop)?{x:c.scrollLeft,y:c.scrollTop}:{x:d.scrollLeft,y:d.scrollTop}},scrollTo:function(a,b,c){var d=a,e=b,f=z(a)?null:E(a);f instanceof bF&&(a=f.position()),A(a)&&(e=a.y,d=a.x),A(c=c||b)&&j.Fx?(new cf.Scroll(this,c)).start({x:d,y:e}):this._.scrollTo(d,e);return this}}),bD=j.Event=new bb(bv,{type:null,which:null,keyCode:null,target:null,currentTarget:null,relatedTarget:null,pageX:null,pageY:null,initialize:by,stopPropagation:function(){this._.stopPropagation?this._.stopPropagation():this._.cancelBubble=!0,this.stopped=!0;return this},preventDefault:function(){this._.preventDefault?this._.preventDefault():this._.returnValue=!1;return this},stop:function(){return this.stopPropagation().preventDefault()},position:function(){return{x:this.pageX,y:this.pageY}},offset:function(){if(this.target instanceof bF){var a=this.target.position();return{x:this.pageX-a.x,y:this.pageY-a.y}}return null},find:function(a){if(this.target instanceof bv&&this.currentTarget instanceof bv){var b=this.target._,c=this.currentTarget.find(a,!0);while(b){if(c.indexOf(b)!==-1)return bz(b);b=b.parentNode}}return i}},by),bE=[],bF=j.Element=new bb(bv,{initialize:function(a,b){bJ(this,a,b)}},bx),bG=bF.Wrappers={},bH={},bI=function(a,c){return(a in bH?bH[a]:bH[a]=b.createElement(a)).cloneNode(!1)};bs&&(bI=function(a,c){a==="input"&&c!==i&&(a='<input name="'+c.name+'" type='+c.type+(c.checked?" checked":"")+"/>");return b.createElement(a)}),bF.include({parent:function(a){var b=this._.parentNode,c=b&&b.nodeType;return a?this.parents(a)[0]:c===1||c===9?bz(b):null},parents:function(a){return bK(this,"parentNode",a)},children:function(a){return this.find(a).filter(function(a){return a._.parentNode===this._},this)},siblings:function(a){return this.prevSiblings(a).reverse().concat(this.nextSiblings(a))},nextSiblings:function(a){return bK(this,"nextSibling",a)},prevSiblings:function(a){return bK(this,"previousSibling",a)},next:function(a){return!a&&this._.nextElementSibling!==i?bz(this._.nextElementSibling):this.nextSiblings(a)[0]},prev:function(a){return!a&&this._.previousElementSibling!==i?bz(this._.previousElementSibling):this.prevSiblings(a)[0]},remove:function(){var a=this._,b=a.parentNode;b&&b.removeChild(a);return this},insert:function(a,b){var c=null,d=this._;b=b===i?"bottom":b,typeof a!=="object"?c=a=""+a:a instanceof bF&&(a=a._),bL[b](d,a.nodeType===i?bP(b==="bottom"||b==="top"?d:d.parentNode,a):a),c!==null&&c.evalScripts();return this},insertTo:function(a,b){E(a).insert(this,b);return this},append:function(a){return this.insert(y(a)?J(arguments).join(""):arguments)},update:function(a){if(typeof a!=="object"){a=""+a;try{this._.innerHTML=a}catch(b){return this.clean().insert(a)}a.evalScripts();return this}return this.clean().insert(a)},html:function(a){return a===i?this._.innerHTML:this.update(a)},text:function(a){return a===i?this._.textContent||this._.innerText:this.update(this.doc()._.createTextNode(a))},replace:function(a){return this.insert(a,"instead")},wrap:function(a){var b=this._,c=b.parentNode;c&&(a=E(a)._,c.replaceChild(a,b),a.appendChild(b));return this},clean:function(){while(this._.firstChild)this._.removeChild(this._.firstChild);return this},empty:function(){return this.html().blank()},clone:function(){return new bF(this._.cloneNode(!0))},index:function(){var a=this._,b=a.parentNode.firstChild,c=0;while(b!==a)b.nodeType===1&&c++,b=b.nextSibling;return c}});var bL={bottom:function(a,b){a.appendChild(b)},top:function(a,b){a.firstChild!==null?a.insertBefore(b,a.firstChild):a.appendChild(b)},after:function(a,b){var c=a.parentNode,d=a.nextSibling;d!==null?c.insertBefore(b,d):c.appendChild(b)},before:function(a,b){a.parentNode.insertBefore(b,a)},instead:function(a,b){a.parentNode.replaceChild(b,a)}},bM={TBODY:["<TABLE>","</TABLE>",2],TR:["<TABLE><TBODY>","</TBODY></TABLE>",3],TD:["<TABLE><TBODY><TR>","</TR></TBODY></TABLE>",4],COL:["<TABLE><COLGROUP>","</COLGROUP><TBODY></TBODY></TABLE>",2],LEGEND:["<FIELDSET>","</FIELDSET>",2],AREA:["<map>","</map>",2],OPTION:["<SELECT>","</SELECT>",2]};v(bM,{OPTGROUP:"OPTION",THEAD:"TBODY",TFOOT:"TBODY",TH:"TD"});var bN=b.createDocumentFragment(),bO=b.createElement("DIV");bF.include({setStyle:function(a,b){var c,d,e={},f=this._.style;b!==i?(e[a]=b,a=e):y(a)&&(a.split(";").each(function(a){var b=a.split(":").map("trim");b[0]&&b[1]&&(e[b[0]]=b[1])}),a=e);for(c in a)d=c.indexOf("-")<0?c:c.camelize(),bt&&c==="opacity"?f.filter="alpha(opacity="+a[c]*100+")":c==="float"&&(d=bq?"styleFloat":"cssFloat"),f[d]=a[c];return this},getStyle:function(a){return bQ(this._.style,a)||bQ(this.computedStyles(),a)},computedStyles:o.currentStyle?function(){return this._.currentStyle||{}}:o.runtimeStyle?function(){return this._.runtimeStyle||{}}:function(){return this._.ownerDocument.defaultView.getComputedStyle(this._,null)},hasClass:function(a){return(" "+this._.className+" ").indexOf(" "+a+" ")!=-1},setClass:function(a){this._.className=a;return this},getClass:function(){return this._.className},addClass:function(a){var b=" "+this._.className+" ";b.indexOf(" "+a+" ")==-1&&(this._.className+=(b===" "?"":" ")+a);return this},removeClass:function(a){this._.className=(" "+this._.className+" ").replace(" "+a+" "," ").trim();return this},toggleClass:function(a){return this[this.hasClass(a)?"removeClass":"addClass"](a)},radioClass:function(a){this.siblings().each("removeClass",a);return this.addClass(a)}}),bF.include({set:function(a,b){if(typeof a==="string"){var c={};c[a]=b,a=c}var d,e=this._;for(d in a)d==="style"?this.setStyle(a[d]):(d in e||e.setAttribute(d,""+a[d]),e[d]=a[d]);return this},get:function(a){var b=this._,c=b[a]||b.getAttribute(a);return c===""?null:c},has:function(a){return this.get(a)!==null},erase:function(a){this._.removeAttribute(a);return this},hidden:function(){return this.getStyle("display")==="none"},visible:function(){return!this.hidden()},hide:function(a,b){this.visible()&&(this._d=this.getStyle("display"),this._.style.display="none");return this},show:function(){if(this.hidden()){var a=this._,b=this._d,c;if(!b||b==="none")c=G(a.tagName).insertTo(o),b=c.getStyle("display"),c.remove();b==="none"&&(b="block"),a.style.display=b}return this},toggle:function(){return this[this.visible()?"hide":"show"]()},radio:function(a,b){this.siblings().each("hide",a,b);return this.show()}}),bF.include({doc:function(){return bz(this._.ownerDocument)},win:function(){return this.doc().win()},size:function(){return{x:this._.offsetWidth,y:this._.offsetHeight}},position:function(){var a=this._.getBoundingClientRect(),b=this.doc()._.documentElement,c=this.win().scrolls();return{x:a.left+c.x-b.clientLeft,y:a.top+c.y-b.clientTop}},scrolls:function(){return{x:this._.scrollLeft,y:this._.scrollTop}},dimensions:function(){var a=this.size(),b=this.scrolls(),c=this.position();return{top:c.y,left:c.x,width:a.x,height:a.y,scrollLeft:b.x,scrollTop:b.y}},overlaps:function(a){var b=this.position(),c=this.size();return a.x>b.x&&a.x<b.x+c.x&&a.y>b.y&&a.y<b.y+c.y},setWidth:function(a){var b=this._.style;b.width=a+"px",b.width=2*a-this._.offsetWidth+"px";return this},setHeight:function(a){var b=this._.style;b.height=a+"px",b.height=2*a-this._.offsetHeight+"px";return this},resize:function(a,b){A(a)&&(b=a.y,a=a.x);return this.setWidth(a).setHeight(b)},moveTo:function(a,b){A(a)&&(b=a.y,a=a.x);return this.setStyle({left:a+"px",top:b+"px"})},scrollTo:function(a,b){A(a)&&(b=a.y,a=a.x),this._.scrollLeft=a,this._.scrollTop=b;return this},scrollThere:function(a){this.win().scrollTo(this,a);return this}}),[bF,bA,bC].each("include",s(bk({}),{on:function(){bm(this,arguments,function(a){a.e==="mouseenter"||a.e==="mouseleave"?(b$(),a.n=a.e,a.w=function(){}):(a.e==="contextmenu"&&br.Konqueror?a.n="rightclick":a.e==="mousewheel"&&br.Gecko?a.n="DOMMouseScroll":a.n=a.e,a.w=function(b){b=new bD(b,a.t),a.f.apply(a.t,(a.r?[]:[b]).concat(a.a))===!1&&b.stop()},bs?a.t._.attachEvent("on"+a.n,a.w):a.t._.addEventListener(a.n,a.w,!1));return a});return this},stopObserving:function(a,b){bn(this,a,b,function(a){bs?a.t._.detachEvent("on"+a.n,a.w):a.t._.removeEventListener(a.n,a.w,!1)});return this},fire:function(a,b){var c=this.parent&&this.parent();a instanceof bD||(a=new bD(a,s({target:this._},b))),a.currentTarget=this,(this.$listeners||[]).each(function(b){b.e===a.type&&b.f.apply(this,(b.r?[]:[a]).concat(b.a))===!1&&a.stop()},this),c&&c.fire&&!a.stopped&&c.fire(a);return this},stopEvent:function(){return!1}})),bl(bC.prototype,H("blur focus scroll resize load")),bR("click rightclick contextmenu mousedown mouseup mouseover mouseout mousemove keypress keydown keyup"),[bF,bA].each("include",{first:function(a){return bz(a===i&&this._.firstElementChild!==i?this._.firstElementChild:this._.querySelector(a||"*"))},find:function(a,b){var c=this._.querySelectorAll(a||"*"),d,e=0,f=c.length;if(b===!0)d=J(c);else for(d=[];e<f;e++)d[e]=bz(c[e]);return d},match:function(a){var c=this._,d=c,e,f=!1;while(d.parentNode!==null&&d.parentNode.nodeType!==11)d=d.parentNode;c===d&&(d=b.createElement("div"),d.appendChild(c),f=!0),e=bz(d).find(a,!0).indexOf(c)!==-1,f&&d.removeChild(c);return e}}),bA.include({on:function(a){if(a==="ready"&&!this._iR){var b=this._,c=this.fire.bind(this,"ready");"readyState"in b?function(){["loaded","complete"].include(b.readyState)?c():arguments.callee.delay(50)}():b.addEventListener("DOMContentLoaded",c,!1),this._iR=!0}return this.$super.apply(this,arguments)}}),bl(bA.prototype,["ready"]);var bS=j.Form=bG.FORM=new bb(bF,{initialize:function(a){var b=a||{},d="remote"in b,e=b;A(b)&&!C(b)&&(e="form",b=c.without(b,"remote")),this.$super(e,b),d&&this.remotize()},elements:function(){return this.find("input,button,select,textarea")},inputs:function(){return this.elements().filter(function(a){return!["submit","button","reset","image",null].include(a._.type)})},input:function(a){return bz(this._[a])},focus:function(){var a=this.inputs().first(function(a){return a._.type!=="hidden"});a&&a.focus();return this},blur:function(){this.elements().each("blur");return this},disable:function(){this.elements().each("disable");return this},enable:function(){this.elements().each("enable");return this},values:function(){var a={},b,c,d,e;this.inputs().each(function(d){e=d._,c=e.name,!e.disabled&&c&&(!["checkbox","radio"].include(e.type)||e.checked)&&(b=d.getValue(),c.endsWith("[]")&&(b=(a[c]||[]).concat([b])),a[c]=b)});return a},serialize:function(){return c.toQueryString(this.values())},submit:function(){this._.submit();return this},reset:function(){this._.reset();return this}});bR("submit reset focus blur disable enable change");var bT=j.Input=bG.INPUT=bG.BUTTON=bG.SELECT=bG.TEXTAREA=bG.OPTGROUP=new bb(bF,{initialize:function(a,b){if(!a||A(a)&&!C(a))b=a||{},/textarea|select/.test(b.type||"")?(a=b.type,delete b.type):a="input";this.$super(a,b)},form:function(){return bz(this._.form)},insert:function(a,b){this.$super(a,b),this.find("option").each(function(a){a._.selected=!!a.get("selected")});return this},update:function(a){return this.clean().insert(a)},getValue:function(){return this._.type=="select-multiple"?this.find("option").map(function(a){return a._.selected?a._.value:null}).compact():this._.value},setValue:function(a){this._.type=="select-multiple"?(a=N(a).map(e),this.find("option").each(function(b){b._.selected=a.include(b._.value)})):this._.value=a;return this},value:function(a){return this[a===i?"getValue":"setValue"](a)},focus:function(){this._.focus(),this.focused=!0,bq&&this.fire("focus",{bubbles:!1});return this},blur:function(){this._.blur(),this.focused=!1,bq&&this.fire("blur",{bubbles:!1});return this},select:function(){this._.select();return this.focus()},disable:function(){this._.disabled=!0;return this.fire("disable")},enable:function(){this._.disabled=!1;return this.fire("enable")},disabled:function(a){return a===i?this._.disabled:this[a?"disable":"enable"]()},checked:function(a){a===i?a=this._.checked:(this._.checked=a,a=this);return a}});bs?(b.attachEvent("onfocusin",bU),b.attachEvent("onfocusout",bU)):(b.addEventListener("focus",bU,!0),b.addEventListener("blur",bU,!0));var bV=[],bW=!0;bR("mouseenter mouseleave"),[bF,bA].each("include",{delegate:function(a){var b=ca(arguments),c,d,e,f;for(c in b)for(d=0,f=b[c];d<f.length;d++)this.on(a,b_(c,f[d],this)),s(this.$listeners.last(),{dr:c,dc:f[d][0]});return this},undelegate:function(a){cb(arguments,this).each(function(a){this.stopObserving(a.n,a.f)},this);return this},delegates:function(){return!!cb(arguments,this).length}}),c.each({on:"delegate",stopObserving:"undelegate",observes:"delegates"},function(a,b){e.prototype[a]=function(){var a=J(arguments),c;a.splice(1,0,""+this),c=bB[b].apply(bB,a);return c===bB?this:c}});var cc=e.prototype.on;e.prototype.on=function(a){if(A(a))for(var b in a)cc.apply(this,[b].concat([a[b]]));else cc.apply(this,arguments);return this},bE.each(function(a){e.prototype["on"+a.capitalize()]=function(){return this.on.apply(this,[a].concat(J(arguments)))}}),H("Element Input Form").each(function(a){c.each(a in j?j[a].prototype:{},function(a,b){x(b)&&!(a in e.prototype)&&(e.prototype[a]=function(){var b=F(this,!0),c=0,d=b.length,e=!0,f,g;for(;c<d;c++){f=bz(b[c]),g=f[a].apply(f,arguments);if(e){if(g!==f)return g;e=!1}}return null})})});var cd=j.Xhr=new bb(bj,{extend:{EVENTS:H("success failure complete request cancel create"),Options:{headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript,text/html,application/xml,text/xml,*/*"},method:"post",encoding:"utf-8",async:!0,evalScripts:!1,evalResponse:!1,evalJS:!0,evalJSON:!0,secureJSON:!0,urlEncoded:!0,spinner:null,spinnerFx:"fade",params:null,iframed:!1,jsonp:!1},load:function(a,b){return(new this(a,s({method:"get"},b))).send()}},initialize:function(a,b){this.initCallbacks(),this.url=a,s(this.$super(b),this.options),this.params!=cd.Options.params&&(this.params=this.prepareData(cd.Options.params,this.params)),cd.Options.spinner&&E(this.spinner)===E(cd.Options.spinner)&&(this.spinner=null)},setHeader:function(a,b){this.headers[a]=b;return this},getHeader:function(a){var b;try{b=this.xhr.getResponseHeader(a)}catch(c){}return b},successful:function(){return this.status>=200&&this.status<300},send:function(a){var b={},c=this.url,d=this.method.toLowerCase(),e=this.headers,f,g;if(d=="put"||d=="delete")b._method=d,d="post";var h=this.prepareData(this.params,this.prepareParams(a),b);this.urlEncoded&&d=="post"&&!e["Content-type"]&&this.setHeader("Content-type","application/x-www-form-urlencoded;charset="+this.encoding),d=="get"&&(h&&(c+=(c.include("?")?"&":"?")+h),h=null),g=this.xhr=this.createXhr(),this.fire("create"),g.open(d,c,this.async),g.onreadystatechange=this.stateChanged.bind(this);for(f in e)g.setRequestHeader(f,e[f]);g.send(h),this.fire("request"),this.async||this.stateChanged();return this},update:function(a,b){return this.onSuccess(function(b){a.update(b.text)}).send(b)},cancel:function(){var a=this.xhr;if(!a||a.canceled)return this;a.abort(),a.onreadystatechange=function(){},a.canceled=!0;return this.fire("cancel")},fire:function(a){return this.$super(a,this,this.xhr)},createXhr:function(){return this.jsonp?new cd.JSONP(this):this.form&&this.form.first("input[type=file]")?new cd.IFramed(this.form):"ActiveXObject"in a?new ActiveXObject("MSXML2.XMLHTTP"):new XMLHttpRequest},prepareParams:function(a){a&&a instanceof bS&&(this.form=a,a=a.values());return a},prepareData:function(){return J(arguments).map(function(a){y(a)||(a=c.toQueryString(a));return a.blank()?null:a}).compact().join("&")},stateChanged:function(){var a=this.xhr;if(a.readyState==4&&!a.canceled){try{this.status=a.status}catch(b){this.status=0}this.text=this.responseText=a.responseText,this.xml=this.responseXML=a.responseXML,this.fire("complete").fire(this.successful()?"success":"failure")}},tryScripts:function(a){var b=this.getHeader("Content-type");this.evalResponse||this.evalJS&&/(ecma|java)script/i.test(b)?t(this.text):/json/.test(b)&&this.evalJSON?this.json=this.responseJSON=this.sanitizedJSON():this.evalScripts&&this.text.evalScripts()},sanitizedJSON:function(){if(!/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(this.text.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){if(this.secureJSON)throw"JSON error: "+this.text;return null}return"JSON"in a?JSON.parse(this.text):(new f("return "+this.text))()},initCallbacks:function(){this.on({success:"tryScripts",create:"showSpinner",complete:"hideSpinner",cancel:"hideSpinner"}),cd.EVENTS.each(function(a){this.on(a,function(){cd.fire(a,this,this.xhr)})},this)},showSpinner:function(){cd.showSpinner.call(this,this)},hideSpinner:function(){cd.hideSpinner.call(this,this)}});s(bk(cd),{counter:0,showSpinner:function(a){cd.trySpinner(a,"show")},hideSpinner:function(a){cd.trySpinner(a,"hide")},trySpinner:function(a,b){var c=a||cd.Options,d=E(c.spinner);d&&d[b](c.spinnerFx,{duration:100})},countIn:function(){cd.counter++,cd.showSpinner()},countOut:function(){cd.counter--,cd.counter<1&&cd.hideSpinner()}}).on({create:"countIn",complete:"countOut",cancel:"countOut"}),bS.include({send:function(a){a=a||{},a.method=a.method||this._.method||"post",this.xhr=(new cd(this._.action||b.location.href,s({spinner:this.first(".spinner")},a))).onComplete(this.enable.bind(this)).onCancel(this.enable.bind(this)).send(this),this.disable.bind(this).delay(1);return this},cancelXhr:function(){this.xhr instanceof cd&&this.xhr.cancel();return this},remotize:function(a){this.remote||(this.on("submit",ce,a),this.remote=!0);return this},unremotize:function(){this.stopObserving("submit",ce),this.remote=!1;return this}}),bF.include({load:function(a,b){(new cd(a,s({method:"get"},b))).update(this);return this}}),cd.Dummy={open:function(){},setRequestHeader:function(){},onreadystatechange:function(){}},cd.IFramed=new bb({include:cd.Dummy,initialize:function(a){this.form=a,this.id="xhr_"+(new Date).getTime(),this.form.doc().first("body").append('<i><iframe name="'+this.id+'" id="'+this.id+'" width="0" height="0" frameborder="0" src="about:blank"></iframe></i>',"after"),E(this.id).on("load",this.onLoad.bind(this))},send:function(){this.form.set("target",this.id).submit()},onLoad:function(){this.status=200,this.readyState=4,this.form.set("target","");try{this.responseText=a[this.id].document.documentElement.innerHTML}catch(b){}this.onreadystatechange()},abort:function(){E(this.id).set("src","about:blank")}}),cd.JSONP=new bb({include:cd.Dummy,prefix:"jsonp",initialize:function(a){this.xhr=a,this.name=this.prefix+(new Date).getTime(),this.param=(y(a.jsonp)?a.jsonp:"callback")+"="+this.name,this.script=G("script",{charset:a.encoding,async:a.async})},open:function(a,b,c){this.url=b,this.method=a},send:function(b){a[this.name]=this.finish.bind(this),this.script.set("src",this.url+(this.url.include("?")?"&":"?")+this.param+"&"+b).insertTo(F("script").last(),"after")},finish:function(a){this.status=200,this.readyState=4,this.xhr.json=this.xhr.responseJSON=a,this.onreadystatechange()},abort:function(){a[this.name]=function(){}}});var cf=j.Fx=new bb(bj,{extend:{EVENTS:H("start finish cancel"),Durations:{"short":200,normal:400,"long":800},Options:{fps:bs?40:60,duration:"normal",transition:"Sin",queue:!0},Transitions:{Sin:function(a){return-(h.cos(h.PI*a)-1)/2},Cos:function(a){return h.asin((a-.5)*2)/h.PI+.5},Exp:function(a){return h.pow(2,8*(a-1))},Log:function(a){return 1-h.pow(2,-8*a)},Lin:function(a){return a}}},initialize:function(a,b){this.$super(b),this.element=E(a),ci(this)},start:function(){if(cj(this,arguments))return this;var a=this.options,b=cf.Durations[a.duration]||a.duration,c=cf.Transitions[a.transition]||a.transition,d=(b/1e3*this.options.fps).ceil(),e=(1e3/this.options.fps).round();ck(this),this.prepare.apply(this,arguments),co(this,c,e,d);return this.fire("start",this)},finish:function(){cp(this),cl(this),this.fire("finish"),cm(this);return this},cancel:function(){cp(this),cl(this);return this.fire("cancel")},prepare:function(){},render:function(){}}),cg=[],ch=[];e.COLORS={maroon:"#800000",red:"#ff0000",orange:"#ffA500",yellow:"#ffff00",olive:"#808000",purple:"#800080",fuchsia:"#ff00ff",white:"#ffffff",lime:"#00ff00",green:"#008000",navy:"#000080",blue:"#0000ff",aqua:"#00ffff",teal:"#008080",black:"#000000",silver:"#c0c0c0",gray:"#808080",brown:"#a52a2a"},e.include({toHex:function(){var a=/^#(\w)(\w)(\w)$/.exec(this);a?a="#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:(a=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(this))?a="#"+a.slice(1).map(function(a){a=(a-0).toString(16);return a.length==1?"0"+a:a}).join(""):a=e.COLORS[this]||this;return a},toRgb:function(a){var b=/#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/i.exec(this.toHex()||"");b&&(b=b.slice(1).map("toInt",16),b=a?b:"rgb("+b+")");return b}}),bF.include({stop:function(){cn(this);return this},hide:function(a,b){return a&&this.visible()?cq(this,a,["out",b]):this.$super()},show:function(a,b){return a&&!this.visible()?cq(this,a,["in",b]):this.$super()},toggle:function(a,b){return a?cq(this,a,["toggle",b]):this.$super()},remove:function(a,b){return a&&this.visible()?cq(this,a,["out",s(b||{},{onFinish:this.$super.bind(this)})]):this.$super()},morph:function(a,b){return cq(this,"morph",[a,b||{}])},highlight:function(){return cq(this,"highlight",arguments)},fade:function(){return cq(this,"fade",arguments)},slide:function(){return cq(this,"slide",arguments)},scroll:function(a,b){return cq(this,"scroll",[a,b||{}])},scrollTo:function(a,b){return A(b)?this.scroll(a,b):this.$super.apply(this,arguments)}});var cr=["WebkitT","OT","MozT","MsT","t"].first(function(a){return a+"ransition"in o.style}),cs=cr+"ransition",ct=cs+"Property",cu=cs+"Duration",cv=cs+"TimingFunction",cw={Sin:"cubic-bezier(.3,0,.6,1)",Cos:"cubic-bezier(0,.3,.6,0)",Log:"cubic-bezier(0.6,.3,.8)",Exp:"cubic-bezier(.6,0,.8,.3)",Lin:"cubic-bezier(0,0,1,1)"};cf.Options.engine=cr===i||bp?"javascript":"native",cf.Morph=new bb(cf,{prepare:function(a){if(this.options.engine==="native"&&cr!==i)this.render=this.transition=function(){},cx.call(this,a);else{var b=cA(a),c=cF(this.element,b),d=cG(this.element,a,b);cE(this.element,c,d),this.before=cD(c),this.after=cD(d)}},render:function(a){var b,c,d,e=this.element._.style,f,g,i;for(f in this.after){b=this.before[f],c=this.after[f];for(g=0,i=c.length;g<i;g++)d=b[g]+(c[g]-b[g])*a,c.r&&(d=h.round(d)),c.t[g*2+1]=d;e[f]=c.t.join("")}}});var cy=H("Top Left Right Bottom");cf.Highlight=new bb(cf.Morph,{extend:{Options:c.merge(cf.Options,{color:"#FF8",transition:"Exp"})},prepare:function(a,b){var c=this.element,d=c._.style,e="backgroundColor",f=b||c.getStyle(e);cB(f)&&(this.onFinish(function(){d[e]="transparent"}),f=[c].concat(c.parents()).map("getStyle",e).reject(cB).compact().first()||"#FFF"),d[e]=a||this.options.color;return this.$super({backgroundColor:f})}}),cf.Twin=new bb(cf.Morph,{finish:function(){this.how==="out"&&bF.prototype.hide.call(this.element);return this.$super()},setHow:function(a){this.how=a||"toggle",this.how==="toggle"&&(this.how=this.element.visible()?"out":"in")}}),cf.Slide=new bb(cf.Twin,{extend:{Options:c.merge(cf.Options,{direction:"top"})},prepare:function(a){function f(){for(var a in e)d[a]=e[a]}this.setHow(a);var b=bF.prototype.show.call(this.element),d=b._.style,e=c.only(d,"overflow","width","height","marginTop","marginLeft");this.onFinish(f).onCancel(f),d.overflow="hidden";return this.$super(cH(d,b.size(),this.options.direction,this.how))}}),cf.Fade=new bb(cf.Twin,{prepare:function(a){this.setHow(a),this.how==="in"&&bF.prototype.show.call(this.element.setStyle({opacity:0}));return this.$super({opacity:this.how==="in"?1:0})}}),cf.Attr=new bb(cf,{prepare:function(a){this.before={},this.after=a;var b,c=this.element._;for(b in a)this.before[b]=c[b]},render:function(a){var b,c=this.element._,d=this.before;for(b in d)c[b]=d[b]+(this.after[b]-d[b])*a}}),cf.Scroll=new bb(cf.Attr,{initialize:function(a,b){a=E(a),this.$super(a instanceof bC?a._.document["body"in a._.document?"body":"documentElement"]:a,b)},prepare:function(a){var b={};"x"in a&&(b.scrollLeft=a.x),"y"in a&&(b.scrollTop=a.y),this.$super(b)}});var cI=j.Cookie=new bb({include:bi,extend:{set:function(a,b,c){return(new this(a,c)).set(b)},get:function(a){return(new this(a)).get()},remove:function(a){return(new this(a)).remove()},enabled:function(){b.cookie="__t=1";return b.cookie.indexOf("__t=1")!=-1},Options:{secure:!1,document:b}},initialize:function(a,b){this.name=a,this.setOptions(b)},set:function(a){var b=encodeURIComponent(a),c=this.options;c.domain&&(b+="; domain="+c.domain),c.path&&(b+="; path="+c.path);if(c.duration){var d=new Date;d.setTime(d.getTime()+c.duration*24*60*60*1e3),b+="; expires="+d.toGMTString()}c.secure&&(b+="; secure"),c.document.cookie=this.name+"="+b;return this},get:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+RegExp.escape(this.name)+"=([^;]*)");return a?decodeURIComponent(a[1]):null},remove:function(){this.options.duration=-1;return this.set("")}});s(a,c.without(j,"version","modules"));return j}(window,document,Object,Array,String,Function,Number,Math);RightJS.Browser.OLD&&function(a){var b=a.createElement("script"),c=a.getElementsByTagName("script"),d=c[c.length-1];b.src=d.src.replace(/(^|\/)(right)([^\/]+)$/,"$1$2-olds$3"),d.parentNode.appendChild(b)}(document)
@@ -1,625 +0,0 @@
1
- /**
2
- * RightJS-UI Autocompleter v2.2.1
3
- * http://rightjs.org/ui/autocompleter
4
- *
5
- * Copyright (C) 2010-2011 Nikolay Nemshilov
6
- */
7
- var Autocompleter = RightJS.Autocompleter = (function(document, RightJS) {
8
- /**
9
- * This module defines the basic widgets constructor
10
- * it creates an abstract proxy with the common functionality
11
- * which then we reuse and override in the actual widgets
12
- *
13
- * Copyright (C) 2010-2011 Nikolay Nemshilov
14
- */
15
-
16
- /**
17
- * The widget units constructor
18
- *
19
- * @param String tag-name or Object methods
20
- * @param Object methods
21
- * @return Widget wrapper
22
- */
23
- function Widget(tag_name, methods) {
24
- if (!methods) {
25
- methods = tag_name;
26
- tag_name = 'DIV';
27
- }
28
-
29
- /**
30
- * An Abstract Widget Unit
31
- *
32
- * Copyright (C) 2010 Nikolay Nemshilov
33
- */
34
- var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
35
- /**
36
- * The common constructor
37
- *
38
- * @param Object options
39
- * @param String optional tag name
40
- * @return void
41
- */
42
- initialize: function(key, options) {
43
- this.key = key;
44
- var args = [{'class': 'rui-' + key}];
45
-
46
- // those two have different constructors
47
- if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
48
- args.unshift(tag_name);
49
- }
50
- this.$super.apply(this, args);
51
-
52
- if (RightJS.isString(options)) {
53
- options = RightJS.$(options);
54
- }
55
-
56
- // if the options is another element then
57
- // try to dynamically rewrap it with our widget
58
- if (options instanceof RightJS.Element) {
59
- this._ = options._;
60
- if ('$listeners' in options) {
61
- options.$listeners = options.$listeners;
62
- }
63
- options = {};
64
- }
65
- this.setOptions(options, this);
66
-
67
- return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
68
- },
69
-
70
- // protected
71
-
72
- /**
73
- * Catches the options
74
- *
75
- * @param Object user-options
76
- * @param Element element with contextual options
77
- * @return void
78
- */
79
- setOptions: function(options, element) {
80
- if (element) {
81
- options = RightJS.Object.merge(options, new Function("return "+(
82
- element.get('data-'+ this.key) || '{}'
83
- ))());
84
- }
85
-
86
- if (options) {
87
- RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
88
- }
89
-
90
- return this;
91
- }
92
- });
93
-
94
- /**
95
- * Creating the actual widget class
96
- *
97
- */
98
- var Klass = new RightJS.Class(AbstractWidget, methods);
99
-
100
- // creating the widget related shortcuts
101
- RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([]));
102
-
103
- return Klass;
104
- }
105
-
106
-
107
- /**
108
- * A shared module to create textual spinners
109
- *
110
- * Copyright (C) 2010-2011 Nikolay Nemshilov
111
- */
112
- var Spinner = new RightJS.Class(RightJS.Element, {
113
- /**
114
- * Constructor
115
- *
116
- * @param Number optional spinner size (4 by default)
117
- * @return void
118
- */
119
- initialize: function(size) {
120
- this.$super('div', {'class': 'rui-spinner'});
121
- this.dots = [];
122
-
123
- for (var i=0; i < (size || 4); i++) {
124
- this.dots.push(new RightJS.Element('div'));
125
- }
126
-
127
- this.dots[0].addClass('glowing');
128
- this.insert(this.dots);
129
- RightJS(this.shift).bind(this).periodical(300);
130
- },
131
-
132
- /**
133
- * Shifts the spinner elements
134
- *
135
- * @return void
136
- */
137
- shift: function() {
138
- if (this.visible()) {
139
- var dot = this.dots.pop();
140
- this.dots.unshift(dot);
141
- this.insert(dot, 'top');
142
- }
143
- }
144
- });
145
-
146
-
147
- /**
148
- * A shared module that toggles a widget visibility status
149
- * in a uniformed way according to the options settings
150
- *
151
- * Copyright (C) 2010-2011 Nikolay Nemshilov
152
- */
153
- var Toggler = {
154
- /**
155
- * Shows the element
156
- *
157
- * @param String fx-name
158
- * @param Object fx-options
159
- * @return Element this
160
- */
161
- show: function(fx_name, fx_options) {
162
- this.constructor.current = this;
163
- return Toggler_toggle(this, 'show', fx_name, fx_options);
164
- },
165
-
166
- /**
167
- * Hides the element
168
- *
169
- * @param String fx-name
170
- * @param Object fx-options
171
- * @return Element this
172
- */
173
- hide: function(fx_name, fx_options) {
174
- this.constructor.current = null;
175
- return Toggler_toggle(this, 'show', fx_name, fx_options);
176
- },
177
-
178
- /**
179
- * Toggles the widget at the given element
180
- *
181
- * @param Element the related element
182
- * @param String position right/bottom (bottom is the default)
183
- * @param Boolean marker if the element should be resized to the element size
184
- * @return Widget this
185
- */
186
- showAt: function(element, where, resize) {
187
- this.hide(null).shownAt = element = RightJS.$(element);
188
-
189
- // moves this element at the given one
190
- Toggler_re_position.call(this, element, where, resize);
191
-
192
- return this.show();
193
- },
194
-
195
- /**
196
- * Toggles the widget at the given element
197
- *
198
- * @param Element the related element
199
- * @param String position top/left/right/bottom (bottom is the default)
200
- * @param Boolean marker if the element should be resized to the element size
201
- * @return Widget this
202
- */
203
- toggleAt: function(element, where, resize) {
204
- return this.hidden() ? this.showAt(element, where, resize) : this.hide();
205
- }
206
- };
207
-
208
-
209
- /**
210
- * toggles the element's state according to the current settings
211
- *
212
- * @param event String 'show' or 'hide' the event name
213
- * @param String an optional fx-name
214
- * @param Object an optional fx-options hash
215
- * @return void
216
- */
217
- function Toggler_toggle(element, event, fx_name, fx_options) {
218
- if (RightJS.Fx) {
219
- if (fx_name === undefined) {
220
- fx_name = element.options.fxName;
221
-
222
- if (fx_options === undefined) {
223
- fx_options = {
224
- duration: element.options.fxDuration,
225
- onFinish: RightJS(element.fire).bind(element, event)
226
- };
227
-
228
- // hide on double time
229
- if (event === 'hide') {
230
- fx_options.duration = (RightJS.Fx.Durations[fx_options.duration] ||
231
- fx_options.duration) / 2;
232
- }
233
- }
234
- }
235
- }
236
-
237
- // manually trigger the event if no fx were specified
238
- if (!RightJS.Fx || !fx_name) { element.fire(event); }
239
-
240
- return element.$super(fx_name, fx_options);
241
- }
242
-
243
- /**
244
- * Relatively positions the current element
245
- * against the specified one
246
- *
247
- * NOTE: this function is called in a context
248
- * of another element
249
- *
250
- * @param Element the target element
251
- * @param String position 'right' or 'bottom'
252
- * @param Boolean if `true` then the element size will be adjusted
253
- * @return void
254
- */
255
- function Toggler_re_position(element, where, resize) {
256
- var anchor = this.reAnchor || (this.reAnchor =
257
- new RightJS.Element('div', {'class': 'rui-re-anchor'}))
258
- .insert(this),
259
-
260
- pos = anchor.insertTo(element, 'after').position(),
261
- dims = element.dimensions(), target = this,
262
-
263
- border_top = parseInt(element.getStyle('borderTopWidth')),
264
- border_left = parseInt(element.getStyle('borderLeftWidth')),
265
- border_right = parseInt(element.getStyle('borderRightWidth')),
266
- border_bottom = parseInt(element.getStyle('borderBottomWidth')),
267
-
268
- top = dims.top - pos.y + border_top,
269
- left = dims.left - pos.x + border_left,
270
- width = dims.width - border_left - border_right,
271
- height = dims.height - border_top - border_bottom;
272
-
273
- // making the element to appear so we could read it's sizes
274
- target.setStyle('visibility:hidden').show(null);
275
-
276
- if (where === 'right') {
277
- left += width - target.size().x;
278
- } else { // bottom
279
- top += height;
280
- }
281
-
282
- target.moveTo(left, top);
283
-
284
- if (resize) {
285
- if (where === 'left' || where === 'right') {
286
- target.setHeight(height);
287
- } else {
288
- target.setWidth(width);
289
- }
290
- }
291
-
292
- // rolling the invisibility back
293
- target.setStyle('visibility:visible').hide(null);
294
- }
295
-
296
- /**
297
- * Autocompleter initializer
298
- *
299
- * Copyright (C) 2010 Nikolay Nemshilov
300
- */
301
- var R = RightJS,
302
- $ = RightJS.$,
303
- $w = RightJS.$w,
304
- $E = RightJS.$E,
305
- Xhr = RightJS.Xhr,
306
- RegExp = RightJS.RegExp,
307
- isArray = RightJS.isArray;
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
- /**
317
- * The RightJS UI Autocompleter unit base class
318
- *
319
- * Copyright (C) 2009-2011 Nikolay Nemshilov
320
- */
321
- var Autocompleter = new Widget('UL', {
322
- include: Toggler,
323
-
324
- extend: {
325
- version: '2.2.1',
326
-
327
- EVENTS: $w('show hide update load select done'),
328
-
329
- Options: {
330
- url: document.location.href,
331
- param: 'search',
332
- method: 'get',
333
-
334
- minLength: 1, // the minimal length when it starts work
335
- threshold: 200, // the typing pause threshold
336
-
337
- cache: true, // use the results cache
338
- local: null, // an optional local search results list
339
-
340
- fxName: 'slide', // list appearance fx name
341
- fxDuration: 'short', // list appearance fx duration
342
-
343
- spinner: 'native', // spinner element reference
344
-
345
- cssRule: 'input[data-autocompleter]' // the auto-initialization css-rule
346
- }
347
- },
348
-
349
- /**
350
- * basic constructor
351
- *
352
- * @param mixed the input element reference, a string id or the element instance
353
- * @param Object options
354
- */
355
- initialize: function(input, options) {
356
- this.input = $(input); // KEEP IT before the super call
357
-
358
- this
359
- .$super('autocompleter', options)
360
- .addClass('rui-dd-menu')
361
- .onMousedown(this.clicked);
362
-
363
- this.input.autocompleter = this;
364
- },
365
-
366
- /**
367
- * Destructor
368
- *
369
- * @return Autocompleter this
370
- */
371
- destroy: function() {
372
- delete(this.input.autocompleter);
373
- return this;
374
- },
375
-
376
- /**
377
- * picks the next item on the list
378
- *
379
- * @return Autocompleter this
380
- */
381
- prev: function() {
382
- return this.pick('prev');
383
- },
384
-
385
- /**
386
- * picks the next item on the list
387
- *
388
- * @return Autocompleter this
389
- */
390
- next: function() {
391
- return this.pick('next');
392
- },
393
-
394
- /**
395
- * triggers the done event, sets up the value and closes the list
396
- *
397
- * @return Autocompleter this
398
- */
399
- done: function(current) {
400
- current = current || this.first('li.current');
401
-
402
- if (current) {
403
- current.radioClass('current');
404
- this.input.setValue(current._.textContent || current._.innerText);
405
- this.fire('done');
406
- }
407
-
408
- return this.hide();
409
- },
410
-
411
- // protected
412
-
413
- // preprocessing the urls a bit
414
- setOptions: function(options) {
415
- this.$super(options, this.input);
416
-
417
- options = this.options;
418
-
419
- // building the correct url template with a placeholder
420
- if (!R(options.url).includes('%{search}')) {
421
- options.url += (R(options.url).includes('?') ? '&' : '?') + options.param + '=%{search}';
422
- }
423
- },
424
-
425
- // works with the 'prev' and 'next' methods
426
- pick: function(which_one) {
427
- var items = this.children(),
428
- current = items.first('hasClass', 'current'),
429
- index = items.indexOf(current);
430
-
431
- if (which_one == 'prev') {
432
- current = index < 1 ? items.last() : items[index < 0 ? 0 : (index-1)];
433
- } else if (which_one == 'next') {
434
- current = index < 0 || index == (items.length - 1) ?
435
- items.first() : items[index + 1];
436
- }
437
-
438
- return this.fire('select', {item: current.radioClass('current')});
439
- },
440
-
441
- // handles mouse clicks on the list element
442
- clicked: function(event) {
443
- this.done(event.stop().find('li'));
444
- },
445
-
446
- // handles the key-press events
447
- keypressed: function(event) {
448
- if (this.input.value().length >= this.options.minLength) {
449
- if (this.timeout) {
450
- this.timeout.cancel();
451
- }
452
- this.timeout = R(this.trigger).bind(this).delay(this.options.threshold);
453
- } else {
454
- return this.hide();
455
- }
456
- },
457
-
458
- // triggers the actual action
459
- trigger: function() {
460
- this.timeout = null;
461
-
462
- this.cache = this.cache || {};
463
- var search = this.input.value(), options = this.options;
464
-
465
- if (search.length < options.minLength) { return this.hide(); }
466
-
467
- if (this.cache[search]) {
468
- this.suggest(this.cache[search], search);
469
- } else if (isArray(options.local)) {
470
- this.suggest(this.findLocal(search), search);
471
- } else {
472
- this.request = Xhr.load(options.url.replace('%{search}', encodeURIComponent(search)), {
473
- method: options.method,
474
- spinner: this.getSpinner(),
475
- onComplete: R(function(response) {
476
- this.fire('load').suggest(response.text, search);
477
- }).bind(this)
478
- });
479
- }
480
- },
481
-
482
- // updates the suggestions list
483
- suggest: function(result_text, search) {
484
- // saving the result in cache
485
- if (this.options.cache) {
486
- this.cache[search] = result_text;
487
- }
488
-
489
- if (!R(result_text).blank()) {
490
- this.update(result_text.replace(/<ul[^>]*>|<\/ul>/im, ''));
491
- this.fire('update');
492
- if (!this._connected || this.hidden()) {
493
- this.showAt(this.input, 'bottom', 'resize');
494
- this._connected = true;
495
- }
496
- } else {
497
- this.hide();
498
- }
499
-
500
- return this;
501
- },
502
-
503
- // performs the locals search
504
- findLocal: function(search) {
505
- var regexp = new RegExp("("+RegExp.escape(search)+")", 'ig');
506
-
507
- return R(this.options.local).map(function(option) {
508
- if (option.match(regexp)) {
509
- return '<li>'+ option.replace(regexp, '<strong>$1</strong>') +'</li>';
510
- }
511
- }).compact().join('');
512
- },
513
-
514
- // builds a native textual spinner if necessary
515
- getSpinner: function() {
516
- var options = this.options, spinner = options.spinner;
517
-
518
- if (spinner == 'native') {
519
- spinner = options.spinner = new Spinner(3).insertTo(this);
520
- spinner.addClass('rui-autocompleter-spinner');
521
- }
522
-
523
- // positioning the native spinner
524
- if (spinner instanceof Spinner) {
525
- Toggler_re_position.call(spinner, this.input, 'right', 'resize');
526
- }
527
-
528
- return spinner;
529
- }
530
- });
531
-
532
-
533
- /**
534
- * The document events hooking
535
- *
536
- * Copyright (C) 2009-2010 Nikolay Nemshilov
537
- */
538
- $(document).on({
539
- /**
540
- * Initializes autocompleters on-focus
541
- *
542
- * @param Event focus
543
- * @return void
544
- */
545
- focus: function(event) {
546
- var target = event.target;
547
-
548
- if (target && (target instanceof RightJS.Element) && (target.autocompleter || target.match(Autocompleter.Options.cssRule))) {
549
- if (!target.autocompleter) {
550
- new Autocompleter(target);
551
- }
552
- }
553
- },
554
-
555
- /**
556
- * Hides autocompleters on-blur
557
- *
558
- * @param Event blur
559
- * @return void
560
- */
561
- blur: function(event) {
562
- var autocompleter = event.target ? event.target.autocompleter : null;
563
-
564
- if (autocompleter && autocompleter.visible()) {
565
- autocompleter.hide();
566
- }
567
- },
568
-
569
- /**
570
- * Catching the basic keyboard events
571
- * to navigate through the autocompletion list
572
- *
573
- * @param Event keydown
574
- * @return void
575
- */
576
- keydown: function(event) {
577
- var autocompleter = event.target ? event.target.autocompleter : null;
578
-
579
- if (autocompleter && autocompleter.visible()) {
580
- var method_name = ({
581
- 27: 'hide', // Esc
582
- 38: 'prev', // Up
583
- 40: 'next', // Down
584
- 13: 'done' // Enter
585
- })[event.keyCode];
586
-
587
- if (method_name) {
588
- event.stop();
589
- autocompleter[method_name]();
590
- }
591
- }
592
- },
593
-
594
- /**
595
- * Catches the input fields keyup events
596
- * and tries to make the autocompleter to show some suggestions
597
- *
598
- * @param Event keyup
599
- * @return void
600
- */
601
- keyup: function(event) {
602
- var autocompleter = event.target ? event.target.autocompleter : null;
603
-
604
- if (autocompleter && !R([9, 27, 37, 38, 39, 40, 13]).include(event.keyCode)) {
605
- autocompleter.keypressed(event);
606
- }
607
- }
608
- });
609
-
610
-
611
- var embed_style = document.createElement('style'),
612
- embed_rules = document.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}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}");
613
-
614
- embed_style.type = 'text/css';
615
- document.getElementsByTagName('head')[0].appendChild(embed_style);
616
-
617
- if(embed_style.styleSheet) {
618
- embed_style.styleSheet.cssText = embed_rules.nodeValue;
619
- } else {
620
- embed_style.appendChild(embed_rules);
621
- }
622
-
623
-
624
- return Autocompleter;
625
- })(document, RightJS);