PageSourceSearch

https://www.sundancepower.ca/mysecure/rates/signup/js/request.rate.js

js sundancepower.ca collected 2026-10-05 09:39:15 UTC 4,952 bytes, 44 lines download raw bytes

1if (typeof XMLHttpRequest === 'undefined')�window.location.href = '/system-requirements.html';�function showLoadingImage(id){�var parentElement = document.getElementById(id);�if(parentElement){�var imgElement = document.createElement('img');�imgElement.src = '/public/images/resource-loading.gif';�imgElement.style ='display: block;margin: 0 auto;';�parentElement.appendChild(imgElement);�var remove = function(){�try{�parentElement.removeChild(imgElement);�}�catch(error){�}�};�return function(){�remove();�};�}�}�function httpGet(url,id,responseFunction,errorFunction,headers,async){�var httpRequest=new XMLHttpRequest();�var removeImageFunction = null;�if(id){�removeImageFunction = showLoadingImage(id);�}�httpRequest.onreadystatechange = function(){�if (httpRequest.readyState === 4) {�if(removeImageFunction)�removeImageFunction();�if (httpRequest.status === 200 || httpRequest.status === 304) {�if(responseFunction)�responseFunction(httpRequest.responseText);�else�console.log('No response function for . ' + httpRequest.responseText);�}�else {�if(errorFunction)�errorFunction(httpRequest.status,httpRequest.responseText);�else�console.log('There was a problem trying to make a request '+ httpRequest.status + ' for ' + url +' please contact support.');�}�}�};�try{�if(!async)�httpRequest.open('GET',url,true);�else�httpRequest.open('GET',url,async);�httpRequest.setRequestHeader('X-Requested-With','XMLHttpRequest');�if(headers){�for (var header in headers){�if (headers.hasOwnProperty(header)) {�httpRequest.setRequestHeader(header,headers[header]);�}�}�}�httpRequest.send();�}�catch(exception){�if(removeImageFunction)�removeImageFunction();�if(errorFunction)�errorFunction(503,'SERVICE UNAVAILABLE');�else�console.log('There was a problem trying to send request ' + url +' please contact support.');�}�}�var redirectTo;�var isLoggedInRequestSent=false;�var responseFunctions = [];�var errorFunctions =[];�function insureTopWindow(){�if(window != window.top)�window.top.location.href='/mysecure/portal.html';�else�window.location.href='/mysecure/portal.html';�}�function isRequestingLogin(serverResponse){�return serverResponse.indexOf('loginRequested')!=-1�}�function checkPortalResponse(serverResponse){�notLoggedIn = isRequestingLogin(serverResponse);�if(notLoggedIn){�if(redirectTo)�window.top.location.href=redirectTo;�}�else{�insureTopWindow();�}�}�function checkPortalError(status,response){�if(redirectTo)�window.top.location.href=redirectTo;�}�function isLoggedInRequest(responseFunction,errorFunction,check){�responseFunctions.push(responseFunction);�errorFunctions.push(errorFunction);�if(!isLoggedInRequestSent){�isLoggedInRequestSent=true;�var headers = {};�headers['gwtservice'] = 'true';�try{�if(check)�httpGet('https://'+location.hostname+'/myretailer/secure/login.html?check=true',null,onResponse,onError,headers);�else�httpGet('https://'+location.hostname+'/myretailer/secure/login.html',null,onResponse,onError,headers);�}�catch(exception){�if(errorFunction)�errorFunction();�isLoggedInRequestSent=false;�}�}�}�function checkPortal(affilateSite){�if(affilateSite){�redirectTo = affilateSite;�isLoggedInRequest(checkPortalResponse,checkPortalError,true);�}�}�function onResponse(serverResponse){�for (var i = 0; i < responseFunctions.length; i++) {�responseFunctions[i](serverResponse);�}�responseFunctions=[];�isLoggedInRequestSent=false;�}�function onError(status,response){�for (var i = 0; i < errorFunctions.length; i++) {�errorFunctions[i](status,response);�}�errorFunctions=[];�isLoggedInRequestSent=false;�}�function storeRateRequest(element,type,additionalProperties){
2if(!sessionStorageSupported())
3return;
4var value ='{';
5var delimiter =',';
6if(element){
7var children = element.children;
8var length = children.length;
9for (var i = 0; i < length; i++) {
10var child = children[i];
11if(child.tagName == 'INPUT' && child.type == 'hidden'){
12if(!child.value || child.value === 'null')
13continue;
14value+=('"'+child.name + '"'+ ':' +'"'+ child.value +'"' +delimiter);
15}
16}
17value+=('"type"'+ ':' +'"'+ type +'"');
18}
19if(additionalProperties){
20if(value==='{')
21value+=additionalProperties;
22else
23value+=delimiter+additionalProperties;
24}
25value+='}';
26sessionStorage.setItem("RateRequest", value);
27return value;
28}
29function removeRateRequest(){
30if(!sessionStorageSupported())
31return;
32sessionStorage.removeItem("RateRequest");
33}
34function requestRate(element){
35var json = storeRateRequest(element,'SignUp');
36var utilityRequest = (json.indexOf('electricalRateOptionCode')!=-1) || (json.indexOf('solarClubRateOptionCode')!=-1) || (json.indexOf('preSolarClubRateOptionCode')!=-1) || (json.indexOf('naturalGasRateOptionCode')!=-1);
37var internetRequest = (json.indexOf('internetRateOptionCode')!=-1) || (json.indexOf('skyRoamRateOptionCode')!=-1);
38if(utilityRequest)
39window.location.href = '/mysecure/signup.html';
40else if (internetRequest)
41window.location.href = '/mysecure/isignup.html';
42else
43throw 'requestRate not configured for json';
44}

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.