PageSourceSearch

https://morrisseyengineering.com/js/common.js

js morrisseyengineering.com collected 2026-10-01 15:55:38 UTC 3,966 bytes, 96 lines download raw bytes

1//  ---------------------------------------------
2//	:: External Link Tracking through RegX
3//	---------------------------------------------
4	$(document).ready(function() {
5		var filetypes = /\.(zip|exe|dmg|pdf|doc.*|xls.*|ppt.*|mp3|txt|rar|wma|mov|avi|wmv|flv|wav)$/i;
6		var baseHref = '';
7		if (jQuery('base').attr('href') != undefined) baseHref = jQuery('base').attr('href');
8		var hrefRedirect = '';
9	
10	    $('body a').click(function(event){
11	    	var el = $(this);
12		    var track = true;
13		    var href = (typeof(el.attr('href')) != 'undefined' ) ? el.attr('href') : '';
14		    var isThisDomain = href.match(document.domain.split('.').reverse()[1] + '.' + document.domain.split('.').reverse()[0]);
15		    if (!href.match(/^javascript:/i)) {
16		        var elEv = []; elEv.value=0, elEv.non_i=false;
17		        // Track Mail Clicks
18		        if (href.match(/^mailto\:/i)) {
19		            elEv.category = 'email';
20		            elEv.action = 'click';
21		            elEv.label = href.replace(/^mailto\:/i, '');
22		            elEv.loc = href;
23		        }
24		        // Check File Downloads
25		        else if (href.match(filetypes)) {
26		            var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined;
27		            elEv.category = 'download';
28		            elEv.action = 'click-' + extension[0];
29		            elEv.label = href.replace(/ /g,'-');
30		            elEv.loc = baseHref + href;
31		        }
32		        // Check External Link Clicks
33		        else if (href.match(/^https?\:/i) && !isThisDomain) {
34		            elEv.category = 'external';
35		            elEv.action = 'click';
36		            elEv.label = href.replace(/^https?\:\/\//i, '');
37		            elEv.non_i = true;
38		            elEv.loc = href;
39		        }
40		        // Check Telephone Clicks
41		        else if (href.match(/^tel\:/i)) {
42		            elEv.category = 'telephone';
43		            elEv.action = 'click';
44		            elEv.label = href.replace(/^tel\:/i, '');
45		            elEv.loc = href;
46		        }
47		        else track = false;
48	
49		        if (track) {
50		            var ret = true;
51		            if((elEv.category == 'external' || elEv.category == 'download') && (el.attr('target') == undefined || el.attr('target').toLowerCase() != '_blank') ) {
52		                hrefRedirect = elEv.loc;
53		                ga('send','event', elEv.category.toLowerCase(),elEv.action.toLowerCase(),elEv.label.toLowerCase(),elEv.value,{
54		                    'nonInteraction': elEv.non_i ,
55		                    //'hitCallback':gaHitCallbackHandler
56		                    'hitCallback': function() {
57								window.location.href = hrefRedirect;
58							}
59		                });
60		                ret = false;
61		            }
62		            else {
63		                ga('send','event', elEv.category.toLowerCase(),elEv.action.toLowerCase(),elEv.label.toLowerCase(),elEv.value,{
64		                    'nonInteraction': elEv.non_i
65		                });
66		            }
67		            return ret;
68		        }
69		    }
70	    });
71	});
72
73//sunnydata
74	$(function() { 
75		if($('#miniLiveData'))
76		{
77			swfobject.embedSWF("/flash/sunnyGraphMini.swf", "miniLiveData", "285", "102", "9.0.0", "expressInstall.swf");
78		}
79		if($('#liveOutputMeter'))
80		{
81			swfobject.embedSWF("/flash/sunnyGraph.swf", "liveOutputMeter", "710", "620", "9.0.0", "expressInstall.swf");
82		}
83	});
84
85
86//  ---------------------------------------------
87//	:: Firefox Debugging
88//	---------------------------------------------
89	// (Possibly archaic) Firebox code from before Dylan started working here
90	if (!window.console || !console.firebug){
91	    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
92	    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
93	    window.console = {};
94	    for (var i = 0; i < names.length; ++i)
95	        window.console[names[i]] = function() {}
96	}

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.