PageSourceSearch

https://www.satshot.com/icue-manager/js/func/the-trend.js

js satshot.com collected 2026-09-24 11:31:14 UTC 15,904 bytes, 446 lines download raw bytes

1window.analyses = {
2	/*notificationID: {
3		fieldid: {
4			datasetid: datasetObj
5			}
6		}*/}
7function get_analyses_for_a_notifications_field(notificationID, fieldID){
8	startSpinner();
9	var callerID = 'getAnalysesForNotificationsField';
10	var msgHTML = 'Spinning the Wheel';
11	appendMSG(callerID, msgHTML);
12	var beginTime = new Stopwatch(null, 1000);
13	beginTime.start();
14
15	
16	var datasetIDArray = [];
17
18	$.each(notifications.icue[notificationID].records, function(idx, record){ 
19	   var it = record.changed_data.boundarydatasets[fieldID]
20	   if(it != undefined){
21		  datasetIDArray.push(_.keys(it)[0]);
22	   }
23	});
24
25
26	// first, check to see if each of the datasets information have already been retrieved
27	// if so, skip for that dataset
28	//var abc = analyses[notificationID];
29	//var datasetIDArray_massaged = [];
30	//if(abc != undefined){
31		//console.log('here a')
32		//if(abc[fieldID] != undefined){
33			//console.log('here b')
34			//$.each(datasetIDArray, function(idx, dsid){
35				//console.log('here c')
36				//if(abc[fieldID][dsid] == undefined){
37					//console.log('here d')
38					//datasetIDArray_massaged.push(dsid);
39				//}
40			//});
41		//}
42	//}
43
44	//console.log(datasetIDArray_massaged);
45	
46	$.xmlrpc({
47		url: loginToken,
48		methodName: 'reload_multiple_saved_analyses',
49		params: ['', datasetIDArray],
50		success: function(response, status, jqXHR) {
51			var theImageHandles = [];
52			$.each(response[0], function(dsid, imghandle){
53				theImageHandles.push(imghandle);
54			});
55			
56			get_analyses_info(theImageHandles, fieldID);
57			
58			// unsure if I will store this data, could be very large.
59			//localforage.setItem(userinfo.uid + _.keys(tokens), 'the data', function(err, value) {});	
60			console.log('get_analyses_for_a_notifications_field() ' + beginTime.getElapsed().minutes + '.' + beginTime.getElapsed().seconds + '.' + beginTime.getElapsed().milliseconds);
61			removeMSG(callerID);
62			stopSpinner();
63		},
64		error: function(jqXHR, status, error) {
65			console.log(error.message);
66			removeMSG(callerID);
67			stopSpinner();
68			sessionCheck(error)
69		}
70	});
71}
72window.fieldAnalyses = {};
73function get_analyses_info(imageHandles, fieldID){
74	startSpinner();
75	var callerID = 'getAnalysesInfo';
76	var msgHTML = 'Watching it go around';
77	appendMSG(callerID, msgHTML);
78	var beginTime = new Stopwatch(null, 1000);
79	beginTime.start();
80	
81	$.xmlrpc({
82		url: loginToken,
83		methodName: 'get_multiple_analyses_info',
84		params: [imageHandles],
85		success: function(response, status, jqXHR) {
86			//var returnValue = $.parseJSON(response);
87			
88			console.log(response);
89			
90			fieldAnalyses[fieldID] = response[0];
91			
92			//$.each(returnValue, function(a,b){});
93			
94			// unsure if I will store this data, could be very large.
95			//localforage.setItem(userinfo.uid + _.keys(tokens), 'the data', function(err, value) {});	
96			
97			console.log('get_analyses_for_a_notifications_field() ' + beginTime.getElapsed().minutes + '.' + beginTime.getElapsed().seconds + '.' + beginTime.getElapsed().milliseconds);
98			removeMSG(callerID);
99			stopSpinner();
100		},
101		error: function(jqXHR, status, error) {
102			console.log(error.message);
103			removeMSG(callerID);
104			stopSpinner();
105			sessionCheck(error)
106		}
107	});
108}
109// doing this and checking what is CURRENTLY hovered/mouseentered and pulling data from the hoverLibary, we can make sure that the data is correct, even if there are other calls waiting to come back. race condition otherwise and it will always fail when hovering against a note that ha already been retrieved, then hovering over a note that doenst have data and then immediately going back to any not that has been loaded already. the data from the note being retrieved (or that last one to return) will be the one the html is created from....not desired.
110window.hoverLibrary = {/*noteid: {groupNamesForHover, regionNamesForHover, fieldNamesForHover, theDatesFormattedForHover}*/};
111$('.body-scroll').off('mouseenter').on('mouseenter', '.mouse-hover', function(e){
112	
113	var thisNoteID = $(this).parent('.alert').attr('id').split('_')[1];
114	window.currentAlertIDForHover = thisNoteID;
115	var thisNoteType = $(this).parent('.alert').attr('category');
116	var thisParticularAlert = $(this).parent('.alert');
117	var alertInfo = {};
118	var recordNames = {};
119	satAndDateObj = {};
120	var boundaryIDs = [];
121
122	$('#alert-mouse-hover').html('') //.removeClass().addClass(thisNoteID);
123	hoverLibrary[thisNoteID] = {};
124
125
126	$.each(notifications[thisNoteType][thisNoteID].records, function(idx, record){ 
127		var theRecID = record.id;
128		if(alertInfo[record.action] != undefined){
129			alertInfo[record.action].push(theRecID);
130		}else {
131			alertInfo[record.action] = [];
132			alertInfo[record.action].push(theRecID);
133		}
134		if(recordNames[record.action] != undefined){
135			recordNames[record.action].push(record.name);
136		}else {
137			recordNames[record.action] = [];
138			recordNames[record.action].push(record.name);
139		}
140		if(satAndDateObj[record.changed_data.sceneinfo.satellite] == undefined){
141			satAndDateObj[record.changed_data.sceneinfo.satellite] = [];
142			satAndDateObj[record.changed_data.sceneinfo.satellite].push(record.changed_data.sceneinfo.date);
143		}else {
144			satAndDateObj[record.changed_data.sceneinfo.satellite].push(record.changed_data.sceneinfo.date);
145		}
146		if(thisParticularAlert.attr('subtypes') == 'match'){
147			$.each(record.changed_data.boundaryids, function(idx, id){ boundaryIDs.push(id);})
148		}else if(thisParticularAlert.attr('subtypes') == 'completion'){
149			$.each(record.changed_data.boundarydatasets, function(id, obj){ boundaryIDs.push(id);})
150		}
151	});
152	var theDatesFormattedForHover = {};
153	$.each(satAndDateObj, function(sat, dates){
154		var theDatesRaw = _.uniq(dates).sort();
155		$.each(theDatesRaw, function(idx, date){
156			var finalDate = moment(date).format('MMM DD, YYYY');
157			if(theDatesFormattedForHover[sat] == undefined){
158				theDatesFormattedForHover[sat] = [];
159			}
160			theDatesFormattedForHover[sat].push(finalDate);
161		});
162	});
163	// check to see if the data for these ids have been localized
164	// then check to see if the region for these ids have been localized
165	// get minimun data if not localized
166	var objsToGet = [];
167	$.each(_.uniq(boundaryIDs), function(idx, id){if(objects[id] == ''){objsToGet.push(id);}});
168	console.log('GET THESE')
169	console.log('-------------')
170	console.log(objsToGet)
171	console.log('-------------')
172	//these are organized {scenetype: [image dates]}
173	//console.log(theDatesFormatted);
174	if(objsToGet.length){
175		console.log('NEED TO GET OBJECT INFO');
176		console.log('-------------')
177		console.log(boundaryIDs)
178		console.log('-------------')
179		getNotiObjectsInfoHover(objsToGet, boundaryIDs, theDatesFormattedForHover, thisNoteID);
180	}else {
181		// this section may have to be taken out and put into its own function....
182		var fieldNamesForHover = [];
183		var regionNamesForHover = [];
184		var groupNamesForHover = [];
185		$.each(_.uniq(boundaryIDs), function(idx, id){
186			console.log('the unique boundaryIDs object id')
187			console.log(id)
188			var fieldID = objects[id].objectid;
189			var fieldName = objects[id].name;
190			fieldNamesForHover.push(fieldName);
191			// this is to show what group names for a notification are
192			$.each(objects[id].regions, function(regionID, regionName){
193				regionGroupIDs[regionID] = objects[id].region_groupid;
194				regionNamesForHover.push(regionName);
195				if(groups[regionGroupIDs[regionID]] != undefined){
196					groupNamesForHover.push(groups[regionGroupIDs[regionID]].name);
197				}
198			});
199		});
200		
201		hoverLibrary[thisNoteID] = {
202			'groupNames': _.uniq(groupNamesForHover), 
203			'regionNames': _.uniq(regionNamesForHover), 
204			'fieldNames': _.uniq(fieldNamesForHover), 
205			'theDatesFormatted': theDatesFormattedForHover
206		};
207
208		
209		hoverLoadedChecker(thisNoteID, e);
210	}
211});
212window.posX = 0;
213window.posY = 0;
214window.timeoutHandle = null;
215$('.body-scroll').off('mousemove').on('mousemove', '.mouse-hover', function(e){
216	$('#alert-mouse-hover').hide();
217	window.clearTimeout(timeoutHandle);
218	if(!$(this).hasClass('selected')){
219		timeoutHandle = window.setTimeout(function(){
220			// get mouse position
221			// offset #alert-mouse-hover from the edges of the document, if needed
222			posX = e.pageX + 10;
223			posY = e.pageY + 10;
224			var docWidth = $(document).width();
225			var docHeight = $(document).height();
226			var hoverWindowWidth = $('#alert-mouse-hover').width();
227			var hoverWindowHeight = $('#alert-mouse-hover').height();
228			// mouse is too far right (checked second, so overrides top conditional
229			if( posX > (docWidth - hoverWindowWidth)){
230				posX = docWidth - (hoverWindowWidth + 20);
231			}
232			// mouse is too far down (checked second, so overrides top conditional
233			if( posY > (docHeight - hoverWindowHeight)){
234				posY = docHeight - (hoverWindowHeight + 40);
235			}
236			//console.log(' X: ' + posX + ' hoverWindowWidth: ' + hoverWindowWidth)
237			//console.log(' Y: ' + posY + ' hoeverWindowHeight: ' + hoverWindowHeight)
238			
239			//console.log(posY + ' : ' + posX)
240			
241			$('#alert-mouse-hover').css({'top': posY, 'left': posX}).show();
242		}, 1000);
243	}
244});
245$('.body-scroll').off('mouseleave').on('mouseleave', '.mouse-hover', function(){
246		$('#alert-mouse-hover').hide();
247		window.clearTimeout(timeoutHandle);
248});
249function getNotiObjectsInfoHover(objectIDsToGet, allObjectIDs, theDatesFormattedForHover, thisNoteID) {
250	//startSpinner();
251	//var callerID = 'getNotiObjectsInfo';
252	//var msgHTML = 'Getting Notification Field Info';
253	//appendMSG(callerID, msgHTML);
254	var beginTime = new Stopwatch(null, 1000);
255	beginTime.start();
256	$.xmlrpc({
257		url: loginToken,
258		methodName:  'get_objects_info',
259		params: [[objectIDsToGet], {'include_wkt': 0, 'include_mbc': 0, 'previews': true}],
260		success: function(response, status, jqXHR) {			 
261			beginTime.stop();
262			window.notiObjectsInfo = response[0];
263			var interVar = {};
264			$.each(notiObjectsInfo, function(object, properties){
265				var fieldID = properties.objectid;
266				var fieldName = properties.name;
267				if ($.inArray(fieldID, _.keys(interVar)) == -1) {
268					interVar[fieldID];
269				}
270				interVar[fieldID] = properties;
271				
272				// this is to show what group names for a notification are
273				$.each(properties.regions, function(regionID, regionName){
274					regionGroupIDs[regionID] = properties.region_groupid;
275				})
276			});
277			notiObjectsInfo = interVar;
278			$.each(notiObjectsInfo, function(objID, objObj){
279				objects[objID] = objObj;
280			});
281			updateRegions();
282			console.log('getNotiObjectsInfoHover() ' + beginTime.getElapsed().minutes + '.' + beginTime.getElapsed().seconds + '.' + beginTime.getElapsed().milliseconds);
283			//removeMSG(callerID);
284			//stopSpinner();
285			
286			
287			var fieldNamesForHover = [];
288			var regionNamesForHover = [];
289			var groupNamesForHover = [];
290			$.each(_.uniq(allObjectIDs), function(idx, id){
291				var fieldID = objects[id].objectid;
292				var fieldName = objects[id].name;
293				fieldNamesForHover.push(fieldName);
294				// this is to show what group names for a notification are
295				$.each(objects[id].regions, function(regionID, regionName){
296					regionGroupIDs[regionID] = objects[id].region_groupid;
297					regionNamesForHover.push(regionName);
298					if(groups[regionGroupIDs[regionID]] != undefined){
299						groupNamesForHover.push(groups[regionGroupIDs[regionID]].name);
300					}
301				});
302			});
303
304			hoverLibrary[thisNoteID] = {
305				'groupNames': _.uniq(groupNamesForHover), 
306				'regionNames': _.uniq(regionNamesForHover), 
307				'fieldNames': _.uniq(fieldNamesForHover), 
308				'theDatesFormatted': theDatesFormattedForHover
309			};
310			hoverLoadedChecker(thisNoteID);
311		},
312		error: function(jqXHR, status, error) {
313			console.log(error.message);
314			//removeMSG(callerID);
315			//stopSpinner();
316			sessionCheck(error)
317		}
318	});
319}
320$(document)
321	.on('ajaxStart', function () {$('#alert-mouse-hover').addClass('ajaxAlive');})
322	.on('ajaxStop', function () {$('#alert-mouse-hover').removeClass('ajaxAlive');});
323function hoverLoadedChecker(thisNoteID){
324	if($('#alert-mouse-hover').hasClass('ajaxAlive')){
325		//console.log('keep looping')
326		setTimeout(hoverLoadedChecker, 500);
327		return;
328	}else {
329		//console.log('done looping');
330		hoverCreatorHTML()
331	}
332}
333function hoverCreatorHTML(){
334	$('#alert-mouse-hover').html('');
335	//currentAlertIDForHover is a global variable that is updated when mouseenter on .alert
336	// for reference.
337	//hoverLibrary[currentAlertIDForHover] = {
338		//'groupNames': groupNamesForHover, 
339		//'regionNames': regionNamesForHover, 
340		//'fieldNames': fieldNamesForHover, 
341		//'theDatesFormatted': theDatesFormattedForHover
342	//};
343
344	$('#alert-mouse-hover')
345	.append($(document.createElement('div'))
346		.append($(document.createElement('h5'))
347			.html('Groups')
348			.addClass('title')
349		)
350		.append($(document.createElement('span'))
351		.html(function(){
352			var text = '';
353			if(_.uniq(hoverLibrary[currentAlertIDForHover].groupNames).length > 20){
354				text = '<p class="data-info">There are ' + _.uniq(hoverLibrary[currentAlertIDForHover].groupNames).length + ' groups.
354</p>';
355			}else {
356				$.each(_.uniq(hoverLibrary[currentAlertIDForHover].groupNames), function(idx, groupName){
357						text += '<p class="data-info">' + groupName + '</p>';
358				});
359			}
360			return text;
361		})
362	))
363	.append($(document.createElement('div'))
364		.append($(document.createElement('h5'))
365			.html('Regions')
366			.addClass('title')
367		)
368		.append($(document.createElement('span'))
369		.html(function(){
370			var text = '';
371			if(_.uniq(hoverLibrary[currentAlertIDForHover].regionNames).length > 20){
372				text = '<p class="data-info">There are ' + _.uniq(hoverLibrary[currentAlertIDForHover].regionNames).length + ' regions.</p>';
373			}else {
374				$.each(_.uniq(hoverLibrary[currentAlertIDForHover].regionNames), function(idx, regionName){
375						text += '<p class="data-info">' + regionName + '</p>';
376				});
377			}
378			return text;
379		})
380	))
381	.append($(document.createElement('div'))
382		.append($(document.createElement('h5'))
383			.html('Fields')
384			.addClass('title')
385		)
386		.append($(document.createElement('span'))
387		.html(function(){
388			var text = '';
389			if(_.uniq(hoverLibrary[currentAlertIDForHover].fieldNames).length > 20){
390				text = '<p class="data-info">There are ' + _.uniq(hoverLibrary[currentAlertIDForHover].fieldNames).length + ' fields.</p>';
391			}else {
392				$.each(_.uniq(hoverLibrary[currentAlertIDForHover].fieldNames), function(idx, fieldName){
393						text += '<p class="data-info">' + fieldName + '</p>';
394				});
395			}
396			return text;
397		})
398	));
399
400	if(typeof hoverLibrary[currentAlertIDForHover].theDatesFormatted != 'undefined'){
401		$.each(hoverLibrary[currentAlertIDForHover].theDatesFormatted, function(sceneType, sceneDate){
402			$('#alert-mouse-hover').append($(document.createElement('div'))
403				.append($(document.createElement('h5'))
404					.addClass('title')
405					.html(sceneType + ' Imagery')
406				)
407				.append($(document.createElement('span'))
408					.addClass('scene-date-holder')
409					.html(function(){
410						var text = '';
411						if(sceneDate.length > 20){
412							var a = sceneDate[0];
413							var b = sceneDate[sceneDate.length - 1];
414							text += '<p class="data-info">There are ' + sceneDate.length + ' ' + sceneType + ' image dates from ' + a + ' to ' + b + '</p>';
415						}else {
416							$.each(sceneDate, function(idx, theDate){
417								text += '<p class="data-info date">' + theDate + '</p>';
418							});
419						}
420						return text;
421					})
422				)
423			)
424		});
425	}else {
426		console.log('we did not have any existence.......')
427	}
428
429
430	var docWidth = $(document).width();
431	var docHeight = $(document).height();
432	var hoverWindowHeight = 300;
433	
434	// mouse is too far down (checked second, so overrides top conditional
435	if( posY > (docHeight - hoverWindowHeight)){
436		posY = docHeight - (hoverWindowHeight);
437	}
438	// this means that the 'i' is right next to the right of the document
439	// therefore, the position right will always be 45px
440	if($('.body-scroll').hasClass('full')){
441		$('#alert-mouse-hover').css({'top': posY, 'right': 45, 'left': 'inherit'})//.show();
442	}else {
443		$('#alert-mouse-hover').css({'top': posY, 'left': posX, 'right': 'inherit'})//.show();
444	}	
445
446}

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.