mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 19:54:14 +08:00
DEV: Update jquery.fileupload and dependencies (#9466)
This commit is contained in:
@ -61,6 +61,12 @@ task 'javascript:update' do
|
|||||||
source: 'jquery-color/dist/jquery.color.js'
|
source: 'jquery-color/dist/jquery.color.js'
|
||||||
}, {
|
}, {
|
||||||
source: 'jquery.cookie/jquery.cookie.js'
|
source: 'jquery.cookie/jquery.cookie.js'
|
||||||
|
}, {
|
||||||
|
source: 'blueimp-file-upload/js/jquery.fileupload.js',
|
||||||
|
}, {
|
||||||
|
source: 'blueimp-file-upload/js/jquery.iframe-transport.js',
|
||||||
|
}, {
|
||||||
|
source: 'blueimp-file-upload/js/vendor/jquery.ui.widget.js',
|
||||||
}, {
|
}, {
|
||||||
source: 'jquery/dist/jquery.js'
|
source: 'jquery/dist/jquery.js'
|
||||||
}, {
|
}, {
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"@fortawesome/fontawesome-free": "5.11.2",
|
"@fortawesome/fontawesome-free": "5.11.2",
|
||||||
"@popperjs/core": "v2.0.6",
|
"@popperjs/core": "v2.0.6",
|
||||||
"ace-builds": "1.4.2",
|
"ace-builds": "1.4.2",
|
||||||
|
"blueimp-file-upload": "10.13.0",
|
||||||
"bootbox": "3.2.0",
|
"bootbox": "3.2.0",
|
||||||
"bootstrap": "v3.4.1",
|
"bootstrap": "v3.4.1",
|
||||||
"chart.js": "2.9.3",
|
"chart.js": "2.9.3",
|
||||||
|
517
vendor/assets/javascripts/jquery.fileupload.js
vendored
517
vendor/assets/javascripts/jquery.fileupload.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* jQuery Iframe Transport Plugin 1.8.3
|
* jQuery Iframe Transport Plugin
|
||||||
* https://github.com/blueimp/jQuery-File-Upload
|
* https://github.com/blueimp/jQuery-File-Upload
|
||||||
*
|
*
|
||||||
* Copyright 2011, Sebastian Tschan
|
* Copyright 2011, Sebastian Tschan
|
||||||
* https://blueimp.net
|
* https://blueimp.net
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license:
|
* Licensed under the MIT license:
|
||||||
* http://www.opensource.org/licenses/MIT
|
* https://opensource.org/licenses/MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global define, require, window, document */
|
/* global define, require */
|
||||||
|
|
||||||
(function (factory) {
|
(function (factory) {
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -23,11 +23,18 @@
|
|||||||
// Browser globals:
|
// Browser globals:
|
||||||
factory(window.jQuery);
|
factory(window.jQuery);
|
||||||
}
|
}
|
||||||
}(function ($) {
|
})(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Helper variable to create unique names for the transport iframes:
|
// Helper variable to create unique names for the transport iframes:
|
||||||
var counter = 0;
|
var counter = 0,
|
||||||
|
jsonAPI = $,
|
||||||
|
jsonParse = 'parseJSON';
|
||||||
|
|
||||||
|
if ('JSON' in window && 'parse' in JSON) {
|
||||||
|
jsonAPI = JSON;
|
||||||
|
jsonParse = 'parse';
|
||||||
|
}
|
||||||
|
|
||||||
// The iframe transport accepts four additional options:
|
// The iframe transport accepts four additional options:
|
||||||
// options.fileInput: a jQuery collection of file input fields
|
// options.fileInput: a jQuery collection of file input fields
|
||||||
@ -43,9 +50,8 @@
|
|||||||
if (options.async) {
|
if (options.async) {
|
||||||
// javascript:false as initial iframe src
|
// javascript:false as initial iframe src
|
||||||
// prevents warning popups on HTTPS in IE6:
|
// prevents warning popups on HTTPS in IE6:
|
||||||
/*jshint scripturl: true */
|
// eslint-disable-next-line no-script-url
|
||||||
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
||||||
/*jshint scripturl: false */
|
|
||||||
form,
|
form,
|
||||||
iframe,
|
iframe,
|
||||||
addParamChar;
|
addParamChar;
|
||||||
@ -70,15 +76,17 @@
|
|||||||
// so we set the name along with the iframe HTML markup:
|
// so we set the name along with the iframe HTML markup:
|
||||||
counter += 1;
|
counter += 1;
|
||||||
iframe = $(
|
iframe = $(
|
||||||
'<iframe src="' + initialIframeSrc +
|
'<iframe src="' +
|
||||||
'" name="iframe-transport-' + counter + '"></iframe>'
|
initialIframeSrc +
|
||||||
).bind('load', function () {
|
'" name="iframe-transport-' +
|
||||||
|
counter +
|
||||||
|
'"></iframe>'
|
||||||
|
).on('load', function () {
|
||||||
var fileInputClones,
|
var fileInputClones,
|
||||||
paramNames = $.isArray(options.paramName) ?
|
paramNames = $.isArray(options.paramName)
|
||||||
options.paramName : [options.paramName];
|
? options.paramName
|
||||||
iframe
|
: [options.paramName];
|
||||||
.unbind('load')
|
iframe.off('load').on('load', function () {
|
||||||
.bind('load', function () {
|
|
||||||
var response;
|
var response;
|
||||||
// Wrap in a try/catch block to catch exceptions thrown
|
// Wrap in a try/catch block to catch exceptions thrown
|
||||||
// when trying to access cross-domain iframe contents:
|
// when trying to access cross-domain iframe contents:
|
||||||
@ -95,15 +103,12 @@
|
|||||||
}
|
}
|
||||||
// The complete callback returns the
|
// The complete callback returns the
|
||||||
// iframe content document as response object:
|
// iframe content document as response object:
|
||||||
completeCallback(
|
completeCallback(200, 'success', { iframe: response });
|
||||||
200,
|
|
||||||
'success',
|
|
||||||
{'iframe': response}
|
|
||||||
);
|
|
||||||
// Fix for IE endless progress bar activity bug
|
// Fix for IE endless progress bar activity bug
|
||||||
// (happens on form submits to iframe targets):
|
// (happens on form submits to iframe targets):
|
||||||
$('<iframe src="' + initialIframeSrc + '"></iframe>')
|
$('<iframe src="' + initialIframeSrc + '"></iframe>').appendTo(
|
||||||
.appendTo(form);
|
form
|
||||||
|
);
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
// Removing the form in a setTimeout call
|
// Removing the form in a setTimeout call
|
||||||
// allows Chrome's developer tools to display
|
// allows Chrome's developer tools to display
|
||||||
@ -123,8 +128,11 @@
|
|||||||
.appendTo(form);
|
.appendTo(form);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (options.fileInput && options.fileInput.length &&
|
if (
|
||||||
options.type === 'POST') {
|
options.fileInput &&
|
||||||
|
options.fileInput.length &&
|
||||||
|
options.type === 'POST'
|
||||||
|
) {
|
||||||
fileInputClones = options.fileInput.clone();
|
fileInputClones = options.fileInput.clone();
|
||||||
// Insert a clone for each file input field:
|
// Insert a clone for each file input field:
|
||||||
options.fileInput.after(function (index) {
|
options.fileInput.after(function (index) {
|
||||||
@ -132,10 +140,7 @@
|
|||||||
});
|
});
|
||||||
if (options.paramName) {
|
if (options.paramName) {
|
||||||
options.fileInput.each(function (index) {
|
options.fileInput.each(function (index) {
|
||||||
$(this).prop(
|
$(this).prop('name', paramNames[index] || options.paramName);
|
||||||
'name',
|
|
||||||
paramNames[index] || options.paramName
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Appending the file input fields to the hidden form
|
// Appending the file input fields to the hidden form
|
||||||
@ -168,10 +173,7 @@
|
|||||||
if (iframe) {
|
if (iframe) {
|
||||||
// javascript:false as iframe src aborts the request
|
// javascript:false as iframe src aborts the request
|
||||||
// and prevents warning popups on HTTPS in IE6.
|
// and prevents warning popups on HTTPS in IE6.
|
||||||
// concat is used to avoid the "Script URL" JSLint error:
|
iframe.off('load').prop('src', initialIframeSrc);
|
||||||
iframe
|
|
||||||
.unbind('load')
|
|
||||||
.prop('src', initialIframeSrc);
|
|
||||||
}
|
}
|
||||||
if (form) {
|
if (form) {
|
||||||
form.remove();
|
form.remove();
|
||||||
@ -197,21 +199,23 @@
|
|||||||
return iframe && $(iframe[0].body).text();
|
return iframe && $(iframe[0].body).text();
|
||||||
},
|
},
|
||||||
'iframe json': function (iframe) {
|
'iframe json': function (iframe) {
|
||||||
return iframe && $.parseJSON($(iframe[0].body).text());
|
return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());
|
||||||
},
|
},
|
||||||
'iframe html': function (iframe) {
|
'iframe html': function (iframe) {
|
||||||
return iframe && $(iframe[0].body).html();
|
return iframe && $(iframe[0].body).html();
|
||||||
},
|
},
|
||||||
'iframe xml': function (iframe) {
|
'iframe xml': function (iframe) {
|
||||||
var xmlDoc = iframe && iframe[0];
|
var xmlDoc = iframe && iframe[0];
|
||||||
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
return xmlDoc && $.isXMLDoc(xmlDoc)
|
||||||
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
? xmlDoc
|
||||||
$(xmlDoc.body).html());
|
: $.parseXML(
|
||||||
|
(xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
||||||
|
$(xmlDoc.body).html()
|
||||||
|
);
|
||||||
},
|
},
|
||||||
'iframe script': function (iframe) {
|
'iframe script': function (iframe) {
|
||||||
return iframe && $.globalEval($(iframe[0].body).text());
|
return iframe && $.globalEval($(iframe[0].body).text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}));
|
|
||||||
|
625
vendor/assets/javascripts/jquery.ui.widget.js
vendored
625
vendor/assets/javascripts/jquery.ui.widget.js
vendored
@ -1,105 +1,132 @@
|
|||||||
/*! jQuery UI - v1.11.1+CommonJS - 2014-09-17
|
/*! jQuery UI - v1.12.1+0b7246b6eeadfa9e2696e22f3230f6452f8129dc - 2020-02-20
|
||||||
* http://jqueryui.com
|
* http://jqueryui.com
|
||||||
* Includes: widget.js
|
* Includes: widget.js
|
||||||
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
||||||
|
|
||||||
|
/* global define, require */
|
||||||
|
/* eslint-disable no-param-reassign, new-cap, jsdoc/require-jsdoc */
|
||||||
|
|
||||||
(function (factory) {
|
(function (factory) {
|
||||||
if ( typeof define === "function" && define.amd ) {
|
'use strict';
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
// AMD. Register as an anonymous module.
|
// AMD. Register as an anonymous module.
|
||||||
define([ "jquery" ], factory );
|
define(['jquery'], factory);
|
||||||
|
} else if (typeof exports === 'object') {
|
||||||
} else if (typeof exports === "object") {
|
// Node/CommonJS
|
||||||
// Node/CommonJS:
|
factory(require('jquery'));
|
||||||
factory(require("jquery"));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Browser globals
|
// Browser globals
|
||||||
factory( jQuery );
|
factory(window.jQuery);
|
||||||
}
|
}
|
||||||
}(function( $ ) {
|
})(function ($) {
|
||||||
|
('use strict');
|
||||||
|
|
||||||
|
$.ui = $.ui || {};
|
||||||
|
|
||||||
|
$.ui.version = '1.12.1';
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* jQuery UI Widget 1.11.1
|
* jQuery UI Widget 1.12.1
|
||||||
* http://jqueryui.com
|
* http://jqueryui.com
|
||||||
*
|
*
|
||||||
* Copyright 2014 jQuery Foundation and other contributors
|
* Copyright jQuery Foundation and other contributors
|
||||||
* Released under the MIT license.
|
* Released under the MIT license.
|
||||||
* http://jquery.org/license
|
* http://jquery.org/license
|
||||||
*
|
|
||||||
* http://api.jqueryui.com/jQuery.widget/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//>>label: Widget
|
||||||
|
//>>group: Core
|
||||||
|
//>>description: Provides a factory for creating stateful widgets with a common API.
|
||||||
|
//>>docs: http://api.jqueryui.com/jQuery.widget/
|
||||||
|
//>>demos: http://jqueryui.com/widget/
|
||||||
|
|
||||||
var widget_uuid = 0,
|
// Support: jQuery 1.9.x or older
|
||||||
widget_slice = Array.prototype.slice;
|
// $.expr[ ":" ] is deprecated.
|
||||||
|
if (!$.expr.pseudos) {
|
||||||
|
$.expr.pseudos = $.expr[':'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support: jQuery 1.11.x or older
|
||||||
|
// $.unique has been renamed to $.uniqueSort
|
||||||
|
if (!$.uniqueSort) {
|
||||||
|
$.uniqueSort = $.unique;
|
||||||
|
}
|
||||||
|
|
||||||
|
var widgetUuid = 0;
|
||||||
|
var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
|
||||||
|
var widgetSlice = Array.prototype.slice;
|
||||||
|
|
||||||
$.cleanData = (function (orig) {
|
$.cleanData = (function (orig) {
|
||||||
return function (elems) {
|
return function (elems) {
|
||||||
var events, elem, i;
|
var events, elem, i;
|
||||||
|
// eslint-disable-next-line eqeqeq
|
||||||
for (i = 0; (elem = elems[i]) != null; i++) {
|
for (i = 0; (elem = elems[i]) != null; i++) {
|
||||||
try {
|
|
||||||
|
|
||||||
// Only trigger remove when necessary to save time
|
// Only trigger remove when necessary to save time
|
||||||
events = $._data( elem, "events" );
|
events = $._data(elem, 'events');
|
||||||
if (events && events.remove) {
|
if (events && events.remove) {
|
||||||
$( elem ).triggerHandler( "remove" );
|
$(elem).triggerHandler('remove');
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://bugs.jquery.com/ticket/8235
|
|
||||||
} catch( e ) {}
|
|
||||||
}
|
}
|
||||||
orig(elems);
|
orig(elems);
|
||||||
};
|
};
|
||||||
})($.cleanData);
|
})($.cleanData);
|
||||||
|
|
||||||
$.widget = function (name, base, prototype) {
|
$.widget = function (name, base, prototype) {
|
||||||
var fullName, existingConstructor, constructor, basePrototype,
|
var existingConstructor, constructor, basePrototype;
|
||||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
|
||||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
|
||||||
proxiedPrototype = {},
|
|
||||||
namespace = name.split( "." )[ 0 ];
|
|
||||||
|
|
||||||
name = name.split( "." )[ 1 ];
|
// ProxiedPrototype allows the provided prototype to remain unmodified
|
||||||
fullName = namespace + "-" + name;
|
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||||
|
var proxiedPrototype = {};
|
||||||
|
|
||||||
|
var namespace = name.split('.')[0];
|
||||||
|
name = name.split('.')[1];
|
||||||
|
var fullName = namespace + '-' + name;
|
||||||
|
|
||||||
if (!prototype) {
|
if (!prototype) {
|
||||||
prototype = base;
|
prototype = base;
|
||||||
base = $.Widget;
|
base = $.Widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create selector for plugin
|
if ($.isArray(prototype)) {
|
||||||
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
prototype = $.extend.apply(null, [{}].concat(prototype));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create selector for plugin
|
||||||
|
$.expr.pseudos[fullName.toLowerCase()] = function (elem) {
|
||||||
return !!$.data(elem, fullName);
|
return !!$.data(elem, fullName);
|
||||||
};
|
};
|
||||||
|
|
||||||
$[namespace] = $[namespace] || {};
|
$[namespace] = $[namespace] || {};
|
||||||
existingConstructor = $[namespace][name];
|
existingConstructor = $[namespace][name];
|
||||||
constructor = $[namespace][name] = function (options, element) {
|
constructor = $[namespace][name] = function (options, element) {
|
||||||
// allow instantiation without "new" keyword
|
// Allow instantiation without "new" keyword
|
||||||
if (!this._createWidget) {
|
if (!this._createWidget) {
|
||||||
return new constructor(options, element);
|
return new constructor(options, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow instantiation without initializing for simple inheritance
|
// Allow instantiation without initializing for simple inheritance
|
||||||
// must use "new" keyword (the code above always passes args)
|
// must use "new" keyword (the code above always passes args)
|
||||||
if (arguments.length) {
|
if (arguments.length) {
|
||||||
this._createWidget(options, element);
|
this._createWidget(options, element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// extend with the existing constructor to carry over any static properties
|
|
||||||
|
// Extend with the existing constructor to carry over any static properties
|
||||||
$.extend(constructor, existingConstructor, {
|
$.extend(constructor, existingConstructor, {
|
||||||
version: prototype.version,
|
version: prototype.version,
|
||||||
// copy the object used to create the prototype in case we need to
|
|
||||||
|
// Copy the object used to create the prototype in case we need to
|
||||||
// redefine the widget later
|
// redefine the widget later
|
||||||
_proto: $.extend({}, prototype),
|
_proto: $.extend({}, prototype),
|
||||||
// track widgets that inherit from this widget in case this widget is
|
|
||||||
|
// Track widgets that inherit from this widget in case this widget is
|
||||||
// redefined after a widget inherits from it
|
// redefined after a widget inherits from it
|
||||||
_childConstructors: []
|
_childConstructors: []
|
||||||
});
|
});
|
||||||
|
|
||||||
basePrototype = new base();
|
basePrototype = new base();
|
||||||
// we need to make the options hash a property directly on the new instance
|
|
||||||
|
// We need to make the options hash a property directly on the new instance
|
||||||
// otherwise we'll modify the options hash on the prototype that we're
|
// otherwise we'll modify the options hash on the prototype that we're
|
||||||
// inheriting from
|
// inheriting from
|
||||||
basePrototype.options = $.widget.extend({}, basePrototype.options);
|
basePrototype.options = $.widget.extend({}, basePrototype.options);
|
||||||
@ -109,16 +136,18 @@ $.widget = function( name, base, prototype ) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
proxiedPrototype[prop] = (function () {
|
proxiedPrototype[prop] = (function () {
|
||||||
var _super = function() {
|
function _super() {
|
||||||
return base.prototype[prop].apply(this, arguments);
|
return base.prototype[prop].apply(this, arguments);
|
||||||
},
|
}
|
||||||
_superApply = function( args ) {
|
|
||||||
|
function _superApply(args) {
|
||||||
return base.prototype[prop].apply(this, args);
|
return base.prototype[prop].apply(this, args);
|
||||||
};
|
}
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
var __super = this._super,
|
var __super = this._super;
|
||||||
__superApply = this._superApply,
|
var __superApply = this._superApply;
|
||||||
returnValue;
|
var returnValue;
|
||||||
|
|
||||||
this._super = _super;
|
this._super = _super;
|
||||||
this._superApply = _superApply;
|
this._superApply = _superApply;
|
||||||
@ -132,17 +161,24 @@ $.widget = function( name, base, prototype ) {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
constructor.prototype = $.widget.extend( basePrototype, {
|
constructor.prototype = $.widget.extend(
|
||||||
|
basePrototype,
|
||||||
|
{
|
||||||
// TODO: remove support for widgetEventPrefix
|
// TODO: remove support for widgetEventPrefix
|
||||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||||
// don't prefix for widgets that aren't DOM-based
|
// don't prefix for widgets that aren't DOM-based
|
||||||
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
widgetEventPrefix: existingConstructor
|
||||||
}, proxiedPrototype, {
|
? basePrototype.widgetEventPrefix || name
|
||||||
|
: name
|
||||||
|
},
|
||||||
|
proxiedPrototype,
|
||||||
|
{
|
||||||
constructor: constructor,
|
constructor: constructor,
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
widgetName: name,
|
widgetName: name,
|
||||||
widgetFullName: fullName
|
widgetFullName: fullName
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// If this widget is being redefined then we need to find all widgets that
|
// If this widget is being redefined then we need to find all widgets that
|
||||||
// are inheriting from it and redefine all of them so that they inherit from
|
// are inheriting from it and redefine all of them so that they inherit from
|
||||||
@ -152,11 +188,16 @@ $.widget = function( name, base, prototype ) {
|
|||||||
$.each(existingConstructor._childConstructors, function (i, child) {
|
$.each(existingConstructor._childConstructors, function (i, child) {
|
||||||
var childPrototype = child.prototype;
|
var childPrototype = child.prototype;
|
||||||
|
|
||||||
// redefine the child widget using the same prototype that was
|
// Redefine the child widget using the same prototype that was
|
||||||
// originally used, but inherit from the new version of the base
|
// originally used, but inherit from the new version of the base
|
||||||
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
$.widget(
|
||||||
|
childPrototype.namespace + '.' + childPrototype.widgetName,
|
||||||
|
constructor,
|
||||||
|
child._proto
|
||||||
|
);
|
||||||
});
|
});
|
||||||
// remove the list of existing child constructors from the old constructor
|
|
||||||
|
// Remove the list of existing child constructors from the old constructor
|
||||||
// so the old child constructors can be garbage collected
|
// so the old child constructors can be garbage collected
|
||||||
delete existingConstructor._childConstructors;
|
delete existingConstructor._childConstructors;
|
||||||
} else {
|
} else {
|
||||||
@ -169,21 +210,26 @@ $.widget = function( name, base, prototype ) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$.widget.extend = function (target) {
|
$.widget.extend = function (target) {
|
||||||
var input = widget_slice.call( arguments, 1 ),
|
var input = widgetSlice.call(arguments, 1);
|
||||||
inputIndex = 0,
|
var inputIndex = 0;
|
||||||
inputLength = input.length,
|
var inputLength = input.length;
|
||||||
key,
|
var key;
|
||||||
value;
|
var value;
|
||||||
|
|
||||||
for (; inputIndex < inputLength; inputIndex++) {
|
for (; inputIndex < inputLength; inputIndex++) {
|
||||||
for (key in input[inputIndex]) {
|
for (key in input[inputIndex]) {
|
||||||
value = input[inputIndex][key];
|
value = input[inputIndex][key];
|
||||||
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
if (
|
||||||
|
widgetHasOwnProperty.call(input[inputIndex], key) &&
|
||||||
|
value !== undefined
|
||||||
|
) {
|
||||||
// Clone objects
|
// Clone objects
|
||||||
if ($.isPlainObject(value)) {
|
if ($.isPlainObject(value)) {
|
||||||
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
target[key] = $.isPlainObject(target[key])
|
||||||
$.widget.extend( {}, target[ key ], value ) :
|
? $.widget.extend({}, target[key], value)
|
||||||
// Don't extend strings, arrays, etc. with objects
|
: // Don't extend strings, arrays, etc. with objects
|
||||||
$.widget.extend({}, value);
|
$.widget.extend({}, value);
|
||||||
|
|
||||||
// Copy everything else by reference
|
// Copy everything else by reference
|
||||||
} else {
|
} else {
|
||||||
target[key] = value;
|
target[key] = value;
|
||||||
@ -197,39 +243,63 @@ $.widget.extend = function( target ) {
|
|||||||
$.widget.bridge = function (name, object) {
|
$.widget.bridge = function (name, object) {
|
||||||
var fullName = object.prototype.widgetFullName || name;
|
var fullName = object.prototype.widgetFullName || name;
|
||||||
$.fn[name] = function (options) {
|
$.fn[name] = function (options) {
|
||||||
var isMethodCall = typeof options === "string",
|
var isMethodCall = typeof options === 'string';
|
||||||
args = widget_slice.call( arguments, 1 ),
|
var args = widgetSlice.call(arguments, 1);
|
||||||
returnValue = this;
|
var returnValue = this;
|
||||||
|
|
||||||
// allow multiple hashes to be passed on init
|
|
||||||
options = !isMethodCall && args.length ?
|
|
||||||
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
|
||||||
options;
|
|
||||||
|
|
||||||
if (isMethodCall) {
|
if (isMethodCall) {
|
||||||
|
// If this is an empty collection, we need to have the instance method
|
||||||
|
// return undefined instead of the jQuery instance
|
||||||
|
if (!this.length && options === 'instance') {
|
||||||
|
returnValue = undefined;
|
||||||
|
} else {
|
||||||
this.each(function () {
|
this.each(function () {
|
||||||
var methodValue,
|
var methodValue;
|
||||||
instance = $.data( this, fullName );
|
var instance = $.data(this, fullName);
|
||||||
if ( options === "instance" ) {
|
|
||||||
|
if (options === 'instance') {
|
||||||
returnValue = instance;
|
returnValue = instance;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
return $.error(
|
||||||
"attempted to call method '" + options + "'" );
|
'cannot call methods on ' +
|
||||||
|
name +
|
||||||
|
' prior to initialization; ' +
|
||||||
|
"attempted to call method '" +
|
||||||
|
options +
|
||||||
|
"'"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
|
||||||
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
if (!$.isFunction(instance[options]) || options.charAt(0) === '_') {
|
||||||
|
return $.error(
|
||||||
|
"no such method '" +
|
||||||
|
options +
|
||||||
|
"' for " +
|
||||||
|
name +
|
||||||
|
' widget instance'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
methodValue = instance[options].apply(instance, args);
|
methodValue = instance[options].apply(instance, args);
|
||||||
|
|
||||||
if (methodValue !== instance && methodValue !== undefined) {
|
if (methodValue !== instance && methodValue !== undefined) {
|
||||||
returnValue = methodValue && methodValue.jquery ?
|
returnValue =
|
||||||
returnValue.pushStack( methodValue.get() ) :
|
methodValue && methodValue.jquery
|
||||||
methodValue;
|
? returnValue.pushStack(methodValue.get())
|
||||||
|
: methodValue;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Allow multiple hashes to be passed on init
|
||||||
|
if (args.length) {
|
||||||
|
options = $.widget.extend.apply(null, [options].concat(args));
|
||||||
|
}
|
||||||
|
|
||||||
this.each(function () {
|
this.each(function () {
|
||||||
var instance = $.data(this, fullName);
|
var instance = $.data(this, fullName);
|
||||||
if (instance) {
|
if (instance) {
|
||||||
@ -251,28 +321,28 @@ $.Widget = function( /* options, element */ ) {};
|
|||||||
$.Widget._childConstructors = [];
|
$.Widget._childConstructors = [];
|
||||||
|
|
||||||
$.Widget.prototype = {
|
$.Widget.prototype = {
|
||||||
widgetName: "widget",
|
widgetName: 'widget',
|
||||||
widgetEventPrefix: "",
|
widgetEventPrefix: '',
|
||||||
defaultElement: "<div>",
|
defaultElement: '<div>',
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
|
classes: {},
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
|
||||||
// callbacks
|
// Callbacks
|
||||||
create: null
|
create: null
|
||||||
},
|
},
|
||||||
|
|
||||||
_createWidget: function (options, element) {
|
_createWidget: function (options, element) {
|
||||||
element = $(element || this.defaultElement || this)[0];
|
element = $(element || this.defaultElement || this)[0];
|
||||||
this.element = $(element);
|
this.element = $(element);
|
||||||
this.uuid = widget_uuid++;
|
this.uuid = widgetUuid++;
|
||||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
this.eventNamespace = '.' + this.widgetName + this.uuid;
|
||||||
this.options = $.widget.extend( {},
|
|
||||||
this.options,
|
|
||||||
this._getCreateOptions(),
|
|
||||||
options );
|
|
||||||
|
|
||||||
this.bindings = $();
|
this.bindings = $();
|
||||||
this.hoverable = $();
|
this.hoverable = $();
|
||||||
this.focusable = $();
|
this.focusable = $();
|
||||||
|
this.classesElementLookup = {};
|
||||||
|
|
||||||
if (element !== this) {
|
if (element !== this) {
|
||||||
$.data(element, this.widgetFullName, this);
|
$.data(element, this.widgetFullName, this);
|
||||||
@ -283,45 +353,62 @@ $.Widget.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.document = $( element.style ?
|
this.document = $(
|
||||||
// element within the document
|
element.style
|
||||||
element.ownerDocument :
|
? // Element within the document
|
||||||
// element is window or document
|
element.ownerDocument
|
||||||
element.document || element );
|
: // Element is window or document
|
||||||
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
element.document || element
|
||||||
|
);
|
||||||
|
this.window = $(
|
||||||
|
this.document[0].defaultView || this.document[0].parentWindow
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.options = $.widget.extend(
|
||||||
|
{},
|
||||||
|
this.options,
|
||||||
|
this._getCreateOptions(),
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
this._create();
|
this._create();
|
||||||
this._trigger( "create", null, this._getCreateEventData() );
|
|
||||||
|
if (this.options.disabled) {
|
||||||
|
this._setOptionDisabled(this.options.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._trigger('create', null, this._getCreateEventData());
|
||||||
this._init();
|
this._init();
|
||||||
},
|
},
|
||||||
_getCreateOptions: $.noop,
|
|
||||||
|
_getCreateOptions: function () {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
|
||||||
_getCreateEventData: $.noop,
|
_getCreateEventData: $.noop,
|
||||||
|
|
||||||
_create: $.noop,
|
_create: $.noop,
|
||||||
|
|
||||||
_init: $.noop,
|
_init: $.noop,
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
this._destroy();
|
var that = this;
|
||||||
// we can probably remove the unbind calls in 2.0
|
|
||||||
// all event bindings should go through this._on()
|
|
||||||
this.element
|
|
||||||
.unbind( this.eventNamespace )
|
|
||||||
.removeData( this.widgetFullName )
|
|
||||||
// support: jquery <1.6.3
|
|
||||||
// http://bugs.jquery.com/ticket/9413
|
|
||||||
.removeData( $.camelCase( this.widgetFullName ) );
|
|
||||||
this.widget()
|
|
||||||
.unbind( this.eventNamespace )
|
|
||||||
.removeAttr( "aria-disabled" )
|
|
||||||
.removeClass(
|
|
||||||
this.widgetFullName + "-disabled " +
|
|
||||||
"ui-state-disabled" );
|
|
||||||
|
|
||||||
// clean up events and states
|
this._destroy();
|
||||||
this.bindings.unbind( this.eventNamespace );
|
$.each(this.classesElementLookup, function (key, value) {
|
||||||
this.hoverable.removeClass( "ui-state-hover" );
|
that._removeClass(value, key);
|
||||||
this.focusable.removeClass( "ui-state-focus" );
|
});
|
||||||
|
|
||||||
|
// We can probably remove the unbind calls in 2.0
|
||||||
|
// all event bindings should go through this._on()
|
||||||
|
this.element.off(this.eventNamespace).removeData(this.widgetFullName);
|
||||||
|
this.widget().off(this.eventNamespace).removeAttr('aria-disabled');
|
||||||
|
|
||||||
|
// Clean up events and states
|
||||||
|
this.bindings.off(this.eventNamespace);
|
||||||
},
|
},
|
||||||
|
|
||||||
_destroy: $.noop,
|
_destroy: $.noop,
|
||||||
|
|
||||||
widget: function () {
|
widget: function () {
|
||||||
@ -329,20 +416,20 @@ $.Widget.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
option: function (key, value) {
|
option: function (key, value) {
|
||||||
var options = key,
|
var options = key;
|
||||||
parts,
|
var parts;
|
||||||
curOption,
|
var curOption;
|
||||||
i;
|
var i;
|
||||||
|
|
||||||
if (arguments.length === 0) {
|
if (arguments.length === 0) {
|
||||||
// don't return a reference to the internal hash
|
// Don't return a reference to the internal hash
|
||||||
return $.widget.extend({}, this.options);
|
return $.widget.extend({}, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( typeof key === "string" ) {
|
if (typeof key === 'string') {
|
||||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||||
options = {};
|
options = {};
|
||||||
parts = key.split( "." );
|
parts = key.split('.');
|
||||||
key = parts.shift();
|
key = parts.shift();
|
||||||
if (parts.length) {
|
if (parts.length) {
|
||||||
curOption = options[key] = $.widget.extend({}, this.options[key]);
|
curOption = options[key] = $.widget.extend({}, this.options[key]);
|
||||||
@ -367,6 +454,7 @@ $.Widget.prototype = {
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setOptions: function (options) {
|
_setOptions: function (options) {
|
||||||
var key;
|
var key;
|
||||||
|
|
||||||
@ -376,42 +464,181 @@ $.Widget.prototype = {
|
|||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setOption: function (key, value) {
|
_setOption: function (key, value) {
|
||||||
|
if (key === 'classes') {
|
||||||
|
this._setOptionClasses(value);
|
||||||
|
}
|
||||||
|
|
||||||
this.options[key] = value;
|
this.options[key] = value;
|
||||||
|
|
||||||
if ( key === "disabled" ) {
|
if (key === 'disabled') {
|
||||||
this.widget()
|
this._setOptionDisabled(value);
|
||||||
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
|
||||||
|
|
||||||
// If the widget is becoming disabled, then nothing is interactive
|
|
||||||
if ( value ) {
|
|
||||||
this.hoverable.removeClass( "ui-state-hover" );
|
|
||||||
this.focusable.removeClass( "ui-state-focus" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_setOptionClasses: function (value) {
|
||||||
|
var classKey, elements, currentElements;
|
||||||
|
|
||||||
|
for (classKey in value) {
|
||||||
|
currentElements = this.classesElementLookup[classKey];
|
||||||
|
if (
|
||||||
|
value[classKey] === this.options.classes[classKey] ||
|
||||||
|
!currentElements ||
|
||||||
|
!currentElements.length
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We are doing this to create a new jQuery object because the _removeClass() call
|
||||||
|
// on the next line is going to destroy the reference to the current elements being
|
||||||
|
// tracked. We need to save a copy of this collection so that we can add the new classes
|
||||||
|
// below.
|
||||||
|
elements = $(currentElements.get());
|
||||||
|
this._removeClass(currentElements, classKey);
|
||||||
|
|
||||||
|
// We don't use _addClass() here, because that uses this.options.classes
|
||||||
|
// for generating the string of classes. We want to use the value passed in from
|
||||||
|
// _setOption(), this is the new value of the classes option which was passed to
|
||||||
|
// _setOption(). We pass this value directly to _classes().
|
||||||
|
elements.addClass(
|
||||||
|
this._classes({
|
||||||
|
element: elements,
|
||||||
|
keys: classKey,
|
||||||
|
classes: value,
|
||||||
|
add: true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_setOptionDisabled: function (value) {
|
||||||
|
this._toggleClass(
|
||||||
|
this.widget(),
|
||||||
|
this.widgetFullName + '-disabled',
|
||||||
|
null,
|
||||||
|
!!value
|
||||||
|
);
|
||||||
|
|
||||||
|
// If the widget is becoming disabled, then nothing is interactive
|
||||||
|
if (value) {
|
||||||
|
this._removeClass(this.hoverable, null, 'ui-state-hover');
|
||||||
|
this._removeClass(this.focusable, null, 'ui-state-focus');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
enable: function () {
|
enable: function () {
|
||||||
return this._setOptions({ disabled: false });
|
return this._setOptions({ disabled: false });
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function () {
|
disable: function () {
|
||||||
return this._setOptions({ disabled: true });
|
return this._setOptions({ disabled: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
_on: function( suppressDisabledCheck, element, handlers ) {
|
_classes: function (options) {
|
||||||
var delegateElement,
|
var full = [];
|
||||||
instance = this;
|
var that = this;
|
||||||
|
|
||||||
// no suppressDisabledCheck flag, shuffle arguments
|
options = $.extend(
|
||||||
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
{
|
||||||
|
element: this.element,
|
||||||
|
classes: this.options.classes || {}
|
||||||
|
},
|
||||||
|
options
|
||||||
|
);
|
||||||
|
|
||||||
|
function bindRemoveEvent() {
|
||||||
|
options.element.each(function (_, element) {
|
||||||
|
var isTracked = $.map(that.classesElementLookup, function (elements) {
|
||||||
|
return elements;
|
||||||
|
}).some(function (elements) {
|
||||||
|
return elements.is(element);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isTracked) {
|
||||||
|
that._on($(element), {
|
||||||
|
remove: '_untrackClassesElement'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function processClassString(classes, checkOption) {
|
||||||
|
var current, i;
|
||||||
|
for (i = 0; i < classes.length; i++) {
|
||||||
|
current = that.classesElementLookup[classes[i]] || $();
|
||||||
|
if (options.add) {
|
||||||
|
bindRemoveEvent();
|
||||||
|
current = $(
|
||||||
|
$.uniqueSort(current.get().concat(options.element.get()))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
current = $(current.not(options.element).get());
|
||||||
|
}
|
||||||
|
that.classesElementLookup[classes[i]] = current;
|
||||||
|
full.push(classes[i]);
|
||||||
|
if (checkOption && options.classes[classes[i]]) {
|
||||||
|
full.push(options.classes[classes[i]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.keys) {
|
||||||
|
processClassString(options.keys.match(/\S+/g) || [], true);
|
||||||
|
}
|
||||||
|
if (options.extra) {
|
||||||
|
processClassString(options.extra.match(/\S+/g) || []);
|
||||||
|
}
|
||||||
|
|
||||||
|
return full.join(' ');
|
||||||
|
},
|
||||||
|
|
||||||
|
_untrackClassesElement: function (event) {
|
||||||
|
var that = this;
|
||||||
|
$.each(that.classesElementLookup, function (key, value) {
|
||||||
|
if ($.inArray(event.target, value) !== -1) {
|
||||||
|
that.classesElementLookup[key] = $(value.not(event.target).get());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this._off($(event.target));
|
||||||
|
},
|
||||||
|
|
||||||
|
_removeClass: function (element, keys, extra) {
|
||||||
|
return this._toggleClass(element, keys, extra, false);
|
||||||
|
},
|
||||||
|
|
||||||
|
_addClass: function (element, keys, extra) {
|
||||||
|
return this._toggleClass(element, keys, extra, true);
|
||||||
|
},
|
||||||
|
|
||||||
|
_toggleClass: function (element, keys, extra, add) {
|
||||||
|
add = typeof add === 'boolean' ? add : extra;
|
||||||
|
var shift = typeof element === 'string' || element === null,
|
||||||
|
options = {
|
||||||
|
extra: shift ? keys : extra,
|
||||||
|
keys: shift ? element : keys,
|
||||||
|
element: shift ? this.element : element,
|
||||||
|
add: add
|
||||||
|
};
|
||||||
|
options.element.toggleClass(this._classes(options), add);
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
_on: function (suppressDisabledCheck, element, handlers) {
|
||||||
|
var delegateElement;
|
||||||
|
var instance = this;
|
||||||
|
|
||||||
|
// No suppressDisabledCheck flag, shuffle arguments
|
||||||
|
if (typeof suppressDisabledCheck !== 'boolean') {
|
||||||
handlers = element;
|
handlers = element;
|
||||||
element = suppressDisabledCheck;
|
element = suppressDisabledCheck;
|
||||||
suppressDisabledCheck = false;
|
suppressDisabledCheck = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no element argument, shuffle and use this.element
|
// No element argument, shuffle and use this.element
|
||||||
if (!handlers) {
|
if (!handlers) {
|
||||||
handlers = element;
|
handlers = element;
|
||||||
element = this.element;
|
element = this.element;
|
||||||
@ -423,46 +650,60 @@ $.Widget.prototype = {
|
|||||||
|
|
||||||
$.each(handlers, function (event, handler) {
|
$.each(handlers, function (event, handler) {
|
||||||
function handlerProxy() {
|
function handlerProxy() {
|
||||||
// allow widgets to customize the disabled handling
|
// Allow widgets to customize the disabled handling
|
||||||
// - disabled as an array instead of boolean
|
// - disabled as an array instead of boolean
|
||||||
// - disabled class as method for disabling individual parts
|
// - disabled class as method for disabling individual parts
|
||||||
if ( !suppressDisabledCheck &&
|
if (
|
||||||
|
!suppressDisabledCheck &&
|
||||||
(instance.options.disabled === true ||
|
(instance.options.disabled === true ||
|
||||||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
$(this).hasClass('ui-state-disabled'))
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
return (typeof handler === 'string'
|
||||||
.apply( instance, arguments );
|
? instance[handler]
|
||||||
|
: handler
|
||||||
|
).apply(instance, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the guid so direct unbinding works
|
// Copy the guid so direct unbinding works
|
||||||
if ( typeof handler !== "string" ) {
|
if (typeof handler !== 'string') {
|
||||||
handlerProxy.guid = handler.guid =
|
handlerProxy.guid = handler.guid =
|
||||||
handler.guid || handlerProxy.guid || $.guid++;
|
handler.guid || handlerProxy.guid || $.guid++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
var match = event.match(/^([\w:-]*)\s*(.*)$/);
|
||||||
eventName = match[1] + instance.eventNamespace,
|
var eventName = match[1] + instance.eventNamespace;
|
||||||
selector = match[2];
|
var selector = match[2];
|
||||||
|
|
||||||
if (selector) {
|
if (selector) {
|
||||||
delegateElement.delegate( selector, eventName, handlerProxy );
|
delegateElement.on(eventName, selector, handlerProxy);
|
||||||
} else {
|
} else {
|
||||||
element.bind( eventName, handlerProxy );
|
element.on(eventName, handlerProxy);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_off: function (element, eventName) {
|
_off: function (element, eventName) {
|
||||||
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
eventName =
|
||||||
element.unbind( eventName ).undelegate( eventName );
|
(eventName || '').split(' ').join(this.eventNamespace + ' ') +
|
||||||
|
this.eventNamespace;
|
||||||
|
element.off(eventName);
|
||||||
|
|
||||||
|
// Clear the stack to avoid memory leaks (#10056)
|
||||||
|
this.bindings = $(this.bindings.not(element).get());
|
||||||
|
this.focusable = $(this.focusable.not(element).get());
|
||||||
|
this.hoverable = $(this.hoverable.not(element).get());
|
||||||
},
|
},
|
||||||
|
|
||||||
_delay: function (handler, delay) {
|
_delay: function (handler, delay) {
|
||||||
function handlerProxy() {
|
|
||||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
|
||||||
.apply( instance, arguments );
|
|
||||||
}
|
|
||||||
var instance = this;
|
var instance = this;
|
||||||
|
function handlerProxy() {
|
||||||
|
return (typeof handler === 'string'
|
||||||
|
? instance[handler]
|
||||||
|
: handler
|
||||||
|
).apply(instance, arguments);
|
||||||
|
}
|
||||||
return setTimeout(handlerProxy, delay || 0);
|
return setTimeout(handlerProxy, delay || 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -470,10 +711,10 @@ $.Widget.prototype = {
|
|||||||
this.hoverable = this.hoverable.add(element);
|
this.hoverable = this.hoverable.add(element);
|
||||||
this._on(element, {
|
this._on(element, {
|
||||||
mouseenter: function (event) {
|
mouseenter: function (event) {
|
||||||
$( event.currentTarget ).addClass( "ui-state-hover" );
|
this._addClass($(event.currentTarget), null, 'ui-state-hover');
|
||||||
},
|
},
|
||||||
mouseleave: function (event) {
|
mouseleave: function (event) {
|
||||||
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
this._removeClass($(event.currentTarget), null, 'ui-state-hover');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -482,28 +723,30 @@ $.Widget.prototype = {
|
|||||||
this.focusable = this.focusable.add(element);
|
this.focusable = this.focusable.add(element);
|
||||||
this._on(element, {
|
this._on(element, {
|
||||||
focusin: function (event) {
|
focusin: function (event) {
|
||||||
$( event.currentTarget ).addClass( "ui-state-focus" );
|
this._addClass($(event.currentTarget), null, 'ui-state-focus');
|
||||||
},
|
},
|
||||||
focusout: function (event) {
|
focusout: function (event) {
|
||||||
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
this._removeClass($(event.currentTarget), null, 'ui-state-focus');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_trigger: function (type, event, data) {
|
_trigger: function (type, event, data) {
|
||||||
var prop, orig,
|
var prop, orig;
|
||||||
callback = this.options[ type ];
|
var callback = this.options[type];
|
||||||
|
|
||||||
data = data || {};
|
data = data || {};
|
||||||
event = $.Event(event);
|
event = $.Event(event);
|
||||||
event.type = ( type === this.widgetEventPrefix ?
|
event.type = (type === this.widgetEventPrefix
|
||||||
type :
|
? type
|
||||||
this.widgetEventPrefix + type ).toLowerCase();
|
: this.widgetEventPrefix + type
|
||||||
// the original event may come from any element
|
).toLowerCase();
|
||||||
|
|
||||||
|
// The original event may come from any element
|
||||||
// so we need to reset the target on the new event
|
// so we need to reset the target on the new event
|
||||||
event.target = this.element[0];
|
event.target = this.element[0];
|
||||||
|
|
||||||
// copy original event properties over to the new event
|
// Copy original event properties over to the new event
|
||||||
orig = event.originalEvent;
|
orig = event.originalEvent;
|
||||||
if (orig) {
|
if (orig) {
|
||||||
for (prop in orig) {
|
for (prop in orig) {
|
||||||
@ -514,32 +757,39 @@ $.Widget.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.element.trigger(event, data);
|
this.element.trigger(event, data);
|
||||||
return !( $.isFunction( callback ) &&
|
return !(
|
||||||
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
($.isFunction(callback) &&
|
||||||
event.isDefaultPrevented() );
|
callback.apply(this.element[0], [event].concat(data)) === false) ||
|
||||||
|
event.isDefaultPrevented()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
$.each({ show: 'fadeIn', hide: 'fadeOut' }, function (method, defaultEffect) {
|
||||||
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
$.Widget.prototype['_' + method] = function (element, options, callback) {
|
||||||
if ( typeof options === "string" ) {
|
if (typeof options === 'string') {
|
||||||
options = { effect: options };
|
options = { effect: options };
|
||||||
}
|
}
|
||||||
var hasOptions,
|
|
||||||
effectName = !options ?
|
var hasOptions;
|
||||||
method :
|
var effectName = !options
|
||||||
options === true || typeof options === "number" ?
|
? method
|
||||||
defaultEffect :
|
: options === true || typeof options === 'number'
|
||||||
options.effect || defaultEffect;
|
? defaultEffect
|
||||||
|
: options.effect || defaultEffect;
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
if ( typeof options === "number" ) {
|
if (typeof options === 'number') {
|
||||||
options = { duration: options };
|
options = { duration: options };
|
||||||
}
|
}
|
||||||
|
|
||||||
hasOptions = !$.isEmptyObject(options);
|
hasOptions = !$.isEmptyObject(options);
|
||||||
options.complete = callback;
|
options.complete = callback;
|
||||||
|
|
||||||
if (options.delay) {
|
if (options.delay) {
|
||||||
element.delay(options.delay);
|
element.delay(options.delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasOptions && $.effects && $.effects.effect[effectName]) {
|
if (hasOptions && $.effects && $.effects.effect[effectName]) {
|
||||||
element[method](options);
|
element[method](options);
|
||||||
} else if (effectName !== method && element[effectName]) {
|
} else if (effectName !== method && element[effectName]) {
|
||||||
@ -555,9 +805,4 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
});
|
||||||
var widget = $.widget;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}));
|
|
||||||
|
24
yarn.lock
24
yarn.lock
@ -415,6 +415,30 @@ base@^0.11.1:
|
|||||||
mixin-deep "^1.2.0"
|
mixin-deep "^1.2.0"
|
||||||
pascalcase "^0.1.1"
|
pascalcase "^0.1.1"
|
||||||
|
|
||||||
|
blueimp-canvas-to-blob@3:
|
||||||
|
version "3.19.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/blueimp-canvas-to-blob/-/blueimp-canvas-to-blob-3.19.0.tgz#842a30605c59ec12b1219bb3d8969160e27b6f8e"
|
||||||
|
integrity sha512-WlLp3GOEdpyQr5hqyPaRoFHGdzMcf6T5Wr8ZjjGl1MM4tit6+rCsJcw7psXFvgoIk69uCGEhyvZOWXU2b4bDcQ==
|
||||||
|
|
||||||
|
blueimp-file-upload@10.13.0:
|
||||||
|
version "10.13.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/blueimp-file-upload/-/blueimp-file-upload-10.13.0.tgz#3994d1606caa44197e4aa29d7f7e1cdd6f521568"
|
||||||
|
integrity sha512-N0yIt/5oR0ZioBaj6u8YuCRSp+1doaJOnNJHIYHBHZdrcWfjfc9Xq03nzodkSdbQIRfWwNin5rexUwY203V35g==
|
||||||
|
optionalDependencies:
|
||||||
|
blueimp-canvas-to-blob "3"
|
||||||
|
blueimp-load-image "3"
|
||||||
|
blueimp-tmpl "3"
|
||||||
|
|
||||||
|
blueimp-load-image@3:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/blueimp-load-image/-/blueimp-load-image-3.0.0.tgz#d71c39440a7d2f1a83e3e86a625e329116a51705"
|
||||||
|
integrity sha512-Q9rFbd4ZUNvzSFmRXx9MoG0RwWwJeMjjEUbG7WIOJgUg22Jgkow0wL5b35B6qwiBscxACW9OHdrP5s2vQ3x8DQ==
|
||||||
|
|
||||||
|
blueimp-tmpl@3:
|
||||||
|
version "3.14.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/blueimp-tmpl/-/blueimp-tmpl-3.14.0.tgz#4951cf03a127521fa88922db616949d75cbbd5c3"
|
||||||
|
integrity sha512-mA8iwfEVkvpjtBXpRp25DxGqW2YOZqC9FVLLOa03Qwdsd6J4kVyL1noC04arAm0CNsu3Y0FmxkAOt+x2MoxpYA==
|
||||||
|
|
||||||
bootbox@3.2.0:
|
bootbox@3.2.0:
|
||||||
version "3.2.0"
|
version "3.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/bootbox/-/bootbox-3.2.0.tgz#00bf643fc9edefd9ae1e7c648c6b022db4be0aee"
|
resolved "https://registry.yarnpkg.com/bootbox/-/bootbox-3.2.0.tgz#00bf643fc9edefd9ae1e7c648c6b022db4be0aee"
|
||||||
|
Reference in New Issue
Block a user