Last active
December 22, 2015 20:39
-
-
Save matt-bernhardt/6528122 to your computer and use it in GitHub Desktop.
BartonPlus Placards
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
<div><center>This widget is attempting to put an iframe into a custom placard area</center></div> | |
<div id="mysearch" style="display:none">ep.SearchTerm</div> | |
<script type="text/javascript" language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// functions | |
function CleanSearchTerm(strTerm) { | |
strTerm = strTerm.toLowerCase(); | |
// Trim leading/trailing spaces | |
strTerm = strTerm.trim(); | |
return strTerm; | |
} | |
function NoPlacard() { | |
$('.related-info-area:contains("bartonplus_placard")', window.parent.document).css('display','none'); | |
} | |
// Main body of script | |
console.log('Hours placard loader v1.0'); | |
var searchterm = document.getElementById('mysearch').innerHTML; | |
searchterm = CleanSearchTerm(searchterm); | |
if(searchterm === "hours" || searchterm === "library hours"){ | |
var resultdiv1 = '<div id="bartonplus_placard"><iframe src="http://libraries.mit.edu/eds/placard_hours.html" seamless="seamless" width="100%"></iframe></div>'; | |
$('.result-list', window.parent.document).before(resultdiv1); | |
$('.related-info-area:contains("bartonplus_placard")', window.parent.document).css('display','none'); | |
} | |
else { | |
NoPlacard(); | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment