h2ocube_rails_assets 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +1 -0
- data/Vendorfile +196 -0
- data/h2ocube_rails_assets.gemspec +3 -4
- data/lib/h2ocube_rails_assets.rb +8 -6
- data/test/jquery_test.rb +1 -1
- data/test/turbolinks_test.rb +1 -3
- data/vendor/assets/images/jquery.fancybox/fancybox_loading.gif +0 -0
- data/vendor/assets/images/jquery.fancybox/fancybox_loading@2x.gif +0 -0
- data/vendor/assets/images/jquery.fancybox/fancybox_sprite@2x.png +0 -0
- data/vendor/assets/javascripts/backbone.js +4 -1571
- data/vendor/assets/javascripts/bootstrap.js +6 -2276
- data/vendor/assets/javascripts/highcharts.js +272 -15281
- data/vendor/assets/javascripts/jasny-bootstrap.js +7 -3060
- data/vendor/assets/javascripts/jquery/1.10.js +6 -9807
- data/vendor/assets/javascripts/jquery/1.8.js +2 -9472
- data/vendor/assets/javascripts/jquery/1.9.js +5 -9597
- data/vendor/assets/javascripts/jquery/2.0.js +5 -8841
- data/vendor/assets/javascripts/jquery.cookie.js +26 -23
- data/vendor/assets/javascripts/jquery.fancybox.js +46 -1983
- data/vendor/assets/javascripts/jquery.fileupload.js +1329 -4
- data/vendor/assets/javascripts/jquery.iframe-transport.js +24 -4
- data/vendor/assets/javascripts/jquery.js +1 -1
- data/vendor/assets/javascripts/jquery.lazyload.js +3 -216
- data/vendor/assets/javascripts/jquery.mobile.js +7 -11092
- data/vendor/assets/javascripts/jquery.pnotify.js +29 -903
- data/vendor/assets/javascripts/jquery.timeago.coffee +2 -4
- data/vendor/assets/javascripts/jquery.turbolinks.coffee +40 -51
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.accordion.js +4 -572
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.autocomplete.js +4 -610
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.button.js +4 -419
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.core.js +4 -320
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.datepicker.js +5 -2050
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.dialog.js +4 -808
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.draggable.js +4 -933
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.droppable.js +4 -372
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-blind.js +4 -82
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-bounce.js +4 -113
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-clip.js +4 -67
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-drop.js +4 -65
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-explode.js +4 -97
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-fade.js +4 -30
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-fold.js +4 -76
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-highlight.js +4 -50
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-pulsate.js +4 -63
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-scale.js +4 -318
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-shake.js +4 -74
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-slide.js +4 -64
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect-transfer.js +4 -47
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.effect.js +4 -1289
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.menu.js +4 -621
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.mouse.js +4 -169
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.position.js +4 -497
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.progressbar.js +4 -145
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.resizable.js +4 -968
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.selectable.js +4 -277
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.slider.js +4 -672
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.sortable.js +4 -1282
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.spinner.js +4 -493
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.tabs.js +4 -846
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.tooltip.js +4 -402
- data/vendor/assets/javascripts/jquery.ui/jquery.ui.widget.js +4 -521
- data/vendor/assets/javascripts/jquery.validate.js +2 -1207
- data/vendor/assets/javascripts/lazyload.js +4 -391
- data/vendor/assets/javascripts/sammy.js +5 -2117
- data/vendor/assets/javascripts/underscore.js +4 -1224
- data/vendor/assets/javascripts/zepto.js +1 -1564
- data/vendor/assets/stylesheets/bootstrap.responsive.css +2 -1102
- data/vendor/assets/stylesheets/bootstrap.scss +2 -6151
- data/vendor/assets/stylesheets/jasny-bootstrap.responsive.css +2 -1263
- data/vendor/assets/stylesheets/jasny-bootstrap.scss +2 -7591
- data/vendor/assets/stylesheets/jquery.fancybox.scss +27 -2
- data/vendor/assets/stylesheets/jquery.mobile.scss +2 -3356
- data/vendor/assets/stylesheets/jquery.ui.scss +2 -1184
- metadata +43 -19
- data/vendor/assets/images/jquery.mobile/ajax-loader.gif +0 -0
- data/vendor/assets/images/jquery.mobile/icons-18-black.png +0 -0
- data/vendor/assets/images/jquery.mobile/icons-18-white.png +0 -0
- data/vendor/assets/images/jquery.mobile/icons-36-black.png +0 -0
- data/vendor/assets/images/jquery.mobile/icons-36-white.png +0 -0
- data/vendor/assets/javascripts/_jquery.fileupload.js +0 -1164
- data/vendor/assets/javascripts/zepto/fx_methods.js +0 -71
@@ -1,621 +1,4 @@
|
|
1
|
-
/*!
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
* Copyright 2013 jQuery Foundation and other contributors
|
6
|
-
* Released under the MIT license.
|
7
|
-
* http://jquery.org/license
|
8
|
-
*
|
9
|
-
* http://api.jqueryui.com/menu/
|
10
|
-
*
|
11
|
-
* Depends:
|
12
|
-
* jquery.ui.core.js
|
13
|
-
* jquery.ui.widget.js
|
14
|
-
* jquery.ui.position.js
|
15
|
-
*/
|
16
|
-
(function( $, undefined ) {
|
17
|
-
|
18
|
-
$.widget( "ui.menu", {
|
19
|
-
version: "1.10.2",
|
20
|
-
defaultElement: "<ul>",
|
21
|
-
delay: 300,
|
22
|
-
options: {
|
23
|
-
icons: {
|
24
|
-
submenu: "ui-icon-carat-1-e"
|
25
|
-
},
|
26
|
-
menus: "ul",
|
27
|
-
position: {
|
28
|
-
my: "left top",
|
29
|
-
at: "right top"
|
30
|
-
},
|
31
|
-
role: "menu",
|
32
|
-
|
33
|
-
// callbacks
|
34
|
-
blur: null,
|
35
|
-
focus: null,
|
36
|
-
select: null
|
37
|
-
},
|
38
|
-
|
39
|
-
_create: function() {
|
40
|
-
this.activeMenu = this.element;
|
41
|
-
// flag used to prevent firing of the click handler
|
42
|
-
// as the event bubbles up through nested menus
|
43
|
-
this.mouseHandled = false;
|
44
|
-
this.element
|
45
|
-
.uniqueId()
|
46
|
-
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
47
|
-
.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
|
48
|
-
.attr({
|
49
|
-
role: this.options.role,
|
50
|
-
tabIndex: 0
|
51
|
-
})
|
52
|
-
// need to catch all clicks on disabled menu
|
53
|
-
// not possible through _on
|
54
|
-
.bind( "click" + this.eventNamespace, $.proxy(function( event ) {
|
55
|
-
if ( this.options.disabled ) {
|
56
|
-
event.preventDefault();
|
57
|
-
}
|
58
|
-
}, this ));
|
59
|
-
|
60
|
-
if ( this.options.disabled ) {
|
61
|
-
this.element
|
62
|
-
.addClass( "ui-state-disabled" )
|
63
|
-
.attr( "aria-disabled", "true" );
|
64
|
-
}
|
65
|
-
|
66
|
-
this._on({
|
67
|
-
// Prevent focus from sticking to links inside menu after clicking
|
68
|
-
// them (focus should always stay on UL during navigation).
|
69
|
-
"mousedown .ui-menu-item > a": function( event ) {
|
70
|
-
event.preventDefault();
|
71
|
-
},
|
72
|
-
"click .ui-state-disabled > a": function( event ) {
|
73
|
-
event.preventDefault();
|
74
|
-
},
|
75
|
-
"click .ui-menu-item:has(a)": function( event ) {
|
76
|
-
var target = $( event.target ).closest( ".ui-menu-item" );
|
77
|
-
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
|
78
|
-
this.mouseHandled = true;
|
79
|
-
|
80
|
-
this.select( event );
|
81
|
-
// Open submenu on click
|
82
|
-
if ( target.has( ".ui-menu" ).length ) {
|
83
|
-
this.expand( event );
|
84
|
-
} else if ( !this.element.is( ":focus" ) ) {
|
85
|
-
// Redirect focus to the menu
|
86
|
-
this.element.trigger( "focus", [ true ] );
|
87
|
-
|
88
|
-
// If the active item is on the top level, let it stay active.
|
89
|
-
// Otherwise, blur the active item since it is no longer visible.
|
90
|
-
if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
|
91
|
-
clearTimeout( this.timer );
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}
|
95
|
-
},
|
96
|
-
"mouseenter .ui-menu-item": function( event ) {
|
97
|
-
var target = $( event.currentTarget );
|
98
|
-
// Remove ui-state-active class from siblings of the newly focused menu item
|
99
|
-
// to avoid a jump caused by adjacent elements both having a class with a border
|
100
|
-
target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
|
101
|
-
this.focus( event, target );
|
102
|
-
},
|
103
|
-
mouseleave: "collapseAll",
|
104
|
-
"mouseleave .ui-menu": "collapseAll",
|
105
|
-
focus: function( event, keepActiveItem ) {
|
106
|
-
// If there's already an active item, keep it active
|
107
|
-
// If not, activate the first item
|
108
|
-
var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
|
109
|
-
|
110
|
-
if ( !keepActiveItem ) {
|
111
|
-
this.focus( event, item );
|
112
|
-
}
|
113
|
-
},
|
114
|
-
blur: function( event ) {
|
115
|
-
this._delay(function() {
|
116
|
-
if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
|
117
|
-
this.collapseAll( event );
|
118
|
-
}
|
119
|
-
});
|
120
|
-
},
|
121
|
-
keydown: "_keydown"
|
122
|
-
});
|
123
|
-
|
124
|
-
this.refresh();
|
125
|
-
|
126
|
-
// Clicks outside of a menu collapse any open menus
|
127
|
-
this._on( this.document, {
|
128
|
-
click: function( event ) {
|
129
|
-
if ( !$( event.target ).closest( ".ui-menu" ).length ) {
|
130
|
-
this.collapseAll( event );
|
131
|
-
}
|
132
|
-
|
133
|
-
// Reset the mouseHandled flag
|
134
|
-
this.mouseHandled = false;
|
135
|
-
}
|
136
|
-
});
|
137
|
-
},
|
138
|
-
|
139
|
-
_destroy: function() {
|
140
|
-
// Destroy (sub)menus
|
141
|
-
this.element
|
142
|
-
.removeAttr( "aria-activedescendant" )
|
143
|
-
.find( ".ui-menu" ).addBack()
|
144
|
-
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
|
145
|
-
.removeAttr( "role" )
|
146
|
-
.removeAttr( "tabIndex" )
|
147
|
-
.removeAttr( "aria-labelledby" )
|
148
|
-
.removeAttr( "aria-expanded" )
|
149
|
-
.removeAttr( "aria-hidden" )
|
150
|
-
.removeAttr( "aria-disabled" )
|
151
|
-
.removeUniqueId()
|
152
|
-
.show();
|
153
|
-
|
154
|
-
// Destroy menu items
|
155
|
-
this.element.find( ".ui-menu-item" )
|
156
|
-
.removeClass( "ui-menu-item" )
|
157
|
-
.removeAttr( "role" )
|
158
|
-
.removeAttr( "aria-disabled" )
|
159
|
-
.children( "a" )
|
160
|
-
.removeUniqueId()
|
161
|
-
.removeClass( "ui-corner-all ui-state-hover" )
|
162
|
-
.removeAttr( "tabIndex" )
|
163
|
-
.removeAttr( "role" )
|
164
|
-
.removeAttr( "aria-haspopup" )
|
165
|
-
.children().each( function() {
|
166
|
-
var elem = $( this );
|
167
|
-
if ( elem.data( "ui-menu-submenu-carat" ) ) {
|
168
|
-
elem.remove();
|
169
|
-
}
|
170
|
-
});
|
171
|
-
|
172
|
-
// Destroy menu dividers
|
173
|
-
this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
|
174
|
-
},
|
175
|
-
|
176
|
-
_keydown: function( event ) {
|
177
|
-
/*jshint maxcomplexity:20*/
|
178
|
-
var match, prev, character, skip, regex,
|
179
|
-
preventDefault = true;
|
180
|
-
|
181
|
-
function escape( value ) {
|
182
|
-
return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
|
183
|
-
}
|
184
|
-
|
185
|
-
switch ( event.keyCode ) {
|
186
|
-
case $.ui.keyCode.PAGE_UP:
|
187
|
-
this.previousPage( event );
|
188
|
-
break;
|
189
|
-
case $.ui.keyCode.PAGE_DOWN:
|
190
|
-
this.nextPage( event );
|
191
|
-
break;
|
192
|
-
case $.ui.keyCode.HOME:
|
193
|
-
this._move( "first", "first", event );
|
194
|
-
break;
|
195
|
-
case $.ui.keyCode.END:
|
196
|
-
this._move( "last", "last", event );
|
197
|
-
break;
|
198
|
-
case $.ui.keyCode.UP:
|
199
|
-
this.previous( event );
|
200
|
-
break;
|
201
|
-
case $.ui.keyCode.DOWN:
|
202
|
-
this.next( event );
|
203
|
-
break;
|
204
|
-
case $.ui.keyCode.LEFT:
|
205
|
-
this.collapse( event );
|
206
|
-
break;
|
207
|
-
case $.ui.keyCode.RIGHT:
|
208
|
-
if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
|
209
|
-
this.expand( event );
|
210
|
-
}
|
211
|
-
break;
|
212
|
-
case $.ui.keyCode.ENTER:
|
213
|
-
case $.ui.keyCode.SPACE:
|
214
|
-
this._activate( event );
|
215
|
-
break;
|
216
|
-
case $.ui.keyCode.ESCAPE:
|
217
|
-
this.collapse( event );
|
218
|
-
break;
|
219
|
-
default:
|
220
|
-
preventDefault = false;
|
221
|
-
prev = this.previousFilter || "";
|
222
|
-
character = String.fromCharCode( event.keyCode );
|
223
|
-
skip = false;
|
224
|
-
|
225
|
-
clearTimeout( this.filterTimer );
|
226
|
-
|
227
|
-
if ( character === prev ) {
|
228
|
-
skip = true;
|
229
|
-
} else {
|
230
|
-
character = prev + character;
|
231
|
-
}
|
232
|
-
|
233
|
-
regex = new RegExp( "^" + escape( character ), "i" );
|
234
|
-
match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
|
235
|
-
return regex.test( $( this ).children( "a" ).text() );
|
236
|
-
});
|
237
|
-
match = skip && match.index( this.active.next() ) !== -1 ?
|
238
|
-
this.active.nextAll( ".ui-menu-item" ) :
|
239
|
-
match;
|
240
|
-
|
241
|
-
// If no matches on the current filter, reset to the last character pressed
|
242
|
-
// to move down the menu to the first item that starts with that character
|
243
|
-
if ( !match.length ) {
|
244
|
-
character = String.fromCharCode( event.keyCode );
|
245
|
-
regex = new RegExp( "^" + escape( character ), "i" );
|
246
|
-
match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
|
247
|
-
return regex.test( $( this ).children( "a" ).text() );
|
248
|
-
});
|
249
|
-
}
|
250
|
-
|
251
|
-
if ( match.length ) {
|
252
|
-
this.focus( event, match );
|
253
|
-
if ( match.length > 1 ) {
|
254
|
-
this.previousFilter = character;
|
255
|
-
this.filterTimer = this._delay(function() {
|
256
|
-
delete this.previousFilter;
|
257
|
-
}, 1000 );
|
258
|
-
} else {
|
259
|
-
delete this.previousFilter;
|
260
|
-
}
|
261
|
-
} else {
|
262
|
-
delete this.previousFilter;
|
263
|
-
}
|
264
|
-
}
|
265
|
-
|
266
|
-
if ( preventDefault ) {
|
267
|
-
event.preventDefault();
|
268
|
-
}
|
269
|
-
},
|
270
|
-
|
271
|
-
_activate: function( event ) {
|
272
|
-
if ( !this.active.is( ".ui-state-disabled" ) ) {
|
273
|
-
if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
|
274
|
-
this.expand( event );
|
275
|
-
} else {
|
276
|
-
this.select( event );
|
277
|
-
}
|
278
|
-
}
|
279
|
-
},
|
280
|
-
|
281
|
-
refresh: function() {
|
282
|
-
var menus,
|
283
|
-
icon = this.options.icons.submenu,
|
284
|
-
submenus = this.element.find( this.options.menus );
|
285
|
-
|
286
|
-
// Initialize nested menus
|
287
|
-
submenus.filter( ":not(.ui-menu)" )
|
288
|
-
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
|
289
|
-
.hide()
|
290
|
-
.attr({
|
291
|
-
role: this.options.role,
|
292
|
-
"aria-hidden": "true",
|
293
|
-
"aria-expanded": "false"
|
294
|
-
})
|
295
|
-
.each(function() {
|
296
|
-
var menu = $( this ),
|
297
|
-
item = menu.prev( "a" ),
|
298
|
-
submenuCarat = $( "<span>" )
|
299
|
-
.addClass( "ui-menu-icon ui-icon " + icon )
|
300
|
-
.data( "ui-menu-submenu-carat", true );
|
301
|
-
|
302
|
-
item
|
303
|
-
.attr( "aria-haspopup", "true" )
|
304
|
-
.prepend( submenuCarat );
|
305
|
-
menu.attr( "aria-labelledby", item.attr( "id" ) );
|
306
|
-
});
|
307
|
-
|
308
|
-
menus = submenus.add( this.element );
|
309
|
-
|
310
|
-
// Don't refresh list items that are already adapted
|
311
|
-
menus.children( ":not(.ui-menu-item):has(a)" )
|
312
|
-
.addClass( "ui-menu-item" )
|
313
|
-
.attr( "role", "presentation" )
|
314
|
-
.children( "a" )
|
315
|
-
.uniqueId()
|
316
|
-
.addClass( "ui-corner-all" )
|
317
|
-
.attr({
|
318
|
-
tabIndex: -1,
|
319
|
-
role: this._itemRole()
|
320
|
-
});
|
321
|
-
|
322
|
-
// Initialize unlinked menu-items containing spaces and/or dashes only as dividers
|
323
|
-
menus.children( ":not(.ui-menu-item)" ).each(function() {
|
324
|
-
var item = $( this );
|
325
|
-
// hyphen, em dash, en dash
|
326
|
-
if ( !/[^\-\u2014\u2013\s]/.test( item.text() ) ) {
|
327
|
-
item.addClass( "ui-widget-content ui-menu-divider" );
|
328
|
-
}
|
329
|
-
});
|
330
|
-
|
331
|
-
// Add aria-disabled attribute to any disabled menu item
|
332
|
-
menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
|
333
|
-
|
334
|
-
// If the active item has been removed, blur the menu
|
335
|
-
if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
|
336
|
-
this.blur();
|
337
|
-
}
|
338
|
-
},
|
339
|
-
|
340
|
-
_itemRole: function() {
|
341
|
-
return {
|
342
|
-
menu: "menuitem",
|
343
|
-
listbox: "option"
|
344
|
-
}[ this.options.role ];
|
345
|
-
},
|
346
|
-
|
347
|
-
_setOption: function( key, value ) {
|
348
|
-
if ( key === "icons" ) {
|
349
|
-
this.element.find( ".ui-menu-icon" )
|
350
|
-
.removeClass( this.options.icons.submenu )
|
351
|
-
.addClass( value.submenu );
|
352
|
-
}
|
353
|
-
this._super( key, value );
|
354
|
-
},
|
355
|
-
|
356
|
-
focus: function( event, item ) {
|
357
|
-
var nested, focused;
|
358
|
-
this.blur( event, event && event.type === "focus" );
|
359
|
-
|
360
|
-
this._scrollIntoView( item );
|
361
|
-
|
362
|
-
this.active = item.first();
|
363
|
-
focused = this.active.children( "a" ).addClass( "ui-state-focus" );
|
364
|
-
// Only update aria-activedescendant if there's a role
|
365
|
-
// otherwise we assume focus is managed elsewhere
|
366
|
-
if ( this.options.role ) {
|
367
|
-
this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
|
368
|
-
}
|
369
|
-
|
370
|
-
// Highlight active parent menu item, if any
|
371
|
-
this.active
|
372
|
-
.parent()
|
373
|
-
.closest( ".ui-menu-item" )
|
374
|
-
.children( "a:first" )
|
375
|
-
.addClass( "ui-state-active" );
|
376
|
-
|
377
|
-
if ( event && event.type === "keydown" ) {
|
378
|
-
this._close();
|
379
|
-
} else {
|
380
|
-
this.timer = this._delay(function() {
|
381
|
-
this._close();
|
382
|
-
}, this.delay );
|
383
|
-
}
|
384
|
-
|
385
|
-
nested = item.children( ".ui-menu" );
|
386
|
-
if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
|
387
|
-
this._startOpening(nested);
|
388
|
-
}
|
389
|
-
this.activeMenu = item.parent();
|
390
|
-
|
391
|
-
this._trigger( "focus", event, { item: item } );
|
392
|
-
},
|
393
|
-
|
394
|
-
_scrollIntoView: function( item ) {
|
395
|
-
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
|
396
|
-
if ( this._hasScroll() ) {
|
397
|
-
borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
|
398
|
-
paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
|
399
|
-
offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
|
400
|
-
scroll = this.activeMenu.scrollTop();
|
401
|
-
elementHeight = this.activeMenu.height();
|
402
|
-
itemHeight = item.height();
|
403
|
-
|
404
|
-
if ( offset < 0 ) {
|
405
|
-
this.activeMenu.scrollTop( scroll + offset );
|
406
|
-
} else if ( offset + itemHeight > elementHeight ) {
|
407
|
-
this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
|
408
|
-
}
|
409
|
-
}
|
410
|
-
},
|
411
|
-
|
412
|
-
blur: function( event, fromFocus ) {
|
413
|
-
if ( !fromFocus ) {
|
414
|
-
clearTimeout( this.timer );
|
415
|
-
}
|
416
|
-
|
417
|
-
if ( !this.active ) {
|
418
|
-
return;
|
419
|
-
}
|
420
|
-
|
421
|
-
this.active.children( "a" ).removeClass( "ui-state-focus" );
|
422
|
-
this.active = null;
|
423
|
-
|
424
|
-
this._trigger( "blur", event, { item: this.active } );
|
425
|
-
},
|
426
|
-
|
427
|
-
_startOpening: function( submenu ) {
|
428
|
-
clearTimeout( this.timer );
|
429
|
-
|
430
|
-
// Don't open if already open fixes a Firefox bug that caused a .5 pixel
|
431
|
-
// shift in the submenu position when mousing over the carat icon
|
432
|
-
if ( submenu.attr( "aria-hidden" ) !== "true" ) {
|
433
|
-
return;
|
434
|
-
}
|
435
|
-
|
436
|
-
this.timer = this._delay(function() {
|
437
|
-
this._close();
|
438
|
-
this._open( submenu );
|
439
|
-
}, this.delay );
|
440
|
-
},
|
441
|
-
|
442
|
-
_open: function( submenu ) {
|
443
|
-
var position = $.extend({
|
444
|
-
of: this.active
|
445
|
-
}, this.options.position );
|
446
|
-
|
447
|
-
clearTimeout( this.timer );
|
448
|
-
this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
|
449
|
-
.hide()
|
450
|
-
.attr( "aria-hidden", "true" );
|
451
|
-
|
452
|
-
submenu
|
453
|
-
.show()
|
454
|
-
.removeAttr( "aria-hidden" )
|
455
|
-
.attr( "aria-expanded", "true" )
|
456
|
-
.position( position );
|
457
|
-
},
|
458
|
-
|
459
|
-
collapseAll: function( event, all ) {
|
460
|
-
clearTimeout( this.timer );
|
461
|
-
this.timer = this._delay(function() {
|
462
|
-
// If we were passed an event, look for the submenu that contains the event
|
463
|
-
var currentMenu = all ? this.element :
|
464
|
-
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
|
465
|
-
|
466
|
-
// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
|
467
|
-
if ( !currentMenu.length ) {
|
468
|
-
currentMenu = this.element;
|
469
|
-
}
|
470
|
-
|
471
|
-
this._close( currentMenu );
|
472
|
-
|
473
|
-
this.blur( event );
|
474
|
-
this.activeMenu = currentMenu;
|
475
|
-
}, this.delay );
|
476
|
-
},
|
477
|
-
|
478
|
-
// With no arguments, closes the currently active menu - if nothing is active
|
479
|
-
// it closes all menus. If passed an argument, it will search for menus BELOW
|
480
|
-
_close: function( startMenu ) {
|
481
|
-
if ( !startMenu ) {
|
482
|
-
startMenu = this.active ? this.active.parent() : this.element;
|
483
|
-
}
|
484
|
-
|
485
|
-
startMenu
|
486
|
-
.find( ".ui-menu" )
|
487
|
-
.hide()
|
488
|
-
.attr( "aria-hidden", "true" )
|
489
|
-
.attr( "aria-expanded", "false" )
|
490
|
-
.end()
|
491
|
-
.find( "a.ui-state-active" )
|
492
|
-
.removeClass( "ui-state-active" );
|
493
|
-
},
|
494
|
-
|
495
|
-
collapse: function( event ) {
|
496
|
-
var newItem = this.active &&
|
497
|
-
this.active.parent().closest( ".ui-menu-item", this.element );
|
498
|
-
if ( newItem && newItem.length ) {
|
499
|
-
this._close();
|
500
|
-
this.focus( event, newItem );
|
501
|
-
}
|
502
|
-
},
|
503
|
-
|
504
|
-
expand: function( event ) {
|
505
|
-
var newItem = this.active &&
|
506
|
-
this.active
|
507
|
-
.children( ".ui-menu " )
|
508
|
-
.children( ".ui-menu-item" )
|
509
|
-
.first();
|
510
|
-
|
511
|
-
if ( newItem && newItem.length ) {
|
512
|
-
this._open( newItem.parent() );
|
513
|
-
|
514
|
-
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
|
515
|
-
this._delay(function() {
|
516
|
-
this.focus( event, newItem );
|
517
|
-
});
|
518
|
-
}
|
519
|
-
},
|
520
|
-
|
521
|
-
next: function( event ) {
|
522
|
-
this._move( "next", "first", event );
|
523
|
-
},
|
524
|
-
|
525
|
-
previous: function( event ) {
|
526
|
-
this._move( "prev", "last", event );
|
527
|
-
},
|
528
|
-
|
529
|
-
isFirstItem: function() {
|
530
|
-
return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
|
531
|
-
},
|
532
|
-
|
533
|
-
isLastItem: function() {
|
534
|
-
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
|
535
|
-
},
|
536
|
-
|
537
|
-
_move: function( direction, filter, event ) {
|
538
|
-
var next;
|
539
|
-
if ( this.active ) {
|
540
|
-
if ( direction === "first" || direction === "last" ) {
|
541
|
-
next = this.active
|
542
|
-
[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
|
543
|
-
.eq( -1 );
|
544
|
-
} else {
|
545
|
-
next = this.active
|
546
|
-
[ direction + "All" ]( ".ui-menu-item" )
|
547
|
-
.eq( 0 );
|
548
|
-
}
|
549
|
-
}
|
550
|
-
if ( !next || !next.length || !this.active ) {
|
551
|
-
next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
|
552
|
-
}
|
553
|
-
|
554
|
-
this.focus( event, next );
|
555
|
-
},
|
556
|
-
|
557
|
-
nextPage: function( event ) {
|
558
|
-
var item, base, height;
|
559
|
-
|
560
|
-
if ( !this.active ) {
|
561
|
-
this.next( event );
|
562
|
-
return;
|
563
|
-
}
|
564
|
-
if ( this.isLastItem() ) {
|
565
|
-
return;
|
566
|
-
}
|
567
|
-
if ( this._hasScroll() ) {
|
568
|
-
base = this.active.offset().top;
|
569
|
-
height = this.element.height();
|
570
|
-
this.active.nextAll( ".ui-menu-item" ).each(function() {
|
571
|
-
item = $( this );
|
572
|
-
return item.offset().top - base - height < 0;
|
573
|
-
});
|
574
|
-
|
575
|
-
this.focus( event, item );
|
576
|
-
} else {
|
577
|
-
this.focus( event, this.activeMenu.children( ".ui-menu-item" )
|
578
|
-
[ !this.active ? "first" : "last" ]() );
|
579
|
-
}
|
580
|
-
},
|
581
|
-
|
582
|
-
previousPage: function( event ) {
|
583
|
-
var item, base, height;
|
584
|
-
if ( !this.active ) {
|
585
|
-
this.next( event );
|
586
|
-
return;
|
587
|
-
}
|
588
|
-
if ( this.isFirstItem() ) {
|
589
|
-
return;
|
590
|
-
}
|
591
|
-
if ( this._hasScroll() ) {
|
592
|
-
base = this.active.offset().top;
|
593
|
-
height = this.element.height();
|
594
|
-
this.active.prevAll( ".ui-menu-item" ).each(function() {
|
595
|
-
item = $( this );
|
596
|
-
return item.offset().top - base + height > 0;
|
597
|
-
});
|
598
|
-
|
599
|
-
this.focus( event, item );
|
600
|
-
} else {
|
601
|
-
this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
|
602
|
-
}
|
603
|
-
},
|
604
|
-
|
605
|
-
_hasScroll: function() {
|
606
|
-
return this.element.outerHeight() < this.element.prop( "scrollHeight" );
|
607
|
-
},
|
608
|
-
|
609
|
-
select: function( event ) {
|
610
|
-
// TODO: It should never be possible to not have an active item at this
|
611
|
-
// point, but the tests don't trigger mouseenter before click.
|
612
|
-
this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
|
613
|
-
var ui = { item: this.active };
|
614
|
-
if ( !this.active.has( ".ui-menu" ).length ) {
|
615
|
-
this.collapseAll( event, true );
|
616
|
-
}
|
617
|
-
this._trigger( "select", event, ui );
|
618
|
-
}
|
619
|
-
});
|
620
|
-
|
621
|
-
}( jQuery ));
|
1
|
+
/*! jQuery UI - v1.10.3 - 2013-05-03
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
|
4
|
+
(function(t){t.widget("ui.menu",{version:"1.10.3",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,t.proxy(function(t){this.options.disabled&&t.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(t){t.preventDefault()},"click .ui-state-disabled > a":function(t){t.preventDefault()},"click .ui-menu-item:has(a)":function(e){var i=t(e.target).closest(".ui-menu-item");!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.mouseHandled=!0,this.select(e),i.has(".ui-menu").length?this.expand(e):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){var i=t(e.currentTarget);i.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(e,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.children(".ui-menu-item").eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){t.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){t(e.target).closest(".ui-menu").length||this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var e=t(this);e.data("ui-menu-submenu-carat")&&e.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(e){function i(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,n,a,o,r,h=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:h=!1,n=this.previousFilter||"",a=String.fromCharCode(e.keyCode),o=!1,clearTimeout(this.filterTimer),a===n?o=!0:a=n+a,r=RegExp("^"+i(a),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())}),s=o&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(a=String.fromCharCode(e.keyCode),r=RegExp("^"+i(a),"i"),s=this.activeMenu.children(".ui-menu-item").filter(function(){return r.test(t(this).children("a").text())})),s.length?(this.focus(e,s),s.length>1?(this.previousFilter=a,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&e.preventDefault()},_activate:function(t){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i=this.options.icons.submenu,s=this.element.find(this.options.menus);s.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),s=e.prev("a"),n=t("<span>").addClass("ui-menu-icon ui-icon "+i).data("ui-menu-submenu-carat",!0);s.attr("aria-haspopup","true").prepend(n),e.attr("aria-labelledby",s.attr("id"))}),e=s.add(this.element),e.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),e.children(":not(.ui-menu-item)").each(function(){var e=t(this);/[^\-\u2014\u2013\s]/.test(e.text())||e.addClass("ui-widget-content ui-menu-divider")}),e.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){"icons"===t&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(e.submenu),this._super(t,e)},focus:function(t,e){var i,s;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=e.height(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",t,{item:this.active}))},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.children(".ui-menu-item")[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())),undefined):(this.next(e),undefined)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.children(".ui-menu-item").first())),undefined):(this.next(e),undefined)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)}})})(jQuery);
|