<commit_before>(function ( $ ){

	/*
	EXAMPLE CONFIGURATION

		var defaultKey	= 'fje329iun52ngtuijo2f4jeun432A', // Unique master Xively API key to be used as a default
		defaultFeeds	= [61916,12425,94322], // Comma separated array of Xively Feed ID numbers
		applicationName	= 'My Company\'s Application', // Replaces Xively logo in the header
		dataDuration	= '90days', // Default duration of data to be displayed // ref: https://xively.com/dev/docs/api/data/read/historical_data/
		dataInterval	= 10800, // Default interval for data to be displayed (in seconds)
		dataColor		= '0A1922', // CSS HEX value of color to represent data (omit leading #)
		hideForm		= 0;
	*/

	var defaultKey		= '<KEY>', // Unique master Xively API key to be used as a default
		defaultFeeds	= [1492359879], // Comma separated array of Xively Feed ID numbers
		applicationName	= 'Fickleview', // Replaces Xively logo in the header
		dataDuration	= '1day', // Default duration of data to be displayed // ref: https://xively.com/dev/docs/api/data/read/historical_data/
		dataInterval	= 60, // Default interval for data to be displayed (in seconds)
		dataColor		= 'FFCC99', // CSS HEX value of color to represent data (omit leading #)
		hideForm		= 1, // To hide input form use value of 1, otherwise set to 0
		timeZoneOffsetMs        = 0; // -10800,  // Seconds
		
		
// Function Declarations

	// URL Parameters
	function getParam(key) {
	 	var value = location.hash.match(new RegExp(key+'=([^&]*)'));
		if(value) {
			return value[1];
		} else {
			return "";
		}
	}

	// Graph Annotations
	function addAnnotation(force) {
		if (messages.length > 0 && (force || Math.random() >= 0.95)) {
			annotator.add(seriesData[2][seriesData[2].length-1].x, messages.shift());
		}
	}

	// Add One (1) Day to Date Object
	Date.prototype.addDays = function (d) {
		if (d) {
			var t = this.getTime();
			t = t + (d * 86400000);
			this.setTime(t);
		}
	};

	// Subtract One (1) Day to Date Object
	Date.prototype.subtractDays = function (d) {
		if (d) {
			var t = this.getTime();
			t = t - (d * 86400000);
			this.setTime(t);
		}
	};

	// Parse Xively ISO Date Format to Date Object
	Date.prototype.parseISO = function(iso){
		var stamp= Date.parse(iso);
		if(!stamp) throw iso +' Unknown date format';
		stamp = stamp;
		return new Date(stamp);
	}

	// Set xively API Key
	function setApiKey(key) {
		xively.setKey(key);
	}

	function updateFeeds(feedId, datastreamIds, duration, interval) {
		xively.feed.get(feedId, function(feedData) {
			if(feedData.datastreams) {
				if(datastreamIds == '' || !datastreamIds) {
					feedData.datastreams.forEach(function(datastream) {
						datastreamIds += datastream.id + " ";
					});
				}
				feedData.datastreams.forEach(function(datastream) {
					var now = new Date();
					var then = new Date();
					var updated = new Date;
					updated = updated.parseISO(datastream.at);
					var diff = null;
					if(duration == '6hours') diff = 21600000;
					 if(duration == '1day') diff = 86400000;
					 if(duration == '1week') diff = 604800000;
					 if(duration == '1month') diff = 2628000000;
					 if(duration == '90days') diff = 7884000000;
					then.setTime(now.getTime() - diff);
					if(updated.getTime() > then.getTime()) {
						if(datastreamIds && datastreamIds != '' && datastreamIds.indexOf(datastream.id) >= 0) {
							xively.datastream.history(feedId, datastream.id, {duration: duration, interval: interval, limit: 1000}, function(datastreamData) {

								var series = [];
								var points = [];

								// Create Datastream UI
								$('.datastream-' + datastream.id).empty();
								$('.datastream-' + datastream.id).remove();
								$('#feed-' + feedId + ' .datastream.hidden').clone().appendTo('#feed-' + feedId + ' .datastreams').addClass('datastream-' + datastream.id).removeClass('hidden');

								// Check for Datastream Tags
								var tagsHtml = '';
								if(datastreamData.tags) {
									tagsHtml = '<div style="font-size: 14px;"><span class="radius secondary label">' + datastreamData.tags.join('</span> <span class="radius secondary label">') + '</span></div>';
								} else {
									tagsHtml = '';
								}

								// Fill Datastream UI with Data
								$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-name').html(datastream.id);
								$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value);

								// Include Datastream Unit (If Available)
								if(datastream.unit) {
									if(datastream.unit.symbol) {
										$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value + datastream.unit.symbol);
									} else {
										$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value);
									}
								} else {
									$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value);
								}
								$('.datastream-' + datastream.id).removeClass('hidden');

								// Historical Datapoints
								if(datastreamData.datapoints) {

									// Add Each Datapoint to Array
									// Timedate timezone = TimeZone.getDefault();
									datastreamData.datapoints.forEach(function(datapoint) {
										points.push({x: new Date(datapoint.at).getTime()/1000.0 +timeZoneOffsetMs, y: parseFloat(datapoint.value)});
									});

									// Add Datapoints Array to Graph Series Array
									series.push({
										name: datastream.id,
										data: points,
										color: '#' + dataColor
									});

									// Initialize Graph DOM Element
									$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .graph').attr('id', 'graph-' + feedId + '-' + datastream.id);

						 			// Build Graph
						 			
						 			// Set the y axis min and max for specific channels
						 			var minSet = 0;
						 			var maxSet = 0;
						 			
						 				 if (datastream.id == 'Basement-Inside' || datastream.id == 'Cold-Storage' || datastream.id == 'Sunroom-Inside'|| datastream.id == 'Prop-Case-Soil' || datastream.id == 'Prop-Case-Air') {  // 
									   		minSet = -5;
											maxSet = 30;
									  	 } else {
									  	  if (datastream.id == 'StoveTemp') {  // 
											minSet = 0;
											maxSet = 700;
									  	  } else {	
									  	if (datastream.id == 'Deck-Outside') {  // 
											minSet = -20;
											maxSet = 35;
									  	} else {	
									  	if (datastream.id == 'RainMM') {  // 
											minSet = 0;
											maxSet = 100;
									  	
									  	  } else {	// All others
									  	  
									     minSet =  parseFloat(datastream.min_value) - .25*(parseFloat(datastream.max_value) - parseFloat(datastream.min_value));
								  	     maxSet =  parseFloat(datastream.max_value) + .25*(parseFloat(datastream.max_value) - parseFloat(datastream.min_value));

									  	   }
									     	   }
									  	  }
									  	 }
						 			         
						 			      
										
									var graph = new Rickshaw.Graph( {
										element: document.querySelector('#graph-' + feedId + '-' + datastream.id),
										width: 600,
										height: 200,
										render: 'area',<commit_msg>Update follows.js<commit_after>(function ( $ ){

	/*
	EXAMPLE CONFIGURATION

		var defaultKey	= 'fje329iun52ngtuijo2f4jeun432A', // Unique master Xively API key to be used as a default
		defaultFeeds	= [61916,12425,94322], // Comma separated array of Xively Feed ID numbers
		applicationName	= 'My Company\'s Application', // Replaces Xively logo in the header
		dataDuration	= '90days', // Default duration of data to be displayed // ref: https://xively.com/dev/docs/api/data/read/historical_data/
		dataInterval	= 10800, // Default interval for data to be displayed (in seconds)
		dataColor		= '0A1922', // CSS HEX value of color to represent data (omit leading #)
		hideForm		= 0;
	*/

	var defaultKey		= '<KEY>', // Unique master Xively API key to be used as a default
		defaultFeeds	= [1492359879], // Comma separated array of Xively Feed ID numbers
		applicationName	= 'Fickleview', // Replaces Xively logo in the header
		dataDuration	= '1day', // Default duration of data to be displayed // ref: https://xively.com/dev/docs/api/data/read/historical_data/
		dataInterval	= 60, // Default interval for data to be displayed (in seconds)
		dataColor		= 'FFCC99', // CSS HEX value of color to represent data (omit leading #)
		hideForm		= 1, // To hide input form use value of 1, otherwise set to 0
		timeZoneOffsetMs        = 0; // -10800,  // Seconds
		
		
// Function Declarations

	// URL Parameters
	function getParam(key) {
	 	var value = location.hash.match(new RegExp(key+'=([^&]*)'));
		if(value) {
			return value[1];
		} else {
			return "";
		}
	}

	// Graph Annotations
	function addAnnotation(force) {
		if (messages.length > 0 && (force || Math.random() >= 0.95)) {
			annotator.add(seriesData[2][seriesData[2].length-1].x, messages.shift());
		}
	}

	// Add One (1) Day to Date Object
	Date.prototype.addDays = function (d) {
		if (d) {
			var t = this.getTime();
			t = t + (d * 86400000);
			this.setTime(t);
		}
	};

	// Subtract One (1) Day to Date Object
	Date.prototype.subtractDays = function (d) {
		if (d) {
			var t = this.getTime();
			t = t - (d * 86400000);
			this.setTime(t);
		}
	};

	// Parse Xively ISO Date Format to Date Object
	Date.prototype.parseISO = function(iso){
		var stamp= Date.parse(iso);
		if(!stamp) throw iso +' Unknown date format';
		stamp = stamp;
		return new Date(stamp);
	}

	// Set xively API Key
	function setApiKey(key) {
		xively.setKey(key);
	}

	function updateFeeds(feedId, datastreamIds, duration, interval) {
		xively.feed.get(feedId, function(feedData) {
			if(feedData.datastreams) {
				if(datastreamIds == '' || !datastreamIds) {
					feedData.datastreams.forEach(function(datastream) {
						datastreamIds += datastream.id + " ";
					});
				}
				feedData.datastreams.forEach(function(datastream) {
					var now = new Date();
					var then = new Date();
					var updated = new Date;
					updated = updated.parseISO(datastream.at);
					var diff = null;
					if(duration == '6hours') diff = 21600000;
					 if(duration == '1day') diff = 86400000;
					 if(duration == '1week') diff = 604800000;
					 if(duration == '1month') diff = 2628000000;
					 if(duration == '90days') diff = 7884000000;
					then.setTime(now.getTime() - diff);
					if(updated.getTime() > then.getTime()) {
						if(datastreamIds && datastreamIds != '' && datastreamIds.indexOf(datastream.id) >= 0) {
							xively.datastream.history(feedId, datastream.id, {duration: duration, interval: interval, limit: 1000}, function(datastreamData) {

								var series = [];
								var points = [];

								// Create Datastream UI
								$('.datastream-' + datastream.id).empty();
								$('.datastream-' + datastream.id).remove();
								$('#feed-' + feedId + ' .datastream.hidden').clone().appendTo('#feed-' + feedId + ' .datastreams').addClass('datastream-' + datastream.id).removeClass('hidden');

								// Check for Datastream Tags
								var tagsHtml = '';
								if(datastreamData.tags) {
									tagsHtml = '<div style="font-size: 14px;"><span class="radius secondary label">' + datastreamData.tags.join('</span> <span class="radius secondary label">') + '</span></div>';
								} else {
									tagsHtml = '';
								}

								// Fill Datastream UI with Data
								$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-name').html(datastream.id);
								$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value);

								// Include Datastream Unit (If Available)
								if(datastream.unit) {
									if(datastream.unit.symbol) {
										$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value + datastream.unit.symbol);
									} else {
										$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value);
									}
								} else {
									$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .datastream-value').html(datastream.current_value);
								}
								$('.datastream-' + datastream.id).removeClass('hidden');

								// Historical Datapoints
								if(datastreamData.datapoints) {

									// Add Each Datapoint to Array
									// Timedate timezone = TimeZone.getDefault();
									datastreamData.datapoints.forEach(function(datapoint) {
										points.push({x: new Date(datapoint.at).getTime()/1000.0 +timeZoneOffsetMs, y: parseFloat(datapoint.value)});
									});

									// Add Datapoints Array to Graph Series Array
									series.push({
										name: datastream.id,
										data: points,
										color: '#' + dataColor
									});

									// Initialize Graph DOM Element
									$('#feed-' + feedId + ' .datastreams .datastream-' + datastream.id + ' .graph').attr('id', 'graph-' + feedId + '-' + datastream.id);

						 			// Build Graph
						 			
						 			// Set the y axis min and max for specific channels
						 			var minSet = 0;
						 			var maxSet = 0;
						 			
						 				 if (datastream.id == 'Basement-Inside' || datastream.id == 'Cold-Storage' || datastream.id == 'Sunroom-Inside'|| datastream.id == 'Prop-Case-Soil' || datastream.id == 'Prop-Case-Air') {  // 
									   		minSet = -5;
											maxSet = 30;
						 				 } else {
									  	  if (datastream.id == 'Irrigation-Containers' || datastream.id == 'Irrigation-Front-Garden' || datastream.id == 'Irrigation-Veg-Garden' || datastream.id == 'Irrigation-Hosta-Garden' || datastream.id == 'Irrigation-Herb-South') {  // 
											minSet = 0;
											maxSet = 20;
									  	 } else {
									  	  if (datastream.id == 'StoveTemp') {  // 
											minSet = 0;
											maxSet = 700;
									  	  } else {	
									  	if (datastream.id == 'Deck-Outside') {  // 
											minSet = -20;
											maxSet = 35;
									  	} else {	
									  	if (datastream.id == 'RainMM') {  // 
											minSet = 0;
											maxSet = 100;
									  	
									  	  } else {	// All others
									  	  
									     minSet =  parseFloat(datastream.min_value) - .25*(parseFloat(datastream.max_value) - parseFloat(datastream.min_value));
								  	     maxSet =  parseFloat(datastream.max_value) + .25*(parseFloat(datastream.max_value) - parseFloat(datastream.min_value));

									  	   }
									     	   }
									  	  }
									  	 }
						 			         
						 			      
										
									var graph = new Rickshaw.Graph( {
										element: document.querySelector('#graph-' + feedId + '-' + datastream.id),
										width: 600,
										height: 200,
										render: 'area',
{'fraction_non_alphanumeric': 0.14596876884927285, 'fraction_numerical': 0.0240600495945312, 'mean_word_length': 2.3233853006681513, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1482911', 'n_tokens_mistral': 6823, 'n_tokens_neox': 4857, 'n_words': 1088}