Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 11th, 2013  |  syntax: None  |  size: 1.23 KB  |  views: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. if (document.domain.toLowerCase().indexOf("domainName") != -1)
  2.        
  3. if(window.location.href.match(/://(.[^/]+)/)[1].toLowerCase().indexOf("domainName") != -1)
  4.        
  5. if(window.location.hostname.toLowerCase().indexOf("domainName") != -1)
  6.        
  7. if(location.hostname == "mysite.com"){
  8.  
  9. }
  10.        
  11. if(location.hostname.match('mysite')){} // will return null if no match is found
  12.        
  13. function isEquals(myhost){
  14.               var hostName = window.location.hostname.split('.');
  15.               myhost = myhost.split(".");
  16.               //handle stuff like site:.com or ..com
  17.               for (var x in myhost)
  18.                 if (myhost[x] == "") myhost.splice(x,1);
  19.  
  20.           //j is where to start comparing in the hostname of the url in question
  21.           var j = hostName.length - myhost.length;
  22.           for(var i in myhost)
  23.           {
  24.               //if j is undefined or doesn't equal the hostname to match return false
  25.               if (!hostName[j] || hostName[j].toLowerCase() != host[i].toLowerCase())
  26.                   return false;
  27.               j++;
  28.           }
  29.           return true;
  30.       }
  31.        
  32. window.location.hostname == "stackoverflow.com"?
  33.        
  34. var domainParts = window.location.hostname.split(".");
  35. domainParts[domainParts.length - 2] == "stackoverflow"