fume 0.6.7 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/CHANGELOG.md +7 -0
  2. data/VERSION +1 -1
  3. data/fume.gemspec +4 -1
  4. data/lib/fume/app_setting_loader.rb +13 -0
  5. data/lib/fume/authlogic.rb +1 -1
  6. data/lib/fume/cancan.rb +1 -1
  7. data/lib/fume/rails_ext.rb +16 -1
  8. data/lib/fume/railtie.rb +2 -2
  9. data/lib/fume/simple_nav.rb +49 -0
  10. data/lib/fume.rb +2 -1
  11. metadata +42 -64
  12. data/lib/fume/simple_theme.rb +0 -59
  13. data/rails_generators/fume/simple_theme/simple_theme_gen.rb +0 -9
  14. data/rails_generators/fume/simple_theme/templates/public/stylesheets/reset.css +0 -89
  15. data/rails_generators/fume/simple_theme/templates/public/stylesheets/reset.less +0 -1
  16. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/demo.html +0 -513
  17. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/simple-theme-ie-patch.js +0 -19
  18. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/simple-theme.css +0 -864
  19. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/simple-theme.less +0 -539
  20. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/src/base.less +0 -9
  21. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/src/function.less +0 -17
  22. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/src/layout.less +0 -432
  23. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/src/reset.less +0 -18
  24. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/src/vendor/yui-3.0/base.css +0 -80
  25. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/src/vendor/yui-3.0/fonts.css +0 -47
  26. data/rails_generators/fume/simple_theme/templates/public/themes/simple_theme/src/vendor/yui-3.0/reset.css +0 -126
  27. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-1.4.2.js +0 -6240
  28. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.js +0 -10921
  29. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_flat_30_cccccc_40x100.png +0 -0
  30. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_flat_50_5c5c5c_40x100.png +0 -0
  31. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_glass_20_555555_1x400.png +0 -0
  32. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_glass_40_0078a3_1x400.png +0 -0
  33. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_glass_40_ffc73d_1x400.png +0 -0
  34. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
  35. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_highlight-soft_80_eeeeee_1x100.png +0 -0
  36. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_inset-soft_25_000000_1x100.png +0 -0
  37. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-bg_inset-soft_30_f58400_1x100.png +0 -0
  38. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-icons_222222_256x240.png +0 -0
  39. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-icons_4b8e0b_256x240.png +0 -0
  40. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-icons_a83300_256x240.png +0 -0
  41. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-icons_cccccc_256x240.png +0 -0
  42. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness/ui-icons_ffffff_256x240.png +0 -0
  43. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-1.8.ui-darkness.css +0 -480
  44. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery-ui-i18n-1.8.js +0 -1176
  45. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.ba-bbq-1.2.1.js +0 -1137
  46. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.corner-2.09.js +0 -239
  47. data/rails_generators/fume/simple_theme/templates/public/themes/vendor/jquery.timepicker-0.2.1.js +0 -413
@@ -1,239 +0,0 @@
1
- /*!
2
- * jQuery corner plugin: simple corner rounding
3
- * Examples and documentation at: http://jquery.malsup.com/corner/
4
- * version 2.09 (11-MAR-2010)
5
- * Requires jQuery v1.3.2 or later
6
- * Dual licensed under the MIT and GPL licenses:
7
- * http://www.opensource.org/licenses/mit-license.php
8
- * http://www.gnu.org/licenses/gpl.html
9
- * Authors: Dave Methvin and Mike Alsup
10
- */
11
-
12
- /**
13
- * corner() takes a single string argument: $('#myDiv').corner("effect corners width")
14
- *
15
- * effect: name of the effect to apply, such as round, bevel, notch, bite, etc (default is round).
16
- * corners: one or more of: top, bottom, tr, tl, br, or bl. (default is all corners)
17
- * width: width of the effect; in the case of rounded corners this is the radius.
18
- * specify this value using the px suffix such as 10px (yes, it must be pixels).
19
- */
20
- ;(function($) {
21
-
22
- var style = document.createElement('div').style;
23
- var moz = style['MozBorderRadius'] !== undefined;
24
- var webkit = style['WebkitBorderRadius'] !== undefined;
25
- var radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined;
26
- var mode = document.documentMode || 0;
27
- var noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
28
-
29
- var expr = $.browser.msie && (function() {
30
- var div = document.createElement('div');
31
- try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
32
- catch(e) { return false; }
33
- return true;
34
- })();
35
-
36
- function sz(el, p) {
37
- return parseInt($.css(el,p))||0;
38
- };
39
- function hex2(s) {
40
- var s = parseInt(s).toString(16);
41
- return ( s.length < 2 ) ? '0'+s : s;
42
- };
43
- function gpc(node) {
44
- while(node) {
45
- var v = $.css(node,'backgroundColor');
46
- if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
47
- if (v.indexOf('rgb') >= 0) {
48
- var rgb = v.match(/\d+/g);
49
- return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
50
- }
51
- return v;
52
- }
53
- node = node.parentNode; // keep walking if transparent
54
- }
55
- return '#ffffff';
56
- };
57
-
58
- function getWidth(fx, i, width) {
59
- switch(fx) {
60
- case 'round': return Math.round(width*(1-Math.cos(Math.asin(i/width))));
61
- case 'cool': return Math.round(width*(1+Math.cos(Math.asin(i/width))));
62
- case 'sharp': return Math.round(width*(1-Math.cos(Math.acos(i/width))));
63
- case 'bite': return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
64
- case 'slide': return Math.round(width*(Math.atan2(i,width/i)));
65
- case 'jut': return Math.round(width*(Math.atan2(width,(width-i-1))));
66
- case 'curl': return Math.round(width*(Math.atan(i)));
67
- case 'tear': return Math.round(width*(Math.cos(i)));
68
- case 'wicked': return Math.round(width*(Math.tan(i)));
69
- case 'long': return Math.round(width*(Math.sqrt(i)));
70
- case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
71
- case 'dogfold':
72
- case 'dog': return (i&1) ? (i+1) : width;
73
- case 'dog2': return (i&2) ? (i+1) : width;
74
- case 'dog3': return (i&3) ? (i+1) : width;
75
- case 'fray': return (i%2)*width;
76
- case 'notch': return width;
77
- case 'bevelfold':
78
- case 'bevel': return i+1;
79
- }
80
- };
81
-
82
- $.fn.corner = function(options) {
83
- // in 1.3+ we can fix mistakes with the ready state
84
- if (this.length == 0) {
85
- if (!$.isReady && this.selector) {
86
- var s = this.selector, c = this.context;
87
- $(function() {
88
- $(s,c).corner(options);
89
- });
90
- }
91
- return this;
92
- }
93
-
94
- return this.each(function(index){
95
- var $this = $(this);
96
- // meta values override options
97
- var o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase();
98
- var keep = /keep/.test(o); // keep borders?
99
- var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]); // corner color
100
- var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]); // strip color
101
- var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width
102
- var re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/;
103
- var fx = ((o.match(re)||['round'])[0]);
104
- var fold = /dogfold|bevelfold/.test(o);
105
- var edges = { T:0, B:1 };
106
- var opts = {
107
- TL: /top|tl|left/.test(o), TR: /top|tr|right/.test(o),
108
- BL: /bottom|bl|left/.test(o), BR: /bottom|br|right/.test(o)
109
- };
110
- if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
111
- opts = { TL:1, TR:1, BL:1, BR:1 };
112
-
113
- // support native rounding
114
- if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
115
- if (opts.TL)
116
- $this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
117
- if (opts.TR)
118
- $this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
119
- if (opts.BL)
120
- $this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
121
- if (opts.BR)
122
- $this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
123
- return;
124
- }
125
-
126
- var strip = document.createElement('div');
127
- $(strip).css({
128
- overflow: 'hidden',
129
- height: '1px',
130
- minHeight: '1px',
131
- fontSize: '1px',
132
- backgroundColor: sc || 'transparent',
133
- borderStyle: 'solid'
134
- });
135
-
136
- var pad = {
137
- T: parseInt($.css(this,'paddingTop'))||0, R: parseInt($.css(this,'paddingRight'))||0,
138
- B: parseInt($.css(this,'paddingBottom'))||0, L: parseInt($.css(this,'paddingLeft'))||0
139
- };
140
-
141
- if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
142
- if (!keep) this.style.border = 'none';
143
- strip.style.borderColor = cc || gpc(this.parentNode);
144
- var cssHeight = $(this).outerHeight();
145
-
146
- for (var j in edges) {
147
- var bot = edges[j];
148
- // only add stips if needed
149
- if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
150
- strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
151
- var d = document.createElement('div');
152
- $(d).addClass('jquery-corner');
153
- var ds = d.style;
154
-
155
- bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);
156
-
157
- if (bot && cssHeight != 'auto') {
158
- if ($.css(this,'position') == 'static')
159
- this.style.position = 'relative';
160
- ds.position = 'absolute';
161
- ds.bottom = ds.left = ds.padding = ds.margin = '0';
162
- if (expr)
163
- ds.setExpression('width', 'this.parentNode.offsetWidth');
164
- else
165
- ds.width = '100%';
166
- }
167
- else if (!bot && $.browser.msie) {
168
- if ($.css(this,'position') == 'static')
169
- this.style.position = 'relative';
170
- ds.position = 'absolute';
171
- ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
172
-
173
- // fix ie6 problem when blocked element has a border width
174
- if (expr) {
175
- var bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
176
- ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
177
- }
178
- else
179
- ds.width = '100%';
180
- }
181
- else {
182
- ds.position = 'relative';
183
- ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' :
184
- (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';
185
- }
186
-
187
- for (var i=0; i < width; i++) {
188
- var w = Math.max(0,getWidth(fx,i, width));
189
- var e = strip.cloneNode(false);
190
- e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
191
- bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
192
- }
193
-
194
- if (fold && $.support.boxModel) {
195
- if (bot && noBottomFold) continue;
196
- for (var c in opts) {
197
- if (!opts[c]) continue;
198
- if (bot && (c == 'TL' || c == 'TR')) continue;
199
- if (!bot && (c == 'BL' || c == 'BR')) continue;
200
-
201
- var common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
202
- var $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
203
- switch(c) {
204
- case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
205
- case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
206
- case 'BL': $horz.css({ top: 0, left: 0 }); break;
207
- case 'BR': $horz.css({ top: 0, right: 0 }); break;
208
- }
209
- d.appendChild($horz[0]);
210
-
211
- var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
212
- switch(c) {
213
- case 'TL': $vert.css({ left: width }); break;
214
- case 'TR': $vert.css({ right: width }); break;
215
- case 'BL': $vert.css({ left: width }); break;
216
- case 'BR': $vert.css({ right: width }); break;
217
- }
218
- d.appendChild($vert[0]);
219
- }
220
- }
221
- }
222
- }
223
- });
224
- };
225
-
226
- $.fn.uncorner = function() {
227
- if (radius || moz || webkit)
228
- this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
229
- $('div.jquery-corner', this).remove();
230
- return this;
231
- };
232
-
233
- // expose options
234
- $.fn.corner.defaults = {
235
- useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
236
- metaAttr: 'data-corner' // name of meta attribute to use for options
237
- };
238
-
239
- })(jQuery);
@@ -1,413 +0,0 @@
1
- /*!
2
- * jQuery UI Timepicker 0.2.1
3
- *
4
- * Copyright (c) 2009 Martin Milesich (http://milesich.com/)
5
- *
6
- * Some parts are
7
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
8
- *
9
- * $Id: timepicker.js 28 2009-08-11 20:31:23Z majlo $
10
- *
11
- * Depends:
12
- * ui.core.js
13
- * ui.datepicker.js
14
- * ui.slider.js
15
- */
16
- (function($) {
17
-
18
- /**
19
- * Extending default values
20
- */
21
- $.extend($.datepicker._defaults, {
22
- 'stepMinutes': 1, // Number of minutes to step up/down
23
- 'stepHours': 1, // Number of hours to step up/down
24
- 'time24h': false, // True if 24h time
25
- 'showTime': false, // Show timepicker with datepicker
26
- 'altTimeField': '' // Selector for an alternate field to store time into
27
- });
28
-
29
- /**
30
- * _hideDatepicker must be called with null
31
- */
32
- $.datepicker._connectDatepickerOverride = $.datepicker._connectDatepicker;
33
- $.datepicker._connectDatepicker = function(target, inst) {
34
- $.datepicker._connectDatepickerOverride(target, inst);
35
-
36
- // showButtonPanel is required with timepicker
37
- if (this._get(inst, 'showTime')) {
38
- inst.settings['showButtonPanel'] = true;
39
- }
40
-
41
- var showOn = this._get(inst, 'showOn');
42
-
43
- if (showOn == 'button' || showOn == 'both') {
44
- // Unbind all click events
45
- inst.trigger.unbind('click');
46
-
47
- // Bind new click event
48
- inst.trigger.click(function() {
49
- if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target)
50
- $.datepicker._hideDatepicker(null); // This override is all about the "null"
51
- else
52
- $.datepicker._showDatepicker(target);
53
- return false;
54
- });
55
- }
56
- };
57
-
58
- /**
59
- * Datepicker does not have an onShow event so I need to create it.
60
- * What I actually doing here is copying original _showDatepicker
61
- * method to _showDatepickerOverload method.
62
- */
63
- $.datepicker._showDatepickerOverride = $.datepicker._showDatepicker;
64
- $.datepicker._showDatepicker = function (input) {
65
- // Call the original method which will show the datepicker
66
- $.datepicker._showDatepickerOverride(input);
67
-
68
- input = input.target || input;
69
-
70
- // find from button/image trigger
71
- if (input.nodeName.toLowerCase() != 'input') input = $('input', input.parentNode)[0];
72
-
73
- // Do not show timepicker if datepicker is disabled
74
- if ($.datepicker._isDisabledDatepicker(input)) return;
75
-
76
- // Get instance to datepicker
77
- var inst = $.datepicker._getInst(input);
78
-
79
- var showTime = $.datepicker._get(inst, 'showTime');
80
-
81
- // If showTime = True show the timepicker
82
- if (showTime) $.timepicker.show(input);
83
- };
84
-
85
- /**
86
- * Same as above. Here I need to extend the _checkExternalClick method
87
- * because I don't want to close the datepicker when the sliders get focus.
88
- */
89
- $.datepicker._checkExternalClickOverride = $.datepicker._checkExternalClick;
90
- $.datepicker._checkExternalClick = function (event) {
91
- if (!$.datepicker._curInst) return;
92
- var $target = $(event.target);
93
-
94
- if (($target.parents('#' + $.timepicker._mainDivId).length == 0)) {
95
- $.datepicker._checkExternalClickOverride(event);
96
- }
97
- };
98
-
99
- /**
100
- * Datepicker has onHide event but I just want to make it simple for you
101
- * so I hide the timepicker when datepicker hides.
102
- */
103
- $.datepicker._hideDatepickerOverride = $.datepicker._hideDatepicker;
104
- $.datepicker._hideDatepicker = function(input, duration) {
105
- // Some lines from the original method
106
- var inst = this._curInst;
107
-
108
- if (!inst || (input && inst != $.data(input, PROP_NAME))) return;
109
-
110
- // Get the value of showTime property
111
- var showTime = this._get(inst, 'showTime');
112
-
113
- if (input === undefined && showTime) {
114
- if (inst.input) {
115
- inst.input.val(this._formatDate(inst));
116
- inst.input.trigger('change'); // fire the change event
117
- }
118
-
119
- this._updateAlternate(inst);
120
-
121
- if (showTime) $.timepicker.update(this._formatDate(inst));
122
- }
123
-
124
- // Hide datepicker
125
- $.datepicker._hideDatepickerOverride(input, duration);
126
-
127
- // Hide the timepicker if enabled
128
- if (showTime) {
129
- $.timepicker.hide();
130
- }
131
- };
132
-
133
- /**
134
- * This is a complete replacement of the _selectDate method.
135
- * If showed with timepicker do not close when date is selected.
136
- */
137
- $.datepicker._selectDate = function(id, dateStr) {
138
- var target = $(id);
139
- var inst = this._getInst(target[0]);
140
- var showTime = this._get(inst, 'showTime');
141
- dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
142
- if (!showTime) {
143
- if (inst.input)
144
- inst.input.val(dateStr);
145
- this._updateAlternate(inst);
146
- }
147
- var onSelect = this._get(inst, 'onSelect');
148
- if (onSelect)
149
- onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
150
- else if (inst.input && !showTime)
151
- inst.input.trigger('change'); // fire the change event
152
- if (inst.inline)
153
- this._updateDatepicker(inst);
154
- else if (!inst.stayOpen) {
155
- if (showTime) {
156
- this._updateDatepicker(inst);
157
- } else {
158
- this._hideDatepicker(null, this._get(inst, 'duration'));
159
- this._lastInput = inst.input[0];
160
- if (typeof(inst.input[0]) != 'object')
161
- inst.input[0].focus(); // restore focus
162
- this._lastInput = null;
163
- }
164
- }
165
- };
166
-
167
- /**
168
- * We need to resize the timepicker when the datepicker has been changed.
169
- */
170
- $.datepicker._updateDatepickerOverride = $.datepicker._updateDatepicker;
171
- $.datepicker._updateDatepicker = function(inst) {
172
- $.datepicker._updateDatepickerOverride(inst);
173
- $.timepicker.resize();
174
- };
175
-
176
- function Timepicker() {}
177
-
178
- Timepicker.prototype = {
179
- init: function()
180
- {
181
- this._mainDivId = 'ui-timepicker-div';
182
- this._inputId = null;
183
- this._orgValue = null;
184
- this._orgHour = null;
185
- this._orgMinute = null;
186
- this._colonPos = -1;
187
- this._visible = false;
188
- this.tpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible" style="width: 100px; display: none; position: absolute;"></div>');
189
- this._generateHtml();
190
- },
191
-
192
- show: function (input)
193
- {
194
- // Get instance to datepicker
195
- var inst = $.datepicker._getInst(input);
196
-
197
- this._time24h = $.datepicker._get(inst, 'time24h');
198
- this._altTimeField = $.datepicker._get(inst, 'altTimeField');
199
-
200
- var stepMinutes = parseInt($.datepicker._get(inst, 'stepMinutes'), 10) || 1;
201
- var stepHours = parseInt($.datepicker._get(inst, 'stepHours'), 10) || 1;
202
-
203
- if (60 % stepMinutes != 0) { stepMinutes = 1; }
204
- if (24 % stepHours != 0) { stepHours = 1; }
205
-
206
- $('#hourSlider').slider('option', 'max', 24 - stepHours);
207
- $('#hourSlider').slider('option', 'step', stepHours);
208
-
209
- $('#minuteSlider').slider('option', 'max', 60 - stepMinutes);
210
- $('#minuteSlider').slider('option', 'step', stepMinutes);
211
-
212
- this._inputId = input.id;
213
-
214
- if (!this._visible) {
215
- this._parseTime();
216
- this._orgValue = $('#' + this._inputId).val();
217
- }
218
-
219
- this.resize();
220
-
221
- $('#' + this._mainDivId).show();
222
-
223
- this._visible = true;
224
-
225
- var dpDiv = $('#' + $.datepicker._mainDivId);
226
- var dpDivPos = dpDiv.position();
227
-
228
- var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
229
- var tpRight = this.tpDiv.offset().left + this.tpDiv.outerWidth();
230
-
231
- if (tpRight > viewWidth) {
232
- dpDiv.css('left', dpDivPos.left - (tpRight - viewWidth) - 5);
233
- this.tpDiv.css('left', dpDiv.offset().left + dpDiv.outerWidth() + 'px');
234
- }
235
- },
236
-
237
- update: function (fd)
238
- {
239
- var curTime = $('#' + this._mainDivId + ' span.fragHours').text()
240
- + ':'
241
- + $('#' + this._mainDivId + ' span.fragMinutes').text();
242
-
243
- if (!this._time24h) {
244
- curTime += ' ' + $('#' + this._mainDivId + ' span.fragAmpm').text();
245
- }
246
-
247
- var curDate = $('#' + this._inputId).val();
248
-
249
- $('#' + this._inputId).val(fd + ' ' + curTime);
250
-
251
- if (this._altTimeField) {
252
- $(this._altTimeField).each(function() { $(this).val(curTime); });
253
- }
254
- },
255
-
256
- hide: function ()
257
- {
258
- this._visible = false;
259
- $('#' + this._mainDivId).hide();
260
- },
261
-
262
- resize: function ()
263
- {
264
- var dpDiv = $('#' + $.datepicker._mainDivId);
265
- var dpDivPos = dpDiv.position();
266
-
267
- var hdrHeight = $('#' + $.datepicker._mainDivId + ' > div.ui-datepicker-header:first-child').height();
268
-
269
- $('#' + this._mainDivId + ' > div.ui-datepicker-header:first-child').css('height', hdrHeight);
270
-
271
- this.tpDiv.css({
272
- 'height': dpDiv.height(),
273
- 'top' : dpDivPos.top,
274
- 'left' : dpDivPos.left + dpDiv.outerWidth() + 'px'
275
- });
276
-
277
- $('#hourSlider').css('height', this.tpDiv.height() - (3.5 * hdrHeight));
278
- $('#minuteSlider').css('height', this.tpDiv.height() - (3.5 * hdrHeight));
279
- },
280
-
281
- _generateHtml: function ()
282
- {
283
- var html = '';
284
-
285
- html += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">';
286
- html += '<div class="ui-datepicker-title" style="margin:0">';
287
- html += '<span class="fragHours">08</span><span class="delim">:</span><span class="fragMinutes">45</span> <span class="fragAmpm"></span></div></div><table>';
288
- html += '<tr><th>Hour</th><th>Minute</th></tr>';
289
- html += '<tr><td align="center"><div id="hourSlider" class="slider"></div></td><td align="center"><div id="minuteSlider" class="slider"></div></td></tr>';
290
- html += '</table>';
291
-
292
- this.tpDiv.empty().append(html);
293
- $('body').append(this.tpDiv);
294
-
295
- var self = this;
296
-
297
- $('#hourSlider').slider({
298
- orientation: "vertical",
299
- range: 'min',
300
- min: 0,
301
- max: 23,
302
- step: 1,
303
- slide: function(event, ui) {
304
- self._writeTime('hour', ui.value);
305
- },
306
- stop: function(event, ui) {
307
- $('#' + self._inputId).focus();
308
- }
309
- });
310
-
311
- $('#minuteSlider').slider({
312
- orientation: "vertical",
313
- range: 'min',
314
- min: 0,
315
- max: 59,
316
- step: 1,
317
- slide: function(event, ui) {
318
- self._writeTime('minute', ui.value);
319
- },
320
- stop: function(event, ui) {
321
- $('#' + self._inputId).focus();
322
- }
323
- });
324
-
325
- $('#hourSlider > a').css('padding', 0);
326
- $('#minuteSlider > a').css('padding', 0);
327
- },
328
-
329
- _writeTime: function (type, value)
330
- {
331
- if (type == 'hour') {
332
- if (!this._time24h) {
333
- if (value < 12) {
334
- $('#' + this._mainDivId + ' span.fragAmpm').text('am');
335
- } else {
336
- $('#' + this._mainDivId + ' span.fragAmpm').text('pm');
337
- value -= 12;
338
- }
339
-
340
- if (value == 0) value = 12;
341
- } else {
342
- $('#' + this._mainDivId + ' span.fragAmpm').text('');
343
- }
344
-
345
- if (value < 10) value = '0' + value;
346
- $('#' + this._mainDivId + ' span.fragHours').text(value);
347
- }
348
-
349
- if (type == 'minute') {
350
- if (value < 10) value = '0' + value;
351
- $('#' + this._mainDivId + ' span.fragMinutes').text(value);
352
- }
353
- },
354
-
355
- _parseTime: function ()
356
- {
357
- var dt = $('#' + this._inputId).val();
358
-
359
- this._colonPos = dt.search(':');
360
-
361
- var m = 0, h = 0, a = '';
362
-
363
- if (this._colonPos != -1) {
364
- h = parseInt(dt.substr(this._colonPos - 2, 2), 10);
365
- m = parseInt(dt.substr(this._colonPos + 1, 2), 10);
366
- a = jQuery.trim(dt.substr(this._colonPos + 3, 3));
367
- }
368
-
369
- a = a.toLowerCase();
370
-
371
- if (a != 'am' && a != 'pm') {
372
- a = '';
373
- }
374
-
375
- if (h < 0) h = 0;
376
- if (m < 0) m = 0;
377
-
378
- if (h > 23) h = 23;
379
- if (m > 59) m = 59;
380
-
381
- if (a == 'pm' && h < 12) h += 12;
382
- if (a == 'am' && h == 12) h = 0;
383
-
384
- this._setTime('hour', h);
385
- this._setTime('minute', m);
386
-
387
- this._orgHour = h;
388
- this._orgMinute = m;
389
- },
390
-
391
- _setTime: function (type, value)
392
- {
393
- if (isNaN(value)) value = 0;
394
- if (value < 0) value = 0;
395
- if (value > 23 && type == 'hour') value = 23;
396
- if (value > 59 && type == 'minute') value = 59;
397
-
398
- if (type == 'hour') {
399
- $('#hourSlider').slider('value', value);
400
- }
401
-
402
- if (type == 'minute') {
403
- $('#minuteSlider').slider('value', value);
404
- }
405
-
406
- this._writeTime(type, value);
407
- }
408
- };
409
-
410
- $.timepicker = new Timepicker();
411
- $('document').ready(function () {$.timepicker.init();});
412
-
413
- })(jQuery);