Widget:PillIdentifier: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(15 intermediate revisions by the same user not shown) | |||
Line 24: | Line 24: | ||
$('.navTool').click(nav); | $('.navTool').click(nav); | ||
$("#reset").click(resetForm); | $("#reset").click(resetForm); | ||
$(".pillShapeOption").click(function(){ | $(".pillShapeOption").click(function(){ | ||
$(".pillShapeOption").children("img").css("border",""); | $(".pillShapeOption").children("img").css("border",""); | ||
Line 161: | Line 162: | ||
var printoutRequests = "|?Pill%20Imprint|?Pill%20Dosage|?Pill%20Ingred|?Pill%20Color|?Pill%20Shape|?Pill%20Size%20(mm)|?Pill%20Scoring|?NDC|?Pill%20Name"; | var printoutRequests = "|?Pill%20Imprint|?Pill%20Dosage|?Pill%20Ingred|?Pill%20Color|?Pill%20Shape|?Pill%20Size%20(mm)|?Pill%20Scoring|?NDC|?Pill%20Name"; | ||
var jsonURL = "http://www.wikidoc.org/api.php?action=ask&query="+queryParameters+printoutRequests+"&format=json"; | var jsonURL = "http://www.wikidoc.org/api.php?action=ask&query="+queryParameters+printoutRequests+"&format=json"; | ||
$.getJSON(jsonURL, function (data) { | $.getJSON(jsonURL, function (data) { | ||
if(data > 0){ | if(countProperties(data.query.results) > 0){ | ||
$.each(data.query.results, function(ind, val) { | $.each(data.query.results, function(ind, val) { | ||
///////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////// | ||
Line 248: | Line 250: | ||
}); | }); | ||
} else { | } else { | ||
$("#resultsTable-container").append("No | $("#resultsTable-container").append('<div style="margin:auto"><span style="font-size:36px;">No Results Found. Please Check Back Later.</span></div>'); | ||
} | } | ||
}); | }); | ||
$('#resultsTable-container').css("visibility", "visible"); | $('#resultsTable-container').css("visibility", "visible"); | ||
Line 361: | Line 361: | ||
} | } | ||
}; | }; | ||
function countProperties (obj) { | |||
var count = 0; | |||
for (var property in obj) { | |||
if (Object.prototype.hasOwnProperty.call(obj, property)) { | |||
count++; | |||
} | |||
} | |||
return count; | |||
} | |||
</script> | </script> | ||
<style type="text/css"> | <style type="text/css"> | ||
Line 421: | Line 433: | ||
width: 100px; | width: 100px; | ||
margin: 50px; | margin: 50px; | ||
cursor:pointer; | |||
} | } | ||
.pillColorOption { | .pillColorOption { | ||
Line 427: | Line 440: | ||
width: 100px; | width: 100px; | ||
margin: 50px; | margin: 50px; | ||
cursor:pointer; | |||
} | } | ||
.pillScoreOption { | .pillScoreOption { | ||
Line 433: | Line 447: | ||
width: 100px; | width: 100px; | ||
margin: 50px; | margin: 50px; | ||
cursor:pointer; | |||
} | } | ||
Line 505: | Line 520: | ||
#pillIDNav div{ | #pillIDNav div{ | ||
display:inline-block; | display:inline-block; | ||
cursor:pointer; | |||
} | } | ||