PageSourceSearch

https://instaredebine.ro/wp-content/themes/pxlz/assets/js/modules/plugins/jquery.plugin.js?ver=7.1.2

js instaredebine.ro collected 2026-09-24 13:05:13 UTC 6,648 bytes, 175 lines download raw bytes

1/* Simple JavaScript Inheritance
2 * By John Resig http://ejohn.org/
3 * MIT Licensed.
4 */
5// Inspired by base2 and Prototype
6(function () {
7    var initializing = false;
8    window.JQClass = function () {
9    };
10    JQClass.classes = {};
11    JQClass.extend = function extender(prop) {
12        var base = this.prototype;
13        initializing = true;
14        var prototype = new this();
15        initializing = false;
16        for (var name in prop) {
17            prototype[name] = typeof prop[name] == 'function' && typeof base[name] == 'function' ? (function (name, fn) {
18                return function () {
19                    var __super = this._super;
20                    this._super = function (args) {
21                        return base[name].apply(this, args || []);
22                    };
23                    var ret = fn.apply(this, arguments);
24                    this._super = __super;
25                    return ret;
26                };
27            })(name, prop[name]) : prop[name];
28        }
29        function JQClass() {
30            if (!initializing && this._init) {
31                this._init.apply(this, arguments);
32            }
33        }
34
35        JQClass.prototype = prototype;
36        JQClass.prototype.constructor = JQClass;
37        JQClass.extend = extender;
38        return JQClass;
39    };
40})();
41
42(function ($) {
43    /** Abstract base class for collection plugins v1.0.1.
44     Written by Keith Wood (kbwood{at}iinet.com.au) December 2013.
45     Licensed under the MIT (http://keith-wood.name/licence.html) license.
46     @module $.JQPlugin
47     @abstract */
48    JQClass.classes.JQPlugin = JQClass.extend({
49        name: 'plugin',
50        defaultOptions: {},
51        regionalOptions: {},
52        _getters: [],
53        _getMarker: function () {
54            return 'is-' + this.name;
55        },
56        _init: function () {
57            $.extend(this.defaultOptions, (this.regionalOptions && this.regionalOptions['']) || {});
58            var jqName = camelCase(this.name);
59            $[jqName] = this;
60            $.fn[jqName] = function (options) {
61                var otherArgs = Array.prototype.slice.call(arguments, 1);
62                if ($[jqName]._isNotChained(options, otherArgs)) {
63                    return $[jqName][options].apply($[jqName], [this[0]].concat(otherArgs));
64                }
65                return this.each(function () {
66                    if (typeof options === 'string') {
67                        if (options[0] === '_' || !$[jqName][options]) {
68                            throw 'Unknown method: ' + options;
69                        }
70                        $[jqName][options].apply($[jqName], [this].concat(otherArgs));
71                    } else {
72                        $[jqName]._attach(this, options);
73                    }
74                });
75            };
76        },
77        setDefaults: function (options) {
78            $.extend(this.defaultOptions, options || {});
79        },
80        _isNotChained: function (name, otherArgs) {
81            if (name === 'option' && (otherArgs.length === 0 || (otherArgs.length === 1 && typeof otherArgs[0] === 'string'))) {
82                return true;
83            }
84            return $.inArray(name, this._getters) > -1;
85        },
86        _attach: function (elem, options) {
87            elem = $(elem);
88            if (elem.hasClass(this._getMarker())) {
89                return;
90            }
91            elem.addClass(this._getMarker());
92            options = $.extend({}, this.defaultOptions, this._getMetadata(elem), options || {});
93            var inst = $.extend({name: this.name, elem: elem, options: options}, this._instSettings(elem, options));
94            elem.data(this.name, inst);
95            this._postAttach(elem, inst);
96            this.option(elem, options);
97        },
98        _instSettings: function (elem, options) {
99            return {};
100        },
101        _postAttach: function (elem, inst) {
102        },
103        _getMetadata: function (elem) {
104            try {
105                var data = elem.data(this.name.toLowerCase()) || '';
106                data = data.replace(/'/g, '"');
107                data = data.replace(/([a-zA-Z0-9]+):/g, function (match, group, i) {
108                    var count = data.substring(0, i).match(/"/g);
109                    return (!count || count.length % 2 === 0 ? '"' + group + '":' : group + ':');
110                });
111                data = $.parseJSON('{' + data + '}');
112                for (var name in data) {
113                    var value = data[name];
114                    if (typeof value === 'string' && value.match(/^new Date\((.*)\)$/)) {
115                        data[name] = eval(value);
116                    }
117                }
118                return data;
119            } catch (e) {
120                return {};
121            }
122        },
123        _getInst: function (elem) {
124            return $(elem).data(this.name) || {};
125        },
126        option: function (elem, name, value) {
127            elem = $(elem);
128            var inst = elem.data(this.name);
129            if (!name || (typeof name === 'string' && value == null)) {
130                var options = (inst || {}).options;
131                return (options && name ? options[name] : options);
132            }
133            if (!elem.hasClass(this._getMarker())) {
134                return;
135            }
136            var options = name || {};
137            if (typeof name === 'string') {
138                options = {};
139                options[name] = value;
140            }
141            this._optionsChanged(elem, inst, options);
142            $.extend(inst.options, options);
143        },
144        _optionsChanged: function (elem, inst, options) {
145        },
146        destroy: function (elem) {
147            elem = $(elem);
148            if (!elem.hasClass(this._getMarker())) {
149                return;
150            }
151            this._preDestroy(elem, this._getInst(elem));
152            elem.removeData(this.name).removeClass(this._getMarker());
153        },
154        _preDestroy: function (elem, inst) {
155        }
156    });
157    function camelCase(name) {
158        return name.replace(/-([a-z])/g, function (match, group) {
159            return group.toUpperCase();
160        });
161    }
162
163    $.JQPlugin = {
164        createPlugin: function (superClass, overrides) {
165            if (typeof superClass === 'object') {
166                overrides = superClass;
167                superClass = 'JQPlugin';
168            }
169            superClass = camelCase(superClass);
170            var className = camelCase(overrides.name);
171            JQClass.classes[className] = JQClass.classes[superClass].extend(overrides);
172            new JQClass.classes[className]();
173        }
174    };
175})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.