Widget:CJP4: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
<script content-type= "application/javascript" src="http://www.wikidoc.org/includes/raty/md5.js"></script> | <script content-type= "application/javascript" src="http://www.wikidoc.org/includes/raty/md5.js"></script> | ||
<script type"text/javascript"> | <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css" /> | ||
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script><script type"text/javascript"> | |||
$(document).ready(loadResources); | $(document).ready(loadResources); | ||
Line 221: | Line 222: | ||
//Next we build the directory name using the first two characters | //Next we build the directory name using the first two characters | ||
imageDirect = 'http://static.wikidoc.org/' + md5.charAt(0) + '/' + md5.substring(0,2) + '/' + pillName | imageDirect = 'http://static.wikidoc.org/' + md5.charAt(0) + '/' + md5.substring(0,2) + '/' + pillName | ||
imageDirect = imageCheck(imageDirect) | |||
///////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////// | ||
////// Create the Drug Name Hyperlink ////// | ////// Create the Drug Name Hyperlink ////// | ||
Line 281: | Line 283: | ||
$('#resultsTable-container').css("visibility", "visible") | $('#resultsTable-container').css("visibility", "visible") | ||
}; | }; | ||
function imageCheck(url){ | |||
if (UrlExists(url) {return url} | |||
else {return "http://static.wikidoc.org/0/0e/No_image.jpg"} | |||
}; | |||
function UrlExists(url) { | |||
var http = new XMLHttpRequest(); | |||
http.open('HEAD', url, false); | |||
http.send(); | |||
return http.status != 404; | |||
} | |||
</script> | </script> | ||
<style type="text/css"> | <style type="text/css"> |