Created
March 1, 2013 16:31
-
-
Save tessas-capella/5065837 to your computer and use it in GitHub Desktop.
sniffs file's location and writes style sheet links and js script tags depending on what environment the file is being served from. Searches for that server's common wrapper files. - localhost, cis subdomain, ffti courseroom.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
//check where page is coming from | |
var hostname = window.location.hostname; | |
if(hostname == 'localhost'){ | |
var sharedResources = "//localhost/00-medtronic/"; | |
}else if(hostname == 'customsolutions.capella-id.com'){ | |
var sharedResources = "//customsolutions.capella-id.com/medtronic/"; | |
}else{ | |
var sharedResources = "//medtronic.capella.edu/file.php/1/media/"; | |
}//if/else check for where the page is loading | |
//css sample | |
document.write('<link rel="stylesheet" href="'+sharedResources+'/common/wrapper/css/css.css" />'); | |
//js sample | |
document.write("<scr" + "ipt src='"+sharedResources+"/common/wrapper/js/modernizr-1.7.min.js' type='text/javascript' charset='utf-8'><\/scr" + "ipt>"); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment