5 lines
6.3 KiB
JavaScript
5 lines
6.3 KiB
JavaScript
/*! jQuery UI - v1.10.3 - 2013-09-10
|
|
* http://jqueryui.com
|
|
* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */
|
|
|
|
(function(e,t){var i=0,a=Array.prototype.slice,s=e.cleanData;e.cleanData=function(t){for(var i,a=0;null!=(i=t[a]);a++)try{e(i).triggerHandler("remove")}catch(n){}s(t)},e.widget=function(i,a,s){var n,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],n=u+"-"+i,s||(s=a,a=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),h=new a,h.options=e.widget.extend({},h.options),e.each(s,function(i,s){return e.isFunction(s)?(l[i]=function(){var e=function(){return a.prototype[i].apply(this,arguments)},t=function(e){return a.prototype[i].apply(this,e)};return function(){var i,a=this._super,n=this._superApply;return this._super=e,this._superApply=t,i=s.apply(this,arguments),this._super=a,this._superApply=n,i}}(),t):(l[i]=s,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:n}),r?(e.each(r._childConstructors,function(t,i){var a=i.prototype;e.widget(a.namespace+"."+a.widgetName,o,i._proto)}),delete r._childConstructors):a._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var s,n,r=a.call(arguments,1),o=0,h=r.length;h>o;o++)for(s in r[o])n=r[o][s],r[o].hasOwnProperty(s)&&n!==t&&(i[s]=e.isPlainObject(n)?e.isPlainObject(i[s])?e.widget.extend({},i[s],n):e.widget.extend({},n):n);return i},e.widget.bridge=function(i,s){var n=s.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=a.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var a,s=e.data(this,n);return s?e.isFunction(s[r])&&"_"!==r.charAt(0)?(a=s[r].apply(s,h),a!==s&&a!==t?(l=a&&a.jquery?l.pushStack(a.get()):a,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,n);t?t.option(r||{})._init():e.data(this,n,new s(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,a){a=e(a||this.defaultElement||this)[0],this.element=e(a),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),a!==this&&(e.data(a,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===a&&this.destroy()}}),this.document=e(a.style?a.ownerDocument:a.document||a),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,a){var s,n,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},s=i.split("."),i=s.shift(),s.length){for(n=o[i]=e.widget.extend({},this.options[i]),r=0;s.length-1>r;r++)n[s[r]]=n[s[r]]||{},n=n[s[r]];if(i=s.pop(),a===t)return n[i]===t?null:n[i];n[i]=a}else{if(a===t)return this.options[i]===t?null:this.options[i];o[i]=a}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,a,s){var n,r=this;"boolean"!=typeof i&&(s=a,a=i,i=!1),s?(a=n=e(a),this.bindings=this.bindings.add(a)):(s=a,a=this.element,n=this.widget()),e.each(s,function(s,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=s.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,d=l[2];d?n.delegate(d,u,h):a.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?a[e]:e).apply(a,arguments)}var a=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,a){var s,n,r=this.options[t];if(a=a||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],n=i.originalEvent)for(s in n)s in i||(i[s]=n[s]);return this.element.trigger(i,a),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(a))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(a,s,n){"string"==typeof s&&(s={effect:s});var r,o=s?s===!0||"number"==typeof s?i:s.effect||i:t;s=s||{},"number"==typeof s&&(s={duration:s}),r=!e.isEmptyObject(s),s.complete=n,s.delay&&a.delay(s.delay),r&&e.effects&&e.effects.effect[o]?a[t](s):o!==t&&a[o]?a[o](s.duration,s.easing,n):a.queue(function(i){e(this)[t](),n&&n.call(a[0]),i()})}})})(jQuery); |