mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -04:00
FEATURE: adding files
This commit is contained in:
parent
a374748d81
commit
5ff5fc999c
134
DynamicBibleUtility/DynamicBibleApp/js/Bible.js
Normal file
134
DynamicBibleUtility/DynamicBibleApp/js/Bible.js
Normal file
@ -0,0 +1,134 @@
|
||||
var Bible = (function () {
|
||||
function Bible() {
|
||||
}
|
||||
Bible.DisplayPassage = function (cs, ref, testament) {
|
||||
try {
|
||||
var r = "";
|
||||
for (var j = 0; j < cs.length; j++) {
|
||||
if (Number(ref.startchapter) < Number(ref.endchapter)) {
|
||||
r += "<b>Chapter: " + cs[j].ch + "</b><br />";
|
||||
}
|
||||
var vss = cs[j].vss;
|
||||
for (var m = 0; m < vss.length; m++) {
|
||||
var v = vss[m];
|
||||
r += "<b>" + v.v + ".</b> ";
|
||||
for (var w = 0; w < v.w.length; w++) {
|
||||
if (v.w[w].s != undefined) {
|
||||
var strongs_pre = "";
|
||||
if (testament == "old") {
|
||||
strongs_pre = "H";
|
||||
}
|
||||
if (testament == "new") {
|
||||
strongs_pre = "G";
|
||||
}
|
||||
var sp = "";
|
||||
if (v.w[w].t.substr(v.w[w].t.length - 1) == " ") {
|
||||
sp = " ";
|
||||
}
|
||||
r += "<a href='javascript:void(0)' class='hiddenlink' title='Strongs #: " + v.w[w].s + "'><span class='searchvalue' style='display:none'>" + strongs_pre + v.w[w].s + "</span>" + v.w[w].t.trim() + "</a>" + sp;
|
||||
}
|
||||
else {
|
||||
r += v.w[w].t;
|
||||
}
|
||||
}
|
||||
if ($("#break-on-verses").is(":checked")) {
|
||||
r += "<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
var t = $("<div class='passage result'><a href='javascript:void(0)' class='removeresult' style='border: 0;'><img style='border: 0px;' src='images/delete.png' width='48' height='48' /></a><a href='#' class='trigger left'> </a><div class='tags panel left'></div><span class='resultbody'>" + "<h2><a class ='result-heading' href='?r=" + ref.toString() + "'>" + ref.toString() + "</a></h2>" + r + "</span><br clear='all' /></div>");
|
||||
Bible.AttachEvents(t, ref);
|
||||
$("#result").prepend(t);
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
};
|
||||
Bible.GetPassage = function (b, sch, ech, sv, ev) {
|
||||
try {
|
||||
var chapters = []; // the verses from the chapter.
|
||||
var r = {
|
||||
cs: [],
|
||||
testament: ""
|
||||
};
|
||||
for (var i = sch; i <= ech; i++) {
|
||||
var url = "bibles/kjv_strongs/" + b + "-" + i + ".json";
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (d, t, x) {
|
||||
chapters.push(d);
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
Util.HandleError(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
for (var j = 0; j < chapters.length; j++) {
|
||||
var vss = [];
|
||||
var start;
|
||||
var end;
|
||||
// figure out the start verse.
|
||||
if (j == 0) {
|
||||
start = sv;
|
||||
}
|
||||
else {
|
||||
start = 1;
|
||||
}
|
||||
// figure out the end verse
|
||||
if ((j + 1) == chapters.length) {
|
||||
end = ev;
|
||||
}
|
||||
else {
|
||||
end = "*";
|
||||
}
|
||||
// get the verses requested.
|
||||
var tvs = chapters[j].vss.length;
|
||||
if (end == "*" || end > tvs) {
|
||||
end = tvs;
|
||||
}
|
||||
for (i = start; i <= end; i++) {
|
||||
// we're using c based indexes here, so the index is 1 less than the verse #.
|
||||
vss.push(chapters[j].vss[i - 1]);
|
||||
}
|
||||
r.cs.push({
|
||||
"ch": chapters[j].ch,
|
||||
"vss": vss
|
||||
});
|
||||
}
|
||||
if (b >= 40) {
|
||||
r.testament = "new";
|
||||
}
|
||||
else {
|
||||
r.testament = "old";
|
||||
}
|
||||
return r;
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Bible.AttachEvents = function (t, ref) {
|
||||
t.find(".hiddenlink").click(function (e) {
|
||||
Util.HandleHiddenLink(e);
|
||||
});
|
||||
t.find(".removeresult").click(function (e) {
|
||||
Util.RemoveResult(e);
|
||||
});
|
||||
t.find(".resultbody h2").tooltip({
|
||||
items: ".resultbody h2",
|
||||
content: function (tt) {
|
||||
}
|
||||
});
|
||||
t.find('.trigger').slidePanel({
|
||||
triggerCss: 'margin-top: 60px; display: block; width: 48px; height: 48px;',
|
||||
panelCss: 'margin-top: 55px; border: 2px solid #666;'
|
||||
});
|
||||
};
|
||||
return Bible;
|
||||
}());
|
||||
;
|
||||
//# sourceMappingURL=Bible.js.map
|
1
DynamicBibleUtility/DynamicBibleApp/js/Bible.js.map
Normal file
1
DynamicBibleUtility/DynamicBibleApp/js/Bible.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"Bible.js","sourceRoot":"","sources":["../ts/Bible.ts"],"names":[],"mappings":"AAAA;IAAA;IA0IA,CAAC;IAxIiB,oBAAc,GAA5B,UAA6B,EAAE,EAAE,GAAG,EAAE,SAAS;QAC3C,IAAI,CAAC;YACD,IAAI,CAAC,GAAG,EAAE,CAAC;YACX,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;oBACpD,CAAC,IAAI,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,YAAY,CAAC;gBAClD,CAAC;gBACD,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;gBAEpB,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAClC,IAAI,CAAC,GAAG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AAC,CAAC;IACP,CAAC;IACL,YAAC;AAAD,CAAC,AA1ID,IA0IC;AAAA,CAAC"}
|
42
DynamicBibleUtility/DynamicBibleApp/js/Util.js
Normal file
42
DynamicBibleUtility/DynamicBibleApp/js/Util.js
Normal file
@ -0,0 +1,42 @@
|
||||
var Util = (function () {
|
||||
function Util() {
|
||||
}
|
||||
Util.HandleLink = function (e) {
|
||||
Search($(e.target).text());
|
||||
Settings.SaveResults();
|
||||
};
|
||||
Util.HandleHiddenLink = function (e) {
|
||||
Search($(e.target).find(".searchvalue").text());
|
||||
Settings.SaveResults();
|
||||
};
|
||||
Util.RemoveResult = function (e) {
|
||||
var ref = $(e.target).parent().parent().children(".resultbody").children("h2").children("a").text();
|
||||
delete CurrentReferences[ref.trim().toLowerCase()];
|
||||
$(e.target).parent().parent().remove();
|
||||
Settings.SaveResults();
|
||||
};
|
||||
Util.HandleError = function (e) {
|
||||
var self = this;
|
||||
// for now we're going to put the error in the main result div.
|
||||
var t = $("<div class='strongsdef result'><a href='javascript:void(0)' class='removeresult' style='border: 0;'><img style='border: 0px;' src='images/delete.png' width='48' height='48' /></a><span class='resultbody'>" + e + "</span><br clear='all' /></div>");
|
||||
$("#result").prepend(t);
|
||||
t.find(".removeresult").click(function (e) {
|
||||
self.RemoveResult(e);
|
||||
});
|
||||
return false;
|
||||
};
|
||||
Util.GetUrlVars = function () {
|
||||
// Read a page's GET URL variables and return them as an associative array.
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for (var i = 0; i < hashes.length; i++) {
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(hash[0]);
|
||||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
return vars;
|
||||
};
|
||||
return Util;
|
||||
}());
|
||||
;
|
||||
//# sourceMappingURL=Util.js.map
|
1
DynamicBibleUtility/DynamicBibleApp/js/Util.js.map
Normal file
1
DynamicBibleUtility/DynamicBibleApp/js/Util.js.map
Normal file
@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Ae,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;YACrC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC;IAEa,eAAU,GAAxB;QACI,2EAA2E;QAC3E,IAAI,IAAI,GAAG,EAAE,EAAE,IAAI,CAAC;QACpB,IAAI,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1F,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IACL,WAAC;AAAD,CAAC,AAxCD,IAwCC;AAAA,CAAC"}
|
462
DynamicBibleUtility/DynamicBibleApp/js/Words.js
Normal file
462
DynamicBibleUtility/DynamicBibleApp/js/Words.js
Normal file
@ -0,0 +1,462 @@
|
||||
var IndexResult = (function () {
|
||||
function IndexResult() {
|
||||
}
|
||||
return IndexResult;
|
||||
}());
|
||||
var Words = (function () {
|
||||
function Words() {
|
||||
}
|
||||
Words.ConvertResultsToArray = function (r) {
|
||||
try {
|
||||
var results = new Array();
|
||||
$(r).each(function () {
|
||||
results.push([$(this).attr("b"), $(this).attr("ch"), $(this).attr("v")]);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Words.DisplayResults = function (results, q) {
|
||||
try {
|
||||
var txt = "<h4>Query: <a href='javascript:void(0)' class='link'>" + q + "</a></h4><ul>";
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var r = results[i].split(":");
|
||||
txt += "<li /><a href='javascript:void(0)' class='link' alt='" + Reference.bookName(r[0]) + " " + r[1] + ":" + r[2] + "'>" + Reference.bookName(r[0]) + " " + r[1] + ":" + r[2] + "</a>";
|
||||
}
|
||||
txt += "</ul>";
|
||||
var t = $(txt);
|
||||
Words.AttachEvents(t);
|
||||
$("#searchresults").html(t.html());
|
||||
$("#searchTotal").html(results.length);
|
||||
return false;
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Words.FindReferences = function (qry) {
|
||||
try {
|
||||
qry = qry.toLowerCase();
|
||||
var qs = qry.split(" ");
|
||||
var words = this.BuildIndexArray().sort();
|
||||
var results = new Array();
|
||||
// Loop through each query term.
|
||||
for (var i = 0; i < qs.length; i++) {
|
||||
var q = qs[i].replace("'", ""); // we don't included ticks in our words.
|
||||
// For each query term, figure out which xml file it is in, and get it.
|
||||
// getSearchRefs returns an array of references.
|
||||
for (var w = 0; w < words.length; w++) {
|
||||
// If we are at the end of the array, we want to use a different test.
|
||||
if (w == 0) {
|
||||
if (q <= words[w]) {
|
||||
results.unshift(this.GetSearchReferences("index/" + words[w] + "idx.json", q));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (q <= words[w] && q > words[w - 1]) {
|
||||
results.unshift(this.GetSearchReferences("index/" + words[w] + "idx.json", q));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // End of loop through query terms
|
||||
// Now we need to test results. If there is more than one item in the array, we need to find the set
|
||||
// that is shared by all of them. IF not, we can just return those refs.
|
||||
if (results.length == 1) {
|
||||
this.DisplayResults(results[0], qry);
|
||||
}
|
||||
else {
|
||||
var shared = this.FindSharedSet(results);
|
||||
if (shared == null) {
|
||||
shared = [];
|
||||
}
|
||||
this.DisplayResults(shared, qry);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Words.GetSearchReferences = function (url, query) {
|
||||
try {
|
||||
// getSearchRefs takes a url and uses ajax to retrieve the references and returns an array of references.
|
||||
var r_1;
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (d, t, x) {
|
||||
r_1 = d;
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
Util.HandleError(error);
|
||||
}
|
||||
});
|
||||
// find the right word
|
||||
var refs = $.grep(r_1, function (o, i) {
|
||||
return o.word == query;
|
||||
});
|
||||
if (refs.length > 0) {
|
||||
return refs[0].refs;
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
return [];
|
||||
};
|
||||
Words.BuildIndexArray = function () {
|
||||
var words = new Array();
|
||||
words.unshift('abiram');
|
||||
words.unshift('accepteth');
|
||||
words.unshift('acquit');
|
||||
words.unshift('adna');
|
||||
words.unshift('affecteth');
|
||||
words.unshift('aharhel');
|
||||
words.unshift('aijeleth');
|
||||
words.unshift('almug');
|
||||
words.unshift('amiable');
|
||||
words.unshift('ancients');
|
||||
words.unshift('anything');
|
||||
words.unshift('appointeth');
|
||||
words.unshift('areopagus');
|
||||
words.unshift('art');
|
||||
words.unshift('ashteroth');
|
||||
words.unshift('astaroth');
|
||||
words.unshift('availeth');
|
||||
words.unshift('azotus');
|
||||
words.unshift('badness');
|
||||
words.unshift('baptizing');
|
||||
words.unshift('bat');
|
||||
words.unshift('bechorath');
|
||||
words.unshift('beguile');
|
||||
words.unshift('bemoaning');
|
||||
words.unshift('beside');
|
||||
words.unshift('bezek');
|
||||
words.unshift('bitterly');
|
||||
words.unshift('bloodthirsty');
|
||||
words.unshift('bolted');
|
||||
words.unshift('bountifulness');
|
||||
words.unshift('breastplates');
|
||||
words.unshift('broth');
|
||||
words.unshift('bunni');
|
||||
words.unshift('cain');
|
||||
words.unshift('cankered');
|
||||
words.unshift('carry');
|
||||
words.unshift('celebrate');
|
||||
words.unshift('chapel');
|
||||
words.unshift('cheese');
|
||||
words.unshift('chilmad');
|
||||
words.unshift('circumcision');
|
||||
words.unshift('closer');
|
||||
words.unshift('come');
|
||||
words.unshift('communication');
|
||||
words.unshift('concerning');
|
||||
words.unshift('confusion');
|
||||
words.unshift('consummation');
|
||||
words.unshift('convince');
|
||||
words.unshift('couch');
|
||||
words.unshift('covers');
|
||||
words.unshift('crisping');
|
||||
words.unshift('curse');
|
||||
words.unshift('damnable');
|
||||
words.unshift('deacons');
|
||||
words.unshift('decision');
|
||||
words.unshift('defileth');
|
||||
words.unshift('depart');
|
||||
words.unshift('despisest');
|
||||
words.unshift('diblathaim');
|
||||
words.unshift('directly');
|
||||
words.unshift('dishonesty');
|
||||
words.unshift('distracted');
|
||||
words.unshift('dominion');
|
||||
words.unshift('dreamer');
|
||||
words.unshift('dulcimer');
|
||||
words.unshift('eastward');
|
||||
words.unshift('eighteenth');
|
||||
words.unshift('elihoreph');
|
||||
words.unshift('embrace');
|
||||
words.unshift('endeavored');
|
||||
words.unshift('ensign');
|
||||
words.unshift('ephraim');
|
||||
words.unshift('eshtemoa');
|
||||
words.unshift('evening');
|
||||
words.unshift('excellest');
|
||||
words.unshift('extended');
|
||||
words.unshift('fairer');
|
||||
words.unshift('fastings');
|
||||
words.unshift('feign');
|
||||
words.unshift('fight');
|
||||
words.unshift('fishermen');
|
||||
words.unshift('flint');
|
||||
words.unshift('foolishness');
|
||||
words.unshift('forever');
|
||||
words.unshift('forts');
|
||||
words.unshift('fresh');
|
||||
words.unshift('furnish');
|
||||
words.unshift('gallio');
|
||||
words.unshift('gebal');
|
||||
words.unshift('gezrites');
|
||||
words.unshift('girt');
|
||||
words.unshift('goath');
|
||||
words.unshift('government');
|
||||
words.unshift('greeteth');
|
||||
words.unshift('guiltless');
|
||||
words.unshift('haggai');
|
||||
words.unshift('hamstrung');
|
||||
words.unshift('happy');
|
||||
words.unshift('harum');
|
||||
words.unshift('hattush');
|
||||
words.unshift('heard');
|
||||
words.unshift('heir');
|
||||
words.unshift('herbs');
|
||||
words.unshift('hezronites');
|
||||
words.unshift('hivite');
|
||||
words.unshift('honored');
|
||||
words.unshift('hostages');
|
||||
words.unshift('huntest');
|
||||
words.unshift('idalah');
|
||||
words.unshift('impenitent');
|
||||
words.unshift('inferior');
|
||||
words.unshift('insomuch');
|
||||
words.unshift('ira');
|
||||
words.unshift('isuah');
|
||||
words.unshift('jabneh');
|
||||
words.unshift('japhia');
|
||||
words.unshift('jeduthun');
|
||||
words.unshift('jerahmeelites');
|
||||
words.unshift('jew');
|
||||
words.unshift('joined');
|
||||
words.unshift('joy');
|
||||
words.unshift('kadmonites');
|
||||
words.unshift('kid');
|
||||
words.unshift('kneaded');
|
||||
words.unshift('lack');
|
||||
words.unshift('languish');
|
||||
words.unshift('lazarus');
|
||||
words.unshift('legions');
|
||||
words.unshift('libnath');
|
||||
words.unshift('likhi');
|
||||
words.unshift('lock');
|
||||
words.unshift('louder');
|
||||
words.unshift('lysias');
|
||||
words.unshift('magpiash');
|
||||
words.unshift('malchus');
|
||||
words.unshift('marble');
|
||||
words.unshift('mastery');
|
||||
words.unshift('meddle');
|
||||
words.unshift('members');
|
||||
words.unshift('mesech');
|
||||
words.unshift('midian');
|
||||
words.unshift('ministered');
|
||||
words.unshift('mithnite');
|
||||
words.unshift('morasthite');
|
||||
words.unshift('mower');
|
||||
words.unshift('myrtle');
|
||||
words.unshift('naphish');
|
||||
words.unshift('necks');
|
||||
words.unshift('net');
|
||||
words.unshift('noadiah');
|
||||
words.unshift('nursed');
|
||||
words.unshift('occurrent');
|
||||
words.unshift('omnipotent');
|
||||
words.unshift('orchard');
|
||||
words.unshift('outside');
|
||||
words.unshift('owed');
|
||||
words.unshift('palti');
|
||||
words.unshift('partition');
|
||||
words.unshift('paulus');
|
||||
words.unshift('peoples');
|
||||
words.unshift('persecute');
|
||||
words.unshift('phares');
|
||||
words.unshift('pilate');
|
||||
words.unshift('plagues');
|
||||
words.unshift('plentiful');
|
||||
words.unshift('poorer');
|
||||
words.unshift('powerful');
|
||||
words.unshift('presented');
|
||||
words.unshift('prison');
|
||||
words.unshift('promoted');
|
||||
words.unshift('provision');
|
||||
words.unshift('purely');
|
||||
words.unshift('quarter');
|
||||
words.unshift('rahab');
|
||||
words.unshift('ravening');
|
||||
words.unshift('rebuking');
|
||||
words.unshift('refined');
|
||||
words.unshift('release');
|
||||
words.unshift('rent');
|
||||
words.unshift('requirest');
|
||||
words.unshift('return');
|
||||
words.unshift('rezon');
|
||||
words.unshift('riseth');
|
||||
words.unshift('roof');
|
||||
words.unshift('rump');
|
||||
words.unshift('sail');
|
||||
words.unshift('sanctuaries');
|
||||
words.unshift('savors');
|
||||
words.unshift('scorpions');
|
||||
words.unshift('second');
|
||||
words.unshift('sellers');
|
||||
words.unshift('served');
|
||||
words.unshift('shaft');
|
||||
words.unshift('sharaim');
|
||||
words.unshift('shedder');
|
||||
words.unshift('shepho');
|
||||
words.unshift('shimshai');
|
||||
words.unshift('shophan');
|
||||
words.unshift('shuppim');
|
||||
words.unshift('sihor');
|
||||
words.unshift('sippai');
|
||||
words.unshift('slandereth');
|
||||
words.unshift('smelling');
|
||||
words.unshift('softer');
|
||||
words.unshift('sores');
|
||||
words.unshift('sparrows');
|
||||
words.unshift('spoil');
|
||||
words.unshift('staff');
|
||||
words.unshift('steel');
|
||||
words.unshift('stool');
|
||||
words.unshift('stretched');
|
||||
words.unshift('stumblingblocks');
|
||||
words.unshift('suffice');
|
||||
words.unshift('surnamed');
|
||||
words.unshift('swore');
|
||||
words.unshift('take');
|
||||
words.unshift('task');
|
||||
words.unshift('temani');
|
||||
words.unshift('testator');
|
||||
words.unshift('thessalonica');
|
||||
words.unshift('threatening');
|
||||
words.unshift('tie');
|
||||
words.unshift('titus');
|
||||
words.unshift('torments');
|
||||
words.unshift('translation');
|
||||
words.unshift('tributaries');
|
||||
words.unshift('tubal');
|
||||
words.unshift('unchangeable');
|
||||
words.unshift('unlawful');
|
||||
words.unshift('upbraideth');
|
||||
words.unshift('uzza');
|
||||
words.unshift('verily');
|
||||
words.unshift('visage');
|
||||
words.unshift('walk');
|
||||
words.unshift('washing');
|
||||
words.unshift('wayside');
|
||||
words.unshift('wellspring');
|
||||
words.unshift('whisperer');
|
||||
words.unshift('win');
|
||||
words.unshift('withereth');
|
||||
words.unshift('work');
|
||||
words.unshift('wrest');
|
||||
words.unshift('yours');
|
||||
words.unshift('zealously');
|
||||
words.unshift('zetham');
|
||||
words.unshift('zophim');
|
||||
words.unshift('zuzims');
|
||||
return words;
|
||||
};
|
||||
Words.FindSharedSet = function (results) {
|
||||
try {
|
||||
// FindSharedSet takes an array of reference arrays, and figures out which references are shared
|
||||
// by all arrays/sets, then returns a single array of references.
|
||||
for (var j in results) {
|
||||
var refs = results[j];
|
||||
if (refs != null) {
|
||||
for (var i = 0; i < refs.length; i++) {
|
||||
var r = refs[i].split(":");
|
||||
// convert references to single integers.
|
||||
// Book * 100000, Chapter * 1000, Verse remains same, add all together.
|
||||
var ref = parseInt(r[0]) * 100000000;
|
||||
ref = ref + (parseInt(r[1]) * 10000);
|
||||
ref = ref + parseInt(r[2]);
|
||||
results[j][i] = ref;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// get the first result
|
||||
var result = results[0];
|
||||
// for each additional result, get the shared set
|
||||
for (i = 1; i < results.length; i++) {
|
||||
result = this.ReturnSharedSet(results[i], result);
|
||||
}
|
||||
// convert the references back into book, chapter and verse.
|
||||
for (i = 0; i < result.length; i++) {
|
||||
ref = result[i];
|
||||
result[i] = (ref / 100000000) + ":" + ((ref % 100000000) / 10000) + ":" + ((ref % 100000000) % 10000);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Words.ReturnSharedSet = function (x, y) {
|
||||
try {
|
||||
/// <summary>
|
||||
/// Takes two javascript arrays and returns an array
|
||||
/// containing a set of values shared by arrays.
|
||||
/// </summary>
|
||||
// declare iterator
|
||||
var i = 0;
|
||||
// declare terminator
|
||||
var t = (x.length < y.length) ? x.length : y.length;
|
||||
// sort the arrays
|
||||
x.sort(SortNumeric);
|
||||
y.sort(SortNumeric);
|
||||
// in this loop, we remove from the arrays, the
|
||||
// values that aren't shared between them.
|
||||
while (i < t) {
|
||||
if (x[i] == y[i]) {
|
||||
i++;
|
||||
}
|
||||
if (x[i] < y[i]) {
|
||||
x.splice(i, 1);
|
||||
}
|
||||
if (x[i] > y[i]) {
|
||||
y.splice(i, 1);
|
||||
}
|
||||
t = (x.length < y.length) ? x.length : y.length;
|
||||
// we have to make sure to remove any extra values
|
||||
// at the end of an array when we reach the end of
|
||||
// the other.
|
||||
if (t == i && t < x.length) {
|
||||
x.splice(i, x.length - i);
|
||||
}
|
||||
if (t == i && t < y.length) {
|
||||
y.splice(i, x.length - i);
|
||||
}
|
||||
}
|
||||
// we could return y, because at this time, both arrays
|
||||
// are identical.
|
||||
return x;
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Words.AttachEvents = function (t) {
|
||||
t.find(".link").click(function (e) {
|
||||
Util.HandleLink(e);
|
||||
});
|
||||
};
|
||||
return Words;
|
||||
}());
|
||||
;
|
||||
//# sourceMappingURL=Words.js.map
|
1
DynamicBibleUtility/DynamicBibleApp/js/Words.js.map
Normal file
1
DynamicBibleUtility/DynamicBibleApp/js/Words.js.map
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user