jquery-ui-rails 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/.gitignore +0 -1
- data/History.md +6 -0
- data/README.md +1 -0
- data/Rakefile +13 -2
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery.effects.all.js +14 -0
- data/vendor/assets/javascripts/jquery.effects.blind.js +51 -0
- data/vendor/assets/javascripts/jquery.effects.bounce.js +80 -0
- data/vendor/assets/javascripts/jquery.effects.clip.js +56 -0
- data/vendor/assets/javascripts/jquery.effects.core.js +763 -0
- data/vendor/assets/javascripts/jquery.effects.drop.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.explode.js +81 -0
- data/vendor/assets/javascripts/jquery.effects.fade.js +34 -0
- data/vendor/assets/javascripts/jquery.effects.fold.js +58 -0
- data/vendor/assets/javascripts/jquery.effects.highlight.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.pulsate.js +53 -0
- data/vendor/assets/javascripts/jquery.effects.scale.js +180 -0
- data/vendor/assets/javascripts/jquery.effects.shake.js +59 -0
- data/vendor/assets/javascripts/jquery.effects.slide.js +52 -0
- data/vendor/assets/javascripts/jquery.effects.transfer.js +47 -0
- data/vendor/assets/javascripts/jquery.ui.accordion.js +614 -0
- data/vendor/assets/javascripts/jquery.ui.all.js +31 -0
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +635 -0
- data/vendor/assets/javascripts/jquery.ui.button.js +417 -0
- data/vendor/assets/javascripts/jquery.ui.core.js +321 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-af.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-AU.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-GB.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-en-NZ.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +61 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +27 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ge.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hu.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-km.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lb.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-mk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl-BE.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +24 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +23 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +28 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-ta.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +26 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +25 -0
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +1826 -0
- data/vendor/assets/javascripts/jquery.ui.dialog.js +882 -0
- data/vendor/assets/javascripts/jquery.ui.draggable.js +835 -0
- data/vendor/assets/javascripts/jquery.ui.droppable.js +301 -0
- data/vendor/assets/javascripts/jquery.ui.mouse.js +168 -0
- data/vendor/assets/javascripts/jquery.ui.position.js +298 -0
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +112 -0
- data/vendor/assets/javascripts/jquery.ui.resizable.js +811 -0
- data/vendor/assets/javascripts/jquery.ui.selectable.js +271 -0
- data/vendor/assets/javascripts/jquery.ui.slider.js +666 -0
- data/vendor/assets/javascripts/jquery.ui.sortable.js +1085 -0
- data/vendor/assets/javascripts/jquery.ui.tabs.js +760 -0
- data/vendor/assets/javascripts/jquery.ui.widget.js +272 -0
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +23 -0
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +13 -0
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +57 -0
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +23 -0
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +42 -0
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +38 -0
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +72 -0
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +25 -0
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +15 -0
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +24 -0
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +14 -0
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +28 -0
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +22 -0
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +250 -0
- metadata +111 -113
- data/jquery-ui/GPL-LICENSE.txt +0 -278
- data/jquery-ui/MIT-LICENSE.txt +0 -25
- data/jquery-ui/package.json +0 -36
@@ -0,0 +1,760 @@
|
|
1
|
+
//= require jquery.ui.core
|
2
|
+
//= require jquery.ui.widget
|
3
|
+
|
4
|
+
/*!
|
5
|
+
* jQuery UI Tabs 1.8.20
|
6
|
+
*
|
7
|
+
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
|
8
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
9
|
+
* http://jquery.org/license
|
10
|
+
*
|
11
|
+
* http://docs.jquery.com/UI/Tabs
|
12
|
+
*
|
13
|
+
* Depends:
|
14
|
+
* jquery.ui.core.js
|
15
|
+
* jquery.ui.widget.js
|
16
|
+
*/
|
17
|
+
(function( $, undefined ) {
|
18
|
+
|
19
|
+
var tabId = 0,
|
20
|
+
listId = 0;
|
21
|
+
|
22
|
+
function getNextTabId() {
|
23
|
+
return ++tabId;
|
24
|
+
}
|
25
|
+
|
26
|
+
function getNextListId() {
|
27
|
+
return ++listId;
|
28
|
+
}
|
29
|
+
|
30
|
+
$.widget( "ui.tabs", {
|
31
|
+
options: {
|
32
|
+
add: null,
|
33
|
+
ajaxOptions: null,
|
34
|
+
cache: false,
|
35
|
+
cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
|
36
|
+
collapsible: false,
|
37
|
+
disable: null,
|
38
|
+
disabled: [],
|
39
|
+
enable: null,
|
40
|
+
event: "click",
|
41
|
+
fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
|
42
|
+
idPrefix: "ui-tabs-",
|
43
|
+
load: null,
|
44
|
+
panelTemplate: "<div></div>",
|
45
|
+
remove: null,
|
46
|
+
select: null,
|
47
|
+
show: null,
|
48
|
+
spinner: "<em>Loading…</em>",
|
49
|
+
tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
|
50
|
+
},
|
51
|
+
|
52
|
+
_create: function() {
|
53
|
+
this._tabify( true );
|
54
|
+
},
|
55
|
+
|
56
|
+
_setOption: function( key, value ) {
|
57
|
+
if ( key == "selected" ) {
|
58
|
+
if (this.options.collapsible && value == this.options.selected ) {
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
this.select( value );
|
62
|
+
} else {
|
63
|
+
this.options[ key ] = value;
|
64
|
+
this._tabify();
|
65
|
+
}
|
66
|
+
},
|
67
|
+
|
68
|
+
_tabId: function( a ) {
|
69
|
+
return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
|
70
|
+
this.options.idPrefix + getNextTabId();
|
71
|
+
},
|
72
|
+
|
73
|
+
_sanitizeSelector: function( hash ) {
|
74
|
+
// we need this because an id may contain a ":"
|
75
|
+
return hash.replace( /:/g, "\\:" );
|
76
|
+
},
|
77
|
+
|
78
|
+
_cookie: function() {
|
79
|
+
var cookie = this.cookie ||
|
80
|
+
( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
|
81
|
+
return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
|
82
|
+
},
|
83
|
+
|
84
|
+
_ui: function( tab, panel ) {
|
85
|
+
return {
|
86
|
+
tab: tab,
|
87
|
+
panel: panel,
|
88
|
+
index: this.anchors.index( tab )
|
89
|
+
};
|
90
|
+
},
|
91
|
+
|
92
|
+
_cleanup: function() {
|
93
|
+
// restore all former loading tabs labels
|
94
|
+
this.lis.filter( ".ui-state-processing" )
|
95
|
+
.removeClass( "ui-state-processing" )
|
96
|
+
.find( "span:data(label.tabs)" )
|
97
|
+
.each(function() {
|
98
|
+
var el = $( this );
|
99
|
+
el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
|
100
|
+
});
|
101
|
+
},
|
102
|
+
|
103
|
+
_tabify: function( init ) {
|
104
|
+
var self = this,
|
105
|
+
o = this.options,
|
106
|
+
fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
|
107
|
+
|
108
|
+
this.list = this.element.find( "ol,ul" ).eq( 0 );
|
109
|
+
this.lis = $( " > li:has(a[href])", this.list );
|
110
|
+
this.anchors = this.lis.map(function() {
|
111
|
+
return $( "a", this )[ 0 ];
|
112
|
+
});
|
113
|
+
this.panels = $( [] );
|
114
|
+
|
115
|
+
this.anchors.each(function( i, a ) {
|
116
|
+
var href = $( a ).attr( "href" );
|
117
|
+
// For dynamically created HTML that contains a hash as href IE < 8 expands
|
118
|
+
// such href to the full page url with hash and then misinterprets tab as ajax.
|
119
|
+
// Same consideration applies for an added tab with a fragment identifier
|
120
|
+
// since a[href=#fragment-identifier] does unexpectedly not match.
|
121
|
+
// Thus normalize href attribute...
|
122
|
+
var hrefBase = href.split( "#" )[ 0 ],
|
123
|
+
baseEl;
|
124
|
+
if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
|
125
|
+
( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
|
126
|
+
href = a.hash;
|
127
|
+
a.href = href;
|
128
|
+
}
|
129
|
+
|
130
|
+
// inline tab
|
131
|
+
if ( fragmentId.test( href ) ) {
|
132
|
+
self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
|
133
|
+
// remote tab
|
134
|
+
// prevent loading the page itself if href is just "#"
|
135
|
+
} else if ( href && href !== "#" ) {
|
136
|
+
// required for restore on destroy
|
137
|
+
$.data( a, "href.tabs", href );
|
138
|
+
|
139
|
+
// TODO until #3808 is fixed strip fragment identifier from url
|
140
|
+
// (IE fails to load from such url)
|
141
|
+
$.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
|
142
|
+
|
143
|
+
var id = self._tabId( a );
|
144
|
+
a.href = "#" + id;
|
145
|
+
var $panel = self.element.find( "#" + id );
|
146
|
+
if ( !$panel.length ) {
|
147
|
+
$panel = $( o.panelTemplate )
|
148
|
+
.attr( "id", id )
|
149
|
+
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
|
150
|
+
.insertAfter( self.panels[ i - 1 ] || self.list );
|
151
|
+
$panel.data( "destroy.tabs", true );
|
152
|
+
}
|
153
|
+
self.panels = self.panels.add( $panel );
|
154
|
+
// invalid tab href
|
155
|
+
} else {
|
156
|
+
o.disabled.push( i );
|
157
|
+
}
|
158
|
+
});
|
159
|
+
|
160
|
+
// initialization from scratch
|
161
|
+
if ( init ) {
|
162
|
+
// attach necessary classes for styling
|
163
|
+
this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
|
164
|
+
this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
|
165
|
+
this.lis.addClass( "ui-state-default ui-corner-top" );
|
166
|
+
this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
|
167
|
+
|
168
|
+
// Selected tab
|
169
|
+
// use "selected" option or try to retrieve:
|
170
|
+
// 1. from fragment identifier in url
|
171
|
+
// 2. from cookie
|
172
|
+
// 3. from selected class attribute on <li>
|
173
|
+
if ( o.selected === undefined ) {
|
174
|
+
if ( location.hash ) {
|
175
|
+
this.anchors.each(function( i, a ) {
|
176
|
+
if ( a.hash == location.hash ) {
|
177
|
+
o.selected = i;
|
178
|
+
return false;
|
179
|
+
}
|
180
|
+
});
|
181
|
+
}
|
182
|
+
if ( typeof o.selected !== "number" && o.cookie ) {
|
183
|
+
o.selected = parseInt( self._cookie(), 10 );
|
184
|
+
}
|
185
|
+
if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
|
186
|
+
o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
|
187
|
+
}
|
188
|
+
o.selected = o.selected || ( this.lis.length ? 0 : -1 );
|
189
|
+
} else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
|
190
|
+
o.selected = -1;
|
191
|
+
}
|
192
|
+
|
193
|
+
// sanity check - default to first tab...
|
194
|
+
o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
|
195
|
+
? o.selected
|
196
|
+
: 0;
|
197
|
+
|
198
|
+
// Take disabling tabs via class attribute from HTML
|
199
|
+
// into account and update option properly.
|
200
|
+
// A selected tab cannot become disabled.
|
201
|
+
o.disabled = $.unique( o.disabled.concat(
|
202
|
+
$.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
|
203
|
+
return self.lis.index( n );
|
204
|
+
})
|
205
|
+
) ).sort();
|
206
|
+
|
207
|
+
if ( $.inArray( o.selected, o.disabled ) != -1 ) {
|
208
|
+
o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
|
209
|
+
}
|
210
|
+
|
211
|
+
// highlight selected tab
|
212
|
+
this.panels.addClass( "ui-tabs-hide" );
|
213
|
+
this.lis.removeClass( "ui-tabs-selected ui-state-active" );
|
214
|
+
// check for length avoids error when initializing empty list
|
215
|
+
if ( o.selected >= 0 && this.anchors.length ) {
|
216
|
+
self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
|
217
|
+
this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
|
218
|
+
|
219
|
+
// seems to be expected behavior that the show callback is fired
|
220
|
+
self.element.queue( "tabs", function() {
|
221
|
+
self._trigger( "show", null,
|
222
|
+
self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );
|
223
|
+
});
|
224
|
+
|
225
|
+
this.load( o.selected );
|
226
|
+
}
|
227
|
+
|
228
|
+
// clean up to avoid memory leaks in certain versions of IE 6
|
229
|
+
// TODO: namespace this event
|
230
|
+
$( window ).bind( "unload", function() {
|
231
|
+
self.lis.add( self.anchors ).unbind( ".tabs" );
|
232
|
+
self.lis = self.anchors = self.panels = null;
|
233
|
+
});
|
234
|
+
// update selected after add/remove
|
235
|
+
} else {
|
236
|
+
o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
|
237
|
+
}
|
238
|
+
|
239
|
+
// update collapsible
|
240
|
+
// TODO: use .toggleClass()
|
241
|
+
this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
|
242
|
+
|
243
|
+
// set or update cookie after init and add/remove respectively
|
244
|
+
if ( o.cookie ) {
|
245
|
+
this._cookie( o.selected, o.cookie );
|
246
|
+
}
|
247
|
+
|
248
|
+
// disable tabs
|
249
|
+
for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
|
250
|
+
$( li )[ $.inArray( i, o.disabled ) != -1 &&
|
251
|
+
// TODO: use .toggleClass()
|
252
|
+
!$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
|
253
|
+
}
|
254
|
+
|
255
|
+
// reset cache if switching from cached to not cached
|
256
|
+
if ( o.cache === false ) {
|
257
|
+
this.anchors.removeData( "cache.tabs" );
|
258
|
+
}
|
259
|
+
|
260
|
+
// remove all handlers before, tabify may run on existing tabs after add or option change
|
261
|
+
this.lis.add( this.anchors ).unbind( ".tabs" );
|
262
|
+
|
263
|
+
if ( o.event !== "mouseover" ) {
|
264
|
+
var addState = function( state, el ) {
|
265
|
+
if ( el.is( ":not(.ui-state-disabled)" ) ) {
|
266
|
+
el.addClass( "ui-state-" + state );
|
267
|
+
}
|
268
|
+
};
|
269
|
+
var removeState = function( state, el ) {
|
270
|
+
el.removeClass( "ui-state-" + state );
|
271
|
+
};
|
272
|
+
this.lis.bind( "mouseover.tabs" , function() {
|
273
|
+
addState( "hover", $( this ) );
|
274
|
+
});
|
275
|
+
this.lis.bind( "mouseout.tabs", function() {
|
276
|
+
removeState( "hover", $( this ) );
|
277
|
+
});
|
278
|
+
this.anchors.bind( "focus.tabs", function() {
|
279
|
+
addState( "focus", $( this ).closest( "li" ) );
|
280
|
+
});
|
281
|
+
this.anchors.bind( "blur.tabs", function() {
|
282
|
+
removeState( "focus", $( this ).closest( "li" ) );
|
283
|
+
});
|
284
|
+
}
|
285
|
+
|
286
|
+
// set up animations
|
287
|
+
var hideFx, showFx;
|
288
|
+
if ( o.fx ) {
|
289
|
+
if ( $.isArray( o.fx ) ) {
|
290
|
+
hideFx = o.fx[ 0 ];
|
291
|
+
showFx = o.fx[ 1 ];
|
292
|
+
} else {
|
293
|
+
hideFx = showFx = o.fx;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
// Reset certain styles left over from animation
|
298
|
+
// and prevent IE's ClearType bug...
|
299
|
+
function resetStyle( $el, fx ) {
|
300
|
+
$el.css( "display", "" );
|
301
|
+
if ( !$.support.opacity && fx.opacity ) {
|
302
|
+
$el[ 0 ].style.removeAttribute( "filter" );
|
303
|
+
}
|
304
|
+
}
|
305
|
+
|
306
|
+
// Show a tab...
|
307
|
+
var showTab = showFx
|
308
|
+
? function( clicked, $show ) {
|
309
|
+
$( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
|
310
|
+
$show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
|
311
|
+
.animate( showFx, showFx.duration || "normal", function() {
|
312
|
+
resetStyle( $show, showFx );
|
313
|
+
self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
|
314
|
+
});
|
315
|
+
}
|
316
|
+
: function( clicked, $show ) {
|
317
|
+
$( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
|
318
|
+
$show.removeClass( "ui-tabs-hide" );
|
319
|
+
self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
|
320
|
+
};
|
321
|
+
|
322
|
+
// Hide a tab, $show is optional...
|
323
|
+
var hideTab = hideFx
|
324
|
+
? function( clicked, $hide ) {
|
325
|
+
$hide.animate( hideFx, hideFx.duration || "normal", function() {
|
326
|
+
self.lis.removeClass( "ui-tabs-selected ui-state-active" );
|
327
|
+
$hide.addClass( "ui-tabs-hide" );
|
328
|
+
resetStyle( $hide, hideFx );
|
329
|
+
self.element.dequeue( "tabs" );
|
330
|
+
});
|
331
|
+
}
|
332
|
+
: function( clicked, $hide, $show ) {
|
333
|
+
self.lis.removeClass( "ui-tabs-selected ui-state-active" );
|
334
|
+
$hide.addClass( "ui-tabs-hide" );
|
335
|
+
self.element.dequeue( "tabs" );
|
336
|
+
};
|
337
|
+
|
338
|
+
// attach tab event handler, unbind to avoid duplicates from former tabifying...
|
339
|
+
this.anchors.bind( o.event + ".tabs", function() {
|
340
|
+
var el = this,
|
341
|
+
$li = $(el).closest( "li" ),
|
342
|
+
$hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
|
343
|
+
$show = self.element.find( self._sanitizeSelector( el.hash ) );
|
344
|
+
|
345
|
+
// If tab is already selected and not collapsible or tab disabled or
|
346
|
+
// or is already loading or click callback returns false stop here.
|
347
|
+
// Check if click handler returns false last so that it is not executed
|
348
|
+
// for a disabled or loading tab!
|
349
|
+
if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
|
350
|
+
$li.hasClass( "ui-state-disabled" ) ||
|
351
|
+
$li.hasClass( "ui-state-processing" ) ||
|
352
|
+
self.panels.filter( ":animated" ).length ||
|
353
|
+
self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
|
354
|
+
this.blur();
|
355
|
+
return false;
|
356
|
+
}
|
357
|
+
|
358
|
+
o.selected = self.anchors.index( this );
|
359
|
+
|
360
|
+
self.abort();
|
361
|
+
|
362
|
+
// if tab may be closed
|
363
|
+
if ( o.collapsible ) {
|
364
|
+
if ( $li.hasClass( "ui-tabs-selected" ) ) {
|
365
|
+
o.selected = -1;
|
366
|
+
|
367
|
+
if ( o.cookie ) {
|
368
|
+
self._cookie( o.selected, o.cookie );
|
369
|
+
}
|
370
|
+
|
371
|
+
self.element.queue( "tabs", function() {
|
372
|
+
hideTab( el, $hide );
|
373
|
+
}).dequeue( "tabs" );
|
374
|
+
|
375
|
+
this.blur();
|
376
|
+
return false;
|
377
|
+
} else if ( !$hide.length ) {
|
378
|
+
if ( o.cookie ) {
|
379
|
+
self._cookie( o.selected, o.cookie );
|
380
|
+
}
|
381
|
+
|
382
|
+
self.element.queue( "tabs", function() {
|
383
|
+
showTab( el, $show );
|
384
|
+
});
|
385
|
+
|
386
|
+
// TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
|
387
|
+
self.load( self.anchors.index( this ) );
|
388
|
+
|
389
|
+
this.blur();
|
390
|
+
return false;
|
391
|
+
}
|
392
|
+
}
|
393
|
+
|
394
|
+
if ( o.cookie ) {
|
395
|
+
self._cookie( o.selected, o.cookie );
|
396
|
+
}
|
397
|
+
|
398
|
+
// show new tab
|
399
|
+
if ( $show.length ) {
|
400
|
+
if ( $hide.length ) {
|
401
|
+
self.element.queue( "tabs", function() {
|
402
|
+
hideTab( el, $hide );
|
403
|
+
});
|
404
|
+
}
|
405
|
+
self.element.queue( "tabs", function() {
|
406
|
+
showTab( el, $show );
|
407
|
+
});
|
408
|
+
|
409
|
+
self.load( self.anchors.index( this ) );
|
410
|
+
} else {
|
411
|
+
throw "jQuery UI Tabs: Mismatching fragment identifier.";
|
412
|
+
}
|
413
|
+
|
414
|
+
// Prevent IE from keeping other link focussed when using the back button
|
415
|
+
// and remove dotted border from clicked link. This is controlled via CSS
|
416
|
+
// in modern browsers; blur() removes focus from address bar in Firefox
|
417
|
+
// which can become a usability and annoying problem with tabs('rotate').
|
418
|
+
if ( $.browser.msie ) {
|
419
|
+
this.blur();
|
420
|
+
}
|
421
|
+
});
|
422
|
+
|
423
|
+
// disable click in any case
|
424
|
+
this.anchors.bind( "click.tabs", function(){
|
425
|
+
return false;
|
426
|
+
});
|
427
|
+
},
|
428
|
+
|
429
|
+
_getIndex: function( index ) {
|
430
|
+
// meta-function to give users option to provide a href string instead of a numerical index.
|
431
|
+
// also sanitizes numerical indexes to valid values.
|
432
|
+
if ( typeof index == "string" ) {
|
433
|
+
index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
|
434
|
+
}
|
435
|
+
|
436
|
+
return index;
|
437
|
+
},
|
438
|
+
|
439
|
+
destroy: function() {
|
440
|
+
var o = this.options;
|
441
|
+
|
442
|
+
this.abort();
|
443
|
+
|
444
|
+
this.element
|
445
|
+
.unbind( ".tabs" )
|
446
|
+
.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
|
447
|
+
.removeData( "tabs" );
|
448
|
+
|
449
|
+
this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
|
450
|
+
|
451
|
+
this.anchors.each(function() {
|
452
|
+
var href = $.data( this, "href.tabs" );
|
453
|
+
if ( href ) {
|
454
|
+
this.href = href;
|
455
|
+
}
|
456
|
+
var $this = $( this ).unbind( ".tabs" );
|
457
|
+
$.each( [ "href", "load", "cache" ], function( i, prefix ) {
|
458
|
+
$this.removeData( prefix + ".tabs" );
|
459
|
+
});
|
460
|
+
});
|
461
|
+
|
462
|
+
this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
|
463
|
+
if ( $.data( this, "destroy.tabs" ) ) {
|
464
|
+
$( this ).remove();
|
465
|
+
} else {
|
466
|
+
$( this ).removeClass([
|
467
|
+
"ui-state-default",
|
468
|
+
"ui-corner-top",
|
469
|
+
"ui-tabs-selected",
|
470
|
+
"ui-state-active",
|
471
|
+
"ui-state-hover",
|
472
|
+
"ui-state-focus",
|
473
|
+
"ui-state-disabled",
|
474
|
+
"ui-tabs-panel",
|
475
|
+
"ui-widget-content",
|
476
|
+
"ui-corner-bottom",
|
477
|
+
"ui-tabs-hide"
|
478
|
+
].join( " " ) );
|
479
|
+
}
|
480
|
+
});
|
481
|
+
|
482
|
+
if ( o.cookie ) {
|
483
|
+
this._cookie( null, o.cookie );
|
484
|
+
}
|
485
|
+
|
486
|
+
return this;
|
487
|
+
},
|
488
|
+
|
489
|
+
add: function( url, label, index ) {
|
490
|
+
if ( index === undefined ) {
|
491
|
+
index = this.anchors.length;
|
492
|
+
}
|
493
|
+
|
494
|
+
var self = this,
|
495
|
+
o = this.options,
|
496
|
+
$li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
|
497
|
+
id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
|
498
|
+
|
499
|
+
$li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
|
500
|
+
|
501
|
+
// try to find an existing element before creating a new one
|
502
|
+
var $panel = self.element.find( "#" + id );
|
503
|
+
if ( !$panel.length ) {
|
504
|
+
$panel = $( o.panelTemplate )
|
505
|
+
.attr( "id", id )
|
506
|
+
.data( "destroy.tabs", true );
|
507
|
+
}
|
508
|
+
$panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
|
509
|
+
|
510
|
+
if ( index >= this.lis.length ) {
|
511
|
+
$li.appendTo( this.list );
|
512
|
+
$panel.appendTo( this.list[ 0 ].parentNode );
|
513
|
+
} else {
|
514
|
+
$li.insertBefore( this.lis[ index ] );
|
515
|
+
$panel.insertBefore( this.panels[ index ] );
|
516
|
+
}
|
517
|
+
|
518
|
+
o.disabled = $.map( o.disabled, function( n, i ) {
|
519
|
+
return n >= index ? ++n : n;
|
520
|
+
});
|
521
|
+
|
522
|
+
this._tabify();
|
523
|
+
|
524
|
+
if ( this.anchors.length == 1 ) {
|
525
|
+
o.selected = 0;
|
526
|
+
$li.addClass( "ui-tabs-selected ui-state-active" );
|
527
|
+
$panel.removeClass( "ui-tabs-hide" );
|
528
|
+
this.element.queue( "tabs", function() {
|
529
|
+
self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
|
530
|
+
});
|
531
|
+
|
532
|
+
this.load( 0 );
|
533
|
+
}
|
534
|
+
|
535
|
+
this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
536
|
+
return this;
|
537
|
+
},
|
538
|
+
|
539
|
+
remove: function( index ) {
|
540
|
+
index = this._getIndex( index );
|
541
|
+
var o = this.options,
|
542
|
+
$li = this.lis.eq( index ).remove(),
|
543
|
+
$panel = this.panels.eq( index ).remove();
|
544
|
+
|
545
|
+
// If selected tab was removed focus tab to the right or
|
546
|
+
// in case the last tab was removed the tab to the left.
|
547
|
+
if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
|
548
|
+
this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
|
549
|
+
}
|
550
|
+
|
551
|
+
o.disabled = $.map(
|
552
|
+
$.grep( o.disabled, function(n, i) {
|
553
|
+
return n != index;
|
554
|
+
}),
|
555
|
+
function( n, i ) {
|
556
|
+
return n >= index ? --n : n;
|
557
|
+
});
|
558
|
+
|
559
|
+
this._tabify();
|
560
|
+
|
561
|
+
this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
|
562
|
+
return this;
|
563
|
+
},
|
564
|
+
|
565
|
+
enable: function( index ) {
|
566
|
+
index = this._getIndex( index );
|
567
|
+
var o = this.options;
|
568
|
+
if ( $.inArray( index, o.disabled ) == -1 ) {
|
569
|
+
return;
|
570
|
+
}
|
571
|
+
|
572
|
+
this.lis.eq( index ).removeClass( "ui-state-disabled" );
|
573
|
+
o.disabled = $.grep( o.disabled, function( n, i ) {
|
574
|
+
return n != index;
|
575
|
+
});
|
576
|
+
|
577
|
+
this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
578
|
+
return this;
|
579
|
+
},
|
580
|
+
|
581
|
+
disable: function( index ) {
|
582
|
+
index = this._getIndex( index );
|
583
|
+
var self = this, o = this.options;
|
584
|
+
// cannot disable already selected tab
|
585
|
+
if ( index != o.selected ) {
|
586
|
+
this.lis.eq( index ).addClass( "ui-state-disabled" );
|
587
|
+
|
588
|
+
o.disabled.push( index );
|
589
|
+
o.disabled.sort();
|
590
|
+
|
591
|
+
this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
592
|
+
}
|
593
|
+
|
594
|
+
return this;
|
595
|
+
},
|
596
|
+
|
597
|
+
select: function( index ) {
|
598
|
+
index = this._getIndex( index );
|
599
|
+
if ( index == -1 ) {
|
600
|
+
if ( this.options.collapsible && this.options.selected != -1 ) {
|
601
|
+
index = this.options.selected;
|
602
|
+
} else {
|
603
|
+
return this;
|
604
|
+
}
|
605
|
+
}
|
606
|
+
this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
|
607
|
+
return this;
|
608
|
+
},
|
609
|
+
|
610
|
+
load: function( index ) {
|
611
|
+
index = this._getIndex( index );
|
612
|
+
var self = this,
|
613
|
+
o = this.options,
|
614
|
+
a = this.anchors.eq( index )[ 0 ],
|
615
|
+
url = $.data( a, "load.tabs" );
|
616
|
+
|
617
|
+
this.abort();
|
618
|
+
|
619
|
+
// not remote or from cache
|
620
|
+
if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
|
621
|
+
this.element.dequeue( "tabs" );
|
622
|
+
return;
|
623
|
+
}
|
624
|
+
|
625
|
+
// load remote from here on
|
626
|
+
this.lis.eq( index ).addClass( "ui-state-processing" );
|
627
|
+
|
628
|
+
if ( o.spinner ) {
|
629
|
+
var span = $( "span", a );
|
630
|
+
span.data( "label.tabs", span.html() ).html( o.spinner );
|
631
|
+
}
|
632
|
+
|
633
|
+
this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
|
634
|
+
url: url,
|
635
|
+
success: function( r, s ) {
|
636
|
+
self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
|
637
|
+
|
638
|
+
// take care of tab labels
|
639
|
+
self._cleanup();
|
640
|
+
|
641
|
+
if ( o.cache ) {
|
642
|
+
$.data( a, "cache.tabs", true );
|
643
|
+
}
|
644
|
+
|
645
|
+
self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
|
646
|
+
try {
|
647
|
+
o.ajaxOptions.success( r, s );
|
648
|
+
}
|
649
|
+
catch ( e ) {}
|
650
|
+
},
|
651
|
+
error: function( xhr, s, e ) {
|
652
|
+
// take care of tab labels
|
653
|
+
self._cleanup();
|
654
|
+
|
655
|
+
self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
|
656
|
+
try {
|
657
|
+
// Passing index avoid a race condition when this method is
|
658
|
+
// called after the user has selected another tab.
|
659
|
+
// Pass the anchor that initiated this request allows
|
660
|
+
// loadError to manipulate the tab content panel via $(a.hash)
|
661
|
+
o.ajaxOptions.error( xhr, s, index, a );
|
662
|
+
}
|
663
|
+
catch ( e ) {}
|
664
|
+
}
|
665
|
+
} ) );
|
666
|
+
|
667
|
+
// last, so that load event is fired before show...
|
668
|
+
self.element.dequeue( "tabs" );
|
669
|
+
|
670
|
+
return this;
|
671
|
+
},
|
672
|
+
|
673
|
+
abort: function() {
|
674
|
+
// stop possibly running animations
|
675
|
+
this.element.queue( [] );
|
676
|
+
this.panels.stop( false, true );
|
677
|
+
|
678
|
+
// "tabs" queue must not contain more than two elements,
|
679
|
+
// which are the callbacks for the latest clicked tab...
|
680
|
+
this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
|
681
|
+
|
682
|
+
// terminate pending requests from other tabs
|
683
|
+
if ( this.xhr ) {
|
684
|
+
this.xhr.abort();
|
685
|
+
delete this.xhr;
|
686
|
+
}
|
687
|
+
|
688
|
+
// take care of tab labels
|
689
|
+
this._cleanup();
|
690
|
+
return this;
|
691
|
+
},
|
692
|
+
|
693
|
+
url: function( index, url ) {
|
694
|
+
this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
|
695
|
+
return this;
|
696
|
+
},
|
697
|
+
|
698
|
+
length: function() {
|
699
|
+
return this.anchors.length;
|
700
|
+
}
|
701
|
+
});
|
702
|
+
|
703
|
+
$.extend( $.ui.tabs, {
|
704
|
+
version: "1.8.20"
|
705
|
+
});
|
706
|
+
|
707
|
+
/*
|
708
|
+
* Tabs Extensions
|
709
|
+
*/
|
710
|
+
|
711
|
+
/*
|
712
|
+
* Rotate
|
713
|
+
*/
|
714
|
+
$.extend( $.ui.tabs.prototype, {
|
715
|
+
rotation: null,
|
716
|
+
rotate: function( ms, continuing ) {
|
717
|
+
var self = this,
|
718
|
+
o = this.options;
|
719
|
+
|
720
|
+
var rotate = self._rotate || ( self._rotate = function( e ) {
|
721
|
+
clearTimeout( self.rotation );
|
722
|
+
self.rotation = setTimeout(function() {
|
723
|
+
var t = o.selected;
|
724
|
+
self.select( ++t < self.anchors.length ? t : 0 );
|
725
|
+
}, ms );
|
726
|
+
|
727
|
+
if ( e ) {
|
728
|
+
e.stopPropagation();
|
729
|
+
}
|
730
|
+
});
|
731
|
+
|
732
|
+
var stop = self._unrotate || ( self._unrotate = !continuing
|
733
|
+
? function(e) {
|
734
|
+
if (e.clientX) { // in case of a true click
|
735
|
+
self.rotate(null);
|
736
|
+
}
|
737
|
+
}
|
738
|
+
: function( e ) {
|
739
|
+
rotate();
|
740
|
+
});
|
741
|
+
|
742
|
+
// start rotation
|
743
|
+
if ( ms ) {
|
744
|
+
this.element.bind( "tabsshow", rotate );
|
745
|
+
this.anchors.bind( o.event + ".tabs", stop );
|
746
|
+
rotate();
|
747
|
+
// stop rotation
|
748
|
+
} else {
|
749
|
+
clearTimeout( self.rotation );
|
750
|
+
this.element.unbind( "tabsshow", rotate );
|
751
|
+
this.anchors.unbind( o.event + ".tabs", stop );
|
752
|
+
delete this._rotate;
|
753
|
+
delete this._unrotate;
|
754
|
+
}
|
755
|
+
|
756
|
+
return this;
|
757
|
+
}
|
758
|
+
});
|
759
|
+
|
760
|
+
})( jQuery );
|