1
/* Simple JavaScript Inheritance
2
* By John Resig http://ejohn.org/
3
* MIT Licensed.
4
*/
5
// Inspired by base2 and Prototype
6
(function(){var initializing = false; window.JQClass = function(){}
7
; JQClass.classes = {}
8
; JQClass.extend = function extender(prop) {var base = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) {prototype[name] = typeof prop[name] == 'function' && typeof base[name] == 'function' ? (function(name, fn){return function() {var __super = this._super; this._super = function(args) {return base[name].apply(this, args || []); }
9
; var ret = fn.apply(this, arguments); this._super = __super; return ret; }
10
; }
11
)(name, prop[name]) : prop[name]; }
12
function JQClass() {if (!initializing && this._init) {this._init.apply(this, arguments); }
13
}
14
JQClass.prototype = prototype; JQClass.prototype.constructor = JQClass; JQClass.extend = extender; return JQClass; }
15
; }
16
)();
17
18
(function($) {
19
/** Abstract base class for collection plugins v1.0.1.
20
Written by Keith Wood (kbwood{at}
21
iinet.com.au) December 2013.
22
Licensed under the MIT (http://keith-wood.name/licence.html) license.
23
@module $.JQPlugin
24
@abstract */
25
JQClass.classes.JQPlugin = JQClass.extend({name: 'plugin', defaultOptions: {}
26
, regionalOptions: {}
27
, _getters: [], _getMarker: function() {return 'is-' + this.name; }
28
, _init: function() {$.extend(this.defaultOptions, (this.regionalOptions && this.regionalOptions['']) || {}
29
); var jqName = camelCase(this.name); $[jqName] = this; $.fn[jqName] = function(options) {var otherArgs = Array.prototype.slice.call(arguments, 1); if ($[jqName]._isNotChained(options, otherArgs)) {return $[jqName][options].apply($[jqName], [this[0]].concat(otherArgs)); }
30
return this.each(function() {if (typeof options === 'string') {if (options[0] === '_' || !$[jqName][options]) {throw 'Unknown method: ' + options; }
31
$[jqName][options].apply($[jqName], [this].concat(otherArgs)); }
32
else {$[jqName]._attach(this, options); }
33
}
34
); }
35
; }
36
, setDefaults: function(options) {$.extend(this.defaultOptions, options || {}
37
); }
38
, _isNotChained: function(name, otherArgs) {if (name === 'option' && (otherArgs.length === 0 || (otherArgs.length === 1 && typeof otherArgs[0] === 'string'))) {return true; }
39
return $.inArray(name, this._getters) > -1; }
40
, _attach: function(elem, options) {elem = $(elem); if (elem.hasClass(this._getMarker())) {return; }
...
</html>