/// /// /** * Created by phil on 11/18/15. * * DO NOT MODIFY THIS JAVASCRIPT FILE. It is generated from door43counts/private/ts/word-count-plugin.ts. Make all * changes in the typescript file (word-count-plugin.ts) and then run tsc.sh to regenerate the javascript. * */ function word_count_plugin_script_loaded() { return true; } var reload_timer; function load_word_counts() { // use this timer to reload in case of timeout generating counts reload_timer = setTimeout(function () { document.location.reload(true); }, 3 * 60 * 1000); // We need to get the data from the plugin because of browser Cross-Origin restrictions. var url = DOKU_BASE + 'lib/exe/ajax.php'; var dataValues = { call: 'door43_word_counts' }; var ajaxSettings = { type: 'POST', url: url, data: dataValues }; jQuery.ajax(ajaxSettings).done(function (data) { // stop the reload timer if (typeof reload_timer !== 'undefined') { window.clearTimeout(reload_timer); reload_timer = undefined; } jQuery('#loading-h3').hide(); var $div = jQuery('#count-results-div'); if (data.substr(0, 1) === '{') { // an object was returned var obj = JSON.parse(data); var $ul = $div.find('ul'); // ta counts var ta_data = obj['ta']; var $ta = jQuery(''); var ta_count = 0; for (var i = 0; i < ta_data.length; i++) { $ta.append('
  • ' + ta_data[i][0] + ': ' + ta_data[i][1] + '
  • '); ta_count += ta_data[i][1]; } $li = jQuery('
  • tA: ' + ta_count + '
  • '); $li.append($ta); $ul.append($li); // OBS counts var obs = obj['obs']; for (var i = 0; i < obs.length; i++) { $ul.append('
  • ' + obs[i][0] + ': ' + obs[i][1] + '
  • '); } $ul.append('
  • Bible tW: ' + obj['terms'] + '
  • '); // Bible counts var $ulb = jQuery(''); var ulb_count = 0; var $udb = jQuery(''); var udb_count = 0; var bible = obj['bible']; var $notes = jQuery(''); var note_count = 0; var $cq = jQuery(''); var cq_count = 0; for (var i = 1; i < 68; i++) { if (!bible[i]) continue; // ULB counts $ulb.append('
  • ' + bible[i][0] + ': ' + bible[i][1]['ulb'] + '
  • '); ulb_count += bible[i][1]['ulb']; // UDB counts $udb.append('
  • ' + bible[i][0] + ': ' + bible[i][1]['udb'] + '
  • '); udb_count += bible[i][1]['udb']; // note counts $notes.append('
  • ' + bible[i][0] + ': ' + bible[i][1]['notes'] + '
  • '); note_count += bible[i][1]['notes']; // checking question counts $cq.append('
  • ' + bible[i][0] + ': ' + bible[i][1]['questions'] + '
  • '); cq_count += bible[i][1]['questions']; } var $li = jQuery('
  • Bible tN: ' + note_count + '
  • '); $li.append($notes); $ul.append($li); $li = jQuery('
  • Bible tQ: ' + cq_count + '
  • '); $li.append($cq); $ul.append($li); $li = jQuery('
  • ULB: ' + ulb_count + '
  • '); $li.append($ulb); $ul.append($li); $li = jQuery('
  • UDB: ' + udb_count + '
  • '); $li.append($udb); $ul.append($li); } else { // this is probably an error message $div.html(data); } $div.show(); }); } //# sourceMappingURL=word-count-plugin.js.map