PageSourceSearch

https://gtsenter.no/wp-content/plugins/business-reviews-bundle/assets/js/rplg.js?ver=1.3.6

js gtsenter.no collected 2026-10-02 23:13:18 UTC 5,858 bytes, 183 lines download raw bytes

1function _rplg_badge_init(el) {
2    var badge_cnt = el.querySelector('.rplg-badge-cnt');
3    if (badge_cnt.className.indexOf('-fixed') > -1) {
4        document.body.appendChild(el);
5    }
6
7    var badges = el.querySelectorAll('.rplg-badge2'),
8        rplg   = document.createElement('div');
9
10    for (var i = 0; i < badges.length; i++) {
11        var badge = badges[i],
12            btn   = badge.querySelector('.rplg-badge2-btn'),
13            form  = badge.querySelector('.rplg-form');
14
15        if (form) {
16            (function(btn, form) {
17                btn.onclick = function() {
18                    rplg_load_imgs(form);
19                    form.style.display='block';
20                };
21                rplg.appendChild(form);
22            })(btn, form);
23        }
24    }
25
26    if (rplg.hasChildNodes()) {
27        rplg.className = 'rplg';
28        document.body.appendChild(rplg);
29    }
30}
31
32function rplg_load_imgs(el) {
33    var imgs = el.querySelectorAll('img.rplg-blazy[data-src]');
34    for (var i = 0; i < imgs.length; i++) {
35        imgs[i].setAttribute('src', imgs[i].getAttribute('data-src'));
36        imgs[i].removeAttribute('data-src');
37    }
38}
39
40function rplg_next_reviews(pagin) {
41    var parent = this.parentNode,
42        selector = '.rplg .rplg-hide';
43        reviews = parent.querySelectorAll(selector);
44    for (var i = 0; i < pagin && i < reviews.length; i++) {
45        if (reviews[i]) {
46            reviews[i].className = reviews[i].className.replace('rplg-hide', '');
47        }
48    }
49    reviews = parent.querySelectorAll(selector);
50    if (reviews.length < 1) {
51        parent.removeChild(this);
52    }
53    window.rplg_blazy && window.rplg_blazy.revalidate();
54    return false;
55}
56
57function rplg_leave_review_window() {
58    _rplg_popup(this.getAttribute('href'), 620, 500);
59    return false;
60}
61
62function _rplg_lang() {
63    var n = navigator;
64    return (n.language || n.systemLanguage || n.userLanguage ||  'en').substr(0, 2).toLowerCase();
65}
66
67function _rplg_popup(url, width, height) {
68    var dual_left = window.screenLeft != undefined ? window.screenLeft : window.screenX,
69        dual_top = window.screenTop != undefined ? window.screenTop : window.screenY,
70
71        doc_elem = document.documentElement,
72        screen_width = window.innerWidth ? window.innerWidth : doc_elem.clientWidth ? doc_elem.clientWidth : screen.width,
73        screen_height = window.innerHeight ? window.innerHeight : doc_elem.clientHeight ? doc_elem.clientHeight : screen.height,
74
75        left = ((screen_width / 2) - (width / 2)) + dual_left,
76        top = ((screen_height / 2) - (height / 2)) + dual_top,
77        win = window.open(url, '', 'scrollbars=yes, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
78
79    if (window.focus) {
80        win.focus();
81    }
82
83    return win;
84}
85
86function _rplg_init_timeago(el) {
87    var els = el.querySelectorAll('.rplg-review-time');
88    for (var i = 0; i < els.length; i++) {
89        var clss = els[i].className, time;
90        time = parseInt(els[i].getAttribute('data-time')) * 1000;
91        els[i].innerHTML = WPacTime.getTime(time, _rplg_lang(), 'ago');
92    }
93}
94
95function _rplg_init_blazy(attempts) {
96    if (!window.Blazy) {
97        if (attempts > 0) {
98            setTimeout(function() { _rplg_init_blazy(attempts - 1); }, 200);
99        }
100        return;
101    }
102    window.rplg_blazy = new Blazy({selector: 'img.rplg-blazy'});
103}
104
105function _rplg_init_slider(el, data) {
106    if (!window.Rplgsw) {
107        return setTimeout(function() { _rplg_init_slider(el, data); }, 200);
108    }
109    var swiperEl = el.querySelector('.rplgsw-container'),
110        swiperData = {
111            loop                : true,
112            autoplay            : parseInt(data.speed),
113            effect              : data.effect,
114            slidesPerView       : parseInt(data.count),
115            spaceBetween        : parseInt(data.space),
116            autoHeight          : true,
117            fade                : { crossFade : true },
118            breakpoints         : {},
119            onInit              : function(swiper) {
120                setTimeout(function() {
121                    window.dispatchEvent(new Event('resize'));
122                }, 500);
123            },
124            onTransitionEnd     : function(swiper){
125                window.rplg_blazy && window.rplg_blazy.revalidate();
126            }
127        };
128
129    if (data.pagin) {
130        swiperData.paginationClickable = true;
131        swiperData.pagination = '.rplgsw-pagination';
132    }
133    if (data.nextprev) {
134        swiperData.nextButton = el.querySelector('.rplg-slider-next');
135        swiperData.prevButton = el.querySelector('.rplg-slider-prev');
136    }
137    swiperData.breakpoints[data.mobileBreakpoint] = {
138        slidesPerView: parseInt(data.mobileCount),
139        spaceBetween: 10
140    };
141    swiperData.breakpoints[data.tabletBreakpoint] = {
142        slidesPerView: parseInt(data.tabletCount),
143        spaceBetween: 20
144    };
145    swiperData.breakpoints[data.desktopBreakpoint] = {
146        slidesPerView: parseInt(data.desktopCount),
147        spaceBetween: 30
148    };
149    return new Rplgsw(swiperEl, swiperData);
150}
151
152function _rplg_get_parent(el) {
153    if (el.className.indexOf('rplg') < 0) {
154        while ((el = el.parentElement) && el.className.indexOf('rplg') < 0);
155    }
156    return el;
157}
158
159function rplg_init_slider_theme(el, data) {
160    el = _rplg_get_parent(el);
161    _rplg_init_timeago(el);
162    _rplg_init_slider(el, data);
163    _rplg_init_blazy(10);
164}
165
166function rplg_init_grid_theme(el) {
167    el = _rplg_get_parent(el);
168    _rplg_init_timeago(el);
169    _rplg_init_blazy(10);
170}
171
172function rplg_init_list_theme(el) {
173    el = _rplg_get_parent(el);
174    _rplg_init_timeago(el);
175    _rplg_init_blazy(10);
176}
177
178function rplg_init_badge_theme(el) {
179    el = _rplg_get_parent(el);
180    _rplg_init_timeago(el);
181    _rplg_badge_init(el);
182    _rplg_init_blazy(10);
183}

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.