ui_alchemy-rails 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +6 -0
- data/Rakefile +21 -0
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.svg +154 -0
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.svg +154 -0
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.svg +154 -0
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.svg +154 -0
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/Red Hat Liberation License.txt +78 -0
- data/app/assets/fonts/alchemy/overpass_bold-web.eot +0 -0
- data/app/assets/fonts/alchemy/overpass_bold-web.svg +470 -0
- data/app/assets/fonts/alchemy/overpass_bold-web.ttf +0 -0
- data/app/assets/fonts/alchemy/overpass_bold-web.woff +0 -0
- data/app/assets/fonts/alchemy/overpass_regular-web.eot +0 -0
- data/app/assets/fonts/alchemy/overpass_regular-web.svg +470 -0
- data/app/assets/fonts/alchemy/overpass_regular-web.ttf +0 -0
- data/app/assets/fonts/alchemy/overpass_regular-web.woff +0 -0
- data/app/assets/images/alchemy/icons/action-icons.png +0 -0
- data/app/assets/images/alchemy/icons/arrow_icon.png +0 -0
- data/app/assets/images/alchemy/icons/chosen-sprite.png +0 -0
- data/app/assets/images/alchemy/icons/error_icon.png +0 -0
- data/app/assets/images/alchemy/icons/objects.png +0 -0
- data/app/assets/images/alchemy/icons/spinner.gif +0 -0
- data/app/assets/images/alchemy/icons/spinner_head.gif +0 -0
- data/app/assets/images/alchemy/icons/success_icon.png +0 -0
- data/app/assets/images/alchemy/icons/warning_icon.png +0 -0
- data/app/assets/javascripts/alchemy/flash_messages.js +12 -0
- data/app/assets/javascripts/alchemy/forms.js +25 -0
- data/app/assets/javascripts/alchemy/i18n.js +36 -0
- data/app/assets/javascripts/alchemy/login.js +130 -0
- data/app/assets/javascripts/alchemy/password.js +99 -0
- data/app/assets/stylesheets/alchemy/components/_chosen.scss +423 -0
- data/app/assets/stylesheets/alchemy/components/_content.scss +58 -0
- data/app/assets/stylesheets/alchemy/components/_helpers.scss +38 -0
- data/app/assets/stylesheets/alchemy/components/_media.scss +49 -0
- data/app/assets/stylesheets/alchemy/components/_media_object.scss +22 -0
- data/app/assets/stylesheets/alchemy/components/_normalize.scss +396 -0
- data/app/assets/stylesheets/alchemy/components/_shared.scss +18 -0
- data/app/assets/stylesheets/alchemy/components/buttons/_buttons.scss +278 -0
- data/app/assets/stylesheets/alchemy/components/buttons/_buttons_vars.scss +11 -0
- data/app/assets/stylesheets/alchemy/components/flash_messages/_flash_messages.scss +93 -0
- data/app/assets/stylesheets/alchemy/components/flash_messages/_flash_messages_vars.scss +3 -0
- data/app/assets/stylesheets/alchemy/components/fonts/_liberation.scss +44 -0
- data/app/assets/stylesheets/alchemy/components/fonts/_overpass.scss +24 -0
- data/app/assets/stylesheets/alchemy/components/footer/_footer.scss +53 -0
- data/app/assets/stylesheets/alchemy/components/footer/_footer_vars.scss +4 -0
- data/app/assets/stylesheets/alchemy/components/forms/_forms.scss +552 -0
- data/app/assets/stylesheets/alchemy/components/forms/_forms_ie.scss +45 -0
- data/app/assets/stylesheets/alchemy/components/forms/_forms_mixins.scss +18 -0
- data/app/assets/stylesheets/alchemy/components/forms/_forms_responsive.scss +167 -0
- data/app/assets/stylesheets/alchemy/components/forms/_forms_vars.scss +25 -0
- data/app/assets/stylesheets/alchemy/components/header/_header.scss +216 -0
- data/app/assets/stylesheets/alchemy/components/header/_header_vars.scss +11 -0
- data/app/assets/stylesheets/alchemy/components/login/_login.scss +173 -0
- data/app/assets/stylesheets/alchemy/components/login/_login_mixins.scss +7 -0
- data/app/assets/stylesheets/alchemy/components/login/_login_vars.scss +19 -0
- data/app/assets/stylesheets/alchemy/components/sprites/_sprites.scss +110 -0
- data/app/assets/stylesheets/alchemy/components/sprites/_sprites_mixins.scss +9 -0
- data/app/assets/stylesheets/alchemy/components/text/_text.scss +30 -0
- data/app/assets/stylesheets/alchemy/components/text/_text_vars.scss +1 -0
- data/app/assets/stylesheets/alchemy/composites/content_elements.scss +6 -0
- data/app/assets/stylesheets/alchemy/composites/login.scss +9 -0
- data/app/assets/stylesheets/alchemy/composites/shell.scss +4 -0
- data/app/assets/stylesheets/alchemy/partials/_base.scss +8 -0
- data/app/assets/stylesheets/alchemy/partials/_colors.scss +99 -0
- data/app/assets/stylesheets/alchemy/partials/_mixins.scss +24 -0
- data/app/assets/stylesheets/alchemy/partials/_vars.scss +31 -0
- data/app/helpers/ui_alchemy/gettext_translations.rb +28 -0
- data/app/helpers/ui_alchemy/layout_helper.rb +35 -0
- data/app/helpers/ui_alchemy/rails_translations.rb +21 -0
- data/app/helpers/ui_alchemy/translation_helper.rb +19 -0
- data/app/views/alchemy/layouts/_change_password_layout.html.haml +20 -0
- data/app/views/alchemy/layouts/_common_i18n.haml +4 -0
- data/app/views/alchemy/layouts/_header_layout.haml +13 -0
- data/app/views/alchemy/layouts/_login_layout.html.haml +58 -0
- data/app/views/alchemy/layouts/_user_session_layout.haml +17 -0
- data/app/views/alchemy/layouts/base.html.haml +20 -0
- data/app/views/alchemy/layouts/shell_layout.haml +10 -0
- data/lib/ui_alchemy/rails/engine.rb +6 -0
- data/lib/ui_alchemy/rails/version.rb +5 -0
- data/lib/ui_alchemy-rails.rb +2 -0
- data/vendor/assets/javascripts/alchemy/handlebars.js +2201 -0
- data/vendor/assets/javascripts/alchemy/html5shiv.js +298 -0
- data/vendor/assets/javascripts/alchemy/jquery/jquery-1.6.2.js +8981 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/chosen.jquery.js +1003 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/excanvas.js +1427 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/excanvas.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.colorhelpers.js +179 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.colorhelpers.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.crosshair.js +167 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.crosshair.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.fillbetween.js +183 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.fillbetween.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.image.js +238 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.image.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.js +2599 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.min.js +6 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.navigate.js +336 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.navigate.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.pie.js +750 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.pie.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.resize.js +60 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.resize.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.selection.js +344 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.selection.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.stack.js +184 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.stack.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.symbol.js +70 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.symbol.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.threshold.js +103 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.threshold.min.js +1 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/blank.svg +3 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/custom_test.js +67 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.css +9 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.js +1101 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.min.js +7 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.pack.js +7 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svgfilter.js +396 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svgfilter.min.js +7 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svgfilter.pack.js +7 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svggraph.js +1337 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svggraph.min.js +7 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svggraph.pack.js +7 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/lion.svg +161 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/test.js +714 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ajaxfileupload.js +205 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ba-bbq.js +1137 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ba-resize.js +246 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.cookie.js +92 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.easing.1.3.js +205 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.fancyqueries.js +106 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.flash.js +288 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.form.js +964 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.hoverIntent.js +106 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jeditable.ajaxupload.js +62 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jeditable.js +556 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jnotify.js +210 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jscrollpane.js +1390 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jscrollpane.min.js +11 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.linkHover.js +89 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.loadmask.min.js +10 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.mousewheel.js +78 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.multiselect.filter.js +176 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.multiselect.js +668 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.pack.js +11 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.periodicalupdater.js +175 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.sortElements.js +75 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.sparkline.min.js +94 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.text-overflow.js +60 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.timepickr.js +214 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.timers.js +142 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.tipsy.js +358 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.treeTable.js +226 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.trunk8.js +203 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ui.multiselect.js +338 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ui.totop.js +58 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.uitablefilter.js +95 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/ui.spinner.js +683 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-hard_75_dadada_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-hard_75_e6e6e6_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-hard_95_ffffff_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-soft_80_e0e0e0_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_inset-hard_65_ffffff_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-icons_8f8f8f_256x240.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-icons_97baed_256x240.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/jquery-ui-1.8.11.custom.css +573 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/js/jquery-1.5.1.min.js +16 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/js/jquery-ui-1.8.11.custom.min.js +783 -0
- data/vendor/assets/javascripts/alchemy/rails.js +331 -0
- data/vendor/assets/javascripts/alchemy/underscore-1.3.1.js +999 -0
- metadata +252 -0
@@ -0,0 +1,214 @@
|
|
1
|
+
/*
|
2
|
+
jQuery Ui timepickr
|
3
|
+
(c) Maxime Haineault <haineault@gmail.com>
|
4
|
+
http://haineault.com
|
5
|
+
|
6
|
+
MIT License (http://www.opensource.org/licenses/mit-license.php
|
7
|
+
Modified under license by Daniel Wachsstock & Haso Keric
|
8
|
+
|
9
|
+
Updated 10/25/2010 for jQuery UI 1.8.5
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function($) {
|
13
|
+
var menuTemplate = '<div class="ui-helper-reset ui-timepickr ui-widget" />';
|
14
|
+
var rowTemplate = '<ol />';
|
15
|
+
var buttonTemplate = '<li class="{className}">{label}</li>';
|
16
|
+
function format(s, o){ // simple parameterizing strings
|
17
|
+
for (key in o) s = s.replace('{'+key+'}', o[key]);
|
18
|
+
return s;
|
19
|
+
}
|
20
|
+
|
21
|
+
$.widget('ui.timepickr', {
|
22
|
+
_init: function() {
|
23
|
+
var ui = this, element = this.element;
|
24
|
+
element.data('timepickr.initialValue', element.val());
|
25
|
+
var menu = this.menu = ui._buildMenu().insertAfter(element);
|
26
|
+
menu.children().hide();
|
27
|
+
|
28
|
+
element.bind(this.options.trigger + '.timepickr', function(){
|
29
|
+
ui.show();
|
30
|
+
});
|
31
|
+
|
32
|
+
var hover = this.options.hoverIntent && $.fn.hoverIntent ? 'hoverIntent' : 'hover';
|
33
|
+
menu
|
34
|
+
.data('timepickr', this)
|
35
|
+
.css({width:this.options.width})
|
36
|
+
.find('li')
|
37
|
+
.addClass('ui-state-default ui-corner-all')
|
38
|
+
[hover](function(){
|
39
|
+
ui.inside = true;
|
40
|
+
$(this).siblings().removeClass('ui-state-hover');
|
41
|
+
$(this).addClass('ui-state-hover');
|
42
|
+
ui._redraw();
|
43
|
+
ui.showNextLevel(this);
|
44
|
+
ui.update();
|
45
|
+
}, function(){
|
46
|
+
ui.inside = false;
|
47
|
+
}).end()
|
48
|
+
.find('ol')
|
49
|
+
.addClass('ui-widget ui-helper-clearfix ui-helper-reset')
|
50
|
+
.hide();
|
51
|
+
|
52
|
+
this._redraw();
|
53
|
+
|
54
|
+
element.blur(function(e) {
|
55
|
+
ui.hide();
|
56
|
+
if (ui.inside){
|
57
|
+
// clicking outside the element blurs it before the click on the new element in called
|
58
|
+
ui._trigger ('select', [e, ui]);
|
59
|
+
}
|
60
|
+
if (ui.options.resetOnBlur) {
|
61
|
+
element.val(element.data('timepickr.initialValue'));
|
62
|
+
}
|
63
|
+
});
|
64
|
+
|
65
|
+
if (this.options.val) {
|
66
|
+
element.val(this.options.val);
|
67
|
+
}
|
68
|
+
|
69
|
+
if (this.options.handle) {
|
70
|
+
$(this.options.handle).click(function() {
|
71
|
+
ui.show();
|
72
|
+
ui.element.focus();
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
if (this.options.resetOnBlur) {
|
77
|
+
menu.find('li').bind('mousedown.timepickr', function(){
|
78
|
+
element.data('timepickr.initialValue', element.val());
|
79
|
+
});
|
80
|
+
}
|
81
|
+
|
82
|
+
this._redraw();
|
83
|
+
},
|
84
|
+
|
85
|
+
update: function() {
|
86
|
+
var val = {
|
87
|
+
h: this.getValue('hour'),
|
88
|
+
m: this.getValue('minute'),
|
89
|
+
prefix: this.getValue('prefix'),
|
90
|
+
suffix: this.getValue('suffix')
|
91
|
+
};
|
92
|
+
$(this.element).val(format(this.options.format, val));
|
93
|
+
},
|
94
|
+
|
95
|
+
getValue: function(type) {
|
96
|
+
// get the highlighted element; if none is highlighted, get the first one
|
97
|
+
var elem = $('.'+ type +'.ui-state-hover', this.menu)[0] || $('.'+type+':first', this.menu)[0];
|
98
|
+
return $(elem).text();
|
99
|
+
},
|
100
|
+
|
101
|
+
destroy: function() {
|
102
|
+
this.menu.remove();
|
103
|
+
$.Widget.prototype.destroy.apply(this);
|
104
|
+
},
|
105
|
+
|
106
|
+
show: function() {
|
107
|
+
this.menu.css({
|
108
|
+
top: this.element.position().top + this.element.height() + this.options.top,
|
109
|
+
zIndex: 1000
|
110
|
+
});
|
111
|
+
this.menu.find('ol:eq(0)').css('left', this.element.position().left).show();
|
112
|
+
},
|
113
|
+
|
114
|
+
showNextLevel: function(el) {
|
115
|
+
$(el).closest('ol').next().show(this.options.animSpeed);
|
116
|
+
},
|
117
|
+
|
118
|
+
// essentially reposition each ol
|
119
|
+
_redraw: function() {
|
120
|
+
this.menu.css({
|
121
|
+
top: this.element.position().top + this.element.height() + this.options.top,
|
122
|
+
left: this.element.position().left + this.options.left
|
123
|
+
});
|
124
|
+
|
125
|
+
if (this.options.convention === 24) {
|
126
|
+
var hrs = this.menu.find('ol:eq(1)');
|
127
|
+
var dayHours = hrs.find('li').slice(0, 12);
|
128
|
+
var nightHours = hrs.find('li').slice(12, 24);
|
129
|
+
if (this.menu.find('ol:eq(0) li:eq(0)').hasClass('ui-state-hover')){
|
130
|
+
// daytime
|
131
|
+
nightHours.hide();
|
132
|
+
dayHours.show();
|
133
|
+
}else{
|
134
|
+
//nighttime
|
135
|
+
dayHours.hide();
|
136
|
+
nightHours.show();
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
// reposition each ol
|
141
|
+
var ols = this.menu.find('ol');
|
142
|
+
ols.each(function(i) {
|
143
|
+
var prevOL = $(this).prev('ol');
|
144
|
+
// find the span that's being hovered; if nothing, use the first one
|
145
|
+
var pos = prevOL.find('.ui-state-hover:visible').position() || prevOL.find('li:visible:first').position();
|
146
|
+
if (pos) $(this).css('margin-left', pos.left);
|
147
|
+
});
|
148
|
+
},
|
149
|
+
|
150
|
+
// hide all levels
|
151
|
+
hide: function() {
|
152
|
+
this.menu.find('ol').hide();
|
153
|
+
},
|
154
|
+
|
155
|
+
activate: function(e) {
|
156
|
+
this.element.focus();
|
157
|
+
this.show(this.options.animSpeed);
|
158
|
+
},
|
159
|
+
|
160
|
+
_createRow: function(range, className) {
|
161
|
+
var row = $(rowTemplate);
|
162
|
+
$.each(range, function(){
|
163
|
+
row.append($(format(buttonTemplate, {className: className, label: this.toString()})));
|
164
|
+
});
|
165
|
+
return row;
|
166
|
+
},
|
167
|
+
|
168
|
+
_getRanges12: function() {
|
169
|
+
var o = [];
|
170
|
+
o.push(this._createRow(['01','02','03','04','05','06','07','08','09','10','11','12'], 'hour'));
|
171
|
+
o.push(this._createRow(this.options.rangeMin, 'minute'));
|
172
|
+
o.push(this._createRow(this.options.suffix, 'suffix'));
|
173
|
+
return o;
|
174
|
+
},
|
175
|
+
|
176
|
+
_getRanges24: function() {
|
177
|
+
var o = [], opt = this.options;
|
178
|
+
o.push(this._createRow(this.options.prefix, false, 'prefix')); // prefix is required in 24h mode
|
179
|
+
o.push(this._createRow(
|
180
|
+
['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'],
|
181
|
+
'hour'
|
182
|
+
));
|
183
|
+
o.push(this._createRow(this.options.rangeMin, 'minute'));
|
184
|
+
return o;
|
185
|
+
},
|
186
|
+
|
187
|
+
_buildMenu: function() {
|
188
|
+
var menu = $(menuTemplate);
|
189
|
+
var ranges = this.options.convention === 24
|
190
|
+
&& this._getRanges24() || this._getRanges12();
|
191
|
+
$.each(ranges, function(i, val){
|
192
|
+
menu.append(val);
|
193
|
+
});
|
194
|
+
return menu;
|
195
|
+
}
|
196
|
+
});
|
197
|
+
|
198
|
+
$.ui.timepickr.prototype.options = {
|
199
|
+
top: 6,
|
200
|
+
left: 0,
|
201
|
+
animSpeed: 0,
|
202
|
+
trigger: 'click',
|
203
|
+
convention: 12, // 24, 12
|
204
|
+
format: '{h}:{m} {suffix}',
|
205
|
+
handle: false,
|
206
|
+
prefix: ['00-11', '12-23'],
|
207
|
+
suffix: ['am', 'pm'],
|
208
|
+
rangeMin: ['00', '15', '30', '45'],
|
209
|
+
resetOnBlur: true,
|
210
|
+
val: false,
|
211
|
+
hoverIntent: false
|
212
|
+
};
|
213
|
+
|
214
|
+
})(jQuery);
|
@@ -0,0 +1,142 @@
|
|
1
|
+
jQuery.fn.extend({
|
2
|
+
everyTime: function(interval, label, fn, times, belay) {
|
3
|
+
return this.each(function() {
|
4
|
+
jQuery.timer.add(this, interval, label, fn, times, belay);
|
5
|
+
});
|
6
|
+
},
|
7
|
+
oneTime: function(interval, label, fn) {
|
8
|
+
return this.each(function() {
|
9
|
+
jQuery.timer.add(this, interval, label, fn, 1);
|
10
|
+
});
|
11
|
+
},
|
12
|
+
stopTime: function(label, fn) {
|
13
|
+
return this.each(function() {
|
14
|
+
jQuery.timer.remove(this, label, fn);
|
15
|
+
});
|
16
|
+
}
|
17
|
+
});
|
18
|
+
|
19
|
+
jQuery.extend({
|
20
|
+
timer: {
|
21
|
+
guid: 1,
|
22
|
+
global: {},
|
23
|
+
regex: /^([0-9]+)\s*(.*s)?$/,
|
24
|
+
powers: {
|
25
|
+
// Yeah this is major overkill...
|
26
|
+
'ms': 1,
|
27
|
+
'cs': 10,
|
28
|
+
'ds': 100,
|
29
|
+
's': 1000,
|
30
|
+
'das': 10000,
|
31
|
+
'hs': 100000,
|
32
|
+
'ks': 1000000
|
33
|
+
},
|
34
|
+
timeParse: function(value) {
|
35
|
+
if (value == undefined || value == null)
|
36
|
+
return null;
|
37
|
+
var result = this.regex.exec(jQuery.trim(value.toString()));
|
38
|
+
if (result[2]) {
|
39
|
+
var num = parseInt(result[1], 10);
|
40
|
+
var mult = this.powers[result[2]] || 1;
|
41
|
+
return num * mult;
|
42
|
+
} else {
|
43
|
+
return value;
|
44
|
+
}
|
45
|
+
},
|
46
|
+
add: function(element, interval, label, fn, times, belay) {
|
47
|
+
var counter = 0;
|
48
|
+
|
49
|
+
if (jQuery.isFunction(label)) {
|
50
|
+
if (!times)
|
51
|
+
times = fn;
|
52
|
+
fn = label;
|
53
|
+
label = interval;
|
54
|
+
}
|
55
|
+
|
56
|
+
interval = jQuery.timer.timeParse(interval);
|
57
|
+
|
58
|
+
if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
|
59
|
+
return;
|
60
|
+
|
61
|
+
if (times && times.constructor != Number) {
|
62
|
+
belay = !!times;
|
63
|
+
times = 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
times = times || 0;
|
67
|
+
belay = belay || false;
|
68
|
+
|
69
|
+
if (!element.$timers)
|
70
|
+
element.$timers = {};
|
71
|
+
|
72
|
+
if (!element.$timers[label])
|
73
|
+
element.$timers[label] = {};
|
74
|
+
|
75
|
+
fn.$timerID = fn.$timerID || this.guid++;
|
76
|
+
|
77
|
+
var handler = function() {
|
78
|
+
if (belay && this.inProgress)
|
79
|
+
return;
|
80
|
+
this.inProgress = true;
|
81
|
+
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
|
82
|
+
jQuery.timer.remove(element, label, fn);
|
83
|
+
this.inProgress = false;
|
84
|
+
};
|
85
|
+
|
86
|
+
handler.$timerID = fn.$timerID;
|
87
|
+
|
88
|
+
if (!element.$timers[label][fn.$timerID])
|
89
|
+
element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
|
90
|
+
|
91
|
+
if ( !this.global[label] )
|
92
|
+
this.global[label] = [];
|
93
|
+
this.global[label].push( element );
|
94
|
+
|
95
|
+
},
|
96
|
+
remove: function(element, label, fn) {
|
97
|
+
var timers = element.$timers, ret;
|
98
|
+
|
99
|
+
if ( timers ) {
|
100
|
+
|
101
|
+
if (!label) {
|
102
|
+
for ( label in timers )
|
103
|
+
this.remove(element, label, fn);
|
104
|
+
} else if ( timers[label] ) {
|
105
|
+
if ( fn ) {
|
106
|
+
if ( fn.$timerID ) {
|
107
|
+
window.clearInterval(timers[label][fn.$timerID]);
|
108
|
+
delete timers[label][fn.$timerID];
|
109
|
+
}
|
110
|
+
} else {
|
111
|
+
for ( var fn in timers[label] ) {
|
112
|
+
window.clearInterval(timers[label][fn]);
|
113
|
+
delete timers[label][fn];
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
for ( ret in timers[label] ) break;
|
118
|
+
if ( !ret ) {
|
119
|
+
ret = null;
|
120
|
+
delete timers[label];
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
for ( ret in timers ) break;
|
125
|
+
if ( !ret )
|
126
|
+
element.$timers = null;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
});
|
131
|
+
|
132
|
+
if (jQuery.browser.msie)
|
133
|
+
jQuery(window).one("unload", function() {
|
134
|
+
var global = jQuery.timer.global;
|
135
|
+
for ( var label in global ) {
|
136
|
+
var els = global[label], i = els.length;
|
137
|
+
while ( --i )
|
138
|
+
jQuery.timer.remove(els[i], label);
|
139
|
+
}
|
140
|
+
});
|
141
|
+
|
142
|
+
|
@@ -0,0 +1,358 @@
|
|
1
|
+
// tipsy, facebook style tooltips for jquery
|
2
|
+
// version 1.0.0a
|
3
|
+
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
4
|
+
// released under the MIT license
|
5
|
+
|
6
|
+
(function($) {
|
7
|
+
|
8
|
+
function maybeCall(thing, ctx) {
|
9
|
+
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
|
10
|
+
};
|
11
|
+
|
12
|
+
function Tipsy(element, options) {
|
13
|
+
this.$element = $(element);
|
14
|
+
this.options = options;
|
15
|
+
this.enabled = true;
|
16
|
+
this.fixTitle();
|
17
|
+
};
|
18
|
+
|
19
|
+
Tipsy.prototype = {
|
20
|
+
show: function() {
|
21
|
+
var title = this.getTitle(),
|
22
|
+
to_render = title;
|
23
|
+
if (title && this.enabled) {
|
24
|
+
var $tip = this.tip();
|
25
|
+
|
26
|
+
if(this.cached_title){
|
27
|
+
title = this.cached_title;
|
28
|
+
}
|
29
|
+
else {
|
30
|
+
this.fetchData();
|
31
|
+
}
|
32
|
+
|
33
|
+
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
34
|
+
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
35
|
+
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
|
36
|
+
|
37
|
+
|
38
|
+
if (this.options.className) {
|
39
|
+
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
|
40
|
+
}
|
41
|
+
|
42
|
+
var that = this;
|
43
|
+
function tipOver() {
|
44
|
+
that.hoverTooltip = true;
|
45
|
+
}
|
46
|
+
function tipOut() {
|
47
|
+
if (that.hoverState == 'in') return; // If field is still focused.
|
48
|
+
that.hoverTooltip = false;
|
49
|
+
if (that.options.trigger != 'manual') {
|
50
|
+
var eventOut = that.options.trigger == 'hover' ? 'mouseleave.tipsy' : 'blur.tipsy';
|
51
|
+
that.$element.trigger(eventOut);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
if (this.options.hoverable) {
|
56
|
+
$tip.hover(tipOver, tipOut);
|
57
|
+
}
|
58
|
+
|
59
|
+
var pos = $.extend({}, this.$element.offset(), {
|
60
|
+
width: this.$element[0].offsetWidth,
|
61
|
+
height: this.$element[0].offsetHeight
|
62
|
+
});
|
63
|
+
|
64
|
+
var actualWidth = $tip[0].offsetWidth,
|
65
|
+
actualHeight = $tip[0].offsetHeight,
|
66
|
+
gravity = maybeCall(this.options.gravity, this.$element[0]);
|
67
|
+
|
68
|
+
var tp;
|
69
|
+
switch (gravity.charAt(0)) {
|
70
|
+
case 'n':
|
71
|
+
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
72
|
+
break;
|
73
|
+
case 's':
|
74
|
+
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
75
|
+
break;
|
76
|
+
case 'e':
|
77
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
78
|
+
break;
|
79
|
+
case 'w':
|
80
|
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
81
|
+
break;
|
82
|
+
}
|
83
|
+
|
84
|
+
if (gravity.length == 2) {
|
85
|
+
if (gravity.charAt(1) == 'w') {
|
86
|
+
tp.left = pos.left + pos.width / 2 - 15;
|
87
|
+
} else {
|
88
|
+
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
$tip.css(tp).addClass('tipsy-' + gravity);
|
93
|
+
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
|
94
|
+
|
95
|
+
if (this.options.fade) {
|
96
|
+
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
97
|
+
} else {
|
98
|
+
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
99
|
+
}
|
100
|
+
// if there's a callback, run it
|
101
|
+
if( $.isFunction(this.options.afterShow) ) this.options.afterShow.apply(self);
|
102
|
+
}
|
103
|
+
},
|
104
|
+
hide: function() {
|
105
|
+
if (this.options.fade) {
|
106
|
+
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
107
|
+
} else {
|
108
|
+
this.tip().remove();
|
109
|
+
}
|
110
|
+
},
|
111
|
+
|
112
|
+
fixTitle: function() {
|
113
|
+
var $e = this.$element;
|
114
|
+
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
|
115
|
+
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
|
116
|
+
}
|
117
|
+
},
|
118
|
+
fetchData: function(){
|
119
|
+
var o = this.options,
|
120
|
+
tipsy = this,
|
121
|
+
url = o.url;
|
122
|
+
|
123
|
+
if(o.url && !this.fetching){
|
124
|
+
if (typeof o.url === 'function') {
|
125
|
+
url = url(this.$element);
|
126
|
+
}
|
127
|
+
$.get(url, {}, function(data){
|
128
|
+
tipsy.cached_title = data;
|
129
|
+
tipsy.fetching = true;
|
130
|
+
if(tipsy.$tip.is(':visible')){
|
131
|
+
tipsy.show();
|
132
|
+
}
|
133
|
+
});
|
134
|
+
}
|
135
|
+
},
|
136
|
+
getTitle: function() {
|
137
|
+
var title, $e = this.$element, o = this.options;
|
138
|
+
this.fixTitle();
|
139
|
+
var title, o = this.options;
|
140
|
+
if (typeof o.title === 'string') {
|
141
|
+
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
|
142
|
+
} else if (typeof o.title == 'function') {
|
143
|
+
title = o.title.call($e[0]);
|
144
|
+
}
|
145
|
+
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
146
|
+
return title || o.fallback;
|
147
|
+
},
|
148
|
+
|
149
|
+
tip: function() {
|
150
|
+
if (!this.$tip) {
|
151
|
+
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
|
152
|
+
}
|
153
|
+
return this.$tip;
|
154
|
+
},
|
155
|
+
|
156
|
+
validate: function() {
|
157
|
+
if (!this.$element[0].parentNode) {
|
158
|
+
this.hide();
|
159
|
+
this.$element = null;
|
160
|
+
this.options = null;
|
161
|
+
}
|
162
|
+
},
|
163
|
+
|
164
|
+
enable: function() { this.enabled = true; },
|
165
|
+
disable: function() { this.enabled = false; },
|
166
|
+
toggleEnabled: function() { this.enabled = !this.enabled; }
|
167
|
+
};
|
168
|
+
|
169
|
+
$.fn.tipsy = function(options) {
|
170
|
+
|
171
|
+
if (options === true) {
|
172
|
+
return this.data('tipsy');
|
173
|
+
} else if (typeof options == 'string') {
|
174
|
+
var tipsy = this.data('tipsy');
|
175
|
+
if (tipsy) tipsy[options]();
|
176
|
+
return this;
|
177
|
+
}
|
178
|
+
|
179
|
+
options = $.extend({}, $.fn.tipsy.defaults, options);
|
180
|
+
if (options.hoverable) {
|
181
|
+
options.delayOut = options.delayOut || 200;
|
182
|
+
}
|
183
|
+
|
184
|
+
function get(ele) {
|
185
|
+
var tipsy = $.data(ele, 'tipsy');
|
186
|
+
if (!tipsy) {
|
187
|
+
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
188
|
+
$.data(ele, 'tipsy', tipsy);
|
189
|
+
}
|
190
|
+
return tipsy;
|
191
|
+
}
|
192
|
+
|
193
|
+
function enter() {
|
194
|
+
var tipsy = get(this);
|
195
|
+
if( options.activeTip === undefined ){
|
196
|
+
tipsy.hoverState = 'in';
|
197
|
+
if (options.delayIn == 0) {
|
198
|
+
tipsy.show();
|
199
|
+
} else {
|
200
|
+
tipsy.fixTitle();
|
201
|
+
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
};
|
205
|
+
|
206
|
+
function leave() {
|
207
|
+
var tipsy = get(this);
|
208
|
+
if( tipsy.clickState !== 'on' ){
|
209
|
+
tipsy.hoverState = 'out';
|
210
|
+
if (options.delayOut == 0) {
|
211
|
+
tipsy.hide();
|
212
|
+
} else {
|
213
|
+
setTimeout(function() { if (tipsy.hoverState == 'out' && !tipsy.hoverTooltip) tipsy.hide(); }, options.delayOut);
|
214
|
+
}
|
215
|
+
}
|
216
|
+
};
|
217
|
+
|
218
|
+
function sticky() {
|
219
|
+
var tipsy = get(this),
|
220
|
+
activeTip,
|
221
|
+
show = (tipsy.clickState === 'on') ? false : true;
|
222
|
+
handleClose();
|
223
|
+
|
224
|
+
if( show ){
|
225
|
+
tipsy.show();
|
226
|
+
tipsy.clickState = 'on';
|
227
|
+
options.activeTip = this;
|
228
|
+
$(this).addClass('tipsy-sticky-click');
|
229
|
+
options.stickyClick(this, tipsy.clickState);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
function handleScroll(event) {
|
234
|
+
var target = $(event.target);
|
235
|
+
|
236
|
+
if( !(target.parents().hasClass('tipsy-inner')) ){
|
237
|
+
if( options.activeTip ){
|
238
|
+
if(options.closeOnScroll){
|
239
|
+
handleClose();
|
240
|
+
}
|
241
|
+
else {
|
242
|
+
get(options.activeTip).show();
|
243
|
+
}
|
244
|
+
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}
|
248
|
+
|
249
|
+
function closeAll(){
|
250
|
+
var elements = $('.tipsy');
|
251
|
+
|
252
|
+
elements.remove();
|
253
|
+
}
|
254
|
+
|
255
|
+
function handleClose(){
|
256
|
+
var elements = $('.tipsy-sticky-click'),
|
257
|
+
i, length, tipsy, node;
|
258
|
+
|
259
|
+
for(i=0, length = elements.length; i < length; i += 1){
|
260
|
+
node = elements[i];
|
261
|
+
$(node).removeClass('tipsy-sticky-click');
|
262
|
+
tipsy = get(node);
|
263
|
+
tipsy.clickState = 'off';
|
264
|
+
tipsy.hide();
|
265
|
+
options.stickyClick(node, tipsy.clickState);
|
266
|
+
}
|
267
|
+
options.activeTip = undefined;
|
268
|
+
}
|
269
|
+
|
270
|
+
if (!options.live) this.each(function() { get(this); });
|
271
|
+
|
272
|
+
if (options.trigger != 'manual') {
|
273
|
+
var binder = options.live ? 'live' : 'bind',
|
274
|
+
eventIn = options.trigger == 'hover' ? 'mouseenter.tipsy' : 'focus.tipsy',
|
275
|
+
eventOut = options.trigger == 'hover' ? 'mouseleave.tipsy' : 'blur.tipsy';
|
276
|
+
this[binder](eventIn, enter)[binder](eventOut, leave);
|
277
|
+
}
|
278
|
+
|
279
|
+
if (options.stickyClick) {
|
280
|
+
this['live']('click', sticky);
|
281
|
+
$(document).bind('scroll', handleScroll);
|
282
|
+
$(document).bind('close.tipsy', handleClose);
|
283
|
+
}
|
284
|
+
|
285
|
+
$(document).bind('close.tipsy', function(){
|
286
|
+
closeAll();
|
287
|
+
});
|
288
|
+
|
289
|
+
return this;
|
290
|
+
|
291
|
+
};
|
292
|
+
|
293
|
+
$.fn.tipsy.defaults = {
|
294
|
+
className: null,
|
295
|
+
delayIn: 0,
|
296
|
+
delayOut: 0,
|
297
|
+
fade: false,
|
298
|
+
fallback: '',
|
299
|
+
gravity: 'n',
|
300
|
+
html: false,
|
301
|
+
live: false,
|
302
|
+
hoverable: false,
|
303
|
+
stickyClick: false,
|
304
|
+
offset: 0,
|
305
|
+
opacity: 0.8,
|
306
|
+
title: 'title',
|
307
|
+
trigger: 'hover',
|
308
|
+
afterShow: null //call back after the tip is shown
|
309
|
+
};
|
310
|
+
|
311
|
+
// Overwrite this method to provide options on a per-element basis.
|
312
|
+
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
313
|
+
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
314
|
+
// (remember - do not modify 'options' in place!)
|
315
|
+
$.fn.tipsy.elementOptions = function(ele, options) {
|
316
|
+
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
317
|
+
};
|
318
|
+
|
319
|
+
$.fn.tipsy.autoNS = function() {
|
320
|
+
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
321
|
+
};
|
322
|
+
|
323
|
+
$.fn.tipsy.autoWE = function() {
|
324
|
+
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
325
|
+
};
|
326
|
+
|
327
|
+
/**
|
328
|
+
* yields a closure of the supplied parameters, producing a function that takes
|
329
|
+
* no arguments and is suitable for use as an autogravity function like so:
|
330
|
+
*
|
331
|
+
* @param margin (int) - distance from the viewable region edge that an
|
332
|
+
* element should be before setting its tooltip's gravity to be away
|
333
|
+
* from that edge.
|
334
|
+
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
|
335
|
+
* if there are no viewable region edges effecting the tooltip's
|
336
|
+
* gravity. It will try to vary from this minimally, for example,
|
337
|
+
* if 'sw' is preferred and an element is near the right viewable
|
338
|
+
* region edge, but not the top edge, it will set the gravity for
|
339
|
+
* that element's tooltip to be 'se', preserving the southern
|
340
|
+
* component.
|
341
|
+
*/
|
342
|
+
$.fn.tipsy.autoBounds = function(margin, prefer) {
|
343
|
+
return function() {
|
344
|
+
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
|
345
|
+
boundTop = $(document).scrollTop() + margin,
|
346
|
+
boundLeft = $(document).scrollLeft() + margin,
|
347
|
+
$this = $(this);
|
348
|
+
|
349
|
+
if ($this.offset().top < boundTop) dir.ns = 'n';
|
350
|
+
if ($this.offset().left < boundLeft) dir.ew = 'w';
|
351
|
+
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
|
352
|
+
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
|
353
|
+
|
354
|
+
return dir.ns + (dir.ew ? dir.ew : '');
|
355
|
+
}
|
356
|
+
};
|
357
|
+
|
358
|
+
})(jQuery);
|