1var d = new Date(), 2 ctTimeMs = new Date().getTime(), 3 ctMouseEventTimerFlag = true, //Reading interval flag 4 ctMouseData = "[", 5 ctMouseDataCounter = 0; 6 7function ctSetCookie(c_name, value) { 8 document.cookie = c_name + "=" + encodeURIComponent(value) + "; path=/"; 9} 10 11ctSetCookie("ct_ps_timestamp", Math.floor(new Date().getTime()/1000)); 12ctSetCookie("ct_fkp_timestamp", "0"); 13ctSetCookie("ct_pointer_data", "0"); 14ctSetCookie("ct_timezone", d.getTimezoneOffset()/60*(-1)); 15 16//Reading interval 17var ctMouseReadInterval = setInterval(function(){ 18 ctMouseEventTimerFlag = true; 19 }, 150); 20 21//Writting interval 22var ctMouseWriteDataInterval = setInterval(function(){ 23 var ctMouseDataToSend = ctMouseData.slice(0,-1).concat("]"); 24 ctSetCookie("ct_pointer_data", ctMouseDataToSend); 25 }, 1200); 26 27//Stop observing function 28function ctMouseStopData(){ 29 if(typeof window.addEventListener == "function") 30 window.removeEventListener("mousemove", ctFunctionMouseMove); 31 else 32 window.detachEvent("onmousemove", ctFunctionMouseMove); 33 clearInterval(ctMouseReadInterval); 34 clearInterval(ctMouseWriteDataInterval); 35} 36 37//Logging mouse position each 300 ms 38var ctFunctionMouseMove = function output(event){ 39 if(ctMouseEventTimerFlag == true){ 40 var mouseDate = new Date(); 41 ctMouseData += "[" + Math.round(event.pageY) + "," + Math.round(event.pageX) + "," + Math.round(mouseDate.getTime() - ctTimeMs) + "],"; 42 ctMouseDataCounter++; 43 ctMouseEventTimerFlag = false; 44 if(ctMouseDataCounter >= 100) 45 ctMouseStopData(); 46 } 47}; 48 49//Stop key listening function 50function ctKeyStopStopListening(){ 51 if(typeof window.addEventListener == "function"){ 52 window.removeEventListener("mousedown", ctFunctionFirstKey); 53 window.removeEventListener("keydown", ctFunctionFirstKey); 54 }else{ 55 window.detachEvent("mousedown", ctFunctionFirstKey); 56 window.detachEvent("keydown", ctFunctionFirstKey); 57 } 58} 59 60//Writing first key press timestamp 61var ctFunctionFirstKey = function output(event){ 62 var KeyTimestamp = Math.floor(new Date().getTime()/1000); 63 ctSetCookie("ct_fkp_timestamp", KeyTimestamp); 64 ctKeyStopStopListening(); 65}; 66 67if(typeof window.addEventListener == "function"){ 68 window.addEventListener("mousemove", ctFunctionMouseMove); 69 window.addEventListener("mousedown", ctFunctionFirstKey); 70 window.addEventListener("keydown", ctFunctionFirstKey); 71}else{ 72 window.attachEvent("onmousemove", ctFunctionMouseMove); 73 window.attachEvent("mousedown", ctFunctionFirstKey); 74 window.attachEvent("keydown", ctFunctionFirstKey); 75}; 76(function ($) { 77 78Drupal.googleanalytics = {}; 79 80$(document).ready(function() { 81 82 // Attach mousedown, keyup, touchstart events to document only and catch 83 // clicks on all elements. 84 $(document.body).bind("mousedown keyup touchstart", function(event) { 85 86 // Catch the closest surrounding link of a clicked element. 87 $(event.target).closest("a,area").each(function() { 88 89 // Is the clicked URL internal? 90 if (Drupal.googleanalytics.isInternal(this.href)) { 91 // Skip 'click' tracking, if custom tracking events are bound. 92 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) { 93 // Do nothing here. The custom event will handle all tracking. 94 //console.info("Click on .colorbox item has been detected."); 95 } 96 // Is download tracking activated and the file extension configured for download tracking? 97 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 98 // Download link clicked. 99 gtag('event', Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), { 100 event_category: 'Downloads', 101 event_label: Drupal.googleanalytics.getPageUrl(this.href), 102 transport_type: 'beacon' 103 }); 104 } 105 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 106 // Keep the internal URL for Google Analytics website overlay intact. 107 // @todo: May require tracking ID 108 var target = this; 109 $.each(Drupal.settings.googleanalytics.account, function () { 110 gtag('config', this, { 111 page_path: Drupal.googleanalytics.getPageUrl(target.href), 112 transport_type: 'beacon' 113 }); 114 }); 115 } 116 } 117 else { 118 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 119 // Mailto link clicked. 120 gtag('event', 'Click', { 121 event_category: 'Mails', 122 event_label: this.href.substring(7), 123 transport_type: 'beacon' 124 }); 125 } 126 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 127 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 128 // External link clicked / No top-level cross domain clicked. 129 gtag('event', 'Click', { 130 event_category: 'Outbound links', 131 event_label: this.href, 132 transport_type: 'beacon' 133 }); 134 } 135 } 136 } 137 }); 138 }); 139 140 // Track hash changes as unique pageviews, if this option has been enabled. 141 if (Drupal.settings.googleanalytics.trackUrlFragments) { 142 window.onhashchange = function() { 143 $.each(Drupal.settings.googleanalytics.account, function () { 144 gtag('config', this, { 145 page_path: location.pathname + location.search + location.hash 146 }); 147 }); 148 }; 149 } 150 151 // Colorbox: This event triggers when the transition has completed and the 152 // newly loaded content has been revealed. 153 if (Drupal.settings.googleanalytics.trackColorbox) { 154 $(document).bind("cbox_complete", function () {
155 var href = $.colorbox.element().attr("href"); 156 if (href) { 157 $.each(Drupal.settings.googleanalytics.account, function () { 158 gtag('config', this, { 159 page_path: Drupal.googleanalytics.getPageUrl(href) 160 }); 161 }); 162 } 163 }); 164 } 165 166}); 167 168/** 169 * Check whether the hostname is part of the cross domains or not. 170 * 171 * @param string hostname 172 * The hostname of the clicked URL. 173 * @param array crossDomains 174 * All cross domain hostnames as JS array. 175 * 176 * @return boolean 177 */ 178Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 179 /** 180 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 181 * `null` or `undefined`, https://bugs.jquery.com/ticket/10076, 182 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 183 * 184 * @todo: Remove/Refactor in D8 185 */ 186 if (!crossDomains) { 187 return false; 188 } 189 else { 190 return $.inArray(hostname, crossDomains) > -1 ? true : false; 191 } 192}; 193 194/** 195 * Check whether this is a download URL or not. 196 * 197 * @param string url 198 * The web url to check. 199 * 200 * @return boolean 201 */ 202Drupal.googleanalytics.isDownload = function (url) { 203 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 204 return isDownload.test(url); 205}; 206 207/** 208 * Check whether this is an absolute internal URL or not. 209 * 210 * @param string url 211 * The web url to check. 212 * 213 * @return boolean 214 */ 215Drupal.googleanalytics.isInternal = function (url) { 216 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 217 return isInternal.test(url); 218}; 219 220/** 221 * Check whether this is a special URL or not. 222 * 223 * URL types: 224 * - gotwo.module /go/* links. 225 * 226 * @param string url 227 * The web url to check. 228 * 229 * @return boolean 230 */ 231Drupal.googleanalytics.isInternalSpecial = function (url) { 232 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 233 return isInternalSpecial.test(url); 234}; 235 236/** 237 * Extract the relative internal URL from an absolute internal URL. 238 * 239 * Examples: 240 * - https://mydomain.com/node/1 -> /node/1 241 * - https://example.com/foo/bar -> https://example.com/foo/bar 242 * 243 * @param string url 244 * The web url to check. 245 * 246 * @return string 247 * Internal website URL 248 */ 249Drupal.googleanalytics.getPageUrl = function (url) { 250 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 251 return url.replace(extractInternalUrl, ''); 252}; 253 254/** 255 * Extract the download file extension from the URL. 256 * 257 * @param string url 258 * The web url to check. 259 * 260 * @return string 261 * The file extension of the passed url. e.g. "zip", "txt" 262 */ 263Drupal.googleanalytics.getDownloadExtension = function (url) { 264 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 265 var extension = extractDownloadextension.exec(url); 266 return (extension === null) ? '' : extension[1]; 267}; 268 269})(jQuery); 270; 271/** 272 * @file 273 * Javascript for entity background image. 274 */ 275 276(function ($) { 277 Drupal.behaviors.entityBackgroundImage = { 278 attach: function (context) { 279 var images = Drupal.settings.entity_background_image; 280 $.each(images, function (selector, value) { 281 $(selector).css('background-image', 'url(' + value.image + ')'); 282 // Add class. 283 $(selector).addClass('eb-image'); 284 // Add style class. 285 if (value.style) { 286 $(selector).addClass(value.style); 287 } 288 }); 289 } 290 }; 291 292})(jQuery); 293;
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.