You are viewing our Forum Archives. To view or take place in current topics click here.
Can anyone help me with this code?
Posted:

Can anyone help me with this code?Posted:

IanP98
  • Prospect
Status: Offline
Joined: Feb 02, 201212Year Member
Posts: 698
Reputation Power: 28
Status: Offline
Joined: Feb 02, 201212Year Member
Posts: 698
Reputation Power: 28
Okay so here is the code I have: [ Register or Signin to view external links. ]

if you need to copy it its here:

//////////////////////////////////////////////////////////////////////////////////////
// Function omniCheckHost
//
// Description: This function manages the report suites so a developer doesn't have to
// monitor the switching of non-production and production report suites.
//
// rsi - string of comma separated report suites
//
// addDevDomains - string of comma separated keyword matches for additional development
// domains exclusive from "alpha.","beta.","dev.","load."&"local."
// that need to be flagged as non-production environment
//
// includeDevDomains - string of comma separated keyword matches for exclusion from
// predetermined development environments("alpha.","beta.","dev.","load."&"local.")
// that need to be flagged as production environment
//
// Called By: s_account
//
//////////////////////////////////////////////////////////////////////////////////////

function omniCheckHost(rsi,addDevDomains,includeDevDomains){

var currHost = document.location.hostname.toLowerCase();
if((currHost == "")||(currHost == null)||(currHost == undefined)){
return rsi ? (rsi.split(",").join("dev,")+"dev").replace(/\s+/g,'').toLowerCase() : "eaeacomdev"
}
if (currHost.match(/(alpha|beta|test|dev|load|local)\./)) {
if ((includeDevDomains != null)&&(includeDevDomains != undefined)&&(includeDevDomains != "")){
var xDomArray = includeDevDomains.split(",");
if (xDomArray.length > 0) {
for (var j = 0; j < xDomArray.length; j++) {
var exPattern = xDomArray[j].toLowerCase();
if(currHost.indexOf(exPattern )!=-1){
return rsi.replace(/\s+/g,'').toLowerCase();
}
}
}
return rsi ? (rsi.split(",").join("dev,")+"dev").replace(/\s+/g,'').toLowerCase() : "eaeacomdev"
}else{
return rsi ? (rsi.split(",").join("dev,")+"dev").replace(/\s+/g,'').toLowerCase() : "eaeacomdev"
}
} else {
if ((addDevDomains != null)&&(addDevDomains != undefined)&&(addDevDomains != "")){
var array = addDevDomains.split(",");
if (array.length > 0) {
for (var i = 0; i < array.length; i++) {
var pattern = array[i].toLowerCase();
if(currHost.indexOf(pattern)!=-1){
return rsi ? (rsi.split(",").join("dev,")+"dev").replace(/\s+/g,'').toLowerCase() : "eaeacomdev"
}
}
}
}
return rsi.replace(/\s+/g,'').toLowerCase();
}
};


Would anyone be able to tell me what it does? thanks for any replies
#2. Posted:
UnrealEgg
  • Powerhouse
Status: Offline
Joined: May 30, 201014Year Member
Posts: 438
Reputation Power: 49
Status: Offline
Joined: May 30, 201014Year Member
Posts: 438
Reputation Power: 49
More context would have been nice but after searching, it is clear that it is from the source code of [ Register or Signin to view external links. ] which is cached [ Register or Signin to view external links. ] .

From the comments above the function, it seems to me like it is a helper function that changes strings so a developer doesn't have to. When developing, you may have different environments, the most simple would be dev and release.

The function just seems to be manipulating strings so that the correct URLs(?) are used depending on the current hostname.
#3. Posted:
IanP98
  • Prospect
Status: Offline
Joined: Feb 02, 201212Year Member
Posts: 698
Reputation Power: 28
Status: Offline
Joined: Feb 02, 201212Year Member
Posts: 698
Reputation Power: 28
UnrealEgg wrote More context would have been nice but after searching, it is clear that it is from the source code of [ Register or Signin to view external links. ] which is cached [ Register or Signin to view external links. ] .

From the comments above the function, it seems to me like it is a helper function that changes strings so a developer doesn't have to. When developing, you may have different environments, the most simple would be dev and release.

The function just seems to be manipulating strings so that the correct URLs(?) are used depending on the current hostname.


So it says if you are a dev use this URL if not then use x ?
#4. Posted:
o7scape
  • New Member
Status: Offline
Joined: Feb 01, 201410Year Member
Posts: 37
Reputation Power: 1
Status: Offline
Joined: Feb 01, 201410Year Member
Posts: 37
Reputation Power: 1
it looks like it check the ip of the user and if its the host user it puts them in dev mode.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.