PageSourceSearch

https://static.accuradio.com/static/js/c624f42e84afb1eb023e5695d2d366a2e6a4cfd9/ltjs.js

js accuradio.com collected 2026-10-01 10:23:07 UTC 3,860 bytes, 151 lines download raw bytes

1initAndoTracker();
2
3function initAndoTracker() {
4	window.andoTracker = window.andoTracker || new AndoTracker('https://accuradio.tritondigital.com/lt');
5}
6
7// AndoTracker class
8function AndoTracker(tritonTrackingUrl, timeMultiplier) {
9	var _andoPingInterval = "60000";
10	var _timeMultiplier = timeMultiplier || 1000;
11	var _andohost = tritonTrackingUrl;
12	var _andopingTimer = null;
13	var _sessionGuid = null;
14	var _sessionStartPending = false;
15	// stationId
16	var _sid = null;
17	var _dist = location && location.hostname;
18	
19	function startTracking(stationId, volume) {
20		if(!stationId) {
21			return;
22		}
23
24		if(_sid !== stationId && _sessionGuid) {
25			_sessionGuid = null;
26		}
27
28		var isReduntantCall = _sid === stationId && (_sessionGuid || _sessionStartPending);
29		if(isReduntantCall) {
30			return;
31		}
32
33		_sid = stationId;
34		clearInterval(_andopingTimer);
35		_andopingTimer = null;
36		
37		// This is if they change channels while the volume is at zero.
38		// Don't start a new session
39		//  but we need the _sid updated, clear the interval just in case 
40		//  (it should've been cleared already when volume went to 0).
41		// A volume change should start a new session if there isn't one already.
42		if(volume === 0) return;
43
44		_sessionStartPending = true;
45		var url = _andohost + '?sid=' + stationId;
46		var fullUrl = _getFullUrl(url);
47		try {
48		    startSession(fullUrl, sessionStartSuccess, sessionStartError);
49		} catch (e) {
50			_sessionStartPending = false;
51			console.error(e);
52            throw e;
53		}
54
55		function sessionStartSuccess(responseText) {
56		    _sessionStartPending = false;
57			clearInterval(_andopingTimer);
58			_andopingTimer = null;
59			var responseParts = responseText.split(',');
60			var pingFrequencySeconds = parseInt(responseParts[0] || '60');
61			var sessionGuid = responseParts[1];
62
63			_andoPingInterval = pingFrequencySeconds * _timeMultiplier;
64			_sessionGuid = sessionGuid;
65			_andopingTimer = setInterval(_ping, _andoPingInterval);
66		}
67		function sessionStartError(err) {
68			_sessionStartPending = false;
69			console.error(err);
70			_sessionGuid = null;
71			clearInterval(_andopingTimer);
72			_andopingTimer = null;
73			throw(err);
74		}
75	}
76
77	// channel hasn't changed, but user unpaused, unmuted, or changed volume from 0 to > 0
78	function resumeTracking(volume) {
79		startTracking(_sid, volume);
80	}
81
82	function endTracking() {
83		if(_andopingTimer) _ping();
84		clearInterval(_andopingTimer);
85		_andopingTimer = null;
86		_sessionGuid = null;
87	}
88
89	var _ping = function _ping() {
90		if (!_sessionGuid) {
91			// this is a fallback to catch any pings that need to be restarted
92			_startNewSession();
93		}
94
95		if (_sessionGuid) {
96			var url = _andohost + '?guid=' + _sessionGuid;
97			var fullUrl = _getFullUrl(url);
98			sendPing(fullUrl);
99		}
100	};
101
102	var _startNewSession = function _startNewSession() {
103		_sessionGuid = null;
104		_startTracking(_sid);
105	};
106
107	var _getFullUrl = function _getFullUrl(url) {
108		return url + 
109			'&cb=' + Math.random() + 
110			'&dist=' + (encodeURIComponent(_dist) || '');
111	};
112
113	var _startTracking = startTracking;
114
115	return {
116		startTracking: startTracking,
117		resumeTracking: resumeTracking,
118		endTracking: endTracking
119	};
120}
121
122function startSession(fullUrl, success) {
123	makeRequest(fullUrl, success, 
124		function onError(){ 
125			// try again in 10 seconds
126			setTimeout(makeRequest, 10000, fullUrl, success, console.error); 
127		}
128	);
129}
130
131function sendPing(fullUrl) {
132	makeRequest(fullUrl);
133}
134
135function makeRequest(fullUrl, onSuccess, onError) {
136
137	var req = new XMLHttpRequest();
138	req.open('GET', fullUrl, true);
139	req.onreadystatechange = function(e) {
140		if(this.readyState === 4) {
141			if(this.status === 200) {
142				if (typeof(onError) === 'function') onSuccess(this.responseText);
143			} else {
144				if (typeof(onError) === 'function') onError(e);
145			}
146		}
147	};
148	req.send();
149	var now = new Date();
150	console.debug('' + now.toUTCString() + ': ' + fullUrl);
151}

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.