Widget:CJP: Difference between revisions

Jump to navigation Jump to search
Christopher Popma (talk | contribs)
No edit summary
Christopher Popma (talk | contribs)
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();
        contentView();
    });
    $("#skip").click(function () {
        //$('option:selected', 'select').removeAttr('selected').next('option').attr('selected', 'selected');
     });
     });
     function createPage() {
     function createPage() {
Line 47: Line 43:
         .always(function (data) {
         .always(function (data) {
             alert("Great success?");
             alert("Great success?");
             $('option:selected', 'select').removeAttr('selected').next('option').attr('selected', 'selected');
             $('#microChapter option:selected').removeAttr('selected').next('option').attr('selected', 'selected');
             microChapterData();
             microChapterData();
         });
         });
     }
     }
     function microChapterData() {
     function microChapterData() {
         if ($('option:selected', 'select').val() === "Black Box Warning") {
 
         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', 'select').val() === "Chapter 2") {
         } else if ($('#microChapter option:selected').text() === "Adult Indications and Dosage") {
             $("#prepend").val("Added Text to the Beginning");
             resetForm();
            $("#pend").val("Added Text to the Middle");
            if ($('#headings option').length == 0) {
             $("#append").val("Added Text to the End");
                addHeading(["FDA-Labeled Indications and Dosage Information (Adults)", "Off-Label Use and Dosage (Adults)"]);
             $("#instructions").html("These are some instructions");
                microChapterData();
             $("#chapterContent2").css("visibility", "visible");
                $("#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() {
        console.log($("#microChapter"));
         $("#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");
    }
    function contentView() {
        alert($("#prepend").val() + " " + $("#chapterContent").val());
     }
     }
}
}
$(document).ready(ensureLoggedIn);
$(document).ready(ensureLoggedIn);
</script>
< / script >


Page Title: <input type="text" id="drugName" /><br />
Page Title: <input type="text" id="drugName" /><br />

Revision as of 19:24, 20 March 2014