PageSourceSearch

https://visitdelphi.gr/wp-content/plugins/easy-accordion-free/public/assets/js/collapse.js?ver=3.0.6

js visitdelphi.gr collected 2026-10-02 12:37:20 UTC 19,193 bytes, 487 lines download raw bytes

1;(function($) {
2    (function () {
3        function _defineProperties(target, props) {
4            for (var i = 0; i < props.length; i++) {
5                var descriptor = props[i];
6                descriptor.enumerable = descriptor.enumerable || false;
7                descriptor.configurable = true;
8                if ("value" in descriptor) descriptor.writable = true;
9                Object.defineProperty(target, descriptor.key, descriptor);
10            }
11        }
12
13        function _createClass(Constructor, protoProps, staticProps) {
14            if (protoProps) _defineProperties(Constructor.prototype, protoProps);
15            if (staticProps) _defineProperties(Constructor, staticProps);
16            return Constructor;
17        }
18
19        function _defineProperty(obj, key, value) {
20            if (key in obj) {
21                Object.defineProperty(obj, key, {
22                    value: value,
23                    enumerable: true,
24                    configurable: true,
25                    writable: true
26                });
27            } else {
28                obj[key] = value;
29            }
30
31            return obj;
32        }
33
34        function _objectSpread(target) {
35            for (var i = 1; i < arguments.length; i++) {
36                var source = arguments[i] != null ? arguments[i] : {};
37                var ownKeys = Object.keys(source);
38
39                if (typeof Object.getOwnPropertySymbols === 'function') {
40                    ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
41                        return Object.getOwnPropertyDescriptor(source, sym).enumerable;
42                    }));
43                }
44
45                ownKeys.forEach(function (key) {
46                    _defineProperty(target, key, source[key]);
47                });
48            }
49
50            return target;
51        }
52        var TRANSITION_END = 'transitionend';
53        var MILLISECONDS_MULTIPLIER = 1000;
54
55        function getSelectorFromElement(element) {
56            var selector = element.getAttribute('data-sptarget');
57
58            if (!selector || selector === '#') {
59                var hrefAttr = element.getAttribute('href');
60                selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
61            }
62            try {
63                return document.querySelector(selector) ? selector : null;
64            } catch (err) {
65                return null;
66            }
67        };
68
69        function reflow(element) {
70            return element.offsetHeight;
71        };
72
73        function getTransitionDurationFromElement(element) {
74            if (!element) {
75                return 0
76            }
77            var transitionDuration = $(element).css('transition-duration')
78            var floatTransitionDuration = parseFloat(transitionDuration)
79            if (!floatTransitionDuration) {
80                return 0
81            }
82            transitionDuration = transitionDuration.split(',')[0]
83            return parseFloat(transitionDuration) * MILLISECONDS_MULTIPLIER
84        }; // Get transition-duration of the element
85        function isElement(obj) {
86            return (obj[0] || obj).nodeType;
87        };
88
89        function toType(obj) {
90            return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
91        };
92
93        function typeCheckConfig(componentName, config, configTypes) {
94            Object.keys(configTypes).forEach(function (property) {
95                var expectedTypes = configTypes[property];
96                var value = config[property];
97                var valueType = value && isElement(value) ? 'element' : toType(value);
98
99                if (!new RegExp(expectedTypes).test(valueType)) {
100                    throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
101                }
102            });
103        };
104
105        function triggerTransitionEnd(element) {
106            $(element).trigger(TRANSITION_END)
107        }
108
109        function transitionEndEmulator(duration) {
110            var called = false
111            $(this).one(SPCollapse.TRANSITION_END, function (event) {
112                called = true
113            });
114            setTimeout(function () {
115                if (!called) {
116                    triggerTransitionEnd(this);
117                }
118            }, duration)
119            return this
120        }
121
122        function setTransitionEndSupport() {
123            $.fn.emulateTransitionEnd = transitionEndEmulator
124        };
125        setTransitionEndSupport();
126        /**
127         * ------------------------------------------------------------------------
128         * Constants
129         * ------------------------------------------------------------------------
130         */
131
132        var NAME = 'spcollapse';
133        var VERSION = '2.0.2';
134        var DATA_KEY = 'bs.spcollapse';
135        var EVENT_KEY = "." + DATA_KEY;
136        var DATA_API_KEY = '.data-api';
137        var JQUERY_NO_CONFLICT = $.fn[NAME];
138        var Default = {
139            toggle: true,
140            parent: ''
141        };
142        var DefaultType = {
143            toggle: 'boolean',
144            parent: '(string|element)'
145        };
146        var Event = {
147            SHOW: "show" + EVENT_KEY,
148            SHOWN: "shown" + EVENT_KEY,
149            HIDE: "hide" + EVENT_KEY,
150            HIDDEN: "hidden" + EVENT_KEY,
151            CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
152        };
153        var ClassName = {
154            SHOW: 'show',
155            COLLAPSE: 'spcollapse',
156            COLLAPSING: 'spcollapsing',
157            COLLAPSED: 'collapsed'
158        };
159        var Dimension = {
160            WIDTH: 'width',
161            HEIGHT: 'height'
162        };
163        var Selector = {
164            ACTIVES: '.show, .spcollapsing',
165            DATA_TOGGLE: '[data-sptoggle="spcollapse"]'
166            /**
167             * ------------------------------------------------------------------------
168             * Class Definition
169             * ------------------------------------------------------------------------
170             */
171
172        };
173
174        var SPCollapse =
175            /*#__PURE__*/
176            function () {
177                function SPCollapse(element, config) {
178                    this._isTransitioning = false;
179                    this._element = element;
180                    this._config = this._getConfig(config);
181                    this._triggerArray = [].slice.call(document.querySelectorAll("[data-sptoggle=\"spcollapse\"][href=\"#" + element.id + "\"]," + ("[data-sptoggle=\"spcollapse\"][data-sptarget=\"#" + element.id + "\"]")));
182                    var toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE));
183
184                    for (var i = 0, len = toggleList.length; i < len; i++) {
185                        var elem = toggleList[i];
186                        var selector = getSelectorFromElement(elem);
187                        var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
188                            return foundElem === element;
189                        });
190
191                        if (selector !== null && filterElement.length > 0) {
192                            this._selector = selector;
193
194                            this._triggerArray.push(elem);
195                        }
196                    }
197
198                    this._parent = this._config.parent ? this._getParent() : null;
199
200                    if (!this._config.parent) {
201                        this._addAriaAndCollapsedClass(this._element, this._triggerArray);
202                    }
203
204                    if (this._config.toggle) {
205                        this.toggle();
206                    }
207                } // Getters
208
209
210                var _proto = SPCollapse.prototype;
211
212                // Public
213                _proto.toggle = function toggle() {
214                    if ($(this._element).hasClass(ClassName.SHOW)) {
215                        this.hide();
216                    } else {
217                        this.show();
218                    }
219                };
220
221                _proto.show = function show() {
222                    var _this = this;
223
224                    if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) {
225                        return;
226                    }
227
228                    var actives;
229                    var activesData;
230
231                    if (this._parent) {
232                        actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
233                            if (typeof _this._config.parent === 'string') {
234                                return elem.getAttribute('data-parent') === _this._config.parent;
235                            }
236
237                            return elem.classList.contains(ClassName.COLLAPSE);
238                        });
239
240                        if (actives.length === 0) {
241                            actives = null;
242                        }
243                    }
244
245                    if (actives) {
246                        activesData = $(actives).not(this._selector).data(DATA_KEY);
247
248                        if (activesData && activesData._isTransitioning) {
249                            return;
250                        }
251                    }
252
253                    var startEvent = $.Event(Event.SHOW);
254                    $(this._element).trigger(startEvent);
255
256                    if (startEvent.isDefaultPrevented()) {
257                        return;
258                    }
259
260                    if (actives) {
261                        SPCollapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
262
263                        if (!activesData) {
264                            $(actives).data(DATA_KEY, null);
265                        }
266                    }
267
268                    var dimension = this._getDimension();
269
270                    $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING);
271                    this._element.style[dimension] = 0;
272
273                    if (this._triggerArray.length) {
274                        $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true);
275                    }
276
277                    this.setTransitioning(true);
278
279                    var complete = function complete() {
280                        $(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW);
281                        _this._element.style[dimension] = '';
282
283                        _this.setTransitioning(false);
284
285                        $(_this._element).trigger(Event.SHOWN);
286                    };
287
288                    var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
289                    var scrollSize = "scroll" + capitalizedDimension;
290                    var transitionDuration = getTransitionDurationFromElement(this._element);
291                    $(this._element).one(TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
292                    this._element.style[dimension] = this._element[scrollSize] + "px";
293                };
294
295                _proto.hide = function hide() {
296                    var _this2 = this;
297
298                    if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) {
299                        return;
300                    }
301
302                    var startEvent = $.Event(Event.HIDE);
303                    $(this._element).trigger(startEvent);
304
305                    if (startEvent.isDefaultPrevented()) {
306                        return;
307                    }
308
309                    var dimension = this._getDimension();
310
311                    this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
312                    reflow(this._element);
313                    $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW);
314                    var triggerArrayLength = this._triggerArray.length;
315
316                    if (triggerArrayLength > 0) {
317                        for (var i = 0; i < triggerArrayLength; i++) {
318                            var trigger = this._triggerArray[i];
319                            var selector = getSelectorFromElement(trigger);
320
321                            if (selector !== null) {
322                                var $elem = $([].slice.call(document.querySelectorAll(selector)));
323
324                                if (!$elem.hasClass(ClassName.SHOW)) {
325                                    $(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false);
326                                }
327                            }
328                        }
329                    }
330
331                    this.setTransitioning(true);
332
333                    var complete = function complete() {
334                        _this2.setTransitioning(false);
335
336                        $(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN);
337                    };
338
339                    this._element.style[dimension] = '';
340                    var transitionDuration = getTransitionDurationFromElement(this._element);
341                    $(this._element).one(TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
342                };
343
344                _proto.setTransitioning = function setTransitioning(isTransitioning) {
345                    this._isTransitioning = isTransitioning;
346                };
347
348                _proto.dispose = function dispose() {
349                    $.removeData(this._element, DATA_KEY);
350                    this._config = null;
351                    this._parent = null;
352                    this._element = null;
353                    this._triggerArray = null;
354                    this._isTransitioning = null;
355                } // Private
356                ;
357
358                _proto._getConfig = function _getConfig(config) {
359                    config = _objectSpread({}, Default, config);
360                    config.toggle = Boolean(config.toggle); // Coerce string values
361
362                    typeCheckConfig(NAME, config, DefaultType);
363                    return config;
364                };
365
366                _proto._getDimension = function _getDimension() {
367                    var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
368                    return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
369                };
370
371                _proto._getParent = function _getParent() {
372                    var _this3 = this;
373
374                    var parent;
375
376                    if (isElement(this._config.parent)) {
377                        parent = this._config.parent; // It's a jQuery object
378
379                        if (typeof this._config.parent.jquery !== 'undefined') {
380                            parent = this._config.parent[0];
381                        }
382                    } else {
383                        parent = document.querySelector(this._config.parent);
384                    }
385
386                    var selector = "[data-sptoggle=\"spcollapse\"][data-parent=\"" + this._config.parent + "\"]";
387                    var children = [].slice.call(parent.querySelectorAll(selector));
388                    $(children).each(function (i, element) {
389                        _this3._addAriaAndCollapsedClass(SPCollapse._getTargetFromElement(element), [element]);
390                    });
391                    return parent;
392                };
393
394                _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
395                    var isOpen = $(element).hasClass(ClassName.SHOW);
396
397                    if (triggerArray.length) {
398                        $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
399                    }
400                } // Static
401                ;
402
403                SPCollapse._getTargetFromElement = function _getTargetFromElement(element) {
404                    var selector = getSelectorFromElement(element);
405                    return selector ? document.querySelector(selector) : null;
406                };
407
408                SPCollapse._jQueryInterface = function _jQueryInterface(config) {
409                    return this.each(function () {
410                        var $this = $(this);
411                        var data = $this.data(DATA_KEY);
412
413                        var _config = _objectSpread({}, Default, $this.data(), typeof config === 'object' && config ? config : {});
414
415                        if (!data && _config.toggle && /show|hide/.test(config)) {
416                            _config.toggle = false;
417                        }
418
419                        if (!data) {
420                            data = new SPCollapse(this, _config);
421                            $this.data(DATA_KEY, data);
422                        }
423
424                        if (typeof config === 'string') {
425                            if (typeof data[config] === 'undefined') {
426                                throw new TypeError("No method named \"" + config + "\"");
427                            }
428
429                            data[config]();
430                        }
431                    });
432                };
433
434                _createClass(SPCollapse, null, [{
435                    key: "VERSION",
436                    get: function get() {
437                        return VERSION;
438                    }
439                }, {
440                    key: "Default",
441                    get: function get() {
442                        return Default;
443                    }
444                }]);
445
446                return SPCollapse;
447            }();
448        /**
449         * ------------------------------------------------------------------------
450         * Data Api implementation
451         * ------------------------------------------------------------------------
452         */
453
454
455        $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
456            // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
457            if (event.currentTarget.tagName === 'A') {
458                event.preventDefault();
459            }
460            var $trigger = $(this);
461            var selector = getSelectorFromElement(this);
462            var selectors = [].slice.call(document.querySelectorAll(selector));
463            $(selectors).each(function () {
464                var $target = $(this);
465                var data = $target.data(DATA_KEY);
466                var config = data ? 'toggle' : $trigger.data();
467
468                SPCollapse._jQueryInterface.call($target, config);
469            });
470        });
471        /**
472         * ------------------------------------------------------------------------
473         * jQuery
474         * ------------------------------------------------------------------------
475         */
476
477        $.fn[NAME] = SPCollapse._jQueryInterface;
478        $.fn[NAME].Constructor = SPCollapse;
479
480        $.fn[NAME].noConflict = function () {
481            $.fn[NAME] = JQUERY_NO_CONFLICT;
482            return SPCollapse._jQueryInterface;
483        };
484
485        return SPCollapse;
486    }());
487})(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.