blocks 3.0.0.rc4 → 3.0.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -2
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.rdoc +7 -0
- data/Gemfile +10 -3
- data/README.md +25 -9
- data/_config.yml +20 -0
- data/bin/deploy_docs +2 -0
- data/docs/.gitignore +4 -0
- data/docs/404.html +23 -0
- data/docs/_includes/acknowledgements.md +13 -0
- data/docs/_includes/caller-id.md +3 -0
- data/docs/_includes/configuration.md +3 -0
- data/docs/_includes/custom-builders.md +3 -0
- data/docs/_includes/defining.md +615 -0
- data/docs/_includes/demos/hooks-and-wrappers-output.html +109 -0
- data/docs/_includes/hooks.md +1156 -0
- data/docs/_includes/installation.md +25 -0
- data/docs/_includes/introduction.md +18 -0
- data/docs/_includes/option-merging.md +5 -0
- data/docs/_includes/rendering.md +622 -0
- data/docs/_includes/reserved-keywords.md +59 -0
- data/docs/_includes/skipping.md +403 -0
- data/docs/_includes/slate/assets.html +34 -0
- data/docs/_includes/slate/language-tabs.html +11 -0
- data/docs/_includes/templating.md +48 -0
- data/docs/_includes/templating/bootstrap_4_cards.md +753 -0
- data/docs/_includes/use-cases.md +23 -0
- data/docs/_includes/wip.md +34 -0
- data/docs/_includes/wrappers.md +629 -0
- data/docs/_layouts/slate.html +75 -0
- data/docs/_plugins/gem_version.rb +11 -0
- data/docs/_plugins/highlight_with_div.rb +25 -0
- data/docs/_sass/_default_styling.scss +627 -0
- data/docs/_sass/_icon-font.scss +26 -0
- data/docs/_sass/_normalize.scss +427 -0
- data/docs/_sass/_styling_overrides.scss +31 -0
- data/docs/_sass/_syntax.scss +78 -0
- data/docs/_sass/_variable_overrides.scss +10 -0
- data/docs/_sass/_variables.scss +105 -0
- data/docs/assets/javascripts/script.js +18 -0
- data/docs/assets/stylesheets/formChanges.less +106 -0
- data/docs/assets/stylesheets/style.css +46 -0
- data/docs/fonts/slate.eot +0 -0
- data/docs/fonts/slate.svg +14 -0
- data/docs/fonts/slate.ttf +0 -0
- data/docs/fonts/slate.woff +0 -0
- data/docs/fonts/slate.woff2 +0 -0
- data/docs/hooks.html +149 -0
- data/docs/hooks_and_wrappers_demo.html +313 -0
- data/docs/images/favicon.ico +0 -0
- data/docs/images/logo.png +0 -0
- data/docs/images/navbar.png +0 -0
- data/docs/images/placeholder.jpg +0 -0
- data/docs/images/render_strategies.png +0 -0
- data/docs/images/templating.png +0 -0
- data/docs/index.md +32 -0
- data/docs/javascripts/all.js +4 -0
- data/docs/javascripts/all_nosearch.js +3 -0
- data/docs/javascripts/app/lang.js +166 -0
- data/docs/javascripts/app/search.js +75 -0
- data/docs/javascripts/app/toc.js +57 -0
- data/docs/javascripts/demos/hooks_and_wrappers.js +9 -0
- data/docs/javascripts/lib/energize.js +169 -0
- data/docs/javascripts/lib/imagesloaded.min.js +7 -0
- data/docs/javascripts/lib/jquery.highlight.js +108 -0
- data/docs/javascripts/lib/jquery.js +9831 -0
- data/docs/javascripts/lib/jquery.tocify.js +1042 -0
- data/docs/javascripts/lib/jquery_ui.js +566 -0
- data/docs/javascripts/lib/lunr.js +1910 -0
- data/docs/stylesheets/demos/hooks_and_wrappers.scss +32 -0
- data/docs/stylesheets/print.scss +150 -0
- data/docs/stylesheets/screen.scss +10 -0
- data/lib/blocks/action_view_extensions/view_extensions.rb +1 -0
- data/lib/blocks/renderers/renderer.rb +1 -0
- data/lib/blocks/renderers/runtime_context.rb +30 -17
- data/lib/blocks/utilities/hash_with_render_strategy.rb +3 -0
- data/lib/blocks/version.rb +1 -1
- metadata +70 -2
@@ -0,0 +1,566 @@
|
|
1
|
+
/*! jQuery UI - v1.11.3 - 2015-02-12
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Includes: widget.js
|
4
|
+
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
|
5
|
+
|
6
|
+
(function( factory ) {
|
7
|
+
if ( typeof define === "function" && define.amd ) {
|
8
|
+
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define([ "jquery" ], factory );
|
11
|
+
} else {
|
12
|
+
|
13
|
+
// Browser globals
|
14
|
+
factory( jQuery );
|
15
|
+
}
|
16
|
+
}(function( $ ) {
|
17
|
+
/*!
|
18
|
+
* jQuery UI Widget 1.11.3
|
19
|
+
* http://jqueryui.com
|
20
|
+
*
|
21
|
+
* Copyright jQuery Foundation and other contributors
|
22
|
+
* Released under the MIT license.
|
23
|
+
* http://jquery.org/license
|
24
|
+
*
|
25
|
+
* http://api.jqueryui.com/jQuery.widget/
|
26
|
+
*/
|
27
|
+
|
28
|
+
|
29
|
+
var widget_uuid = 0,
|
30
|
+
widget_slice = Array.prototype.slice;
|
31
|
+
|
32
|
+
$.cleanData = (function( orig ) {
|
33
|
+
return function( elems ) {
|
34
|
+
var events, elem, i;
|
35
|
+
for ( i = 0; (elem = elems[i]) != null; i++ ) {
|
36
|
+
try {
|
37
|
+
|
38
|
+
// Only trigger remove when necessary to save time
|
39
|
+
events = $._data( elem, "events" );
|
40
|
+
if ( events && events.remove ) {
|
41
|
+
$( elem ).triggerHandler( "remove" );
|
42
|
+
}
|
43
|
+
|
44
|
+
// http://bugs.jquery.com/ticket/8235
|
45
|
+
} catch ( e ) {}
|
46
|
+
}
|
47
|
+
orig( elems );
|
48
|
+
};
|
49
|
+
})( $.cleanData );
|
50
|
+
|
51
|
+
$.widget = function( name, base, prototype ) {
|
52
|
+
var fullName, existingConstructor, constructor, basePrototype,
|
53
|
+
// proxiedPrototype allows the provided prototype to remain unmodified
|
54
|
+
// so that it can be used as a mixin for multiple widgets (#8876)
|
55
|
+
proxiedPrototype = {},
|
56
|
+
namespace = name.split( "." )[ 0 ];
|
57
|
+
|
58
|
+
name = name.split( "." )[ 1 ];
|
59
|
+
fullName = namespace + "-" + name;
|
60
|
+
|
61
|
+
if ( !prototype ) {
|
62
|
+
prototype = base;
|
63
|
+
base = $.Widget;
|
64
|
+
}
|
65
|
+
|
66
|
+
// create selector for plugin
|
67
|
+
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
68
|
+
return !!$.data( elem, fullName );
|
69
|
+
};
|
70
|
+
|
71
|
+
$[ namespace ] = $[ namespace ] || {};
|
72
|
+
existingConstructor = $[ namespace ][ name ];
|
73
|
+
constructor = $[ namespace ][ name ] = function( options, element ) {
|
74
|
+
// allow instantiation without "new" keyword
|
75
|
+
if ( !this._createWidget ) {
|
76
|
+
return new constructor( options, element );
|
77
|
+
}
|
78
|
+
|
79
|
+
// allow instantiation without initializing for simple inheritance
|
80
|
+
// must use "new" keyword (the code above always passes args)
|
81
|
+
if ( arguments.length ) {
|
82
|
+
this._createWidget( options, element );
|
83
|
+
}
|
84
|
+
};
|
85
|
+
// extend with the existing constructor to carry over any static properties
|
86
|
+
$.extend( constructor, existingConstructor, {
|
87
|
+
version: prototype.version,
|
88
|
+
// copy the object used to create the prototype in case we need to
|
89
|
+
// redefine the widget later
|
90
|
+
_proto: $.extend( {}, prototype ),
|
91
|
+
// track widgets that inherit from this widget in case this widget is
|
92
|
+
// redefined after a widget inherits from it
|
93
|
+
_childConstructors: []
|
94
|
+
});
|
95
|
+
|
96
|
+
basePrototype = new base();
|
97
|
+
// we need to make the options hash a property directly on the new instance
|
98
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
99
|
+
// inheriting from
|
100
|
+
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
101
|
+
$.each( prototype, function( prop, value ) {
|
102
|
+
if ( !$.isFunction( value ) ) {
|
103
|
+
proxiedPrototype[ prop ] = value;
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
proxiedPrototype[ prop ] = (function() {
|
107
|
+
var _super = function() {
|
108
|
+
return base.prototype[ prop ].apply( this, arguments );
|
109
|
+
},
|
110
|
+
_superApply = function( args ) {
|
111
|
+
return base.prototype[ prop ].apply( this, args );
|
112
|
+
};
|
113
|
+
return function() {
|
114
|
+
var __super = this._super,
|
115
|
+
__superApply = this._superApply,
|
116
|
+
returnValue;
|
117
|
+
|
118
|
+
this._super = _super;
|
119
|
+
this._superApply = _superApply;
|
120
|
+
|
121
|
+
returnValue = value.apply( this, arguments );
|
122
|
+
|
123
|
+
this._super = __super;
|
124
|
+
this._superApply = __superApply;
|
125
|
+
|
126
|
+
return returnValue;
|
127
|
+
};
|
128
|
+
})();
|
129
|
+
});
|
130
|
+
constructor.prototype = $.widget.extend( basePrototype, {
|
131
|
+
// TODO: remove support for widgetEventPrefix
|
132
|
+
// always use the name + a colon as the prefix, e.g., draggable:start
|
133
|
+
// don't prefix for widgets that aren't DOM-based
|
134
|
+
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
135
|
+
}, proxiedPrototype, {
|
136
|
+
constructor: constructor,
|
137
|
+
namespace: namespace,
|
138
|
+
widgetName: name,
|
139
|
+
widgetFullName: fullName
|
140
|
+
});
|
141
|
+
|
142
|
+
// If this widget is being redefined then we need to find all widgets that
|
143
|
+
// are inheriting from it and redefine all of them so that they inherit from
|
144
|
+
// the new version of this widget. We're essentially trying to replace one
|
145
|
+
// level in the prototype chain.
|
146
|
+
if ( existingConstructor ) {
|
147
|
+
$.each( existingConstructor._childConstructors, function( i, child ) {
|
148
|
+
var childPrototype = child.prototype;
|
149
|
+
|
150
|
+
// redefine the child widget using the same prototype that was
|
151
|
+
// originally used, but inherit from the new version of the base
|
152
|
+
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
153
|
+
});
|
154
|
+
// remove the list of existing child constructors from the old constructor
|
155
|
+
// so the old child constructors can be garbage collected
|
156
|
+
delete existingConstructor._childConstructors;
|
157
|
+
} else {
|
158
|
+
base._childConstructors.push( constructor );
|
159
|
+
}
|
160
|
+
|
161
|
+
$.widget.bridge( name, constructor );
|
162
|
+
|
163
|
+
return constructor;
|
164
|
+
};
|
165
|
+
|
166
|
+
$.widget.extend = function( target ) {
|
167
|
+
var input = widget_slice.call( arguments, 1 ),
|
168
|
+
inputIndex = 0,
|
169
|
+
inputLength = input.length,
|
170
|
+
key,
|
171
|
+
value;
|
172
|
+
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
173
|
+
for ( key in input[ inputIndex ] ) {
|
174
|
+
value = input[ inputIndex ][ key ];
|
175
|
+
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
176
|
+
// Clone objects
|
177
|
+
if ( $.isPlainObject( value ) ) {
|
178
|
+
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
179
|
+
$.widget.extend( {}, target[ key ], value ) :
|
180
|
+
// Don't extend strings, arrays, etc. with objects
|
181
|
+
$.widget.extend( {}, value );
|
182
|
+
// Copy everything else by reference
|
183
|
+
} else {
|
184
|
+
target[ key ] = value;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
}
|
188
|
+
}
|
189
|
+
return target;
|
190
|
+
};
|
191
|
+
|
192
|
+
$.widget.bridge = function( name, object ) {
|
193
|
+
var fullName = object.prototype.widgetFullName || name;
|
194
|
+
$.fn[ name ] = function( options ) {
|
195
|
+
var isMethodCall = typeof options === "string",
|
196
|
+
args = widget_slice.call( arguments, 1 ),
|
197
|
+
returnValue = this;
|
198
|
+
|
199
|
+
if ( isMethodCall ) {
|
200
|
+
this.each(function() {
|
201
|
+
var methodValue,
|
202
|
+
instance = $.data( this, fullName );
|
203
|
+
if ( options === "instance" ) {
|
204
|
+
returnValue = instance;
|
205
|
+
return false;
|
206
|
+
}
|
207
|
+
if ( !instance ) {
|
208
|
+
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
209
|
+
"attempted to call method '" + options + "'" );
|
210
|
+
}
|
211
|
+
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
212
|
+
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
213
|
+
}
|
214
|
+
methodValue = instance[ options ].apply( instance, args );
|
215
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
216
|
+
returnValue = methodValue && methodValue.jquery ?
|
217
|
+
returnValue.pushStack( methodValue.get() ) :
|
218
|
+
methodValue;
|
219
|
+
return false;
|
220
|
+
}
|
221
|
+
});
|
222
|
+
} else {
|
223
|
+
|
224
|
+
// Allow multiple hashes to be passed on init
|
225
|
+
if ( args.length ) {
|
226
|
+
options = $.widget.extend.apply( null, [ options ].concat(args) );
|
227
|
+
}
|
228
|
+
|
229
|
+
this.each(function() {
|
230
|
+
var instance = $.data( this, fullName );
|
231
|
+
if ( instance ) {
|
232
|
+
instance.option( options || {} );
|
233
|
+
if ( instance._init ) {
|
234
|
+
instance._init();
|
235
|
+
}
|
236
|
+
} else {
|
237
|
+
$.data( this, fullName, new object( options, this ) );
|
238
|
+
}
|
239
|
+
});
|
240
|
+
}
|
241
|
+
|
242
|
+
return returnValue;
|
243
|
+
};
|
244
|
+
};
|
245
|
+
|
246
|
+
$.Widget = function( /* options, element */ ) {};
|
247
|
+
$.Widget._childConstructors = [];
|
248
|
+
|
249
|
+
$.Widget.prototype = {
|
250
|
+
widgetName: "widget",
|
251
|
+
widgetEventPrefix: "",
|
252
|
+
defaultElement: "<div>",
|
253
|
+
options: {
|
254
|
+
disabled: false,
|
255
|
+
|
256
|
+
// callbacks
|
257
|
+
create: null
|
258
|
+
},
|
259
|
+
_createWidget: function( options, element ) {
|
260
|
+
element = $( element || this.defaultElement || this )[ 0 ];
|
261
|
+
this.element = $( element );
|
262
|
+
this.uuid = widget_uuid++;
|
263
|
+
this.eventNamespace = "." + this.widgetName + this.uuid;
|
264
|
+
|
265
|
+
this.bindings = $();
|
266
|
+
this.hoverable = $();
|
267
|
+
this.focusable = $();
|
268
|
+
|
269
|
+
if ( element !== this ) {
|
270
|
+
$.data( element, this.widgetFullName, this );
|
271
|
+
this._on( true, this.element, {
|
272
|
+
remove: function( event ) {
|
273
|
+
if ( event.target === element ) {
|
274
|
+
this.destroy();
|
275
|
+
}
|
276
|
+
}
|
277
|
+
});
|
278
|
+
this.document = $( element.style ?
|
279
|
+
// element within the document
|
280
|
+
element.ownerDocument :
|
281
|
+
// element is window or document
|
282
|
+
element.document || element );
|
283
|
+
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
284
|
+
}
|
285
|
+
|
286
|
+
this.options = $.widget.extend( {},
|
287
|
+
this.options,
|
288
|
+
this._getCreateOptions(),
|
289
|
+
options );
|
290
|
+
|
291
|
+
this._create();
|
292
|
+
this._trigger( "create", null, this._getCreateEventData() );
|
293
|
+
this._init();
|
294
|
+
},
|
295
|
+
_getCreateOptions: $.noop,
|
296
|
+
_getCreateEventData: $.noop,
|
297
|
+
_create: $.noop,
|
298
|
+
_init: $.noop,
|
299
|
+
|
300
|
+
destroy: function() {
|
301
|
+
this._destroy();
|
302
|
+
// we can probably remove the unbind calls in 2.0
|
303
|
+
// all event bindings should go through this._on()
|
304
|
+
this.element
|
305
|
+
.unbind( this.eventNamespace )
|
306
|
+
.removeData( this.widgetFullName )
|
307
|
+
// support: jquery <1.6.3
|
308
|
+
// http://bugs.jquery.com/ticket/9413
|
309
|
+
.removeData( $.camelCase( this.widgetFullName ) );
|
310
|
+
this.widget()
|
311
|
+
.unbind( this.eventNamespace )
|
312
|
+
.removeAttr( "aria-disabled" )
|
313
|
+
.removeClass(
|
314
|
+
this.widgetFullName + "-disabled " +
|
315
|
+
"ui-state-disabled" );
|
316
|
+
|
317
|
+
// clean up events and states
|
318
|
+
this.bindings.unbind( this.eventNamespace );
|
319
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
320
|
+
this.focusable.removeClass( "ui-state-focus" );
|
321
|
+
},
|
322
|
+
_destroy: $.noop,
|
323
|
+
|
324
|
+
widget: function() {
|
325
|
+
return this.element;
|
326
|
+
},
|
327
|
+
|
328
|
+
option: function( key, value ) {
|
329
|
+
var options = key,
|
330
|
+
parts,
|
331
|
+
curOption,
|
332
|
+
i;
|
333
|
+
|
334
|
+
if ( arguments.length === 0 ) {
|
335
|
+
// don't return a reference to the internal hash
|
336
|
+
return $.widget.extend( {}, this.options );
|
337
|
+
}
|
338
|
+
|
339
|
+
if ( typeof key === "string" ) {
|
340
|
+
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
341
|
+
options = {};
|
342
|
+
parts = key.split( "." );
|
343
|
+
key = parts.shift();
|
344
|
+
if ( parts.length ) {
|
345
|
+
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
346
|
+
for ( i = 0; i < parts.length - 1; i++ ) {
|
347
|
+
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
348
|
+
curOption = curOption[ parts[ i ] ];
|
349
|
+
}
|
350
|
+
key = parts.pop();
|
351
|
+
if ( arguments.length === 1 ) {
|
352
|
+
return curOption[ key ] === undefined ? null : curOption[ key ];
|
353
|
+
}
|
354
|
+
curOption[ key ] = value;
|
355
|
+
} else {
|
356
|
+
if ( arguments.length === 1 ) {
|
357
|
+
return this.options[ key ] === undefined ? null : this.options[ key ];
|
358
|
+
}
|
359
|
+
options[ key ] = value;
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
363
|
+
this._setOptions( options );
|
364
|
+
|
365
|
+
return this;
|
366
|
+
},
|
367
|
+
_setOptions: function( options ) {
|
368
|
+
var key;
|
369
|
+
|
370
|
+
for ( key in options ) {
|
371
|
+
this._setOption( key, options[ key ] );
|
372
|
+
}
|
373
|
+
|
374
|
+
return this;
|
375
|
+
},
|
376
|
+
_setOption: function( key, value ) {
|
377
|
+
this.options[ key ] = value;
|
378
|
+
|
379
|
+
if ( key === "disabled" ) {
|
380
|
+
this.widget()
|
381
|
+
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
382
|
+
|
383
|
+
// If the widget is becoming disabled, then nothing is interactive
|
384
|
+
if ( value ) {
|
385
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
386
|
+
this.focusable.removeClass( "ui-state-focus" );
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
390
|
+
return this;
|
391
|
+
},
|
392
|
+
|
393
|
+
enable: function() {
|
394
|
+
return this._setOptions({ disabled: false });
|
395
|
+
},
|
396
|
+
disable: function() {
|
397
|
+
return this._setOptions({ disabled: true });
|
398
|
+
},
|
399
|
+
|
400
|
+
_on: function( suppressDisabledCheck, element, handlers ) {
|
401
|
+
var delegateElement,
|
402
|
+
instance = this;
|
403
|
+
|
404
|
+
// no suppressDisabledCheck flag, shuffle arguments
|
405
|
+
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
406
|
+
handlers = element;
|
407
|
+
element = suppressDisabledCheck;
|
408
|
+
suppressDisabledCheck = false;
|
409
|
+
}
|
410
|
+
|
411
|
+
// no element argument, shuffle and use this.element
|
412
|
+
if ( !handlers ) {
|
413
|
+
handlers = element;
|
414
|
+
element = this.element;
|
415
|
+
delegateElement = this.widget();
|
416
|
+
} else {
|
417
|
+
element = delegateElement = $( element );
|
418
|
+
this.bindings = this.bindings.add( element );
|
419
|
+
}
|
420
|
+
|
421
|
+
$.each( handlers, function( event, handler ) {
|
422
|
+
function handlerProxy() {
|
423
|
+
// allow widgets to customize the disabled handling
|
424
|
+
// - disabled as an array instead of boolean
|
425
|
+
// - disabled class as method for disabling individual parts
|
426
|
+
if ( !suppressDisabledCheck &&
|
427
|
+
( instance.options.disabled === true ||
|
428
|
+
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
429
|
+
return;
|
430
|
+
}
|
431
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
432
|
+
.apply( instance, arguments );
|
433
|
+
}
|
434
|
+
|
435
|
+
// copy the guid so direct unbinding works
|
436
|
+
if ( typeof handler !== "string" ) {
|
437
|
+
handlerProxy.guid = handler.guid =
|
438
|
+
handler.guid || handlerProxy.guid || $.guid++;
|
439
|
+
}
|
440
|
+
|
441
|
+
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
442
|
+
eventName = match[1] + instance.eventNamespace,
|
443
|
+
selector = match[2];
|
444
|
+
if ( selector ) {
|
445
|
+
delegateElement.delegate( selector, eventName, handlerProxy );
|
446
|
+
} else {
|
447
|
+
element.bind( eventName, handlerProxy );
|
448
|
+
}
|
449
|
+
});
|
450
|
+
},
|
451
|
+
|
452
|
+
_off: function( element, eventName ) {
|
453
|
+
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
|
454
|
+
this.eventNamespace;
|
455
|
+
element.unbind( eventName ).undelegate( eventName );
|
456
|
+
|
457
|
+
// Clear the stack to avoid memory leaks (#10056)
|
458
|
+
this.bindings = $( this.bindings.not( element ).get() );
|
459
|
+
this.focusable = $( this.focusable.not( element ).get() );
|
460
|
+
this.hoverable = $( this.hoverable.not( element ).get() );
|
461
|
+
},
|
462
|
+
|
463
|
+
_delay: function( handler, delay ) {
|
464
|
+
function handlerProxy() {
|
465
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
466
|
+
.apply( instance, arguments );
|
467
|
+
}
|
468
|
+
var instance = this;
|
469
|
+
return setTimeout( handlerProxy, delay || 0 );
|
470
|
+
},
|
471
|
+
|
472
|
+
_hoverable: function( element ) {
|
473
|
+
this.hoverable = this.hoverable.add( element );
|
474
|
+
this._on( element, {
|
475
|
+
mouseenter: function( event ) {
|
476
|
+
$( event.currentTarget ).addClass( "ui-state-hover" );
|
477
|
+
},
|
478
|
+
mouseleave: function( event ) {
|
479
|
+
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
480
|
+
}
|
481
|
+
});
|
482
|
+
},
|
483
|
+
|
484
|
+
_focusable: function( element ) {
|
485
|
+
this.focusable = this.focusable.add( element );
|
486
|
+
this._on( element, {
|
487
|
+
focusin: function( event ) {
|
488
|
+
$( event.currentTarget ).addClass( "ui-state-focus" );
|
489
|
+
},
|
490
|
+
focusout: function( event ) {
|
491
|
+
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
492
|
+
}
|
493
|
+
});
|
494
|
+
},
|
495
|
+
|
496
|
+
_trigger: function( type, event, data ) {
|
497
|
+
var prop, orig,
|
498
|
+
callback = this.options[ type ];
|
499
|
+
|
500
|
+
data = data || {};
|
501
|
+
event = $.Event( event );
|
502
|
+
event.type = ( type === this.widgetEventPrefix ?
|
503
|
+
type :
|
504
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
505
|
+
// the original event may come from any element
|
506
|
+
// so we need to reset the target on the new event
|
507
|
+
event.target = this.element[ 0 ];
|
508
|
+
|
509
|
+
// copy original event properties over to the new event
|
510
|
+
orig = event.originalEvent;
|
511
|
+
if ( orig ) {
|
512
|
+
for ( prop in orig ) {
|
513
|
+
if ( !( prop in event ) ) {
|
514
|
+
event[ prop ] = orig[ prop ];
|
515
|
+
}
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
this.element.trigger( event, data );
|
520
|
+
return !( $.isFunction( callback ) &&
|
521
|
+
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
522
|
+
event.isDefaultPrevented() );
|
523
|
+
}
|
524
|
+
};
|
525
|
+
|
526
|
+
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
527
|
+
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
528
|
+
if ( typeof options === "string" ) {
|
529
|
+
options = { effect: options };
|
530
|
+
}
|
531
|
+
var hasOptions,
|
532
|
+
effectName = !options ?
|
533
|
+
method :
|
534
|
+
options === true || typeof options === "number" ?
|
535
|
+
defaultEffect :
|
536
|
+
options.effect || defaultEffect;
|
537
|
+
options = options || {};
|
538
|
+
if ( typeof options === "number" ) {
|
539
|
+
options = { duration: options };
|
540
|
+
}
|
541
|
+
hasOptions = !$.isEmptyObject( options );
|
542
|
+
options.complete = callback;
|
543
|
+
if ( options.delay ) {
|
544
|
+
element.delay( options.delay );
|
545
|
+
}
|
546
|
+
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
547
|
+
element[ method ]( options );
|
548
|
+
} else if ( effectName !== method && element[ effectName ] ) {
|
549
|
+
element[ effectName ]( options.duration, options.easing, callback );
|
550
|
+
} else {
|
551
|
+
element.queue(function( next ) {
|
552
|
+
$( this )[ method ]();
|
553
|
+
if ( callback ) {
|
554
|
+
callback.call( element[ 0 ] );
|
555
|
+
}
|
556
|
+
next();
|
557
|
+
});
|
558
|
+
}
|
559
|
+
};
|
560
|
+
});
|
561
|
+
|
562
|
+
var widget = $.widget;
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
}));
|