right-rails 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Standard dialog widget for RightJS
3
+ * http://rightjs.org/ui/dialog
4
+ *
5
+ * Copyright (C) 2010 Nikolay Nemshilov
6
+ */
7
+ var Dialog=RightJS.Dialog=function(d){var h=d.$,n=d.$w,g=d.$E,i=d.Class,j=d.Object,l=new d.Wrapper(d.Element,{initialize:function(a,c){this.$super("div",c);this._.innerHTML=a;this.addClass("rui-button");this.on("selectstart","stopEvent")},disable:function(){return this.addClass("rui-button-disabled")},enable:function(){return this.removeClass("rui-button-disabled")},disabled:function(){return this.hasClass("rui-button-disabled")},enabled:function(){return!this.disabled()},fire:function(){this.enabled()&&
8
+ this.$super.apply(this,arguments);return this}}),o=new d.Wrapper(d.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"});this.dots=[];for(var c=0;c<(a||4);c++)this.dots.push(new d.Element("div"));this.dots[0].addClass("glowing");this.insert(this.dots);d(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a);this.insert(a,"top")}}}),b=new (function(a,c){if(!c){c=a;a="DIV"}var f=new d.Wrapper(d.Element.Wrappers[a]||
9
+ d.Element,{initialize:function(k,e){this.key=k;var m=[{"class":"rui-"+k}];this instanceof d.Input||this instanceof d.Form||m.unshift(a);this.$super.apply(this,m);if(d.isString(e))e=d.$(e);if(e instanceof d.Element){this._=e._;if("$listeners"in e)e.$listeners=e.$listeners;e={}}this.setOptions(e,this);return this},setOptions:function(k,e){e=e||this;d.Options.setOptions.call(this,d.Object.merge(k,eval("("+(e.get("data-"+this.key)||"{}")+")")));return this}});f=new d.Wrapper(f,c);d.Observer.createShortcuts(f.prototype,
10
+ f.EVENTS||[]);return f})({extend:{version:"2.0.0",EVENTS:n("ok cancel help expand collapse resize load"),Options:{lockScreen:true,draggable:true,closeable:true,expandable:false,showHelp:false,showIcon:null,title:null,html:null,url:null},i18n:{Ok:"Ok",Close:"Close",Cancel:"Cancel",Help:"Help",Expand:"Expand",Collapse:"Collapse",Alert:"Warning!",Confirm:"Confirm",Prompt:"Enter"},current:false,dragged:false},initialize:function(a){this.$super("dialog",a).append(this.head=new b.Head(this),this.body=new b.Body(this),
11
+ this.foot=new b.Foot(this)).onCancel(this.hide);this.locker=g("div",{"class":"rui-screen-locker"});this.options.title&&this.title(this.options.title);this.options.html&&this.html(this.options.html);this.options.url&&this.load(this.options.url)},show:function(){this.options.lockScreen&&this.locker.insertTo(document.body);this.insertTo(document.body).resize();return b.current=this},hide:function(){this.locker.remove();this.remove();b.current=false;return this},resize:function(){arguments.length&&this.$super.apply(this,
12
+ arguments);var a=this.size(),c=h(window).size();if(this.expanded){a.x=c.x-20;a.y=c.y-10;this.$super.call(this,a)}this.setStyle({top:(c.y-a.y)/2+h(window).scrolls().y+"px",left:(c.x-a.x-16)/2+"px"});return this.fire("resize")},title:function(a){if(arguments.length){this.head.title.html(a);return this}else return this.head.title.html()},update:function(a){this.body.update(a);return this.resize()},html:function(){return arguments.length?this.$super.apply(this,arguments):this.body.html()},load:function(a,
13
+ c){this.show();this.body.load(a,c);return this},expand:function(){if(!this.expanded){this._prevSize=this.size();this.resize({x:h(window).size().x-20,y:h(window).size().y-10});this.expanded=true;this.fire("expand")}return this},collapse:function(){if(this.expanded){this.expanded=false;this.resize(this._prevSize);this.fire("collapse")}return this}});b.Head=new i(Element,{initialize:function(a){this.dialog=a;this.options=a.options;this.$super("div",{"class":"rui-dialog-head"});this.append(this.icon=
14
+ g("div",{"class":"icon"}),this.title=g("div",{"class":"title",html:"&nbsp;"}),this.tools=g("div",{"class":"tools"}));this.fsButton=g("div",{"class":"expand",html:"&equiv;",title:b.i18n.Expand}).onClick(function(){if(a.expanded){a.collapse();this.html("&equiv;").set("title",b.i18n.Expand)}else{a.expand();this.html("_").set("title",b.i18n.Collapse)}});this.closeButton=g("div",{"class":"close",html:"&times;",title:b.i18n.Close}).onClick(function(){a.fire("cancel")});this.options.expandable&&this.tools.insert(this.fsButton);
15
+ this.options.closeable&&this.tools.insert(this.closeButton);this.on({selectstart:function(c){c.stop()},mousedown:this.dragStart});this.options.draggable||this.dialog.addClass("rui-dialog-nodrag")},dragStart:function(a){if(this.options.draggable&&!a.find("div.tools div")){var c=this.dialog.dimensions(),f=a.position();this.xDiff=c.left-f.x;this.yDiff=c.top-f.y;this.maxX=h(window).size().x-c.width-20;this.dlgStyle=this.dialog.get("style");b.dragged=this.dialog;a.stop()}},dragMove:function(a){var c=a.position();
16
+ a=c.x+this.xDiff;c=c.y+this.yDiff;if(a<0)a=0;else if(a>this.maxX)a=this.maxX;if(c<0)c=0;this.dlgStyle.top=c+"px";this.dlgStyle.left=a+"px"},dragStop:function(){b.dragged=false}});b.Body=new i(Element,{initialize:function(a){this.dialog=a;this.options=a.options;this.$super("div",{"class":"rui-dialog-body"});this.locker=g("div",{"class":"rui-dialog-body-locker"}).insert(new o)},load:function(a,c){this.insert(this.locker,"top");this.xhr=(new Xhr(a,j.merge({method:"get"},c))).onComplete(d(function(f){this.update(f.text);
17
+ this.dialog.resize().fire("load")}).bind(this)).send();return this},update:function(a){this.$super(a);this.options.showIcon&&this.insert('<div class="rui-dialog-body-icon">'+this.options.showIcon+"</div>","top");return this}});b.Foot=new i(Element,{initialize:function(a){this.$super("div",{"class":"rui-dialog-foot"});this.dialog=a;a.okButton=(new l(b.i18n.Ok,{"class":"ok"})).onClick(function(){a.fire("ok")});a.helpButton=(new l(b.i18n.Help,{"class":"help"})).onClick(function(){a.fire("help")});a.cancelButton=
18
+ (new l(b.i18n.Cancel,{"class":"cancel"})).onClick(function(){a.fire("cancel")});a.options.showHelp&&this.insert(a.helpButton);a.options.closeable&&this.insert(a.cancelButton);this.insert(a.okButton)}});b.Alert=new i(b,{initialize:function(a){a=j.merge({showIcon:"!",title:b.i18n.Alert},a);this.$super(a);this.addClass("rui-dialog-alert");this.on("ok","hide")}});b.Confirm=new i(b,{initialize:function(a){a=j.merge({showIcon:"?",title:b.i18n.Confirm},a);this.$super(a);this.addClass("rui-dialog-confirm");
19
+ this.on("ok","hide")}});b.Prompt=new i(b,{initialize:function(a){a=j.merge({showIcon:"&#x27A5;",title:b.i18n.Prompt,label:b.i18n.Prompt},a);this.$super(a);this.addClass("rui-dialog-prompt");this.html([g("label",{html:this.options.label}),this.input=new d.Input(this.options.input||{})]);this.input.get("type")!=="textarea"&&this.input.onKeydown(d(function(c){c.keyCode===13&&this.fire("ok")}).bind(this))},show:function(){this.$super.apply(this,arguments);this.input.select();return this}});h(document).on({keydown:function(a){if(a.keyCode===
20
+ 27&&b.current)b.current.options.closeable&&b.current.fire("cancel");else if(a.keyCode===13&&b.current)if(!(b.current instanceof b.Prompt)){a.stop();b.current.fire("ok")}},mousemove:function(a){b.dragged&&b.dragged.head.dragMove(a)},mouseup:function(a){b.dragged&&b.dragged.head.dragStop(a)}});h(window).onResize(function(){b.current&&b.current.resize()});document.write('<style type="text/css"> *.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}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-screen-locker{position:fixed;top:0;left:0;width:100%;height:100%;margin:0;padding:0;background:#000;opacity:.5;filter:alpha(opacity=50);z-index:99999;cursor:default}div.rui-dialog{position:absolute;z-index:99999;background:white;margin:0;padding:0;padding-top:2.5em;padding-bottom:2.8em;border-radius:.35em;-moz-border-radius:.35em;-webkit-border-radius:.35em;border:1px solid #ccc}div.rui-dialog-body{min-width:20em;min-height:4.5em;margin:0;padding:0 1em;height:100%;overflow:auto;position:relative}div.rui-dialog-body-locker{position:absolute;z-index:9999;left:0;top:0;width:100%;height:100%;text-align:center;opacity:.6;filter:alpha(opacity=60)}div.rui-dialog-body-locker div.rui-spinner{border:none;background:none;font-size:150%;margin-top:8%}div.rui-dialog-body-icon{float:left;background:#eee;font-size:360%;font-family:Arial;border:2px solid gray;border-radius:.1em;-moz-border-radius:.1em;-webkit-border-radius:.1em;width:1em;line-height:1em;text-align:center;margin-right:.2em;margin-top:.05em;cursor:default;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-dialog-head{position:absolute;top:0;left:0;margin:0;padding:0;width:100%;line-height:2em;background:#ccc;border-radius:.35em;-moz-border-radius:.35em;-webkit-border-radius:.35em;border-bottom-left-radius:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;-moz-border-radius-bottomright:0;-webkit-border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0;cursor:move;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-dialog-head div.icon{float:left;height:1.4em;width:1.4em;margin-left:1em;margin-top:.3em;margin-right:.3em;display:none}div.rui-dialog-head div.title{margin-left:1em;color:#444}div.rui-dialog-head div.tools{position:absolute;right:.3em;top:.3em}div.rui-dialog-head div.tools div{float:left;width:1.4em;line-height:1.4em;text-align:center;margin-left:.15em;cursor:pointer;background:#aaa;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;font-family:Verdana;opacity:.6;filter:alpha(opacity=60)}div.rui-dialog-head div.tools div:hover{opacity:1;filter:alpha(opacity=100);box-shadow:#444 0 0 .1em;-moz-box-shadow:#444 0 0 .1em;-webkit-box-shadow:#444 0 0 .1em}div.rui-dialog-head div.tools div.close:hover{background:#daa}div.rui-dialog-nodrag div.rui-dialog-head{cursor:default}div.rui-dialog-foot{position:absolute;bottom:0;left:0;width:100%;text-align:right}div.rui-dialog-foot div.rui-button{margin:.6em 1em;background:#eee;width:4em}div.rui-dialog-foot div.help{float:left}div.rui-dialog-foot div.cancel{margin-right:-.5em}div.rui-dialog-foot div.ok:hover{background-color:#ded}div.rui-dialog-foot div.cancel:hover{background-color:#ecc}div.rui-dialog-alert div.rui-dialog-foot{text-align:center}div.rui-dialog-alert div.rui-dialog-foot div.cancel{display:none}div.rui-dialog-alert div.rui-dialog-body-icon{color:brown;background:#FEE;border-color:brown}div.rui-dialog-confirm div.rui-dialog-body-icon{color:#44A;background:#EEF;border-color:#44a}div.rui-dialog-prompt div.rui-dialog-body-icon{color:#333}div.rui-dialog-prompt div.rui-dialog-body label{display:block;font-weight:bold;font-size:120%;color:#444;margin-bottom:.5em}div.rui-dialog-prompt div.rui-dialog-body input,div.rui-dialog-prompt div.rui-dialog-body textarea{border:1px solid #aaa;font-size:1em;display:block;width:16em;margin:0;padding:.2em;margin-left:4.7em;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;outline:none}div.rui-dialog-prompt div.rui-dialog-body textarea{width:24em;height:8em}</style>');
21
+ return b}(RightJS);
@@ -40,3 +40,19 @@ if (self.Colorpicker) {
40
40
  Done: 'Erledigt'
41
41
  });
42
42
  }
43
+
44
+ if (self.Dialog) {
45
+ $ext(Dialog.i18n, {
46
+ Ok: 'Ok',
47
+ Close: 'Close',
48
+ Cancel: 'Cancel',
49
+ Help: 'Help',
50
+ Expand: 'Expand',
51
+ Collapse: 'Collapse',
52
+
53
+ Alert: 'Warning!',
54
+ Confirm: 'Confirm',
55
+ Prompt: 'Enter'
56
+ })
57
+ }
58
+
@@ -40,3 +40,19 @@ if (self.Colorpicker) {
40
40
  Done: 'Hecho'
41
41
  });
42
42
  }
43
+
44
+ if (self.Dialog) {
45
+ $ext(Dialog.i18n, {
46
+ Ok: 'Ok',
47
+ Close: 'Cerrar',
48
+ Cancel: 'Cancelar',
49
+ Help: 'Ayuda',
50
+ Expand: 'Expandir',
51
+ Collapse: 'Plegar',
52
+
53
+ Alert: 'Aviso!',
54
+ Confirm: 'Confirmar',
55
+ Prompt: 'Entrar'
56
+ })
57
+ }
58
+
@@ -41,3 +41,19 @@ if (self.Colorpicker) {
41
41
  Done: 'OK'
42
42
  });
43
43
  }
44
+
45
+ if (self.Dialog) {
46
+ $ext(Dialog.i18n, {
47
+ Ok: 'Ok',
48
+ Close: 'Close',
49
+ Cancel: 'Cancel',
50
+ Help: 'Help',
51
+ Expand: 'Expand',
52
+ Collapse: 'Collapse',
53
+
54
+ Alert: 'Warning!',
55
+ Confirm: 'Confirm',
56
+ Prompt: 'Enter'
57
+ })
58
+ }
59
+
@@ -40,3 +40,19 @@ if (self.Colorpicker) {
40
40
  Done: 'Fait'
41
41
  });
42
42
  }
43
+
44
+ if (self.Dialog) {
45
+ $ext(Dialog.i18n, {
46
+ Ok: 'Ok',
47
+ Close: 'Close',
48
+ Cancel: 'Cancel',
49
+ Help: 'Help',
50
+ Expand: 'Expand',
51
+ Collapse: 'Collapse',
52
+
53
+ Alert: 'Warning!',
54
+ Confirm: 'Confirm',
55
+ Prompt: 'Enter'
56
+ })
57
+ }
58
+
@@ -47,3 +47,19 @@ if (self.Colorpicker) {
47
47
  Done: 'Kész'
48
48
  });
49
49
  }
50
+
51
+ if (self.Dialog) {
52
+ $ext(Dialog.i18n, {
53
+ Ok: 'Ok',
54
+ Close: 'Close',
55
+ Cancel: 'Cancel',
56
+ Help: 'Help',
57
+ Expand: 'Expand',
58
+ Collapse: 'Collapse',
59
+
60
+ Alert: 'Warning!',
61
+ Confirm: 'Confirm',
62
+ Prompt: 'Enter'
63
+ })
64
+ }
65
+
@@ -40,3 +40,19 @@ if (self.Colorpicker) {
40
40
  Done: 'Fatto'
41
41
  });
42
42
  }
43
+
44
+ if (self.Dialog) {
45
+ $ext(Dialog.i18n, {
46
+ Ok: 'Ok',
47
+ Close: 'Close',
48
+ Cancel: 'Cancel',
49
+ Help: 'Help',
50
+ Expand: 'Expand',
51
+ Collapse: 'Collapse',
52
+
53
+ Alert: 'Warning!',
54
+ Confirm: 'Confirm',
55
+ Prompt: 'Enter'
56
+ })
57
+ }
58
+
@@ -45,3 +45,18 @@ if (self.Colorpicker) {
45
45
  });
46
46
  }
47
47
 
48
+ if (self.Dialog) {
49
+ $ext(Dialog.i18n, {
50
+ Ok: 'Ok',
51
+ Close: 'Close',
52
+ Cancel: 'Cancel',
53
+ Help: 'Help',
54
+ Expand: 'Expand',
55
+ Collapse: 'Collapse',
56
+
57
+ Alert: 'Warning!',
58
+ Confirm: 'Confirm',
59
+ Prompt: 'Enter'
60
+ })
61
+ }
62
+
@@ -41,3 +41,17 @@ if (self.Colorpicker) {
41
41
  });
42
42
  }
43
43
 
44
+ if (self.Dialog) {
45
+ $ext(Dialog.i18n, {
46
+ Ok: 'Ok',
47
+ Close: 'Close',
48
+ Cancel: 'Cancel',
49
+ Help: 'Help',
50
+ Expand: 'Expand',
51
+ Collapse: 'Collapse',
52
+
53
+ Alert: 'Warning!',
54
+ Confirm: 'Confirm',
55
+ Prompt: 'Enter'
56
+ })
57
+ }
@@ -41,3 +41,17 @@ if (self.Colorpicker) {
41
41
  });
42
42
  }
43
43
 
44
+ if (self.Dialog) {
45
+ $ext(Dialog.i18n, {
46
+ Ok: 'Ok',
47
+ Close: 'Fechar',
48
+ Cancel: 'Cancelar',
49
+ Help: 'Ajuda',
50
+ Expand: 'Maximizar',
51
+ Collapse: 'Minimizar',
52
+
53
+ Alert: 'Atenção!',
54
+ Confirm: 'Confirmar',
55
+ Prompt: 'Editar'
56
+ });
57
+ }
@@ -41,3 +41,17 @@ if (self.Colorpicker) {
41
41
  });
42
42
  }
43
43
 
44
+ if (self.Dialog) {
45
+ $ext(Dialog.i18n, {
46
+ Ok: 'Готово',
47
+ Close: 'Закрыть',
48
+ Cancel: 'Отмена',
49
+ Help: 'Помощь',
50
+ Expand: 'Во все окно',
51
+ Collapse: 'Обычный размер',
52
+
53
+ Alert: 'Внимание!',
54
+ Confirm: 'Подтверждение',
55
+ Prompt: 'Ввод данных'
56
+ });
57
+ }
@@ -8,7 +8,7 @@ if (self.Calendar) {
8
8
  $ext(Calendar.Options, {
9
9
  firstDay: 0
10
10
  });
11
-
11
+
12
12
  $ext(Calendar.i18n, {
13
13
  Done: 'Гаразд',
14
14
  Now: 'Зараз',
@@ -46,3 +46,16 @@ if (self.Colorpicker) {
46
46
  });
47
47
  }
48
48
 
49
+ if (self.Dialog) {
50
+ $ext(Dialog.i18n, {
51
+ Ok: 'Гаразд',
52
+ Close: 'Сховати',
53
+ Cancel: 'Сховати',
54
+ Help: 'Помощь',
55
+ Expand: 'Во все окно',
56
+ Collapse: 'Обычный размер',
57
+ Alert: 'Внимание!',
58
+ Confirm: 'Подтверждение',
59
+ Prompt: 'Ввод данных'
60
+ });
61
+ }
@@ -175,7 +175,7 @@ var Spinner = new RightJS.Wrapper(RightJS.Element, {
175
175
  var Lightbox = new Widget({
176
176
 
177
177
  extend: {
178
- version: '2.0.2',
178
+ version: '2.0.4',
179
179
 
180
180
  EVENTS: $w('show hide load'),
181
181
 
@@ -888,7 +888,7 @@ $(window).on({
888
888
  });
889
889
 
890
890
 
891
- document.write("<style type=\"text/css\">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;z-index:9999;float:none;width:100%;height:100%;margin:0;padding:0;background:none;border:none;text-align:center}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}div.rui-lightbox-dialog{display:inline-block; *display:inline; *zoom:1;position:relative;text-align:left}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:white;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%;z-index:999;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}</style>");
891
+ document.write("<style type=\"text/css\">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}</style>");
892
892
 
893
893
  return Lightbox;
894
894
  })(document, RightJS);
@@ -6,7 +6,7 @@
6
6
  */
7
7
  var Lightbox=RightJS.Lightbox=function(p,d){var q=d.$,r=d.$$,u=d.$w,h=d.$E,v=d.$ext,w=d.Xhr,x=d.Class,y=d.Object,s=d.Wrapper,j=d.Element,i=d.Browser;i.IE6=i.OLD&&navigator.userAgent.indexOf("MSIE 6")>0;var z=new d.Wrapper(d.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"});this.dots=[];for(var b=0;b<(a||4);b++)this.dots.push(new d.Element("div"));this.dots[0].addClass("glowing");this.insert(this.dots);d(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=
8
8
  this.dots.pop();this.dots.unshift(a);this.insert(a,"top")}}}),f=new (function(a,b){if(!b){b=a;a="DIV"}var c=new d.Wrapper(d.Element.Wrappers[a]||d.Element,{initialize:function(e,g){this.key=e;var k=[{"class":"rui-"+e}];this instanceof d.Input||this instanceof d.Form||k.unshift(a);this.$super.apply(this,k);if(d.isString(g))g=d.$(g);if(g instanceof d.Element){this._=g._;if("$listeners"in g)g.$listeners=g.$listeners;g={}}this.setOptions(g,this);return this},setOptions:function(e,g){g=g||this;d.Options.setOptions.call(this,
9
- d.Object.merge(e,eval("("+(g.get("data-"+this.key)||"{}")+")")));return this}});c=new d.Wrapper(c,b);d.Observer.createShortcuts(c.prototype,c.EVENTS||[]);return c})({extend:{version:"2.0.2",EVENTS:u("show hide load"),Options:{fxName:"fade",fxDuration:300,group:null,hideOnEsc:true,hideOnOutClick:true,showCloseButton:true,cssRule:"a[data-lightbox]",mediaWidth:425,mediaHeight:350},i18n:{Close:"Close",Prev:"Previous Image",Next:"Next Image"},Images:/\.(jpg|jpeg|gif|png|bmp)/,Medias:[[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/,
9
+ d.Object.merge(e,eval("("+(g.get("data-"+this.key)||"{}")+")")));return this}});c=new d.Wrapper(c,b);d.Observer.createShortcuts(c.prototype,c.EVENTS||[]);return c})({extend:{version:"2.0.4",EVENTS:u("show hide load"),Options:{fxName:"fade",fxDuration:300,group:null,hideOnEsc:true,hideOnOutClick:true,showCloseButton:true,cssRule:"a[data-lightbox]",mediaWidth:425,mediaHeight:350},i18n:{Close:"Close",Prev:"Previous Image",Next:"Next Image"},Images:/\.(jpg|jpeg|gif|png|bmp)/,Medias:[[/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/,
10
10
  "$1/v/$2","swf"],[/(http:\/\/video.google.com)\/videoplay\?docid=([^&]+)/,"$1/googleplayer.swf?docId=$2","swf"],[/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/,"$1/moogaloop.swf?clip_id=$2","swf"]]},initialize:function(a,b){this.$super("lightbox",{}).setOptions(a,b).insert([this.locker=new A(this.options),this.dialog=new B(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");if(c&&(c=c.match(/lightbox\[(.+?)\]/)))this.options.group=
11
11
  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(){f.current=null;return this.$super(this.options.fxName,{duration:this.options.fxDuration/3,onFinish:d(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();
12
12
  l.prev()},_next:function(a){a.stop();l.next()},_showAnd:function(a){if(f.current!==this){f.current=this;r("div.rui-lightbox").each("remove");this.insertTo(p.body);this.dialog.show("",true);if(i.OLD){this.reposition();j.prototype.show.call(this);a.call(this)}else{this.setStyle("display:none");j.prototype.show.call(this,this.options.fxName,{duration:this.options.fxDuration/2,onFinish:d(function(){a.call(this);this.fire("show")}).bind(this)})}}else a.call(this);return this},reposition:function(){if(i.IE6){var a=
@@ -20,5 +20,5 @@ isImage:function(a,b){if(a.match(f.Images)){var c=this.img=h("img")._;c.onload=f
20
20
  f.current.options:f.Options;e=' width="'+e.mediaWidth+'" height="'+e.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>"}}),l={show:function(a,b){if(a.options.group){this.dialog=a;this.links=this.find(a.options.group);this.link=this.links.first(function(g){return g.get("href")===b});var c=this.links.indexOf(this.link),e=this.links.length;a.prevLink[e&&c>0?"show":"hide"]();a.nextLink[e&&
21
21
  c<e-1?"show":"hide"]()}else this.dialog=null},prev:function(){if(this.dialog&&!this.timer){var a=this.links[this.links.indexOf(this.link)-1];if(a){this.dialog.load(a);this.timeout()}}},next:function(){if(this.dialog&&!this.timer){var a=this.links[this.links.indexOf(this.link)+1];if(a){this.dialog.load(a);this.timeout()}}},find:function(a){return r("a").filter(function(b){var c=b.get("data-lightbox");b=b.get("rel");return c&&eval("("+c+")").group===a||b&&b.indexOf("lightbox["+a+"]")>-1})},timeout:function(){this.timer=
22
22
  d(function(){l.timer=null}).delay(300)}};q(p).on({click:function(a){var b=a.find(f.Options.cssRule)||a.find("a[rel^=lightbox]");if(b){a.stop();(new f({},b)).load(b)}},mousewheel:function(a){if(f.current){var b=a.target;if(!b.parent("div.rui-lightbox-content")||b.getStyle("overflow")==="visible")a.stop();f.current.fire((a._.detail||-a._.wheelDelta)<0?"prev":"next")}},keydown:function(a){var b=f.current,c={27:"close",33:"prev",37:"prev",38:"prev",39:"next",40:"next",34:"next"}[a.keyCode];if(b&&c)if(c!==
23
- "close"||b.options.hideOnEsc){a.stop();b.fire(c)}}});q(window).on({resize:function(){if(f.current){f.current.reposition();f.current.dialog.resize()}},scroll:function(){f.current&&i.IE6&&f.current.reposition()}});p.write('<style type="text/css">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;z-index:9999;float:none;width:100%;height:100%;margin:0;padding:0;background:none;border:none;text-align:center}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}div.rui-lightbox-dialog{display:inline-block; *display:inline; *zoom:1;position:relative;text-align:left}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:white;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%;z-index:999;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}</style>');
23
+ "close"||b.options.hideOnEsc){a.stop();b.fire(c)}}});q(window).on({resize:function(){if(f.current){f.current.reposition();f.current.dialog.resize()}},scroll:function(){f.current&&i.IE6&&f.current.reposition()}});p.write('<style type="text/css">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}</style>');
24
24
  return f}(document,RightJS);
@@ -125,7 +125,7 @@ var Sortable = new Widget('UL', {
125
125
  extend: {
126
126
  version: '2.0.0',
127
127
 
128
- EVENTS: $w('change'),
128
+ EVENTS: $w('start change finish'),
129
129
 
130
130
  Options: {
131
131
  url: null, // the Xhr requests url address, might contain the '%{id}' placeholder
@@ -141,10 +141,27 @@ var Sortable = new Widget('UL', {
141
141
  accept: null, // a reference or a list of references to the other sortables between which you can drag the items
142
142
  minLength: 1, // minimum number of items on the list when the feature works
143
143
 
144
+ itemCss: 'li', // the draggable item's css rule
145
+ handleCss: 'li', // the draggables handle element css rule
146
+
144
147
  cssRule: '*[data-sortable]' // css-rule for automatically initializable sortables
145
148
  },
146
149
 
147
- current: false // a reference to the currently active sortable
150
+ current: false, // a reference to the currently active sortable
151
+
152
+ /**
153
+ * Typecasting the list element for Sortable
154
+ *
155
+ * @param Element list
156
+ * @return Sortable list
157
+ */
158
+ cast: function(element) {
159
+ element = $(element._);
160
+ if (!(element instanceof Sortable)) {
161
+ element = new Sortable(element);
162
+ }
163
+ return element;
164
+ }
148
165
  },
149
166
 
150
167
  /**
@@ -158,7 +175,7 @@ var Sortable = new Widget('UL', {
158
175
  this.$super('sortable', element)
159
176
  .setOptions(options)
160
177
  .addClass('rui-sortable')
161
- .on('change', this._tryXhr)
178
+ .on('finish', this._tryXhr)
162
179
  .on('selectstart', 'stopEvent'); // disable select under IE
163
180
  },
164
181
 
@@ -183,20 +200,26 @@ var Sortable = new Widget('UL', {
183
200
  return this;
184
201
  },
185
202
 
203
+ // returns a list of draggable items
204
+ items: function() {
205
+ return this.children(this.options.itemCss);
206
+ },
207
+
186
208
  // protected
187
209
 
188
210
  // starts the drag
189
211
  startDrag: function(event) {
190
212
  // don't let to drag out the last item
191
- if (this.children().length <= this.options.minLength) { return; }
213
+ if (this.items().length <= this.options.minLength) { return; }
192
214
 
193
215
  // trying to find the list-item upon which the user pressed the mouse
194
- var target = event.target, targets = R([target].concat(target.parents())),
195
- item = targets[targets.indexOf(this) - 1], event_pos = event.position();
216
+ var item = event.find(this.options.itemCss),
217
+ handle = event.find(this.options.handleCss);
196
218
 
197
- if (item) {
198
- this._initDrag(item, event_pos);
219
+ if (item && handle) {
220
+ this._initDrag(item, event.position());
199
221
  Sortable.current = this;
222
+ this.fire('start', this._evOpts(event));
200
223
  }
201
224
  },
202
225
 
@@ -229,32 +252,35 @@ var Sortable = new Widget('UL', {
229
252
  item.insert(this.item, item.prevSiblings().include(this.item) ? 'after' : 'before');
230
253
  this._findSuspects();
231
254
 
232
- // sending the event
233
- var list = item.parent();
234
-
235
- if (!(list instanceof Sortable)) {
236
- list = new Sortable(list);
237
- }
238
-
239
- this.fire('change', {
240
- list: list,
241
- item: this.item,
242
- index: list.children().indexOf(this.item)
243
- });
255
+ this.fire('change', this._evOpts(event, item));
244
256
  }
245
257
  },
246
258
 
247
259
  // finalizes the drag
248
- finishDrag: function() {
260
+ finishDrag: function(event) {
249
261
  if (this.itemClone) {
250
262
  this.itemClone.remove();
251
263
  this.item.setStyle('visibility:visible');
252
264
  }
253
265
  Sortable.current = false;
266
+ this.fire('finish', this._evOpts(event));
267
+ },
268
+
269
+ // returns the event options
270
+ _evOpts: function(event, item) {
271
+ item = item || this.item;
272
+ var list = Sortable.cast(item.parent());
273
+
274
+ return {
275
+ list: list,
276
+ item: item,
277
+ event: event,
278
+ index: list.items().indexOf(item)
279
+ };
254
280
  },
255
281
 
256
282
  _initDrag: function(item, event_pos) {
257
- var dims = this.dimensions(), item_dims = item.dimensions();
283
+ var dims = this.dimensions(), item_dims = item.dimensions();
258
284
 
259
285
  // creating the draggable clone
260
286
  var clone = item.clone().setStyle({
@@ -292,7 +318,7 @@ var Sortable = new Widget('UL', {
292
318
  _findSuspects: function() {
293
319
  var suspects = this.suspects = R([]), item = this.item, clone = this.itemClone;
294
320
  this.options.accept.each(function(list) {
295
- list.children().each(function(element) {
321
+ Sortable.cast(list).items().each(function(element) {
296
322
  if (element !== item && element !== clone) {
297
323
  var dims = element.dimensions();
298
324
 
@@ -360,11 +386,7 @@ $(document).on({
360
386
  var element = event.find(Sortable.Options.cssRule+",*.rui-sortable");
361
387
 
362
388
  if (element) {
363
- if (!(element instanceof Sortable)) {
364
- element = new Sortable(element);
365
- }
366
-
367
- element.startDrag(event);
389
+ Sortable.cast(element).startDrag(event);
368
390
  }
369
391
  },
370
392
 
@@ -374,9 +396,9 @@ $(document).on({
374
396
  }
375
397
  },
376
398
 
377
- mouseup: function() {
399
+ mouseup: function(event) {
378
400
  if (Sortable.current) {
379
- Sortable.current.finishDrag();
401
+ Sortable.current.finishDrag(event);
380
402
  }
381
403
  }
382
404
  });
@@ -6,11 +6,11 @@
6
6
  *
7
7
  * Copyright (C) 2009-2010 Nikolay Nemshilov
8
8
  */
9
- var Sortable=RightJS.Sortable=function(l,f){var j=f.$,m=f.$w,n=f.isString,o=f.isArray,k=f.Object,h=new (function(a,b){if(!b){b=a;a="DIV"}var d=new f.Wrapper(f.Element.Wrappers[a]||f.Element,{initialize:function(e,c){this.key=e;var g=[{"class":"rui-"+e}];this instanceof f.Input||this instanceof f.Form||g.unshift(a);this.$super.apply(this,g);if(f.isString(c))c=f.$(c);if(c instanceof f.Element){this._=c._;if("$listeners"in c)c.$listeners=c.$listeners;c={}}this.setOptions(c,this);return this},setOptions:function(e,
10
- c){c=c||this;f.Options.setOptions.call(this,f.Object.merge(e,eval("("+(c.get("data-"+this.key)||"{}")+")")));return this}});d=new f.Wrapper(d,b);f.Observer.createShortcuts(d.prototype,d.EVENTS||[]);return d})("UL",{extend:{version:"2.0.0",EVENTS:m("change"),Options:{url:null,method:"put",Xhr:{},idParam:"id",posParam:"position",parseId:true,dragClass:"dragging",accept:null,minLength:1,cssRule:"*[data-sortable]"},current:false},initialize:function(a,b){this.$super("sortable",a).setOptions(b).addClass("rui-sortable").on("change",
11
- this._tryXhr).on("selectstart","stopEvent")},setOptions:function(a,b){this.$super(a,b);a=this.options;var d=a.accept||[];o(d)||(d=[d]);a.accept=f([this].concat(d)).map(j).uniq();return this},startDrag:function(a){if(!(this.children().length<=this.options.minLength)){var b=a.target;b=f([b].concat(b.parents()));b=b[b.indexOf(this)-1];a=a.position();if(b){this._initDrag(b,a);h.current=this}}},moveItem:function(a){a=a.position();var b=this.itemClone._.style,d=a.y-this.yRDiff,e=a.x-this.xRDiff,c=e+this.cloneWidth,
12
- g=d+this.cloneHeight;b.top=a.y-this.yDiff+"px";b.left=a.x-this.xDiff+"px";if(a=this.suspects.first(function(i){return(d>i.top&&d<i.topHalf||g<i.bottom&&g>i.topHalf)&&(e>i.left&&e<i.leftHalf||c<i.right&&c>i.leftHalf)})){b=a.item;b.insert(this.item,b.prevSiblings().include(this.item)?"after":"before");this._findSuspects();a=b.parent();a instanceof h||(a=new h(a));this.fire("change",{list:a,item:this.item,index:a.children().indexOf(this.item)})}},finishDrag:function(){if(this.itemClone){this.itemClone.remove();
13
- this.item.setStyle("visibility:visible")}h.current=false},_initDrag:function(a,b){this.dimensions();var d=a.dimensions(),e=a.clone().setStyle({margin:0,zIndex:9999,position:"absolute",top:"0px",left:"0px"}).addClass(this.options.dragClass).insertTo(this).setHeight(this.cloneHeight=d.height).setWidth(this.cloneWidth=d.width),c=e.position(),g=d.left-c.x;d=d.top-c.y;e.moveTo(g,d);this.item=a.setStyle("visibility:hidden");this.itemClone=e;this.xDiff=b.x-g;this.yDiff=b.y-d;this.xRDiff=b.x-e.position().x;
14
- this.yRDiff=b.y-e.position().y;this._findSuspects()},_findSuspects:function(){var a=this.suspects=f([]),b=this.item,d=this.itemClone;this.options.accept.each(function(e){e.children().each(function(c){if(c!==b&&c!==d){var g=c.dimensions();a.push({item:c,top:g.top,left:g.left,right:g.left+g.width,bottom:g.top+g.height,topHalf:g.top+g.height/2,leftHalf:g.left+g.width/2})}})})},_tryXhr:function(a){if(this.options.url){var b=f(this.options.url),d={},e=a.item;a=a.index+1;var c=k.merge({method:this.options.method,
15
- params:{}},this.options.Xhr);e=e.get("id")||"";if(this.options.parseId&&e)e=(e.match(/\d+/)||[""])[0];if(b.include("%{id}"))b=b.replace("%{id}",e);else d[this.options.idParam]=e;d[this.options.posParam]=a;if(n(c.params))c.params+="&"+k.toQueryString(d);else c.params=k.merge(c.params,d);f.Xhr.load(b,c)}}});j(l).on({mousedown:function(a){var b=a.find(h.Options.cssRule+",*.rui-sortable");if(b){b instanceof h||(b=new h(b));b.startDrag(a)}},mousemove:function(a){h.current&&h.current.moveItem(a)},mouseup:function(){h.current&&
16
- h.current.finishDrag()}});j(window).onBlur(function(){h.current&&h.current.finishDrag()});l.write('<style type="text/css">.rui-sortable{user-select:none;-moz-user-select:none;-webkit-user-select:none}</style>');return h}(document,RightJS);
9
+ var Sortable=RightJS.Sortable=function(l,f){var j=f.$,n=f.$w,o=f.isString,p=f.isArray,k=f.Object,h=new (function(a,b){if(!b){b=a;a="DIV"}var c=new f.Wrapper(f.Element.Wrappers[a]||f.Element,{initialize:function(e,d){this.key=e;var g=[{"class":"rui-"+e}];this instanceof f.Input||this instanceof f.Form||g.unshift(a);this.$super.apply(this,g);if(f.isString(d))d=f.$(d);if(d instanceof f.Element){this._=d._;if("$listeners"in d)d.$listeners=d.$listeners;d={}}this.setOptions(d,this);return this},setOptions:function(e,
10
+ d){d=d||this;f.Options.setOptions.call(this,f.Object.merge(e,eval("("+(d.get("data-"+this.key)||"{}")+")")));return this}});c=new f.Wrapper(c,b);f.Observer.createShortcuts(c.prototype,c.EVENTS||[]);return c})("UL",{extend:{version:"2.0.0",EVENTS:n("start change finish"),Options:{url:null,method:"put",Xhr:{},idParam:"id",posParam:"position",parseId:true,dragClass:"dragging",accept:null,minLength:1,itemCss:"li",handleCss:"li",cssRule:"*[data-sortable]"},current:false,cast:function(a){a=j(a._);a instanceof
11
+ h||(a=new h(a));return a}},initialize:function(a,b){this.$super("sortable",a).setOptions(b).addClass("rui-sortable").on("finish",this._tryXhr).on("selectstart","stopEvent")},setOptions:function(a,b){this.$super(a,b);a=this.options;var c=a.accept||[];p(c)||(c=[c]);a.accept=f([this].concat(c)).map(j).uniq();return this},items:function(){return this.children(this.options.itemCss)},startDrag:function(a){if(!(this.items().length<=this.options.minLength)){var b=a.find(this.options.itemCss),c=a.find(this.options.handleCss);
12
+ if(b&&c){this._initDrag(b,a.position());h.current=this;this.fire("start",this._evOpts(a))}}},moveItem:function(a){var b=a.position(),c=this.itemClone._.style,e=b.y-this.yRDiff,d=b.x-this.xRDiff,g=d+this.cloneWidth,m=e+this.cloneHeight;c.top=b.y-this.yDiff+"px";c.left=b.x-this.xDiff+"px";if(b=this.suspects.first(function(i){return(e>i.top&&e<i.topHalf||m<i.bottom&&m>i.topHalf)&&(d>i.left&&d<i.leftHalf||g<i.right&&g>i.leftHalf)})){c=b.item;c.insert(this.item,c.prevSiblings().include(this.item)?"after":
13
+ "before");this._findSuspects();this.fire("change",this._evOpts(a,c))}},finishDrag:function(a){if(this.itemClone){this.itemClone.remove();this.item.setStyle("visibility:visible")}h.current=false;this.fire("finish",this._evOpts(a))},_evOpts:function(a,b){b=b||this.item;var c=h.cast(b.parent());return{list:c,item:b,event:a,index:c.items().indexOf(b)}},_initDrag:function(a,b){this.dimensions();var c=a.dimensions(),e=a.clone().setStyle({margin:0,zIndex:9999,position:"absolute",top:"0px",left:"0px"}).addClass(this.options.dragClass).insertTo(this).setHeight(this.cloneHeight=
14
+ c.height).setWidth(this.cloneWidth=c.width),d=e.position(),g=c.left-d.x;c=c.top-d.y;e.moveTo(g,c);this.item=a.setStyle("visibility:hidden");this.itemClone=e;this.xDiff=b.x-g;this.yDiff=b.y-c;this.xRDiff=b.x-e.position().x;this.yRDiff=b.y-e.position().y;this._findSuspects()},_findSuspects:function(){var a=this.suspects=f([]),b=this.item,c=this.itemClone;this.options.accept.each(function(e){h.cast(e).items().each(function(d){if(d!==b&&d!==c){var g=d.dimensions();a.push({item:d,top:g.top,left:g.left,
15
+ right:g.left+g.width,bottom:g.top+g.height,topHalf:g.top+g.height/2,leftHalf:g.left+g.width/2})}})})},_tryXhr:function(a){if(this.options.url){var b=f(this.options.url),c={},e=a.item;a=a.index+1;var d=k.merge({method:this.options.method,params:{}},this.options.Xhr);e=e.get("id")||"";if(this.options.parseId&&e)e=(e.match(/\d+/)||[""])[0];if(b.include("%{id}"))b=b.replace("%{id}",e);else c[this.options.idParam]=e;c[this.options.posParam]=a;if(o(d.params))d.params+="&"+k.toQueryString(c);else d.params=
16
+ k.merge(d.params,c);f.Xhr.load(b,d)}}});j(l).on({mousedown:function(a){var b=a.find(h.Options.cssRule+",*.rui-sortable");b&&h.cast(b).startDrag(a)},mousemove:function(a){h.current&&h.current.moveItem(a)},mouseup:function(a){h.current&&h.current.finishDrag(a)}});j(window).onBlur(function(){h.current&&h.current.finishDrag()});l.write('<style type="text/css">.rui-sortable{user-select:none;-moz-user-select:none;-webkit-user-select:none}</style>');return h}(document,RightJS);