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 Drupal.behaviors.webform_feedback = { 78 attach: function (context, settings) { 79 $('#block-webform-client-block-' + Drupal.settings.webform_feedback.key).addClass('webform-feedback-block'); 80 $('#webform-client-form-' + Drupal.settings.webform_feedback.key).addClass('webform-feedback-form'); 81 $('form.webform-feedback-form:not(.filter) :input:visible:enabled:first').focus() 82 $('#webform-feedback a').click(function() { 83 $(Drupal.settings.webform_feedback.inert).prop('inert', 'inert'); 84 $('#mask-bg').show(); 85 CLOSE=0; 86 }); 87 function closeWindow() { 88 if (CLOSE == 0) { 89 $('#mask-bg').hide(); 90 $('#webform-feedback-block').slideToggle(); 91 $('#formclose').slideToggle(750); 92 $(Drupal.settings.webform_feedback.inert).removeAttr('inert'); 93 CLOSE = 1; 94 return false; 95 } 96 } 97 $('a.webform-feedback-close, #mask-bg:not(#webform-feedback-block)').click(function() { 98 closeWindow(); 99 }); 100 $(document).keyup(function(e) { 101 if ( (e.keyCode == 27) && (CLOSE == 0) ) { 102 closeWindow(); 103 } 104 }); 105 if($(window).width() < 820) { 106 $('#webform-feedback-block').addClass('small'); 107 } 108 if($('#ajax-loader').length == 0) 109 $('#webform-feedback-block .form-actions input[type=submit]').after('<div id="ajax-loader"></div>'); 110 $("form.webform-feedback-form").submit(function (e) { 111 $('#webform-feedback-block input[type=submit]').hide(); 112 $('#webform-feedback-block #ajax-loader').show(); 113 var formId = this.id; // "this" is a reference to the submitted form 114 }); 115 116 } 117 }; 118}(jQuery)); 119; 120(function ($) { 121 122Drupal.googleanalytics = {}; 123 124$(document).ready(function() { 125 126 // Attach mousedown, keyup, touchstart events to document only and catch 127 // clicks on all elements. 128 $(document.body).bind("mousedown keyup touchstart", function(event) { 129 130 // Catch the closest surrounding link of a clicked element. 131 $(event.target).closest("a,area").each(function() { 132 133 // Is the clicked URL internal? 134 if (Drupal.googleanalytics.isInternal(this.href)) { 135 // Skip 'click' tracking, if custom tracking events are bound. 136 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) {
137 // Do nothing here. The custom event will handle all tracking. 138 //console.info("Click on .colorbox item has been detected."); 139 } 140 // Is download tracking activated and the file extension configured for download tracking? 141 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 142 // Download link clicked. 143 gtag('event', Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), { 144 event_category: 'Downloads', 145 event_label: Drupal.googleanalytics.getPageUrl(this.href), 146 transport_type: 'beacon' 147 }); 148 } 149 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 150 // Keep the internal URL for Google Analytics website overlay intact. 151 // @todo: May require tracking ID 152 var target = this; 153 $.each(Drupal.settings.googleanalytics.account, function () { 154 gtag('config', this, { 155 page_path: Drupal.googleanalytics.getPageUrl(target.href), 156 transport_type: 'beacon' 157 }); 158 }); 159 } 160 } 161 else { 162 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 163 // Mailto link clicked. 164 gtag('event', 'Click', { 165 event_category: 'Mails', 166 event_label: this.href.substring(7), 167 transport_type: 'beacon' 168 }); 169 } 170 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 171 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 172 // External link clicked / No top-level cross domain clicked. 173 gtag('event', 'Click', { 174 event_category: 'Outbound links', 175 event_label: this.href, 176 transport_type: 'beacon' 177 }); 178 } 179 } 180 } 181 }); 182 }); 183 184 // Track hash changes as unique pageviews, if this option has been enabled. 185 if (Drupal.settings.googleanalytics.trackUrlFragments) { 186 window.onhashchange = function() { 187 $.each(Drupal.settings.googleanalytics.account, function () { 188 gtag('config', this, { 189 page_path: location.pathname + location.search + location.hash 190 }); 191 }); 192 }; 193 } 194 195 // Colorbox: This event triggers when the transition has completed and the 196 // newly loaded content has been revealed. 197 if (Drupal.settings.googleanalytics.trackColorbox) { 198 $(document).bind("cbox_complete", function () { 199 var href = $.colorbox.element().attr("href"); 200 if (href) { 201 $.each(Drupal.settings.googleanalytics.account, function () { 202 gtag('config', this, { 203 page_path: Drupal.googleanalytics.getPageUrl(href) 204 }); 205 }); 206 } 207 }); 208 } 209 210}); 211 212/** 213 * Check whether the hostname is part of the cross domains or not. 214 * 215 * @param string hostname 216 * The hostname of the clicked URL. 217 * @param array crossDomains 218 * All cross domain hostnames as JS array. 219 * 220 * @return boolean 221 */ 222Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 223 /** 224 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 225 * `null` or `undefined`, https://bugs.jquery.com/ticket/10076, 226 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 227 * 228 * @todo: Remove/Refactor in D8 229 */ 230 if (!crossDomains) { 231 return false; 232 } 233 else { 234 return $.inArray(hostname, crossDomains) > -1 ? true : false; 235 } 236}; 237 238/** 239 * Check whether this is a download URL or not. 240 * 241 * @param string url 242 * The web url to check. 243 * 244 * @return boolean 245 */ 246Drupal.googleanalytics.isDownload = function (url) { 247 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 248 return isDownload.test(url); 249}; 250 251/** 252 * Check whether this is an absolute internal URL or not. 253 * 254 * @param string url 255 * The web url to check. 256 * 257 * @return boolean 258 */ 259Drupal.googleanalytics.isInternal = function (url) { 260 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 261 return isInternal.test(url); 262}; 263 264/** 265 * Check whether this is a special URL or not. 266 * 267 * URL types: 268 * - gotwo.module /go/* links. 269 * 270 * @param string url 271 * The web url to check. 272 * 273 * @return boolean 274 */ 275Drupal.googleanalytics.isInternalSpecial = function (url) { 276 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 277 return isInternalSpecial.test(url); 278}; 279 280/** 281 * Extract the relative internal URL from an absolute internal URL. 282 * 283 * Examples: 284 * - https://mydomain.com/node/1 -> /node/1 285 * - https://example.com/foo/bar -> https://example.com/foo/bar 286 * 287 * @param string url 288 * The web url to check. 289 * 290 * @return string 291 * Internal website URL 292 */ 293Drupal.googleanalytics.getPageUrl = function (url) { 294 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 295 return url.replace(extractInternalUrl, ''); 296}; 297 298/** 299 * Extract the download file extension from the URL. 300 * 301 * @param string url 302 * The web url to check. 303 * 304 * @return string 305 * The file extension of the passed url. e.g. "zip", "txt" 306 */ 307Drupal.googleanalytics.getDownloadExtension = function (url) { 308 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 309 var extension = extractDownloadextension.exec(url); 310 return (extension === null) ? '' : extension[1]; 311}; 312 313})(jQuery); 314;
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.