define(['jQuery'], function () { jQuery.mobile = {}; (function ($, window, undefined) { function parentWithClass(elem, className) { while (!elem.classList || !elem.classList.contains(className)) { elem = elem.parentNode; if (!elem) { return null; } } return elem; } $.extend($.mobile, { // Place to store various widget extensions behaviors: {} }); // plugins $.fn.extend({ // Enhance child elements enhanceWithin: function () { var index, widgetElements = {}, that = this; // Enhance widgets $.each($.mobile.widgets, function (name, constructor) { // If initSelector not false find elements if (constructor.initSelector) { // Filter elements that should not be enhanced based on parents var elements = that[0].querySelectorAll(constructor.initSelector); // Enhance whatever is left if (elements.length > 0) { widgetElements[constructor.prototype.widgetName] = $(elements); } } }); for (index in widgetElements) { widgetElements[index][index](); } return this; } }); })(jQuery, this); jQuery.mobile.widgets = {}; // plugins $.fn.extend({ // Enhance child elements enhanceWithin: function () { var index, widgetElements = {}, that = this; // Enhance widgets $.each($.mobile.widgets, function (name, constructor) { // If initSelector not false find elements if (constructor.initSelector) { // Filter elements that should not be enhanced based on parents var elements = that[0].querySelectorAll(constructor.initSelector); // Enhance whatever is left if (elements.length > 0) { widgetElements[constructor.prototype.widgetName] = $(elements); } } }); for (index in widgetElements) { widgetElements[index][index](); } return this; } }); // For backcompat remove in 1.5 jQuery(document).on("create", function (event) { jQuery(event.target).enhanceWithin(); }); /*! * jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40 * http://jqueryui.com * * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/jQuery.widget/ */ (function ($, undefined) { var uuid = 0, slice = Array.prototype.slice, _cleanData = $.cleanData; $.cleanData = function (elems) { for (var i = 0, elem; (elem = elems[i]) != null; i++) { try { $(elem).triggerHandler("remove"); // http://bugs.jquery.com/ticket/8235 } catch (e) { } } _cleanData(elems); }; $.widget = function (name, base, prototype) { var fullName, 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]; fullName = namespace + "-" + name; if (!prototype) { prototype = base; base = $.Widget; } // create selector for plugin $.expr[":"][fullName.toLowerCase()] = function (elem) { return !!$.data(elem, fullName); }; $[namespace] = $[namespace] || {}; existingConstructor = $[namespace][name]; constructor = $[namespace][name] = function (options, element) { // allow instantiation without "new" keyword if (!this._createWidget) { return new constructor(options, element); } // allow instantiation without initializing for simple inheritance // must use "new" keyword (the code above always passes args) if (arguments.length) { this._createWidget(options, element); } }; // extend with the existing constructor to carry over any static properties $.extend(constructor, existingConstructor, { version: prototype.version, // copy the object used to create the prototype in case we need to // redefine the widget later _proto: $.extend({}, prototype), // track widgets that inherit from this widget in case this widget is // redefined after a widget inherits from it _childConstructors: [] }); basePrototype = new base(); // 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 // inheriting from basePrototype.options = $.widget.extend({}, basePrototype.options); $.each(prototype, function (prop, value) { if (!$.isFunction(value)) { proxiedPrototype[prop] = value; return; } proxiedPrototype[prop] = (function () { var _super = function () { return base.prototype[prop].apply(this, arguments); }, _superApply = function (args) { return base.prototype[prop].apply(this, args); }; return function () { var __super = this._super, __superApply = this._superApply, returnValue; this._super = _super; this._superApply = _superApply; returnValue = value.apply(this, arguments); this._super = __super; this._superApply = __superApply; return returnValue; }; })(); }); constructor.prototype = $.widget.extend(basePrototype, { // TODO: remove support for widgetEventPrefix // always use the name + a colon as the prefix, e.g., draggable:start // don't prefix for widgets that aren't DOM-based widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name }, proxiedPrototype, { constructor: constructor, namespace: namespace, widgetName: name, widgetFullName: fullName }); // 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 // the new version of this widget. We're essentially trying to replace one // level in the prototype chain. if (existingConstructor) { $.each(existingConstructor._childConstructors, function (i, child) { var childPrototype = child.prototype; // redefine the child widget using the same prototype that was // originally used, but inherit from the new version of the base $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto); }); // remove the list of existing child constructors from the old constructor // so the old child constructors can be garbage collected delete existingConstructor._childConstructors; } else { base._childConstructors.push(constructor); } $.widget.bridge(name, constructor); return constructor; }; $.widget.extend = function (target) { var input = slice.call(arguments, 1), inputIndex = 0, inputLength = input.length, key, value; for (; inputIndex < inputLength; inputIndex++) { for (key in input[inputIndex]) { value = input[inputIndex][key]; if (input[inputIndex].hasOwnProperty(key) && value !== undefined) { // Clone objects if ($.isPlainObject(value)) { target[key] = $.isPlainObject(target[key]) ? $.widget.extend({}, target[key], value) : // Don't extend strings, arrays, etc. with objects $.widget.extend({}, value); // Copy everything else by reference } else { target[key] = value; } } } } return target; }; $.widget.bridge = function (name, object) { var fullName = object.prototype.widgetFullName || name; $.fn[name] = function (options) { var isMethodCall = typeof options === "string", args = slice.call(arguments, 1), returnValue = this; // allow multiple hashes to be passed on init options = !isMethodCall && args.length ? $.widget.extend.apply(null, [options].concat(args)) : options; if (isMethodCall) { this.each(function () { var methodValue, instance = $.data(this, fullName); if (options === "instance") { returnValue = instance; return false; } if (!instance) { return $.error("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"); } methodValue = instance[options].apply(instance, args); if (methodValue !== instance && methodValue !== undefined) { returnValue = methodValue && methodValue.jquery ? returnValue.pushStack(methodValue.get()) : methodValue; return false; } }); } else { this.each(function () { var instance = $.data(this, fullName); if (instance) { instance.option(options || {})._init(); } else { $.data(this, fullName, new object(options, this)); } }); } return returnValue; }; }; $.Widget = function ( /* options, element */) { }; $.Widget._childConstructors = []; $.Widget.prototype = { widgetName: "widget", widgetEventPrefix: "", defaultElement: "