furatto 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/furatto/version.rb +1 -1
- data/vendor/assets/javascripts/furatto.js +1817 -4
- data/vendor/assets/stylesheets/furatto/_base.scss +1 -1
- data/vendor/assets/stylesheets/furatto/_buttons.scss +3 -3
- data/vendor/assets/stylesheets/furatto/_forms.scss +3 -0
- data/vendor/assets/stylesheets/furatto/_grid.scss +13 -9
- data/vendor/assets/stylesheets/furatto/_mixins.scss +19 -0
- data/vendor/assets/stylesheets/furatto/_modal.scss +2 -1
- data/vendor/assets/stylesheets/furatto/_navigation_bar.scss +10 -0
- data/vendor/assets/stylesheets/furatto/_toolbars.scss +199 -199
- metadata +2 -3
- data/vendor/assets/stylesheets/furatto/_settings.scss +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c156c6f415f48693a32ad918b088917571decb72
|
4
|
+
data.tar.gz: 6b772aa9e1c89b579dc2f8814b6cafe003b0e860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb01d7602eb0f9ce4c95290d9292cdfb98c9b454c5044b364d1aea59869f712f8d4ecea78f9c27456226814dc86e21d1f8ba8bb5e72722b13cc57c0db723c135
|
7
|
+
data.tar.gz: 8eb531e8d5647506bd9cb3c4544d83e01410e09348867d42d9311faa34bfb27f15ed94d4978b4e17d694a5a17125ad74c198e1155b5945b9e545e7f8d0e72717
|
data/lib/furatto/version.rb
CHANGED
@@ -1,9 +1,1822 @@
|
|
1
|
+
/*!
|
2
|
+
* Furatto v3.0.0 (http://icalialabs.github.io/furatto/)
|
3
|
+
* Copyright 2014-2014 Icalia Labs
|
4
|
+
* Licensed under MIT (https://github.com/IcaliaLabs/furatto/blob/master/LICENSE)
|
5
|
+
*/
|
6
|
+
window.Furatto = {
|
7
|
+
name: 'Furatto',
|
8
|
+
version: '1.0.0'
|
9
|
+
};
|
10
|
+
|
11
|
+
$('.alert .close').each(function() {
|
12
|
+
return $(this).click(function(e) {
|
13
|
+
e.preventDefault();
|
14
|
+
return $(this).parent().fadeOut();
|
15
|
+
});
|
16
|
+
});
|
17
|
+
|
18
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
19
|
+
|
20
|
+
(function($, window) {
|
21
|
+
Furatto.Modal = (function() {
|
22
|
+
function Modal(el, options) {
|
23
|
+
this.hideOnDocumentClick = __bind(this.hideOnDocumentClick, this);
|
24
|
+
this.hideOnEsc = __bind(this.hideOnEsc, this);
|
25
|
+
this.show = __bind(this.show, this);
|
26
|
+
this.init = __bind(this.init, this);
|
27
|
+
this.options = $.extend({}, options);
|
28
|
+
this.$el = $(el);
|
29
|
+
this.modal = $(this.$el.data('target'));
|
30
|
+
this.close = this.modal.find('.modal-close');
|
31
|
+
this.transition = this.$el.data('transition') || "1";
|
32
|
+
this.theme = this.$el.data('theme') || "default";
|
33
|
+
this.modal.addClass("modal-effect-" + this.transition);
|
34
|
+
this.modal.addClass("" + this.theme);
|
35
|
+
}
|
36
|
+
|
37
|
+
Modal.prototype.init = function() {
|
38
|
+
var _this = this;
|
39
|
+
this.$el.click(this.show);
|
40
|
+
return this.close.click(function(ev) {
|
41
|
+
ev.stopPropagation();
|
42
|
+
return _this.hide();
|
43
|
+
});
|
44
|
+
};
|
45
|
+
|
46
|
+
Modal.prototype.show = function(ev) {
|
47
|
+
if (this.$el.is('div')) {
|
48
|
+
this.$el.addClass('modal-show');
|
49
|
+
} else {
|
50
|
+
this.modal.addClass('modal-show');
|
51
|
+
}
|
52
|
+
$('.modal-overlay').addClass('modal-show-overlay');
|
53
|
+
$('body').bind('keyup', this.hideOnEsc);
|
54
|
+
return $('body').bind('click', this.hideOnDocumentClick);
|
55
|
+
};
|
56
|
+
|
57
|
+
Modal.prototype.hideOnEsc = function(event) {
|
58
|
+
if (event.keyCode === 27) {
|
59
|
+
return this.hide();
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
Modal.prototype.hideOnDocumentClick = function(event) {
|
64
|
+
if ($(event.target).is('.modal-overlay')) {
|
65
|
+
return this.hide();
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
69
|
+
Modal.prototype.hide = function() {
|
70
|
+
$('.modal-overlay').removeClass('modal-show-overlay');
|
71
|
+
if (this.$el.is('div')) {
|
72
|
+
this.$el.removeClass('modal-show');
|
73
|
+
} else {
|
74
|
+
this.modal.removeClass('modal-show');
|
75
|
+
}
|
76
|
+
$('body').unbind('keyup', this.hideOnEsc);
|
77
|
+
return $('body').unbind('click', this.hideOnDocumentClick);
|
78
|
+
};
|
79
|
+
|
80
|
+
return Modal;
|
81
|
+
|
82
|
+
})();
|
83
|
+
$.fn.modal = function(option) {
|
84
|
+
return this.each(function() {
|
85
|
+
var $this, data, options;
|
86
|
+
$this = $(this);
|
87
|
+
data = $this.data('modal');
|
88
|
+
options = $.extend({}, $this.data(), typeof option === 'object' && option);
|
89
|
+
if (!data) {
|
90
|
+
$this.data('modal', (data = new Furatto.Modal(this, options)));
|
91
|
+
}
|
92
|
+
if (typeof option === 'string') {
|
93
|
+
return data[option]();
|
94
|
+
}
|
95
|
+
});
|
96
|
+
};
|
97
|
+
Furatto.Modal.version = "1.0.0";
|
98
|
+
$(document).ready(function() {
|
99
|
+
var elementToAppend;
|
100
|
+
if ($('.off-screen').length > 0) {
|
101
|
+
elementToAppend = $('.off-screen');
|
102
|
+
} else {
|
103
|
+
elementToAppend = $('body');
|
104
|
+
}
|
105
|
+
elementToAppend.append('<div class="modal-overlay"></div>');
|
106
|
+
return $('[data-furatto="modal"]').each(function() {
|
107
|
+
var modal;
|
108
|
+
modal = $(this);
|
109
|
+
return modal.modal('init');
|
110
|
+
});
|
111
|
+
});
|
112
|
+
return $(document).on('click', '[data-furatto="modal"]', function(e) {
|
113
|
+
var $this;
|
114
|
+
$this = $(this);
|
115
|
+
return $this.modal('init');
|
116
|
+
});
|
117
|
+
})(window.jQuery, window);
|
118
|
+
|
119
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
120
|
+
__slice = [].slice;
|
121
|
+
|
122
|
+
(function($, window, document) {
|
123
|
+
"use strict";
|
124
|
+
var pluginName;
|
125
|
+
pluginName = 'responsiveNavBar';
|
126
|
+
Furatto.ResponsiveNavBar = (function() {
|
127
|
+
function ResponsiveNavBar(el, a, options) {
|
128
|
+
this.el = el;
|
129
|
+
this.closeNavbar = __bind(this.closeNavbar, this);
|
130
|
+
this.openNavbar = __bind(this.openNavbar, this);
|
131
|
+
this.toggleNavbar = __bind(this.toggleNavbar, this);
|
132
|
+
this._initEvents = __bind(this._initEvents, this);
|
133
|
+
this.navbarElements = $('.navigation-bar ul:not(.brand-section)');
|
134
|
+
this.$el = $(this.el);
|
135
|
+
this._initEvents();
|
136
|
+
}
|
137
|
+
|
138
|
+
ResponsiveNavBar.prototype._initEvents = function() {
|
139
|
+
var _this = this;
|
140
|
+
return $('.navigation-bar .menu-toggle').on('touchstart click', function(e) {
|
141
|
+
e.preventDefault();
|
142
|
+
return _this.toggleNavbar();
|
143
|
+
});
|
144
|
+
};
|
145
|
+
|
146
|
+
ResponsiveNavBar.prototype.toggleNavbar = function() {
|
147
|
+
return this.$el.toggleClass('opened');
|
148
|
+
};
|
149
|
+
|
150
|
+
ResponsiveNavBar.prototype.openNavbar = function() {
|
151
|
+
return this.$el.addClass('opened');
|
152
|
+
};
|
153
|
+
|
154
|
+
ResponsiveNavBar.prototype.closeNavbar = function() {
|
155
|
+
return this.$el.removeClass('opened');
|
156
|
+
};
|
157
|
+
|
158
|
+
return ResponsiveNavBar;
|
159
|
+
|
160
|
+
})();
|
161
|
+
$.fn[pluginName] = function(a, options) {
|
162
|
+
var args, _;
|
163
|
+
_ = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
164
|
+
return this.each(function() {
|
165
|
+
var plugin;
|
166
|
+
plugin = $.data(this, "plugin_" + pluginName);
|
167
|
+
if (!plugin) {
|
168
|
+
return $.data(this, "plugin_" + pluginName, new Furatto.ResponsiveNavBar(this, a, options));
|
169
|
+
} else if ((plugin[_] != null) && $.type(plugin[_]) === 'function') {
|
170
|
+
return plugin[_].apply(plugin, args);
|
171
|
+
}
|
172
|
+
});
|
173
|
+
};
|
174
|
+
$('.navigation-bar').responsiveNavBar();
|
175
|
+
return Furatto.ResponsiveNavBar.version = "1.0.0";
|
176
|
+
})(jQuery, window, document);
|
177
|
+
|
178
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
179
|
+
__slice = [].slice;
|
180
|
+
|
181
|
+
(function($, window, document) {
|
182
|
+
"use strict";
|
183
|
+
var closest, defaults, getLevelDepth, hasParent, isFromMobile, pluginName;
|
184
|
+
pluginName = 'offScreen';
|
185
|
+
defaults = {
|
186
|
+
type: 'overlap',
|
187
|
+
levelSpacing: 40,
|
188
|
+
backClass: 'navigation-back'
|
189
|
+
};
|
190
|
+
getLevelDepth = function(level, id, waypoint, cnt) {
|
191
|
+
if (cnt == null) {
|
192
|
+
cnt = 0;
|
193
|
+
}
|
194
|
+
if (level.id.indexOf(id) >= 0) {
|
195
|
+
return cnt;
|
196
|
+
}
|
197
|
+
if ($(level).hasClass(waypoint)) {
|
198
|
+
++cnt;
|
199
|
+
}
|
200
|
+
return level.parentNode && getLevelDepth(level.parentNode, id, waypoint, cnt);
|
201
|
+
};
|
202
|
+
hasParent = function(e, id) {
|
203
|
+
var el;
|
204
|
+
if (!e) {
|
205
|
+
return false;
|
206
|
+
}
|
207
|
+
el = e.target || e.srcElement || e || false;
|
208
|
+
while (el && el.id !== id) {
|
209
|
+
el = el.parentNode || false;
|
210
|
+
}
|
211
|
+
return el !== false;
|
212
|
+
};
|
213
|
+
closest = function(e, classname) {
|
214
|
+
if ($(e).hasClass(classname)) {
|
215
|
+
return e;
|
216
|
+
}
|
217
|
+
return e.parentNode && closest(e.parentNode, classname);
|
218
|
+
};
|
219
|
+
isFromMobile = function() {
|
220
|
+
var check;
|
221
|
+
check = false;
|
222
|
+
(function(a) {
|
223
|
+
if (/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) {
|
224
|
+
return check = true;
|
225
|
+
}
|
226
|
+
})(navigator.userAgent || navigator.vendor || window.opera);
|
227
|
+
return check;
|
228
|
+
};
|
229
|
+
Furatto.OffScreen = (function() {
|
230
|
+
function OffScreen(el, a, options) {
|
231
|
+
this.el = el;
|
232
|
+
this.openMenu = __bind(this.openMenu, this);
|
233
|
+
this._closeMenu = __bind(this._closeMenu, this);
|
234
|
+
this.resetMenu = __bind(this.resetMenu, this);
|
235
|
+
this._setupLevelBack = __bind(this._setupLevelBack, this);
|
236
|
+
this._setupLevelsClosing = __bind(this._setupLevelsClosing, this);
|
237
|
+
this._hideOnDocumentClick = __bind(this._hideOnDocumentClick, this);
|
238
|
+
this._hideOnEsc = __bind(this._hideOnEsc, this);
|
239
|
+
this._setupMenuItems = __bind(this._setupMenuItems, this);
|
240
|
+
this._bindEvents = __bind(this._bindEvents, this);
|
241
|
+
this._shouldPreventOffScreenMenuFromOpening = __bind(this._shouldPreventOffScreenMenuFromOpening, this);
|
242
|
+
this.options = $.extend({}, defaults, options);
|
243
|
+
this.open = false;
|
244
|
+
this.level = 0;
|
245
|
+
this.wrapper = document.getElementById('off-screen');
|
246
|
+
this.levels = Array.prototype.slice.call(this.el.querySelectorAll('div.off-screen-level'));
|
247
|
+
this._setLevels();
|
248
|
+
this.menuItems = Array.prototype.slice.call(this.el.querySelectorAll('li'));
|
249
|
+
this.levelBack = Array.prototype.slice.call(this.el.querySelectorAll('.navigation-back'));
|
250
|
+
this.eventType = isFromMobile() ? 'touchstart' : 'click';
|
251
|
+
$(this.el).addClass("off-screen-" + this.options.type);
|
252
|
+
this.trigger = document.getElementById('trigger');
|
253
|
+
if ($(window).width() <= 768) {
|
254
|
+
this._bindEvents();
|
255
|
+
}
|
256
|
+
this._shouldPreventOffScreenMenuFromOpening();
|
257
|
+
}
|
258
|
+
|
259
|
+
OffScreen.prototype._setLevels = function() {
|
260
|
+
var level, _i, _len, _ref, _results;
|
261
|
+
_ref = this.levels;
|
262
|
+
_results = [];
|
263
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
264
|
+
level = _ref[_i];
|
265
|
+
_results.push(level.setAttribute('data-level', getLevelDepth(level, this.el.id, 'off-screen-level')));
|
266
|
+
}
|
267
|
+
return _results;
|
268
|
+
};
|
269
|
+
|
270
|
+
OffScreen.prototype._shouldPreventOffScreenMenuFromOpening = function() {
|
271
|
+
var _this = this;
|
272
|
+
return $(window).resize(function() {
|
273
|
+
_this.resetMenu();
|
274
|
+
if ($(window).width() >= 768) {
|
275
|
+
return _this.trigger.removeEventListener(_this.eventType);
|
276
|
+
} else {
|
277
|
+
return _this.trigger.addEventListener(_this.eventType, function(event) {
|
278
|
+
event.stopPropagation();
|
279
|
+
event.preventDefault();
|
280
|
+
if (_this.open) {
|
281
|
+
return _this.resetMenu();
|
282
|
+
} else {
|
283
|
+
_this.openMenu();
|
284
|
+
return document.addEventListener(_this.eventType, function(event) {
|
285
|
+
if (_this.open && !hasParent(event.target, _this.el.id)) {
|
286
|
+
return bodyClickBinding(_this);
|
287
|
+
}
|
288
|
+
});
|
289
|
+
}
|
290
|
+
});
|
291
|
+
}
|
292
|
+
});
|
293
|
+
};
|
294
|
+
|
295
|
+
OffScreen.prototype._bindEvents = function() {
|
296
|
+
var bodyClickBinding,
|
297
|
+
_this = this;
|
298
|
+
bodyClickBinding = function(el) {
|
299
|
+
_this.resetMenu();
|
300
|
+
return el.removeEventListener(_this.eventType, bodyClickBinding);
|
301
|
+
};
|
302
|
+
this.trigger.addEventListener(this.eventType, function(event) {
|
303
|
+
event.stopPropagation();
|
304
|
+
event.preventDefault();
|
305
|
+
if (_this.open) {
|
306
|
+
return _this.resetMenu();
|
307
|
+
} else {
|
308
|
+
_this.openMenu();
|
309
|
+
return document.addEventListener(_this.eventType, function(event) {
|
310
|
+
if (_this.open && !hasParent(event.target, _this.el.id)) {
|
311
|
+
return bodyClickBinding(document);
|
312
|
+
}
|
313
|
+
});
|
314
|
+
}
|
315
|
+
});
|
316
|
+
this._setupMenuItems();
|
317
|
+
this._setupLevelsClosing();
|
318
|
+
return this._setupLevelBack();
|
319
|
+
};
|
320
|
+
|
321
|
+
OffScreen.prototype._setupMenuItems = function() {
|
322
|
+
var _this = this;
|
323
|
+
return this.menuItems.forEach(function(el, i) {
|
324
|
+
var subLevel;
|
325
|
+
subLevel = el.querySelector('div.off-screen-level');
|
326
|
+
if (subLevel) {
|
327
|
+
return el.querySelector('a').addEventListener('click', function(event) {
|
328
|
+
var level;
|
329
|
+
event.preventDefault();
|
330
|
+
level = closest(el, 'off-screen-level').getAttribute('data-level');
|
331
|
+
if (_this.level <= level) {
|
332
|
+
event.stopPropagation();
|
333
|
+
$(closest(el, 'off-screen-level')).addClass('off-screen-level-overlay');
|
334
|
+
return _this.openMenu(subLevel);
|
335
|
+
}
|
336
|
+
});
|
337
|
+
}
|
338
|
+
});
|
339
|
+
};
|
340
|
+
|
341
|
+
OffScreen.prototype._hideOnEsc = function(event) {
|
342
|
+
if (event.keyCode === 27) {
|
343
|
+
return this.resetMenu();
|
344
|
+
}
|
345
|
+
};
|
346
|
+
|
347
|
+
OffScreen.prototype._hideOnDocumentClick = function(event) {
|
348
|
+
return this.resetMenu();
|
349
|
+
};
|
350
|
+
|
351
|
+
OffScreen.prototype._setupLevelsClosing = function() {
|
352
|
+
var levelEl, _i, _len, _ref, _results;
|
353
|
+
_ref = this.levels;
|
354
|
+
_results = [];
|
355
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
356
|
+
levelEl = _ref[_i];
|
357
|
+
_results.push(levelEl.addEventListener(this.eventType, function(event) {
|
358
|
+
var level;
|
359
|
+
event.stopPropagation();
|
360
|
+
level = levelEl.getAttribute('data-level');
|
361
|
+
if (this.level > level) {
|
362
|
+
this.level = level;
|
363
|
+
return this._closeMenu();
|
364
|
+
}
|
365
|
+
}));
|
366
|
+
}
|
367
|
+
return _results;
|
368
|
+
};
|
369
|
+
|
370
|
+
OffScreen.prototype._setupLevelBack = function() {
|
371
|
+
var _this = this;
|
372
|
+
return this.levelBack.forEach(function(el, i) {
|
373
|
+
return el.addEventListener(_this.eventType, function(event) {
|
374
|
+
var level;
|
375
|
+
event.preventDefault();
|
376
|
+
level = closest(el, 'off-screen-level').getAttribute('data-level');
|
377
|
+
if (_this.level <= level) {
|
378
|
+
event.stopPropagation();
|
379
|
+
_this.level = closest(el, 'off-screen-level').getAttribute('data-level') - 1;
|
380
|
+
if (_this.level === 0) {
|
381
|
+
return _this.resetMenu();
|
382
|
+
} else {
|
383
|
+
return _this._closeMenu();
|
384
|
+
}
|
385
|
+
}
|
386
|
+
});
|
387
|
+
});
|
388
|
+
};
|
389
|
+
|
390
|
+
OffScreen.prototype.resetMenu = function() {
|
391
|
+
this._setTransform('translate3d(0,0,0)');
|
392
|
+
this.level = 0;
|
393
|
+
$(this.wrapper).removeClass('off-screen-pushed');
|
394
|
+
this._toggleLevels();
|
395
|
+
this.open = false;
|
396
|
+
return $(document).unbind('keyup', this._hideOnEsc);
|
397
|
+
};
|
398
|
+
|
399
|
+
OffScreen.prototype._closeMenu = function() {
|
400
|
+
var translateVal;
|
401
|
+
translateVal = this.options.type === 'overlap' ? this.el.offsetWidth + (this.level - 1) * this.options.levelSpacing : this.el.offsetWidth;
|
402
|
+
this._setTransform("translate3d(" + translateVal + "px, 0, 0");
|
403
|
+
return this._toggleLevels();
|
404
|
+
};
|
405
|
+
|
406
|
+
OffScreen.prototype.openMenu = function(subLevel) {
|
407
|
+
var level, levelFactor, translateVal, _i, _len, _ref;
|
408
|
+
++this.level;
|
409
|
+
levelFactor = (this.level - 1) * this.options.levelSpacing;
|
410
|
+
translateVal = this.options.type === 'overlap' ? this.el.offsetWidth + levelFactor : this.el.offsetWidth;
|
411
|
+
this._setTransform('translate3d(' + translateVal + 'px,0,0)');
|
412
|
+
if (subLevel) {
|
413
|
+
this._setTransform('', subLevel);
|
414
|
+
_ref = this.levels;
|
415
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
416
|
+
level = _ref[_i];
|
417
|
+
if (level !== subLevel && !$(level).hasClass('off-screen-level-open')) {
|
418
|
+
this._setTransform("translate3d(-100%, 0, 0) translate3d(" + (-1 * levelFactor) + "px, 0, 0)", $(level));
|
419
|
+
}
|
420
|
+
}
|
421
|
+
}
|
422
|
+
if (this.level === 1) {
|
423
|
+
$(this.wrapper).addClass('off-screen-pushed');
|
424
|
+
this.open = true;
|
425
|
+
}
|
426
|
+
if (subLevel) {
|
427
|
+
$(subLevel).addClass('off-screen-level-open');
|
428
|
+
} else {
|
429
|
+
$(this.levels[0]).addClass('off-screen-level-open');
|
430
|
+
}
|
431
|
+
$(document).bind('keyup', this._hideOnEsc);
|
432
|
+
return $(document).on('touchstart', this._hideOnDocumentClick);
|
433
|
+
};
|
434
|
+
|
435
|
+
OffScreen.prototype._toggleLevels = function() {
|
436
|
+
var level, _i, _len, _ref, _results;
|
437
|
+
_ref = this.levels;
|
438
|
+
_results = [];
|
439
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
440
|
+
level = _ref[_i];
|
441
|
+
if (level.getAttribute('data-level') >= this.level + 1) {
|
442
|
+
$(level).removeClass('off-screen-level-open');
|
443
|
+
_results.push($(level).removeClass('off-screen-level-overlay'));
|
444
|
+
} else if (Number(level.getAttribute('data-level') === this.level)) {
|
445
|
+
_results.push($(level).removeClass('off-screen-level-overlay'));
|
446
|
+
} else {
|
447
|
+
_results.push(void 0);
|
448
|
+
}
|
449
|
+
}
|
450
|
+
return _results;
|
451
|
+
};
|
452
|
+
|
453
|
+
OffScreen.prototype._setTransform = function(value, element) {
|
454
|
+
if (element == null) {
|
455
|
+
element = this.wrapper;
|
456
|
+
}
|
457
|
+
return $(element).css({
|
458
|
+
'-webkit-transform': value,
|
459
|
+
'-moz-transform': value,
|
460
|
+
'-o-transform': value,
|
461
|
+
'transform': value
|
462
|
+
});
|
463
|
+
};
|
464
|
+
|
465
|
+
return OffScreen;
|
466
|
+
|
467
|
+
})();
|
468
|
+
$.fn[pluginName] = function(a, options) {
|
469
|
+
var args, _;
|
470
|
+
_ = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
471
|
+
return this.each(function() {
|
472
|
+
var plugin;
|
473
|
+
plugin = $.data(this, "plugin_" + pluginName);
|
474
|
+
if (!plugin) {
|
475
|
+
return $.data(this, "plugin_" + pluginName, new Furatto.OffScreen(this, a, options));
|
476
|
+
} else if ((plugin[_] != null) && $.type(plugin[_]) === 'function') {
|
477
|
+
return plugin[_].apply(plugin, args);
|
478
|
+
}
|
479
|
+
});
|
480
|
+
};
|
481
|
+
$('.off-screen-navigation').offScreen();
|
482
|
+
$(document).click(function() {
|
483
|
+
return $('.off-screen-navigation').offScreen('resetMenu');
|
484
|
+
});
|
485
|
+
return Furatto.OffScreen.version = "1.0.0";
|
486
|
+
})(jQuery, window, document);
|
487
|
+
|
488
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
489
|
+
__slice = [].slice;
|
490
|
+
|
1
491
|
(function($, window, document) {
|
2
|
-
|
3
|
-
|
4
|
-
|
492
|
+
"use strict";
|
493
|
+
var defaults, pluginName;
|
494
|
+
pluginName = "responsiveTables";
|
495
|
+
defaults = {
|
496
|
+
widthToCollapse: 768
|
497
|
+
};
|
498
|
+
Furatto.ResponsiveTables = (function() {
|
499
|
+
function ResponsiveTables(el, a, options) {
|
500
|
+
this.el = el;
|
501
|
+
this._setCellHeights = __bind(this._setCellHeights, this);
|
502
|
+
this._unsplitTable = __bind(this._unsplitTable, this);
|
503
|
+
this._splitTable = __bind(this._splitTable, this);
|
504
|
+
this._updateTables = __bind(this._updateTables, this);
|
505
|
+
this._initResponsiveTables = __bind(this._initResponsiveTables, this);
|
506
|
+
this.options = $.extend({}, defaults, options);
|
507
|
+
this.$el = $(this.el);
|
508
|
+
this.switched = false;
|
509
|
+
this._initResponsiveTables();
|
510
|
+
}
|
5
511
|
|
6
|
-
|
512
|
+
ResponsiveTables.prototype._initResponsiveTables = function() {
|
513
|
+
var _this = this;
|
514
|
+
$(window).on('load', this._updateTables);
|
515
|
+
$(window).on('redraw', function() {
|
516
|
+
_this.switched = false;
|
517
|
+
return _this._updateTables();
|
518
|
+
});
|
519
|
+
return $(window).on('resize', this._updateTables);
|
520
|
+
};
|
521
|
+
|
522
|
+
ResponsiveTables.prototype._updateTables = function() {
|
523
|
+
var _this = this;
|
524
|
+
console.log(this.options.widthToCollapse);
|
525
|
+
if ($(window).width() <= this.options.widthToCollapse && !this.switched) {
|
526
|
+
this.switched = true;
|
527
|
+
this.$el.each(function(i, element) {
|
528
|
+
return _this._splitTable($(element));
|
529
|
+
});
|
530
|
+
return true;
|
531
|
+
} else if (this.switched && $(window).width() > this.options.widthToCollapse) {
|
532
|
+
this.switched = false;
|
533
|
+
return this.$el.each(function(i, element) {
|
534
|
+
return _this._unsplitTable($(element));
|
535
|
+
});
|
536
|
+
}
|
537
|
+
};
|
538
|
+
|
539
|
+
ResponsiveTables.prototype._splitTable = function(table) {
|
540
|
+
var tableClone;
|
541
|
+
table.wrap("<div class='table-wrapper' />");
|
542
|
+
tableClone = table.clone();
|
543
|
+
tableClone.find("td:not(:first-child), th:not(:first-child)").css("display", "none");
|
544
|
+
tableClone.removeClass("responsive");
|
545
|
+
table.closest(".table-wrapper").append(tableClone);
|
546
|
+
tableClone.wrap("<div class='pinned' />");
|
547
|
+
table.wrap("<div class='scrollable' />");
|
548
|
+
return this._setCellHeights(table, tableClone);
|
549
|
+
};
|
550
|
+
|
551
|
+
ResponsiveTables.prototype._unsplitTable = function(table) {
|
552
|
+
table.closest(".table-wrapper").find(".pinned").remove();
|
553
|
+
table.unwrap();
|
554
|
+
return table.unwrap();
|
555
|
+
};
|
556
|
+
|
557
|
+
ResponsiveTables.prototype._setCellHeights = function(table, tableClone) {
|
558
|
+
var heights, tableRows, tableRowsCopy;
|
559
|
+
tableRows = table.find('tr');
|
560
|
+
tableRowsCopy = tableClone.find('tr');
|
561
|
+
heights = [];
|
562
|
+
tableRows.each(function(index) {
|
563
|
+
var self, tableHeadersAndData;
|
564
|
+
self = $(this);
|
565
|
+
tableHeadersAndData = self.find('th, td');
|
566
|
+
return tableHeadersAndData.each(function() {
|
567
|
+
var height;
|
568
|
+
height = $(this).outerHeight(true);
|
569
|
+
heights[index] = heights[index] || 0;
|
570
|
+
if (height > heights[index]) {
|
571
|
+
return heights[index] = height;
|
572
|
+
}
|
573
|
+
});
|
574
|
+
});
|
575
|
+
return tableRowsCopy.each(function(index) {
|
576
|
+
return $(this).height(heights[index]);
|
577
|
+
});
|
578
|
+
};
|
579
|
+
|
580
|
+
return ResponsiveTables;
|
7
581
|
|
8
582
|
})();
|
583
|
+
$.fn[pluginName] = function(a, options) {
|
584
|
+
var args, _;
|
585
|
+
_ = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
586
|
+
return this.each(function() {
|
587
|
+
var plugin;
|
588
|
+
plugin = $.data(this, "plugin_" + pluginName);
|
589
|
+
if (!plugin) {
|
590
|
+
return $.data(this, "plugin_" + pluginName, new Furatto.ResponsiveTables(this, a, options));
|
591
|
+
} else if ((plugin[_] != null) && $.type(plugin[_]) === 'function') {
|
592
|
+
return plugin[_].apply(plugin, args);
|
593
|
+
}
|
594
|
+
});
|
595
|
+
};
|
596
|
+
Furatto.ResponsiveTables.version = "1.0.0";
|
597
|
+
return $(document).ready(function() {
|
598
|
+
return $('table.responsive').responsiveTables();
|
599
|
+
});
|
9
600
|
})($, window, document);
|
601
|
+
|
602
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
603
|
+
__slice = [].slice;
|
604
|
+
|
605
|
+
(function($, window, document) {
|
606
|
+
"use strict";
|
607
|
+
var defaults, pluginName;
|
608
|
+
pluginName = 'suraido';
|
609
|
+
defaults = {
|
610
|
+
speed: 500,
|
611
|
+
delay: 3000,
|
612
|
+
pause: false,
|
613
|
+
loop: false,
|
614
|
+
enableKeys: true,
|
615
|
+
enableDots: true,
|
616
|
+
enableArrows: true,
|
617
|
+
prev: '«',
|
618
|
+
next: '»',
|
619
|
+
fluid: true,
|
620
|
+
starting: false,
|
621
|
+
completed: false,
|
622
|
+
easing: 'swing',
|
623
|
+
autoplay: false,
|
624
|
+
paginationClass: 'pagination',
|
625
|
+
paginationItemClass: 'dot',
|
626
|
+
arrowsClass: 'arrows',
|
627
|
+
arrowClass: 'arrow'
|
628
|
+
};
|
629
|
+
Furatto.Suraido = (function() {
|
630
|
+
function Suraido(el, options) {
|
631
|
+
var weakSelf,
|
632
|
+
_this = this;
|
633
|
+
this.el = el;
|
634
|
+
this.prev = __bind(this.prev, this);
|
635
|
+
this.next = __bind(this.next, this);
|
636
|
+
this.stop = __bind(this.stop, this);
|
637
|
+
this.play = __bind(this.play, this);
|
638
|
+
this.to = __bind(this.to, this);
|
639
|
+
this._createArrows = __bind(this._createArrows, this);
|
640
|
+
this._createPagination = __bind(this._createPagination, this);
|
641
|
+
this._enableBindKeys = __bind(this._enableBindKeys, this);
|
642
|
+
this._enablesFluidBehavior = __bind(this._enablesFluidBehavior, this);
|
643
|
+
this._enablesAutoPlay = __bind(this._enablesAutoPlay, this);
|
644
|
+
this._setsMainElement = __bind(this._setsMainElement, this);
|
645
|
+
this._setsItems = __bind(this._setsItems, this);
|
646
|
+
this.$el = $(this.el);
|
647
|
+
this.options = $.extend({}, defaults, options);
|
648
|
+
this.itemsWrapper = this.$el.find('>ul');
|
649
|
+
this.maxSize = {
|
650
|
+
width: this.$el.outerWidth() | 0,
|
651
|
+
height: this.$el.outerHeight() | 0
|
652
|
+
};
|
653
|
+
weakSelf = this;
|
654
|
+
this.items = $(this.itemsWrapper).find('>li').each(function(index) {
|
655
|
+
var $this, height, width;
|
656
|
+
$this = $(this);
|
657
|
+
width = $this.outerWidth();
|
658
|
+
height = $this.outerHeight();
|
659
|
+
if (width > weakSelf.maxSize.width) {
|
660
|
+
weakSelf.maxSize.width = width;
|
661
|
+
}
|
662
|
+
if (height > weakSelf.maxSize.height) {
|
663
|
+
return weakSelf.maxSize.height = height;
|
664
|
+
}
|
665
|
+
});
|
666
|
+
this.itemsLength = this.items.length;
|
667
|
+
this.currentItemIndex = 0;
|
668
|
+
this.items.find('.caption').css({
|
669
|
+
width: "" + (100 / this.itemsLength) + "%"
|
670
|
+
});
|
671
|
+
this._setsMainElement();
|
672
|
+
this.itemsWrapper.css({
|
673
|
+
position: "relative",
|
674
|
+
left: 0,
|
675
|
+
width: "" + (this.itemsLength * 100) + "%"
|
676
|
+
});
|
677
|
+
this._setsItems();
|
678
|
+
if (this.options.autoplay) {
|
679
|
+
this._enablesAutoPlay();
|
680
|
+
}
|
681
|
+
if (this.options.enableKeys) {
|
682
|
+
this._enableBindKeys();
|
683
|
+
}
|
684
|
+
this.options.enableDots && this._createPagination();
|
685
|
+
this.options.enableArrows && this._createArrows();
|
686
|
+
if (this.options.fluid) {
|
687
|
+
this._enablesFluidBehavior();
|
688
|
+
}
|
689
|
+
if (window.chrome) {
|
690
|
+
this.items.css('background-size', '100% 100%');
|
691
|
+
}
|
692
|
+
if ($.event.special['swipe'] || $.Event('swipe')) {
|
693
|
+
this.$el.on('swipeleft swiperight swipeLeft swipeRight', function(e) {
|
694
|
+
if (e.type.toLowerCase() === 'swipeleft') {
|
695
|
+
return _this.next();
|
696
|
+
} else {
|
697
|
+
return _this.prev();
|
698
|
+
}
|
699
|
+
});
|
700
|
+
}
|
701
|
+
}
|
702
|
+
|
703
|
+
Suraido.prototype._setsItems = function() {
|
704
|
+
return this.items.css({
|
705
|
+
float: 'left',
|
706
|
+
width: "" + (100 / this.itemsLength) + "%"
|
707
|
+
});
|
708
|
+
};
|
709
|
+
|
710
|
+
Suraido.prototype._setsMainElement = function() {
|
711
|
+
return this.$el.css({
|
712
|
+
width: this.maxSize.width,
|
713
|
+
height: this.items.first().outerHeight(),
|
714
|
+
overflow: 'hidden'
|
715
|
+
});
|
716
|
+
};
|
717
|
+
|
718
|
+
Suraido.prototype._enablesAutoPlay = function() {
|
719
|
+
var _this = this;
|
720
|
+
return setTimeout(function() {
|
721
|
+
if (_this.options.delay | 0) {
|
722
|
+
_this.play();
|
723
|
+
if (_this.options.pause) {
|
724
|
+
return _this.$el.on('mouseover, mouseout', function(event) {
|
725
|
+
_this.stop();
|
726
|
+
return event.type === 'mouseout' && _this.play();
|
727
|
+
});
|
728
|
+
}
|
729
|
+
}
|
730
|
+
}, this.options.autoPlayDelay | 0);
|
731
|
+
};
|
732
|
+
|
733
|
+
Suraido.prototype._enablesFluidBehavior = function() {
|
734
|
+
var _this = this;
|
735
|
+
return $(window).resize(function() {
|
736
|
+
_this.resize && clearTimeout(_this.resize);
|
737
|
+
return _this.resize = setTimeout(function() {
|
738
|
+
var style, width;
|
739
|
+
style = {
|
740
|
+
height: _this.items.eq(_this.currentItemIndex).outerHeight() + 30
|
741
|
+
};
|
742
|
+
width = _this.$el.outerWidth();
|
743
|
+
_this.itemsWrapper.css(style);
|
744
|
+
style['width'] = "" + (Math.min(Math.round((width / _this.$el.parent().width()) * 100), 100)) + "%";
|
745
|
+
return _this.$el.css(style, 50);
|
746
|
+
});
|
747
|
+
}).resize();
|
748
|
+
};
|
749
|
+
|
750
|
+
Suraido.prototype._enableBindKeys = function() {
|
751
|
+
var _this = this;
|
752
|
+
return $(document).on('keydown', function(event) {
|
753
|
+
switch (event.which) {
|
754
|
+
case 37:
|
755
|
+
return _this.prev();
|
756
|
+
case 39:
|
757
|
+
return _this.next();
|
758
|
+
case 27 || 32:
|
759
|
+
return _this.stop();
|
760
|
+
}
|
761
|
+
});
|
762
|
+
};
|
763
|
+
|
764
|
+
Suraido.prototype._createPagination = function() {
|
765
|
+
var html,
|
766
|
+
_this = this;
|
767
|
+
html = "<ol class='" + this.options.paginationClass + "'>";
|
768
|
+
$.each(this.items, function(index) {
|
769
|
+
return html += "<li class='" + (index === _this.currentItemIndex ? _this.options.paginationItemClass + ' active' : _this.options.paginationItemClass) + "'> " + (++index) + "</li>";
|
770
|
+
});
|
771
|
+
html += "</ol>";
|
772
|
+
return this._bindPagination(this.options.paginationClass, this.options.paginationItemClass, html);
|
773
|
+
};
|
774
|
+
|
775
|
+
Suraido.prototype._createArrows = function() {
|
776
|
+
var html;
|
777
|
+
html = "<div class=\"";
|
778
|
+
html = html + this.options.arrowsClass + "\">" + html + this.options.arrowClass + " prev\">" + this.options.prev + "</div>" + html + this.options.arrowClass + " next\">" + this.options.next + "</div></div>";
|
779
|
+
return this._bindPagination(this.options.arrowsClass, this.options.arrowClass, html);
|
780
|
+
};
|
781
|
+
|
782
|
+
Suraido.prototype._bindPagination = function(className, itemClassName, html) {
|
783
|
+
var weakSelf;
|
784
|
+
weakSelf = this;
|
785
|
+
return this.$el.addClass("has-" + className).append(html).find("." + itemClassName).click(function() {
|
786
|
+
var $this;
|
787
|
+
$this = $(this);
|
788
|
+
if ($this.hasClass(weakSelf.options.paginationItemClass)) {
|
789
|
+
return weakSelf.stop().to($this.index());
|
790
|
+
} else if ($this.hasClass('prev')) {
|
791
|
+
return weakSelf.prev();
|
792
|
+
} else {
|
793
|
+
return weakSelf.next();
|
794
|
+
}
|
795
|
+
});
|
796
|
+
};
|
797
|
+
|
798
|
+
Suraido.prototype.to = function(index, callback) {
|
799
|
+
var easing, obj, speed, target,
|
800
|
+
_this = this;
|
801
|
+
if (this.t) {
|
802
|
+
this.stop();
|
803
|
+
this.play();
|
804
|
+
}
|
805
|
+
target = this.items.eq(index);
|
806
|
+
$.isFunction(this.options.starting) && !callback && this.options.starting(this.$el, this.items.eq(this.currentItemIndex));
|
807
|
+
if (!(target.length || index < 0) && this.options.loop === false) {
|
808
|
+
return;
|
809
|
+
}
|
810
|
+
if (index < 0) {
|
811
|
+
index = this.items.length - 1;
|
812
|
+
}
|
813
|
+
speed = callback ? 5 : this.options.speed | 0;
|
814
|
+
easing = this.options.easing;
|
815
|
+
obj = {
|
816
|
+
height: target.outerHeight() + 30
|
817
|
+
};
|
818
|
+
if (!this.itemsWrapper.queue('fx').length) {
|
819
|
+
this.$el.find("." + this.options.paginationItemClass).eq(index).addClass('active').siblings().removeClass('active');
|
820
|
+
return this.$el.animate(obj, speed, easing) && this.itemsWrapper.animate($.extend({
|
821
|
+
left: "-" + index + "00%"
|
822
|
+
}, obj), speed, easing, function(data) {
|
823
|
+
_this.currentItemIndex = index;
|
824
|
+
return $.isFunction(_this.options.complete) && !callback && _this.options.complete(_this.el, target);
|
825
|
+
});
|
826
|
+
}
|
827
|
+
};
|
828
|
+
|
829
|
+
Suraido.prototype.play = function() {
|
830
|
+
var _this = this;
|
831
|
+
return this.t = setInterval(function() {
|
832
|
+
return _this.to(_this.currentItemIndex + 1);
|
833
|
+
}, this.options.delay | 0);
|
834
|
+
};
|
835
|
+
|
836
|
+
Suraido.prototype.stop = function() {
|
837
|
+
this.t = clearInterval(this.t);
|
838
|
+
return this;
|
839
|
+
};
|
840
|
+
|
841
|
+
Suraido.prototype.next = function() {
|
842
|
+
if (this.currentItemIndex === (this.itemsLength - 1)) {
|
843
|
+
return this.stop().to(0);
|
844
|
+
} else {
|
845
|
+
return this.stop().to(this.currentItemIndex + 1);
|
846
|
+
}
|
847
|
+
};
|
848
|
+
|
849
|
+
Suraido.prototype.prev = function() {
|
850
|
+
return this.stop().to(this.currentItemIndex - 1);
|
851
|
+
};
|
852
|
+
|
853
|
+
return Suraido;
|
854
|
+
|
855
|
+
})();
|
856
|
+
$.fn[pluginName] = function(options) {
|
857
|
+
var args, sliders, _;
|
858
|
+
sliders = this.length;
|
859
|
+
_ = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
860
|
+
return this.each(function(index) {
|
861
|
+
var instance, key, me, plugin;
|
862
|
+
me = $(this);
|
863
|
+
plugin = $.data(this, "plugin_" + pluginName);
|
864
|
+
if (!plugin) {
|
865
|
+
key = "suraido" + (sliders > 1 ? '-' + ++index : '');
|
866
|
+
instance = new Furatto.Suraido(this, options);
|
867
|
+
return me.data(key, instance).data('key', key);
|
868
|
+
} else if ((plugin[_] != null) && $.type(plugin[_]) === 'function') {
|
869
|
+
return plugin[_].apply(plugin, args);
|
870
|
+
}
|
871
|
+
});
|
872
|
+
};
|
873
|
+
Furatto.Suraido.version = "1.0.0";
|
874
|
+
return $(document).ready(function() {
|
875
|
+
return $('[data-suraido]').each(function() {
|
876
|
+
return $(this).suraido();
|
877
|
+
});
|
878
|
+
});
|
879
|
+
})($, window, document);
|
880
|
+
|
881
|
+
/*
|
882
|
+
Toolbar.js
|
883
|
+
|
884
|
+
@fileoverview jQuery plugin that creates tooltip style toolbars.
|
885
|
+
@link http://paulkinzett.github.com/toolbar/
|
886
|
+
@author Paul Kinzett (http://kinzett.co.nz/)
|
887
|
+
@version 1.0.4
|
888
|
+
@requires jQuery 1.7+
|
889
|
+
|
890
|
+
@license jQuery Toolbar Plugin v1.0.4
|
891
|
+
http://paulkinzett.github.com/toolbar/
|
892
|
+
Copyright 2013 Paul Kinzett (http://kinzett.co.nz/)
|
893
|
+
Released under the MIT license.
|
894
|
+
<https://raw.github.com/paulkinzett/toolbar/master/LICENSE.txt>
|
895
|
+
*/
|
896
|
+
|
897
|
+
if (typeof Object.create !== "function") {
|
898
|
+
Object.create = function(obj) {
|
899
|
+
var F;
|
900
|
+
F = function() {};
|
901
|
+
F.prototype = obj;
|
902
|
+
return new F();
|
903
|
+
};
|
904
|
+
}
|
905
|
+
|
906
|
+
(function($, window, document, undefined_) {
|
907
|
+
var ToolBar;
|
908
|
+
ToolBar = {
|
909
|
+
init: function(options, elem) {
|
910
|
+
var self;
|
911
|
+
self = this;
|
912
|
+
self.elem = elem;
|
913
|
+
self.$elem = $(elem);
|
914
|
+
self.options = $.extend({}, $.fn.toolbar.options, options);
|
915
|
+
self.toolbar = $("<div class='tool-container gradient ' />").addClass("tool-" + self.options.position).addClass("tool-rounded").addClass(self.options.theme).append("<div class=\"tool-items\" />").append("<div class='arrow " + self.options.theme + "' />").appendTo("body").css("opacity", 0).hide();
|
916
|
+
self.toolbar_arrow = self.toolbar.find(".arrow");
|
917
|
+
return self.initializeToolbar();
|
918
|
+
},
|
919
|
+
initializeToolbar: function() {
|
920
|
+
var self;
|
921
|
+
self = this;
|
922
|
+
self.populateContent();
|
923
|
+
self.setTrigger();
|
924
|
+
return self.toolbarWidth = self.toolbar.width();
|
925
|
+
},
|
926
|
+
setTrigger: function() {
|
927
|
+
var self;
|
928
|
+
self = this;
|
929
|
+
self.$elem.on("click", function(event) {
|
930
|
+
event.preventDefault();
|
931
|
+
if (self.$elem.hasClass("pressed")) {
|
932
|
+
return self.hide();
|
933
|
+
} else {
|
934
|
+
return self.show();
|
935
|
+
}
|
936
|
+
});
|
937
|
+
if (self.options.hideOnClick) {
|
938
|
+
$("html").on("click.toolbar", function(event) {
|
939
|
+
if (event.target !== self.elem && self.$elem.has(event.target).length === 0 && self.toolbar.has(event.target).length === 0 && self.toolbar.is(":visible")) {
|
940
|
+
return self.hide();
|
941
|
+
}
|
942
|
+
});
|
943
|
+
}
|
944
|
+
return $(window).resize(function(event) {
|
945
|
+
event.stopPropagation();
|
946
|
+
if (self.toolbar.is(":visible")) {
|
947
|
+
self.toolbarCss = self.getCoordinates(self.options.position, 20);
|
948
|
+
self.collisionDetection();
|
949
|
+
self.toolbar.css(self.toolbarCss);
|
950
|
+
return self.toolbar_arrow.css(self.arrowCss);
|
951
|
+
}
|
952
|
+
});
|
953
|
+
},
|
954
|
+
populateContent: function() {
|
955
|
+
var content, location, self;
|
956
|
+
self = this;
|
957
|
+
location = self.toolbar.find(".tool-items");
|
958
|
+
content = $(self.options.content).clone(true).find("a").addClass("tool-item gradient").addClass(self.options.theme);
|
959
|
+
location.html(content);
|
960
|
+
return location.find(".tool-item").on("click", function(event) {
|
961
|
+
event.preventDefault();
|
962
|
+
return self.$elem.trigger("toolbarItemClick", this);
|
963
|
+
});
|
964
|
+
},
|
965
|
+
calculatePosition: function() {
|
966
|
+
var self;
|
967
|
+
self = this;
|
968
|
+
self.arrowCss = {};
|
969
|
+
self.toolbarCss = self.getCoordinates(self.options.position, 0);
|
970
|
+
self.toolbarCss.position = "absolute";
|
971
|
+
self.toolbarCss.zIndex = self.options.zIndex;
|
972
|
+
self.collisionDetection();
|
973
|
+
self.toolbar.css(self.toolbarCss);
|
974
|
+
return self.toolbar_arrow.css(self.arrowCss);
|
975
|
+
},
|
976
|
+
getCoordinates: function(position, adjustment) {
|
977
|
+
var self;
|
978
|
+
self = this;
|
979
|
+
self.coordinates = self.$elem.offset();
|
980
|
+
if (self.options.adjustment && self.options.adjustment[self.options.position]) {
|
981
|
+
adjustment = self.options.adjustment[self.options.position];
|
982
|
+
}
|
983
|
+
switch (self.options.position) {
|
984
|
+
case "top":
|
985
|
+
return {
|
986
|
+
left: self.coordinates.left - (self.toolbar.width() / 2) + (self.$elem.outerWidth() / 2),
|
987
|
+
top: self.coordinates.top - self.$elem.height() - adjustment,
|
988
|
+
right: "auto"
|
989
|
+
};
|
990
|
+
case "left":
|
991
|
+
return {
|
992
|
+
left: self.coordinates.left - (self.toolbar.width() / 2) - (self.$elem.width() / 2) - adjustment,
|
993
|
+
top: self.coordinates.top - (self.toolbar.height() / 2) + (self.$elem.outerHeight() / 2),
|
994
|
+
right: "auto"
|
995
|
+
};
|
996
|
+
case "right":
|
997
|
+
return {
|
998
|
+
left: self.coordinates.left + (self.toolbar.width() / 2) + (self.$elem.width() / 3) + adjustment,
|
999
|
+
top: self.coordinates.top - (self.toolbar.height() / 2) + (self.$elem.outerHeight() / 2),
|
1000
|
+
right: "auto"
|
1001
|
+
};
|
1002
|
+
case "bottom":
|
1003
|
+
return {
|
1004
|
+
left: self.coordinates.left - (self.toolbar.width() / 2) + (self.$elem.outerWidth() / 2),
|
1005
|
+
top: self.coordinates.top + self.$elem.height() + adjustment,
|
1006
|
+
right: "auto"
|
1007
|
+
};
|
1008
|
+
}
|
1009
|
+
},
|
1010
|
+
collisionDetection: function() {
|
1011
|
+
var edgeOffset, self;
|
1012
|
+
self = this;
|
1013
|
+
edgeOffset = 20;
|
1014
|
+
if (self.options.position === "top" || self.options.position === "bottom") {
|
1015
|
+
self.arrowCss = {
|
1016
|
+
left: "50%",
|
1017
|
+
right: "50%"
|
1018
|
+
};
|
1019
|
+
if (self.toolbarCss.left < edgeOffset) {
|
1020
|
+
self.toolbarCss.left = edgeOffset;
|
1021
|
+
return self.arrowCss.left = self.$elem.offset().left + self.$elem.width() / 2 - edgeOffset;
|
1022
|
+
} else if (($(window).width() - (self.toolbarCss.left + self.toolbarWidth)) < edgeOffset) {
|
1023
|
+
self.toolbarCss.right = edgeOffset;
|
1024
|
+
self.toolbarCss.left = "auto";
|
1025
|
+
self.arrowCss.left = "auto";
|
1026
|
+
return self.arrowCss.right = ($(window).width() - self.$elem.offset().left) - (self.$elem.width() / 2) - edgeOffset - 5;
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
},
|
1030
|
+
show: function() {
|
1031
|
+
var animation, self;
|
1032
|
+
self = this;
|
1033
|
+
animation = {
|
1034
|
+
opacity: 1
|
1035
|
+
};
|
1036
|
+
self.$elem.addClass("pressed");
|
1037
|
+
self.calculatePosition();
|
1038
|
+
switch (self.options.position) {
|
1039
|
+
case "top":
|
1040
|
+
animation.top = "-=20";
|
1041
|
+
break;
|
1042
|
+
case "left":
|
1043
|
+
animation.left = "-=20";
|
1044
|
+
break;
|
1045
|
+
case "right":
|
1046
|
+
animation.left = "+=20";
|
1047
|
+
break;
|
1048
|
+
case "bottom":
|
1049
|
+
animation.top = "+=20";
|
1050
|
+
}
|
1051
|
+
self.toolbar.show().animate(animation, 200);
|
1052
|
+
return self.$elem.trigger("toolbarShown");
|
1053
|
+
},
|
1054
|
+
hide: function() {
|
1055
|
+
var animation, self;
|
1056
|
+
self = this;
|
1057
|
+
animation = {
|
1058
|
+
opacity: 0
|
1059
|
+
};
|
1060
|
+
self.$elem.removeClass("pressed");
|
1061
|
+
switch (self.options.position) {
|
1062
|
+
case "top":
|
1063
|
+
animation.top = "+=20";
|
1064
|
+
break;
|
1065
|
+
case "left":
|
1066
|
+
animation.left = "+=20";
|
1067
|
+
break;
|
1068
|
+
case "right":
|
1069
|
+
animation.left = "-=20";
|
1070
|
+
break;
|
1071
|
+
case "bottom":
|
1072
|
+
animation.top = "-=20";
|
1073
|
+
}
|
1074
|
+
self.toolbar.animate(animation, 200, function() {
|
1075
|
+
return self.toolbar.hide();
|
1076
|
+
});
|
1077
|
+
return self.$elem.trigger("toolbarHidden");
|
1078
|
+
},
|
1079
|
+
getToolbarElement: function() {
|
1080
|
+
return this.toolbar.find(".tool-items");
|
1081
|
+
}
|
1082
|
+
};
|
1083
|
+
$.fn.toolbar = function(options) {
|
1084
|
+
var method, toolbarObj;
|
1085
|
+
if ($.isPlainObject(options)) {
|
1086
|
+
return this.each(function() {
|
1087
|
+
var toolbarObj;
|
1088
|
+
toolbarObj = Object.create(ToolBar);
|
1089
|
+
toolbarObj.init(options, this);
|
1090
|
+
return $(this).data("toolbarObj", toolbarObj);
|
1091
|
+
});
|
1092
|
+
} else if (typeof options === "string" && options.indexOf("_") !== 0) {
|
1093
|
+
toolbarObj = $(this).data("toolbarObj");
|
1094
|
+
method = toolbarObj[options];
|
1095
|
+
return method.apply(toolbarObj, $.makeArray(arguments_).slice(1));
|
1096
|
+
}
|
1097
|
+
};
|
1098
|
+
$.fn.toolbar.options = {
|
1099
|
+
content: "#myContent",
|
1100
|
+
position: "top",
|
1101
|
+
hideOnClick: false,
|
1102
|
+
zIndex: 120,
|
1103
|
+
theme: ""
|
1104
|
+
};
|
1105
|
+
return $(document).ready(function() {
|
1106
|
+
return $('[data-furatto="toolbar"]').each(function() {
|
1107
|
+
return $(this).toolbar({
|
1108
|
+
content: $(this).data('content'),
|
1109
|
+
position: $(this).data('position') || 'top',
|
1110
|
+
hideOnClick: true,
|
1111
|
+
theme: $(this).data('theme')
|
1112
|
+
});
|
1113
|
+
});
|
1114
|
+
});
|
1115
|
+
})(jQuery, window, document);
|
1116
|
+
|
1117
|
+
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
1118
|
+
__slice = [].slice;
|
1119
|
+
|
1120
|
+
(function($, window, document) {
|
1121
|
+
var defaults, pluginName;
|
1122
|
+
pluginName = 'tabu';
|
1123
|
+
defaults = {
|
1124
|
+
startIndex: 0,
|
1125
|
+
tabContentClass: 'tabu-content',
|
1126
|
+
tabContentsClass: 'content'
|
1127
|
+
};
|
1128
|
+
Furatto.Tabu = (function() {
|
1129
|
+
function Tabu(el, options) {
|
1130
|
+
this.el = el;
|
1131
|
+
this._toggle = __bind(this._toggle, this);
|
1132
|
+
this._setActiveElements = __bind(this._setActiveElements, this);
|
1133
|
+
this._preventsIndexOutofBounds = __bind(this._preventsIndexOutofBounds, this);
|
1134
|
+
this.$el = $(this.el);
|
1135
|
+
this.options = $.extend(defaults, options, this.$el.data());
|
1136
|
+
this.tabItems = this.$el.find('li');
|
1137
|
+
this.tabItemsLength = this.tabItems.length;
|
1138
|
+
this.tabContents = this.$el.next("." + this.options.tabContentClass).find(">." + this.options.tabContentsClass);
|
1139
|
+
this._preventsIndexOutofBounds();
|
1140
|
+
this._setActiveElements();
|
1141
|
+
this._toggle();
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
Tabu.prototype._preventsIndexOutofBounds = function() {
|
1145
|
+
if (this.options.startIndex >= this.tabItemsLength) {
|
1146
|
+
return this.options.startIndex = this.tabItemsLength - 1;
|
1147
|
+
}
|
1148
|
+
};
|
1149
|
+
|
1150
|
+
Tabu.prototype._setActiveElements = function() {
|
1151
|
+
$(this.tabItems[this.options.startIndex]).addClass('active');
|
1152
|
+
return $(this.tabContents[this.options.startIndex]).addClass('active');
|
1153
|
+
};
|
1154
|
+
|
1155
|
+
Tabu.prototype._toggle = function() {
|
1156
|
+
var weakSelf;
|
1157
|
+
weakSelf = this;
|
1158
|
+
return this.tabItems.on('touchstart click', function(event) {
|
1159
|
+
var id;
|
1160
|
+
event.preventDefault();
|
1161
|
+
weakSelf.tabItems.removeClass('active');
|
1162
|
+
$(this).addClass('active');
|
1163
|
+
weakSelf.tabContents.removeClass('active');
|
1164
|
+
id = $(this).find('a').attr('href');
|
1165
|
+
return $(id).addClass('active');
|
1166
|
+
});
|
1167
|
+
};
|
1168
|
+
|
1169
|
+
return Tabu;
|
1170
|
+
|
1171
|
+
})();
|
1172
|
+
$.fn[pluginName] = function(options) {
|
1173
|
+
var args, tabsLength, _;
|
1174
|
+
tabsLength = this.length;
|
1175
|
+
_ = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
1176
|
+
return this.each(function(index) {
|
1177
|
+
var instance, key, me, plugin;
|
1178
|
+
me = $(this);
|
1179
|
+
plugin = $.data(this, "plugin_" + pluginName);
|
1180
|
+
if (!plugin) {
|
1181
|
+
key = "tabu" + (tabsLength > 1 ? '-' + ++index : '');
|
1182
|
+
instance = new Furatto.Tabu(this, options);
|
1183
|
+
return me.data(key, instance).data('key', key);
|
1184
|
+
} else if ((plugin[_] != null) && $.type(plugin[_]) === 'function') {
|
1185
|
+
return plugin[_].apply(plugin, args);
|
1186
|
+
}
|
1187
|
+
});
|
1188
|
+
};
|
1189
|
+
Furatto.Tabu.version = "1.0.0";
|
1190
|
+
return $(document).ready(function() {
|
1191
|
+
return $('[data-tabu]').each(function() {
|
1192
|
+
return $(this).tabu();
|
1193
|
+
});
|
1194
|
+
});
|
1195
|
+
})($, window, document);
|
1196
|
+
|
1197
|
+
/* ===========================================================
|
1198
|
+
* bootstrap-tooltip.js v2.3.0
|
1199
|
+
* http://twitter.github.com/bootstrap/javascript.html#tooltips
|
1200
|
+
* Inspired by the original jQuery.tipsy by Jason Frame
|
1201
|
+
* ===========================================================
|
1202
|
+
* Copyright 2012 Twitter, Inc.
|
1203
|
+
*
|
1204
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1205
|
+
* you may not use this file except in compliance with the License.
|
1206
|
+
* You may obtain a copy of the License at
|
1207
|
+
*
|
1208
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1209
|
+
*
|
1210
|
+
* Unless required by applicable law or agreed to in writing, software
|
1211
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1212
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1213
|
+
* See the License for the specific language governing permissions and
|
1214
|
+
* limitations under the License.
|
1215
|
+
* ========================================================== */
|
1216
|
+
|
1217
|
+
|
1218
|
+
!function ($) {
|
1219
|
+
|
1220
|
+
"use strict"; // jshint ;_;
|
1221
|
+
|
1222
|
+
|
1223
|
+
/* TOOLTIP PUBLIC CLASS DEFINITION
|
1224
|
+
* =============================== */
|
1225
|
+
|
1226
|
+
var Tooltip = function (element, options) {
|
1227
|
+
this.init('tooltip', element, options)
|
1228
|
+
}
|
1229
|
+
|
1230
|
+
Tooltip.prototype = {
|
1231
|
+
|
1232
|
+
constructor: Tooltip
|
1233
|
+
|
1234
|
+
, init: function (type, element, options) {
|
1235
|
+
var eventIn
|
1236
|
+
, eventOut
|
1237
|
+
, triggers
|
1238
|
+
, trigger
|
1239
|
+
, i
|
1240
|
+
|
1241
|
+
this.type = type
|
1242
|
+
this.$element = $(element)
|
1243
|
+
this.options = this.getOptions(options)
|
1244
|
+
this.enabled = true
|
1245
|
+
|
1246
|
+
triggers = this.options.trigger.split(' ')
|
1247
|
+
|
1248
|
+
for (i = triggers.length; i--;) {
|
1249
|
+
trigger = triggers[i]
|
1250
|
+
if (trigger == 'click') {
|
1251
|
+
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
|
1252
|
+
} else if (trigger != 'manual') {
|
1253
|
+
eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
|
1254
|
+
eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
|
1255
|
+
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
|
1256
|
+
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
|
1257
|
+
}
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
this.options.selector ?
|
1261
|
+
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
|
1262
|
+
this.fixTitle()
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
, getOptions: function (options) {
|
1266
|
+
options = $.extend({}, $.fn[this.type].defaults, this.$element.data(), options)
|
1267
|
+
|
1268
|
+
if (options.delay && typeof options.delay == 'number') {
|
1269
|
+
options.delay = {
|
1270
|
+
show: options.delay
|
1271
|
+
, hide: options.delay
|
1272
|
+
}
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
return options
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
, enter: function (e) {
|
1279
|
+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
1280
|
+
|
1281
|
+
if (!self.options.delay || !self.options.delay.show) return self.show()
|
1282
|
+
|
1283
|
+
clearTimeout(this.timeout)
|
1284
|
+
self.hoverState = 'in'
|
1285
|
+
this.timeout = setTimeout(function() {
|
1286
|
+
if (self.hoverState == 'in') self.show()
|
1287
|
+
}, self.options.delay.show)
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
, leave: function (e) {
|
1291
|
+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
|
1292
|
+
|
1293
|
+
if (this.timeout) clearTimeout(this.timeout)
|
1294
|
+
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
1295
|
+
|
1296
|
+
self.hoverState = 'out'
|
1297
|
+
this.timeout = setTimeout(function() {
|
1298
|
+
if (self.hoverState == 'out') self.hide()
|
1299
|
+
}, self.options.delay.hide)
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
, show: function () {
|
1303
|
+
var $tip
|
1304
|
+
, pos
|
1305
|
+
, actualWidth
|
1306
|
+
, actualHeight
|
1307
|
+
, placement
|
1308
|
+
, tp
|
1309
|
+
, e = $.Event('show')
|
1310
|
+
|
1311
|
+
if (this.hasContent() && this.enabled) {
|
1312
|
+
this.$element.trigger(e)
|
1313
|
+
if (e.isDefaultPrevented()) return
|
1314
|
+
$tip = this.tip()
|
1315
|
+
this.setContent()
|
1316
|
+
|
1317
|
+
if (this.options.animation) {
|
1318
|
+
$tip.addClass('fade')
|
1319
|
+
}
|
1320
|
+
|
1321
|
+
placement = typeof this.options.placement == 'function' ?
|
1322
|
+
this.options.placement.call(this, $tip[0], this.$element[0]) :
|
1323
|
+
this.options.placement
|
1324
|
+
|
1325
|
+
$tip
|
1326
|
+
.detach()
|
1327
|
+
.css({ top: 0, left: 0, display: 'block' })
|
1328
|
+
|
1329
|
+
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
1330
|
+
|
1331
|
+
pos = this.getPosition()
|
1332
|
+
|
1333
|
+
actualWidth = $tip[0].offsetWidth
|
1334
|
+
actualHeight = $tip[0].offsetHeight
|
1335
|
+
|
1336
|
+
switch (placement) {
|
1337
|
+
case 'bottom':
|
1338
|
+
tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
|
1339
|
+
break
|
1340
|
+
case 'top':
|
1341
|
+
tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
|
1342
|
+
break
|
1343
|
+
case 'left':
|
1344
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
|
1345
|
+
break
|
1346
|
+
case 'right':
|
1347
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
|
1348
|
+
break
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
this.applyPlacement(tp, placement)
|
1352
|
+
this.$element.trigger('shown')
|
1353
|
+
}
|
1354
|
+
}
|
1355
|
+
|
1356
|
+
, applyPlacement: function(offset, placement){
|
1357
|
+
var $tip = this.tip()
|
1358
|
+
, width = $tip[0].offsetWidth
|
1359
|
+
, height = $tip[0].offsetHeight
|
1360
|
+
, actualWidth
|
1361
|
+
, actualHeight
|
1362
|
+
, delta
|
1363
|
+
, replace
|
1364
|
+
|
1365
|
+
$tip
|
1366
|
+
.offset(offset)
|
1367
|
+
.addClass(placement)
|
1368
|
+
.addClass('in')
|
1369
|
+
|
1370
|
+
actualWidth = $tip[0].offsetWidth
|
1371
|
+
actualHeight = $tip[0].offsetHeight
|
1372
|
+
|
1373
|
+
if (placement == 'top' && actualHeight != height) {
|
1374
|
+
offset.top = offset.top + height - actualHeight
|
1375
|
+
replace = true
|
1376
|
+
}
|
1377
|
+
|
1378
|
+
if (placement == 'bottom' || placement == 'top') {
|
1379
|
+
delta = 0
|
1380
|
+
|
1381
|
+
if (offset.left < 0){
|
1382
|
+
delta = offset.left * -2
|
1383
|
+
offset.left = 0
|
1384
|
+
$tip.offset(offset)
|
1385
|
+
actualWidth = $tip[0].offsetWidth
|
1386
|
+
actualHeight = $tip[0].offsetHeight
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
this.replaceArrow(delta - width + actualWidth, actualWidth, 'left')
|
1390
|
+
} else {
|
1391
|
+
this.replaceArrow(actualHeight - height, actualHeight, 'top')
|
1392
|
+
}
|
1393
|
+
|
1394
|
+
if (replace) $tip.offset(offset)
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
, replaceArrow: function(delta, dimension, position){
|
1398
|
+
this
|
1399
|
+
.arrow()
|
1400
|
+
.css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
, setContent: function () {
|
1404
|
+
var $tip = this.tip()
|
1405
|
+
, title = this.getTitle()
|
1406
|
+
|
1407
|
+
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
|
1408
|
+
$tip.removeClass('fade in top bottom left right')
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
, hide: function () {
|
1412
|
+
var that = this
|
1413
|
+
, $tip = this.tip()
|
1414
|
+
, e = $.Event('hide')
|
1415
|
+
|
1416
|
+
this.$element.trigger(e)
|
1417
|
+
if (e.isDefaultPrevented()) return
|
1418
|
+
|
1419
|
+
$tip.removeClass('in')
|
1420
|
+
|
1421
|
+
function removeWithAnimation() {
|
1422
|
+
var timeout = setTimeout(function () {
|
1423
|
+
$tip.off($.support.transition.end).detach()
|
1424
|
+
}, 500)
|
1425
|
+
|
1426
|
+
$tip.one($.support.transition.end, function () {
|
1427
|
+
clearTimeout(timeout)
|
1428
|
+
$tip.detach()
|
1429
|
+
})
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
$.support.transition && this.$tip.hasClass('fade') ?
|
1433
|
+
removeWithAnimation() :
|
1434
|
+
$tip.detach()
|
1435
|
+
|
1436
|
+
this.$element.trigger('hidden')
|
1437
|
+
|
1438
|
+
return this
|
1439
|
+
}
|
1440
|
+
|
1441
|
+
, fixTitle: function () {
|
1442
|
+
var $e = this.$element
|
1443
|
+
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
|
1444
|
+
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
1445
|
+
}
|
1446
|
+
}
|
1447
|
+
|
1448
|
+
, hasContent: function () {
|
1449
|
+
return this.getTitle()
|
1450
|
+
}
|
1451
|
+
|
1452
|
+
, getPosition: function () {
|
1453
|
+
var el = this.$element[0]
|
1454
|
+
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : {
|
1455
|
+
width: el.offsetWidth
|
1456
|
+
, height: el.offsetHeight
|
1457
|
+
}, this.$element.offset())
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
, getTitle: function () {
|
1461
|
+
var title
|
1462
|
+
, $e = this.$element
|
1463
|
+
, o = this.options
|
1464
|
+
|
1465
|
+
title = $e.attr('data-original-title')
|
1466
|
+
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
|
1467
|
+
|
1468
|
+
return title
|
1469
|
+
}
|
1470
|
+
|
1471
|
+
, tip: function () {
|
1472
|
+
return this.$tip = this.$tip || $(this.options.template)
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
, arrow: function(){
|
1476
|
+
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
|
1477
|
+
}
|
1478
|
+
|
1479
|
+
, validate: function () {
|
1480
|
+
if (!this.$element[0].parentNode) {
|
1481
|
+
this.hide()
|
1482
|
+
this.$element = null
|
1483
|
+
this.options = null
|
1484
|
+
}
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
, enable: function () {
|
1488
|
+
this.enabled = true
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
, disable: function () {
|
1492
|
+
this.enabled = false
|
1493
|
+
}
|
1494
|
+
|
1495
|
+
, toggleEnabled: function () {
|
1496
|
+
this.enabled = !this.enabled
|
1497
|
+
}
|
1498
|
+
|
1499
|
+
, toggle: function (e) {
|
1500
|
+
var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this
|
1501
|
+
self.tip().hasClass('in') ? self.hide() : self.show()
|
1502
|
+
}
|
1503
|
+
|
1504
|
+
, destroy: function () {
|
1505
|
+
this.hide().$element.off('.' + this.type).removeData(this.type)
|
1506
|
+
}
|
1507
|
+
|
1508
|
+
}
|
1509
|
+
|
1510
|
+
|
1511
|
+
/* TOOLTIP PLUGIN DEFINITION
|
1512
|
+
* ========================= */
|
1513
|
+
|
1514
|
+
var old = $.fn.tooltip
|
1515
|
+
|
1516
|
+
$.fn.tooltip = function ( option ) {
|
1517
|
+
return this.each(function () {
|
1518
|
+
var $this = $(this)
|
1519
|
+
, data = $this.data('tooltip')
|
1520
|
+
, options = typeof option == 'object' && option
|
1521
|
+
if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
|
1522
|
+
if (typeof option == 'string') data[option]()
|
1523
|
+
})
|
1524
|
+
}
|
1525
|
+
|
1526
|
+
$.fn.tooltip.Constructor = Tooltip
|
1527
|
+
|
1528
|
+
$.fn.tooltip.defaults = {
|
1529
|
+
animation: true
|
1530
|
+
, placement: 'top'
|
1531
|
+
, selector: false
|
1532
|
+
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
|
1533
|
+
, trigger: 'hover focus'
|
1534
|
+
, title: ''
|
1535
|
+
, delay: 0
|
1536
|
+
, html: false
|
1537
|
+
, container: false
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
|
1541
|
+
/* TOOLTIP NO CONFLICT
|
1542
|
+
* =================== */
|
1543
|
+
|
1544
|
+
$.fn.tooltip.noConflict = function () {
|
1545
|
+
$.fn.tooltip = old
|
1546
|
+
return this
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
$(document).on('ready', function(){
|
1550
|
+
$("[data-toggle=tooltip]").tooltip();
|
1551
|
+
});
|
1552
|
+
|
1553
|
+
}(window.jQuery);
|
1554
|
+
|
1555
|
+
/* ============================================================
|
1556
|
+
* bootstrap-dropdown.js v2.3.2
|
1557
|
+
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
1558
|
+
* ============================================================
|
1559
|
+
* Copyright 2012 Twitter, Inc.
|
1560
|
+
*
|
1561
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1562
|
+
* you may not use this file except in compliance with the License.
|
1563
|
+
* You may obtain a copy of the License at
|
1564
|
+
*
|
1565
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1566
|
+
*
|
1567
|
+
* Unless required by applicable law or agreed to in writing, software
|
1568
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1569
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1570
|
+
* See the License for the specific language governing permissions and
|
1571
|
+
* limitations under the License.
|
1572
|
+
* ============================================================ */
|
1573
|
+
|
1574
|
+
|
1575
|
+
!function ($) {
|
1576
|
+
|
1577
|
+
"use strict"; // jshint ;_;
|
1578
|
+
|
1579
|
+
|
1580
|
+
/* DROPDOWN CLASS DEFINITION
|
1581
|
+
* ========================= */
|
1582
|
+
|
1583
|
+
var toggle = '[data-toggle=dropdown]'
|
1584
|
+
, Dropdown = function (element) {
|
1585
|
+
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
1586
|
+
$('html').on('click.dropdown.data-api', function () {
|
1587
|
+
$el.parent().removeClass('open')
|
1588
|
+
})
|
1589
|
+
}
|
1590
|
+
|
1591
|
+
Dropdown.prototype = {
|
1592
|
+
|
1593
|
+
constructor: Dropdown
|
1594
|
+
|
1595
|
+
, toggle: function (e) {
|
1596
|
+
var $this = $(this)
|
1597
|
+
, $parent
|
1598
|
+
, isActive
|
1599
|
+
|
1600
|
+
if ($this.is('.disabled, :disabled')) return
|
1601
|
+
|
1602
|
+
$parent = getParent($this)
|
1603
|
+
|
1604
|
+
isActive = $parent.hasClass('open')
|
1605
|
+
|
1606
|
+
clearMenus()
|
1607
|
+
|
1608
|
+
if (!isActive) {
|
1609
|
+
if ('ontouchstart' in document.documentElement) {
|
1610
|
+
// if mobile we we use a backdrop because click events don't delegate
|
1611
|
+
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
1612
|
+
}
|
1613
|
+
$parent.toggleClass('open')
|
1614
|
+
}
|
1615
|
+
|
1616
|
+
$this.focus()
|
1617
|
+
|
1618
|
+
return false
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
, keydown: function (e) {
|
1622
|
+
var $this
|
1623
|
+
, $items
|
1624
|
+
, $active
|
1625
|
+
, $parent
|
1626
|
+
, isActive
|
1627
|
+
, index
|
1628
|
+
|
1629
|
+
if (!/(38|40|27)/.test(e.keyCode)) return
|
1630
|
+
|
1631
|
+
$this = $(this)
|
1632
|
+
|
1633
|
+
e.preventDefault()
|
1634
|
+
e.stopPropagation()
|
1635
|
+
|
1636
|
+
if ($this.is('.disabled, :disabled')) return
|
1637
|
+
|
1638
|
+
$parent = getParent($this)
|
1639
|
+
|
1640
|
+
isActive = $parent.hasClass('open')
|
1641
|
+
|
1642
|
+
if (!isActive || (isActive && e.keyCode == 27)) {
|
1643
|
+
if (e.which == 27) $parent.find(toggle).focus()
|
1644
|
+
return $this.click()
|
1645
|
+
}
|
1646
|
+
|
1647
|
+
$items = $('[role=menu] li:not(.divider):visible a', $parent)
|
1648
|
+
|
1649
|
+
if (!$items.length) return
|
1650
|
+
|
1651
|
+
index = $items.index($items.filter(':focus'))
|
1652
|
+
|
1653
|
+
if (e.keyCode == 38 && index > 0) index-- // up
|
1654
|
+
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
|
1655
|
+
if (!~index) index = 0
|
1656
|
+
|
1657
|
+
$items
|
1658
|
+
.eq(index)
|
1659
|
+
.focus()
|
1660
|
+
}
|
1661
|
+
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
function clearMenus() {
|
1665
|
+
$('.dropdown-backdrop').remove()
|
1666
|
+
$(toggle).each(function () {
|
1667
|
+
getParent($(this)).removeClass('open')
|
1668
|
+
})
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
function getParent($this) {
|
1672
|
+
var selector = $this.attr('data-target')
|
1673
|
+
, $parent
|
1674
|
+
|
1675
|
+
if (!selector) {
|
1676
|
+
selector = $this.attr('href')
|
1677
|
+
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
1678
|
+
}
|
1679
|
+
|
1680
|
+
$parent = selector && $(selector)
|
1681
|
+
|
1682
|
+
if (!$parent || !$parent.length) $parent = $this.parent()
|
1683
|
+
|
1684
|
+
return $parent
|
1685
|
+
}
|
1686
|
+
|
1687
|
+
|
1688
|
+
/* DROPDOWN PLUGIN DEFINITION
|
1689
|
+
* ========================== */
|
1690
|
+
|
1691
|
+
var old = $.fn.dropdown
|
1692
|
+
|
1693
|
+
$.fn.dropdown = function (option) {
|
1694
|
+
return this.each(function () {
|
1695
|
+
var $this = $(this)
|
1696
|
+
, data = $this.data('dropdown')
|
1697
|
+
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
|
1698
|
+
if (typeof option == 'string') data[option].call($this)
|
1699
|
+
})
|
1700
|
+
}
|
1701
|
+
|
1702
|
+
$.fn.dropdown.Constructor = Dropdown
|
1703
|
+
|
1704
|
+
|
1705
|
+
/* DROPDOWN NO CONFLICT
|
1706
|
+
* ==================== */
|
1707
|
+
|
1708
|
+
$.fn.dropdown.noConflict = function () {
|
1709
|
+
$.fn.dropdown = old
|
1710
|
+
return this
|
1711
|
+
}
|
1712
|
+
|
1713
|
+
|
1714
|
+
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
1715
|
+
* =================================== */
|
1716
|
+
|
1717
|
+
$(document)
|
1718
|
+
.on('click.dropdown.data-api', clearMenus)
|
1719
|
+
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
1720
|
+
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
1721
|
+
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
1722
|
+
|
1723
|
+
$(document).ready(function() {
|
1724
|
+
$('.dropdown-toggle').dropdown();
|
1725
|
+
|
1726
|
+
$('.dropdown input, .dropdown label').click(function(e){
|
1727
|
+
e.stopPropagation();
|
1728
|
+
});
|
1729
|
+
})
|
1730
|
+
|
1731
|
+
$('.with-dropdown').on('touchstart click', function(e) {
|
1732
|
+
e.preventDefault();
|
1733
|
+
return $(this).toggleClass('opened');
|
1734
|
+
});
|
1735
|
+
return $('.with-dropdown').hover(function() {
|
1736
|
+
return $(this).addClass('opened');
|
1737
|
+
}, function() {
|
1738
|
+
return $(this).removeClass('opened');
|
1739
|
+
});
|
1740
|
+
|
1741
|
+
}(window.jQuery);
|
1742
|
+
|
1743
|
+
/*!
|
1744
|
+
* classie - class helper functions
|
1745
|
+
* from bonzo https://github.com/ded/bonzo
|
1746
|
+
*
|
1747
|
+
* classie.has( elem, 'my-class' ) -> true/false
|
1748
|
+
* classie.add( elem, 'my-new-class' )
|
1749
|
+
* classie.remove( elem, 'my-unwanted-class' )
|
1750
|
+
* classie.toggle( elem, 'my-class' )
|
1751
|
+
*/
|
1752
|
+
|
1753
|
+
/*jshint browser: true, strict: true, undef: true */
|
1754
|
+
/*global define: false */
|
1755
|
+
|
1756
|
+
( function( window ) {
|
1757
|
+
|
1758
|
+
'use strict';
|
1759
|
+
|
1760
|
+
// class helper functions from bonzo https://github.com/ded/bonzo
|
1761
|
+
|
1762
|
+
function classReg( className ) {
|
1763
|
+
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
|
1764
|
+
}
|
1765
|
+
|
1766
|
+
// classList support for class management
|
1767
|
+
// altho to be fair, the api sucks because it won't accept multiple classes at once
|
1768
|
+
var hasClass, addClass, removeClass;
|
1769
|
+
|
1770
|
+
if ( 'classList' in document.documentElement ) {
|
1771
|
+
hasClass = function( elem, c ) {
|
1772
|
+
return elem.classList.contains( c );
|
1773
|
+
};
|
1774
|
+
addClass = function( elem, c ) {
|
1775
|
+
elem.classList.add( c );
|
1776
|
+
};
|
1777
|
+
removeClass = function( elem, c ) {
|
1778
|
+
elem.classList.remove( c );
|
1779
|
+
};
|
1780
|
+
}
|
1781
|
+
else {
|
1782
|
+
hasClass = function( elem, c ) {
|
1783
|
+
return classReg( c ).test( elem.className );
|
1784
|
+
};
|
1785
|
+
addClass = function( elem, c ) {
|
1786
|
+
if ( !hasClass( elem, c ) ) {
|
1787
|
+
elem.className = elem.className + ' ' + c;
|
1788
|
+
}
|
1789
|
+
};
|
1790
|
+
removeClass = function( elem, c ) {
|
1791
|
+
elem.className = elem.className.replace( classReg( c ), ' ' );
|
1792
|
+
};
|
1793
|
+
}
|
1794
|
+
|
1795
|
+
function toggleClass( elem, c ) {
|
1796
|
+
var fn = hasClass( elem, c ) ? removeClass : addClass;
|
1797
|
+
fn( elem, c );
|
1798
|
+
}
|
1799
|
+
|
1800
|
+
var classie = {
|
1801
|
+
// full names
|
1802
|
+
hasClass: hasClass,
|
1803
|
+
addClass: addClass,
|
1804
|
+
removeClass: removeClass,
|
1805
|
+
toggleClass: toggleClass,
|
1806
|
+
// short names
|
1807
|
+
has: hasClass,
|
1808
|
+
add: addClass,
|
1809
|
+
remove: removeClass,
|
1810
|
+
toggle: toggleClass
|
1811
|
+
};
|
1812
|
+
|
1813
|
+
// transport
|
1814
|
+
if ( typeof define === 'function' && define.amd ) {
|
1815
|
+
// AMD
|
1816
|
+
define( classie );
|
1817
|
+
} else {
|
1818
|
+
// browser global
|
1819
|
+
window.classie = classie;
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
})( window );
|