right-rails 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * RightJS-UI Lightbox v2.2.3
2
+ * RightJS-UI Lightbox v2.4.0
3
3
  * http://rightjs.org/ui/lightbox
4
4
  *
5
5
  * Copyright (C) 2009-2011 Nikolay Nemshilov
6
6
  */
7
- var Lightbox=RightJS.Lightbox=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d=new b.Class(b.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"}),this.dots=[];for(var c=0;c<(a||4);c++)this.dots.push(new b.Element("div"));this.dots[0].addClass("glowing"),this.insert(this.dots),b(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a),this.insert(a,"top")}}}),e=b,f=b.$,g=b.$$,h=b.$w,i=b.$E,j=b.$ext,k=b.Xhr,l=b.Class,m=b.Object,n=b.Element,o=b.Browser;o.IE6=o.OLD&&navigator.userAgent.indexOf("MSIE 6")>0;var p=new c({extend:{version:"2.2.3",EVENTS:h("show hide load"),Options:{fxName:"fade",fxDuration:300,group:null,hideOnEsc:!0,hideOnOutClick:!0,showCloseButton:!0,cssRule:"a[data-lightbox]",mediaWidth:425,mediaHeight:350},i18n:{Close:"Close",Prev:"Previous Image",Next:"Next Image"},Images:/\.(jpg|jpeg|gif|png|bmp)/i,Medias:[[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/i,"$1/v/$2","swf"],[/(http:\/\/video.google.com)\/videoplay\?docid=([^&]+)/i,"$1/googleplayer.swf?docId=$2","swf"],[/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/i,"$1/moogaloop.swf?clip_id=$2","swf"]]},initialize:function(a,b){this.$super("lightbox",{}).setOptions(a,b).insert([this.locker=new q(this.options),this.dialog=new r(this.options)]).on({close:this._close,next:this._next,prev:this._prev})},setOptions:function(a,b){this.$super(a,b);if(b){var c=b.get("rel");c&&(c=c.match(/lightbox\[(.+?)\]/))&&(this.options.group=c[1])}return this},setTitle:function(a){this.dialog.setTitle(a);return this},show:function(a){return this._showAnd(function(){this.dialog.show(a,!a)})},hide:function(){p.current=null;return this.$super(this.options.fxName,{duration:this.options.fxDuration/3,onFinish:e(function(){this.fire("hide"),this.remove()}).bind(this)})},load:function(a,b){return this._showAnd(function(){this.dialog.load(a,b)})},resize:function(a){this.dialog.resize(a);return this},_close:function(a){a.stop(),this.hide()},_prev:function(a){a.stop(),t.prev()},_next:function(a){a.stop(),t.next()},_showAnd:function(b){p.current!==this?(p.current=this,g("div.rui-lightbox").each("remove"),this.insertTo(a.body),this.dialog.show("",!0),o.OLD?(this.reposition(),n.prototype.show.call(this),b.call(this)):(this.setStyle("display:none"),n.prototype.show.call(this,this.options.fxName,{duration:this.options.fxDuration/2,onFinish:e(function(){b.call(this),this.fire("show")}).bind(this)}))):b.call(this);return this},reposition:function(){if(o.IE6){var a=f(window);this.setStyle({top:a.scrolls().y+"px",width:a.size().x+"px",height:a.size().y+"px",position:"absolute"})}}});p.extend({hide:function(){p.current&&p.current.hide()},show:function(){return this.inst("show",arguments)},load:function(){return this.inst("load",arguments)},inst:function(a,b){var c=new p;return c[a].apply(c,b)}});var q=new l(n,{initialize:function(a){this.$super("div",{"class":"rui-lightbox-locker"}),a.hideOnOutClick&&this.onClick("fire","close")}}),r=new l(n,{initialize:function(a){var b=p.i18n;this.options=a,this.$super("div",{"class":"rui-lightbox-dialog"}),this.insert([this.title=i("div",{"class":"rui-lightbox-title"}),i("div",{"class":"rui-lightbox-body"}).insert(i("div",{"class":"rui-lightbox-body-inner"}).insert([this.locker=i("div",{"class":"rui-lightbox-body-locker"}).insert(new d(4)),this.scroller=i("div",{"class":"rui-lightbox-scroller"}).insert(this.content=i("div",{"class":"rui-lightbox-content"}))])),i("div",{"class":"rui-lightbox-navigation"}).insert([this.closeButton=i("div",{"class":"close",html:"&times;",title:b.Close}).onClick("fire","close"),this.prevLink=i("div",{"class":"prev",html:"&larr;",title:b.Prev}).onClick("fire","prev"),this.nextLink=i("div",{"class":"next",html:"&rarr;",title:b.Next}).onClick("fire","next")])]),this.prevLink.hide(),this.nextLink.hide(),a.showCloseButton||this.closeButton.hide()},setTitle:function(a){this.title.update(a||"")},resize:function(a,c){var d=this.parent().size(),f=this.scroller.size(),g=(d.y-this.size().y)/2,h=this.size().x-f.x;a?(a=this.scroller.setStyle(a).size(),this.scroller.setStyle({width:f.x+"px",height:f.y+"px"})):a=this.content.size();var i=100;/^<img [^>]+>/img.test(this.content.html())?(e([["x","y"],["y","x"]]).each(function(b){var c=b[0],e=b[1],f=a[c];a[c]+i>d[c]&&(a[c]=d[c]-i,a[e]=Math.floor(a[e]*a[c]/f))}),this.content.first("img").setStyle({width:a.x+"px",height:a.y+"px"})):(a.x+i>d.x&&(a.x=d.x-i),a.y+i>d.y&&(a.y=d.y-i));var k=(g*2+f.y-a.y)/2,l=this._.style,m=this.scroller._.style;b.Fx&&c&&(a.x!=f.x||a.y!=f.y)?j(new b.Fx(this,{duration:this.options.fxDuration}),{render:function(b){m.width=f.x+(a.x-f.x)*b+"px",m.height=f.y+(a.y-f.y)*b+"px",l.top=g+(k-g)*b+"px",o.IE6&&(l.width=h+f.y+(a.y-f.y)*b+"px")}}).onFinish(e(this.unlock).bind(this)).start():(m.width=a.x+"px",m.height=a.y+"px",l.top=k+"px",o.IE6&&(l.width=h+a.x+"px"),this.request||this.unlock());return this},show:function(a,b){this.content.update(a||""),this.resize(null,!b)},load:function(a,b){a instanceof n&&(this.setTitle(a.get("title")),a=a.get("href")),t.show(this,a),this.lock().cancel(),this.request=new s(a,b,e(function(a,b){this.request=null,this.show(a,b)}).bind(this));return this.resize()},cancel:function(){this.request&&this.request.cancel();return this},lock:function(){this.locker.setStyle("opacity:1;display:block").insertTo(this.scroller,"before");return this},unlock:function(){this.locker.remove(e(this.content.html()).blank()?null:"fade",{duration:this.options.fxDuration*2/3});return this}}),s=new l({initialize:function(a,b,c){this.isImage(a,c)?p.current.addClass("rui-lightbox-image"):this.isMedia(a,c)?p.current.addClass("rui-lightbox-media"):this.xhr=(new k(a,m.merge({method:"get"},b))).onComplete(function(){c(this.text)}).send()},cancel:function(){this.xhr?this.xhr.cancel():this.img&&(this.img.onload=function(){})},isImage:function(a,b){if(a.match(p.Images)){var c=this.img=i("img")._;c.onload=function(){b(c)},c.src=a;return!0}},isMedia:function(a,b){var c=e(p.Medias).map(function(b){return a.match(b[0])?this.buildEmbed(a.replace(b[0],b[1]),b[2]):null},this).compact()[0];if(c){b(c,!0);return!0}},buildEmbed:function(a,b){var c={swf:["D27CDB6E-AE6D-11cf-96B8-444553540000","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0","application/x-shockwave-flash"]},d=p.current?p.current.options:p.Options,e=' width="'+d.mediaWidth+'" height="'+d.mediaHeight+'"';return'<object classid="clsid:'+c[b][0]+'" codebase="'+c[b][1]+'"'+e+'><param name="src" value="'+a+'" /><embed src="'+a+'" type="'+c[b][2]+'"'+e+" /></object>"}}),t={show:function(a,b){if(a.options.group){this.dialog=a,this.links=this.find(a.options.group),this.link=this.links.first(function(a){return a.get("href")===b});var c=this.links.indexOf(this.link),d=this.links.length;a.prevLink[d&&c>0?"show":"hide"](),a.nextLink[d&&c<d-1?"show":"hide"]()}else this.dialog=null},prev:function(){if(this.dialog&&!this.timer){var a=this.links.indexOf(this.link),b=this.links[a-1];b&&(this.dialog.load(b),this.timeout())}},next:function(){if(this.dialog&&!this.timer){var a=this.links.indexOf(this.link),b=this.links[a+1];b&&(this.dialog.load(b),this.timeout())}},find:function(a){return g("a").filter(function(b){var c=b.get("data-lightbox"),d=b.get("rel");return c&&(new Function("return "+c))().group===a||d&&d.indexOf("lightbox["+a+"]")>-1})},timeout:function(){this.timer=e(function(){t.timer=null}).delay(300)}};f(a).on({click:function(a){var b=a.find(p.Options.cssRule)||a.find("a[rel^=lightbox]"),c=a._;b&&!(c.shiftKey||c.altKey||c.ctrlKey||c.metaKey)&&(a.stop(),(new p({},b)).load(b))},mousewheel:function(a){if(p.current){var b=a.target,c=b.parent("div.rui-lightbox-content");(!c||b.getStyle("overflow")==="visible")&&a.stop(),p.current.fire((a._.detail||-a._.wheelDelta)<0?"prev":"next")}},keydown:function(a){var b=p.current,c=({27:"close",33:"prev",37:"prev",38:"prev",39:"next",40:"next",34:"next"})[a.keyCode];if(b&&c)if(c!=="close"||b.options.hideOnEsc)a.stop(),b.fire(c)}}),f(window).on({resize:function(){p.current&&(p.current.reposition(),p.current.dialog.resize())},scroll:function(a){p.current&&o.IE6&&p.current.reposition()}});var u=a.createElement("style"),v=a.createTextNode("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-lightbox{position:fixed;top:0;left:0;float:none;width:100%;height:100%;margin:0;padding:0;background:none;border:none;text-align:center;z-index:9999;z-index/*\\**/:auto\\9}div.rui-lightbox-locker{position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#000;opacity:0.8;filter:alpha(opacity=80);cursor:default;z-index/*\\**/:9990\\9}div.rui-lightbox-dialog{display:inline-block; *display:inline; *zoom:1;position:relative;text-align:left;z-index/*\\**/:9999\\9}div.rui-lightbox-title{height:1.2em;margin-bottom:.1em;white-space:nowrap;color:#DDD;font-weight:bold;font-size:1.6em;font-family:Helvetica}div.rui-lightbox-body{background-color:#FFF;padding:1em;border-radius:.5em;-moz-border-radius:.5em;-webkit-border-radius:.5em}div.rui-lightbox-body-inner{position:relative}div.rui-lightbox-scroller{overflow:hidden}div.rui-lightbox-content{display:inline-block; *display:inline; *zoom:1;min-height:10em;min-width:10em;_height:10em;_width:10em}div.rui-lightbox-body-locker{background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;opacity:0;filter:alpha(opacity=0)}div.rui-lightbox-body-locker div.rui-spinner{position:absolute;right:0;bottom:0;border:none;background:none;font-size:150%}div.rui-lightbox-navigation{color:#888;font-size:160%;font-family:Arial;height:1em;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-lightbox-navigation div{cursor:pointer;position:absolute}div.rui-lightbox-navigation div:hover{color:white}div.rui-lightbox-navigation div.next{left:2em}div.rui-lightbox-navigation div.close{right:0}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body{padding:0;border:1px solid #777;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px}div.rui-lightbox-image div.rui-lightbox-content,div.rui-lightbox-media div.rui-lightbox-content{min-height:12em;min-width:12em;_height:12em;_width:12em}div.rui-lightbox-image div.rui-lightbox-content img{vertical-align:middle}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-image div.rui-lightbox-body-locker,div.rui-lightbox-media div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body-locker{background-color:#D8D8D8}div.rui-lightbox-image div.rui-lightbox-body-locker div.rui-spinner,div.rui-lightbox-media div.rui-lightbox-body-locker div.rui-spinner{bottom:.5em;right:.5em}");u.type="text/css",a.getElementsByTagName("head")[0].appendChild(u),u.styleSheet?u.styleSheet.cssText=v.nodeValue:u.appendChild(v);return p}(document,RightJS)
7
+ var Lightbox=RightJS.Lightbox=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d=new b.Class(b.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"}),this.dots=[];for(var c=0;c<(a||4);c++)this.dots.push(new b.Element("div"));this.dots[0].addClass("glowing"),this.insert(this.dots),b(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a),this.insert(a,"top")}}}),e=b,f=b.$,g=b.$$,h=b.$w,i=b.$E,j=b.$ext,k=b.Xhr,l=b.Class,m=b.Object,n=b.Element,o=b.Browser;o.IE6=o.OLD&&navigator.userAgent.indexOf("MSIE 6")>0;var p=new c({extend:{version:"2.4.0",EVENTS:h("show hide load"),Options:{fxName:"fade",fxDuration:300,group:null,hideOnEsc:!0,hideOnOutClick:!0,showCloseButton:!0,cssRule:"a[data-lightbox]",mediaWidth:425,mediaHeight:350,fullscreen:!0},i18n:{Close:"Close",Prev:"Previous Image",Next:"Next Image"},Images:/\.(jpg|jpeg|gif|png|bmp)/i,Medias:[[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/i,"$1/v/$2","swf"],[/(http:\/\/video.google.com)\/videoplay\?docid=([^&]+)/i,"$1/googleplayer.swf?docId=$2","swf"],[/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/i,"$1/moogaloop.swf?clip_id=$2","swf"]]},initialize:function(a,b){this.$super("lightbox",{}).setOptions(a,b).insert([this.locker=new q(this.options),this.dialog=new r(this.options)]).on({close:this._close,next:this._next,prev:this._prev})},setOptions:function(a,b){this.$super(a,b);if(b){var c=b.get("rel");c&&(c=c.match(/lightbox\[(.+?)\]/))&&(this.options.group=c[1])}return this},setTitle:function(a){this.dialog.setTitle(a);return this},show:function(a){return this._showAnd(function(){this.dialog.show(a,!a)})},hide:function(){p.current=null;return this.$super(this.options.fxName,{duration:this.options.fxDuration/3,onFinish:e(function(){this.fire("hide"),this.remove()}).bind(this)})},load:function(a,b){return this._showAnd(function(){this.dialog.load(a,b)})},resize:function(a){this.dialog.resize(a);return this},_close:function(a){a.stop(),this.hide()},_prev:function(a){a.stop(),t.prev()},_next:function(a){a.stop(),t.next()},_showAnd:function(b){p.current!==this?(p.current=this,g("div.rui-lightbox").each("remove"),this.insertTo(a.body),this.dialog.show("",!0),o.OLD?(this.reposition(),n.prototype.show.call(this),b.call(this)):(this.setStyle("display:none"),n.prototype.show.call(this,this.options.fxName,{duration:this.options.fxDuration/2,onFinish:e(function(){b.call(this),this.fire("show")}).bind(this)}))):b.call(this);return this},reposition:function(){if(o.IE6){var a=f(window);this.setStyle({top:a.scrolls().y+"px",width:a.size().x+"px",height:a.size().y+"px",position:"absolute"})}}});p.extend({hide:function(){p.current&&p.current.hide()},show:function(){return this.inst("show",arguments)},load:function(){return this.inst("load",arguments)},inst:function(a,b){var c=new p;return c[a].apply(c,b)}});var q=new l(n,{initialize:function(a){this.$super("div",{"class":"rui-lightbox-locker"}),a.hideOnOutClick&&this.onClick("fire","close")}}),r=new l(n,{initialize:function(a){var b=p.i18n;this.options=a,this.$super("div",{"class":"rui-lightbox-dialog"}),this.insert([this.title=i("div",{"class":"rui-lightbox-title"}),i("div",{"class":"rui-lightbox-body"}).insert(i("div",{"class":"rui-lightbox-body-inner"}).insert([this.locker=i("div",{"class":"rui-lightbox-body-locker"}).insert(new d(4)),this.scroller=i("div",{"class":"rui-lightbox-scroller"}).insert(this.content=i("div",{"class":"rui-lightbox-content"}))])),i("div",{"class":"rui-lightbox-navigation"}).insert([this.closeButton=i("div",{"class":"close",html:"&times;",title:b.Close}).onClick("fire","close"),this.prevLink=i("div",{"class":"prev",html:"&larr;",title:b.Prev}).onClick("fire","prev"),this.nextLink=i("div",{"class":"next",html:"&rarr;",title:b.Next}).onClick("fire","next")])]),this.prevLink.hide(),this.nextLink.hide(),a.showCloseButton||this.closeButton.hide()},setTitle:function(a){this.title.update(a||"")},resize:function(a,c){var d=this.parent().size(),f=this.scroller.size(),g=(d.y-this.size().y)/2,h=this.size().x-f.x;a?(a=this.scroller.setStyle(a).size(),this.scroller.setStyle({width:f.x+"px",height:f.y+"px"})):a=this.content.size();var i=100;/^<img [^>]+>/img.test(this.content.html())?(e([["x","y"],["y","x"]]).each(function(b){var c=b[0],e=b[1],f=a[c];a[c]+i>d[c]&&(a[c]=d[c]-i,a[e]=Math.floor(a[e]*a[c]/f))}),this.content.first("img").setStyle({width:a.x+"px",height:a.y+"px"})):(a.x+i>d.x&&(a.x=d.x-i),a.y+i>d.y&&(a.y=d.y-i));var k=(g*2+f.y-a.y)/2,l=this._.style,m=this.scroller._.style;b.Fx&&c&&(a.x!=f.x||a.y!=f.y)?j(new b.Fx(this,{duration:this.options.fxDuration}),{render:function(b){m.width=f.x+(a.x-f.x)*b+"px",m.height=f.y+(a.y-f.y)*b+"px",l.top=g+(k-g)*b+"px",o.IE6&&(l.width=h+f.y+(a.y-f.y)*b+"px")}}).onFinish(e(this.unlock).bind(this)).start():(m.width=a.x+"px",m.height=a.y+"px",l.top=k+"px",o.IE6&&(l.width=h+a.x+"px"),this.request||this.unlock());return this},show:function(a,b){this.content.update(a||""),this.resize(null,!b)},load:function(a,b){a instanceof n&&(this.setTitle(a.get("title")),a=a.get("href")),t.show(this,a),this.lock().cancel(),this.request=new s(a,b,e(function(a,b){this.request=null,this.show(a,b)}).bind(this));return this.resize()},cancel:function(){this.request&&this.request.cancel();return this},lock:function(){this.locker.setStyle("opacity:1;display:block").insertTo(this.scroller,"before");return this},unlock:function(){this.locker.remove(e(this.content.html()).blank()?null:"fade",{duration:this.options.fxDuration*2/3});return this}}),s=new l({initialize:function(a,b,c){this.isImage(a,c)?p.current.addClass("rui-lightbox-image"):this.isMedia(a,c)?p.current.addClass("rui-lightbox-media"):this.xhr=(new k(a,m.merge({method:"get"},b))).onComplete(function(){c(this.text)}).send()},cancel:function(){this.xhr?this.xhr.cancel():this.img&&(this.img.onload=function(){})},isImage:function(a,b){if(a.match(p.Images)){var c=this.img=i("img")._;c.onload=function(){b(c)},c.src=a;return!0}},isMedia:function(a,b){var c=e(p.Medias).map(function(b){return a.match(b[0])?this.buildEmbed(a.replace(b[0],b[1]),b[2]):null},this).compact()[0];if(c){b(c,!0);return!0}},buildEmbed:function(a,b){var c={swf:["D27CDB6E-AE6D-11cf-96B8-444553540000","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0","application/x-shockwave-flash"]},d=p.current?p.current.options:p.Options,e=' width="'+d.mediaWidth+'" height="'+d.mediaHeight+'"',f=d.fullscreen?'<param name="allowFullScreen" value="true"></param>':"",g=d.fullscreen?' allowfullscreen="true"':"";a.indexOf("youtube.com")>0&&d.fullscreen&&(a+="?version=3&amp;hl=en_US&amp;rel=0");return'<object classid="clsid:'+c[b][0]+'" codebase="'+c[b][1]+'"'+e+'><param name="src" value="'+a+'" />'+f+'<embed src="'+a+'" type="'+c[b][2]+'"'+e+g+" /></object>"}}),t={show:function(a,b){if(a.options.group){this.dialog=a,this.links=this.find(a.options.group),this.link=this.links.first(function(a){return a.get("href")===b});var c=this.links.indexOf(this.link),d=this.links.length;a.prevLink[d&&c>0?"show":"hide"](),a.nextLink[d&&c<d-1?"show":"hide"]()}else this.dialog=null},prev:function(){if(this.dialog&&!this.timer){var a=this.links.indexOf(this.link),b=this.links[a-1];b&&(this.dialog.load(b),this.timeout())}},next:function(){if(this.dialog&&!this.timer){var a=this.links.indexOf(this.link),b=this.links[a+1];b&&(this.dialog.load(b),this.timeout())}},find:function(a){return g("a").filter(function(b){var c=b.get("data-lightbox"),d=b.get("rel");return c&&(new Function("return "+c))().group===a||d&&d.indexOf("lightbox["+a+"]")>-1})},timeout:function(){this.timer=e(function(){t.timer=null}).delay(300)}};f(a).on({click:function(a){var b=a.find(p.Options.cssRule)||a.find("a[rel^=lightbox]"),c=a._;b&&!(c.shiftKey||c.altKey||c.ctrlKey||c.metaKey)&&(a.stop(),(new p({},b)).load(b))},mousewheel:function(a){if(p.current){var b=a.target,c=b.parent("div.rui-lightbox-content");(!c||b.getStyle("overflow")==="visible")&&a.stop(),p.current.fire((a._.detail||-a._.wheelDelta)<0?"prev":"next")}},keydown:function(a){var b=p.current,c=({27:"close",33:"prev",37:"prev",38:"prev",39:"next",40:"next",34:"next"})[a.keyCode];if(b&&c)if(c!=="close"||b.options.hideOnEsc)a.stop(),b.fire(c)}}),f(window).on({resize:function(){p.current&&(p.current.reposition(),p.current.dialog.resize())},scroll:function(a){p.current&&o.IE6&&p.current.reposition()}});var u=a.createElement("style"),v=a.createTextNode("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-lightbox{position:fixed;top:0;left:0;float:none;width:100%;height:100%;margin:0;padding:0;background:none;border:none;text-align:center;z-index:9999;z-index/*\\**/:auto\\9}div.rui-lightbox-locker{position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#000;opacity:0.8;filter:alpha(opacity=80);cursor:default;z-index/*\\**/:9990\\9}div.rui-lightbox-dialog{display:inline-block; *display:inline; *zoom:1;position:relative;text-align:left;z-index/*\\**/:9999\\9}div.rui-lightbox-title{height:1.2em;margin-bottom:.1em;white-space:nowrap;color:#DDD;font-weight:bold;font-size:1.6em;font-family:Helvetica}div.rui-lightbox-body{background-color:#FFF;padding:1em;border-radius:.5em;-moz-border-radius:.5em;-webkit-border-radius:.5em}div.rui-lightbox-body-inner{position:relative}div.rui-lightbox-scroller{overflow:hidden}div.rui-lightbox-content{display:inline-block; *display:inline; *zoom:1;min-height:10em;min-width:10em;_height:10em;_width:10em}div.rui-lightbox-body-locker{background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;opacity:0;filter:alpha(opacity=0)}div.rui-lightbox-body-locker div.rui-spinner{position:absolute;right:0;bottom:0;border:none;background:none;font-size:150%}div.rui-lightbox-navigation{color:#888;font-size:160%;font-family:Arial;height:1em;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-lightbox-navigation div{cursor:pointer;position:absolute}div.rui-lightbox-navigation div:hover{color:white}div.rui-lightbox-navigation div.next{left:2em}div.rui-lightbox-navigation div.close{right:0}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body{padding:0;border:1px solid #777;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px}div.rui-lightbox-image div.rui-lightbox-content,div.rui-lightbox-media div.rui-lightbox-content{min-height:12em;min-width:12em;_height:12em;_width:12em}div.rui-lightbox-image div.rui-lightbox-content img{vertical-align:middle}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-image div.rui-lightbox-body-locker,div.rui-lightbox-media div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body-locker{background-color:#D8D8D8}div.rui-lightbox-image div.rui-lightbox-body-locker div.rui-spinner,div.rui-lightbox-media div.rui-lightbox-body-locker div.rui-spinner{bottom:.5em;right:.5em}");u.type="text/css",a.getElementsByTagName("head")[0].appendChild(u),u.styleSheet?u.styleSheet.cssText=v.nodeValue:u.appendChild(v);return p}(document,RightJS)
@@ -1,14 +1,14 @@
1
1
  /**
2
- * RubyOnRails Support Module v2.3.1
2
+ * RubyOnRails Support Module v2.3.2
3
3
  * http://rightjs.org/plugins/rails
4
4
  *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
6
6
  */
7
7
  (function(window, document, RightJS) {
8
8
  /**
9
9
  * The Rails plugin initialization script
10
10
  *
11
- * Copyright (C) 2010-2011 Nikolay Nemshilov
11
+ * Copyright (C) 2010-2012 Nikolay Nemshilov
12
12
  */
13
13
 
14
14
  var R = RightJS,
@@ -20,7 +20,7 @@ var R = RightJS,
20
20
  Input = RightJS.Input;
21
21
 
22
22
  RightJS.Rails = {
23
- version: '2.3.1'
23
+ version: '2.3.2'
24
24
  };
25
25
 
26
26
 
@@ -101,7 +101,7 @@ RightJS.$alias(RightJS.Array.prototype, {
101
101
  /**
102
102
  * Rails 3 UJS support module
103
103
  *
104
- * Copyright (C) 2010-2011 Nikolay Nemshilov
104
+ * Copyright (C) 2010-2012 Nikolay Nemshilov
105
105
  */
106
106
  // tries to cancel the event via confirmation
107
107
  function user_cancels(event, element) {
@@ -159,11 +159,7 @@ function try_link_submit(event, link) {
159
159
  var url = link.get('href'),
160
160
  method = link.get('data-method'),
161
161
  remote = link.get('data-remote'),
162
- param = $$('meta[name=csrf-param]')[0],
163
- token = $$('meta[name=csrf-token]')[0];
164
-
165
- param = param && param.get('content');
166
- token = token && token.get('content');
162
+ token = get_csrf_token();
167
163
 
168
164
  if (user_cancels(event, link)) { return; }
169
165
  if (method || remote) { event.stop(); }
@@ -172,14 +168,14 @@ function try_link_submit(event, link) {
172
168
  Xhr.load(url, add_xhr_events(link, {
173
169
  method: method || 'get',
174
170
  spinner: link.get('data-spinner'),
175
- params: new Function('return {"'+ param +'": "'+ token +'"}')()
171
+ params: new Function('return {"'+ token[0] +'": "'+ token[1] +'"}')()
176
172
  }));
177
173
 
178
174
  } else if (method) {
179
175
  var form = $E('form', {action: url, method: 'post'});
180
176
 
181
- if (param && token) {
182
- form.insert('<input type="hidden" name="'+param+'" value="'+token+'" />');
177
+ if (token) {
178
+ form.insert('<input type="hidden" name="'+token[0]+'" value="'+token[1]+'" />');
183
179
  }
184
180
 
185
181
  form.insert('<input type="hidden" name="_method" value="'+method+'"/>')
@@ -189,8 +185,40 @@ function try_link_submit(event, link) {
189
185
  }
190
186
  }
191
187
 
188
+ function get_csrf_token() {
189
+ var param, token;
190
+
191
+ param = $$('meta[name=csrf-param]')[0];
192
+ token = $$('meta[name=csrf-token]')[0];
193
+
194
+ param = param && param.get('content');
195
+ token = token && token.get('content');
196
+
197
+ if (param && token) {
198
+ return [param, token];
199
+ }
200
+ }
201
+
192
202
  // global events listeners
193
203
  $(document).on({
204
+ ready: function() {
205
+ var token = get_csrf_token(), i = 0, xhr,
206
+ modules = ['InEdit', 'Rater', 'Sortable'];
207
+
208
+ if (token) {
209
+ for (; i < modules.length; i++) {
210
+ if (modules[i] in RightJS) {
211
+ xhr = RightJS[modules[i]].Options.Xhr;
212
+
213
+ if (RightJS.isHash(xhr)) {
214
+ xhr.params = Object.merge(xhr.params, {});
215
+ xhr.params[token[0]] = token[1];
216
+ }
217
+ }
218
+ }
219
+ }
220
+ },
221
+
194
222
  click: function(event) {
195
223
  var link = event.find('a');
196
224
  if (link) {
@@ -1,7 +1,7 @@
1
1
  /**
2
- * RubyOnRails Support Module v2.3.1
2
+ * RubyOnRails Support Module v2.3.2
3
3
  * http://rightjs.org/plugins/rails
4
4
  *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
6
6
  */
7
- (function(a,b,c){function p(a,c){var d=c.get("href"),e=c.get("data-method"),i=c.get("data-remote"),j=f("meta[name=csrf-param]")[0],n=f("meta[name=csrf-token]")[0];j=j&&j.get("content"),n=n&&n.get("content");if(!k(a,c)){(e||i)&&a.stop();if(i)h.load(d,l(c,{method:e||"get",spinner:c.get("data-spinner"),params:(new Function('return {"'+j+'": "'+n+'"}'))()}));else if(e){var o=g("form",{action:d,method:"post"});j&&n&&o.insert('<input type="hidden" name="'+j+'" value="'+n+'" />'),o.insert('<input type="hidden" name="_method" value="'+e+'"/>').insertTo(b.body).submit(),m(c)}}}function o(a){return a.has("data-disable-with")?d([a]):a.find("*[data-disable-with]")}function n(a){o(a).each(function(a){if(a.__disable_with_html!==undefined){var b=a instanceof j?"value":"html";a[b](a.__disable_with_html),delete a.__disable_with_html}})}function m(a){o(a).each(function(a){var b=a instanceof j?"value":"html";a.__disable_with_html=a[b](),a[b](a.get("data-disable-with"))})}function l(a,b){return i.merge({onCreate:function(){m(a),a.fire("ajax:loading",{xhr:this})},onComplete:function(){n(a),a.fire("ajax:complete",{xhr:this})},onSuccess:function(){a.fire("ajax:success",{xhr:this})},onFailure:function(){a.fire("ajax:failure",{xhr:this})}},b)}function k(a,b){var c=b.get("data-confirm");if(c&&!confirm(c)){a.stop();return!0}}var d=c,e=c.$,f=c.$$,g=c.$E,h=c.Xhr,i=c.Object,j=c.Input;c.Rails={version:"2.3.1"},d([c.String.prototype,c.Array.prototype,c.Function.prototype,c.Object,c.Options,c.Observer,c.Observer.prototype,c.Window.prototype,c.Document.prototype]).each(function(a){for(var b in a)try{if(/[A-Z]/.test(b)&&typeof a[b]==="function"){var c=d(b).underscored();if(a[c]===null||a[c]===undefined)a[c]=a[b]}}catch(e){}}),d([c.Element,c.Event,c.Form,c.Input]).each(function(a){if(a){var b={},c=a.prototype;for(var e in c)/[A-Z]/.test(e)&&typeof c[e]==="function"&&(a.prototype[d(e).underscored()]=c[e])}}),c.$alias(c.String.prototype,{index_of:"indexOf",last_index_of:"lastIndexOf",to_f:"toFloat",to_i:"toInt",gsub:"replace",downcase:"toLowerCase",upcase:"toUpperCase",index:"indexOf",rindex:"lastIndexOf",strip:"trim"}),c.$alias(c.Array.prototype,{collect:"map",detect:"filter",index_of:"indexOf",last_index_of:"lastIndexOf",index:"indexOf",rindex:"lastIndexOf"}),e(b).on({click:function(a){var b=a.find("a");b&&p(a,b)},submit:function(a){var b=a.target;b.has("data-remote")&&!k(a,b)&&(a.stop(),b.send(l(b,{spinner:b.get("data-spinner")||b.first(".spinner")})))}});var q={Options:{format:"js",flashId:"flashes",flashHideFx:"slide",flashHideDelay:3200,highlightUpdates:!0,removeFx:"fade",insertFx:"fade",insertPosition:"bottom",linkToAjaxEdit:".ajax_edit",linkToAjaxDelete:".ajax_delete",rescanWithScopes:!0},update_flash:function(a){var b=e(this.Options.flashId);b&&this.replace(b,a).hide_flash();return this},hide_flash:function(){if(this.Options.flashHideDelay>-1){var a=e(this.Options.flashId);a&&a.visible()&&a.hide.bind(a,this.Options.flashHideFx).delay(this.Options.flashHideDelay)}return this},highlight:function(a){e(a)&&this.Options.highlightUpdates&&e(a).highlight();return this},insert:function(a,b,c){var d=c||this.Options.insertPosition,f,g=e(a).insert(b,d);switch(d){case"bottom":f=g.children().last();break;case"top":f=g.first();break;case"before":f=g.prev();break;case"after":f=g.next()}f&&this.Options.insertFx?f.hide().show(this.Options.insertFx,{onFinish:this.highlight.bind(this,f)}):this.highlight(f);return this.rescan(a)},replace:function(a,b){e(a).replace(b);return this.highlight(a).rescan(a)},remove:function(a){e(a)&&e(a).remove(this.Options.removeFx)},remotize_form:function(a){var b=e(a);b&&(b.remotize().enable()._.action+="."+this.Options.format);return this},replace_form:function(a,b){var c=e(a);c&&(c.replace(b),this.remotize_form(a));return this.rescan(a)},show_form_for:function(a,b){e(a).find("form").each("remove"),e(a).insert(b);return this.remotize_form(e(a).first("form")).rescan(a)},process_click:function(a){var b;(b=a.find("a"+this.Options.linkToAjaxEdit))?(a.stop(),h.load(b.get("href")+"."+this.Options.format)):(b=a.find("a"+this.Options.linkToAjaxDelete))&&b.has("onclick")&&(a.stop(),(new Function("return "+b.onclick.toString().replace(".submit",".send")))().call(b))},rescan:function(b){$w("Draggable Droppable Tabs Tags Selectable").each(function(c){c in a&&a[c].rescan(this.Options.rescanWithScopes?b:null)},this);return this}};e(b).on({ready:function(){q.hide_flash()},click:function(a){q.process_click(a)}}),a.RR=q})(window,document,RightJS)
7
+ (function(a,b,c){function q(){var a,b;a=f("meta[name=csrf-param]")[0],b=f("meta[name=csrf-token]")[0],a=a&&a.get("content"),b=b&&b.get("content");if(a&&b)return[a,b]}function p(a,c){var d=c.get("href"),e=c.get("data-method"),f=c.get("data-remote"),i=q();if(!k(a,c)){(e||f)&&a.stop();if(f)h.load(d,l(c,{method:e||"get",spinner:c.get("data-spinner"),params:(new Function('return {"'+i[0]+'": "'+i[1]+'"}'))()}));else if(e){var j=g("form",{action:d,method:"post"});i&&j.insert('<input type="hidden" name="'+i[0]+'" value="'+i[1]+'" />'),j.insert('<input type="hidden" name="_method" value="'+e+'"/>').insertTo(b.body).submit(),m(c)}}}function o(a){return a.has("data-disable-with")?d([a]):a.find("*[data-disable-with]")}function n(a){o(a).each(function(a){if(a.__disable_with_html!==undefined){var b=a instanceof j?"value":"html";a[b](a.__disable_with_html),delete a.__disable_with_html}})}function m(a){o(a).each(function(a){var b=a instanceof j?"value":"html";a.__disable_with_html=a[b](),a[b](a.get("data-disable-with"))})}function l(a,b){return i.merge({onCreate:function(){m(a),a.fire("ajax:loading",{xhr:this})},onComplete:function(){n(a),a.fire("ajax:complete",{xhr:this})},onSuccess:function(){a.fire("ajax:success",{xhr:this})},onFailure:function(){a.fire("ajax:failure",{xhr:this})}},b)}function k(a,b){var c=b.get("data-confirm");if(c&&!confirm(c)){a.stop();return!0}}var d=c,e=c.$,f=c.$$,g=c.$E,h=c.Xhr,i=c.Object,j=c.Input;c.Rails={version:"2.3.2"},d([c.String.prototype,c.Array.prototype,c.Function.prototype,c.Object,c.Options,c.Observer,c.Observer.prototype,c.Window.prototype,c.Document.prototype]).each(function(a){for(var b in a)try{if(/[A-Z]/.test(b)&&typeof a[b]==="function"){var c=d(b).underscored();if(a[c]===null||a[c]===undefined)a[c]=a[b]}}catch(e){}}),d([c.Element,c.Event,c.Form,c.Input]).each(function(a){if(a){var b={},c=a.prototype;for(var e in c)/[A-Z]/.test(e)&&typeof c[e]==="function"&&(a.prototype[d(e).underscored()]=c[e])}}),c.$alias(c.String.prototype,{index_of:"indexOf",last_index_of:"lastIndexOf",to_f:"toFloat",to_i:"toInt",gsub:"replace",downcase:"toLowerCase",upcase:"toUpperCase",index:"indexOf",rindex:"lastIndexOf",strip:"trim"}),c.$alias(c.Array.prototype,{collect:"map",detect:"filter",index_of:"indexOf",last_index_of:"lastIndexOf",index:"indexOf",rindex:"lastIndexOf"}),e(b).on({ready:function(){var a=q(),b=0,d,e=["InEdit","Rater","Sortable"];if(a)for(;b<e.length;b++)e[b]in c&&(d=c[e[b]].Options.Xhr,c.isHash(d)&&(d.params=i.merge(d.params,{}),d.params[a[0]]=a[1]))},click:function(a){var b=a.find("a");b&&p(a,b)},submit:function(a){var b=a.target;b.has("data-remote")&&!k(a,b)&&(a.stop(),b.send(l(b,{spinner:b.get("data-spinner")||b.first(".spinner")})))}});var r={Options:{format:"js",flashId:"flashes",flashHideFx:"slide",flashHideDelay:3200,highlightUpdates:!0,removeFx:"fade",insertFx:"fade",insertPosition:"bottom",linkToAjaxEdit:".ajax_edit",linkToAjaxDelete:".ajax_delete",rescanWithScopes:!0},update_flash:function(a){var b=e(this.Options.flashId);b&&this.replace(b,a).hide_flash();return this},hide_flash:function(){if(this.Options.flashHideDelay>-1){var a=e(this.Options.flashId);a&&a.visible()&&a.hide.bind(a,this.Options.flashHideFx).delay(this.Options.flashHideDelay)}return this},highlight:function(a){e(a)&&this.Options.highlightUpdates&&e(a).highlight();return this},insert:function(a,b,c){var d=c||this.Options.insertPosition,f,g=e(a).insert(b,d);switch(d){case"bottom":f=g.children().last();break;case"top":f=g.first();break;case"before":f=g.prev();break;case"after":f=g.next()}f&&this.Options.insertFx?f.hide().show(this.Options.insertFx,{onFinish:this.highlight.bind(this,f)}):this.highlight(f);return this.rescan(a)},replace:function(a,b){e(a).replace(b);return this.highlight(a).rescan(a)},remove:function(a){e(a)&&e(a).remove(this.Options.removeFx)},remotize_form:function(a){var b=e(a);b&&(b.remotize().enable()._.action+="."+this.Options.format);return this},replace_form:function(a,b){var c=e(a);c&&(c.replace(b),this.remotize_form(a));return this.rescan(a)},show_form_for:function(a,b){e(a).find("form").each("remove"),e(a).insert(b);return this.remotize_form(e(a).first("form")).rescan(a)},process_click:function(a){var b;(b=a.find("a"+this.Options.linkToAjaxEdit))?(a.stop(),h.load(b.get("href")+"."+this.Options.format)):(b=a.find("a"+this.Options.linkToAjaxDelete))&&b.has("onclick")&&(a.stop(),(new Function("return "+b.onclick.toString().replace(".submit",".send")))().call(b))},rescan:function(b){$w("Draggable Droppable Tabs Tags Selectable").each(function(c){c in a&&a[c].rescan(this.Options.rescanWithScopes?b:null)},this);return this}};e(b).on({ready:function(){r.hide_flash()},click:function(a){r.process_click(a)}}),a.RR=r})(window,document,RightJS)
@@ -1,8 +1,8 @@
1
1
  /**
2
- * RightJS-UI Resizable v2.2.3
2
+ * RightJS-UI Resizable v2.2.4
3
3
  * http://rightjs.org/ui/resizable
4
4
  *
5
- * Copyright (C) 2010-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2010-2012 Nikolay Nemshilov
6
6
  */
7
7
  var Resizable = RightJS.Resizable = (function(document, RightJS) {
8
8
  /**
@@ -122,11 +122,11 @@ var R = RightJS,
122
122
  /**
123
123
  * The resizable unit main file
124
124
  *
125
- * Copyright (C) 2010-2011 Nikolay Nemshilov
125
+ * Copyright (C) 2010-2012 Nikolay Nemshilov
126
126
  */
127
127
  var Resizable = new Widget({
128
128
  extend: {
129
- version: '2.2.3',
129
+ version: '2.2.4',
130
130
 
131
131
  EVENTS: $w('resize start release'),
132
132
 
@@ -350,46 +350,57 @@ var Resizable = new Widget({
350
350
  /**
351
351
  * Document level hooks for resizables
352
352
  *
353
- * Copyright (C) 2010 Nikolay Nemshilov
353
+ * Copyright (C) 2010-2012 Nikolay Nemshilov
354
354
  */
355
355
  $(document).on({
356
- mousedown: function(event) {
357
- var handle = event.find('.rui-resizable-handle');
358
- if (handle) {
359
- var resizable = handle.parent();
356
+ mousedown: document_mousedown,
357
+ touchstart: document_mousedown,
360
358
 
361
- if (!(resizable instanceof Resizable)) {
362
- resizable = new Resizable(resizable);
363
- }
359
+ mousemove: document_mousemove,
360
+ touchmove: document_mousemove,
364
361
 
365
- Resizable.current = resizable.start(event.stop());
366
- }
367
- },
362
+ mouseup: document_mouseup,
363
+ touchend: document_mouseup
364
+ });
368
365
 
369
- mousemove: function(event) {
370
- var resizable = Resizable.current;
371
- if (resizable) {
372
- resizable.track(event);
373
- }
374
- },
366
+ $(window).onBlur(function(event) {
367
+ var resizable = Resizable.current;
368
+ if (resizable) {
369
+ resizable.release(event);
370
+ Resizable.current = null;
371
+ }
372
+ });
375
373
 
376
- mouseup: function(event) {
377
- var resizable = Resizable.current;
374
+ function document_mousedown(event) {
375
+ var handle = event.find('.rui-resizable-handle');
376
+ if (handle) {
377
+ var resizable = handle.parent();
378
378
 
379
- if (resizable) {
380
- resizable.release(event);
381
- Resizable.current = null;
379
+ if (!(resizable instanceof Resizable)) {
380
+ resizable = new Resizable(resizable);
382
381
  }
382
+
383
+ Resizable.current = resizable.start(event.stop());
383
384
  }
384
- });
385
+ }
385
386
 
386
- $(window).onBlur(function(event) {
387
+ function document_mousemove(event) {
387
388
  var resizable = Resizable.current;
389
+ if (resizable) {
390
+ resizable.track(event);
391
+ }
392
+ }
393
+
394
+ function document_mouseup(event) {
395
+ var resizable = Resizable.current;
396
+
388
397
  if (resizable) {
389
398
  resizable.release(event);
390
399
  Resizable.current = null;
391
400
  }
392
- });
401
+ }
402
+
403
+
393
404
 
394
405
 
395
406
  /**
@@ -1,7 +1,7 @@
1
1
  /**
2
- * RightJS-UI Resizable v2.2.3
2
+ * RightJS-UI Resizable v2.2.4
3
3
  * http://rightjs.org/ui/resizable
4
4
  *
5
- * Copyright (C) 2010-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2010-2012 Nikolay Nemshilov
6
6
  */
7
- var Resizable=RightJS.Resizable=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d=b,e=b.$,f=b.$w,g=b.$E,h=b.Class,i=b.Element,j=new c({extend:{version:"2.2.3",EVENTS:f("resize start release"),Options:{direction:null,minWidth:null,maxWidth:null,minHeight:null,maxHeight:null}},initialize:function(a,b){this.$super("resizable",this.old_inst=e(a)).setOptions(b),this.options.direction?this.addClass("rui-resizable-"+this.options.direction):this.addClass("rui-resizable"),this.content=this.first(".rui-resizable-content")||g("div",{"class":"rui-resizable-content"}).insert(this.children()).insertTo(this),this.handle=this.first(".rui-resizable-handle")||g("div",{"class":"rui-resizable-handle"}).insertTo(this),this.content.setWidth(this.size().x-parseInt(this.getStyle("borderLeftWidth"),10)-parseInt(this.getStyle("borderRightWidth"),10)),this.options.direction!=="left"&&this.options.direction!=="right"&&this.content.setHeight(this.size().y-parseInt(this.getStyle("borderTopWidth"),10)-parseInt(this.getStyle("borderBottomWidth"),10))},destroy:function(){this.removeClass("rui-resizable").removeClass("rui-resizable-top").removeClass("rui-resizable-left").removeClass("rui-resizable-right").removeClass("rui-resizable-bottom").insert(this.content._.childNodes),this.content.remove(),this.handle.remove(),this.old_inst&&(Wrapper.Cache[$uid(this._)]=this.old_inst);return this},setOptions:function(a,b){a=a||{},f("top left right bottom").each(function(b){this.hasClass("rui-resizable-"+b)&&(a.direction=b)},this);return this.$super(a,b)},start:function(a){this.prevSizes=this.size(),this.prevEvPos=a.position(),this.contXDiff=this.size().x-this.content.size().x,this.contYDiff=this.size().y-this.content.size().y,f("minWidth maxWidth minHeight maxHeight").each(function(a){this[a]=this.findDim(a)},this);return this.fire("start",{original:a})},track:function(a){var b=a.position(),c=this.prevEvPos,d=this.handle.dimensions(),e=this.prevSizes,f=e.x,g=e.y,h=c.x-b.x,i=c.y-b.y,j=this.minWidth,k=this.maxWidth,l=this.minHeight,m=this.maxHeight,n=this.options,o=n.direction;f+=(o==="left"?1:-1)*h,g+=(o==="top"?1:-1)*i,f<j&&(f=j),f>k&&(f=k),g<l&&(g=l),g>m&&(g=m),e.x!==f&&o!=="top"&&o!=="bottom"&&this.setWidth(f),e.y!==g&&o!=="left"&&o!=="right"&&this.setHeight(g);if(f==j||f==k)b.x=d.left+d.width/2;if(g==l||g==m)b.y=d.top+d.height/2;this.prevEvPos=b,this.prevSizes=this.size(),this.fire("resize",{original:a})},setWidth:function(a){this.content.setWidth(a-this.contXDiff);return this.$super(a)},setHeight:function(a){this.content.setHeight(a-this.contYDiff);return this.$super(a)},release:function(a){return this.fire("release",{original:a})},findDim:function(a){var b=this.options[a]||this.getStyle(a);if(b&&/\d+/.test(b)&&parseFloat(b)>0){var c=d(a).include("Width")?"width":"height",e=(this._dummy||(this._dummy=g("div",{style:"visibility:hidden;z-index:-1"}))).setStyle(c,b).insertTo(this,"before"),f=e._["offset"+d(c).capitalize()];e.remove();return f}}});e(a).on({mousedown:function(a){var b=a.find(".rui-resizable-handle");if(b){var c=b.parent();c instanceof j||(c=new j(c)),j.current=c.start(a.stop())}},mousemove:function(a){var b=j.current;b&&b.track(a)},mouseup:function(a){var b=j.current;b&&(b.release(a),j.current=null)}}),e(window).onBlur(function(a){var b=j.current;b&&(b.release(a),j.current=null)}),i.include({makeResizable:function(a){return new j(this,a)},undoResizable:function(){this instanceof j&&this.destroy();return this}}),"Draggable"in b&&b.Draggable.include({dragStart:function(a){a.target.hasClass("rui-resizable-handle")||this.$super(a)}});var k=a.createElement("style"),l=a.createTextNode(".rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom,.rui-resizable-content .rui-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.rui-resizable-content{overflow:auto;padding:.5em;position:relative}.rui-resizable-handle{position:absolute;background-image:url(/assets/rightjs-ui/resizable.png);background-repeat:no-repeat;background-color:#DDD;cursor:move}.rui-resizable .rui-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.rui-resizable-top .rui-resizable-handle,.rui-resizable-bottom .rui-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.rui-resizable-left .rui-resizable-handle,.rui-resizable-right .rui-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.rui-resizable-top .rui-resizable-content{padding-top:1em}.rui-resizable-top .rui-resizable-handle{top:0}.rui-resizable-bottom .rui-resizable-content{padding-bottom:1em}.rui-resizable-bottom .rui-resizable-handle{bottom:0}.rui-resizable-left .rui-resizable-content{padding-left:1em}.rui-resizable-left .rui-resizable-handle{left:0}.rui-resizable-right .rui-resizable-content{padding-right:1em}.rui-resizable-right .rui-resizable-handle{right:0}");k.type="text/css",a.getElementsByTagName("head")[0].appendChild(k),k.styleSheet?k.styleSheet.cssText=l.nodeValue:k.appendChild(l);return j}(document,RightJS)
7
+ var Resizable=RightJS.Resizable=function(a,b){function m(a){var b=j.current;b&&(b.release(a),j.current=null)}function l(a){var b=j.current;b&&b.track(a)}function k(a){var b=a.find(".rui-resizable-handle");if(b){var c=b.parent();c instanceof j||(c=new j(c)),j.current=c.start(a.stop())}}function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d=b,e=b.$,f=b.$w,g=b.$E,h=b.Class,i=b.Element,j=new c({extend:{version:"2.2.4",EVENTS:f("resize start release"),Options:{direction:null,minWidth:null,maxWidth:null,minHeight:null,maxHeight:null}},initialize:function(a,b){this.$super("resizable",this.old_inst=e(a)).setOptions(b),this.options.direction?this.addClass("rui-resizable-"+this.options.direction):this.addClass("rui-resizable"),this.content=this.first(".rui-resizable-content")||g("div",{"class":"rui-resizable-content"}).insert(this.children()).insertTo(this),this.handle=this.first(".rui-resizable-handle")||g("div",{"class":"rui-resizable-handle"}).insertTo(this),this.content.setWidth(this.size().x-parseInt(this.getStyle("borderLeftWidth"),10)-parseInt(this.getStyle("borderRightWidth"),10)),this.options.direction!=="left"&&this.options.direction!=="right"&&this.content.setHeight(this.size().y-parseInt(this.getStyle("borderTopWidth"),10)-parseInt(this.getStyle("borderBottomWidth"),10))},destroy:function(){this.removeClass("rui-resizable").removeClass("rui-resizable-top").removeClass("rui-resizable-left").removeClass("rui-resizable-right").removeClass("rui-resizable-bottom").insert(this.content._.childNodes),this.content.remove(),this.handle.remove(),this.old_inst&&(Wrapper.Cache[$uid(this._)]=this.old_inst);return this},setOptions:function(a,b){a=a||{},f("top left right bottom").each(function(b){this.hasClass("rui-resizable-"+b)&&(a.direction=b)},this);return this.$super(a,b)},start:function(a){this.prevSizes=this.size(),this.prevEvPos=a.position(),this.contXDiff=this.size().x-this.content.size().x,this.contYDiff=this.size().y-this.content.size().y,f("minWidth maxWidth minHeight maxHeight").each(function(a){this[a]=this.findDim(a)},this);return this.fire("start",{original:a})},track:function(a){var b=a.position(),c=this.prevEvPos,d=this.handle.dimensions(),e=this.prevSizes,f=e.x,g=e.y,h=c.x-b.x,i=c.y-b.y,j=this.minWidth,k=this.maxWidth,l=this.minHeight,m=this.maxHeight,n=this.options,o=n.direction;f+=(o==="left"?1:-1)*h,g+=(o==="top"?1:-1)*i,f<j&&(f=j),f>k&&(f=k),g<l&&(g=l),g>m&&(g=m),e.x!==f&&o!=="top"&&o!=="bottom"&&this.setWidth(f),e.y!==g&&o!=="left"&&o!=="right"&&this.setHeight(g);if(f==j||f==k)b.x=d.left+d.width/2;if(g==l||g==m)b.y=d.top+d.height/2;this.prevEvPos=b,this.prevSizes=this.size(),this.fire("resize",{original:a})},setWidth:function(a){this.content.setWidth(a-this.contXDiff);return this.$super(a)},setHeight:function(a){this.content.setHeight(a-this.contYDiff);return this.$super(a)},release:function(a){return this.fire("release",{original:a})},findDim:function(a){var b=this.options[a]||this.getStyle(a);if(b&&/\d+/.test(b)&&parseFloat(b)>0){var c=d(a).include("Width")?"width":"height",e=(this._dummy||(this._dummy=g("div",{style:"visibility:hidden;z-index:-1"}))).setStyle(c,b).insertTo(this,"before"),f=e._["offset"+d(c).capitalize()];e.remove();return f}}});e(a).on({mousedown:k,touchstart:k,mousemove:l,touchmove:l,mouseup:m,touchend:m}),e(window).onBlur(function(a){var b=j.current;b&&(b.release(a),j.current=null)}),i.include({makeResizable:function(a){return new j(this,a)},undoResizable:function(){this instanceof j&&this.destroy();return this}}),"Draggable"in b&&b.Draggable.include({dragStart:function(a){a.target.hasClass("rui-resizable-handle")||this.$super(a)}});var n=a.createElement("style"),o=a.createTextNode(".rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom,.rui-resizable-content .rui-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.rui-resizable-content{overflow:auto;padding:.5em;position:relative}.rui-resizable-handle{position:absolute;background-image:url(/assets/rightjs-ui/resizable.png);background-repeat:no-repeat;background-color:#DDD;cursor:move}.rui-resizable .rui-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.rui-resizable-top .rui-resizable-handle,.rui-resizable-bottom .rui-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.rui-resizable-left .rui-resizable-handle,.rui-resizable-right .rui-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.rui-resizable-top .rui-resizable-content{padding-top:1em}.rui-resizable-top .rui-resizable-handle{top:0}.rui-resizable-bottom .rui-resizable-content{padding-bottom:1em}.rui-resizable-bottom .rui-resizable-handle{bottom:0}.rui-resizable-left .rui-resizable-content{padding-left:1em}.rui-resizable-left .rui-resizable-handle{left:0}.rui-resizable-right .rui-resizable-content{padding-right:1em}.rui-resizable-right .rui-resizable-handle{right:0}");n.type="text/css",a.getElementsByTagName("head")[0].appendChild(n),n.styleSheet?n.styleSheet.cssText=o.nodeValue:n.appendChild(o);return j}(document,RightJS)
@@ -1,8 +1,8 @@
1
1
  /**
2
- * RightJS-UI Selectable v2.2.2
2
+ * RightJS-UI Selectable v2.2.3
3
3
  * http://rightjs.org/ui/selectable
4
4
  *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
6
6
  */
7
7
  var Selectable = RightJS.Selectable = (function(document, RightJS) {
8
8
  /**
@@ -179,13 +179,13 @@ var R = RightJS,
179
179
  /**
180
180
  * Selectable unit main script
181
181
  *
182
- * Copyright (C) 2009-2011 Nikolay Nemshilov
182
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
183
183
  */
184
184
  var Selectable = new Widget('UL', {
185
185
  include: Updater,
186
186
 
187
187
  extend: {
188
- version: '2.2.2',
188
+ version: '2.2.3',
189
189
 
190
190
  EVENTS: $w('change select unselect disable enable hover leave show hide'),
191
191
 
@@ -245,11 +245,13 @@ var Selectable = new Widget('UL', {
245
245
  .$super('selectable', element)
246
246
  .setOptions(options)
247
247
  .on({
248
- mousedown: this._mousedown,
249
- mouseover: this._mouseover,
250
- mouseout: this._mouseout,
251
- mouseup: this._mouseup,
252
- click: this._click,
248
+ mousedown: this._mousedown,
249
+ touchstart: this._mousedown,
250
+ mouseover: this._mouseover,
251
+ mouseout: this._mouseout,
252
+ mouseup: this._mouseup,
253
+ touchend: this._mouseup,
254
+ click: this._click,
253
255
 
254
256
  select: this._change,
255
257
  unselect: this._change
@@ -1,7 +1,7 @@
1
1
  /**
2
- * RightJS-UI Selectable v2.2.2
2
+ * RightJS-UI Selectable v2.2.3
3
3
  * http://rightjs.org/ui/selectable
4
4
  *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
6
6
  */
7
- var Selectable=RightJS.Selectable=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d={assignTo:function(b){var c=e(function(a,b){(a=f(a))&&a[a.setValue?"setValue":"update"](b.target.getValue())}).curry(b),d=e(function(a,b){a=f(a),a&&a.onChange&&a.onChange(e(function(){this.setValue(a.value())}).bind(b))}).curry(b);f(b)?(c({target:this}),d(this)):f(a).onReady(e(function(){c({target:this}),d(this)}.bind(this)));return this.onChange(c)}},e=b,f=b.$,g=b.$$,h=b.$w,i=b.$E,j=b.$A,k=b.Object,l=b.isHash,m=b.isArray,n=b.isString,o=b.isNumber,p=b.defined,q=b.Input,r=b.Element,s=new c("UL",{include:d,extend:{version:"2.2.2",EVENTS:h("change select unselect disable enable hover leave show hide"),Options:{options:null,selected:null,disabled:null,multiple:!0,fxName:"slide",fxDuration:"short",update:null,parseIds:!1,limit:null,hCont:"&bull;"},rescan:function(b){f(b||a).find(".rui-selectable").each(function(a){a instanceof s||new s(a)})}},initialize:function(){var a=j(arguments).compact(),b=a.pop(),c=a.pop(),d;if(!l(b)||b instanceof r)c=f(c||b),b=null;c&&(c=f(c))instanceof q&&(this.selectbox=d=c,b=k.merge(this.harvestOptions(c),b),c=null),this.$super("selectable",c).setOptions(b).on({mousedown:this._mousedown,mouseover:this._mouseover,mouseout:this._mouseout,mouseup:this._mouseup,click:this._click,select:this._change,unselect:this._change}),this.empty()&&this.build(),b=this.options;if(!b.multiple||this.hasClass("rui-selectable-single"))this.isSingle=!0,this.addClass("rui-selectable-single"),this.buildSingle(),b.selected===null&&this.select(this.items()[0]);b.disabled&&this.disable(b.disabled),b.selected&&this.select(b.selected),b.update&&this.assignTo(b.update),d&&(this.assignTo(d).insertTo(d,"before"),d.wrap(i("div",{style:"position:absolute;z-index:-1;visibility:hidden;width:0;height:0;overflow:hidden"})))},setValue:function(a){n(a)&&(a=a.split(",").map("trim").filter(function(a){return!a.blank()})),this.items().each("removeClass","rui-selectable-selected");return this.select(a)},getValue:function(){if(this.isSingle){var a=this.items().first("hasClass","rui-selectable-selected");return a?this.itemValue(a):null}return this.items().filter("hasClass","rui-selectable-selected").map(function(a){return this.itemValue(a)},this)},disable:function(a){this.mapOrAll(a).each(function(a){this.fire("disable",a.addClass("rui-selectable-disabled"))},this);return this},enable:function(a){this.mapOrAll(a).each(function(a){this.fire("enable",a.removeClass("rui-selectable-disabled"))},this);return this},disabled:function(a){return this.mapOrAll(a).every("hasClass","rui-selectable-disabled")},select:function(a){var b=this.mapEnabled(a),c="rui-selectable-selected";this.isSingle&&b&&(this.items().each("removeClass",c),b=e([b[0]]));if(!this.isSingle&&this.options.limit){var d=this.items().filter("hasClass",c),f=[];while(b.length&&d.length+f.length<this.options.limit){var g=b.shift();d.include(g)||f.push(g)}b=f}b.compact().each(function(a){this.fire("select",a.addClass(c))},this);return this},unselect:function(a){var b=this.getValue();this.mapEnabled(a).each(function(a){this.fire("unselect",a.removeClass("rui-selectable-selected"))},this);return this},selected:function(a){return this.mapEnabled(a).every("hasClass","rui-selectable-selected")},insertTo:function(a,b){this.$super.call(this.isSingle?this.container:this,a,b);return this},remove:function(){this.$super.call(this.isSingle?this.container:this);return this},fire:function(a,b){b&&b instanceof r?this.$super(a,{item:b,index:this.items().indexOf(b)}):this.$super.apply(this,arguments);return this},itemValue:function(a){var b=e([a._value,a.get("id")||a.get("val")]).compact()[0];return b!==undefined?this.options.parseIds?b.match(/\d+/):b:this.items().indexOf(a)},items:function(){return this.find("li")},mapOrAll:function(a){var b=this.items();p(a)&&(m(a)||(a=[a]),b=e(a).map(function(a){var c=n(a)&&/^\d+$/.test(a)?parseInt(a,10):a,d=a;o(c)?d=b[c]:n(a)&&(d=b.first(function(b){return b.id==a||b.val==a}));return d},this).compact());return b},mapEnabled:function(a){return this.mapOrAll(a).filter(function(a){return!a.hasClass("rui-selectable-disabled")},this)},_mousedown:function(a){a.stop();var b=a.target,c=this.items();if(c.include(b)&&!this.disabled(b)){this.isSingle?this.select(b):this.selected(b)?(this.unselect(b),this._massRemove=!0):(this.select(b),this._massSelect=!0);if((a.shiftKey||a.metaKey)&&this._prevItem){var d=c.indexOf(this._prevItem),e=c.indexOf(b);if(d!=e){if(d>e){var f=d;d=e,e=d}for(var g=d;g<e;g++)this[this._prevItem.hasClass("rui-selectable-selected")?"select":"unselect"](c[g])}}this._prevItem=b}},_mouseup:function(a){a.stop(),this._massRemove=this._massSelect=!1},_mouseover:function(a){var b=a.target;this.fire("hover",b),this.isSingle||(this._massSelect?this.select(b):this._massRemove&&this.unselect(b))},_mouseout:function(a){this.fire("leave",a.target)},_click:function(a){a.stop()},_change:function(){""+this.value!=""+this.getValue()&&(this.value=this.getValue(),this.fire("change"))},build:function(){var a=this.options.options,b=e([]);if(m(a))a.each(function(a){b.push(m(a)?a:[a,a])});else for(var c in a)b.push([a[c],c]);b.each(function(a){var b=i("li",{val:a[1],html:a[0]});b._value=a[1],this.insert(b)},this);return this},buildSingle:function(){this.container=i("div",{"class":"rui-selectable-container"}).insert([this.trigger=i("div",{html:this.options.hCont,"class":"rui-selectable-handle"}),this.display=i("ul",{"class":"rui-selectable-display"})]).onClick(e(this.toggleList).bind(this)),this.parent()&&this.container.insertTo(this,"instead"),this.container.insert(this),f(a).onClick(e(this.hideList).bind(this));return this.onSelect("showItem").onSelect("hideList").addClass("rui-dd-menu")},toggleList:function(a){a.stop();return this.visible()?this.hideList():this.showList(a)},showList:function(a){a.stop(),g(".rui-selectable-single").without(this).each("hide");var b=this.container.dimensions(),c=this.container.position();this.setStyle({top:b.top+b.height-c.y-1+"px",left:b.left-c.x+"px",width:b.width+"px"}).show(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"show",this)}),this.options.fxName||this.fire("show",this)},hideList:function(){this.isSingle&&this.visible()&&(this.hide(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"hide")}),this.options.fxName||this.fire("hide"))},showItem:function(){var a=this.items().first("hasClass","rui-selectable-selected")||this.items().first();this.display.html("<li>"+(a?a.html():"&nbsp;")+"</li>")},harvestOptions:function(a){var b=(new Function("return "+a.get("data-selectable")))()||{};b.multiple=a._.type=="select-multiple",b.options=e([]),b.selected=e([]),b.disabled=e([]),j(a._.getElementsByTagName("OPTION")).each(function(c,d){var e=c.innerHTML,f=c.getAttribute("value");b.options.push([e,f===null?e:f]),c.selected&&!a._.disabled&&b.selected.push(d),(c.disabled||a._.disabled)&&b.disabled.push(d)}),b.selected.empty()&&(b.selected=0);return b}});f(a).onReady(function(){s.rescan()});var t=a.createElement("style"),u=a.createTextNode("*.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em} *.rui-selectable, *.rui-selectable li, *.rui-selectable dt, *.rui-selectable dd, *.rui-selectable ul,div.rui-selectable-container ul.rui-selectable-display,div.rui-selectable-container ul.rui-selectable-display li{margin:0;padding:0;border:none;background:none;list-style:none} *.rui-selectable{border:1px solid #CCC;border-bottom:none;display:inline-block; *display:inline; *zoom:1;min-width:10em;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-selectable li{padding:.3em 1em;cursor:pointer;border-bottom:1px solid #CCC} *.rui-selectable li:hover{background:#EEE} *.rui-selectable li.rui-selectable-selected{font-weight:bold;background:#DDD} *.rui-selectable li.rui-selectable-disabled, *.rui-selectable li.rui-selectable-disabled:hover{background:#CCC;color:#777;cursor:default}dl.rui-selectable dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE;border-bottom:1px solid #CCC}dl.rui-selectable dd li{padding-left:1.5em} *.rui-selectable-single{background:#FFF;display:none} *.rui-selectable-single li{overflow:hidden}div.rui-selectable-container{border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;display:inline-block; *display:inline; *zoom:1; *width:10em;vertical-align:middle;min-width:10em;cursor:pointer;height:1.6em;position:relative}div.rui-selectable-container div.rui-selectable-handle{font-family:Arial;position:absolute;right:0;width:0.8em;background:#DDD;text-align:center;height:100%;line-height:0.8em;font-size:200%;color:#888;border-left:1px solid #CCC}div.rui-selectable-container:hover div.rui-selectable-handle{color:#666}div.rui-selectable-container ul.rui-selectable-display{display:block;width:auto;overflow:hidden;margin-right:2em}div.rui-selectable-container ul.rui-selectable-display li{line-height:1.6em;padding:0 .5em;overflow:hidden;width:100%;white-space:nowrap}select.rui-selectable{visibility:hidden}");t.type="text/css",a.getElementsByTagName("head")[0].appendChild(t),t.styleSheet?t.styleSheet.cssText=u.nodeValue:t.appendChild(u);return s}(document,RightJS)
7
+ var Selectable=RightJS.Selectable=function(a,b){function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||b([]));return e}var d={assignTo:function(b){var c=e(function(a,b){(a=f(a))&&a[a.setValue?"setValue":"update"](b.target.getValue())}).curry(b),d=e(function(a,b){a=f(a),a&&a.onChange&&a.onChange(e(function(){this.setValue(a.value())}).bind(b))}).curry(b);f(b)?(c({target:this}),d(this)):f(a).onReady(e(function(){c({target:this}),d(this)}.bind(this)));return this.onChange(c)}},e=b,f=b.$,g=b.$$,h=b.$w,i=b.$E,j=b.$A,k=b.Object,l=b.isHash,m=b.isArray,n=b.isString,o=b.isNumber,p=b.defined,q=b.Input,r=b.Element,s=new c("UL",{include:d,extend:{version:"2.2.3",EVENTS:h("change select unselect disable enable hover leave show hide"),Options:{options:null,selected:null,disabled:null,multiple:!0,fxName:"slide",fxDuration:"short",update:null,parseIds:!1,limit:null,hCont:"&bull;"},rescan:function(b){f(b||a).find(".rui-selectable").each(function(a){a instanceof s||new s(a)})}},initialize:function(){var a=j(arguments).compact(),b=a.pop(),c=a.pop(),d;if(!l(b)||b instanceof r)c=f(c||b),b=null;c&&(c=f(c))instanceof q&&(this.selectbox=d=c,b=k.merge(this.harvestOptions(c),b),c=null),this.$super("selectable",c).setOptions(b).on({mousedown:this._mousedown,touchstart:this._mousedown,mouseover:this._mouseover,mouseout:this._mouseout,mouseup:this._mouseup,touchend:this._mouseup,click:this._click,select:this._change,unselect:this._change}),this.empty()&&this.build(),b=this.options;if(!b.multiple||this.hasClass("rui-selectable-single"))this.isSingle=!0,this.addClass("rui-selectable-single"),this.buildSingle(),b.selected===null&&this.select(this.items()[0]);b.disabled&&this.disable(b.disabled),b.selected&&this.select(b.selected),b.update&&this.assignTo(b.update),d&&(this.assignTo(d).insertTo(d,"before"),d.wrap(i("div",{style:"position:absolute;z-index:-1;visibility:hidden;width:0;height:0;overflow:hidden"})))},setValue:function(a){n(a)&&(a=a.split(",").map("trim").filter(function(a){return!a.blank()})),this.items().each("removeClass","rui-selectable-selected");return this.select(a)},getValue:function(){if(this.isSingle){var a=this.items().first("hasClass","rui-selectable-selected");return a?this.itemValue(a):null}return this.items().filter("hasClass","rui-selectable-selected").map(function(a){return this.itemValue(a)},this)},disable:function(a){this.mapOrAll(a).each(function(a){this.fire("disable",a.addClass("rui-selectable-disabled"))},this);return this},enable:function(a){this.mapOrAll(a).each(function(a){this.fire("enable",a.removeClass("rui-selectable-disabled"))},this);return this},disabled:function(a){return this.mapOrAll(a).every("hasClass","rui-selectable-disabled")},select:function(a){var b=this.mapEnabled(a),c="rui-selectable-selected";this.isSingle&&b&&(this.items().each("removeClass",c),b=e([b[0]]));if(!this.isSingle&&this.options.limit){var d=this.items().filter("hasClass",c),f=[];while(b.length&&d.length+f.length<this.options.limit){var g=b.shift();d.include(g)||f.push(g)}b=f}b.compact().each(function(a){this.fire("select",a.addClass(c))},this);return this},unselect:function(a){var b=this.getValue();this.mapEnabled(a).each(function(a){this.fire("unselect",a.removeClass("rui-selectable-selected"))},this);return this},selected:function(a){return this.mapEnabled(a).every("hasClass","rui-selectable-selected")},insertTo:function(a,b){this.$super.call(this.isSingle?this.container:this,a,b);return this},remove:function(){this.$super.call(this.isSingle?this.container:this);return this},fire:function(a,b){b&&b instanceof r?this.$super(a,{item:b,index:this.items().indexOf(b)}):this.$super.apply(this,arguments);return this},itemValue:function(a){var b=e([a._value,a.get("id")||a.get("val")]).compact()[0];return b!==undefined?this.options.parseIds?b.match(/\d+/):b:this.items().indexOf(a)},items:function(){return this.find("li")},mapOrAll:function(a){var b=this.items();p(a)&&(m(a)||(a=[a]),b=e(a).map(function(a){var c=n(a)&&/^\d+$/.test(a)?parseInt(a,10):a,d=a;o(c)?d=b[c]:n(a)&&(d=b.first(function(b){return b.id==a||b.val==a}));return d},this).compact());return b},mapEnabled:function(a){return this.mapOrAll(a).filter(function(a){return!a.hasClass("rui-selectable-disabled")},this)},_mousedown:function(a){a.stop();var b=a.target,c=this.items();if(c.include(b)&&!this.disabled(b)){this.isSingle?this.select(b):this.selected(b)?(this.unselect(b),this._massRemove=!0):(this.select(b),this._massSelect=!0);if((a.shiftKey||a.metaKey)&&this._prevItem){var d=c.indexOf(this._prevItem),e=c.indexOf(b);if(d!=e){if(d>e){var f=d;d=e,e=d}for(var g=d;g<e;g++)this[this._prevItem.hasClass("rui-selectable-selected")?"select":"unselect"](c[g])}}this._prevItem=b}},_mouseup:function(a){a.stop(),this._massRemove=this._massSelect=!1},_mouseover:function(a){var b=a.target;this.fire("hover",b),this.isSingle||(this._massSelect?this.select(b):this._massRemove&&this.unselect(b))},_mouseout:function(a){this.fire("leave",a.target)},_click:function(a){a.stop()},_change:function(){""+this.value!=""+this.getValue()&&(this.value=this.getValue(),this.fire("change"))},build:function(){var a=this.options.options,b=e([]);if(m(a))a.each(function(a){b.push(m(a)?a:[a,a])});else for(var c in a)b.push([a[c],c]);b.each(function(a){var b=i("li",{val:a[1],html:a[0]});b._value=a[1],this.insert(b)},this);return this},buildSingle:function(){this.container=i("div",{"class":"rui-selectable-container"}).insert([this.trigger=i("div",{html:this.options.hCont,"class":"rui-selectable-handle"}),this.display=i("ul",{"class":"rui-selectable-display"})]).onClick(e(this.toggleList).bind(this)),this.parent()&&this.container.insertTo(this,"instead"),this.container.insert(this),f(a).onClick(e(this.hideList).bind(this));return this.onSelect("showItem").onSelect("hideList").addClass("rui-dd-menu")},toggleList:function(a){a.stop();return this.visible()?this.hideList():this.showList(a)},showList:function(a){a.stop(),g(".rui-selectable-single").without(this).each("hide");var b=this.container.dimensions(),c=this.container.position();this.setStyle({top:b.top+b.height-c.y-1+"px",left:b.left-c.x+"px",width:b.width+"px"}).show(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"show",this)}),this.options.fxName||this.fire("show",this)},hideList:function(){this.isSingle&&this.visible()&&(this.hide(this.options.fxName,{duration:this.options.fxDuration,onFinish:this.fire.bind(this,"hide")}),this.options.fxName||this.fire("hide"))},showItem:function(){var a=this.items().first("hasClass","rui-selectable-selected")||this.items().first();this.display.html("<li>"+(a?a.html():"&nbsp;")+"</li>")},harvestOptions:function(a){var b=(new Function("return "+a.get("data-selectable")))()||{};b.multiple=a._.type=="select-multiple",b.options=e([]),b.selected=e([]),b.disabled=e([]),j(a._.getElementsByTagName("OPTION")).each(function(c,d){var e=c.innerHTML,f=c.getAttribute("value");b.options.push([e,f===null?e:f]),c.selected&&!a._.disabled&&b.selected.push(d),(c.disabled||a._.disabled)&&b.disabled.push(d)}),b.selected.empty()&&(b.selected=0);return b}});f(a).onReady(function(){s.rescan()});var t=a.createElement("style"),u=a.createTextNode("*.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em} *.rui-selectable, *.rui-selectable li, *.rui-selectable dt, *.rui-selectable dd, *.rui-selectable ul,div.rui-selectable-container ul.rui-selectable-display,div.rui-selectable-container ul.rui-selectable-display li{margin:0;padding:0;border:none;background:none;list-style:none} *.rui-selectable{border:1px solid #CCC;border-bottom:none;display:inline-block; *display:inline; *zoom:1;min-width:10em;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-selectable li{padding:.3em 1em;cursor:pointer;border-bottom:1px solid #CCC} *.rui-selectable li:hover{background:#EEE} *.rui-selectable li.rui-selectable-selected{font-weight:bold;background:#DDD} *.rui-selectable li.rui-selectable-disabled, *.rui-selectable li.rui-selectable-disabled:hover{background:#CCC;color:#777;cursor:default}dl.rui-selectable dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE;border-bottom:1px solid #CCC}dl.rui-selectable dd li{padding-left:1.5em} *.rui-selectable-single{background:#FFF;display:none} *.rui-selectable-single li{overflow:hidden}div.rui-selectable-container{border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;display:inline-block; *display:inline; *zoom:1; *width:10em;vertical-align:middle;min-width:10em;cursor:pointer;height:1.6em;position:relative}div.rui-selectable-container div.rui-selectable-handle{font-family:Arial;position:absolute;right:0;width:0.8em;background:#DDD;text-align:center;height:100%;line-height:0.8em;font-size:200%;color:#888;border-left:1px solid #CCC}div.rui-selectable-container:hover div.rui-selectable-handle{color:#666}div.rui-selectable-container ul.rui-selectable-display{display:block;width:auto;overflow:hidden;margin-right:2em}div.rui-selectable-container ul.rui-selectable-display li{line-height:1.6em;padding:0 .5em;overflow:hidden;width:100%;white-space:nowrap}select.rui-selectable{visibility:hidden}");t.type="text/css",a.getElementsByTagName("head")[0].appendChild(t),t.styleSheet?t.styleSheet.cssText=u.nodeValue:t.appendChild(u);return s}(document,RightJS)
@@ -1,8 +1,8 @@
1
1
  /**
2
- * RightJS-UI Slider v2.3.0
2
+ * RightJS-UI Slider v2.3.1
3
3
  * http://rightjs.org/ui/slider
4
4
  *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
6
6
  */
7
7
  var Slider = RightJS.Slider = (function(document, Math, RightJS) {
8
8
  /**
@@ -171,13 +171,13 @@ var R = RightJS,
171
171
  /**
172
172
  * RightJS UI Slider unit
173
173
  *
174
- * Copyright (C) 2009-2011 Nikolay Nemshilov
174
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
175
175
  */
176
176
  var Slider = new Widget({
177
177
  include: Updater,
178
178
 
179
179
  extend: {
180
- version: '2.3.0',
180
+ version: '2.3.1',
181
181
 
182
182
  EVENTS: $w('change'),
183
183
 
@@ -441,7 +441,7 @@ var Slider = new Widget({
441
441
  /**
442
442
  * Document onReady hook for sliders
443
443
  *
444
- * Copyright (C) 2009-2010 Nikolay Nemshilov
444
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
445
445
  */
446
446
  $(document).on({
447
447
  // preinitializing the sliders
@@ -453,31 +453,14 @@ $(document).on({
453
453
  });
454
454
  },
455
455
 
456
- // initiates the slider move
457
- mousedown: function(event) {
458
- var slider = event.find('.rui-slider');
459
- if (slider) {
460
- event.stop();
461
- if (!(slider instanceof Slider)) {
462
- slider = new Slider(slider);
463
- }
464
- Slider.current = slider.start(event);
465
- }
466
- },
456
+ mousedown: document_mousedown,
457
+ touchstart: document_mousedown,
467
458
 
468
- // handles the slider move
469
- mousemove: function(event) {
470
- if (Slider.current) {
471
- Slider.current.move(event);
472
- }
473
- },
459
+ mousemove: document_mousemove,
460
+ touchmove: document_mousemove,
474
461
 
475
- // handles the slider release
476
- mouseup: function(event) {
477
- if (Slider.current) {
478
- Slider.current = false;
479
- }
480
- }
462
+ mouseup: document_mouseup,
463
+ touchend: document_mouseup
481
464
  });
482
465
 
483
466
  $(window).onBlur(function() {
@@ -486,6 +469,31 @@ $(window).onBlur(function() {
486
469
  }
487
470
  });
488
471
 
472
+ // initiates the slider move
473
+ function document_mousedown(event) {
474
+ var slider = event.find('.rui-slider');
475
+ if (slider) {
476
+ event.stop();
477
+ if (!(slider instanceof Slider)) {
478
+ slider = new Slider(slider);
479
+ }
480
+ Slider.current = slider.start(event);
481
+ }
482
+ }
483
+
484
+ // handles the slider move
485
+ function document_mousemove(event) {
486
+ if (Slider.current) {
487
+ Slider.current.move(event);
488
+ }
489
+ }
490
+
491
+ // handles the slider release
492
+ function document_mouseup(event) {
493
+ if (Slider.current) {
494
+ Slider.current = false;
495
+ }
496
+ }
489
497
 
490
498
  var embed_style = document.createElement('style'),
491
499
  embed_rules = document.createTextNode("div.rui-slider,div.rui-slider .handle,div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:10pt;margin-top:-4pt;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-4pt;margin-bottom:0.4em;height:5pt;width:10pt}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}");
@@ -1,7 +1,7 @@
1
1
  /**
2
- * RightJS-UI Slider v2.3.0
2
+ * RightJS-UI Slider v2.3.1
3
3
  * http://rightjs.org/ui/slider
4
4
  *
5
- * Copyright (C) 2009-2011 Nikolay Nemshilov
5
+ * Copyright (C) 2009-2012 Nikolay Nemshilov
6
6
  */
7
- var Slider=RightJS.Slider=function(a,b,c){function d(a,b){b||(b=a,a="DIV");var d=new c.Class(c.Element.Wrappers[a]||c.Element,{initialize:function(b,d){this.key=b;var e=[{"class":"rui-"+b}];this instanceof c.Input||this instanceof c.Form||e.unshift(a),this.$super.apply(this,e),c.isString(d)&&(d=c.$(d)),d instanceof c.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return c.Wrapper.Cache[c.$uid(this._)]=this},setOptions:function(a,b){b&&(a=c.Object.merge(a,(new Function("return "+(b.get("data-"+this.key)||"{}")))())),a&&c.Options.setOptions.call(this,c.Object.merge(this.options,a));return this}}),e=new c.Class(d,b);c.Observer.createShortcuts(e.prototype,e.EVENTS||c([]));return e}var e={assignTo:function(b){var c=f(function(a,b){(a=g(a))&&a[a.setValue?"setValue":"update"](b.target.getValue())}).curry(b),d=f(function(a,b){a=g(a),a&&a.onChange&&a.onChange(f(function(){this.setValue(a.value())}).bind(b))}).curry(b);g(b)?(c({target:this}),d(this)):g(a).onReady(f(function(){c({target:this}),d(this)}.bind(this)));return this.onChange(c)}},f=c,g=c.$,h=c.$$,i=c.$w,j=c.$E,k=c.$A,l=c.isHash,m=c.Element,n=new d({include:e,extend:{version:"2.3.0",EVENTS:i("change"),Options:{min:0,max:100,snap:0,range:!1,value:null,values:null,direction:"x",update:null,round:0},current:!1},initialize:function(){var a=k(arguments).compact(),b=a.pop(),c=a.pop();if(!l(b)||b instanceof m)c=g(c||b),b={};this.$super("slider",c).setOptions(b).on("selectstart","stopEvent"),this.level=this.first(".level")||j("div",{"class":"level"}).insertTo(this),b=this.options,this.value=b.value===null?b.min:b.value,b.range===!0?(this.handles=[],this.handles[0]=this.first(".handle.from")||j("div",{"class":"handle from"}).insertTo(this),this.handles[1]=this.first(".handle.to")||j("div",{"class":"handle to"}).insertTo(this),this.values=[0,0],this.values[0]=b.values===null?b.min:b.values[0],this.values[1]=b.values===null?b.max:b.values[1],this.setValue(this.values[0],"from"),this.setValue(this.values[1],"to")):(this.handle=this.first(".handle")||j("div",{"class":"handle"}).insertTo(this),this.setValue(this.value)),b.update&&this.assignTo(b.update),b.direction==="y"?this.addClass("rui-slider-vertical"):this.hasClass("rui-slider-vertical")&&(b.direction="y")},setValue:function(a,b){return this.precalc().shiftTo(a,b)},getValue:function(){return this.options.range===!0?this.values[0]:this.value},getValues:function(){return this.values},insertTo:function(a,b){return this.$super(a,b).setValue(this.value)},precalc:function(){var a=this.options.direction==="x",b=this.dims=this.dimensions();if(this.options.range===!0){var c=this.handles[0].setStyle(a?{left:0}:{bottom:0}).dimensions(),d=this.hSize=a?c.width:c.height;this.offset=a?c.left-b.left:b.top+b.height-c.top-d,this.space=(a?b.width:b.height)-d-this.offset*2;var e=this.handles[1].setStyle(a?{left:this.space+"px"}:{bottom:this.space+"px"}).dimensions()}else{var f=this.handle.setStyle(a?{left:0}:{bottom:0}).dimensions(),d=this.hSize=a?f.width:f.height;this.offset=a?f.left-b.left:b.top+b.height-f.top-d,this.space=(a?b.width:b.height)-d-this.offset*2}return this},start:function(a){this._type=null,a.target.hasClass("handle")&&(a.target.hasClass("from")?this._type="from":a.target.hasClass("to")&&(this._type="to"));return this.precalc().e2val(a)},move:function(a){return this.e2val(a)},shiftTo:function(a,c){var d=this.options,e=b.pow(10,d.round),f=d.direction==="x";a=b.round(a*e)/e,a<d.min&&(a=d.min),a>d.max&&(a=d.max);if(d.range===!0){c==="to"&&a<this.values[0]&&(a=this.values[0]);if(c==="from"||c===undefined)a>this.values[1]&&(a=this.values[1])}if(d.snap){var g=d.snap,h=(a-d.min)%g;a=h<g/2?a-h:a-h+g}if(d.range===!0){var i=c==="from"?a:this.values[0],j=c==="to"?a:this.values[1],k=this.space/(d.max-d.min)*(i-d.min),l=this.space/(d.max-d.min)*(j-d.min),m=l-k;c==="to"?this.handles[1]._.style[f?"left":"bottom"]=l+"px":this.handles[0]._.style[f?"left":"bottom"]=k+"px",this.level._.style[f?"left":"top"]=(k>0?k:0)+2+"px",this.level._.style[f?"width":"height"]=(m>0?m:0)+2+"px";var n=!1;c==="from"&&a!==this.values[0]&&(this.values[0]=a,n=!0),c==="to"&&a!==this.values[1]&&(this.values[1]=a,n=!0),n&&this.fire("change",{value:a,values:this.values})}else{var o=this.space/(d.max-d.min)*(a-d.min);this.handle._.style[f?"left":"bottom"]=o+"px",this.level._.style[f?"width":"height"]=(o>0?o:0)+2+"px",a!==this.value&&(this.value=a,this.fire("change",{value:a}))}return this},e2val:function(a){var b=this.options,c=b.direction==="x",d=this.dims,e=this.offset,f=this.space,g=a.position()[c?"x":"y"]-e-this.hSize/2,h=c?d.left+e:d.top+e,i=(b.max-b.min)/f*(g-h),j=this._type;if(j==null)return this.shiftTo(c?b.min+i:b.max-i);if(j==="to"){this.shiftTo(this.values[0],"from");return this.shiftTo(c?b.min+i:b.max-i,"to")}this.shiftTo(this.values[1],"to");return this.shiftTo(c?b.min+i:b.max-i,"from")}});g(a).on({ready:function(){h(".rui-slider").each(function(a){a instanceof n||(a=new n(a))})},mousedown:function(a){var b=a.find(".rui-slider");b&&(a.stop(),b instanceof n||(b=new n(b)),n.current=b.start(a))},mousemove:function(a){n.current&&n.current.move(a)},mouseup:function(a){n.current&&(n.current=!1)}}),g(window).onBlur(function(){n.current&&(n.current=!1)});var o=a.createElement("style"),p=a.createTextNode("div.rui-slider,div.rui-slider .handle,div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:10pt;margin-top:-4pt;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-4pt;margin-bottom:0.4em;height:5pt;width:10pt}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}");o.type="text/css",a.getElementsByTagName("head")[0].appendChild(o),o.styleSheet?o.styleSheet.cssText=p.nodeValue:o.appendChild(p);return n}(document,Math,RightJS)
7
+ var Slider=RightJS.Slider=function(a,b,c){function q(a){n.current&&(n.current=!1)}function p(a){n.current&&n.current.move(a)}function o(a){var b=a.find(".rui-slider");b&&(a.stop(),b instanceof n||(b=new n(b)),n.current=b.start(a))}function d(a,b){b||(b=a,a="DIV");var d=new c.Class(c.Element.Wrappers[a]||c.Element,{initialize:function(b,d){this.key=b;var e=[{"class":"rui-"+b}];this instanceof c.Input||this instanceof c.Form||e.unshift(a),this.$super.apply(this,e),c.isString(d)&&(d=c.$(d)),d instanceof c.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return c.Wrapper.Cache[c.$uid(this._)]=this},setOptions:function(a,b){b&&(a=c.Object.merge(a,(new Function("return "+(b.get("data-"+this.key)||"{}")))())),a&&c.Options.setOptions.call(this,c.Object.merge(this.options,a));return this}}),e=new c.Class(d,b);c.Observer.createShortcuts(e.prototype,e.EVENTS||c([]));return e}var e={assignTo:function(b){var c=f(function(a,b){(a=g(a))&&a[a.setValue?"setValue":"update"](b.target.getValue())}).curry(b),d=f(function(a,b){a=g(a),a&&a.onChange&&a.onChange(f(function(){this.setValue(a.value())}).bind(b))}).curry(b);g(b)?(c({target:this}),d(this)):g(a).onReady(f(function(){c({target:this}),d(this)}.bind(this)));return this.onChange(c)}},f=c,g=c.$,h=c.$$,i=c.$w,j=c.$E,k=c.$A,l=c.isHash,m=c.Element,n=new d({include:e,extend:{version:"2.3.1",EVENTS:i("change"),Options:{min:0,max:100,snap:0,range:!1,value:null,values:null,direction:"x",update:null,round:0},current:!1},initialize:function(){var a=k(arguments).compact(),b=a.pop(),c=a.pop();if(!l(b)||b instanceof m)c=g(c||b),b={};this.$super("slider",c).setOptions(b).on("selectstart","stopEvent"),this.level=this.first(".level")||j("div",{"class":"level"}).insertTo(this),b=this.options,this.value=b.value===null?b.min:b.value,b.range===!0?(this.handles=[],this.handles[0]=this.first(".handle.from")||j("div",{"class":"handle from"}).insertTo(this),this.handles[1]=this.first(".handle.to")||j("div",{"class":"handle to"}).insertTo(this),this.values=[0,0],this.values[0]=b.values===null?b.min:b.values[0],this.values[1]=b.values===null?b.max:b.values[1],this.setValue(this.values[0],"from"),this.setValue(this.values[1],"to")):(this.handle=this.first(".handle")||j("div",{"class":"handle"}).insertTo(this),this.setValue(this.value)),b.update&&this.assignTo(b.update),b.direction==="y"?this.addClass("rui-slider-vertical"):this.hasClass("rui-slider-vertical")&&(b.direction="y")},setValue:function(a,b){return this.precalc().shiftTo(a,b)},getValue:function(){return this.options.range===!0?this.values[0]:this.value},getValues:function(){return this.values},insertTo:function(a,b){return this.$super(a,b).setValue(this.value)},precalc:function(){var a=this.options.direction==="x",b=this.dims=this.dimensions();if(this.options.range===!0){var c=this.handles[0].setStyle(a?{left:0}:{bottom:0}).dimensions(),d=this.hSize=a?c.width:c.height;this.offset=a?c.left-b.left:b.top+b.height-c.top-d,this.space=(a?b.width:b.height)-d-this.offset*2;var e=this.handles[1].setStyle(a?{left:this.space+"px"}:{bottom:this.space+"px"}).dimensions()}else{var f=this.handle.setStyle(a?{left:0}:{bottom:0}).dimensions(),d=this.hSize=a?f.width:f.height;this.offset=a?f.left-b.left:b.top+b.height-f.top-d,this.space=(a?b.width:b.height)-d-this.offset*2}return this},start:function(a){this._type=null,a.target.hasClass("handle")&&(a.target.hasClass("from")?this._type="from":a.target.hasClass("to")&&(this._type="to"));return this.precalc().e2val(a)},move:function(a){return this.e2val(a)},shiftTo:function(a,c){var d=this.options,e=b.pow(10,d.round),f=d.direction==="x";a=b.round(a*e)/e,a<d.min&&(a=d.min),a>d.max&&(a=d.max);if(d.range===!0){c==="to"&&a<this.values[0]&&(a=this.values[0]);if(c==="from"||c===undefined)a>this.values[1]&&(a=this.values[1])}if(d.snap){var g=d.snap,h=(a-d.min)%g;a=h<g/2?a-h:a-h+g}if(d.range===!0){var i=c==="from"?a:this.values[0],j=c==="to"?a:this.values[1],k=this.space/(d.max-d.min)*(i-d.min),l=this.space/(d.max-d.min)*(j-d.min),m=l-k;c==="to"?this.handles[1]._.style[f?"left":"bottom"]=l+"px":this.handles[0]._.style[f?"left":"bottom"]=k+"px",this.level._.style[f?"left":"top"]=(k>0?k:0)+2+"px",this.level._.style[f?"width":"height"]=(m>0?m:0)+2+"px";var n=!1;c==="from"&&a!==this.values[0]&&(this.values[0]=a,n=!0),c==="to"&&a!==this.values[1]&&(this.values[1]=a,n=!0),n&&this.fire("change",{value:a,values:this.values})}else{var o=this.space/(d.max-d.min)*(a-d.min);this.handle._.style[f?"left":"bottom"]=o+"px",this.level._.style[f?"width":"height"]=(o>0?o:0)+2+"px",a!==this.value&&(this.value=a,this.fire("change",{value:a}))}return this},e2val:function(a){var b=this.options,c=b.direction==="x",d=this.dims,e=this.offset,f=this.space,g=a.position()[c?"x":"y"]-e-this.hSize/2,h=c?d.left+e:d.top+e,i=(b.max-b.min)/f*(g-h),j=this._type;if(j==null)return this.shiftTo(c?b.min+i:b.max-i);if(j==="to"){this.shiftTo(this.values[0],"from");return this.shiftTo(c?b.min+i:b.max-i,"to")}this.shiftTo(this.values[1],"to");return this.shiftTo(c?b.min+i:b.max-i,"from")}});g(a).on({ready:function(){h(".rui-slider").each(function(a){a instanceof n||(a=new n(a))})},mousedown:o,touchstart:o,mousemove:p,touchmove:p,mouseup:q,touchend:q}),g(window).onBlur(function(){n.current&&(n.current=!1)});var r=a.createElement("style"),s=a.createTextNode("div.rui-slider,div.rui-slider .handle,div.rui-slider .level{margin:0;padding:0;border:none;background:none}div.rui-slider{height:0.4em;width:20em;border:1px solid #bbb;background:#F8F8F8;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:relative;margin:.6em 0;display:inline-block; *display:inline; *zoom:1;vertical-align:middle;user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer}div.rui-slider .handle{font-size:25%;position:absolute;left:0;top:0;width:4pt;height:10pt;margin-top:-4pt;margin-left:0.4em;background:#BBB;border:1px solid #999;border-radius:.8em;-moz-border-radius:.8em;-webkit-border-radius:.8em;z-index:20}div.rui-slider .level{font-size:25%;position:absolute;top:0;left:0;width:0;height:100%;background:#ddd;z-index:1}div.rui-slider-vertical{height:10em;width:0.4em;margin:0 .3em}div.rui-slider-vertical .handle{top:auto;bottom:0;margin:0;margin-left:-4pt;margin-bottom:0.4em;height:5pt;width:10pt}div.rui-slider-vertical .level{height:0;width:100%;top:auto;bottom:0}");r.type="text/css",a.getElementsByTagName("head")[0].appendChild(r),r.styleSheet?r.styleSheet.cssText=s.nodeValue:r.appendChild(s);return n}(document,Math,RightJS)