sinatra_more 0.3.33 → 0.3.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * RightJS, http://rightjs.org
3
+ * Released under the MIT license
4
+ *
5
+ * Custom build with options: no-olds, server
6
+ *
7
+ * Copyright (C) 2008-2010 Nikolay Nemshilov
8
+ */
9
+ RightJS={version:"1.5.4",modules:["core","dom","form","cookie","xhr","fx"]};function $ext(d,s,a){var s=s||{},k;for(k in s)if(a===undefined||d[k]===undefined)d[k]=s[k];return d};function $try(){for(var i=0;i<arguments.length;i++)try{return arguments[i]()}catch(e){}};function $eval(t){if(!isString(t)||t.blank())return;if(window.execScript)window.execScript(t);else $E('script',{type:'text/javascript',text:t}).insertTo(document.body)}function $break(){throw new Break()};function $alias(o,n){for(var a in n)o[a]=o[n[a]];return o};function defined(v){return v!==undefined};function isFunction(v){return typeof(v)==='function'};function isString(v){return typeof(v)==='string'};function isNumber(v){return typeof(v)==='number'};function isElement(v){return v&&v.tagName};function isNode(v){return v&&v.nodeType};function $E(t,o){return new Element(t,o)};function $(e){return typeof(e)==='string'?document.getElementById(e):e};function $$(c){return $A(document.querySelectorAll(c))};function $w(s){return s.trim().split(/\s+/)}(function(){var t=Object.prototype.toString,s=Array.prototype.slice,U=1;isHash=function(v){return t.call(v)==='[object Object]'};if(isHash(document.documentElement))isHash=function(v){return t.call(v)==='[object Object]'&&v!==null&&v!==undefined&&v.hasOwnProperty!==undefined};isArray=function(v){return t.call(v)==='[object Array]'};$A=function(b){try{return s.call(b)}catch(e){for(var a=[],i=0,l=b.length;i<l;i++)a[i]=b[i];return a}};$uid=function(i){return i.uid||(i.uid=U++)}})();$ext(Object,{keys:function(o){var a=[],k;for(k in o)a.push(k);return a},values:function(o){var v=[],k;for(k in o)v.push(o[k]);return v},empty:function(o){for(var k in o)break;return!k},without:function(){var f=$A(arguments),o=f.shift(),c={},k;for(k in o)if(!f.includes(k))c[k]=o[k];return c},only:function(){var f=$A(arguments),o=f.shift(),c={},i=0,l=f.length;for(;i<l;i++)if(defined(o[f[i]]))c[f[i]]=o[f[i]];return c},merge:function(){var o={},i=0,l=arguments.length;for(;i<l;i++)if(isHash(arguments[i]))$ext(o,arguments[i]);return o},toQueryString:function(o){var t=[],k;for(k in o)t.push(k+'='+encodeURIComponent(o[k]));return t.join('&')}},true);$ext(Math,{random:function(a,m){var r=this._random();if(arguments.length==0)return r;if(arguments.length==1)var m=a,a=0;return Math.floor(r*(m-a+1)+a)},_random:Math.random});$ext(Array.prototype,(function(A){var q=A.forEach||function(c,s){for(var i=0,l=this.length;i<l;i++)c.call(s,this[i],i,this)};var m=A.filter||function(c,s){for(var r=[],i=0,j=0,l=this.length;i<l;i++)if(c.call(s,this[i],i,this))r[j++]=this[i];return r};var w=A.map||function(c,s){for(var r=[],i=0,l=this.length;i<l;i++)r[i]=c.call(s,this[i],i,this);return r};var y=A.some||function(c,s){for(var i=0,l=this.length;i<l;i++)if(c.call(s,this[i],i,this))return true;return false};var k=A.every||function(c,s){for(var i=0,l=this.length;i<l;i++)if(!c.call(s,this[i],i,this))return false;return true};function n(c,s){for(var i=0,l=this.length;i<l;i++)if(c.call(s,this[i],i,this))return this[i];return undefined};function u(c,s){for(var i=this.length-1;i>-1;i--)if(c.call(s,this[i],i,this))return this[i];return undefined};function t(a,b){var d=a[0],a=A.slice.call(a,1),s=b;if(isString(d)){var c=d;if(b.length&&isFunction(b[0][c]))d=function(o){return o[c].apply(o,a)};else d=function(o){return o[c]}}else s=a[0];return[d,s]};function h(f,s,a){try{return f.apply(s,t(a,s))}catch(e){if(!(e instanceof Break))throw(e)}};function g(a){return!!a};return{indexOf:A.indexOf||function(v,f){for(var i=(f<0)?Math.max(0,this.length+f):f||0,l=this.length;i<l;i++)if(this[i]===v)return i;return-1},lastIndexOf:A.lastIndexOf||function(v){for(var i=this.length-1;i>-1;i--)if(this[i]===v)return i;return-1},first:function(){return arguments.length?h(n,this,arguments):this[0]},last:function(){return arguments.length?h(u,this,arguments):this[this.length-1]},random:function(){return this.length?this[Math.random(this.length-1)]:null},size:function(){return this.length},clean:function(){this.length=0;return this},empty:function(){return!this.length},clone:function(){return this.slice(0)},each:function(){h(q,this,arguments);return this},forEach:q,map:function(){return h(w,this,arguments)},filter:function(){return h(m,this,arguments)},some:function(v){return h(y,this,v?arguments:[g])},every:function(v){return h(k,this,v?arguments:[g])},walk:function(){this.map.apply(this,arguments).forEach(function(v,a){this[a]=v},this);return this},merge:function(){for(var c=this.clone(),a,i=0,j,l=arguments.length;i<l;i++){a=arguments[i];if(isArray(a)){for(j=0;j<a.length;j++)if(c.indexOf(a[j])==-1)c.push(a[j])}else if(c.indexOf(a)==-1)c.push(a)}return c},flatten:function(){var c=[];this.forEach(function(v){if(isArray(v))c=c.concat(v.flatten());else c.push(v)});return c},compact:function(){return this.without(null,undefined)},uniq:function(){return[].merge(this)},includes:function(){for(var i=0,l=arguments.length;i<l;i++)if(this.indexOf(arguments[i])==-1)return false;return true},without:function(){var f=$A(arguments);return this.filter(function(v){return!f.includes(v)})},shuffle:function(){var s=this.clone(),j,x,i=s.length;for(;i;j=Math.random(i-1),x=s[--i],s[i]=s[j],s[j]=x);return s},sortBy:function(){var p=t(arguments,this);return this.map(function(b,a){return{item:b,value:p[0].call(p[1],b,a,this)}}).sort(function(c,d){return c.value>d.value?1:c.value<d.value?-1:0}).map('item')}}})(Array.prototype));$alias(Array.prototype,{include:'includes',all:'every',any:'some'});$ext(String.prototype,{empty:function(){return this==''},blank:function(){return/^\s*$/.test(this)},trim:String.prototype.trim||function(){var a=this.replace(/^\s\s*/,''),i=a.length;while(/\s/.test(a.charAt(--i)));return a.slice(0,i+1)},stripTags:function(){return this.replace(/<\/?[^>]+>/ig,'')},stripScripts:function(o){var a='',t=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/img,function(m,s){a+=s+"\n";return ''});if(o===true)$eval(a);else if(isFunction(o))o(a,t);return t},extractScripts:function(){var s='';this.stripScripts(function(a){s=a});return s},evalScripts:function(){$eval(this.extractScripts());return this},camelize:function(){var p=this.match(/^(\-|_)+?/g)||'';return p+this.substr(p.length,this.length).replace(/(\-|_)+?(\D)/g,function(m){return m.replace(/\-|_/,'').toUpperCase()})},underscored:function(){return this.replace(/([a-z0-9])([A-Z]+)/g,function(m,f,s){return f+"_"+(s.length>1?s:s.toLowerCase())}).replace(/\-/g,'_')},capitalize:function(){return this.replace(/(^|\s|\-|_)[a-z\u00e0-\u00fe\u0430-\u045f]/g,function(m){return m.toUpperCase()})},includes:function(s){return this.indexOf(s)!=-1},startsWith:function(a,i){var s=this.substr(0,a.length);return i?s.toLowerCase()===a.toLowerCase():s===a},endsWith:function(s,i){var e=this.substring(this.length-s.length);return i?e.toLowerCase()===s.toLowerCase():e===s},toInt:function(b){return parseInt(this,b||10)},toFloat:function(s){return parseFloat(s?this:this.replace(',','.').replace(/(\d)-(\d)/g,'$1.$2'))}});$alias(String.prototype,{include:'includes'});$ext(Function.prototype,{bind:function(){var a=$A(arguments),s=a.shift(),f=this;return function(){return f.apply(s,(a.length||arguments.length)?a.concat($A(arguments)):a)}},bindAsEventListener:function(){var a=$A(arguments),s=a.shift(),f=this;return function(e){return f.apply(s,[e||window.event].concat(a).concat($A(arguments)))}},curry:function(){return this.bind.apply(this,[this].concat($A(arguments)))},rcurry:function(){var c=$A(arguments),f=this;return function(){return f.apply(f,$A(arguments).concat(c))}},delay:function(){var a=$A(arguments),t=a.shift(),b=new Number(window.setTimeout(this.bind.apply(this,[this].concat(a)),t));b.cancel=function(){window.clearTimeout(this)};return b},periodical:function(){var a=$A(arguments),t=a.shift(),b=new Number(window.setInterval(this.bind.apply(this,[this].concat(a)),t));b.stop=function(){window.clearInterval(this)};return b},chain:function(){var a=$A(arguments),f=a.shift(),c=this;return function(){var r=c.apply(c,arguments);f.apply(f,a);return r}}});$ext(Number.prototype,{times:function(c,s){for(var i=0;i<this;i++)c.call(s,i);return this},upto:function(n,c,s){for(var i=this+0;i<=n;i++)c.call(s,i);return this},downto:function(n,c,s){for(var i=this+0;i>=n;i--)c.call(s,i);return this},abs:function(){return Math.abs(this)},round:function(b){if(b){var b=Math.pow(10,b);return Math.round(this*b)/b}else return Math.round(this)},ceil:function(){return Math.ceil(this)},floor:function(){return Math.floor(this)}});$ext(RegExp,{escape:function(s){return String(s).replace(/([.*+?^=!:${}()|[\]\/\\])/g,'\\$1')}});var Class=function(){var a=$A(arguments),b=a.pop()||{},p=a.pop();function k(){return this.initialize?this.initialize.apply(this,arguments):this};if(!a.length&&!isHash(b)){p=b;b={}}$ext(k,Class.Methods).inherit(p);$w('extend include').each(function(n){if(b[n]){var m=b[n];k[n].apply(k,isArray(m)?m:[m]);delete(b[n])}});return k.include(b)};Class.findSet=function(o,p){var u=p.toUpperCase(),b=p.capitalize(),c=[o,o.constructor].concat(o.constructor.ancestors),h=c.first(function(a){return a&&(a[u]||a[b])});return h?h[u]||h[b]:null};Class.Methods=(function(){var f=$w('selfExtended self_extended selfIncluded self_included'),g=f.concat($w('prototype parent extend include')),i=f.concat(['constructor']);function e(m,w){return Object.without.apply(Object,[m].concat(w=='e'?g:i))};return{inherit:function(p){if(p&&p.prototype){var s=function(){};s.prototype=p.prototype;this.prototype=new s;this.parent=p}this.ancestors=[];while(p){this.ancestors.push(p);p=p.parent}return this.prototype.constructor=this},extend:function(){$A(arguments).filter(isHash).each(function(m){var c=m.selfExtended||m.self_extended;$ext(this,e(m,'e'));if(c)c.call(m,this)},this);return this},include:function(){var d=this.ancestors.map('prototype'),b;$A(arguments).filter(isHash).each(function(a){var c=a.selfIncluded||a.self_included;a=e(a,'i');for(var k in a){b=d.first(function(p){return isFunction(p[k])});this.prototype[k]=!b?a[k]:(function(n,m,s){return function(){this.$super=s;return m.apply(this,arguments)}})(k,a[k],b[k])}if(c)c.call(a,this)},this);return this}}})();Options={setOptions:function(o){var o=this.options=Object.merge(Class.findSet(this,'options'),o),m,k;if(isFunction(this.on))for(k in o)if(m=k.match(/on([A-Z][A-Za-z]+)/)){this.on(m[1].toLowerCase(),o[k]);delete(o[k])}return this},cutOptions:function(a){var a=$A(a);this.setOptions(isHash(a.last())?a.pop():{});return a}};Observer=new Class({include:Options,initialize:function(o){this.setOptions(o);Observer.createShortcuts(this,Class.findSet(this,'events'))},on:function(){var a=$A(arguments),e=a.shift();if(isString(e)){if(!defined(this.$listeners))this.$listeners=[];var c=a.shift(),n;switch(typeof(c)){case "string":n=c;c=this[c];case "function":var h={};h.e=e;h.f=c;h.a=a;h.r=n;this.$listeners.push(h);break;default:if(isArray(c))for(var i=0;i<c.length;i++)this.observe.apply(this,[e].concat(isArray(c[i])?c[i]:[c[i]]).concat(a))}}else for(var n in e)this.observe.apply(this,[n].concat(isArray(e[n])?e[n]:[e[n]]).concat(a));return this},observes:function(e,c){if(this.$listeners){if(!isString(e)){c=e;e=null}if(isString(c))c=this[c];return this.$listeners.some(function(a){return(e&&c)?a.e==e&&a.f==c:e?a.e==e:a.f==c})}return false},stopObserving:function(e,c){if(this.$listeners){if(!isString(e)){c=e;e=null}if(isString(c))c=this[c];this.$listeners=this.$listeners.filter(function(a){return(e&&c)?(a.e!==e||a.f!==c):(e?a.e!==e:a.f!==c)},this)}return this},listeners:function(e){return(this.$listeners||[]).filter(function(a){return!e||a.e===e}).map(function(a){return a.f}).uniq()},fire:function(){var b=$A(arguments),e=b.shift();(this.$listeners||[]).each(function(a){if(a.e===e)a.f.apply(this,a.a.concat(b))},this);return this},extend:{create:function(o,e){$ext(o,Object.without(this.prototype,'initialize','setOptions'),true);return this.createShortcuts(o,e||Class.findSet(o,'events'))},createShortcuts:function(o,a){(a||[]).each(function(n){var m='on'+n.replace(/:/g,'_').camelize().capitalize();if(!defined(o[m]))o[m]=function(){return this.on.apply(this,[n].concat($A(arguments)))}});return o}}});$alias(Observer.prototype,{observe:'on'});Break=new Class(Error,{message:"Manual iterator break"});Browser=(function(a){return{IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:a.indexOf('AppleWebKit/')>-1,Gecko:a.indexOf('Gecko')>-1&&a.indexOf('KHTML')<0,MobileSafari:!!a.match(/Apple.*Mobile.*Safari/),Konqueror:a.indexOf('Konqueror')>-1,OLD:a.indexOf('MSIE 6')>-1||a.indexOf('MSIE 7')>-1,IE8:a.indexOf('MSIE 8')>-1}})(navigator.userAgent);Event=new Class(self.Event,{extend:{ext:function(e,b){if(!e.stop){$ext(e,this.Methods,true);if(!e.which){e.which=e.button==2?3:e.button==4?2:1;var s=window.scrolls();e.pageX=e.clientX+s.x;e.pageY=e.clientY+s.y;e.target=$(e.srcElement)||b;e.relatedTarget=e.target===e.fromElement?$(e.toElement):e.target;e.currentTarget=b;e.eventPhase=3}}if(e.target&&e.target.nodeType==3)e.target=e.target.parentNode;return e},cleanName:function(n){n=n.toLowerCase();n=n.substr(0,2)==='on'?n.slice(2):n;n=n==='rightclick'?'contextmenu':n;return n},realName:function(n){if(Browser.Gecko&&n==='mousewheel')n='DOMMouseScroll';if(Browser.Konqueror&&n==='contextmenu')n='rightclick';return n},Methods:{}},initialize:function(n,o){return new Event.Custom(Event.cleanName(n),o)}});Event.addMethods=Event.include=function(m){$ext(this.Methods,m);try{$ext(Event.parent.prototype,m,true)}catch(e){}};Event.include({stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},stop:function(){this.stopPropagation();this.preventDefault();return this},position:function(){return{x:this.pageX,y:this.pageY}}});Event.Custom=function(n,o){this.type=n;this.stop=function(){};$ext(this,o||{})};Event.delegate=function(o){return function(e){var t=e.target,b,a,c;for(b in o)if($(this).select(b).include(e.target)){a=o[b];a=isArray(a)?a:[a];c=a[0];a=a.slice(1);if(isString(c))t[c].apply(t,a);else c.apply(t,[e].concat(a))}}};String.prototype.behave=function(o){if(isString(o)){var h={},a=$A(arguments);h[a.shift()]=a;o=h}for(var e in o){var h={};h[this]=o[e];document.on(e,Event.delegate(h))}};Element=(function(a){var b={id:['id',0],html:['innerHTML',0],'class':['className',0],style:['setStyle',1],observe:['on',1],on:['on',1]};function n(t,o){var e=document.createElement(t);if(o)for(var k in o){if(b[k]){if(b[k][1])e[b[k][0]](o[k]);else e[b[k][0]]=o[k]}else e.set(k,o[k])}return e};if(Browser.IE)n=eval('['+n.toString().replace(/(\((\w+),\s*(\w+)\)\s*\{)/,'$1if($2==="input"&&$3)$2="<input name="+$3.name+" type="+$3.type+($3.checked?" checked":"")+"/>";')+']')[0];if(a){$ext(n,a);n.parent=a}return n})(self.Element);$ext(Element,{include:function(m,d){$ext(this.Methods,m,d);try{$ext((self.HTMLElement||this.parent).prototype,m,d)}catch(e){}return this},Methods:{}});Element.addMethods=Element.include;Element.include({parent:function(c){return c?this.parents(c)[0]:$(this.parentNode)},parents:function(c){return this.rCollect('parentNode',c)},subNodes:function(c){return this.select(c).filter(function(e){return e.parentNode===this},this)},siblings:function(c){return this.prevSiblings(c).reverse().concat(this.nextSiblings(c))},nextSiblings:function(c){return this.rCollect('nextSibling',c)},prevSiblings:function(c){return this.rCollect('previousSibling',c)},next:function(c){return this.nextSiblings(c)[0]},prev:function(c){return this.prevSiblings(c)[0]},remove:function(){if(this.parentNode)this.parentNode.removeChild(this);return this},insert:function(c,p){if(isHash(c))for(var p in c)this.insert(c[p],p);else{var s,i=Element.insertions;p=isString(p)?p.toLowerCase():'bottom';if(isString(c)||isNumber(c))c=(''+c).stripScripts(function(a){s=a});i[p](this,c.tagName?c:i.createFragment.call((p==='bottom'||p==='top'||!this.parentNode)?this:this.parentNode,c));if(s)$eval(s)}return this},insertTo:function(e,p){$(e).insert(this,p);return this},replace:function(c){return this.insert(c,'instead')},update:function(c){if(isString(c)||isNumber(c)){var s;this.innerHTML=(''+c).stripScripts(function(a){s=a});if(s)$eval(s)}else this.clean().insert(c);return this},wrap:function(e){if(this.parentNode){this.parentNode.replaceChild(e,this);e.appendChild(this)}return this},clean:function(){while(this.firstChild)this.removeChild(this.firstChild);return this},empty:function(){return this.innerHTML.blank()},rCollect:function(a,c){var n=this,r=[];while((n=n[a]))if(n.tagName&&(!c||$(n).match(c)))r.push(n);return r}});Element.insertions={bottom:function(t,c){t.appendChild(c)},top:function(t,c){t.firstChild?t.insertBefore(c,t.firstChild):t.appendChild(c)},after:function(t,c){var p=t.parentNode,s=t.nextSibling;if(p)s?p.insertBefore(c,s):p.appendChild(c)},before:function(t,c){if(t.parentNode)t.parentNode.insertBefore(c,t)},instead:function(t,c){if(t.parentNode)t.parentNode.replaceChild(c,t)},createFragment:function(c){var f;if(isString(c)){var t=document.createElement('div'),w=Element.insertions.wraps[this.tagName]||['','',0],d=w[2];t.innerHTML=w[0]+c+w[1];while(d>0){t=t.firstChild;d--}f=arguments.callee.call(this,t.childNodes)}else{f=document.createDocumentFragment();if(isNode(c))f.appendChild(c);else if(c&&c.length)for(var i=0,l=c.length;i<l;i++)f.appendChild(c[c.length==l?i:0])}return f},wraps:{TABLE:['<table>','</table>',1],TBODY:['<table><tbody>','</tbody></table>',2],TR:['<table><tbody><tr>','</tr></tbody></table>',3],TD:['<table><tbody><tr><td>','</td></tr></tbody></table>',4],SELECT:['<select>','</select>',1]}};$alias(Element.insertions.wraps,{THEAD:'TBODY',TFOOT:'TBODY',TH:'TD'});Element.include({setStyle:function(h,v){var k,c,s={};if(v){s[h]=v;h=s}else if(isString(h)){h.split(';').each(function(o){var e=o.split(':').map('trim');if(e[0]&&e[1])s[e[0]]=e[1]});h=s}for(k in h){c=k.indexOf('-')!=-1?k.camelize():k;if(k==='opacity'){if(Browser.IE)this.style.filter='alpha(opacity='+v*100+')';else this.style.opacity=v}else if(k==='float')c=Browser.IE?'styleFloat':'cssFloat';this.style[c]=h[k]}return this},getStyle:function(k){return this._getStyle(this.style,k)||this._getStyle(this.computedStyles(),k)},computedStyles:function(){return this.currentStyle||this.runtimeStyle||this.ownerDocument.defaultView.getComputedStyle(this,null)||{}},_getStyle:function(s,k){var v,k=k.camelize();switch(k){case 'opacity':v=!Browser.IE?s[k]:((/opacity=(\d+)/i.exec(s.filter||'')||['','100'])[1].toInt()/100)+'';break;case 'float':k=Browser.IE?'styleFloat':'cssFloat';default:v=s[k];if(Browser.Opera&&/color/i.test(k)&&v)v=v.replace(/"/g,'')}return v?v:null},hasClass:function(n){return(' '+this.className+' ').indexOf(' '+n+' ')!=-1},setClass:function(c){this.className=c;return this},addClass:function(n){var t=' '+this.className+' ';if(t.indexOf(' '+n+' ')==-1)this.className+=(t===' '?'':' ')+n;return this},removeClass:function(n){this.className=(' '+this.className+' ').replace(' '+n+' ',' ').trim();return this},toggleClass:function(n){return this[this.hasClass(n)?'removeClass':'addClass'](n)},radioClass:function(n){this.siblings().each('removeClass',n);return this.addClass(n)}});Element.include({set:function(h,a){if(typeof(h)==='string'){var v={};v[h]=a;h=v}for(var k in h){if(this[k]===undefined)this.setAttribute(k,''+h[k]);this[k]=h[k]}return this},get:function(n){var v=this[n]||this.getAttribute(n);return v===''?null:v},has:function(n){return this.get(n)!==null},erase:function(n){this.removeAttribute(n);return this},hidden:function(){return this.getStyle('display')=='none'},visible:function(){return!this.hidden()},hide:function(e,o){this._$pd=this.getStyle('display');this.style.display='none';return this},show:function(e,o){if(this.getStyle('display')=='none'){var v=this.tagName=='DIV'?'block':'inline';this.style.display=this._$pd=='none'?v:this._$pd||v}return this},toggle:function(e,o){return this[this.hidden()?'show':'hide'](e,o)},radio:function(e,o){this.siblings().each('hide',e,o);return this.show()}});Element.include({sizes:function(){return{x:this.offsetWidth,y:this.offsetHeight}},position:function(){var r=this.getBoundingClientRect(),d=this.ownerDocument.documentElement,s=window.scrolls();return{x:r.left+s.x-d.clientLeft,y:r.top+s.y-d.clientTop}},scrolls:function(){return{x:this.scrollLeft,y:this.scrollTop}},dimensions:function(){var a=this.sizes();var s=this.scrolls();var p=this.position();return{top:p.y,left:p.x,width:a.x,height:a.y,scrollLeft:s.x,scrollTop:s.y}},setWidth:function(w){var s=this.style,p='offsetWidth';s.width=w+'px';s.width=(2*w-this[p])+'px';return this},setHeight:function(h){var s=this.style,p='offsetHeight';s.height=h+'px';s.height=(2*h-this[p])+'px';return this},resize:function(w,h){if(isHash(w)){h=w.y;w=w.x}return this.setWidth(w).setHeight(h)},moveTo:function(l,t){if(isHash(l)){t=l.y;l=l.x}return this.setStyle({left:l+'px',top:t+'px'})},scrollTo:function(l,t){if(isHash(l)){t=l.y;l=l.x}this.scrollLeft=l;this.scrollTop=t;return this},scrollThere:function(){window.scrollTo(this);return this}});Element.include((function(){var o=Observer.create({},$w('click rightclick contextmenu mousedown mouseup mouseover mouseout mousemove keypress keydown keyup'));function h(n,r,t){o[n]=eval('['+o[n].toString().replace(r,t)+']')[0]};h('on',/(\$listeners\.push\((\w+?)\);)/,'$1$2.e=Event.cleanName($2.e);$2.n=Event.realName($2.e);$2.w=function(){var a=$A(arguments),e=($2.r&&$2.r!=="stopEvent")?a.shift():Event.ext(a[0],this);return $2.f.apply(this,a.concat($2.a))};'+(self.attachEvent?'$2.w=$2.w.bind(this);this.attachEvent("on"+$2.n,$2.w);':'this.addEventListener($2.n,$2.w,false);'));o.observe=o.on;h('stopObserving',/(function\s*\((\w+)\)\s*\{\s*)(return\s*)([^}]+)/m,'$1var r=$4;if(!r)'+(self.attachEvent?'this.detachEvent("on"+$2.n,$2.w);':'this.removeEventListener($2.n,$2.w,false);')+'$3 r');h('fire',/(\w+)\.f\.apply.*?\.concat\((\w+)\)\)/,'$1.f.apply(this,[new Event($1.e,$2.shift())].concat($1.a).concat($2))');o.stopEvent=function(a){a.stop()};$ext(window,o);$ext(document,o);Observer.createShortcuts(window,$w('blur focus scroll'));return o})());Element.include((function(){function s(c,t){return c?c.replace(/(^|,)/g,'$1'+t+' '):'*'};return{first:function(c){return this.querySelector(s(c,this.tagName))},select:function(c){return $A(this.querySelectorAll(s(c,this.tagName)))},match:function(c){var r,p=this.tagName==='HTML'?this.ownerDocument:this.parents().last();r=$(p||$E('p').insert(this)).select(c).include(this);if(!p)this.remove();return r}}})());$ext(document,{first:function(c){return this.querySelector(c)},select:function(c){return $A(this.querySelectorAll(c))}});$ext(self,(function(){var e=window.scrollTo;return{sizes:function(){var d=document.documentElement;return this.innerWidth?{x:this.innerWidth,y:this.innerHeight}:{x:d.clientWidth,y:d.clientHeight}},scrolls:function(){var b=this.document.body,d=this.document.documentElement,o='pageXOffset',a='pageYOffset',s='scrollLeft',c='scrollTop';return(this[o]||this[a])?{x:this[o],y:this[a]}:(b[s]||b[c])?{x:b[s],y:b[c]}:{x:d[s],y:d[c]}},scrollTo:function(l,t){if(isElement(l)||(isString(l)&&$(l)))l=$(l).position();if(isHash(l)){t=l.y;l=l.x}e(l,t);return this}}})());[window,document].each(function(o){Observer.createShortcuts(o,['ready']);var r=o.fire.bind(o,'ready');if(document.readyState!==undefined)(function(){['loaded','complete'].includes(document.readyState)?r():arguments.callee.delay(50)})();else document.addEventListener('DOMContentLoaded',r,false)});function Form(o){var o=o||{},r=o.remote,f=new Element('form',Object.without(o,'remote'));if(r)f.remotize();return f};$ext(Form,{ext:function(e){return $ext(e,this.Methods)},Methods:{},include:function(m,d){$ext(Form.Methods,m,d);try{$ext(HTMLFormElement.prototype,m,d)}catch(e){}}});Form.addMethods=Form.include;Form.include({getElements:function(){return this.select('input,select,textarea,button')},inputs:function(){return this.getElements().filter(function(i){return!['submit','button','reset','image',null].includes(i.type)})},focus:function(){var f=this.inputs().first(function(i){return i.type!='hidden'});if(f)f.focus();return this.fire('focus')},blur:function(){this.getElements().each('blur');return this.fire('blur')},disable:function(){this.getElements().each('disable');return this.fire('disable')},enable:function(){this.getElements().each('enable');return this.fire('enable')},values:function(){var v={};this.inputs().each(function(i){if(!i.disabled&&i.name&&(!['checkbox','radio'].includes(i.type)||i.checked))v[i.name]=i.getValue()});return v},serialize:function(){return Object.toQueryString(this.values())}});Form.include(Observer.createShortcuts({},$w('submit reset focus')),true);(function(){try{var i=[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement]}catch(e){var i=[]}Form.Element={ext:function(e){e._blur=e.blur;e._focus=e.focus;e._select=e.select;return $ext(e,this.Methods)},Methods:{},include:function(m,d){$ext(this.Methods,m,d);i.each(function(k){$ext(k.prototype,m,d)})}};i.each(function(k){$alias(k.prototype,{_blur:'blur',_focus:'focus',_select:'select'})})})();Form.Element.addMethods=Form.Element.include;Form.Element.include({getValue:function(){if(this.type=='select-multiple')return $A(this.getElementsByTagName('option')).map(function(o){return o.selected?o.value:null}).compact();else return this.value},setValue:function(v){if(this.type=='select-multiple'){v=$A(isArray(v)?v:[v]).map(String);$A(this.getElementsByTagName('option')).each(function(o){o.selected=v.includes(o.value)})}else this.value=v;return this},disable:function(){this.disabled=true;this.fire('disable');return this},enable:function(){this.disabled=false;this.fire('enable');return this},focus:function(){Browser.OLD?this._focus():this._focus.call(this);this.focused=true;this.fire('focus');return this},select:function(){this.focus();Browser.OLD?this._select():this._select.call(this);return this},blur:function(){Browser.OLD?this._blur():this._blur.call(this);this.focused=false;this.fire('blur');return this}});Form.Element.include(Observer.createShortcuts({},$w('disable enable focus blur change')),true);Cookie=new Class({include:Options,extend:{set:function(n,v,o){return new this(n,o).set(v)},get:function(n){return new this(n).get()},remove:function(n){return new this(n).remove()},enabled:function(){document.cookie="__t=1";return document.cookie.indexOf("__t=1")!=-1},Options:{secure:false,document:document}},initialize:function(n,o){this.name=n;this.setOptions(o)},set:function(v){var v=encodeURIComponent(v),o=this.options;if(o.domain)v+='; domain='+o.domain;if(o.path)v+='; path='+o.path;if(o.duration){var d=new Date();d.setTime(d.getTime()+o.duration*24*60*60*1000);v+='; expires='+d.toGMTString()}if(o.secure)v+='; secure';o.document.cookie=this.name+'='+v;return this},get:function(){var v=this.options.document.cookie.match('(?:^|;)\\s*'+RegExp.escape(this.name)+'=([^;]*)');return(v)?decodeURIComponent(v[1]):null},remove:function(){this.options.duration=-1;return this.set('')}});Xhr=new Class(Observer,{extend:{EVENTS:$w('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:true,evalScripts:false,evalResponse:false,evalJSON:true,secureJSON:true,urlEncoded:true,spinner:null,spinnerFx:'fade',params:null,iframed:false},load:function(u,o){return new this(u,Object.merge({method:'get'},o)).send()}},initialize:function(u,o){this.initCallbacks();this.url=u;this.$super(o);for(var k in Xhr.Options)this[k]=this.options[k];this.initSpinner()},setHeader:function(n,v){this.headers[n]=v;return this},getHeader:function(n){try{return this.xhr.getResponseHeader(n)}catch(e){}},successful:function(){return(this.status>=200)&&(this.status<300)},send:function(p){var a={},u=this.url,m=this.method.toLowerCase(),k;if(m=='put'||m=='delete'){a['_method']=m;m='post'}var d=this.prepareData(this.params,this.prepareParams(p),a);if(this.urlEncoded&&m=='post'&&!this.headers['Content-type'])this.setHeader('Content-type','application/x-www-form-urlencoded;charset='+this.encoding);if(m=='get'){u+=(u.includes('?')?'&':'?')+d;d=null}this.xhr=this.createXhr();this.fire('create');this.xhr.open(m,u,this.async);this.xhr.onreadystatechange=this.stateChanged.bind(this);for(k in this.headers)this.xhr.setRequestHeader(k,this.headers[k]);this.xhr.send(d);this.fire('request');if(!this.async)this.stateChanged();return this},update:function(e,p){return this.onSuccess(function(a){e.update(a.text)}).send(p)},cancel:function(){if(!this.xhr||this.xhr.canceled)return this;this.xhr.abort();this.xhr.onreadystatechange=function(){};this.xhr.canceled=true;return this.fire('cancel')},fire:function(n){return this.$super(n,this,this.xhr)},createXhr:function(){if(this.form&&this.form.getElements().map('type').includes('file'))return new Xhr.IFramed(this.form);else try{return new XMLHttpRequest()}catch(e){return new ActiveXObject('MSXML2.XMLHTTP')}},prepareParams:function(p){if(p&&p.tagName=='FORM'){this.form=p;p=p.values()}return p},prepareData:function(){return $A(arguments).map(function(p){if(!isString(p))p=Object.toQueryString(p);return p.blank()?null:p}).compact().join('&')},stateChanged:function(){if(this.xhr.readyState!=4||this.xhr.canceled)return;try{this.status=this.xhr.status}catch(e){this.status=0}this.text=this.responseText=this.xhr.responseText;this.xml=this.responseXML=this.xhr.responseXML;this.fire('complete').fire(this.successful()?'success':'failure')},tryScripts:function(r){if(this.evalResponse||(/(ecma|java)script/).test(this.getHeader('Content-type')))$eval(this.text);else if((/json/).test(this.getHeader('Content-type'))&&this.evalJSON)this.json=this.responseJSON=this.sanitizedJSON();else if(this.evalScripts)this.text.evalScripts()},sanitizedJSON:function(){try{return JSON.parse(this.text)}catch(e){if(self.JSON||!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(this.text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,''))){if(this.secureJSON)throw "JSON parse error: "+this.text;else return null}}return eval("("+this.text+")")},initCallbacks:function(){this.on({success:'tryScripts',create:'showSpinner',complete:'hideSpinner',cancel:'hideSpinner'});Xhr.EVENTS.each(function(n){this.on(n,function(){Xhr.fire(n,this,this.xhr)})},this)},initSpinner:function(){if(this.spinner)this.spinner=$(this.spinner);if(Xhr.Options.spinner&&this.spinner===$(Xhr.Options.spinner))this.spinner=null},showSpinner:function(){if(this.spinner)this.spinner.show(this.spinnerFx,{duration:100})},hideSpinner:function(){if(this.spinner)this.spinner.hide(this.spinnerFx,{duration:100})}});Observer.create(Xhr);$ext(Xhr,{counter:0,showSpinner:function(){if(this.Options.spinner)$(this.Options.spinner).show(this.Options.spinnerFx,{duration:100})},hideSpinner:function(){if(this.Options.spinner)$(this.Options.spinner).hide(this.Options.spinnerFx,{duration:100})}});Xhr.onCreate(function(){this.counter++;this.showSpinner()}).onComplete(function(){this.counter--;if(this.counter<1)this.hideSpinner()}).onCancel(function(){this.counter--;if(this.counter<1)this.hideSpinner()});Form.include({send:function(o){o=o||{};o['method']=o['method']||this.method||'post';new Xhr(this.get('action')||document.location.href,o).onRequest(this.disable.bind(this)).onComplete(this.enable.bind(this)).send(this);return this},remotize:function(o){this.onsubmit=function(){this.send.bind(this,Object.merge({spinner:this.first('.spinner')},o)).delay(20);return false};this.remote=true;return this},unremotize:function(){this.onsubmit=function(){};this.remote=false;return this}});Element.include({load:function(u,o){new Xhr(u,Object.merge({method:'get'},o)).update(this);return this}});Xhr.IFramed=new Class({initialize:function(f){this.form=f;var i='xhr_frame_'+Math.random().toString().split('.').last();$E('div').insertTo(document.body).update('<iframe name="'+i+'" id="'+i+'" width="0" height="0" frameborder="0" src="about:blank"></iframe>');this.iframe=$(i);this.iframe.on('load',this.onLoad.bind(this))},send:function(){var o=this.form.onsubmit,a=this.form.target;this.form.onsubmit=function(){};this.form.target=this.iframe.id;this.form.submit();this.form.onsubmit=o;this.form.target=a},onLoad:function(){this.status=200;this.readyState=4;var d=window[this.iframe.id].document.documentElement;this.responseText=d?d.innerHTML:null;this.onreadystatechange()},open:function(){},abort:function(){},setRequestHeader:function(){},onreadystatechange:function(){}});Fx=new Class(Observer,{extend:{EVENTS:$w('start finish cancel'),Durations:{'short':200,'normal':400,'long':800},Options:{fps:Browser.IE?40:60,duration:'normal',transition:'Sin',queue:true},Transitions:{Sin:function(a){return-(Math.cos(Math.PI*a)-1)/2},Cos:function(a){return Math.asin((a-0.5)*2)/Math.PI+0.5},Exp:function(a){return Math.pow(2,8*(a-1))},Log:function(a){return 1-Math.pow(2,-8*a)},Lin:function(a){return a}}},initialize:function(e,o){this.$super(o);this.element=$(e)},start:function(){if(this.queue(arguments))return this;this.prepare.apply(this,arguments);var o=this.options,d=Fx.Durations[o.duration]||o.duration;this.transition=Fx.Transitions[o.transition]||o.transition;this.steps=(d/1000*this.options.fps).ceil();this.number=1;return this.fire('start',this).startTimer()},finish:function(){return this.stopTimer().fire('finish').next()},cancel:function(){return this.stopTimer().fire('cancel').next()},pause:function(){return this.stopTimer()},resume:function(){return this.startTimer()},prepare:function(v){},render:function(d){},step:function(t){if(t.number>t.steps)t.finish();else{if(!t.w){t.w=true;t.render(t.transition(t.number/t.steps));t.w=false}t.number++}},startTimer:function(){this.timer=this.step.periodical((1000/this.options.fps).round(),this);return this},stopTimer:function(){if(this.timer)this.timer.stop();return this},queue:function(a){if(!this.element)return false;if(this.$ch)return this.$ch=false;var u=$uid(this.element),c;Fx.$ch=Fx.$ch||[];c=(Fx.$ch[u]=Fx.$ch[u]||[]);if(this.options.queue)c.push([a,this]);this.next=function(){var n=c.shift();n=c[0];if(n){n[1].$ch=true;n[1].start.apply(n[1],n[0])}return this};return this.options.queue&&c[0][1]!==this},next:function(){return this}});String.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'};$ext(String.prototype,{toHex:function(){var m=/^#(\w)(\w)(\w)$/.exec(this);if(m)m="#"+m[1]+m[1]+m[2]+m[2]+m[3]+m[3];else if(m=/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(this))m="#"+m.slice(1).map(function(b){b=(b-0).toString(16);return b.length==1?'0'+b:b}).join('');else m=String.COLORS[this]||this;return m},toRgb:function(a){var m=/#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})/i.exec(this.toHex()||'');if(m){m=m.slice(1).map('toInt',16);m=a?m:'rgb('+m+')'}return m}});Fx.Morph=new Class(Fx,(function(){var C='Color',S='Style',W='Width',B='background',o='border',P='Position',h=B+C,t=$w('Top Left Right Bottom');function p(a,k,v){for(var i=0;i<v.length;i++)a.push(k+v[i])};function q(e,a){for(var i=0;i<4;i++){var f=t[i],c=o+f+S,d=o+f+W,b=o+f+C;if(e[c]!=a[c]){var s=this.element.style;if(e[c]=='none')s[d]='0px';s[c]=a[c];if(this._transp(e[b]))s[b]=this.element.getStyle(C)}}};function u(b){var a={},r=/[\d\.\-]+/g,m,k,v,i;for(k in b){m=b[k].match(r);v=m.map('toFloat');v.t=b[k].split(r);v.r=v.t[0]==='rgb(';if(v.t[0]===''||v.r)v.t.shift();for(i=0;i<v.length;i++)v.t.splice(i*2,0,v[i]);a[k]=v}return a};return{prepare:function(s){var k=this._styleKeys(s),b=this._cloneStyle(this.element,k),a=this._endStyle(s,k);this._cleanStyles(b,a);this.before=u(b);this.after=u(a)},render:function(d){var b,a,v,s=this.element.style,k,i;for(k in this.after){b=this.before[k];a=this.after[k];for(i=0;i<a.length;i++){v=b[i]+(a[i]-b[i])*d;if(a.r)v=Math.round(v);a.t[i*2]=v}v=a.t.join('');if(a.r)v='rgb('+v;s[k]=v}},_endStyle:function(s,k){var d=$(this.element.cloneNode(true)).setStyle('position:absolute;z-index:-1;visibility:hidden').insertTo(this.element,'before').setWidth(this.element.sizes().x).setStyle(s),a=this._cloneStyle(d,k);d.remove();return a},_cloneStyle:function(e,k){for(var i=0,l=k.length,s=e.computedStyles(),c={};i<l;i++)c[k[i]]=s[k[i]];return c},_styleKeys:function(s){var a=[],b=[S,C,W],k,i,j;for(k in s){if(k.startsWith(o))for(i=0;i<b.length;i++)for(j=0;j<t.length;j++)a.push(o+t[j]+b[i]);else if(k=='margin'||k=='padding')p(a,k,t);else if(k.startsWith(B))p(a,B,[C,P,P+'X',P+'Y']);else if(k=='opacity'&&Browser.IE)a.push('filter');else a.push(k)}return a},_cleanStyles:function(b,a){var r=[],k;for(k in a)if((k=='width'||k=='height')&&b[k]=='auto')b[k]=this.element['offset'+k.capitalize()]+'px';if(a.filter&&!b.filter)b.filter='alpha(opacity=100)';q.call(this,b,a);for(k in a){if(a[k]!==b[k]&&!r.includes(k)&&/color/i.test(k)){if(Browser.Opera){a[k]=a[k].replace(/"/g,'');b[k]=b[k].replace(/"/g,'')}if(!this._transp(a[k]))a[k]=a[k].toRgb();if(!this._transp(b[k]))b[k]=b[k].toRgb();if(!a[k]||!b[k])a[k]=b[k]=''}if(/\d/.test(a[k])&&!/\d/.test(b[k]))b[k]=a[k].replace(/[\d\.\-]+/g,'0');if(a[k]===b[k]||r.includes(k)||!/\d/.test(b[k])||!/\d/.test(a[k])){delete(a[k]);delete(b[k])}}},_getBGColor:function(e){return[e].concat(e.parents()).map(function(n){var b=n.getStyle(h);return(b&&!this._transp(b))?b:null},this).compact().first()||'#FFF'},_transp:function(c){return c==='transparent'||c==='rgba(0, 0, 0, 0)'}}})());Fx.Highlight=new Class(Fx.Morph,{extend:{Options:Object.merge(Fx.Options,{color:'#FF8',transition:'Exp'})},prepare:function(s,e){var a=e||this.element.getStyle('backgroundColor');if(this._transp(a)){this.onFinish(function(){this.element.style.backgroundColor='transparent'});a=this._getBGColor(this.element)}this.element.style.backgroundColor=(s||this.options.color);return this.$super({backgroundColor:a})}});Fx.Twin=new Class(Fx.Morph,{finish:function(){if(this.how=='out')this.element.hide();return this.$super()},setHow:function(h){this.how=h||'toggle';if(this.how=='toggle')this.how=this.element.visible()?'out':'in'}});Fx.Slide=new Class(Fx.Twin,{extend:{Options:Object.merge(Fx.Options,{direction:'top'})},prepare:function(h){this.setHow(h);var e=this.element;e.show();this.sizes=e.sizes();this.styles={};$w('overflow height width marginTop marginLeft').each(function(k){this.styles[k]=e.style[k]},this);e.style.overflow='hidden';this.onFinish('_getBack').onCancel('_getBack');return this.$super(this._getStyle(this.options.direction))},_getBack:function(){this.element.setStyle(this.styles)},_getStyle:function(d){var f={},s=this.sizes,m='marginLeft',a='marginTop',b=this.styles[m].toFloat()||0,c=this.styles[a].toFloat()||0;if(this.how=='out'){f[['top','bottom'].includes(d)?'height':'width']='0px';if(d=='right')f[m]=b+s.x+'px';else if(d=='bottom')f[a]=c+s.y+'px'}else if(this.how=='in'){var e=this.element.style;if(['top','bottom'].includes(d)){f.height=s.y+'px';e.height='0px'}else{f.width=s.x+'px';e.width='0px'}if(d=='right'){f[m]=b+'px';e[m]=b+s.x+'px'}else if(d=='bottom'){f[a]=c+'px';e[a]=c+s.y+'px'}}return f}});Fx.Fade=new Class(Fx.Twin,{prepare:function(h){this.setHow(h);if(this.how=='in')this.element.setStyle({opacity:0}).show();return this.$super({opacity:isNumber(h)?h:this.how=='in'?1:0})}});Fx.Scroll=new Class(Fx,{prepare:function(v){this.before={};this.after=v;if(defined(v.x))this.before.x=this.element.scrollLeft;if(defined(v.y))this.before.y=this.element.scrollTop},render:function(d){var b=this.before,k;for(k in b)this.element['scroll'+(k=='x'?'Left':'Top')]=b[k]+(this.after[k]-b[k])*d}});Element.include((function(m){var b=m.hide,d=m.show,c=m.scrollTo;return{hide:function(f,o){return f?this.fx(f,['out',o]):b.call(this)},show:function(f,o){return f?this.fx(f,['in',o]):d.call(this)},morph:function(s,o){return this.fx('morph',[s,o||{}])},highlight:function(){return this.fx('highlight',arguments)},fade:function(){return this.fx('fade',arguments)},slide:function(){return this.fx('slide',arguments)},scroll:function(v,o){return this.fx('scroll',[v,o||{}])},scrollTo:function(v,o){return isHash(o)?this.scroll(v,o):c.apply(this,arguments)},fx:function(n,a){var a=$A(a).compact(),o=isHash(a.last())?a.pop():{},f=new Fx[n.capitalize()](this,o);f.start.apply(f,a);return this}}})(Element.Methods));if(!document.querySelector)(function(){var r=/(^|\/)(right)([^\/]+)$/,c=$A(document.getElementsByTagName('script')).map('src').compact().first('match',r);if(c)document.write('<scr'+'ipt src="'+c.replace(r,'$1$2-olds$3')+'"></scr'+'ipt>')})();
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This is old browsers support patch for RightJS
3
+ *
4
+ * The library released under terms of the MIT license
5
+ * Visit http://rightjs.org for more details
6
+ *
7
+ * Copyright (C) 2008-2010 Nikolay V. Nemshilov aka St.
8
+ */
9
+ if(Browser.OLD){$=(function(o){return function(i){var e=o(i);return e?Element.prepare(e):e}})($);$ext(document,{createElement:(function(o){return function(t){return Element.prepare(o(t))}})(document.createElement)});$ext(Element,{prepare:function(e){if(e&&e.tagName&&!e.set){$ext(e,Element.Methods,true);if(self.Form)switch(e.tagName){case 'FORM':Form.ext(e);break;case 'INPUT':case 'SELECT':case 'BUTTON':case 'TEXTAREA':Form.Element.ext(e);break}}return e}});Element.include((function(){var o=Element.Methods.rCollect;return{rCollect:function(a,c){return o.call(this,a,c).each(Element.prepare)}}})())}if(!$E('p').getBoundingClientRect)Element.include({position:function(){var l=this.offsetLeft,t=this.offsetTop,a=this.getStyle('position'),p=this.parentNode,b=this.ownerDocument.body;while(p&&p.tagName){if(p===b||p.getStyle('position')!='static'){if(p!==b||a!='absolute'){var s=p.position();l+=s.x;t+=s.y}break}p=p.parentNode}return{x:l,y:t}}});if(!document.querySelector)Element.include((function(){var H={' ':function(e,t){return $A(e.getElementsByTagName(t))},'>':function(e,t){var r=[],n=e.firstChild;while(n){if(t=='*'||n.tagName==t)r.push(n);n=n.nextSibling}return r},'+':function(e,t){while(e=e.nextSibling)if(e.tagName)return(t=='*'||e.tagName==t)?[e]:[];return[]},'~':function(e,t){var r=[];while(e=e.nextSibling)if(t=='*'||e.tagName==t)r.push(e);return r}};var G={checked:function(){return this.checked},disabled:function(){return this.disabled},empty:function(){return!(this.innerText||this.innerHTML||this.textContent||'').length},'first-child':function(t){var n=this;while(n=n.previousSibling)if(n.tagName&&(!t||n.tagName==t))return false;return true},'first-of-type':function(){return arguments[1]['first-child'].call(this,this.tagName)},'last-child':function(t){var n=this;while(n=n.nextSibling)if(n.tagName&&(!t||n.tagName==t))return false;return true},'last-of-type':function(){return arguments[1]['last-child'].call(this,this.tagName)},'only-child':function(t,m){return m['first-child'].call(this,t)&&m['last-child'].call(this,t)},'only-of-type':function(){return arguments[1]['only-child'].call(this,this.tagName,arguments[1])},'nth-child':function(d,c,t){if(!this.parentNode)return false;d=d.toLowerCase();if(d=='n')return true;if(d.includes('n')){var a=b=0;if(m=d.match(/^([+-]?\d*)?n([+-]?\d*)?$/)){a=m[1]=='-'?-1:parseInt(m[1],10)||1;b=parseInt(m[2],10)||0}var i=1,n=this;while((n=n.previousSibling))if(n.tagName&&(!t||n.tagName==t))i++;return(i-b)% a==0&&(i-b)/a>=0}else return c['index'].call(this,d.toInt()-1,c,t)},'nth-of-type':function(n){return arguments[1]['nth-child'].call(this,n,arguments[1],this.tagName)},index:function(a,m,t){a=isString(a)?a.toInt():a;var n=this,c=0;while((n=n.previousSibling))if(n.tagName&&(!t||n.tagName==t)&&++c>a)return false;return c==a}};var A=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g;var E=/#([\w\-_]+)/;var L=/^[\w\*]+/;var C=/\.([\w\-\._]+)/;var F=/:([\w\-]+)(\((.+?)\))*$/;var w=/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/;var q={};function x(b){if(!q[b]){var i,t,c,a,p,v,m,d={};while(m=b.match(w)){a=a||{};a[m[1]]={o:m[2],v:m[5]||m[6]};b=b.replace(m[0],'')}if(m=b.match(F)){p=m[1];v=m[3]==''?null:m[3];b=b.replace(m[0],'')}i=(b.match(E)||[1,null])[1];t=(b.match(L)||'*').toString().toUpperCase();c=(b.match(C)||[1,''])[1].split('.').without('');d.tag=t;if(i||c.length||a||p){var f='function(y){var e,r=[];for(var z=0,x=y.length;z<x;z++){e=y[z];_f_}return r}';var e=function(c){f=f.replace('_f_',c+'_f_')};if(i)e('if(e.id!=i)continue;');if(c.length)e('if(e.className){var n=e.className.split(" ");if(n.length==1&&c.indexOf(n[0])==-1)continue;else{for(var i=0,l=c.length,b=false;i<l;i++)if(n.indexOf(c[i])==-1){b=true;break;}if(b)continue;}}else continue;');if(a)e('var p,o,v,b=false;for (var k in a){p=e.getAttribute(k)||"";o=a[k].o;v=a[k].v;if((o=="="&&p!=v)||(o=="*="&&!p.includes(v))||(o=="^="&&!p.startsWith(v))||(o=="$="&&!p.endsWith(v))||(o=="~="&&!p.split(" ").includes(v))||(o=="|="&&!p.split("-").includes(v))){b=true;break;}}if(b){continue;}');if(p&&G[p]){var s=G;e('if(!s[p].call(e,v,s))continue;')}d.filter=eval('['+f.replace('_f_','r.push(e)')+']')[0]}q[b]=d}return q[b]};var M={};function y(g){var h=g.join('');if(!M[h]){for(var i=0;i<g.length;i++)g[i][1]=x(g[i][1]);var c=$uid;var k=function(e){var b=[],a=[],u;for(var i=0,l=e.length;i<l;i++){u=c(e[i]);if(!a[u]){b.push(e[i]);a[u]=true}}return b};var d=function(e,a){var r=H[a[0]](e,a[1].tag);return a[1].filter?a[1].filter(r):r};M[h]=function(e){var f,s;for(var i=0,a=g.length;i<a;i++){if(i==0)f=d(e,g[i]);else{if(i>1)f=k(f);for(var j=0;j<f.length;j++){s=d(f[j],g[i]);s.unshift(1);s.unshift(j);f.splice.apply(f,s);j+=s.length-3}}}return g.length>1?k(f):f}}return M[h]};var J={},B={};function K(c){if(!J[c]){A.lastIndex=0;var b=[],a=[],r=' ',m,t;while(m=A.exec(c)){t=m[1];if(t=='+'||t=='>'||t=='~')r=t;else{a.push([r,t]);r=' '}if(m[2]){b.push(y(a));a=[]}}b.push(y(a));J[c]=b}return J[c]};function I(e,c){var s=K(c),r=[];for(var i=0,l=s.length;i<l;i++)r=r.concat(s[i](e));if(Browser.OLD)r.forEach(Element.prepare);return r};var D={first:function(c){return this.select(c).first()},select:function(c){return I(this,c||'*')}};$ext(document,D);self.$$=function(c){return I(document,c||'*')};return D})());
@@ -1,7 +1,7 @@
1
1
  module SinatraMore
2
2
  module MochaMockGen
3
3
  def setup_mock
4
- require_dependencies 'mocha', :env => :testing
4
+ require_dependencies 'mocha', :group => :testing
5
5
  insert_mocking_include "Mocha::API", :path => "test/test_config.rb"
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module SinatraMore
2
2
  module RrMockGen
3
3
  def setup_mock
4
- require_dependencies 'rr', :env => :testing
4
+ require_dependencies 'rr', :group => :testing
5
5
  insert_mocking_include "RR::Adapters::RRMethods", :path => "test/test_config.rb"
6
6
  end
7
7
  end
@@ -2,7 +2,7 @@ module SinatraMore
2
2
  module JqueryScriptGen
3
3
 
4
4
  def setup_script
5
- get("http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js", "public/javascripts/jquery.min.js")
5
+ copy_file("components/files/jquery-1.3.2.min.js", "public/javascripts/jquery.min.js")
6
6
  end
7
7
 
8
8
  end
@@ -2,8 +2,8 @@ module SinatraMore
2
2
  module PrototypeScriptGen
3
3
 
4
4
  def setup_script
5
- get("http://prototypejs.org/assets/2009/8/31/prototype.js", "public/javascripts/prototype.js")
6
- get('http://github.com/nesquena/lowpro/raw/master/dist/lowpro.js', "public/javascripts/lowpro.js")
5
+ copy_file("components/files/prototype.js", "public/javascripts/prototype.js")
6
+ copy_file('components/files/lowpro.js', "public/javascripts/lowpro.js")
7
7
  end
8
8
 
9
9
  end
@@ -2,8 +2,8 @@ module SinatraMore
2
2
  module RightjsScriptGen
3
3
 
4
4
  def setup_script
5
- get("http://rightjs.org/builds/current/right-min.js", "public/javascripts/right-min.js")
6
- get("http://rightjs.org/builds/current/right-olds-min.js", "public/javascripts/right-olds-min.js")
5
+ copy_file("components/files/right-min.js", "public/javascripts/right-min.js")
6
+ copy_file("components/files/right-olds-min.js", "public/javascripts/right-olds-min.js")
7
7
  end
8
8
 
9
9
  end
@@ -11,7 +11,7 @@ end
11
11
  TEST
12
12
 
13
13
  def setup_test
14
- require_dependencies 'bacon', :env => :testing
14
+ require_dependencies 'bacon', :group => :testing
15
15
  insert_test_suite_setup BACON_SETUP
16
16
  end
17
17
 
@@ -11,7 +11,7 @@ end
11
11
  TEST
12
12
 
13
13
  def setup_test
14
- require_dependencies 'riot', :env => :testing
14
+ require_dependencies 'riot', :group => :testing
15
15
  insert_test_suite_setup RIOT_SETUP
16
16
  end
17
17
 
@@ -11,7 +11,7 @@ end
11
11
  TEST
12
12
 
13
13
  def setup_test
14
- insert_into_gemfile 'rspec', :require_as => 'spec', :env => :testing
14
+ insert_into_gemfile 'rspec', :require => 'spec', :group => :testing
15
15
  insert_test_suite_setup RSPEC_SETUP
16
16
  end
17
17
 
@@ -11,7 +11,7 @@ end
11
11
  TEST
12
12
 
13
13
  def setup_test
14
- require_dependencies 'test/unit', 'shoulda', :env => :testing
14
+ require_dependencies 'test/unit', 'shoulda', :group => :testing
15
15
  insert_test_suite_setup SHOULDA_SETUP
16
16
  end
17
17
 
@@ -1,3 +1,4 @@
1
+ require 'thor/group'
1
2
  require File.dirname(__FILE__) + '/generator_actions'
2
3
  require File.dirname(__FILE__) + '/components/component_actions'
3
4
  Dir[File.dirname(__FILE__) + "/{base_app,components}/**/*.rb"].each { |lib| require lib }
@@ -46,7 +47,7 @@ module SinatraMore
46
47
  def bundle_dependencies
47
48
  if options[:run_bundle]
48
49
  say "Bundling application dependencies using bundler..."
49
- in_root { run 'gem bundle' }
50
+ in_root { run 'bundle install' }
50
51
  end
51
52
  end
52
53
  end
@@ -32,12 +32,9 @@ module SinatraMore
32
32
  raise "WardenPlugin::Error - Install warden with 'sudo gem install warden' to use plugin!" unless Warden && Warden::Manager
33
33
  app.use Warden::Manager do |manager|
34
34
  manager.default_strategies :password
35
- manager.default_serializers :session, :cookie
36
35
  manager.failure_app = app
37
- manager.serializers.update(:session) do
38
- def serialize(user); user.nil? ? nil : user.id; end
39
- def deserialize(id); id.nil? ? nil : PasswordStrategy.user_class.find(id); end
40
- end
36
+ manager.serialize_into_session { |user| user.nil? ? nil : user.id }
37
+ manager.serialize_from_session { |id| id.nil? ? nil : PasswordStrategy.user_class.find(id) }
41
38
  end
42
39
  app.helpers SinatraMore::OutputHelpers
43
40
  app.helpers SinatraMore::WardenHelpers
data/sinatra_more.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra_more}
8
- s.version = "0.3.33"
8
+ s.version = "0.3.34"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nathan Esquenazi"]
12
- s.date = %q{2010-01-07}
12
+ s.date = %q{2010-02-09}
13
13
  s.default_executable = %q{sinatra_gen}
14
14
  s.description = %q{Expands sinatra with standard helpers and tools to allow for complex applications}
15
15
  s.email = %q{nesquena@gmail.com}
@@ -54,6 +54,11 @@ Gem::Specification.new do |s|
54
54
  "generators/base_app/tmp/.empty_directory",
55
55
  "generators/base_app/vendor/gems/.empty_directory",
56
56
  "generators/components/component_actions.rb",
57
+ "generators/components/files/jquery-1.3.2.min.js",
58
+ "generators/components/files/lowpro.js",
59
+ "generators/components/files/prototype.js",
60
+ "generators/components/files/right-min.js",
61
+ "generators/components/files/right-olds-min.js",
57
62
  "generators/components/mocks/mocha_mock_gen.rb",
58
63
  "generators/components/mocks/rr_mock_gen.rb",
59
64
  "generators/components/orms/activerecord_orm_gen.rb",
@@ -183,7 +188,7 @@ Gem::Specification.new do |s|
183
188
  s.add_runtime_dependency(%q<tilt>, [">= 0.2"])
184
189
  s.add_runtime_dependency(%q<thor>, [">= 0.11.8"])
185
190
  s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"])
186
- s.add_runtime_dependency(%q<bundler>, [">= 0"])
191
+ s.add_runtime_dependency(%q<bundler>, [">= 0.9.2"])
187
192
  s.add_development_dependency(%q<haml>, [">= 2.2.14"])
188
193
  s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
189
194
  s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
@@ -194,7 +199,7 @@ Gem::Specification.new do |s|
194
199
  s.add_dependency(%q<tilt>, [">= 0.2"])
195
200
  s.add_dependency(%q<thor>, [">= 0.11.8"])
196
201
  s.add_dependency(%q<activesupport>, [">= 2.2.2"])
197
- s.add_dependency(%q<bundler>, [">= 0"])
202
+ s.add_dependency(%q<bundler>, [">= 0.9.2"])
198
203
  s.add_dependency(%q<haml>, [">= 2.2.14"])
199
204
  s.add_dependency(%q<shoulda>, [">= 2.10.2"])
200
205
  s.add_dependency(%q<mocha>, [">= 0.9.7"])
@@ -206,7 +211,7 @@ Gem::Specification.new do |s|
206
211
  s.add_dependency(%q<tilt>, [">= 0.2"])
207
212
  s.add_dependency(%q<thor>, [">= 0.11.8"])
208
213
  s.add_dependency(%q<activesupport>, [">= 2.2.2"])
209
- s.add_dependency(%q<bundler>, [">= 0"])
214
+ s.add_dependency(%q<bundler>, [">= 0.9.2"])
210
215
  s.add_dependency(%q<haml>, [">= 2.2.14"])
211
216
  s.add_dependency(%q<shoulda>, [">= 2.10.2"])
212
217
  s.add_dependency(%q<mocha>, [">= 0.9.7"])
@@ -169,7 +169,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
169
169
  should "properly generate for rspec" do
170
170
  buffer = silence_logger { SinatraMore::SkeletonGenerator.start(['sample_app', '/tmp', '--test=rspec', '--script=none']) }
171
171
  assert_match /Applying.*?rspec.*?test/, buffer
172
- assert_match_in_file(/gem 'rspec', :require_as => "spec"/, '/tmp/sample_app/Gemfile')
172
+ assert_match_in_file(/gem 'rspec', :require => "spec"/, '/tmp/sample_app/Gemfile')
173
173
  assert_match_in_file(/Spec::Runner/, '/tmp/sample_app/test/test_config.rb')
174
174
  end
175
175
 
@@ -11,7 +11,7 @@ class TestAssetTagHelpers < Test::Unit::TestCase
11
11
  def flash
12
12
  { :notice => "Demo notice" }
13
13
  end
14
-
14
+
15
15
  context 'for #flash_tag method' do
16
16
  should "display flash with no given attributes" do
17
17
  assert_has_tag('div.flash', :content => "Demo notice") { flash_tag(:notice) }
@@ -160,16 +160,16 @@ class TestFormBuilder < Test::Unit::TestCase
160
160
 
161
161
  should "display correct label in haml" do
162
162
  visit '/haml/form_for'
163
- assert_have_selector '#demo label', :content => "Login: ", :class => 'user-label'
164
- assert_have_selector '#demo label', :content => "About Me: "
165
- assert_have_selector '#demo2 label', :content => "Nickname: ", :class => 'label'
163
+ assert_have_selector '#demo label', :content => "Login", :class => 'user-label'
164
+ assert_have_selector '#demo label', :content => "About Me"
165
+ assert_have_selector '#demo2 label', :content => "Nickname", :class => 'label'
166
166
  end
167
167
 
168
168
  should "display correct label in erb" do
169
169
  visit '/erb/form_for'
170
- assert_have_selector '#demo label', :content => "Login: ", :class => 'user-label'
171
- assert_have_selector '#demo label', :content => "About Me: "
172
- assert_have_selector '#demo2 label', :content => "Nickname: ", :class => 'label'
170
+ assert_have_selector '#demo label', :content => "Login", :class => 'user-label'
171
+ assert_have_selector '#demo label', :content => "About Me"
172
+ assert_have_selector '#demo2 label', :content => "Nickname", :class => 'label'
173
173
  end
174
174
  end
175
175
 
@@ -496,13 +496,13 @@ class TestFormBuilder < Test::Unit::TestCase
496
496
 
497
497
  should "display correct text area block in haml" do
498
498
  visit '/haml/form_for'
499
- assert_have_selector '#demo2 p label', :for => 'markup_user_about', :content => "About: "
499
+ assert_have_selector '#demo2 p label', :for => 'markup_user_about', :content => "About"
500
500
  assert_have_selector '#demo2 p textarea', :name => 'markup_user[about]', :id => 'markup_user_about'
501
501
  end
502
502
 
503
503
  should "display correct text area block in erb" do
504
504
  visit '/erb/form_for'
505
- assert_have_selector '#demo2 p label', :for => 'markup_user_about', :content => "About: "
505
+ assert_have_selector '#demo2 p label', :for => 'markup_user_about', :content => "About"
506
506
  assert_have_selector '#demo2 p textarea', :name => 'markup_user[about]', :id => 'markup_user_about'
507
507
  end
508
508
  end
@@ -516,13 +516,13 @@ class TestFormBuilder < Test::Unit::TestCase
516
516
 
517
517
  should "display correct password field block in haml" do
518
518
  visit '/haml/form_for'
519
- assert_have_selector '#demo2 p label', :for => 'markup_user_code', :content => "Code: "
519
+ assert_have_selector '#demo2 p label', :for => 'markup_user_code', :content => "Code"
520
520
  assert_have_selector '#demo2 p input', :type => 'password', :name => 'markup_user[code]', :id => 'markup_user_code'
521
521
  end
522
522
 
523
523
  should "display correct password field block in erb" do
524
524
  visit '/erb/form_for'
525
- assert_have_selector '#demo2 p label', :for => 'markup_user_code', :content => "Code: "
525
+ assert_have_selector '#demo2 p label', :for => 'markup_user_code', :content => "Code"
526
526
  assert_have_selector '#demo2 p input', :type => 'password', :name => 'markup_user[code]', :id => 'markup_user_code'
527
527
  end
528
528
  end
@@ -536,13 +536,13 @@ class TestFormBuilder < Test::Unit::TestCase
536
536
 
537
537
  should "display correct file field block in haml" do
538
538
  visit '/haml/form_for'
539
- assert_have_selector '#demo2 p label', :for => 'markup_user_photo', :content => "Photo: "
539
+ assert_have_selector '#demo2 p label', :for => 'markup_user_photo', :content => "Photo"
540
540
  assert_have_selector '#demo2 p input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
541
541
  end
542
542
 
543
543
  should "display correct file field block in erb" do
544
544
  visit '/erb/form_for'
545
- assert_have_selector '#demo2 p label', :for => 'markup_user_photo', :content => "Photo: "
545
+ assert_have_selector '#demo2 p label', :for => 'markup_user_photo', :content => "Photo"
546
546
  assert_have_selector '#demo2 p input.upload', :type => 'file', :name => 'markup_user[photo]', :id => 'markup_user_photo'
547
547
  end
548
548
  end
@@ -556,13 +556,13 @@ class TestFormBuilder < Test::Unit::TestCase
556
556
 
557
557
  should "display correct check box block in haml" do
558
558
  visit '/haml/form_for'
559
- assert_have_selector '#demo2 p label', :for => 'markup_user_remember_me', :content => "Remember Me: "
559
+ assert_have_selector '#demo2 p label', :for => 'markup_user_remember_me', :content => "Remember Me"
560
560
  assert_have_selector '#demo2 p input.checker', :type => 'checkbox', :name => 'markup_user[remember_me]'
561
561
  end
562
562
 
563
563
  should "display correct check box block in erb" do
564
564
  visit '/erb/form_for'
565
- assert_have_selector '#demo2 p label', :for => 'markup_user_remember_me', :content => "Remember Me: "
565
+ assert_have_selector '#demo2 p label', :for => 'markup_user_remember_me', :content => "Remember Me"
566
566
  assert_have_selector '#demo2 p input.checker', :type => 'checkbox', :name => 'markup_user[remember_me]'
567
567
  end
568
568
  end
@@ -578,7 +578,7 @@ class TestFormBuilder < Test::Unit::TestCase
578
578
 
579
579
  should "display correct select_block block in haml" do
580
580
  visit '/haml/form_for'
581
- assert_have_selector '#demo2 p label', :for => 'markup_user_state', :content => "State: "
581
+ assert_have_selector '#demo2 p label', :for => 'markup_user_state', :content => "State"
582
582
  assert_have_selector '#demo2 p select', :name => 'markup_user[state]', :id => 'markup_user_state'
583
583
  assert_have_selector '#demo2 p select option', :content => 'California'
584
584
  assert_have_selector '#demo2 p select option', :content => 'Texas'
@@ -586,7 +586,7 @@ class TestFormBuilder < Test::Unit::TestCase
586
586
 
587
587
  should "display correct select_block block in erb" do
588
588
  visit '/erb/form_for'
589
- assert_have_selector '#demo2 p label', :for => 'markup_user_state', :content => "State: "
589
+ assert_have_selector '#demo2 p label', :for => 'markup_user_state', :content => "State"
590
590
  assert_have_selector '#demo2 p select', :name => 'markup_user[state]', :id => 'markup_user_state'
591
591
  end
592
592
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra_more
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.33
4
+ version: 0.3.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-07 00:00:00 -08:00
12
+ date: 2010-02-09 00:00:00 -08:00
13
13
  default_executable: sinatra_gen
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: "0"
63
+ version: 0.9.2
64
64
  version:
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: haml
@@ -157,6 +157,11 @@ files:
157
157
  - generators/base_app/tmp/.empty_directory
158
158
  - generators/base_app/vendor/gems/.empty_directory
159
159
  - generators/components/component_actions.rb
160
+ - generators/components/files/jquery-1.3.2.min.js
161
+ - generators/components/files/lowpro.js
162
+ - generators/components/files/prototype.js
163
+ - generators/components/files/right-min.js
164
+ - generators/components/files/right-olds-min.js
160
165
  - generators/components/mocks/mocha_mock_gen.rb
161
166
  - generators/components/mocks/rr_mock_gen.rb
162
167
  - generators/components/orms/activerecord_orm_gen.rb