PageSourceSearch

https://welcomebreak.co.uk/wp-content/themes/cn-core-theme/assets/js/modules/element-cycle.js

js welcomebreak.co.uk collected 2026-09-25 18:42:00 UTC 901 bytes, 47 lines download raw bytes

1var CN = CN || {};
2
3/**
4 * Create the object literal
5 * @param {object} el The object element with the data-attribute
6 */
7CN.ElementCycle = function(el) {
8
9    this.elements = el.children();
10
11    this.interval = el.data('element-cycle-interval');
12
13    this.currentElement = 0;
14
15    this.init();
16};
17
18CN.ElementCycle.prototype.init = function() {
19
20    var _this = this;
21
22    this.nextElement();
23
24    setInterval(function () {
25        _this.nextElement();
26    }, this.interval);
27};
28
29CN.ElementCycle.prototype.nextElement = function() {
30
31    var _this = this;
32
33    $.each(this.elements, function(element) {
34
35        if (_this.currentElement === element) {
36            $(this).addClass('is-active');
37        } else {
38            $(this).removeClass('is-active');
39        }
40    });
41
42    this.currentElement++;
43
44    if (this.currentElement >= this.elements.length) {
45        this.currentElement = 0;
46    }
47};

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.