PageSourceSearch

https://www.greatcanadianutilities.com/js/title.js

js greatcanadianutilities.com collected 2026-10-05 09:39:06 UTC 10,961 bytes, 261 lines download raw bytes

1var title='Great Canadian Utilities';�document.title = title;if (typeof Element.prototype.addClassName !== 'function') {�Element.prototype.addClassName = function (className){�if(!this.classNameExists(className)){�if (this.className.trim().length > 0)�this.className = this.className.trim() + ' ' + className;�else�this.className = className;�return true;�}�else�return false;�};�}�if (typeof Element.prototype.addClassNameFirst !== 'function') {�Element.prototype.addClassNameFirst = function (className){�if(!this.classNameExists(className)){�if (this.className.trim().length > 0)�this.className = className + ' ' + this.className.trim();�else�this.className = className;�return true;�}�else�return false;�};�}�if (typeof Element.prototype.classNameExists !== 'function') {�Element.prototype.classNameExists = function (className){�if (!className)�return false;�className = className.trim();�if(className.length == 0)�return false;�if(this.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'))==null)�return false;�return true;�};�}�if (typeof Element.prototype.removeClassName !== 'function') {�Element.prototype.removeClassName = function (className){�if(this.classNameExists(className)){�this.className =this.className.replace(className , '' ).trim();�return true;�}�return false;�};�}�if (typeof Element.prototype.removeFromParent !== 'function') {�Element.prototype.removeFromParent = function (){�var parentNode = this.parentNode;�if(parentNode){�parentNode.removeChild(this);�}�return parentNode;�};�}�if (typeof Element.prototype.removeChildren !== 'function') {�Element.prototype.removeChildren = function (){�while(this.firstChild) {�this.removeChild(this.firstChild);�}�};�}�if (typeof window.WindowOnload != 'function') {
2window.WindowOnload = function WindowOnload(windowOnloadFunction,useCapture){
3if(window.addEventListener){
4if(useCapture)
5window.addEventListener('load',windowOnloadFunction,false); //W3C
6else
7window.addEventListener('load',windowOnloadFunction,useCapture);
8}
9else if (window.attachEvent){
10window.attachEvent('onload',windowOnloadFunction); //IE
11}
12else if( window.onLoad ) {
13if (typeof window.onload != 'function') {
14window.onload = windowOnloadFunction;
15}
16else {
17var currentOnload = window.onload;
18window.onload = function() {
19if(currentOnload) {
20currentOnload();
21}
22windowOnloadFunction();
23}
24}
25}
26};
27}
28function checkStorageSupport(storage){
29var dummy = '_unet_dummy_';
30try {
31window[storage].setItem(dummy, dummy);
32window[storage].removeItem(dummy);
33return true;
34} catch (e) {
35return false;
36}
37}
38function localStorageSupported(){
39return checkStorageSupport('localStorage');
40}
41function sessionStorageSupported(){
42return checkStorageSupport('sessionStorage');
43}
44function isCookiesEnabled(){�var isCookiesEnabled = false;�try{�var cookieName = 'cookieTest'+new Date().getTime();�var cookieValue = 'true';�var path ='/';�setCookie(cookieName,cookieValue,null,null,path,'none');�var read = readCookie(cookieName);�var isCookiesEnabled = (read === cookieValue);�if(isCookiesEnabled)�removeCookie(cookieName,path,'none');�}�catch(ex){�isCookiesEnabled = false;�}�return isCookiesEnabled;�}�function readCookie(cookieName) {�if(!cookieName || cookieName=='')�return null;�var theCookie=''+document.cookie;�var ind=theCookie.indexOf(cookieName);�if (ind==-1)�return null;�var ind1=theCookie.indexOf(';',ind);�if (ind1==-1)�ind1=theCookie.length;�var value = decodeURIComponent(theCookie.substring(ind+cookieName.length+1,ind1));�return value;�}�function removeCookie(name,path,samesite){�if(readCookie(name)){�var cookie = name + '=;'�if(path){�cookie += 'path=' + path + ';';�}�if(samesite){�cookie += 'SameSite=' + samesite + ';';�if('none'.toUpperCase() === samesite.toUpperCase())�cookie += 'Secure;';�}�document.cookie = cookie + 'expires=Fri, 02-Jan-1970 00:00:00 GMT'�}�}�function setCookie(name,value,expires,domain, path,samesite){�name = encodeURIComponent(name);�value = encodeURIComponent(value);�var cookie = name + '=' + value + ';';�if (expires) {�if(expires instanceof Date) {�if (isNaN(expires.getTime()))�expires = new Date();�}�else�expires = new Date(new Date().getTime() + parseInt(expires) * 1000 * 60 * 60 * 24);�cookie += 'expires=' + expires.toGMTString() + ';';�}�if (path)�cookie += 'path=' + path + ';';�if (domain)�cookie += 'domain=' + domain + ';';�if(samesite){�cookie += 'SameSite=' + samesite + ';';�if('none'.toUpperCase() === samesite.toUpperCase())�cookie += 'Secure;';�}�document.cookie = cookie;�}�function isTopAccessible() {
45try {
46window.top.location;
47return true;
48}
49catch (err) {
50return false;
51}
52}
53function showRequirements() {
54if(isTopAccessible()){
55window.top.location.href = '/system-requirements.html';
56}
57}
58function addRequiredStorageSupportToWindow(){
59window.sessionStorageSupported = function(){return true;};
60window.localStorageSupported = function(){return true;};
61}
62function addRequiredCookiesEnabledToWindow(){
63window.isCookiesEnabled = function(){return true;};
64}
65function checkBrowserIfFirefoxOnIOS(){
66if(isFirefoxIOS()){
67var addFirefoxIOSScript = document.createElement('script');
68addFirefoxIOSScript.setAttribute('src','/js/messagealert_firefoxios.js');
69document.head.appendChild(addFirefoxIOSScript);
70var addFirefoxIOSStyle = document.createElement('link');
71addFirefoxIOSStyle.setAttribute('href','/css/messagealert_firefoxios.css');
72addFirefoxIOSStyle.setAttribute('rel','stylesheet');
73addFirefoxIOSStyle.setAttribute('type','text/css');
74document.head.appendChild(addFirefoxIOSStyle);
75}
76}
77function isFirefoxIOS() {
78return navigator.userAgent.match("FxiOS");
79}
80function checkRequiredBrowserImplementation(){
81try{
82if(window.sessionStorage.getItem('unEnvChecked') === 'true'){
83addRequiredStorageSupportToWindow();
84addRequiredCookiesEnabledToWindow();
85return;
86}
87}
88catch(ex){}
89if(!sessionStorageSupported()){
90showRequirements();
91return;
92}
93else if(!localStorageSupported()){
94showRequirements();
95return;
96}
97addRequiredStorageSupportToWindow();
98if(!isCookiesEnabled()){
99showRequirements();
100return;
101}
102addRequiredCookiesEnabledToWindow();
103checkBrowserIfFirefoxOnIOS();
104window.sessionStorage.setItem('unEnvChecked','true') ;
105}
106checkRequiredBrowserImplementation();
107function hasGA(){
108if (typeof window.gtag === 'function'){
109return true;
110}
111else{
112return false;
113}
114}
115function ga4Exception(description, fatal){
116if(hasGA()){
117window.gtag({'event' : 'exception',
118'description': description,
119'fatal': fatal
120});
121}
122}
123function ga4SignUp(method){
124if(hasGA()){
125window.gtag({'event' : 'sign_up',
126'method': method });
127}
128}
129function ga4FileDownload(fileName, fileExtension,linkText, linkURL){
130if(hasGA()){
131window.gtag({'event' : 'file_download',
132'file_name':fileName,
133'file_extension': fileExtension,
134'link_text': linkText,
135'link_url':linkURL});
136}
137}
138var gaExtensionRegex = new RegExp(/pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi|mp3|wav|wma/,'i')
139var gaFileNameRegex = new RegExp(/\/([^\/?#]+)[^\/]*$/);
140function ga4SendPageView(pageTitle,pageLocation) {
141if(hasGA()){
142window.gtag({'event' : 'page_view',
143'page_title': pageTitle,
144'page_location': pageLocation
145});
146}
147}
148function ga4URLFileDownload(url, linkText) {
149if(!hasGA()){
150return;
151}
152try {
153if(!url)
154return;
155var linkURL = url.split("?")[0].split("#")[0];
156var fileName = null;
157var fileExtension = null;
158var matches = gaFileNameRegex.exec(url);
159if (matches != null && matches.length > 1) {
160var theMatch = matches[1];
161var extensionMatches = gaExtensionRegex.exec(theMatch);
162if (extensionMatches != null && extensionMatches.length > 1) {
163fileName = theMatch;
164fileExtension = extensionMatches[0];
165}
166} else { // linkURL match
167var extensionMatches = gaExtensionRegex.exec(linkURL);
168if (extensionMatches != null && extensionMatches.length > 1) {
169fileName = linkURL;
170fileExtension = extensionMatches[0];
171}
172}
173if (fileName && fileExtension && linkURL) {
174if (!linkText) {
175linkText = fileName.substring(0, fileName.indexOf('.'));
176}
177window.ga4FileDownload(fileName, fileExtension,linkText, linkURL);
178}
179} catch (ex) {
180}
181}
182function gaConfig(containerid){
183if (window.gtmDoneLoad) {
184return false;
185}
186window.gtmDoneLoad = true;
187window.dataLayer = window.dataLayer || [];
188dataLayer.push({ event: 'gtm.js', 'gtm.start': new Date().getTime()});
189window.gtag = function (dataObject){dataLayer.push(dataObject);};
190var gtm = document.createElement('script');
191gtm.type = 'text/javascript';
192gtm.async = true;
193gtm.src = 'https://www.googletagmanager.com/gtm.js?id='+ containerid;
194document.head.insertBefore(gtm, document.head.firstChild);
195}
196function gaNoOpConfig(containerid){
197}
198if (window.location.href.toLowerCase().indexOf('www.greatcanadianutilities.com') != -1) {�gaConfig('GTM-MXWFV95Z');�}
199function hasSessionStorageSupported(){
200return (typeof window.sessionStorageSupported === 'function') && sessionStorageSupported();
201}
202function removeMyAccountMenu(){
203if(!hasSessionStorageSupported())
204return;
205sessionStorage.removeItem('myaccount.menu');
206}
207function storeMyAccountMenu(jsonObject){
208if(!hasSessionStorageSupported())
209return;
210jsonString = JSON.stringify(jsonObject);
211sessionStorage.setItem('myaccount.menu', jsonString);
212}
213function isMyAccountMenuInStorage(){
214if (hasSessionStorageSupported())
215return sessionStorage.getItem('myaccount.menu') != null;
216return false;
217}
218function changeMenuToLoggedIn(jsonObject){
219if(!hasSessionStorageSupported())
220return;
221theDocument = window.top.document;
222element = theDocument.getElementById('deskTopMainMenuMyAccountAnchor');
223if(element){
224if(!jsonObject){
225jsonString = sessionStorage.getItem('myaccount.menu');
226if(!jsonString)
227return;
228jsonObject = JSON.parse(jsonString);
229}
230name = jsonObject.name;
231var nameNode = theDocument.createTextNode(name);
232var childNode = element.childNodes[0];
233if(nameNode.isEqualNode(childNode))
234return;
235element.replaceChild(nameNode,childNode );
236linksElement = theDocument.getElementById('deskTopMainMenuMyAccountLinks');
237if(linksElement){
238while(linksElement.firstChild){
239linksElement.removeChild(linksElement.firstChild);
240}
241dashboardAnchorElement = theDocument.createElement('a');
242dashboardAnchorElement.setAttribute('href','/mysecure/portal.html');
243dashboardAnchorElement.appendChild(document.createTextNode("Dashboard"));
244dashboardListElement = theDocument.createElement('li');
245dashboardListElement.appendChild(dashboardAnchorElement);
246dashboardListElement.setAttribute('title',name);
247linksElement.appendChild(dashboardListElement);
248logoutAnchorElement = theDocument.createElement('a');
249logoutAnchorElement.setAttribute('href','/myretailer/secure/logout.html');
250logoutAnchorElement.appendChild(document.createTextNode('Log Out'));
251logoutAnchorElement.setAttribute('onclick', 'removeMyAccountMenu(); sessionStorage.removeItem("RateRequest");');
252logoutListElement = theDocument.createElement('li');
253logoutListElement.appendChild(logoutAnchorElement);
254logoutListElement.setAttribute('title',name);
255linksElement.appendChild(logoutListElement);
256}
257element = theDocument.getElementById('deskTopMainMenuSignupAnchor');
258if(element)
259element.innerHTML='Add Account';
260}
261}

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.