PageSourceSearch

https://dv.energyintel.com/js/site.js?ver=2026.04.01.3

js energyintel.com collected 2026-09-24 15:32:30 UTC 14,748 bytes, 446 lines download raw bytes

1/*
2JS file for miscellaneous site functions
3*/
4//Track GMR tabs
5$(document).ready(function() {
6	document.addEventListener('BSAnalytics:init', function () {
7		//console.log("webhook trigger check");
8		let rpath = /\/gas-market-reconnaissance(#|$|\/$)/;
9		if (rpath.test(window.location.href)){
10				updatePayload();
11		}
12		var match = document.cookie.match(new RegExp('(^| )CookieScriptConsent=([^;]+)'));
13		if (match) {
14			val=(match[2]);
15			cookieConsent(val)
16		}
17	})
18})
19
20function updatePayload(){
21    //console.log('Change in URL detected by javascript loaded from site settings');
22    if (window.location.href.includes("gas-market-reconnaissance#")){
23        window.trackingObject.page_url = window.location.href;
24    }else {
25    	window.trackingObject.page_url = window.location.href + "#gas-markets";
26    }
27    
28    if ((Pelcro.user.isEntitledTo("gas_market_reconnaissance_web")) || (Pelcro.user.isEntitledTo("gas_and_lng_data_web"))){
29        window.trackingObject.access_granted=true;   
30        window.trackingObject.bsp_content_type = "Article";
31		window.trackingObject.bsp_product_name = "GAS MARKET RECONNAISSANCE";
32        sendWebhook();
33    }else {
34        window.trackingObject.access_granted=false;
35        window.trackingObject.bsp_content_type = "Article";
36		window.trackingObject.bsp_product_name = "GAS MARKET RECONNAISSANCE";
37        sendWebhook();
38    }
39}
40
41function sendWebhook(){
42    let customEvent = new window.CustomEvent('BSAnalytics:trackingEvent', {
43       bubbles: true,
44       detail: {
45         data: window.trackingObject
46       }
47     })
48     document.body.dispatchEvent(customEvent)
49}
50
51//Record Cookie preferences
52function cookieConsent(val){
53	if (window.Pelcro.user.isAuthenticated()){
54	window.Pelcro.user.saveToMetaData({
55		auth_token: window.Pelcro.user.read().auth_token,
56		key: "CookieScriptConsent",
57		value: JSON.parse(val)
58	}, (error, response) => {
59		if (error) {
60			return console.log("error", error.message);
61		}
62
63		const userMetaData = response.data.metadata;
64		//console.log(userMetaData);
65	})
66	}
67}
68
69//Suppress tawk.io form when printing
70var _print = window.print;
71window.print = function() {
72	var d = document.getElementsByTagName('iframe')	
73	var s = document.styleSheets
74	var f = false;
75	for (var j = 0; j < d.length; j++){
76		var iframe = d[j].parentElement
77		if (f == true){
78			break;
79		}
80		for (var i = 0; i < s.length; i++) {
81			try {
82				if (s[i].cssRules[0].selectorText == '#' + iframe.id){
83					var t = s[i].cssRules[0].cssText
84					t = t.replace('display: none !important','display: block !important')
85					s[i].deleteRule(0)
86					s[i].insertRule(t,0)
87					s[i].insertRule('@media print { #' + iframe.id + ' { display: none !important; } }', 1);
88					iframe.style.display='none';
89					f = true;
90					break;
91				}
92			}
93			catch(err) {
94				//console.log(err)
95			}
96		}
97	}
98  _print();
99}
100
101/*OTHER*/
102//user loaded check
103//document.addEventListener("PelcroUserLoaded", function(){
104//  console.log('Pelcro User Loaded');
105//});
106
107function eigDownloadReport(){
108    var q = document.location.search;
109    var r = document.referrer;
110    var p = 'https://www.energyintel.com/_downloadable';
111    if (q.includes('?id=')){
112    	window.open(p + q);
113    }else if (r != undefined && r.includes('id=')){
114        window.open(p + '?' + r.split('?')[1]);
115    }else {
116     alert('The link is broken, please try your email link again');
117    }
118};
119
120
121document.addEventListener("PelcroUserLogin", function(){
122	localStorage.setItem('PelcroLoginLastLogin','true');
123	localStorage.setItem('PelcroLoginPardot','true');
124});
125
126document.addEventListener("PelcroUserRegister", function(){
127	localStorage.setItem('PelcroLoginLastLogin','true');
128	localStorage.setItem('PelcroLoginPardot','true');
129});
130
131document.addEventListener("PelcroUserLoaded", function(){
132	try {
133		if (((Pelcro.user.read().metadata.metadata_pardot_cookie_flag != '0') || (localStorage.getItem("PelcroLoginPardot") == 'true')) && (window.pi != undefined )) {
134			
135			pi.tracker.pi_list_email = Pelcro.user.read().email;
136			piTracker();
137			localStorage.setItem('PelcroLoginPardot','false');
138			window.Pelcro.user.saveToMetaData({
139				auth_token: window.Pelcro.user.read().auth_token,
140				key: "pardot_cookie_flag",
141				value: '0'
142				}, (error, response) => {
143				if (error) {
144					return console.log("error", error.message);
145				} 
146				const userMetaData = response.data.metadata;
147			});
148		}
149	} catch(err) {
150		console.log(err)
151	}
152	
153	try {
154	if (localStorage.getItem("PelcroLoginLastLogin") == 'true'){
155		localStorage.setItem('PelcroLoginLastLogin','false');
156		var login_events = window.Pelcro.user.read().metadata['metadata_login_events'];		
157		if (login_events) {
158			if (Pelcro.user.read().last_login_method == null){
159				localStorage.setItem('PelcroLoginLastLogin','true');
160				return;
161			}
162			login_events.push({'event_date':new Date().toISOString(), 'event_type':Pelcro.user.read().last_login_method})	
163			var max_logins = 30;
164			if (login_events.length >max_logins) {
165				login_events = login_events.slice(login_events.length-max_logins,login_events.length)
166			}
167		}else{
168			login_events=[];
169			if (Pelcro.user.read().last_login_method == null){
170				login_events[0] = {'event_date':new Date().toISOString(), 'event_type':'email'}	
171			}else {
172				login_events[0] = {'event_date':new Date().toISOString(), 'event_type':Pelcro.user.read().last_login_method}	
173			}
174		}
175		window.Pelcro.user.saveToMetaData({
176			auth_token: window.Pelcro.user.read().auth_token,
177			key: "login_events",
178			value: login_events
179		}, (error, response) => {
180			if (error) {
181				localStorage.setItem('PelcroLoginLastLogin','true');
182				return console.log("error", error.message);
183			}
184		const userMetaData = response.data.metadata;
185		})
186	}
187
188	} catch(err) {
189		console.log(err)
190	}
191});
192
193//Resize highcharts on print to prevent cropping
194(function() {
195
196    var beforePrint = function() {
197        for(var j = 0; j < $(".highcharts-container").length; j++){
198            chart = Highcharts.charts[j]
199			if ($(".highcharts-container")[j].parentElement.parentElement.parentElement.classList.contains("chart-pair")){				
200				chartWidthPair = chart.chartWidth;
201				chartHeightPair = chart.chartHeight; 
202				chart.setSize(320,chartHeightPair, false); 
203			}else {				
204				chartWidth = chart.chartWidth;
205				chartHeight = chart.chartHeight;
206				chart.setSize(660,chartHeight, false);    
207			}
208			
209        }
210		              
211    };
212
213    var afterPrint = function() {
214		for(var j = 0; j < $(".highcharts-container").length; j++){
215			chart = Highcharts.charts[j]
216			if ($(".highcharts-container")[j].parentElement.parentElement.parentElement.classList.contains("chart-pair")){	
217				chart.setSize(chartWidthPair,chartHeightPair, false);
218			}else {	
219				chart.setSize(chartWidth,chartHeight, false);        		
220			}	
221			chart.hasUserSize = null;    // This makes chart responsive			
222		
223        
224		}
225    };
226
227    if (window.matchMedia) {
228        var mediaQueryList = window.matchMedia('print');
229        mediaQueryList.addListener(function(mql) {
230            if (mql.matches) {
231                beforePrint();
232            } else {
233				setTimeout(function(){
234					//pause to allow varibles to be defined
235					afterPrint();
236				}, 500);
237            }
238        });
239    }
240
241    window.onbeforeprint = beforePrint;			
242	window.onafterprint = afterPrint;	
243    
244}());
245
246
247$(document).ready(function() {
248//Add and insert marketprices tables
249
250// Add the dynamic table to a container.
251var divContainer1 = document.getElementById("market_prices_1");
252if (divContainer1 != undefined){
253
254	$.getJSON('https://dv.energyintel.com/eig/json/market_prices_1.json?utc=' + Date.now(), function(data) {	
255		var table = document.createElement("table") // Create table header.
256		table.classList.add("eig-table")    
257		var tr = table.insertRow(-1); // Table row. (last position)
258		tr.classList.add("eig-table_title")
259		var tabCell = tr.insertCell(-1);
260		tabCell.innerHTML = "Futures Markets";
261		tabCell.id = "futures_markets_title";
262		tabCell.colspan = 3;
263		tabCell.classList.add("eigSmall");
264		tabCell.style.textTransform = "none";
265		
266		
267		tr = table.insertRow(-1); // Table row. (last position)
268		tr.classList.add("eig-table_heading")
269		var col = ["Crude Oil", "Last", "Change"]
270		
271		for (var i = 0; i < col.length; i++) {
272		tabCell = tr.insertCell(-1);
273		tabCell.innerHTML = col[i];
274		tabCell.classList.add("eig-table_borderbottom","eigSmall","eig-table_cell_general")
275		}
276		
277		var ng = false;var p =false;
278		for (var i = 0; i < data.length; i++){
279			if (data[i].Category == "Natural Gas" & ng == false){
280			ng=true 
281			tr = table.insertRow(-1);
282			tr.classList.add("eig-table_heading")
283			tabCell = tr.insertCell(-1);
284			tabCell.innerHTML = data[i].Category;
285			tabCell.colSpan = 3
286			tabCell.classList.add("eig-table_bordertop","eig-table_borderbottom","eigSmall","eig-table_cell_general")
287			
288		}
289		if (data[i].Category == "Products" & p == false){
290			p=true 
291			tr = table.insertRow(-1);
292			tr.classList.add("eig-table_heading")
293			tabCell = tr.insertCell(-1);
294			tabCell.innerHTML = data[i].Category;
295			tabCell.colSpan = 3
296			tabCell.classList.add("eig-table_bordertop","eig-table_borderbottom","eigSmall","eig-table_cell_general")                
297		}
298		
299		tr = table.insertRow(-1); 
300		tr.classList.add("eig-table_body")
301		tabCell = tr.insertCell(-1);
302		tabCell.innerHTML = data[i].PriceItem;
303		if (data[i].Category.includes("Crude Oil") & data[i].Category != "Crude Oil"){       	
304			tabCell.style["padding"] = '20px'
305		}
306		
307		tabCell = tr.insertCell(-1);
308		tabCell.innerHTML = data[i].LastPrice;
309		tabCell = tr.insertCell(-1);
310		tabCell.innerHTML = data[i].PriceChange;
311		if (data[i].PriceChange < 0) {
312			tabCell.style["color"] = 'red'
313		}else {
314			tabCell.style["color"] = 'green'
315		}
316			
317		}
318			
319		tr = table.insertRow(-1); 
320		tr.classList.add("eig-table_footer")
321		tabCell = tr.insertCell(-1);
322		tabCell.innerHTML = "Change vs prior close - Source <a href='https://www.barchart.com' target='_blank'>www.barchart.com</a>. Last Updated at - " + data[0].ModifiedDate;
323		tabCell.colSpan = 3
324		tabCell.classList.add("eigSmall","eig-table_firstcolumn")
325
326		divContainer1.innerHTML = "";
327		divContainer1.appendChild(table); 
328		document.getElementById("futures_markets_title").colSpan=3;
329		  
330		var img = document.createElement("img")
331		img.src = "https://dv.energyintel.com/media/CME_Group_Logo.svg"
332		img.alt = "CME Group Logo"
333		img.style["max-width"] = '120px'
334		img.style["padding-top"] = '10px'
335		img.style["padding-left"] = '5px'
336		divContainer1.appendChild(img); 	
337	})
338};
339
340//Add the dynamic table to a container.	
341var divContainer2 = document.getElementById("market_prices_2");
342if (divContainer2 != undefined){
343	$.getJSON('https://dv.energyintel.com/eig/json/market_prices_2.json?utc=' + Date.now(), function(data) {
344
345    var table = document.createElement("table") // Create table header.
346    table.classList.add("eig-table")    
347    var tr = table.insertRow(-1); // Table row. (last position)
348    tr.classList.add("eig-table_title")
349  	var tabCell = tr.insertCell(-1);
350    tabCell.innerHTML = "Spot Markets";
351    tabCell.colspan = 3;
352    tabCell.classList.add("eigSmall");
353	tabCell.id = "spot_markets_title";
354	tabCell.style.textTransform = "none";
355	
356	tr = table.insertRow(-1); // Table row. (last position)
357    tr.classList.add("eig-table_heading")
358    var col = ["Crude Oil ($/bbl)", "Last", "Change"]
359    
360    for (var i = 0; i < col.length; i++) {
361      tabCell = tr.insertCell(-1);
362      tabCell.innerHTML = col[i];
363      tabCell.classList.add("eig-table_borderbottom","eigSmall","eig-table_cell_general")
364      }     
365    
366    for (var i = 0; i < data.length; i++){
367		if (i == 1){
368			tr = table.insertRow(-1);
369			tr.classList.add("eig-table_heading")
370			tabCell = tr.insertCell(-1);
371			tabCell.innerHTML = "Natural Gas ($/MMBtu)";
372			tabCell.colSpan = 3
373			tabCell.classList.add("eig-table_bordertop","eig-table_borderbottom","eigSmall","eig-table_cell_general")
374		}
375       
376		tr = table.insertRow(-1); // add new row for the names
377		tr.classList.add("eig-table_body")
378		
379		tabCell = tr.insertCell(-1);
380		tabCell.innerHTML = data[i].ei_point_name;
381        //if (data[i].ei_point_name == " Opec Basket"){        
382		//	tabCell.style["padding"] = '20px'
383        //}
384       
385		tabCell = tr.insertCell(-1);
386		tabCell.innerHTML = data[i].price_usd_per_bbl;
387		tabCell = tr.insertCell(-1);
388		tabCell.innerHTML = data[i]._change;
389		if (data[i]._change < 0) {
390		   tabCell.style["color"] = 'red'
391	   }else {
392		   tabCell.style["color"] = 'green'
393	   }
394    	     
395    }
396		
397    tr = table.insertRow(-1); 
398	tr.classList.add("eig-table_footer")
399    tabCell = tr.insertCell(-1);
400    tabCell.innerHTML = "Change vs prior close - Source Energy Intelligence. Last Updated at - " + data[1].published_datetime;
401	tabCell.colSpan = 3
402	tabCell.classList.add("eigSmall","eig-table_firstcolumn")
403	
404	
405	divContainer2.innerHTML = "";
406	divContainer2.appendChild(table); 
407	document.getElementById("spot_markets_title").colSpan=3;	
408	})	
409};
410
411})
412
413$(document).ready(function() {
414	if (document.querySelector('meta[property="og:type"]')?.content == "article"){						
415		try {
416			let topic = document.querySelector(".ArticlePage-topicLink");
417			topic = topic.innerText.replace(",","")
418			let aiDiv = document.createElement("div");
419			aiDiv.style="display:None";
420			aiDiv.className = "ArticlePage-aiSummary";
421			let innerDiv = '<a href="/ai-synthesis?topics=' + topic + '" target=_blank>'
422			innerDiv += 'Generate an AI synthesis of related coverage on: <br><span>' + topic + '</span><img src="https://dv.energyintel.com/media/ai_2_stars.png"/></a>' 
423			aiDiv.innerHTML = innerDiv;
424			const aiBr = document.createElement("br");
425			let parentElement = document.getElementsByClassName("ArticlePage-byline")[0];
426			parentElement.appendChild(aiBr);
427			parentElement.appendChild(aiDiv);
428		}catch (error){
429			console.warn("ai-summary append link failed");	
430		}
431	};			
432});
433
434/*Display ai-summary if users are signed in */
435if (document.querySelector('meta[property="og:type"]')?.content == "article"){
436	document.addEventListener('PelcroUserRefresh', function () {
437		try{
438			if (Pelcro.user.isEntitledTo("ai_summary_web") == true){
439				let aiDiv = document.getElementsByClassName("ArticlePage-aiSummary")[0];
440					aiDiv.style="display:block";
441			}
442		}catch (error){
443			console.warn("ai-summary entitlment check failed");	
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.