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.custom_search = { 78 attach: function(context) { 79 80 if (!Drupal.settings.custom_search.solr) { 81 // Check if the search box is not empty on submit 82 $('form.search-form', context).submit(function(){ 83 var $this = $(this); 84 var box = $this.find('input.custom-search-box'); 85 if (box.val() != undefined && box.val() == '') { 86 $this.find('input.custom-search-box').addClass('error'); 87 return false; 88 } 89 // If basic search is hidden, copy or value to the keys 90 if ($this.find('#edit-keys').parents('div.element-invisible').attr('class') == 'element-invisible') { 91 $this.find('#edit-keys').val($this.find('#edit-or').val()); 92 $this.find('#edit-or').val(''); 93 } 94 return true; 95 }); 96 } 97 98 // Search from target 99 $('form.search-form').attr('target', Drupal.settings.custom_search.form_target); 100 101 // Displays Popup. 102 $('form.search-form input.custom-search-box', context).bind('click focus', function(e){ 103 var $parentForm = $(this).parents('form'); 104 // check if there's something in the popup and displays it 105 var popup = $parentForm.find('fieldset.custom_search-popup'); 106 if (popup.find('input,select').length && !popup.hasClass('opened')) { 107 popup.fadeIn().addClass('opened'); 108 } 109 e.stopPropagation(); 110 }); 111 $(document).bind('click focus', function(){ 112 $('fieldset.custom_search-popup').hide().removeClass('opened'); 113 }); 114 115 // Handle checkboxes
116 $('.custom-search-selector input:checkbox', context).each(function(){ 117 var el = $(this); 118 if (el.val() == 'c-all') { 119 el.change(function(){ 120 $(this).parents('.custom-search-selector').find('input:checkbox[value!=c-all]').attr('checked', false); 121 }); 122 } 123 else { 124 if (el.val().substr(0,2) == 'c-') { 125 el.change(function(){ 126 $('.custom-search-selector input:checkbox').each(function(){ 127 if ($(this).val().substr(0,2) == 'o-') { 128 $(this).attr('checked', false); 129 } 130 }); 131 $(this).parents('.custom-search-selector').find('input:checkbox[value=c-all]').attr('checked', false); 132 }); 133 } else { 134 el.change(function(){ 135 $(this).parents('.custom-search-selector').find('input:checkbox[value!=' + el.val() + ']').attr('checked', false); 136 }); 137 } 138 } 139 }); 140 141 // Handle popup. 142 var popup = $('fieldset.custom_search-popup:not(.custom_search-processed)', context).addClass("custom_search-processed"); 143 popup.click(function(e){ 144 e.stopPropagation(); 145 }) 146 popup.append('<a class="custom_search-popup-close" href="#">' + Drupal.t('Close') + '</a>'); 147 $('a.custom_search-popup-close').click(function(e){ 148 $('fieldset.custom_search-popup.opened').hide().removeClass('opened'); 149 e.preventDefault(); 150 }); 151 152 } 153 } 154})(jQuery); 155; 156(function ($) { 157 158 Drupal.behaviors.captcha = { 159 attach: function (context) { 160 161 // Turn off autocompletion for the CAPTCHA response field. 162 // We do it here with JavaScript (instead of directly in the markup) 163 // because this autocomplete attribute is not standard and 164 // it would break (X)HTML compliance. 165 $("#edit-captcha-response").attr("autocomplete", "off"); 166 167 } 168 }; 169 170 Drupal.behaviors.captchaAdmin = { 171 attach: function (context) { 172 // Add onclick handler to checkbox for adding a CAPTCHA description 173 // so that the textfields for the CAPTCHA description are hidden 174 // when no description should be added. 175 // @todo: div.form-item-captcha-description depends on theming, maybe 176 // it's better to add our own wrapper with id (instead of a class). 177 $("#edit-captcha-add-captcha-description").click(function() { 178 if ($("#edit-captcha-add-captcha-description").is(":checked")) { 179 // Show the CAPTCHA description textfield(s). 180 $("div.form-item-captcha-description").show('slow'); 181 } 182 else { 183 // Hide the CAPTCHA description textfield(s). 184 $("div.form-item-captcha-description").hide('slow'); 185 } 186 }); 187 // Hide the CAPTCHA description textfields if option is disabled on page load. 188 if (!$("#edit-captcha-add-captcha-description").is(":checked")) { 189 $("div.form-item-captcha-description").hide(); 190 } 191 } 192 193 }; 194 195})(jQuery); 196; 197(function ($) { 198 199Drupal.googleanalytics = {}; 200 201$(document).ready(function() { 202 203 // Attach mousedown, keyup, touchstart events to document only and catch 204 // clicks on all elements. 205 $(document.body).bind("mousedown keyup touchstart", function(event) { 206 207 // Catch the closest surrounding link of a clicked element. 208 $(event.target).closest("a,area").each(function() { 209 210 // Is the clicked URL internal? 211 if (Drupal.googleanalytics.isInternal(this.href)) { 212 // Skip 'click' tracking, if custom tracking events are bound. 213 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) { 214 // Do nothing here. The custom event will handle all tracking. 215 //console.info("Click on .colorbox item has been detected."); 216 } 217 // Is download tracking activated and the file extension configured for download tracking? 218 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 219 // Download link clicked. 220 gtag('event', Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), { 221 event_category: 'Downloads', 222 event_label: Drupal.googleanalytics.getPageUrl(this.href), 223 transport_type: 'beacon' 224 }); 225 } 226 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 227 // Keep the internal URL for Google Analytics website overlay intact. 228 // @todo: May require tracking ID 229 var target = this; 230 $.each(Drupal.settings.googleanalytics.account, function () { 231 gtag('config', this, { 232 page_path: Drupal.googleanalytics.getPageUrl(target.href), 233 transport_type: 'beacon' 234 }); 235 }); 236 } 237 } 238 else { 239 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 240 // Mailto link clicked. 241 gtag('event', 'Click', { 242 event_category: 'Mails', 243 event_label: this.href.substring(7), 244 transport_type: 'beacon' 245 }); 246 } 247 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 248 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 249 // External link clicked / No top-level cross domain clicked. 250 gtag('event', 'Click', { 251 event_category: 'Outbound links', 252 event_label: this.href, 253 transport_type: 'beacon' 254 }); 255 } 256 } 257 } 258 }); 259 }); 260 261 // Track hash changes as unique pageviews, if this option has been enabled. 262 if (Drupal.settings.googleanalytics.trackUrlFragments) { 263 window.onhashchange = function() { 264 $.each(Drupal.settings.googleanalytics.account, function () { 265 gtag('config', this, { 266 page_path: location.pathname + location.search + location.hash 267 }); 268 }); 269 }; 270 } 271 272 // Colorbox: This event triggers when the transition has completed and the 273 // newly loaded content has been revealed. 274 if (Drupal.settings.googleanalytics.trackColorbox) { 275 $(document).bind("cbox_complete", function () {
276 var href = $.colorbox.element().attr("href"); 277 if (href) { 278 $.each(Drupal.settings.googleanalytics.account, function () { 279 gtag('config', this, { 280 page_path: Drupal.googleanalytics.getPageUrl(href) 281 }); 282 }); 283 } 284 }); 285 } 286 287}); 288 289/** 290 * Check whether the hostname is part of the cross domains or not. 291 * 292 * @param string hostname 293 * The hostname of the clicked URL. 294 * @param array crossDomains 295 * All cross domain hostnames as JS array. 296 * 297 * @return boolean 298 */ 299Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 300 /** 301 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 302 * `null` or `undefined`, https://bugs.jquery.com/ticket/10076, 303 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 304 * 305 * @todo: Remove/Refactor in D8 306 */ 307 if (!crossDomains) { 308 return false; 309 } 310 else { 311 return $.inArray(hostname, crossDomains) > -1 ? true : false; 312 } 313}; 314 315/** 316 * Check whether this is a download URL or not. 317 * 318 * @param string url 319 * The web url to check. 320 * 321 * @return boolean 322 */ 323Drupal.googleanalytics.isDownload = function (url) { 324 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 325 return isDownload.test(url); 326}; 327 328/** 329 * Check whether this is an absolute internal URL or not. 330 * 331 * @param string url 332 * The web url to check. 333 * 334 * @return boolean 335 */ 336Drupal.googleanalytics.isInternal = function (url) { 337 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 338 return isInternal.test(url); 339}; 340 341/** 342 * Check whether this is a special URL or not. 343 * 344 * URL types: 345 * - gotwo.module /go/* links. 346 * 347 * @param string url 348 * The web url to check. 349 * 350 * @return boolean 351 */ 352Drupal.googleanalytics.isInternalSpecial = function (url) { 353 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 354 return isInternalSpecial.test(url); 355}; 356 357/** 358 * Extract the relative internal URL from an absolute internal URL. 359 * 360 * Examples: 361 * - https://mydomain.com/node/1 -> /node/1 362 * - https://example.com/foo/bar -> https://example.com/foo/bar 363 * 364 * @param string url 365 * The web url to check. 366 * 367 * @return string 368 * Internal website URL 369 */ 370Drupal.googleanalytics.getPageUrl = function (url) { 371 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 372 return url.replace(extractInternalUrl, ''); 373}; 374 375/** 376 * Extract the download file extension from the URL. 377 * 378 * @param string url 379 * The web url to check. 380 * 381 * @return string 382 * The file extension of the passed url. e.g. "zip", "txt" 383 */ 384Drupal.googleanalytics.getDownloadExtension = function (url) { 385 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 386 var extension = extractDownloadextension.exec(url); 387 return (extension === null) ? '' : extension[1]; 388}; 389 390})(jQuery); 391;
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.