MediaWiki:Common.js

Revision as of 16:08, 9 February 2017 by Kbjarkefur (talk | contribs)
Jump to: navigation, search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Java script needed for the main page */
$(function () {

  lifeCycleTopics = [
     ['Image file','Impact Evaluation Design', 'A brief introduction to the regression models commonly used in Impact Evaluation. Links to in details resources.'],
     ['Image file','Sampling & Power Calculations','A brief introduction to the regression models commonly used in Impact Evaluation. Links to in details resources.'],
     ['Image file','Human Subjects Approval','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Preparing for Data Collection','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Survey Firm Procurement','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Questionnaire Design','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Questionnaire Translation','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Questionnaire Programming','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Survey Pilot','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Enumerator Training','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Monitoring Data Quality','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Data Management','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Data Cleaning','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Data Analysis','Fill this in by edit the page MediaWiki:Common.js'],
     ['Image file','Reproducible Research','Fill this in by edit the page MediaWiki:Common.js']
   ]

   standAloneTopics = [
     'Stata Coding Practices','SurveyCTO Coding Practices','Geo Spatial Data','Check Lists for Field Coordinators','i2i Trust Fund for Impact Evaluation','Impact Evaluation Team','Cost-effectiveness Analysis'
   ]

  standAloneTopics.sort(function(a, b){return 0.5 - Math.random()});


  document.getElementById('dimewiki-mainpage-lc-js').innerHTML = dispTopics_lc(lifeCycleTopics);
  document.getElementById('dimewiki-mainpage-sa-js').innerHTML = dispTopics_sa(standAloneTopics);

/*
  var myElement = document.getElementById('mw-mywiki-example');
  myElement.innerHTML = dispTopics_lc(lifeCycleTopics);
*/

}());


function dispTopics_lc(topicArray)
  {
    var topicTable = '<div class="table-div"><table style="width:100%">';
    topicTable += '<col width=20%><col width=80%><tr>';

    for ( topic = 0 ; topic < topicArray.length ; ++topic ) {

      topicTable += '<td rowspan="2">'+ topicArray[topic][0] +'</td>';
      topicTable += '<td class="td_lc_titl"><a href="/wiki/'+ topicArray[topic][1] +'">'+ topicArray[topic][1] +'</a></td>';
      topicTable += '</tr><tr>';
      topicTable += '<td class="td_lc_desc">'+ topicArray[topic][2] +'</td></tr>';

    }

    topicTable += '</table></div>';

    return topicTable;
  }

  function dispTopics_sa(topicArray)
  {

    var topicTable = '<div class="table-div"><table style="width:100%">';

    for ( topic = 0 ; topic < topicArray.length ; ++topic ) {

      topicTable += '<tr><td class="td_sa"><a href="/wiki/'+ topicArray[topic] +'">'+ topicArray[topic] +'</a></td></tr>';
    }
    
    topicTable += '</table></div>';

    return topicTable;
  }