/// var Strongs = (function () { function Strongs() { } Strongs.GetStrongs = function (sn, dict) { try { var self_1 = this; var results_1 = { prefix: "", sn: -1, strongs: [], rmac: [], crossrefs: [], rmaccode: '', }; var url = dict + Math.ceil(sn / 100) + ".json"; if (dict == "grk") { results_1.prefix = "G"; if (sn > 5624) return false; } else { results_1.prefix = "H"; if (sn > 8674) return false; } results_1.sn = sn; $.ajax({ async: false, type: "GET", url: "data/strongs/" + url, dataType: "json", success: function (d, t, x) { results_1.strongs = d; }, error: function (request, status, error) { Util.HandleError(error); } }); $.ajax({ async: false, type: "GET", url: "data/strongscr/cr" + url, dataType: "json", success: function (d, t, x) { results_1.crossrefs = d; }, error: function (request, status, error) { Util.HandleError(error); } }); if (dict == "grk") { url = "data/rmac/rs" + Math.ceil(sn / 1000) + ".json"; var rmac_cross_references_1; // rmac is a two get process. $.ajax({ async: false, type: "GET", url: url, dataType: "json", success: function (d, t, x) { rmac_cross_references_1 = d; }, error: function (request, status, error) { Util.HandleError(error); } }); // deal with RMAC results_1.rmaccode = $.grep(rmac_cross_references_1, function (el, i) { if (el.i == sn + "") { return true; } else { return false; } })[0].r; if (results_1.rmaccode != undefined) { url = "data/rmac/r-" + results_1.rmaccode.substring(0, 1) + ".json"; $.ajax({ async: false, type: "GET", url: url, dataType: "json", success: function (d, t, x) { results_1.rmac = d; }, error: function (request, status, error) { Util.HandleError(error); } }); } } return results_1; } catch (err) { Util.HandleError(err); } return null; }; Strongs.BuildStrongs = function (r) { try { var t = void 0; // sometimes people search for a number that doesn't exist if (r.strongs == undefined) { t = $("
Doesn't exist.
"); } else { // first deal with strongs data. var entry = $.grep(r.strongs, function (el, i) { if (el.i == r.prefix + r.sn) { return true; } else { return false; } })[0]; var title = entry.lemma; var trans = entry.tr; var pron = entry.p; var desc = entry.de; var re = /([hg][0-9]{1,4})/gi; desc = desc.replace(re, "$1"); // now deal with cross references. var cr = $.grep(r.crossrefs, function (el, i) { if (el.id == r.prefix + r.sn) { return true; } else { return false; } }); var crtxt = ""; if (cr.length > 0) { crtxt = "
Cross References: Show
"; for (var _i = 0, cr_1 = cr; _i < cr_1.length; _i++) { var i = cr_1[_i]; for (var _a = 0, _b = i.ss; _a < _b.length; _a++) { var j = _b[_a]; crtxt += "" + j.w + ": "; for (var _c = 0, _d = j.rs; _c < _d.length; _c++) { var k = _d[_c]; var ref = k.r.split(";"); crtxt += "" + Reference.bookName(parseInt(ref[0])) + " " + ref[1] + ":" + ref[2] + ", "; } } crtxt = crtxt.substr(0, crtxt.length - 2); crtxt += "
"; } crtxt += "
"; } var rtxt = ""; if (r.prefix == "G" && r.rmac.length > 0) { rtxt += "
Robinsons Morphological Analysis Code: " + r.rmaccode + " Show
"; for (var _e = 0, _f = r.rmac; _e < _f.length; _e++) { var el = _f[_e]; if (el.id.toUpperCase() == r.rmaccode.toUpperCase()) rtxt += el.d + "
"; } rtxt += "
"; } // put together the display. // ok. we have to do this because click events seem to be cumulative with jquery. t = $("

" + r.prefix + r.sn + "

" + trans + " (" + r.sn + ") - " + pron + " - " + title + " - " + desc + "
" + rtxt + crtxt + "

"); } t.find(".link").click(function (e) { Util.HandleLink(e); }); t.find(".removeresult").click(function (e) { Util.RemoveResult(e); }); t.find(".showhide").click(function (e) { Strongs.ShowHide(e); }); return t; } catch (err) { Util.HandleError(err); } return null; }; Strongs.DisplayStrongs = function (r) { try { var t = Strongs.BuildStrongs(r); $("#result").prepend(t); return false; } catch (err) { Util.HandleError(err); } return null; }; Strongs.DisplayStrongsDialog = function (r) { try { var t = Strongs.BuildStrongs(r); var d = $("
").append(t); d.dialog({ draggable: true, width: 600, height: 500, resizable: true, title: "Strongs Definition", buttons: { "Close": function () { $(this).dialog("close"); } } }); return false; } catch (err) { Util.HandleError(err); } return null; }; Strongs.ShowHide = function (e) { var o = $(e.target); var c = o.parent().find(".contents"); if (c.css("display") != "none") { c.css("display", "none"); o.html("Show"); } else { c.css("display", "inline"); o.html("Hide"); } }; return Strongs; }()); ; //# sourceMappingURL=Strongs.js.map