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
 
(14 intermediate revisions by the same user not shown)
Line 2: Line 2:
<script type = "text/javascript">
<script type = "text/javascript">
$(document).ready(function() {
$(document).ready(function() {
$('#prepend').val('{|class="wikitable sortable" cellpadding="5" !Drug Name !! Pill Imprint !! Dosage !! Ingredients !! Pill Color !! Pill Shape !! Pill Size (mm) !! Score !! NDC !! Pill Image|-{{#ask:');
    $('#pillTable').css('visibility','hidden');
$('#pend').val('[[Pill Shape::Round]]');
    $('#executeGo').click(function() {
$('#append').val('|?Pill Imprint|?Pill Dosage|?Pill Ingred|?Pill Color|?Pill Shape|?Pill Size (mm)|?Pill Scoring |?NDC|?Pill Name|format=template|template=PillID}} |}')
        $('#searchParameters').append('<string>[[Pill Shape::</string>'+$('#selectPillShape option:selected').val() +'<string>]]</string>');
});
        $('#pillTable').css('visibility','visible');


$('#executeGo').click( function() {
        var api = new mw.Api();
  $('#prepend').css("visibility","visible");
            api.parse( $('#pillTable') )
  $('#pend').css("visibility","visible");
            .done( function ( html ) {
  $('#apend').css("visibility","visible");
        console.log( 'Parsed result:', html );
            } );
    });
    $('#executeReset').click(function() {
        $('#searchParameters').empty();
        $('#pillTable').css('visibility','hidden');
    });
});
});
</script>
</script>
<input type="button" id="executeGo" value="Go" />
Pill Shape: <select id="selectPillShape">
<input type="hidden" id="prepend" />
                    <option>Round</option>
<input type="hidden" id="pend" />
                    <option>Oval</option>
<input type="hidden" id="append" />
                    <option>Capsule</option>
                </select><br />
<input type="button" id="executeGo" value="Go" />
<input type="button" id="executeReset" value="Reset" />
<div id="pillTable" style="width:500px;">
    {|class="wikitable sortable" cellpadding="5"
    !Drug Name !! Pill Imprint !! Dosage !! Ingredients !! Pill Color !! Pill Shape !! Pill Size (mm) !! Score !! NDC !! Pill Image<br/>
    |- <br/>
    {{#ask:<string id="searchParameters"></string><br/>
    |?Pill Imprint<br/>
    |?Pill Dosage<br/>
    |?Pill Ingred<br/>
    |?Pill Color<br/>
    |?Pill Shape<br/>
    |?Pill Size (mm)<br/>
    |?Pill Scoring<br/>
    |?NDC<br/>
    |?Pill Name<br/>
    |format=template<br/>
    |template=PillID}}<br/>
    |}
</div>
</includeonly>
</includeonly>

Latest revision as of 13:36, 29 May 2014