jqtools-rails 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +34 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/jqtools-rails.gemspec +81 -0
- data/lib/jqtools-rails.rb +5 -0
- data/spec/jqtools-rails_spec.rb +7 -0
- data/spec/spec_helper.rb +12 -0
- data/vendor/assets/javascripts/dateinput/dateinput.js +791 -0
- data/vendor/assets/javascripts/jquery.tools.min.js +39 -0
- data/vendor/assets/javascripts/overlay/overlay.apple.js +155 -0
- data/vendor/assets/javascripts/overlay/overlay.js +293 -0
- data/vendor/assets/javascripts/rangeinput/rangeinput.js +471 -0
- data/vendor/assets/javascripts/scrollable/scrollable.autoscroll.js +96 -0
- data/vendor/assets/javascripts/scrollable/scrollable.js +368 -0
- data/vendor/assets/javascripts/scrollable/scrollable.navigator.js +134 -0
- data/vendor/assets/javascripts/tabs/tabs.js +319 -0
- data/vendor/assets/javascripts/tabs/tabs.slideshow.js +191 -0
- data/vendor/assets/javascripts/toolbox/toolbox.expose.js +224 -0
- data/vendor/assets/javascripts/toolbox/toolbox.flashembed.js +301 -0
- data/vendor/assets/javascripts/toolbox/toolbox.history.js +108 -0
- data/vendor/assets/javascripts/toolbox/toolbox.mousewheel.js +65 -0
- data/vendor/assets/javascripts/tooltip/tooltip.dynamic.js +154 -0
- data/vendor/assets/javascripts/tooltip/tooltip.js +358 -0
- data/vendor/assets/javascripts/tooltip/tooltip.slide.js +78 -0
- data/vendor/assets/javascripts/validator/validator.js +598 -0
- metadata +135 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* jQuery Tools @VERSION / Scrollable Navigator
|
4
|
+
*
|
5
|
+
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
|
6
|
+
*
|
7
|
+
* http://flowplayer.org/tools/scrollable/navigator.html
|
8
|
+
*
|
9
|
+
* Since: September 2009
|
10
|
+
* Date: @DATE
|
11
|
+
*/
|
12
|
+
(function($) {
|
13
|
+
|
14
|
+
var t = $.tools.scrollable;
|
15
|
+
|
16
|
+
t.navigator = {
|
17
|
+
|
18
|
+
conf: {
|
19
|
+
navi: '.navi',
|
20
|
+
naviItem: null,
|
21
|
+
activeClass: 'active',
|
22
|
+
indexed: false,
|
23
|
+
idPrefix: null,
|
24
|
+
|
25
|
+
// 1.2
|
26
|
+
history: false
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
function find(root, query) {
|
31
|
+
var el = $(query);
|
32
|
+
return el.length < 2 ? el : root.parent().find(query);
|
33
|
+
}
|
34
|
+
|
35
|
+
// jQuery plugin implementation
|
36
|
+
$.fn.navigator = function(conf) {
|
37
|
+
|
38
|
+
// configuration
|
39
|
+
if (typeof conf == 'string') { conf = {navi: conf}; }
|
40
|
+
conf = $.extend({}, t.navigator.conf, conf);
|
41
|
+
|
42
|
+
var ret;
|
43
|
+
|
44
|
+
this.each(function() {
|
45
|
+
|
46
|
+
var api = $(this).data("scrollable"),
|
47
|
+
navi = conf.navi.jquery ? conf.navi : find(api.getRoot(), conf.navi),
|
48
|
+
buttons = api.getNaviButtons(),
|
49
|
+
cls = conf.activeClass,
|
50
|
+
hashed = conf.history && !!history.pushState,
|
51
|
+
size = api.getConf().size;
|
52
|
+
|
53
|
+
|
54
|
+
// @deprecated stuff
|
55
|
+
if (api) { ret = api; }
|
56
|
+
|
57
|
+
api.getNaviButtons = function() {
|
58
|
+
return buttons.add(navi);
|
59
|
+
};
|
60
|
+
|
61
|
+
|
62
|
+
if (hashed) {
|
63
|
+
history.pushState({i: 0});
|
64
|
+
|
65
|
+
$(window).bind("popstate", function(evt) {
|
66
|
+
var s = evt.originalEvent.state;
|
67
|
+
if (s) { api.seekTo(s.i); }
|
68
|
+
});
|
69
|
+
}
|
70
|
+
|
71
|
+
function doClick(el, i, e) {
|
72
|
+
api.seekTo(i);
|
73
|
+
e.preventDefault();
|
74
|
+
if (hashed) { history.pushState({i: i}); }
|
75
|
+
}
|
76
|
+
|
77
|
+
function els() {
|
78
|
+
return navi.find(conf.naviItem || '> *');
|
79
|
+
}
|
80
|
+
|
81
|
+
function addItem(i) {
|
82
|
+
|
83
|
+
var item = $("<" + (conf.naviItem || 'a') + "/>").click(function(e) {
|
84
|
+
doClick($(this), i, e);
|
85
|
+
});
|
86
|
+
|
87
|
+
// index number / id attribute
|
88
|
+
if (i === 0) { item.addClass(cls); }
|
89
|
+
if (conf.indexed) { item.text(i + 1); }
|
90
|
+
if (conf.idPrefix) { item.attr("id", conf.idPrefix + i); }
|
91
|
+
|
92
|
+
return item.appendTo(navi);
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
// generate navigator
|
97
|
+
if (els().length) {
|
98
|
+
els().each(function(i) {
|
99
|
+
$(this).click(function(e) {
|
100
|
+
doClick($(this), i, e);
|
101
|
+
});
|
102
|
+
});
|
103
|
+
|
104
|
+
} else {
|
105
|
+
$.each(api.getItems(), function(i) {
|
106
|
+
if (i % size == 0) addItem(i);
|
107
|
+
});
|
108
|
+
}
|
109
|
+
|
110
|
+
// activate correct entry
|
111
|
+
api.onBeforeSeek(function(e, index) {
|
112
|
+
setTimeout(function() {
|
113
|
+
if (!e.isDefaultPrevented()) {
|
114
|
+
var i = index / size,
|
115
|
+
el = els().eq(i);
|
116
|
+
|
117
|
+
if (el.length) { els().removeClass(cls).eq(i).addClass(cls); }
|
118
|
+
}
|
119
|
+
}, 1);
|
120
|
+
});
|
121
|
+
|
122
|
+
// new item being added
|
123
|
+
api.onAddItem(function(e, item) {
|
124
|
+
var i = api.getItems().index(item);
|
125
|
+
if (i % size == 0) addItem(i);
|
126
|
+
});
|
127
|
+
|
128
|
+
});
|
129
|
+
|
130
|
+
return conf.api ? ret : this;
|
131
|
+
|
132
|
+
};
|
133
|
+
|
134
|
+
})(jQuery);
|
@@ -0,0 +1,319 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* jQuery Tools @VERSION Tabs- The basics of UI design.
|
4
|
+
*
|
5
|
+
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
|
6
|
+
*
|
7
|
+
* http://flowplayer.org/tools/tabs/
|
8
|
+
*
|
9
|
+
* Since: November 2008
|
10
|
+
* Date: @DATE
|
11
|
+
*/
|
12
|
+
(function($) {
|
13
|
+
|
14
|
+
// static constructs
|
15
|
+
$.tools = $.tools || {version: '@VERSION'};
|
16
|
+
|
17
|
+
$.tools.tabs = {
|
18
|
+
|
19
|
+
conf: {
|
20
|
+
tabs: 'a',
|
21
|
+
current: 'current',
|
22
|
+
onBeforeClick: null,
|
23
|
+
onClick: null,
|
24
|
+
effect: 'default',
|
25
|
+
initialIndex: 0,
|
26
|
+
event: 'click',
|
27
|
+
rotate: false,
|
28
|
+
|
29
|
+
// slide effect
|
30
|
+
slideUpSpeed: 400,
|
31
|
+
slideDownSpeed: 400,
|
32
|
+
|
33
|
+
// 1.2
|
34
|
+
history: false
|
35
|
+
},
|
36
|
+
|
37
|
+
addEffect: function(name, fn) {
|
38
|
+
effects[name] = fn;
|
39
|
+
}
|
40
|
+
|
41
|
+
};
|
42
|
+
|
43
|
+
var effects = {
|
44
|
+
|
45
|
+
// simple "toggle" effect
|
46
|
+
'default': function(i, done) {
|
47
|
+
this.getPanes().hide().eq(i).show();
|
48
|
+
done.call();
|
49
|
+
},
|
50
|
+
|
51
|
+
/*
|
52
|
+
configuration:
|
53
|
+
- fadeOutSpeed (positive value does "crossfading")
|
54
|
+
- fadeInSpeed
|
55
|
+
*/
|
56
|
+
fade: function(i, done) {
|
57
|
+
|
58
|
+
var conf = this.getConf(),
|
59
|
+
speed = conf.fadeOutSpeed,
|
60
|
+
panes = this.getPanes();
|
61
|
+
|
62
|
+
if (speed) {
|
63
|
+
panes.fadeOut(speed);
|
64
|
+
} else {
|
65
|
+
panes.hide();
|
66
|
+
}
|
67
|
+
|
68
|
+
panes.eq(i).fadeIn(conf.fadeInSpeed, done);
|
69
|
+
},
|
70
|
+
|
71
|
+
// for basic accordions
|
72
|
+
slide: function(i, done) {
|
73
|
+
var conf = this.getConf();
|
74
|
+
|
75
|
+
this.getPanes().slideUp(conf.slideUpSpeed);
|
76
|
+
this.getPanes().eq(i).slideDown(conf.slideDownSpeed, done);
|
77
|
+
},
|
78
|
+
|
79
|
+
/**
|
80
|
+
* AJAX effect
|
81
|
+
*/
|
82
|
+
ajax: function(i, done) {
|
83
|
+
this.getPanes().eq(0).load(this.getTabs().eq(i).attr("href"), done);
|
84
|
+
}
|
85
|
+
};
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Horizontal accordion
|
89
|
+
*
|
90
|
+
* @deprecated will be replaced with a more robust implementation
|
91
|
+
*/
|
92
|
+
|
93
|
+
var
|
94
|
+
/**
|
95
|
+
* @type {Boolean}
|
96
|
+
*
|
97
|
+
* Mutex to control horizontal animation
|
98
|
+
* Disables clicking of tabs while animating
|
99
|
+
* They mess up otherwise as currentPane gets set *after* animation is done
|
100
|
+
*/
|
101
|
+
animating,
|
102
|
+
/**
|
103
|
+
* @type {Number}
|
104
|
+
*
|
105
|
+
* Initial width of tab panes
|
106
|
+
*/
|
107
|
+
w;
|
108
|
+
|
109
|
+
$.tools.tabs.addEffect("horizontal", function(i, done) {
|
110
|
+
if (animating) return; // don't allow other animations
|
111
|
+
|
112
|
+
var nextPane = this.getPanes().eq(i),
|
113
|
+
currentPane = this.getCurrentPane();
|
114
|
+
|
115
|
+
// store original width of a pane into memory
|
116
|
+
w || ( w = this.getPanes().eq(0).width() );
|
117
|
+
animating = true;
|
118
|
+
|
119
|
+
nextPane.show(); // hidden by default
|
120
|
+
|
121
|
+
// animate current pane's width to zero
|
122
|
+
// animate next pane's width at the same time for smooth animation
|
123
|
+
currentPane.animate({width: 0}, {
|
124
|
+
step: function(now){
|
125
|
+
nextPane.css("width", w-now);
|
126
|
+
},
|
127
|
+
complete: function(){
|
128
|
+
$(this).hide();
|
129
|
+
done.call();
|
130
|
+
animating = false;
|
131
|
+
}
|
132
|
+
});
|
133
|
+
// Dirty hack... onLoad, currentPant will be empty and nextPane will be the first pane
|
134
|
+
// If this is the case, manually run callback since the animation never occured, and reset animating
|
135
|
+
if (!currentPane.length){
|
136
|
+
done.call();
|
137
|
+
animating = false;
|
138
|
+
}
|
139
|
+
});
|
140
|
+
|
141
|
+
|
142
|
+
function Tabs(root, paneSelector, conf) {
|
143
|
+
|
144
|
+
var self = this,
|
145
|
+
trigger = root.add(this),
|
146
|
+
tabs = root.find(conf.tabs),
|
147
|
+
panes = paneSelector.jquery ? paneSelector : root.children(paneSelector),
|
148
|
+
current;
|
149
|
+
|
150
|
+
|
151
|
+
// make sure tabs and panes are found
|
152
|
+
if (!tabs.length) { tabs = root.children(); }
|
153
|
+
if (!panes.length) { panes = root.parent().find(paneSelector); }
|
154
|
+
if (!panes.length) { panes = $(paneSelector); }
|
155
|
+
|
156
|
+
|
157
|
+
// public methods
|
158
|
+
$.extend(this, {
|
159
|
+
click: function(i, e) {
|
160
|
+
|
161
|
+
var tab = tabs.eq(i);
|
162
|
+
|
163
|
+
if (typeof i == 'string' && i.replace("#", "")) {
|
164
|
+
tab = tabs.filter("[href*=" + i.replace("#", "") + "]");
|
165
|
+
i = Math.max(tabs.index(tab), 0);
|
166
|
+
}
|
167
|
+
|
168
|
+
if (conf.rotate) {
|
169
|
+
var last = tabs.length -1;
|
170
|
+
if (i < 0) { return self.click(last, e); }
|
171
|
+
if (i > last) { return self.click(0, e); }
|
172
|
+
}
|
173
|
+
|
174
|
+
if (!tab.length) {
|
175
|
+
if (current >= 0) { return self; }
|
176
|
+
i = conf.initialIndex;
|
177
|
+
tab = tabs.eq(i);
|
178
|
+
}
|
179
|
+
|
180
|
+
// current tab is being clicked
|
181
|
+
if (i === current) { return self; }
|
182
|
+
|
183
|
+
// possibility to cancel click action
|
184
|
+
e = e || $.Event();
|
185
|
+
e.type = "onBeforeClick";
|
186
|
+
trigger.trigger(e, [i]);
|
187
|
+
if (e.isDefaultPrevented()) { return; }
|
188
|
+
|
189
|
+
// call the effect
|
190
|
+
effects[conf.effect].call(self, i, function() {
|
191
|
+
current = i;
|
192
|
+
// onClick callback
|
193
|
+
e.type = "onClick";
|
194
|
+
trigger.trigger(e, [i]);
|
195
|
+
});
|
196
|
+
|
197
|
+
// default behaviour
|
198
|
+
tabs.removeClass(conf.current);
|
199
|
+
tab.addClass(conf.current);
|
200
|
+
|
201
|
+
return self;
|
202
|
+
},
|
203
|
+
|
204
|
+
getConf: function() {
|
205
|
+
return conf;
|
206
|
+
},
|
207
|
+
|
208
|
+
getTabs: function() {
|
209
|
+
return tabs;
|
210
|
+
},
|
211
|
+
|
212
|
+
getPanes: function() {
|
213
|
+
return panes;
|
214
|
+
},
|
215
|
+
|
216
|
+
getCurrentPane: function() {
|
217
|
+
return panes.eq(current);
|
218
|
+
},
|
219
|
+
|
220
|
+
getCurrentTab: function() {
|
221
|
+
return tabs.eq(current);
|
222
|
+
},
|
223
|
+
|
224
|
+
getIndex: function() {
|
225
|
+
return current;
|
226
|
+
},
|
227
|
+
|
228
|
+
next: function() {
|
229
|
+
return self.click(current + 1);
|
230
|
+
},
|
231
|
+
|
232
|
+
prev: function() {
|
233
|
+
return self.click(current - 1);
|
234
|
+
},
|
235
|
+
|
236
|
+
destroy: function() {
|
237
|
+
tabs.unbind(conf.event).removeClass(conf.current);
|
238
|
+
panes.find("a[href^=#]").unbind("click.T");
|
239
|
+
return self;
|
240
|
+
}
|
241
|
+
|
242
|
+
});
|
243
|
+
|
244
|
+
// callbacks
|
245
|
+
$.each("onBeforeClick,onClick".split(","), function(i, name) {
|
246
|
+
|
247
|
+
// configuration
|
248
|
+
if ($.isFunction(conf[name])) {
|
249
|
+
$(self).bind(name, conf[name]);
|
250
|
+
}
|
251
|
+
|
252
|
+
// API
|
253
|
+
self[name] = function(fn) {
|
254
|
+
if (fn) { $(self).bind(name, fn); }
|
255
|
+
return self;
|
256
|
+
};
|
257
|
+
});
|
258
|
+
|
259
|
+
|
260
|
+
if (conf.history && $.fn.history) {
|
261
|
+
$.tools.history.init(tabs);
|
262
|
+
conf.event = 'history';
|
263
|
+
}
|
264
|
+
|
265
|
+
// setup click actions for each tab
|
266
|
+
tabs.each(function(i) {
|
267
|
+
$(this).bind(conf.event, function(e) {
|
268
|
+
self.click(i, e);
|
269
|
+
return e.preventDefault();
|
270
|
+
});
|
271
|
+
});
|
272
|
+
|
273
|
+
// cross tab anchor link
|
274
|
+
panes.find("a[href^=#]").bind("click.T", function(e) {
|
275
|
+
self.click($(this).attr("href"), e);
|
276
|
+
});
|
277
|
+
|
278
|
+
// open initial tab
|
279
|
+
if (location.hash && conf.tabs == "a" && root.find("[href=" +location.hash+ "]").length) {
|
280
|
+
self.click(location.hash);
|
281
|
+
|
282
|
+
} else {
|
283
|
+
if (conf.initialIndex === 0 || conf.initialIndex > 0) {
|
284
|
+
self.click(conf.initialIndex);
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
}
|
289
|
+
|
290
|
+
|
291
|
+
// jQuery plugin implementation
|
292
|
+
$.fn.tabs = function(paneSelector, conf) {
|
293
|
+
|
294
|
+
// return existing instance
|
295
|
+
var el = this.data("tabs");
|
296
|
+
if (el) {
|
297
|
+
el.destroy();
|
298
|
+
this.removeData("tabs");
|
299
|
+
}
|
300
|
+
|
301
|
+
if ($.isFunction(conf)) {
|
302
|
+
conf = {onBeforeClick: conf};
|
303
|
+
}
|
304
|
+
|
305
|
+
// setup conf
|
306
|
+
conf = $.extend({}, $.tools.tabs.conf, conf);
|
307
|
+
|
308
|
+
|
309
|
+
this.each(function() {
|
310
|
+
el = new Tabs($(this), paneSelector, conf);
|
311
|
+
$(this).data("tabs", el);
|
312
|
+
});
|
313
|
+
|
314
|
+
return conf.api ? el: this;
|
315
|
+
};
|
316
|
+
|
317
|
+
}) (jQuery);
|
318
|
+
|
319
|
+
|