PageSourceSearch

https://uae-voice.net/wp-content/plugins/foxiz-core/assets/core.js?ver=1.9.3

js uae-voice.net collected 2026-10-02 19:38:49 UTC 8,605 bytes, 267 lines download raw bytes

1/** FOXIZ_CORE_SCRIPT */
2var FOXIZ_CORE_SCRIPT = (function (Module, $) {
3    "use strict";
4
5    Module.init = function () {
6        this._body = $('body');
7        this.darkModeID = foxizCoreParams.darkModeID || 'RubyDarkMode';
8        this.mSiteID = foxizCoreParams.mSiteID || null;
9        this.isCMode = document.body.classList.contains("is-cmode");
10        this.personailizeUID = this.getUserUUID();
11        this.initDarkModeCookie();
12        this.switchDarkMode();
13    }
14
15    /**
16     * generate UUID
17     * @returns {string}
18     */
19    Module.generateUUID = function () {
20        const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';
21        let id = '';
22        for (let i = 0; i < 7; i++) {
23            const randomIndex = Math.floor(Math.random() * alphabet.length);
24            id += alphabet[randomIndex];
25        }
26        return id;
27    }
28
29    /**
30     * set cookies
31     * @param name
32     * @param value
33     * @param days
34     */
35    Module.setCookie = function (name, value, days = 60) {
36
37        var date = new Date();
38        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
39        var expires = '; expires=' + date.toUTCString();
40        var cookieDomain = foxizCoreParams.cookieDomain || '';
41        var cookiePath = foxizCoreParams.cookiePath || '/';
42
43        document.cookie = name + '=' + encodeURIComponent(value) + expires + '; path=' + cookiePath + '; domain=' + cookieDomain;
44    }
45
46    /**
47     * get cookie
48     * @param name
49     * @returns {string|null}
50     */
51    Module.getCookie = function (name) {
52        var nameEQ = name + '=';
53        var cookies = document.cookie.split(';');
54        for (var i = 0; i < cookies.length; i++) {
55            var cookie = cookies[i];
56            while (cookie.charAt(0) == ' ') cookie = cookie.substring(1, cookie.length);
57            if (cookie.indexOf(nameEQ) == 0) return decodeURIComponent(cookie.substring(nameEQ.length, cookie.length));
58        }
59        return null;
60    }
61
62    /**
63     * delete cookies
64     * @param name
65     */
66    Module.deleteCookie = function (name) {
67        var cookieDomain = foxizCoreParams.cookieDomain || '';
68        var cookiePath = foxizCoreParams.cookiePath || '/';
69        document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=' + cookiePath + '; domain=' + cookieDomain;
70    }
71
72    /**
73     * set localStorage
74     * @param key
75     * @param data
76     */
77    Module.setStorage = function (key, data) {
78        localStorage.setItem(key, JSON.stringify(data));
79    }
80
81    /**
82     * get localStorage
83     * @param key
84     * @param defaultValue
85     * @returns {any}
86     */
87    Module.getStorage = function (key, defaultValue) {
88        const data = localStorage.getItem(key);
89        if (data === null) {
90            return defaultValue;
91        }
92        return JSON.parse(data);
93    }
94
95    /**
96     * delelte localStorage
97     * @param key
98     */
99    Module.deleteStorage = function (key) {
100        localStorage.removeItem(key);
101    }
102
103    /**
104     * create UUID
105     * @returns {string|*}
106     */
107    Module.getUserUUID = function () {
108        let uuid;
109
110        if (!navigator.cookieEnabled) {
111            return 'uuid';
112        }
113
114        if (this.getCookie('RBUUID')) {
115            uuid = this.getCookie('RBUUID');
116        } else {
117            uuid = this.getStorage('RBUUID', null);
118            if (null === uuid) {
119                uuid = this.generateUUID();
120                this.setStorage('RBUUID', uuid);
121                this.setCookie('personalize_sync', 'yes', 1);
122            }
123
124            this.setCookie('RBUUID', uuid);
125        }
126
127        if (this.mSiteID) {
128            uuid = this.mSiteID + uuid;
129        }
130
131        return uuid;
132    }
133
134    Module.initDarkModeCookie = function () {
135        if (this.isCMode && !this.getCookie(this.darkModeID)) {
136            this.setCookie(this.darkModeID, document.body.getAttribute('data-theme'));
137        }
138    }
139
140    Module.setDarkModeCookie = function (name, value) {
141        if (this.isCMode) {
142            this.setCookie(name, value);
143        }
144    }
145
146    /**
147     * dark mode switcher
148     */
149    Module.switchDarkMode = function () {
150        var self = this;
151
152        $('.dark-mode-toggle').off('click').on('click', function (e) {
153            e.preventDefault();
154            e.stopPropagation();
155
156            if (!$(this).hasClass('triggered')) {
157                $(this).addClass('triggered')
158            }
159
160            const iconDefault = $('.mode-icon-default');
161            const iconDark = $('.mode-icon-dark');
162            const currentMode = (
163                (self.isCMode || !navigator.cookieEnabled) ?
164                    document.body.getAttribute('data-theme') :
165                    localStorage.getItem(self.darkModeID)
166            );
167
168            self._body.addClass('switch-smooth');
169
170            if ('dark' === currentMode) {
171                if (navigator.cookieEnabled) {
172                    localStorage.setItem(self.darkModeID, 'default');
173                    self.setDarkModeCookie(self.darkModeID, 'default');
174                }
175                self._body.attr('data-theme', 'default');
176                iconDefault.addClass('activated');
177                iconDark.removeClass('activated');
178            } else {
179                if (navigator.cookieEnabled) {
180                    localStorage.setItem(self.darkModeID, 'dark');
181                    self.setDarkModeCookie(self.darkModeID, 'dark');
182                }
183                self._body.attr('data-theme', 'dark');
184                iconDefault.removeClass('activated');
185                iconDark.addClass('activated');
186            }
187        })
188    }
189
190    /** share action */
191    Module.shareTrigger = function () {
192        $('a.share-trigger').off('click').on('click', function (e) {
193            e.preventDefault();
194            e.stopPropagation();
195            window.open($(this).attr('href'), '_blank', 'width=600, height=350');
196            return false;
197        });
198        $('a.copy-trigger').off('click').on('click', function (e) {
199            e.preventDefault();
200            e.stopPropagation();
201            var target = $(this);
202            var link = target.data('link');
203            var copied = target.data('copied');
204            if (link) {
205                navigator.clipboard.writeText(link).then(
206                    function () {
207                        $('body').find('.tipsy-inner').html((copied));
208                    }).catch(function () {
209                    alert('Copying is not supported by your browser.');
210                });
211            }
212        });
213    };
214
215
216    /** single infinite load */
217    Module.loadGoogleAds = function (response) {
218        var googleAds = $(response).find('.adsbygoogle');
219        if (typeof window.adsbygoogle !== 'undefined' && googleAds.length) {
220            var adsbygoogle;
221            googleAds.each(function () {
222                (adsbygoogle = window.adsbygoogle || []).push({});
223            });
224        }
225    }
226
227    Module.loadInstagram = function (response) {
228        var instEmbed = $(response).find('.instagram-media');
229        if ('undefined' !== typeof window.instgrm) {
230            window.instgrm.Embeds.process();
231        } else if (instEmbed.length && 'undefined' === typeof window.instgrm) {
232            var embedJS = document.createElement('script');
233            embedJS.src = '//platform.instagram.com/en_US/embeds.js';
234            embedJS.onload = function () {
235                window.instgrm.Embeds.process();
236            };
237            this._body.append(embedJS);
238        }
239    }
240
241    Module.updateGA = function (article) {
242        var gaURL = article.postURL.replace(/https?:\/\/[^\/]+/i, '');
243        if (typeof _gaq !== 'undefined' && _gaq !== null) {
244            _gaq.push(['_trackPageview', gaURL]);
245        }
246        if (typeof ga !== 'undefined' && ga !== null) {
247            ga('send', 'pageview', gaURL);
248        }
249        if (typeof __gaTracker !== 'undefined' && __gaTracker !== null) {
250            __gaTracker('send', 'pageview', gaURL);
251        }
252        if (window.googletag && googletag.pubadsReady) {
253            googletag.pubads().refresh();
254        }
255    }
256
257
258    return Module;
259}(FOXIZ_CORE_SCRIPT || {}, jQuery));
260
261jQuery(document).ready(function () {
262    FOXIZ_CORE_SCRIPT.init();
263});
264
265jQuery(window).on('load', function () {
266    FOXIZ_CORE_SCRIPT.shareTrigger();
267});

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.