Widget:CJP2: Difference between revisions

Jump to navigation Jump to search
Christopher Popma (talk | contribs)
Created page with "<includeonly> <script type = "text/javascript"> $(document).ready(function() { $('#pillTable').css('visibility','hidden'); $('#executeGo').click(function() { ..."
 
Christopher Popma (talk | contribs)
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>
<script type = "text/javascript">
<script type="text/javascript">
$(document).ready(function() {
$(document).ready(function() {
    $('#pillTable').css('visibility','hidden');
mw.loader.load('mediawiki.Api', function() {
    $('#executeGo').click(function() {
var api = new mw.Api();
        var api = new mw.Api();
api.get({
            api.parse( $('#pillTable') )
action : 'ask',
            .done( function ( html ) {
query : '[[Pill Shape::Oval]]|?Pill Imprint|?Pill Dosage|?Pill Ingred|?Pill Color|?Pill Shape|?Pill Size (mm)|?Pill Scoring|?NDC|?Pill Name',
        console.log( 'Parsed result:', html );
format : 'json'
            } );
},function(data) {alert("Data: " + data);});
                /*.always(function (data) {
$.each(data.query.results, function (index, value) {
//Assign variables the values returned from the function//
var drugNameFull = value.fulltext;
var drugNameShort = drugNameLong.split("#")[0];
var pillImprint = value.printouts["Pill Imprint"];
var pillDosage = value.printouts["Pill Dosage"];
var pillIngred = value.printouts["Pill Ingred"];
var pillColor = value.printouts["Pill Color"];
var pillShape = value.printouts["Pill Shape"];
var pillSize = value.printouts["Pill Size (mm)"];
var pillScoring = value.printouts["Pill Scoring"];
var ndc = value.printouts["NDC"];
var pillName = value.printouts["Pill Name"];
//Find a <table> element with id="resultsTable-body":
var table = document.getElementById("resultsTable-body");


        $('#pillTable').css('visibility','visible');
//Create an empty <tr> element and add it to the 1st position of the table:
var row = table.insertRow(index);


    });
//Insert new cells(<td> elements) into the "new" <tr> element:
    $('#executeReset').click(function() {
var cellDrugName = row.insertCell(0);
        $('#searchParameters').empty();
var cellPillImprint = row.insertCell(1);
        $('#pillTable').css('visibility','hidden');
var cellPillDosage = row.insertCell(2);
    });
var cellPillIngred = row.insertCell(3);
});
var cellPillColor = row.insertCell(4);
var cellPillShape = row.insertCell(5);
var cellPillSize = row.insertCell(6);
var cellPillSocring = row.insertCell(7);
var cellNDC = row.insertCell(8);
var cellPillName = row.insertCell(9);
 
//Add Values to the cells:
cellDrugName.innerHTML = drugNameShort ;
cellPillImprint.innerHTML = pillImprint;
cellPillDosage.innerHTML = pillDosage;
cellPillIngred.innerHTML = pillIngred;
cellPillColor.innerHTML = pillColor;
cellPillShape.innerHTML = pillShape;
cellPillSize.innerHTML = pillSize;
cellPillSocring.innerHTML = pillScoring;
cellNDC.innerHTML = ndc;
cellPillName.innerHTML = pillName;
 
 
 
//Create a variable containing the HTML to be appended to the end of the table//
var newRow = '<tr> <td>' + drugNameShort + '</td> <td>' + pillImprint + '</td> <td>' + pillDosage + '</td> <td>' + pillIngred + '</td> <td>' + pillColor + '</td> <td>' + pillShape + '</td> <td>' + pillSize + '</td> <td>' + ndc + '</td> <td>' + pillName + '</td> </tr>';
//Append the new row with the information.//
$('#resultsTable-body').innerHTML(newRow);
});
});*/
});
});  
</script>
</script>
Pill Shape: <select id="selectPillShape">
<div id="resultsTable-container">
                    <option>Round</option>
    <table id="resultsTable">
                    <option>Oval</option>
        <thead>
                    <option>Capsule</option>
            <th>
                 </select><br />
                Drug Name
<input type="button" id="executeGo" value="Go" />
                </th>
<div id="pillTable" style="width:500px;">
               
    '''Hello World'''
                <th>
</div>
                Pill Imprint
                </th>
               
                <th>
                Dosage
                </th>
               
                <th>
                Ingredients
                </th>
               
                <th>
                Pill Color
                 </th>
               
                <th>
                Pill Shape
                </th>
               
                <th>
                Pill Size (mm)
                </th>
               
                <th>
                Score
                </th>
               
                <th>
                NDC
                </th>
               
                <th>
                Pill Image
                </th>
            </thead>
           
            <tbody id="resultsTable-body">
           
            </tbody>
        </table>
    </div>
</includeonly>
</includeonly>

Latest revision as of 13:06, 3 June 2014