1/** FOXIZ_CORE_SCRIPT */ 2function setDarkModeCookie(id, value) { 3 if (foxizCoreParams.darkCookieMode !== undefined) { 4 var date = new Date() 5 date.setTime(date.getTime() + 5184000000); 6 document.cookie = id + '= ' + value + '; path=/; expires=' + date.toGMTString() + ';'; 7 } 8} 9 10(function () { 11 let currentPrivacy = false; 12 let readingSize = false; 13 14 if (navigator.cookieEnabled) { 15 currentPrivacy = localStorage.getItem('RubyPrivacyAllowed'); 16 readingSize = sessionStorage.getItem('rubyResizerStep'); 17 } 18 19 let privacyBox = document.getElementById('rb-privacy'); 20 if (!currentPrivacy && privacyBox !== null) { 21 privacyBox.classList.add('activated'); 22 } 23 24 if (readingSize) { 25 let body = document.getElementsByTagName("BODY")[0]; 26 if (2 == readingSize) { 27 body.classList.add('medium-entry-size'); 28 } else if (3 == readingSize) { 29 body.classList.add('big-entry-size'); 30 } 31 } 32})(); 33 34/** core */ 35var FOXIZ_CORE_SCRIPT = (function (Module, $) { 36 "use strict"; 37 38 Module.init = function () { 39 this._body = $('body'); 40 this.switchDarkMode(); 41 this.notificationStatus(); 42 } 43 44 Module.switchDarkMode = function () { 45 var self = this; 46 let darkModeID = 'RubyDarkMode'; 47 48 if (foxizCoreParams.darkModeID) { 49 darkModeID = foxizCoreParams.darkModeID; 50 } 51 52 $('.dark-mode-toggle').off('click').on('click', function (e) { 53 e.preventDefault(); 54 e.stopPropagation(); 55 56 if (!$(this).hasClass('triggered')) { 57 $(this).addClass('triggered') 58 } 59 let iconDefault = $('.mode-icon-default'); 60 let iconDark = $('.mode-icon-dark'); 61 62 let currentMode = null; 63 64 if (navigator.cookieEnabled) { 65 currentMode = localStorage.getItem(darkModeID); 66 } 67 68 if (null === currentMode) { 69 currentMode = document.body.getAttribute('data-theme'); 70 } 71 self._body.addClass('switch-smooth'); 72 if (null === currentMode || 'default' === currentMode) { 73 if (navigator.cookieEnabled) { 74 localStorage.setItem(darkModeID, 'dark'); 75 setDarkModeCookie(darkModeID, 'dark'); 76 } 77 78 self._body.attr('data-theme', 'dark'); 79 iconDefault.removeClass('activated'); 80 iconDark.addClass('activated'); 81 } else { 82 if (navigator.cookieEnabled) { 83 localStorage.setItem(darkModeID, 'default'); 84 setDarkModeCookie(darkModeID, 'default'); 85 } 86 self._body.attr('data-theme', 'default'); 87 iconDefault.addClass('activated'); 88 iconDark.removeClass('activated'); 89 } 90 }) 91 } 92 93 /** share action */ 94 Module.shareTrigger = function () { 95 $('a.share-trigger').off('click').on('click', function (e) { 96 e.preventDefault(); 97 e.stopPropagation(); 98 window.open($(this).attr('href'), '_blank', 'width=600, height=350'); 99 return false; 100 }); 101 $('a.copy-trigger').off('click').on('click', function (e) { 102 e.preventDefault(); 103 e.stopPropagation(); 104 var target = $(this); 105 var link = target.data('link'); 106 var copied = target.data('copied'); 107 if (link) { 108 navigator.clipboard.writeText(link).then( 109 function () { 110 $('body').find('.tipsy-inner').html((copied)); 111 }); 112 } 113 }); 114 }; 115 116 Module.notificationStatus = function () { 117 let storageID = 'RubyNotification'; 118 let notification = $('.notification-icon'); 119 let statusID = notification.data('notification'); 120 if (statusID) { 121 let currentStatus = localStorage.getItem(storageID); 122 if (!currentStatus || statusID != currentStatus) { 123 notification.addClass('notification-activated'); 124 } 125 } 126 notification.on('click', function () { 127 $(this).removeClass('notification-activated'); 128 localStorage.setItem(storageID, statusID); 129 }); 130 } 131 132 /** single infinite load */ 133 Module.loadGoogleAds = function (response) { 134 var googleAds = $(response).find('.adsbygoogle'); 135 if (typeof window.adsbygoogle !== 'undefined' && googleAds.length) { 136 var adsbygoogle; 137 googleAds.each(function () { 138 (adsbygoogle = window.adsbygoogle || []).push({}); 139 }); 140 } 141 } 142 143 Module.loadInstagram = function (response) { 144 var instEmbed = $(response).find('.instagram-media'); 145 if ('undefined' !== typeof window.instgrm) { 146 window.instgrm.Embeds.process(); 147 } else if (instEmbed.length && 'undefined' === typeof window.instgrm) { 148 var embedJS = document.createElement('script'); 149 embedJS.src = '//platform.instagram.com/en_US/embeds.js'; 150 embedJS.onload = function () { 151 window.instgrm.Embeds.process(); 152 }; 153 this.$body.append(embedJS); 154 } 155 } 156 157 Module.updateGA = function (article) { 158 var gaURL = article.postURL.replace(/https?:\/\/[^\/]+/i, ''); 159 if (typeof _gaq !== 'undefined' && _gaq !== null) {
160 _gaq.push(['_trackPageview', gaURL]); 161 } 162 if (typeof ga !== 'undefined' && ga !== null) { 163 ga('send', 'pageview', gaURL); 164 } 165 if (typeof __gaTracker !== 'undefined' && __gaTracker !== null) { 166 __gaTracker('send', 'pageview', gaURL); 167 } 168 if (window.googletag && googletag.pubadsReady) { 169 googletag.pubads().refresh(); 170 } 171 } 172 173 return Module; 174}(FOXIZ_CORE_SCRIPT || {}, jQuery)); 175 176 177jQuery(document).ready(function () { 178 FOXIZ_CORE_SCRIPT.init(); 179}); 180 181jQuery(window).on('load', function () { 182 FOXIZ_CORE_SCRIPT.shareTrigger(); 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.