Widget:CJP: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<script type="text/javascript"> | < script type = "text/javascript" > | ||
function ensureLoggedIn() { | function ensureLoggedIn() { | ||
mw.loader.load('mediaWiki.user'); | mw.loader.load('mediaWiki.user'); | ||
Line 13: | Line 13: | ||
function createMicrochapter() { | function createMicrochapter() { | ||
$("#executeGo").click(function () { | $("#executeGo").click(function () { | ||
microChapterData( | microChapterData(); | ||
}); | }); | ||
function createPage() { | function createPage() { | ||
Line 47: | Line 43: | ||
.always(function (data) { | .always(function (data) { | ||
alert("Great success?"); | alert("Great success?"); | ||
$('option:selected | $('#microChapter option:selected').removeAttr('selected').next('option').attr('selected', 'selected'); | ||
microChapterData(); | microChapterData(); | ||
}); | }); | ||
} | } | ||
function microChapterData() { | function microChapterData() { | ||
if ($('option:selected | |||
if ($('#microChapter option:selected').text() === "Black Box Warning") { | |||
resetForm(); | |||
$("#chapterContent2").css("visibility", "visible"); | |||
$("#prepend").val("{{TopOfDrugPage}} \n \n {{BlackBoxTemplate|blackBoxWarningTitle="); | $("#prepend").val("{{TopOfDrugPage}} \n \n {{BlackBoxTemplate|blackBoxWarningTitle="); | ||
$("pend").val("|blackBoxWarningBody="); | $("pend").val("|blackBoxWarningBody="); | ||
$("#append").val("}}"); | $("#append").val("}}"); | ||
$("#instructions").html("These are some instructions"); | $("#instructions").html("These are some instructions"); | ||
} else if ($('option:selected | } else if ($('#microChapter option:selected').text() === "Adult Indications and Dosage") { | ||
$( | resetForm(); | ||
if ($('#headings option').length == 0) { | |||
$(" | addHeading(["FDA-Labeled Indications and Dosage Information (Adults)", "Off-Label Use and Dosage (Adults)"]); | ||
$(" | microChapterData(); | ||
$( | $("#instructions").html("These are some instructions"); | ||
} else if ($('#headings option:selected').text() === "FDA-Labeled Indications and Dosage Information (Adults)") { | |||
alert("Hi"); | |||
$('#headings option:selected').removeAttr('selected').next('option').attr('selected', 'selected'); | |||
} else if ($('#headings option:selected').text() === "Off-Label Use and Dosage (Adults)") { | |||
alert("Clear!"); | |||
resetForm(); | |||
} | |||
} else if ($('#microChapter option:selected').text() === "Contraindications") { | |||
alert("Passed."); | |||
} | } | ||
} | } | ||
Line 78: | Line 86: | ||
} | } | ||
function resetForm() { | function resetForm() { | ||
$("#instructions").html(" "); | $("#instructions").html(" "); | ||
$("#chapterContent").val(" "); | $("#chapterContent").val(" "); | ||
Line 87: | Line 94: | ||
$("#chapterContent2").css("visibility", "hidden"); | $("#chapterContent2").css("visibility", "hidden"); | ||
$("#headingDiv").css("visibility", "hidden"); | $("#headingDiv").css("visibility", "hidden"); | ||
} | } | ||
} | } | ||
$(document).ready(ensureLoggedIn); | $(document).ready(ensureLoggedIn); | ||
</script> | < / script > | ||
Page Title: <input type="text" id="drugName" /><br /> | Page Title: <input type="text" id="drugName" /><br /> |