right-rails 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/init.rb +1 -0
- data/lib/generators/right_rails/right_rails_generator.rb +15 -6
- data/lib/right_rails.rb +1 -1
- data/lib/right_rails/controller_extensions.rb +28 -15
- data/lib/right_rails/helpers/misc.rb +38 -38
- data/lib/right_rails/helpers/rails.rb +50 -7
- data/lib/rjs_renderer.rb +26 -0
- data/spec/lib/right_rails/controller_extensions_spec.rb +25 -14
- data/spec/lib/right_rails/helpers/forms_spec.rb +6 -6
- data/spec/lib/right_rails/helpers/rails_spec.rb +44 -45
- data/vendor/assets/images/rightjs-ui/rte.png +0 -0
- data/vendor/assets/javascripts/right-safe-src.js +2 -2
- data/vendor/assets/javascripts/right-safe.js +2 -2
- data/vendor/assets/javascripts/right-src.js +386 -100
- data/vendor/assets/javascripts/right.js +2 -2
- data/vendor/assets/javascripts/right/calendar-src.js +19 -3
- data/vendor/assets/javascripts/right/calendar.js +2 -2
- data/vendor/assets/javascripts/right/colorpicker-src.js +59 -20
- data/vendor/assets/javascripts/right/colorpicker.js +2 -2
- data/vendor/assets/javascripts/right/i18n/de.js +43 -42
- data/vendor/assets/javascripts/right/i18n/es.js +1 -0
- data/vendor/assets/javascripts/right/i18n/fi.js +1 -0
- data/vendor/assets/javascripts/right/i18n/fr.js +1 -0
- data/vendor/assets/javascripts/right/i18n/hu.js +1 -0
- data/vendor/assets/javascripts/right/i18n/it.js +1 -0
- data/vendor/assets/javascripts/right/i18n/jp.js +1 -0
- data/vendor/assets/javascripts/right/i18n/lt.js +96 -0
- data/vendor/assets/javascripts/right/i18n/nl.js +1 -0
- data/vendor/assets/javascripts/right/i18n/pt-br.js +1 -0
- data/vendor/assets/javascripts/right/i18n/ru.js +1 -0
- data/vendor/assets/javascripts/right/i18n/ua.js +1 -0
- data/vendor/assets/javascripts/right/jquerysh-src.js +4 -4
- data/vendor/assets/javascripts/right/jquerysh.js +2 -2
- data/vendor/assets/javascripts/right/rails-src.js +51 -15
- data/vendor/assets/javascripts/right/rails.js +2 -2
- data/vendor/assets/javascripts/right/resizable-src.js +11 -11
- data/vendor/assets/javascripts/right/rte-src.js +33 -13
- data/vendor/assets/javascripts/right/rte.js +2 -2
- data/vendor/assets/javascripts/right/slider-src.js +137 -28
- data/vendor/assets/javascripts/right/slider.js +2 -2
- metadata +24 -126
- data/generators/right_rails/right_rails_generator.rb +0 -46
- data/generators/right_rails/templates/iframed.html.erb +0 -10
- data/generators/right_scaffold/right_scaffold_generator.rb +0 -53
- data/generators/right_scaffold/templates/controller.rb +0 -99
- data/generators/right_scaffold/templates/helper.rb +0 -2
- data/generators/right_scaffold/templates/layout.html.erb +0 -18
- data/generators/right_scaffold/templates/style.css +0 -54
- data/generators/right_scaffold/templates/view__form.html.erb +0 -16
- data/generators/right_scaffold/templates/view__item.html.erb +0 -13
- data/generators/right_scaffold/templates/view_edit.html.erb +0 -6
- data/generators/right_scaffold/templates/view_index.html.erb +0 -9
- data/generators/right_scaffold/templates/view_new.html.erb +0 -5
- data/generators/right_scaffold/templates/view_show.html.erb +0 -10
- data/lib/generators/right_rails/templates/iframed.html.erb +0 -10
- data/public/images/rightjs-ui/colorpicker.png +0 -0
- data/public/images/rightjs-ui/resizable.png +0 -0
- data/public/images/rightjs-ui/rte.png +0 -0
- data/public/javascripts/right-olds-src.js +0 -652
- data/public/javascripts/right-olds.js +0 -9
- data/public/javascripts/right-safe-src.js +0 -68
- data/public/javascripts/right-safe.js +0 -7
- data/public/javascripts/right-src.js +0 -6014
- data/public/javascripts/right.js +0 -7
- data/public/javascripts/right/autocompleter-src.js +0 -625
- data/public/javascripts/right/autocompleter.js +0 -7
- data/public/javascripts/right/billboard-src.js +0 -564
- data/public/javascripts/right/billboard.js +0 -7
- data/public/javascripts/right/calendar-src.js +0 -1464
- data/public/javascripts/right/calendar.js +0 -7
- data/public/javascripts/right/casting-src.js +0 -183
- data/public/javascripts/right/casting.js +0 -7
- data/public/javascripts/right/colorpicker-src.js +0 -981
- data/public/javascripts/right/colorpicker.js +0 -7
- data/public/javascripts/right/dialog-src.js +0 -768
- data/public/javascripts/right/dialog.js +0 -7
- data/public/javascripts/right/dnd-src.js +0 -591
- data/public/javascripts/right/dnd.js +0 -7
- data/public/javascripts/right/effects-src.js +0 -508
- data/public/javascripts/right/effects.js +0 -7
- data/public/javascripts/right/i18n/de.js +0 -95
- data/public/javascripts/right/i18n/en-us.js +0 -11
- data/public/javascripts/right/i18n/es.js +0 -95
- data/public/javascripts/right/i18n/fi.js +0 -96
- data/public/javascripts/right/i18n/fr.js +0 -95
- data/public/javascripts/right/i18n/hu.js +0 -100
- data/public/javascripts/right/i18n/it.js +0 -95
- data/public/javascripts/right/i18n/jp.js +0 -99
- data/public/javascripts/right/i18n/nl.js +0 -95
- data/public/javascripts/right/i18n/pt-br.js +0 -95
- data/public/javascripts/right/i18n/ru.js +0 -95
- data/public/javascripts/right/i18n/ua.js +0 -99
- data/public/javascripts/right/in-edit-src.js +0 -373
- data/public/javascripts/right/in-edit.js +0 -7
- data/public/javascripts/right/jquerysh-src.js +0 -362
- data/public/javascripts/right/jquerysh.js +0 -7
- data/public/javascripts/right/json-src.js +0 -147
- data/public/javascripts/right/json.js +0 -7
- data/public/javascripts/right/keys-src.js +0 -87
- data/public/javascripts/right/keys.js +0 -7
- data/public/javascripts/right/lightbox-src.js +0 -931
- data/public/javascripts/right/lightbox.js +0 -7
- data/public/javascripts/right/rails-src.js +0 -402
- data/public/javascripts/right/rails.js +0 -7
- data/public/javascripts/right/rater-src.js +0 -384
- data/public/javascripts/right/rater.js +0 -7
- data/public/javascripts/right/resizable-src.js +0 -465
- data/public/javascripts/right/resizable.js +0 -7
- data/public/javascripts/right/rte-src.js +0 -2685
- data/public/javascripts/right/rte.js +0 -7
- data/public/javascripts/right/selectable-src.js +0 -725
- data/public/javascripts/right/selectable.js +0 -7
- data/public/javascripts/right/sizzle-src.js +0 -1132
- data/public/javascripts/right/sizzle.js +0 -7
- data/public/javascripts/right/slider-src.js +0 -395
- data/public/javascripts/right/slider.js +0 -7
- data/public/javascripts/right/sortable-src.js +0 -430
- data/public/javascripts/right/sortable.js +0 -7
- data/public/javascripts/right/table-src.js +0 -176
- data/public/javascripts/right/table.js +0 -7
- data/public/javascripts/right/tabs-src.js +0 -1157
- data/public/javascripts/right/tabs.js +0 -7
- data/public/javascripts/right/tags-src.js +0 -745
- data/public/javascripts/right/tags.js +0 -7
- data/public/javascripts/right/tooltips-src.js +0 -331
- data/public/javascripts/right/tooltips.js +0 -7
- data/public/javascripts/right/uploader-src.js +0 -302
- data/public/javascripts/right/uploader.js +0 -7
@@ -1,7 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* RightJS-UI Sortable v2.2.0
|
3
|
-
* http://rightjs.org/ui/sortable
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var Sortable=RightJS.Sortable=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.isString,h=b.isArray,i=b.Object,j=new c("UL",{extend:{version:"2.2.0",EVENTS:f("start change finish"),Options:{url:null,method:"put",Xhr:{},idParam:"id",posParam:"position",parseId:!0,dragClass:"dragging",accept:null,minLength:1,itemCss:"li",handleCss:"li",cssRule:"*[data-sortable]"},current:!1,cast:function(a){a=e(a._),a instanceof j||(a=new j(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||[];h(c)||(c=[c]),a.accept=d([this].concat(c)).map(e).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);b&&c&&(this._initDrag(b,a.position()),j.current=this,this.fire("start",this._evOpts(a)))}},moveItem:function(a){var b=a.position(),c=this.itemClone._.style,d=b.y-this.yRDiff,e=b.x-this.xRDiff,f=e+this.cloneWidth,g=d+this.cloneHeight;c.top=b.y-this.yDiff+"px",c.left=b.x-this.xDiff+"px";var h=this.suspects.first(function(a){return(d>a.top&&d<a.topHalf||g<a.bottom&&g>a.topHalf)&&(e>a.left&&e<a.leftHalf||f<a.right&&f>a.leftHalf)});h&&(c=h.item,c.insert(this.item,c.prevSiblings().include(this.item)?"after":"before"),this._findSuspects(),this.fire("change",this._evOpts(a,c)))},finishDrag:function(a){this.itemClone&&(this.itemClone.remove(),this.item.setStyle("visibility:visible")),j.current=!1,this.fire("finish",this._evOpts(a))},_evOpts:function(a,b){b=b||this.item;var c=j.cast(b.parent());return{list:c,item:b,event:a,index:c.items().indexOf(b)}},_initDrag:function(a,b){var c=this.dimensions(),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),f=e.position(),g=d.left-f.x,h=d.top-f.y;e.moveTo(g,h),this.item=a.setStyle("visibility:hidden"),this.itemClone=e,this.xDiff=b.x-g,this.yDiff=b.y-h,this.xRDiff=b.x-e.position().x,this.yRDiff=b.y-e.position().y,this._findSuspects()},_findSuspects:function(){var a=this.suspects=d([]),b=this.item,c=this.itemClone;this.options.accept.each(function(d){j.cast(d).items().each(function(d){if(d!==b&&d!==c){var e=d.dimensions();a.push({item:d,top:e.top,left:e.left,right:e.left+e.width,bottom:e.top+e.height,topHalf:e.top+e.height/2,leftHalf:e.left+e.width/2})}})})},_tryXhr:function(a){if(this.options.url){var c=d(this.options.url),e={},f=a.item,h=a.index+1,j=i.merge({method:this.options.method,params:{}},this.options.Xhr),k=f.get("id")||"";this.options.parseId&&k&&(k=(k.match(/\d+/)||[""])[0]),c.include("%{id}")?c=c.replace("%{id}",k):e[this.options.idParam]=k,e[this.options.posParam]=h,g(j.params)?j.params+="&"+i.toQueryString(e):j.params=i.merge(j.params,e),b.Xhr.load(c,j)}}});e(a).on({mousedown:function(a){var b=a.find(j.Options.cssRule+",*.rui-sortable");b&&j.cast(b).startDrag(a)},mousemove:function(a){j.current&&j.current.moveItem(a)},mouseup:function(a){j.current&&j.current.finishDrag(a)}}),e(window).onBlur(function(){j.current&&j.current.finishDrag()});var k=a.createElement("style"),l=a.createTextNode(".rui-sortable{user-select:none;-moz-user-select:none;-webkit-user-select:none}");k.type="text/css",a.getElementsByTagName("head")[0].appendChild(k),k.styleSheet?k.styleSheet.cssText=l.nodeValue:k.appendChild(l);return j}(document,RightJS)
|
@@ -1,176 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Tables Specific Wrappers v2.2.0
|
3
|
-
* http://rightjs.org/plugins/table
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var Table = RightJS.Table = (function(RightJS) {
|
8
|
-
/**
|
9
|
-
* Table plugin initialization script
|
10
|
-
*
|
11
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
12
|
-
*/
|
13
|
-
var R = RightJS,
|
14
|
-
$ = RightJS.$,
|
15
|
-
$E = RightJS.$E,
|
16
|
-
isHash = RightJS.isHash,
|
17
|
-
isElement = RightJS.isElement,
|
18
|
-
Class = RightJS.Class,
|
19
|
-
Object = RightJS.Object,
|
20
|
-
Element = RightJS.Element;
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
/**
|
26
|
-
* Tables specific dom-wrapper
|
27
|
-
*
|
28
|
-
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
29
|
-
*/
|
30
|
-
var Table = Element.Wrappers.TABLE = new Class(Element, {
|
31
|
-
|
32
|
-
extend: {
|
33
|
-
version: '2.2.0',
|
34
|
-
|
35
|
-
Options: {
|
36
|
-
ascMarker: '▼', // asc marker content
|
37
|
-
descMarker: '▲', // desc marker content
|
38
|
-
algorithm: 'text', // default sorting algorithm 'text' or 'numeric'
|
39
|
-
order: 'asc', // default order
|
40
|
-
sortedClass: 'sorted'
|
41
|
-
}
|
42
|
-
},
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Basic constructor
|
46
|
-
*
|
47
|
-
* @param mixed raw dom-element or an options list
|
48
|
-
* @return void
|
49
|
-
*/
|
50
|
-
initialize: function(arg) {
|
51
|
-
var options = arg || {}, element = options;
|
52
|
-
|
53
|
-
if (isHash(options) && !isElement(options)) {
|
54
|
-
element = 'table';
|
55
|
-
}
|
56
|
-
|
57
|
-
this.$super(element, options);
|
58
|
-
|
59
|
-
this.options = Object.merge(
|
60
|
-
Table.Options, new Function('return '+ this.get('data-table'))
|
61
|
-
);
|
62
|
-
},
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Sorts the table by the given index
|
66
|
-
*
|
67
|
-
* @param mixed Number column index or TH element
|
68
|
-
* @param String order direction 'asc' or 'desc'
|
69
|
-
* @param String optional algorythm 'string', 'numeric'
|
70
|
-
* @return Table this
|
71
|
-
*/
|
72
|
-
sort: function(index, direction, algorithm) {
|
73
|
-
var th = index instanceof Element ? index : this.header().last().children('th')[index];
|
74
|
-
if (!th) { return this; } // in case something goes wrong
|
75
|
-
|
76
|
-
// reading data from the TH cell
|
77
|
-
index = th.parent().children('th').indexOf(th);
|
78
|
-
direction = direction || (this.marker && this.marker.parent() === th ? this.marker.asc ? 'desc' : 'asc' : null);
|
79
|
-
algorithm = algorithm || (th.hasClass('numeric') ? 'numeric' : null);
|
80
|
-
|
81
|
-
// handling the fallback from the options
|
82
|
-
direction = direction || this.options.order;
|
83
|
-
algorithm = algorithm || this.options.algorithm;
|
84
|
-
sortedClass = this.options.sortedClass;
|
85
|
-
|
86
|
-
// collecting the list of sortable rows
|
87
|
-
var rows = this.rows().map(function(row) {
|
88
|
-
var cell = row.children('td')[index], text = cell ? cell.text() : '';
|
89
|
-
|
90
|
-
if (algorithm === 'numeric') {
|
91
|
-
text = R(text).toFloat();
|
92
|
-
}
|
93
|
-
|
94
|
-
return { row: row, text: text };
|
95
|
-
});
|
96
|
-
|
97
|
-
// creating an anchor where to insert the rows
|
98
|
-
var anchor = rows[0] ?
|
99
|
-
$E('tr').insertTo(rows[0].row, 'before') :
|
100
|
-
$E('tr').insertTo(this.first('tbody') || this);
|
101
|
-
|
102
|
-
// finding the exact sorting algorithm
|
103
|
-
if (typeof(algorithm) !== 'function') {
|
104
|
-
algorithm = direction === 'asc' ? function(a, b) {
|
105
|
-
return a.text > b.text ? 1 : a.text < b.text ? -1 : 0;
|
106
|
-
} : function(a, b) {
|
107
|
-
return a.text > b.text ? -1 : a.text < b.text ? 1 : 0;
|
108
|
-
};
|
109
|
-
}
|
110
|
-
|
111
|
-
// sorting the rows and reinsert them in the correct order
|
112
|
-
rows.sort(algorithm).reverse().each(function(hash) {
|
113
|
-
anchor.insert(hash.row, 'after');
|
114
|
-
});
|
115
|
-
|
116
|
-
anchor.remove();
|
117
|
-
|
118
|
-
// putting the sorting marker
|
119
|
-
this.marker = (
|
120
|
-
this.marker || th.first('span.sort-marker') || $E('span', {'class': 'sort-marker'})
|
121
|
-
).update(
|
122
|
-
this.options[direction === 'asc' ? 'ascMarker' : 'descMarker']
|
123
|
-
).insertTo(th, 'bottom');
|
124
|
-
this.marker.asc = direction === 'asc';
|
125
|
-
this.find('th').each(function(th) {
|
126
|
-
th.removeClass(sortedClass);
|
127
|
-
});
|
128
|
-
this.marker.parent().toggleClass(sortedClass);
|
129
|
-
|
130
|
-
return this;
|
131
|
-
},
|
132
|
-
|
133
|
-
/**
|
134
|
-
* Returns the table data-rows
|
135
|
-
*
|
136
|
-
* @return Array table data rows
|
137
|
-
*/
|
138
|
-
rows: function() {
|
139
|
-
return this.find('tr').reject(function(row) {
|
140
|
-
return row.first('th') || row.parent('tfoot');
|
141
|
-
});
|
142
|
-
},
|
143
|
-
|
144
|
-
/**
|
145
|
-
* Returns the table header rows
|
146
|
-
*
|
147
|
-
* @return Array table header rows
|
148
|
-
*/
|
149
|
-
header: function() {
|
150
|
-
return this.find('tr').filter('first', 'th');
|
151
|
-
},
|
152
|
-
|
153
|
-
/**
|
154
|
-
* Returns the table footer rows
|
155
|
-
*
|
156
|
-
* @return Array table footer rows
|
157
|
-
*/
|
158
|
-
footer: function() {
|
159
|
-
return this.find('tfoot > tr');
|
160
|
-
}
|
161
|
-
});
|
162
|
-
|
163
|
-
/**
|
164
|
-
* Document level hooks for the table plugin
|
165
|
-
*
|
166
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
167
|
-
*/
|
168
|
-
$(document).onClick(function(event) {
|
169
|
-
var th = event.find('th.sortable');
|
170
|
-
|
171
|
-
if (th) {
|
172
|
-
th.parent('table').sort(th);
|
173
|
-
}
|
174
|
-
});
|
175
|
-
return Table;
|
176
|
-
})(RightJS);
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Tables Specific Wrappers v2.2.0
|
3
|
-
* http://rightjs.org/plugins/table
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var Table=RightJS.Table=function(a){var b=a,c=a.$,d=a.$E,e=a.isHash,f=a.isElement,g=a.Class,h=a.Object,i=a.Element,j=i.Wrappers.TABLE=new g(i,{extend:{version:"2.2.0",Options:{ascMarker:"▼",descMarker:"▲",algorithm:"text",order:"asc",sortedClass:"sorted"}},initialize:function(a){var b=a||{},c=b;e(b)&&!f(b)&&(c="table"),this.$super(c,b),this.options=h.merge(j.Options,new Function("return "+this.get("data-table")))},sort:function(a,c,e){var f=a instanceof i?a:this.header().last().children("th")[a];if(!f)return this;a=f.parent().children("th").indexOf(f),c=c||(this.marker&&this.marker.parent()===f?this.marker.asc?"desc":"asc":null),e=e||(f.hasClass("numeric")?"numeric":null),c=c||this.options.order,e=e||this.options.algorithm,sortedClass=this.options.sortedClass;var g=this.rows().map(function(c){var d=c.children("td")[a],f=d?d.text():"";e==="numeric"&&(f=b(f).toFloat());return{row:c,text:f}}),h=g[0]?d("tr").insertTo(g[0].row,"before"):d("tr").insertTo(this.first("tbody")||this);typeof e!=="function"&&(e=c==="asc"?function(a,b){return a.text>b.text?1:a.text<b.text?-1:0}:function(a,b){return a.text>b.text?-1:a.text<b.text?1:0}),g.sort(e).reverse().each(function(a){h.insert(a.row,"after")}),h.remove(),this.marker=(this.marker||f.first("span.sort-marker")||d("span",{"class":"sort-marker"})).update(this.options[c==="asc"?"ascMarker":"descMarker"]).insertTo(f,"bottom"),this.marker.asc=c==="asc",this.find("th").each(function(a){a.removeClass(sortedClass)}),this.marker.parent().toggleClass(sortedClass);return this},rows:function(){return this.find("tr").reject(function(a){return a.first("th")||a.parent("tfoot")})},header:function(){return this.find("tr").filter("first","th")},footer:function(){return this.find("tfoot > tr")}});c(document).onClick(function(a){var b=a.find("th.sortable");b&&b.parent("table").sort(b)});return j}(RightJS)
|
@@ -1,1157 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* RightJS-UI Tabs v2.2.3
|
3
|
-
* http://rightjs.org/ui/tabs
|
4
|
-
*
|
5
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
6
|
-
*/
|
7
|
-
var Tabs = RightJS.Tabs = (function(document, parseInt, RightJS) {
|
8
|
-
/**
|
9
|
-
* This module defines the basic widgets constructor
|
10
|
-
* it creates an abstract proxy with the common functionality
|
11
|
-
* which then we reuse and override in the actual widgets
|
12
|
-
*
|
13
|
-
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
14
|
-
*/
|
15
|
-
|
16
|
-
/**
|
17
|
-
* The widget units constructor
|
18
|
-
*
|
19
|
-
* @param String tag-name or Object methods
|
20
|
-
* @param Object methods
|
21
|
-
* @return Widget wrapper
|
22
|
-
*/
|
23
|
-
function Widget(tag_name, methods) {
|
24
|
-
if (!methods) {
|
25
|
-
methods = tag_name;
|
26
|
-
tag_name = 'DIV';
|
27
|
-
}
|
28
|
-
|
29
|
-
/**
|
30
|
-
* An Abstract Widget Unit
|
31
|
-
*
|
32
|
-
* Copyright (C) 2010 Nikolay Nemshilov
|
33
|
-
*/
|
34
|
-
var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
|
35
|
-
/**
|
36
|
-
* The common constructor
|
37
|
-
*
|
38
|
-
* @param Object options
|
39
|
-
* @param String optional tag name
|
40
|
-
* @return void
|
41
|
-
*/
|
42
|
-
initialize: function(key, options) {
|
43
|
-
this.key = key;
|
44
|
-
var args = [{'class': 'rui-' + key}];
|
45
|
-
|
46
|
-
// those two have different constructors
|
47
|
-
if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
|
48
|
-
args.unshift(tag_name);
|
49
|
-
}
|
50
|
-
this.$super.apply(this, args);
|
51
|
-
|
52
|
-
if (RightJS.isString(options)) {
|
53
|
-
options = RightJS.$(options);
|
54
|
-
}
|
55
|
-
|
56
|
-
// if the options is another element then
|
57
|
-
// try to dynamically rewrap it with our widget
|
58
|
-
if (options instanceof RightJS.Element) {
|
59
|
-
this._ = options._;
|
60
|
-
if ('$listeners' in options) {
|
61
|
-
options.$listeners = options.$listeners;
|
62
|
-
}
|
63
|
-
options = {};
|
64
|
-
}
|
65
|
-
this.setOptions(options, this);
|
66
|
-
|
67
|
-
return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
|
68
|
-
},
|
69
|
-
|
70
|
-
// protected
|
71
|
-
|
72
|
-
/**
|
73
|
-
* Catches the options
|
74
|
-
*
|
75
|
-
* @param Object user-options
|
76
|
-
* @param Element element with contextual options
|
77
|
-
* @return void
|
78
|
-
*/
|
79
|
-
setOptions: function(options, element) {
|
80
|
-
if (element) {
|
81
|
-
options = RightJS.Object.merge(options, new Function("return "+(
|
82
|
-
element.get('data-'+ this.key) || '{}'
|
83
|
-
))());
|
84
|
-
}
|
85
|
-
|
86
|
-
if (options) {
|
87
|
-
RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
|
88
|
-
}
|
89
|
-
|
90
|
-
return this;
|
91
|
-
}
|
92
|
-
});
|
93
|
-
|
94
|
-
/**
|
95
|
-
* Creating the actual widget class
|
96
|
-
*
|
97
|
-
*/
|
98
|
-
var Klass = new RightJS.Class(AbstractWidget, methods);
|
99
|
-
|
100
|
-
// creating the widget related shortcuts
|
101
|
-
RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || RightJS([]));
|
102
|
-
|
103
|
-
return Klass;
|
104
|
-
}
|
105
|
-
|
106
|
-
|
107
|
-
/**
|
108
|
-
* A shared module to create textual spinners
|
109
|
-
*
|
110
|
-
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
111
|
-
*/
|
112
|
-
var Spinner = new RightJS.Class(RightJS.Element, {
|
113
|
-
/**
|
114
|
-
* Constructor
|
115
|
-
*
|
116
|
-
* @param Number optional spinner size (4 by default)
|
117
|
-
* @return void
|
118
|
-
*/
|
119
|
-
initialize: function(size) {
|
120
|
-
this.$super('div', {'class': 'rui-spinner'});
|
121
|
-
this.dots = [];
|
122
|
-
|
123
|
-
for (var i=0; i < (size || 4); i++) {
|
124
|
-
this.dots.push(new RightJS.Element('div'));
|
125
|
-
}
|
126
|
-
|
127
|
-
this.dots[0].addClass('glowing');
|
128
|
-
this.insert(this.dots);
|
129
|
-
RightJS(this.shift).bind(this).periodical(300);
|
130
|
-
},
|
131
|
-
|
132
|
-
/**
|
133
|
-
* Shifts the spinner elements
|
134
|
-
*
|
135
|
-
* @return void
|
136
|
-
*/
|
137
|
-
shift: function() {
|
138
|
-
if (this.visible()) {
|
139
|
-
var dot = this.dots.pop();
|
140
|
-
this.dots.unshift(dot);
|
141
|
-
this.insert(dot, 'top');
|
142
|
-
}
|
143
|
-
}
|
144
|
-
});
|
145
|
-
|
146
|
-
|
147
|
-
/**
|
148
|
-
* The tabs init-script
|
149
|
-
*
|
150
|
-
* Copyright (C) 2010-2011 Nikolay Nemshilov
|
151
|
-
*/
|
152
|
-
var R = RightJS,
|
153
|
-
$ = RightJS.$,
|
154
|
-
$$ = RightJS.$$,
|
155
|
-
$w = RightJS.$w,
|
156
|
-
$E = RightJS.$E,
|
157
|
-
Fx = RightJS.Fx,
|
158
|
-
Object = RightJS.Object,
|
159
|
-
Browser = RightJS.Browser,
|
160
|
-
isArray = RightJS.isArray,
|
161
|
-
isNumber = RightJS.isNumber,
|
162
|
-
Class = RightJS.Class,
|
163
|
-
Element = RightJS.Element,
|
164
|
-
Cookie = RightJS.Cookie;
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
/**
|
173
|
-
* The basic tabs handling engine
|
174
|
-
*
|
175
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
176
|
-
*/
|
177
|
-
var Tabs = new Widget('UL', {
|
178
|
-
extend: {
|
179
|
-
version: '2.2.3',
|
180
|
-
|
181
|
-
EVENTS: $w('select hide load disable enable add remove move'),
|
182
|
-
|
183
|
-
Options: {
|
184
|
-
idPrefix: '', // the tab-body elements id prefix
|
185
|
-
tabsElement: null, // the tabs list element reference, in case it's situated somewhere else
|
186
|
-
|
187
|
-
resizeFx: 'both', // 'slide', 'fade', 'both' or null for no fx
|
188
|
-
resizeDuration: 400, // the tab panels resize fx duration
|
189
|
-
|
190
|
-
scrollTabs: false, // use the tabs list scrolling
|
191
|
-
scrollDuration: 400, // the tabs scrolling fx duration
|
192
|
-
|
193
|
-
selected: null, // the index of the currently opened tab, by default will check url, cookies or set 0
|
194
|
-
disabled: null, // list of disabled tab indexes
|
195
|
-
|
196
|
-
closable: false, // set true if you want a close icon on your tabs
|
197
|
-
|
198
|
-
loop: false, // put a delay in ms to make it autostart the slideshow loop
|
199
|
-
loopPause: true, // make the loop get paused when user hovers the tabs with mouse
|
200
|
-
|
201
|
-
url: false, // a common remote tabs url template, should have the %{id} placeholder
|
202
|
-
cache: false, // marker if the remote tabs should be cached
|
203
|
-
|
204
|
-
Xhr: null, // the xhr addtional options
|
205
|
-
Cookie: null // set the cookie options if you'd like to keep the last selected tab index in cookies
|
206
|
-
},
|
207
|
-
|
208
|
-
// scans and automatically intializes the tabs
|
209
|
-
rescan: function(scope) {
|
210
|
-
$(scope || document).find('.rui-tabs,*[data-tabs]').each(function(element) {
|
211
|
-
element = element instanceof Tabs ? element : new Tabs(element);
|
212
|
-
});
|
213
|
-
}
|
214
|
-
},
|
215
|
-
|
216
|
-
/**
|
217
|
-
* The basic constructor
|
218
|
-
*
|
219
|
-
* @param element or id
|
220
|
-
* @param Object options
|
221
|
-
*/
|
222
|
-
initialize: function(element, options) {
|
223
|
-
this
|
224
|
-
.$super('tabs', element)
|
225
|
-
.setOptions(options)
|
226
|
-
.addClass('rui-tabs');
|
227
|
-
|
228
|
-
this.isHarmonica = this._.tagName === 'DL';
|
229
|
-
this.isCarousel = this.hasClass('rui-tabs-carousel');
|
230
|
-
this.isSimple = !this.isHarmonica && !this.isCarousel;
|
231
|
-
|
232
|
-
this
|
233
|
-
.findTabs()
|
234
|
-
.initScrolls()
|
235
|
-
.findCurrent()
|
236
|
-
.setStyle('visibility:visible');
|
237
|
-
|
238
|
-
if (this.options.disabled) {
|
239
|
-
this.disable(this.options.disabled);
|
240
|
-
}
|
241
|
-
|
242
|
-
if (this.options.loop) {
|
243
|
-
this.startLoop();
|
244
|
-
}
|
245
|
-
},
|
246
|
-
|
247
|
-
/**
|
248
|
-
* Shows the given tab
|
249
|
-
*
|
250
|
-
* @param integer tab index or a Tabs.Tab instance
|
251
|
-
* @return Tabs this
|
252
|
-
*/
|
253
|
-
select: function(tab) {
|
254
|
-
return this.callTab(tab, 'select');
|
255
|
-
},
|
256
|
-
|
257
|
-
/**
|
258
|
-
* Disables the given tab
|
259
|
-
*
|
260
|
-
* @param integer tab index or a Tabs.Tab instance or a list of them
|
261
|
-
* @return Tabs this
|
262
|
-
*/
|
263
|
-
disable: function(tab) {
|
264
|
-
return this.callTab(tab, 'disable');
|
265
|
-
},
|
266
|
-
|
267
|
-
/**
|
268
|
-
* Enables the given tab
|
269
|
-
*
|
270
|
-
* @param integer tab index or a Tabs.Tab instance or a list of them
|
271
|
-
* @return Tabs this
|
272
|
-
*/
|
273
|
-
enable: function(tab) {
|
274
|
-
return this.callTab(tab, 'enable');
|
275
|
-
},
|
276
|
-
|
277
|
-
/**
|
278
|
-
* Returns the reference to the currently opened tab
|
279
|
-
*
|
280
|
-
* @return Tab tab or undefined
|
281
|
-
*/
|
282
|
-
current: function() {
|
283
|
-
return this.tabs.first('current');
|
284
|
-
},
|
285
|
-
|
286
|
-
/**
|
287
|
-
* Returns the list of enabled tabs
|
288
|
-
*
|
289
|
-
* @return Array of enabled tabs
|
290
|
-
*/
|
291
|
-
enabled: function() {
|
292
|
-
return this.tabs.filter('enabled');
|
293
|
-
},
|
294
|
-
|
295
|
-
// protected
|
296
|
-
|
297
|
-
// calls the tab (or tabs) method
|
298
|
-
callTab: function(tabs, method) {
|
299
|
-
R(isArray(tabs) ? tabs : [tabs]).each(function(tab) {
|
300
|
-
if (isNumber(tab)) { tab = this.tabs[tab]; }
|
301
|
-
if (tab && tab instanceof Tab) {
|
302
|
-
tab[method]();
|
303
|
-
}
|
304
|
-
}, this);
|
305
|
-
|
306
|
-
return this;
|
307
|
-
},
|
308
|
-
|
309
|
-
// finds and interconnects the tabs
|
310
|
-
findTabs: function() {
|
311
|
-
this.tabsList = this.isHarmonica ? this :
|
312
|
-
$(this.options.tabsElement) || this.first('.rui-tabs-list') ||
|
313
|
-
(this.first('UL') || $E('UL').insertTo(this)).addClass('rui-tabs-list');
|
314
|
-
|
315
|
-
this.tabs = R([]);
|
316
|
-
|
317
|
-
this.tabsList.children(this.isHarmonica ? 'dt' : null).map(function(node) {
|
318
|
-
this.tabs.push(new Tab(node, this));
|
319
|
-
}, this);
|
320
|
-
|
321
|
-
// removing the whitespaces so the didn't screw with the margins
|
322
|
-
for (var i=0, list = this.tabsList.get('childNodes'); i < list.length; i++) {
|
323
|
-
if (list[i].nodeType == 3) { this.tabsList._.removeChild(list[i]); }
|
324
|
-
}
|
325
|
-
|
326
|
-
return this;
|
327
|
-
}
|
328
|
-
});
|
329
|
-
|
330
|
-
|
331
|
-
/**
|
332
|
-
* A single tab handling object
|
333
|
-
*
|
334
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
335
|
-
*/
|
336
|
-
var Tab = Tabs.Tab = new Class(Element, {
|
337
|
-
extend: {
|
338
|
-
autoId: 0
|
339
|
-
},
|
340
|
-
|
341
|
-
/**
|
342
|
-
* Constructor
|
343
|
-
*
|
344
|
-
* @param Element the tab's element
|
345
|
-
* @param Tabs the main element
|
346
|
-
* @return void
|
347
|
-
*/
|
348
|
-
initialize: function(element, main) {
|
349
|
-
this.$super(element._);
|
350
|
-
this.addClass('rui-tabs-tab');
|
351
|
-
|
352
|
-
this.main = main;
|
353
|
-
this.link = this.first('a');
|
354
|
-
this.id = this.link.get('href').split('#')[1] || Tab.autoId++;
|
355
|
-
this.panel = new Panel(this.findPanel(), this);
|
356
|
-
|
357
|
-
if (this.current()) {
|
358
|
-
this.select();
|
359
|
-
}
|
360
|
-
|
361
|
-
// adding the 'close' icon onto the tab if needed
|
362
|
-
if (main.options.closable) {
|
363
|
-
this.link.insert($E('div', {
|
364
|
-
'class': 'rui-tabs-tab-close-icon', 'html': '×'
|
365
|
-
}).onClick(R(this.remove).bind(this)));
|
366
|
-
}
|
367
|
-
|
368
|
-
this.onClick(this._clicked);
|
369
|
-
},
|
370
|
-
|
371
|
-
select: function() {
|
372
|
-
if (this.enabled()) {
|
373
|
-
var prev_tab = this.main.current();
|
374
|
-
if (prev_tab) {
|
375
|
-
prev_tab.removeClass('rui-tabs-current').fire('hide');
|
376
|
-
}
|
377
|
-
|
378
|
-
this.addClass('rui-tabs-current');
|
379
|
-
this.main.scrollToTab(this);
|
380
|
-
this.panel.show();
|
381
|
-
}
|
382
|
-
|
383
|
-
return this.fire('select');
|
384
|
-
},
|
385
|
-
|
386
|
-
disable: function() {
|
387
|
-
return this.addClass('rui-tabs-disabled').fire('disable');
|
388
|
-
},
|
389
|
-
|
390
|
-
enable: function() {
|
391
|
-
return this.removeClass('rui-tabs-disabled').fire('enable');
|
392
|
-
},
|
393
|
-
|
394
|
-
disabled: function() {
|
395
|
-
return !this.enabled();
|
396
|
-
},
|
397
|
-
|
398
|
-
enabled: function() {
|
399
|
-
return !this.hasClass('rui-tabs-disabled');
|
400
|
-
},
|
401
|
-
|
402
|
-
current: function() {
|
403
|
-
return this.hasClass('rui-tabs-current');
|
404
|
-
},
|
405
|
-
|
406
|
-
remove: function(event) {
|
407
|
-
if (event) { event.stop(); }
|
408
|
-
|
409
|
-
// switching to the next available sibling
|
410
|
-
if (this.current()) {
|
411
|
-
var enabled = this.main.enabled();
|
412
|
-
var sibling = enabled[enabled.indexOf(this) + 1] || enabled[enabled.indexOf(this)-1];
|
413
|
-
|
414
|
-
if (sibling) {
|
415
|
-
sibling.select();
|
416
|
-
}
|
417
|
-
}
|
418
|
-
|
419
|
-
// removing the tab out of the list
|
420
|
-
this.main.tabs.splice(this.main.tabs.indexOf(this), 1);
|
421
|
-
this.panel.remove();
|
422
|
-
|
423
|
-
var parent = this.parent();
|
424
|
-
this.fire('beforeremove');
|
425
|
-
this.$super();
|
426
|
-
parent.fire('remove', {target: this});
|
427
|
-
|
428
|
-
return this;
|
429
|
-
},
|
430
|
-
|
431
|
-
// protected
|
432
|
-
|
433
|
-
// handles the clicks on the tabs
|
434
|
-
_clicked: function(event) {
|
435
|
-
event.stop();
|
436
|
-
return this.select();
|
437
|
-
},
|
438
|
-
|
439
|
-
// searches for a panel for the tab
|
440
|
-
findPanel: function() {
|
441
|
-
var main = this.main, panel_id = main.options.idPrefix + this.id, panel;
|
442
|
-
|
443
|
-
if (main.isHarmonica) {
|
444
|
-
var next = this.next();
|
445
|
-
panel = (next && next._.tagName === 'DD') ? next : $E('DD').insertTo(this, 'after');
|
446
|
-
} else {
|
447
|
-
panel = $(panel_id) || $E(main._.tagName === 'UL' ? 'LI' : 'DIV').insertTo(main);
|
448
|
-
}
|
449
|
-
|
450
|
-
return panel.set('id', panel_id);
|
451
|
-
},
|
452
|
-
|
453
|
-
// returns the tab width, used for the scrolling calculations
|
454
|
-
width: function() {
|
455
|
-
var next = this.next();
|
456
|
-
|
457
|
-
if (next) {
|
458
|
-
return next.position().x - this.position().x;
|
459
|
-
} else {
|
460
|
-
return this.size().x + 1;
|
461
|
-
}
|
462
|
-
}
|
463
|
-
|
464
|
-
});
|
465
|
-
|
466
|
-
|
467
|
-
/**
|
468
|
-
* The tab panels behavior logic
|
469
|
-
*
|
470
|
-
* Copyright (C) 2009-2011 Nikolay Nemshilov
|
471
|
-
*/
|
472
|
-
var Panel = Tabs.Panel = new Class(Element, {
|
473
|
-
|
474
|
-
/**
|
475
|
-
* Basic constructor
|
476
|
-
*
|
477
|
-
* @param Element panel-element
|
478
|
-
* @param Tab the tab object
|
479
|
-
* @return void
|
480
|
-
*/
|
481
|
-
initialize: function(element, tab) {
|
482
|
-
this.$super(element._);
|
483
|
-
this.addClass('rui-tabs-panel');
|
484
|
-
|
485
|
-
this.tab = tab;
|
486
|
-
this.id = this.get('id');
|
487
|
-
},
|
488
|
-
|
489
|
-
// shows the panel
|
490
|
-
show: function() {
|
491
|
-
return this.resizing(function() {
|
492
|
-
this.tab.main.tabs.each(function(tab) {
|
493
|
-
tab.panel[
|
494
|
-
tab.panel === this ? 'addClass' : 'removeClass'
|
495
|
-
]('rui-tabs-current');
|
496
|
-
}, this);
|
497
|
-
});
|
498
|
-
},
|
499
|
-
|
500
|
-
// updates the panel content
|
501
|
-
update: function(content) {
|
502
|
-
// don't use resize if it's some other hidden tab was loaded asynch
|
503
|
-
if (this.tab.current()) {
|
504
|
-
this.resizing(function() {
|
505
|
-
Element.prototype.update.call(this, content||'');
|
506
|
-
});
|
507
|
-
} else {
|
508
|
-
this.$super(content||'');
|
509
|
-
}
|
510
|
-
|
511
|
-
return this;
|
512
|
-
},
|
513
|
-
|
514
|
-
// locks the panel with a spinner locker
|
515
|
-
lock: function() {
|
516
|
-
this.insert(this.locker(), 'top');
|
517
|
-
},
|
518
|
-
|
519
|
-
// protected
|
520
|
-
|
521
|
-
resizing: function(callback) {
|
522
|
-
var controller = this.tab.main;
|
523
|
-
|
524
|
-
if (controller.__working) { return this.resizing.bind(this, callback).delay(100); }
|
525
|
-
|
526
|
-
var options = controller.options;
|
527
|
-
var prev_panel = controller.tabs.map('panel').first('hasClass', 'rui-tabs-current');
|
528
|
-
var this_panel = this;
|
529
|
-
var swapping = prev_panel !== this_panel;
|
530
|
-
var loading = this.first('div.rui-tabs-panel-locker');
|
531
|
-
|
532
|
-
// sometimes it looses the parent on remote tabs
|
533
|
-
if (this_panel.parent().hasClass('rui-tabs-resizer')) {
|
534
|
-
this_panel.insertTo(prev_panel.parent());
|
535
|
-
}
|
536
|
-
|
537
|
-
if (options.resizeFx && RightJS.Fx && prev_panel && (swapping || loading)) {
|
538
|
-
controller.__working = true;
|
539
|
-
var unlock = function() { controller.__working = false; };
|
540
|
-
|
541
|
-
// calculating the visual effects durations
|
542
|
-
var fx_name = (options.resizeFx === 'both' && loading) ? 'slide' : options.resizeFx;
|
543
|
-
var duration = options.resizeDuration; duration = Fx.Durations[duration] || duration;
|
544
|
-
var resize_duration = fx_name === 'fade' ? 0 : fx_name === 'slide' ? duration : duration / 2;
|
545
|
-
var fade_duration = duration - resize_duration;
|
546
|
-
|
547
|
-
if (fx_name !== 'slide') {
|
548
|
-
this_panel.setStyle({opacity: 0});
|
549
|
-
}
|
550
|
-
|
551
|
-
// saving the previous sizes
|
552
|
-
var prev_panel_height = (controller.isHarmonica && swapping) ? 0 : prev_panel.size().y;
|
553
|
-
|
554
|
-
// applying the changes
|
555
|
-
callback.call(this);
|
556
|
-
|
557
|
-
// getting the new size
|
558
|
-
var new_panel_height = this_panel.size().y;
|
559
|
-
var fx_wrapper = null;
|
560
|
-
var hide_wrapper = null;
|
561
|
-
var prev_back = null;
|
562
|
-
|
563
|
-
if (fx_name !== 'fade' && prev_panel_height !== new_panel_height) {
|
564
|
-
// preserving the whole element size so it didn't jump when we are tossing the tabs around
|
565
|
-
controller._.style.height = controller.size().y + 'px';
|
566
|
-
|
567
|
-
// wrapping the element with an overflowed element to visualize the resize
|
568
|
-
fx_wrapper = $E('div', {
|
569
|
-
'class': 'rui-tabs-resizer',
|
570
|
-
'style': 'height: '+ prev_panel_height + 'px'
|
571
|
-
});
|
572
|
-
|
573
|
-
// in case of harmonica nicely hidding the previous panel
|
574
|
-
if (controller.isHarmonica && swapping) {
|
575
|
-
prev_panel.addClass('rui-tabs-current');
|
576
|
-
hide_wrapper = $E('div', {'class': 'rui-tabs-resizer'});
|
577
|
-
hide_wrapper._.style.height = prev_panel.size().y + 'px';
|
578
|
-
prev_back = function() {
|
579
|
-
hide_wrapper.replace(prev_panel.removeClass('rui-tabs-current'));
|
580
|
-
};
|
581
|
-
prev_panel.wrap(hide_wrapper);
|
582
|
-
|
583
|
-
fx_wrapper._.style.height = '0px';
|
584
|
-
}
|
585
|
-
|
586
|
-
this_panel.wrap(fx_wrapper);
|
587
|
-
|
588
|
-
// getting back the auto-size so we could resize it
|
589
|
-
controller._.style.height = 'auto';
|
590
|
-
|
591
|
-
} else {
|
592
|
-
// removing the resize duration out of the equasion
|
593
|
-
rezise_duration = 0;
|
594
|
-
duration = fade_duration;
|
595
|
-
}
|
596
|
-
|
597
|
-
var counter = 0;
|
598
|
-
var set_back = function() {
|
599
|
-
if (fx_wrapper) {
|
600
|
-
if (fx_name == 'both' && !counter) {
|
601
|
-
return counter ++;
|
602
|
-
}
|
603
|
-
|
604
|
-
fx_wrapper.replace(this_panel);
|
605
|
-
}
|
606
|
-
|
607
|
-
unlock();
|
608
|
-
};
|
609
|
-
|
610
|
-
if (hide_wrapper) {
|
611
|
-
hide_wrapper.morph({height: '0px'},
|
612
|
-
{duration: resize_duration, onFinish: prev_back});
|
613
|
-
}
|
614
|
-
|
615
|
-
if (fx_wrapper) {
|
616
|
-
fx_wrapper.morph({height: new_panel_height + 'px'},
|
617
|
-
{duration: resize_duration, onFinish: set_back});
|
618
|
-
}
|
619
|
-
|
620
|
-
if (fx_name !== 'slide') {
|
621
|
-
this_panel.morph.bind(this_panel, {opacity: 1},
|
622
|
-
{duration: fade_duration, onFinish: set_back}
|
623
|
-
).delay(resize_duration);
|
624
|
-
}
|
625
|
-
|
626
|
-
if (!fx_wrapper && fx_name === 'slide') {
|
627
|
-
set_back();
|
628
|
-
}
|
629
|
-
|
630
|
-
} else {
|
631
|
-
callback.call(this);
|
632
|
-
}
|
633
|
-
|
634
|
-
return this;
|
635
|
-
},
|
636
|
-
|
637
|
-
// builds the locker element
|
638
|
-
locker: function() {
|
639
|
-
return this._locker || (this._locker =
|
640
|
-
$E('div', {'class': 'rui-tabs-panel-locker'}).insert(new Spinner(5))
|
641
|
-
);
|
642
|
-
}
|
643
|
-
});
|
644
|
-
|
645
|
-
|
646
|
-
/**
|
647
|
-
* Contains the tabs scrolling functionality
|
648
|
-
*
|
649
|
-
* NOTE: different types of tabs have different scrolling behavior
|
650
|
-
* simple tabs just scroll the tabs line without actually picking
|
651
|
-
* any tab. But the carousel tabs scrolls to the next/previous
|
652
|
-
* tabs on the list.
|
653
|
-
*
|
654
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
655
|
-
*/
|
656
|
-
Tabs.include({
|
657
|
-
/**
|
658
|
-
* Shows the next tab
|
659
|
-
*
|
660
|
-
* @return Tabs this
|
661
|
-
*/
|
662
|
-
next: function() {
|
663
|
-
return this.pickTab(+1);
|
664
|
-
},
|
665
|
-
|
666
|
-
/**
|
667
|
-
* Shows the preveious tab
|
668
|
-
*
|
669
|
-
* @return Tabs this
|
670
|
-
*/
|
671
|
-
prev: function() {
|
672
|
-
return this.pickTab(-1);
|
673
|
-
},
|
674
|
-
|
675
|
-
/**
|
676
|
-
* Scrolls the tabs to the left
|
677
|
-
*
|
678
|
-
* @return Tabs this
|
679
|
-
*/
|
680
|
-
scrollLeft: function() {
|
681
|
-
if (!this.prevButton.hasClass('rui-tabs-scroller-disabled')) {
|
682
|
-
this[this.isCarousel ? 'prev' : 'justScroll'](+0.6);
|
683
|
-
}
|
684
|
-
return this;
|
685
|
-
},
|
686
|
-
|
687
|
-
/**
|
688
|
-
* Scrolls the tabs to the right
|
689
|
-
*
|
690
|
-
* @return Tabs this
|
691
|
-
*/
|
692
|
-
scrollRight: function() {
|
693
|
-
if (!this.nextButton.hasClass('rui-tabs-scroller-disabled')) {
|
694
|
-
this[this.isCarousel ? 'next' : 'justScroll'](-0.6);
|
695
|
-
}
|
696
|
-
return this;
|
697
|
-
},
|
698
|
-
|
699
|
-
// protected
|
700
|
-
|
701
|
-
// overloading the init script to add the scrollbar support
|
702
|
-
initScrolls: function() {
|
703
|
-
if ((this.scrollable = (this.options.scrollTabs || this.isCarousel))) {
|
704
|
-
this.buildScroller();
|
705
|
-
}
|
706
|
-
|
707
|
-
return this;
|
708
|
-
},
|
709
|
-
|
710
|
-
// builds the tabs scroller block
|
711
|
-
buildScroller: function() {
|
712
|
-
if (!(
|
713
|
-
(this.prevButton = this.first('.rui-tabs-scroller-prev')) &&
|
714
|
-
(this.nextButton = this.first('.rui-tabs-scroller-next'))
|
715
|
-
)) {
|
716
|
-
this.prevButton = $E('div', {'class': 'rui-tabs-scroller-prev', 'html': '«'});
|
717
|
-
this.nextButton = $E('div', {'class': 'rui-tabs-scroller-next', 'html': '»'});
|
718
|
-
|
719
|
-
// using a dummy element to insert the scroller in place of the tabs list
|
720
|
-
$E('div').insertTo(this.tabsList, 'before')
|
721
|
-
.replace(
|
722
|
-
$E('div', {'class': 'rui-tabs-scroller'}).insert([
|
723
|
-
this.prevButton, this.nextButton, this.scroller = $E('div', {
|
724
|
-
'class': 'rui-tabs-scroller-body'
|
725
|
-
}).insert(this.tabsList)
|
726
|
-
])
|
727
|
-
).remove();
|
728
|
-
}
|
729
|
-
|
730
|
-
this.prevButton.onClick(R(this.scrollLeft).bind(this));
|
731
|
-
this.nextButton.onClick(R(this.scrollRight).bind(this));
|
732
|
-
},
|
733
|
-
|
734
|
-
// picks the next/prev non-disabled available tab
|
735
|
-
pickTab: function(pos) {
|
736
|
-
var current = this.current();
|
737
|
-
if (current && current.enabled()) {
|
738
|
-
var enabled_tabs = this.enabled();
|
739
|
-
var tab = enabled_tabs[enabled_tabs.indexOf(current) + pos];
|
740
|
-
if (tab) { tab.select(); }
|
741
|
-
}
|
742
|
-
},
|
743
|
-
|
744
|
-
// scrolls the tabs line to make the tab visible
|
745
|
-
scrollToTab: function(tab) {
|
746
|
-
if (this.scroller) {
|
747
|
-
// calculating the previous tabs widths
|
748
|
-
var tabs_width = 0;
|
749
|
-
for (var i=0; i < this.tabs.length; i++) {
|
750
|
-
tabs_width += this.tabs[i].width();
|
751
|
-
if (this.tabs[i] === tab) { break; }
|
752
|
-
}
|
753
|
-
|
754
|
-
// calculating the scroll (the carousel tabs should be centralized)
|
755
|
-
var available_width = this.scroller.size().x;
|
756
|
-
var scroll = (this.isCarousel ? (available_width/2 + tab.width()/2) : available_width) - tabs_width;
|
757
|
-
|
758
|
-
// check if the tab doesn't need to be scrolled
|
759
|
-
if (!this.isCarousel) {
|
760
|
-
var current_scroll = parseInt(this.tabsList.getStyle('left') || 0, 10);
|
761
|
-
|
762
|
-
if (scroll >= current_scroll && scroll < (current_scroll + available_width - tab.width())) {
|
763
|
-
scroll = current_scroll;
|
764
|
-
} else if (current_scroll > -tabs_width && current_scroll <= (tab.width() - tabs_width)) {
|
765
|
-
scroll = tab.width() - tabs_width;
|
766
|
-
}
|
767
|
-
}
|
768
|
-
|
769
|
-
this.scrollTo(scroll);
|
770
|
-
}
|
771
|
-
},
|
772
|
-
|
773
|
-
// just scrolls the scrollable area onto the given number of scrollable area widths
|
774
|
-
justScroll: function(size) {
|
775
|
-
if (!this.scroller) { return this; }
|
776
|
-
var current_scroll = parseInt(this.tabsList.getStyle('left') || 0, 10);
|
777
|
-
var available_width = this.scroller.size().x;
|
778
|
-
|
779
|
-
this.scrollTo(current_scroll + available_width * size);
|
780
|
-
},
|
781
|
-
|
782
|
-
// scrolls the tabs list to the position
|
783
|
-
scrollTo: function(scroll) {
|
784
|
-
// checking the constraints
|
785
|
-
var available_width = this.scroller.size().x;
|
786
|
-
var overall_width = this.tabs.map('width').sum();
|
787
|
-
|
788
|
-
if (scroll < (available_width - overall_width)) {
|
789
|
-
scroll = available_width - overall_width;
|
790
|
-
}
|
791
|
-
if (scroll > 0) { scroll = 0; }
|
792
|
-
|
793
|
-
// applying the scroll
|
794
|
-
this.tabsList.morph({left: scroll+'px'}, {duration: this.options.scrollDuration});
|
795
|
-
|
796
|
-
this.checkScrollButtons(overall_width, available_width, scroll);
|
797
|
-
},
|
798
|
-
|
799
|
-
// checks the scroll buttons
|
800
|
-
checkScrollButtons: function(overall_width, available_width, scroll) {
|
801
|
-
var has_prev = false, has_next = false;
|
802
|
-
|
803
|
-
if (this.isCarousel) {
|
804
|
-
var enabled = this.enabled();
|
805
|
-
var current = enabled.first('current');
|
806
|
-
|
807
|
-
if (current) {
|
808
|
-
var index = enabled.indexOf(current);
|
809
|
-
|
810
|
-
has_prev = index > 0;
|
811
|
-
has_next = index < enabled.length - 1;
|
812
|
-
}
|
813
|
-
} else {
|
814
|
-
has_prev = scroll !== 0;
|
815
|
-
has_next = scroll > (available_width - overall_width);
|
816
|
-
}
|
817
|
-
|
818
|
-
this.prevButton[has_prev ? 'removeClass' : 'addClass']('rui-tabs-scroller-disabled');
|
819
|
-
this.nextButton[has_next ? 'removeClass' : 'addClass']('rui-tabs-scroller-disabled');
|
820
|
-
}
|
821
|
-
|
822
|
-
});
|
823
|
-
|
824
|
-
|
825
|
-
/**
|
826
|
-
* This module handles the current tab state saving/restoring processes
|
827
|
-
*
|
828
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
829
|
-
*/
|
830
|
-
function get_cookie_indexes() {
|
831
|
-
return R(RightJS.Cookie ? (Cookie.get('right-tabs-indexes') || '').split(',') : []);
|
832
|
-
}
|
833
|
-
|
834
|
-
function save_tab_in_cookies(options, tabs, event) {
|
835
|
-
if (RightJS.Cookie) {
|
836
|
-
var indexes = get_cookie_indexes();
|
837
|
-
indexes = indexes.without.apply(indexes, tabs.map('id'));
|
838
|
-
indexes.push(event.target.id);
|
839
|
-
Cookie.set('right-tabs-indexes', indexes.uniq().join(','), options);
|
840
|
-
}
|
841
|
-
}
|
842
|
-
|
843
|
-
Tabs.include({
|
844
|
-
|
845
|
-
// protected
|
846
|
-
|
847
|
-
// searches and activates the current tab
|
848
|
-
findCurrent: function() {
|
849
|
-
var enabled = this.enabled(), current = (
|
850
|
-
this.tabs[this.options.selected] ||
|
851
|
-
this.tabs[this.urlIndex()] ||
|
852
|
-
this.tabs[this.cookieIndex()] ||
|
853
|
-
enabled.first('current') ||
|
854
|
-
enabled[0]
|
855
|
-
);
|
856
|
-
|
857
|
-
if (current) {
|
858
|
-
current.select();
|
859
|
-
}
|
860
|
-
|
861
|
-
// initializing the cookies storage if set
|
862
|
-
if (this.options.Cookie) {
|
863
|
-
this.onSelect(R(save_tab_in_cookies).curry(this.options.Cookie, this.tabs));
|
864
|
-
}
|
865
|
-
|
866
|
-
return this;
|
867
|
-
},
|
868
|
-
|
869
|
-
// tries to find the current tab index in the url hash
|
870
|
-
urlIndex: function() {
|
871
|
-
var index = -1, id = document.location.href.split('#')[1];
|
872
|
-
|
873
|
-
if (id) {
|
874
|
-
for (var i=0; i < this.tabs.length; i++) {
|
875
|
-
if (this.tabs[i].id == id) {
|
876
|
-
index = i;
|
877
|
-
break;
|
878
|
-
}
|
879
|
-
}
|
880
|
-
}
|
881
|
-
|
882
|
-
return index;
|
883
|
-
},
|
884
|
-
|
885
|
-
// tries to find the current tab index in the cookies storage
|
886
|
-
cookieIndex: function() {
|
887
|
-
var index = -1;
|
888
|
-
|
889
|
-
if (this.options.Cookie) {
|
890
|
-
var indexes = get_cookie_indexes();
|
891
|
-
for (var i=0; i < this.tabs.length; i++) {
|
892
|
-
if (indexes.include(this.tabs[i].id)) {
|
893
|
-
index = i;
|
894
|
-
break;
|
895
|
-
}
|
896
|
-
}
|
897
|
-
}
|
898
|
-
|
899
|
-
return index;
|
900
|
-
}
|
901
|
-
|
902
|
-
});
|
903
|
-
|
904
|
-
|
905
|
-
/**
|
906
|
-
* This module handles the tabs cration and removing processes
|
907
|
-
*
|
908
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
909
|
-
*/
|
910
|
-
Tabs.include({
|
911
|
-
/**
|
912
|
-
* Creates a new tab
|
913
|
-
*
|
914
|
-
* USAGE:
|
915
|
-
* With the #add method you have to specify the tab title
|
916
|
-
* optional content (possibly empty or null) and some options
|
917
|
-
* The options might have the following keys
|
918
|
-
*
|
919
|
-
* * id - the tab/panel id (will use the idPrefix option for the panels)
|
920
|
-
* * url - a remote tab content address
|
921
|
-
* * position - an integer position of the tab in the stack
|
922
|
-
*
|
923
|
-
* @param String title
|
924
|
-
* @param mixed content
|
925
|
-
* @param Object options
|
926
|
-
* @return Tabs this
|
927
|
-
*/
|
928
|
-
add: function(title, content, options) {
|
929
|
-
options = options || {};
|
930
|
-
|
931
|
-
// creating the new tab element
|
932
|
-
var element = $E(this.isHarmonica ? 'dt' : 'li').insert(
|
933
|
-
$E('a', {html: title, href: options.url || '#'+(options.id||'')}
|
934
|
-
)).insertTo(this.tabsList);
|
935
|
-
|
936
|
-
// creating the actual tab instance
|
937
|
-
var tab = new Tab(element, this);
|
938
|
-
tab.panel.update(content||'');
|
939
|
-
this.tabs.push(tab);
|
940
|
-
tab.fire('add');
|
941
|
-
|
942
|
-
// moving the tab in place if asked
|
943
|
-
if ('position' in options) {
|
944
|
-
this.move(tab, options.position);
|
945
|
-
}
|
946
|
-
|
947
|
-
return this;
|
948
|
-
},
|
949
|
-
|
950
|
-
/**
|
951
|
-
* Moves the given tab to the given position
|
952
|
-
*
|
953
|
-
* NOTE if the position is not within the tabs range then it will do nothing
|
954
|
-
*
|
955
|
-
* @param mixed tab index or a tab instance
|
956
|
-
* @param Integer position
|
957
|
-
* @return Tabs this
|
958
|
-
*/
|
959
|
-
move: function(tab, position) {
|
960
|
-
tab = this.tabs[tab] || tab;
|
961
|
-
|
962
|
-
if (this.tabs[position] && this.tabs[position] !== tab) {
|
963
|
-
// moving the tab element
|
964
|
-
this.tabs[position].insert(tab, (position === this.tabs.length-1) ? 'after' : 'before');
|
965
|
-
|
966
|
-
// inserting the panel after the tab if it's a harmonica
|
967
|
-
if (this.isHarmonica) {
|
968
|
-
tab.insert(tab.panel, 'after');
|
969
|
-
}
|
970
|
-
|
971
|
-
// moving the tab in the registry
|
972
|
-
this.tabs.splice(this.tabs.indexOf(tab), 1);
|
973
|
-
this.tabs.splice(position, 0, tab);
|
974
|
-
|
975
|
-
tab.fire('move', {index: position});
|
976
|
-
}
|
977
|
-
|
978
|
-
return this;
|
979
|
-
},
|
980
|
-
|
981
|
-
/**
|
982
|
-
* Removes the given tab
|
983
|
-
*
|
984
|
-
* @param integer tab index or a Tabs.Tab instance or a list of them
|
985
|
-
* @return Tabs this
|
986
|
-
*/
|
987
|
-
remove: function(tab) {
|
988
|
-
return arguments.length === 0 ? this.$super() : this.callTab(tab, 'remove');
|
989
|
-
}
|
990
|
-
|
991
|
-
});
|
992
|
-
|
993
|
-
|
994
|
-
/**
|
995
|
-
* This module contains the remote tabs loading logic
|
996
|
-
*
|
997
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
998
|
-
*/
|
999
|
-
var old_select = Tab.prototype.select;
|
1000
|
-
|
1001
|
-
Tab.include({
|
1002
|
-
|
1003
|
-
// wrapping the original mehtod, to catch the remote requests
|
1004
|
-
select: function() {
|
1005
|
-
if (this.dogPiling(arguments)) { return this; }
|
1006
|
-
|
1007
|
-
var result = old_select.apply(this, arguments);
|
1008
|
-
var url = R(this.link.get('href'));
|
1009
|
-
var options = this.main.options;
|
1010
|
-
|
1011
|
-
// building the url
|
1012
|
-
if (url.includes('#')) {
|
1013
|
-
url = options.url ? options.url.replace('%{id}', url.split('#')[1]) : null;
|
1014
|
-
}
|
1015
|
-
|
1016
|
-
// if there is an actual url and no ongoing request or a cache, starting the request
|
1017
|
-
if (url && !this.request && !(options.cache || this.cache)) {
|
1018
|
-
this.panel.lock();
|
1019
|
-
|
1020
|
-
try { // basically that's for the development tests, so the IE browsers didn't get screwed on the test page
|
1021
|
-
|
1022
|
-
this.request = new RightJS.Xhr(url, Object.merge({method: 'get'}, options.Xhr))
|
1023
|
-
.onComplete(R(function(response) {
|
1024
|
-
if (this.main.__working) {
|
1025
|
-
return arguments.callee.bind(this, response).delay(100);
|
1026
|
-
}
|
1027
|
-
|
1028
|
-
this.panel.update(response.text);
|
1029
|
-
|
1030
|
-
this.request = null; // removing the request marker so it could be rerun
|
1031
|
-
if (options.cache) {
|
1032
|
-
this.cache = true;
|
1033
|
-
}
|
1034
|
-
|
1035
|
-
this.fire('load');
|
1036
|
-
}).bind(this)
|
1037
|
-
).send();
|
1038
|
-
|
1039
|
-
} catch(e) { if (!Browser.OLD) { throw(e); } }
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
return result;
|
1043
|
-
},
|
1044
|
-
|
1045
|
-
// protected
|
1046
|
-
|
1047
|
-
dogPiling: function(args) {
|
1048
|
-
if (this.main.__working) {
|
1049
|
-
if (this.main.__timeout) {
|
1050
|
-
this.main.__timeout.cancel();
|
1051
|
-
}
|
1052
|
-
|
1053
|
-
this.main.__timeout = R(function(args) {
|
1054
|
-
this.select.apply(this, args);
|
1055
|
-
}).bind(this, args).delay(100);
|
1056
|
-
|
1057
|
-
return true;
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
return (this.main.__timeout = null);
|
1061
|
-
}
|
1062
|
-
|
1063
|
-
});
|
1064
|
-
|
1065
|
-
|
1066
|
-
/**
|
1067
|
-
* This module handles the slide-show loop feature for the Tabs
|
1068
|
-
*
|
1069
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
1070
|
-
*/
|
1071
|
-
Tabs.include({
|
1072
|
-
|
1073
|
-
/**
|
1074
|
-
* Starts the slideshow loop
|
1075
|
-
*
|
1076
|
-
* @param Number optional delay in ms
|
1077
|
-
* @return Tabs this
|
1078
|
-
*/
|
1079
|
-
startLoop: function(delay) {
|
1080
|
-
if (!delay && !this.options.loop) { return this; }
|
1081
|
-
|
1082
|
-
// attaching the loop pause feature
|
1083
|
-
if (this.options.loopPause) {
|
1084
|
-
this._stopLoop = this._stopLoop || R(this.stopLoop).bind(this, true);
|
1085
|
-
this._startLoop = this._startLoop || R(this.startLoop).bind(this, delay);
|
1086
|
-
|
1087
|
-
this.forgetHovers().on({
|
1088
|
-
mouseover: this._stopLoop,
|
1089
|
-
mouseout: this._startLoop
|
1090
|
-
});
|
1091
|
-
}
|
1092
|
-
|
1093
|
-
if (this.timer) { this.timer.stop(); }
|
1094
|
-
|
1095
|
-
this.timer = R(function() {
|
1096
|
-
var enabled = this.enabled();
|
1097
|
-
var current = this.current();
|
1098
|
-
var next = enabled[enabled.indexOf(current)+1];
|
1099
|
-
|
1100
|
-
this.select(next || enabled.first());
|
1101
|
-
|
1102
|
-
}).bind(this).periodical(this.options.loop || delay);
|
1103
|
-
|
1104
|
-
return this;
|
1105
|
-
},
|
1106
|
-
|
1107
|
-
/**
|
1108
|
-
* Stops the slideshow loop
|
1109
|
-
*
|
1110
|
-
* @return Tabs this
|
1111
|
-
*/
|
1112
|
-
stopLoop: function(event, pause) {
|
1113
|
-
if (this.timer) {
|
1114
|
-
this.timer.stop();
|
1115
|
-
this.timer = null;
|
1116
|
-
}
|
1117
|
-
if (!pause && this._startLoop) {
|
1118
|
-
this.forgetHovers();
|
1119
|
-
}
|
1120
|
-
},
|
1121
|
-
|
1122
|
-
// private
|
1123
|
-
forgetHovers: function() {
|
1124
|
-
return this
|
1125
|
-
.stopObserving('mouseover', this._stopLoop)
|
1126
|
-
.stopObserving('mouseout', this._startLoop);
|
1127
|
-
}
|
1128
|
-
|
1129
|
-
|
1130
|
-
});
|
1131
|
-
|
1132
|
-
|
1133
|
-
/**
|
1134
|
-
* The document level hooks for the tabs-egnine
|
1135
|
-
*
|
1136
|
-
* Copyright (C) 2009-2010 Nikolay Nemshilov
|
1137
|
-
*/
|
1138
|
-
$(document).onReady(function() {
|
1139
|
-
Tabs.rescan();
|
1140
|
-
});
|
1141
|
-
|
1142
|
-
|
1143
|
-
var embed_style = document.createElement('style'),
|
1144
|
-
embed_rules = document.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}.rui-tabs,.rui-tabs-list,.rui-tabs-tab,.rui-tabs-panel,.rui-tabs-scroll-left,.rui-tabs-scroll-right,.rui-tabs-scroll-body,.rui-tabs-panel-locker,.rui-tabs-resizer{margin:0;padding:0;background:none;border:none;list-style:none;display:block;width:auto;height:auto}.rui-tabs{display:block;visibility:hidden;border-bottom:1px solid #CCC}.rui-tabs-resizer{overflow:hidden}.rui-tabs-list{display:block;position:relative;padding:0 .5em;border-bottom:1px solid #CCC;white-space:nowrap}.rui-tabs-list .rui-tabs-tab,.rui-tabs-tab *,.rui-tabs-tab *:hover{display:inline-block; *display:inline; *zoom:1;cursor:pointer;text-decoration:none;vertical-align:center}.rui-tabs-list .rui-tabs-tab{vertical-align:bottom;margin-right:.1em}.rui-tabs-tab a{outline:none;position:relative;border:1px solid #CCC;background:#DDD;color:#444;padding:.3em 1em;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;border-bottom:none;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}.rui-tabs-tab a:hover{border-color:#CCC;background:#EEE}.rui-tabs-list .rui-tabs-current a,.rui-tabs-list .rui-tabs-current a:hover{font-weight:bold;color:#000;background:#FFF;border-bottom:1px solid #FFF;border-top-width:2px;padding-top:.34em;padding-bottom:.34em;top:1px}.rui-tabs-tab a img{border:none;opacity:.6;filter:alpha(opacity=60)}.rui-tabs-tab a:hover img,.rui-tabs-list .rui-tabs-current a img{opacity:1;filter:alpha(opacity=100)}.rui-tabs-disabled a,.rui-tabs-disabled a:hover{background:#EEE;border-color:#DDD;color:#AAA;cursor:default}.rui-tabs-disabled a img,.rui-tabs-disabled a:hover img{opacity:.5;filter:alpha(opacity=50)}.rui-tabs-tab-close-icon{display:inline-block; *display:inline; *zoom:1;margin-right:-0.5em;margin-left:0.5em;cursor:pointer;opacity:0.5;filter:alpha(opacity=50)}.rui-tabs-tab-close-icon:hover{opacity:1;filter:alpha(opacity=100);color:#B00;text-shadow:#888 .15em .15em .2em}.rui-tabs-panel{display:none;position:relative;min-height:4em;padding:.5em 0}.rui-tabs-current{display:block}.rui-tabs-scroller{position:relative;padding:0 1.4em}.rui-tabs-scroller-prev,.rui-tabs-scroller-next{width:1.1em;text-align:center;background:#EEE;color:#666;cursor:pointer;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;position:absolute;bottom:0px;left:0px;padding:0.3em 0;user-select:none;-moz-user-select:none;-webkit-user-select:none}.rui-tabs-scroller-prev:hover,.rui-tabs-scroller-next:hover{color:#000;background:#DDD;border-color:#AAA}.rui-tabs-scroller-prev:active,.rui-tabs-scroller-next:active{background:#eee;border-color:#ccc}.rui-tabs-scroller-next{left:auto;right:0px}.rui-tabs-scroller-disabled,.rui-tabs-scroller-disabled:hover{cursor:default;background:#DDD;border-color:#DDD;color:#AAA}.rui-tabs-scroller-body{overflow:hidden;width:100%;position:relative}.rui-tabs-scroller .rui-tabs-list{padding-left:0;padding-right:0;width:9999em;z-index:10}.rui-tabs-panel-locker{position:absolute;top:0px;left:0px;opacity:0.5;filter:alpha(opacity=50);background:#CCC;width:100%;height:100%;text-align:center}.rui-tabs-panel-locker .rui-spinner{position:absolute;left:44%;top:44%;background:none;border:none;height:2em}.rui-tabs-panel-locker .rui-spinner div{background:#666;width:.65em;margin-left:.15em}.rui-tabs-panel-locker .rui-spinner div.glowing{background:#000}.rui-tabs-carousel .rui-tabs-list{border:none}.rui-tabs-carousel .rui-tabs-tab a,.rui-tabs-carousel .rui-tabs-scroller .rui-tabs-scroller-prev,.rui-tabs-carousel .rui-tabs-scroller .rui-tabs-scroller-next{height:6em;line-height:6em;padding:0;border-bottom:1px solid #ccc;border-radius:.25em;-moz-border-radius:.25em;-webkit-border-radius:.25em}.rui-tabs-carousel .rui-tabs-tab{margin-right:3px}.rui-tabs-carousel .rui-tabs-tab a img{border:1px solid #CCC;vertical-align:middle;margin:.4em;padding:0;border-radius:0;-moz-border-radius:0;-webkit-border-radius:0}.rui-tabs-carousel .rui-tabs-list .rui-tabs-current a{border-width:1px;border-color:#AAA;padding:0;top:auto}.rui-tabs-carousel .rui-tabs-list .rui-tabs-current a img{border-color:#bbb}.rui-tabs-carousel .rui-tabs-panel{text-align:center}dl.rui-tabs{border:none}dt.rui-tabs-tab,dt.rui-tabs-tab a,dt.rui-tabs-tab a:hover{display:block;float:none}dt.rui-tabs-tab a,dt.rui-tabs-tab a:hover{padding:.2em 1em;border:1px solid #ccc;border-radius:.25em;-moz-border-radius:.3em;-webkit-border-radius:.3em}dl.rui-tabs dt.rui-tabs-current a{background:#EEE;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}dl.rui-tabs dd.rui-tabs-current+dt.rui-tabs-tab a{border-top-left-radius:0;border-top-right-radius:0;-moz-border-radius-topleft:0;-moz-border-radius-topright:0;-webkit-border-top-left-radius:0;-webkit-border-top-right-radius:0}");
|
1145
|
-
|
1146
|
-
embed_style.type = 'text/css';
|
1147
|
-
document.getElementsByTagName('head')[0].appendChild(embed_style);
|
1148
|
-
|
1149
|
-
if(embed_style.styleSheet) {
|
1150
|
-
embed_style.styleSheet.cssText = embed_rules.nodeValue;
|
1151
|
-
} else {
|
1152
|
-
embed_style.appendChild(embed_rules);
|
1153
|
-
}
|
1154
|
-
|
1155
|
-
|
1156
|
-
return Tabs;
|
1157
|
-
})(document, parseInt, RightJS);
|