mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-26 17:10:11 -04:00
- added loading of ref via querystring
- ran build script to copy changes to android app
This commit is contained in:
parent
8570ca5b36
commit
2964af32cf
@ -11,70 +11,8 @@
|
|||||||
<meta name="keywords" content="AJAX, KJV, King James Version, Strong's Dictionary, Strongs" />
|
<meta name="keywords" content="AJAX, KJV, King James Version, Strong's Dictionary, Strongs" />
|
||||||
<meta name="copyright" content="All content copyrighted to Jason Wall, and available by permission of the owner." />
|
<meta name="copyright" content="All content copyrighted to Jason Wall, and available by permission of the owner." />
|
||||||
<title>The Bible with Strong's Numbers and Cross References</title>
|
<title>The Bible with Strong's Numbers and Cross References</title>
|
||||||
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
|
|
||||||
<script type="text/javascript" src="js/jquery.cookie.js"></script>
|
|
||||||
<script type="text/javascript" src="js/jquery-ui-1.9.1.custom.min.js"></script>
|
|
||||||
<script type="text/javascript" src="js/bible_ref_parsing.js"></script>
|
|
||||||
<script type="text/javascript" src="js/common.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function()
|
|
||||||
{
|
|
||||||
$("#searchform").submit(function()
|
|
||||||
{
|
|
||||||
Search($("#searchvalue").val());
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$("#growfont").click(function()
|
|
||||||
{
|
|
||||||
Settings.IncreaseResultFontSize();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$("#shrinkfont").click(function()
|
|
||||||
{
|
|
||||||
Settings.DecreaseResultFontSize();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$("#switch-panes").click(function()
|
|
||||||
{
|
|
||||||
Settings.SwitchPanes();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$("#showhelp").click(function()
|
|
||||||
{
|
|
||||||
$("#help").dialog({draggable:true, width: 700, height: 650, resizable: true});
|
|
||||||
});
|
|
||||||
$("#showhidesearch").click(function()
|
|
||||||
{
|
|
||||||
Settings.ShowHideSearch();
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$("#changefont").change(function()
|
|
||||||
{
|
|
||||||
Settings.ChangeResultFont($("#changefont").val());
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$("#display-strongs-as-dialog").change(function()
|
|
||||||
{
|
|
||||||
Settings.ChangeDisplayStrongsInDialog($("#display-strongs-as-dialog")[0].checked);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$(window).bind("resize", function()
|
|
||||||
{
|
|
||||||
$("#searchresults").css("height", window.innerHeight - 200);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#searchresults").css("height", window.innerHeight - 200);
|
|
||||||
|
|
||||||
|
|
||||||
// remember the settings...
|
|
||||||
Settings.Load();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style>@import "css/bible.css";@import "css/jquery-ui.css";</style>
|
<style>@import "css/bible.css";@import "css/jquery-ui.css";</style>
|
||||||
<style>
|
<script data-main="js/main" type="text/javascript" src="js/require-jquery.js"></script>
|
||||||
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<table style="width: 100%; padding: 12px;">
|
<table style="width: 100%; padding: 12px;">
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
define(['jquery', 'reference', 'jquery.ui'],
|
||||||
|
function($, reference) {
|
||||||
function SortNumeric(x, y) {
|
function SortNumeric(x, y) {
|
||||||
return x - y;
|
return x - y;
|
||||||
}
|
}
|
||||||
@ -13,8 +15,42 @@ String.prototype.ltrim = function() {
|
|||||||
String.prototype.rtrim = function() {
|
String.prototype.rtrim = function() {
|
||||||
return this.replace(/\s+$/, "");
|
return this.replace(/\s+$/, "");
|
||||||
};
|
};
|
||||||
|
var Util = {
|
||||||
function Traverse(node, testament) {
|
HandleLink: function(e) {
|
||||||
|
Search($(e.target).text());
|
||||||
|
Settings.SaveResults();
|
||||||
|
},
|
||||||
|
HandleHiddenLink: function(e) {
|
||||||
|
Search($(e.target).find(".searchvalue").text());
|
||||||
|
Settings.SaveResults();
|
||||||
|
},
|
||||||
|
RemoveResult: function(e) {
|
||||||
|
$(e.target).parent().parent().remove();
|
||||||
|
Settings.SaveResults();
|
||||||
|
},
|
||||||
|
HandleError: function(e) {
|
||||||
|
// for now we're going to put the error in the main result div.
|
||||||
|
var t = $("<div class='strongsdef result'><a href='javascript:void();' 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) {
|
||||||
|
Util.RemoveResult(e);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var Traverse = function (node, testament) {
|
||||||
try {
|
try {
|
||||||
var treeText = "";
|
var treeText = "";
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
@ -52,9 +88,8 @@ function Traverse(node, testament) {
|
|||||||
Util.HandleError(err);
|
Util.HandleError(err);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
};
|
||||||
|
var Search = function (sv) {
|
||||||
function Search(sv) {
|
|
||||||
try {
|
try {
|
||||||
var qs = sv.split(";");
|
var qs = sv.split(";");
|
||||||
|
|
||||||
@ -93,8 +128,9 @@ function Search(sv) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// its a verse reference.
|
// its a verse reference.
|
||||||
|
var passage = "";
|
||||||
if (q.trim() != "") {
|
if (q.trim() != "") {
|
||||||
var myref = new Reference(q.trim());
|
var myref = reference.Parse(q.trim());
|
||||||
var r = Bible.GetPassage(myref.book, myref.startchapter, myref.endchapter, myref.startverse, myref.endverse);
|
var r = Bible.GetPassage(myref.book, myref.startchapter, myref.endchapter, myref.startverse, myref.endverse);
|
||||||
|
|
||||||
Bible.DisplayPassage(r.cs, myref, r.testament);
|
Bible.DisplayPassage(r.cs, myref, r.testament);
|
||||||
@ -113,32 +149,17 @@ function Search(sv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
var Settings = {
|
var Settings = {
|
||||||
Load: function() {
|
Load: function(skipresults) {
|
||||||
if(localStorage != null && typeof(Storage)!=="undefined")
|
if(typeof(Storage)!=="undefined") {
|
||||||
{
|
// sometimes we want to load the settings, but not the results previously in the window.
|
||||||
if (localStorage.Results !== "undefined" && localStorage.SearchResults !== "undefined") {
|
if (skipresults == "undefined" || skipresults == false) {
|
||||||
$("#resultwrap").html(localStorage.Results);
|
|
||||||
$("#searchresultswrap").html(localStorage.SearchResults);
|
|
||||||
$("#resultwrap").find(".hiddenlink").click(function(e) {
|
|
||||||
Util.HandleHiddenLink(e);
|
|
||||||
});
|
|
||||||
$("#resultwrap").find(".removeresult").click(function(e) {
|
|
||||||
Util.RemoveResult(e);
|
|
||||||
});
|
|
||||||
$("#searchresultswrap").find(".link").click(function(e) {
|
|
||||||
Util.HandleLink(e);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localStorage.Panes !== "undefined") {
|
if (localStorage.Panes !== "undefined") {
|
||||||
$("#resultwrap").css("float", localStorage.Panes);
|
$("#resultwrap").css("float", localStorage.Panes);
|
||||||
$("#searchresultswrap").css("float", localStorage.Panes);
|
$("#searchresultswrap").css("float", localStorage.Panes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (localStorage.Search !== "undefined" && localStorage.Search == "none") {
|
if (localStorage.Search !== "undefined" && localStorage.Search == "none") {
|
||||||
$("#searchresultswrap").css("display", "none");
|
$("#searchresultswrap").css("display", "none");
|
||||||
$("#showhidesearch").html("Show Search");
|
$("#showhidesearch").html("Show Search");
|
||||||
@ -162,10 +183,24 @@ var Settings = {
|
|||||||
} else {
|
} else {
|
||||||
$("#display-strongs-as-dialog")[0].checked = true;
|
$("#display-strongs-as-dialog")[0].checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (localStorage.Results !== "undefined" && localStorage.SearchResults !== "undefined") {
|
||||||
|
$("#resultwrap").html(localStorage.Results);
|
||||||
|
$("#searchresultswrap").html(localStorage.SearchResults);
|
||||||
|
$("#resultwrap").find(".hiddenlink").click(function(e) {
|
||||||
|
Util.HandleHiddenLink(e);
|
||||||
|
});
|
||||||
|
$("#resultwrap").find(".removeresult").click(function(e) {
|
||||||
|
Util.RemoveResult(e);
|
||||||
|
});
|
||||||
|
$("#searchresultswrap").find(".link").click(function(e) {
|
||||||
|
Util.HandleLink(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Save: function() {
|
Save: function() {
|
||||||
if(typeof(Storage)!=="undefined" && localStorage != null)
|
if(typeof(Storage)!=="undefined")
|
||||||
{
|
{
|
||||||
localStorage.Panes = $("#resultwrap").css("float");
|
localStorage.Panes = $("#resultwrap").css("float");
|
||||||
localStorage.Search = $("#searchresultswrap").css("display");
|
localStorage.Search = $("#searchresultswrap").css("display");
|
||||||
@ -183,7 +218,6 @@ var Settings = {
|
|||||||
s.css("display", "none");
|
s.css("display", "none");
|
||||||
o.html("Show Search");
|
o.html("Show Search");
|
||||||
r.css("width", "100%");
|
r.css("width", "100%");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
s.css("display", "block");
|
s.css("display", "block");
|
||||||
o.html("Hide Search");
|
o.html("Hide Search");
|
||||||
@ -218,43 +252,14 @@ var Settings = {
|
|||||||
$("#result").css("font-family", fontfamily);
|
$("#result").css("font-family", fontfamily);
|
||||||
this.Save();
|
this.Save();
|
||||||
},
|
},
|
||||||
ChangeDisplayStrongsInDialog: function() {
|
ChangeDisplayStrongsInDialog: function(fontfamily) {
|
||||||
this.Save();
|
this.Save();
|
||||||
},
|
},
|
||||||
SaveResults: function()
|
SaveResults: function() {
|
||||||
{
|
|
||||||
if(localStorage != null && typeof(Storage)!=="undefined")
|
|
||||||
{
|
|
||||||
localStorage.Results = $("#resultwrap").html();
|
localStorage.Results = $("#resultwrap").html();
|
||||||
localStorage.SearchResults = $("#searchresultswrap").html();
|
localStorage.SearchResults = $("#searchresultswrap").html();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var Util = {
|
|
||||||
HandleLink: function(e) {
|
|
||||||
Search($(e.target).text());
|
|
||||||
Settings.SaveResults();
|
|
||||||
},
|
|
||||||
HandleHiddenLink: function(e) {
|
|
||||||
Search($(e.target).find(".searchvalue").text());
|
|
||||||
Settings.SaveResults();
|
|
||||||
},
|
|
||||||
RemoveResult: function(e) {
|
|
||||||
$(e.target).parent().parent().remove();
|
|
||||||
Settings.SaveResults();
|
|
||||||
},
|
|
||||||
HandleError: function(e) {
|
|
||||||
// for now we're going to put the error in the main result div.
|
|
||||||
var t = $("<div class='strongsdef result'><a href='javascript:void();' 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) {
|
|
||||||
Util.RemoveResult(e);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var Bible = {
|
var Bible = {
|
||||||
DisplayPassage: function(cs, ref, testament) {
|
DisplayPassage: function(cs, ref, testament) {
|
||||||
try {
|
try {
|
||||||
@ -379,7 +384,6 @@ var Bible = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var Strongs = {
|
var Strongs = {
|
||||||
GetStrongs: function(sn, dict) {
|
GetStrongs: function(sn, dict) {
|
||||||
try {
|
try {
|
||||||
@ -480,7 +484,7 @@ var Strongs = {
|
|||||||
|
|
||||||
$(this).find("r").each(function(j) {
|
$(this).find("r").each(function(j) {
|
||||||
var ref = $(this).attr("r").split(";");
|
var ref = $(this).attr("r").split(";");
|
||||||
crtxt += "<a href='javascript:void();' class='link'>" + bookName(ref[0]) + " " + ref[1] + ":" + ref[2] + "</a>, ";
|
crtxt += "<a href='javascript:void();' class='link'>" + reference.bookName(ref[0]) + " " + ref[1] + ":" + ref[2] + "</a>, ";
|
||||||
});
|
});
|
||||||
crtxt = crtxt.substr(0, crtxt.length - 2);
|
crtxt = crtxt.substr(0, crtxt.length - 2);
|
||||||
crtxt += "<br />";
|
crtxt += "<br />";
|
||||||
@ -534,18 +538,18 @@ var Strongs = {
|
|||||||
try {
|
try {
|
||||||
var t = Strongs.BuildStrongs(r);
|
var t = Strongs.BuildStrongs(r);
|
||||||
var d = $("<div></div>").append(t);
|
var d = $("<div></div>").append(t);
|
||||||
|
|
||||||
d.dialog({
|
d.dialog({
|
||||||
draggable:true,
|
draggable:true,
|
||||||
width: 600,
|
width: 600,
|
||||||
height: 500,
|
height: 500,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
title: "Strongs Definition",
|
title: "Strongs Definition"
|
||||||
buttons: {
|
// TODO(walljm): Figure out why this break stuff.
|
||||||
"Close": function() {
|
//buttons: {
|
||||||
$( this ).dialog( "close" );
|
// "Close": function() {
|
||||||
}
|
// $( this ).dialog( "close" );
|
||||||
}
|
// }
|
||||||
|
//}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -565,8 +569,7 @@ var Strongs = {
|
|||||||
o.html("Hide");
|
o.html("Hide");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
var Words = {
|
var Words = {
|
||||||
ConvertResultsToArray: function(r) {
|
ConvertResultsToArray: function(r) {
|
||||||
try {
|
try {
|
||||||
@ -585,7 +588,7 @@ var Words = {
|
|||||||
var txt = "<h4>Query: <a href='javascript:void();' class='link'>" + q + "</a></h4><ul>";
|
var txt = "<h4>Query: <a href='javascript:void();' class='link'>" + q + "</a></h4><ul>";
|
||||||
for (var i = 0; i < results.length; i++) {
|
for (var i = 0; i < results.length; i++) {
|
||||||
var r = results[i].split(":");
|
var r = results[i].split(":");
|
||||||
txt += "<li /><a href='javascript:void();' class='link' alt='" + bookName(r[0]) + " " + r[1] + ":" + r[2] + "'>" + bookName(r[0]) + " " + r[1] + ":" + r[2] + "</a>";
|
txt += "<li /><a href='javascript:void();' class='link' alt='" + reference.bookName(r[0]) + " " + r[1] + ":" + r[2] + "'>" + reference.bookName(r[0]) + " " + r[1] + ":" + r[2] + "</a>";
|
||||||
}
|
}
|
||||||
txt += "</ul>";
|
txt += "</ul>";
|
||||||
|
|
||||||
@ -982,17 +985,13 @@ var Words = {
|
|||||||
/// Takes two javascript arrays and returns an array
|
/// Takes two javascript arrays and returns an array
|
||||||
/// containing a set of values shared by arrays.
|
/// containing a set of values shared by arrays.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
// declare iterator
|
// declare iterator
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
// declare terminator
|
// declare terminator
|
||||||
var t = (x.length < y.length) ? x.length : y.length;
|
var t = (x.length < y.length) ? x.length : y.length;
|
||||||
|
|
||||||
// sort the arrays
|
// sort the arrays
|
||||||
x.sort(SortNumeric);
|
x.sort(SortNumeric);
|
||||||
y.sort(SortNumeric);
|
y.sort(SortNumeric);
|
||||||
|
|
||||||
// in this loop, we remove from the arrays, the
|
// in this loop, we remove from the arrays, the
|
||||||
// values that aren't shared between them.
|
// values that aren't shared between them.
|
||||||
while (i < t) {
|
while (i < t) {
|
||||||
@ -1006,7 +1005,6 @@ var Words = {
|
|||||||
y.splice(i, 1);
|
y.splice(i, 1);
|
||||||
}
|
}
|
||||||
t = (x.length < y.length) ? x.length : y.length;
|
t = (x.length < y.length) ? x.length : y.length;
|
||||||
|
|
||||||
// we have to make sure to remove any extra values
|
// we have to make sure to remove any extra values
|
||||||
// at the end of an array when we reach the end of
|
// at the end of an array when we reach the end of
|
||||||
// the other.
|
// the other.
|
||||||
@ -1026,3 +1024,14 @@ var Words = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
return {
|
||||||
|
Traverse: Traverse,
|
||||||
|
Search: Search,
|
||||||
|
Settings: Settings,
|
||||||
|
Util: Util,
|
||||||
|
Bible: Bible,
|
||||||
|
Strongs: Strongs,
|
||||||
|
Words: Words
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
132
Android/DynamicBible/assets/js/db.js
Normal file
132
Android/DynamicBible/assets/js/db.js
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
// js/db implements a basic wrapper for IndexedDB databases.
|
||||||
|
// See http://www.w3.org/TR/IndexedDB/ for more details about the
|
||||||
|
// IDB* interfaces referenced below.
|
||||||
|
define(
|
||||||
|
'db', {
|
||||||
|
// Construct db wrapper.
|
||||||
|
// If debug is true then logging will be turned on.
|
||||||
|
Init: function(debug) {
|
||||||
|
var self = {
|
||||||
|
version: 1,
|
||||||
|
dbName: "localdata",
|
||||||
|
stores: ['settings', 'verselists'],
|
||||||
|
debug: false,
|
||||||
|
// Internal method not for external use.
|
||||||
|
handleError: function(e) {
|
||||||
|
this.debug && console.log("Error: ", e);
|
||||||
|
},
|
||||||
|
// Internal method not for external use.
|
||||||
|
handleUpdate: function(e) {
|
||||||
|
var db = e.target.result;
|
||||||
|
e.target.transaction.onerror = this.handleError;
|
||||||
|
for (i in this.stores) {
|
||||||
|
if (db.objectStoreNames.contains(this.stores[i])) {
|
||||||
|
// TODO(jwall): handle this more gracefully?
|
||||||
|
db.deleteObjectStore(this.stores[i]);
|
||||||
|
}
|
||||||
|
var store = db.createObjectStore(this.stores[i],
|
||||||
|
{keyPath: "key"});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Do operations on an open database.
|
||||||
|
// ops is expected to be a function taking an IDBDatabase object
|
||||||
|
// as a parameter.
|
||||||
|
Session: function(ops) {
|
||||||
|
var self = this;
|
||||||
|
var req = indexedDB.open(this.dbname, this.version);
|
||||||
|
// HandleUpgrades
|
||||||
|
req.onupgradeneeded = function(e) {
|
||||||
|
self.handleUpdate(e);
|
||||||
|
};
|
||||||
|
req.onsuccess = function(e) {
|
||||||
|
ops(e.target.result);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// Do operations on an open transaction scoped to the list of stores.
|
||||||
|
// ops is expected to be a function taking an IDBTransation object
|
||||||
|
// as a parameter.
|
||||||
|
// type is an optional transaction type. values should be one of the
|
||||||
|
// following: readonly or readwrite
|
||||||
|
Transaction: function(stores, ops, type) {
|
||||||
|
var self = this;
|
||||||
|
var transType = type || "readonly";
|
||||||
|
self.debug && console.log(
|
||||||
|
"running", transType, "transaction on stores",
|
||||||
|
stores);
|
||||||
|
self.Session(
|
||||||
|
function(db) {
|
||||||
|
// Figure this api out.
|
||||||
|
var trans = db.transaction(stores, transType);
|
||||||
|
ops(trans);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// Get a key from the the object store.
|
||||||
|
// success is expected to be a function taking an IDBRequest object
|
||||||
|
// as a parameter.
|
||||||
|
// error is optional and expected to be a function taking an IDBRequest
|
||||||
|
// object as a parameter.
|
||||||
|
Get: function(storeName, key, success, error) {
|
||||||
|
var self = this;
|
||||||
|
self.Transaction(
|
||||||
|
[storeName], function(trans) {
|
||||||
|
var store = trans.objectStore(storeName);
|
||||||
|
var req = store.get(key);
|
||||||
|
req.onsuccess = success;
|
||||||
|
req.onerror = error || self.handleError;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// Store or update a key with data in an object store.
|
||||||
|
// success is expected to be a function taking an IDBRequest object
|
||||||
|
// as a parameter.
|
||||||
|
// error is optional and expected to be a function taking an IDBRequest
|
||||||
|
// object as a parameter.
|
||||||
|
Update: function(storeName, key, data, success, error) {
|
||||||
|
var self = this;
|
||||||
|
self.Transaction(
|
||||||
|
[storeName], function(trans) {
|
||||||
|
var store = trans.objectStore(storeName);
|
||||||
|
var req = store.put({"key": key, "data": data});
|
||||||
|
req.onsuccess = success;
|
||||||
|
req.onerror = error || self.handleError;
|
||||||
|
}, "readwrite");
|
||||||
|
},
|
||||||
|
// Delete a key from an object store.
|
||||||
|
// success is expected to be a function taking an IDBRequest object
|
||||||
|
// as a parameter.
|
||||||
|
// error is optional and expected to be a function taking an IDBRequest
|
||||||
|
// object as a parameter.
|
||||||
|
Delete: function(storeName, key, success, error) {
|
||||||
|
var self = this;
|
||||||
|
self.Transaction(
|
||||||
|
[storeName], function(trans) {
|
||||||
|
var store = trans.objectStore(storeName);
|
||||||
|
var req = store.delete(key);
|
||||||
|
req.onsuccess = success;
|
||||||
|
req.onerror = error || self.handleError;
|
||||||
|
}, "readwrite");
|
||||||
|
},
|
||||||
|
// Query a range of values from an object store.
|
||||||
|
// range is expected to be an IDBKeyRange.
|
||||||
|
// success is expected to be a function taking an IDBRequest object
|
||||||
|
// as a parameter.
|
||||||
|
// error is optional and expected to be a function taking an IDBRequest
|
||||||
|
// object as a parameter.
|
||||||
|
Query: function(storeName, range, success, error) {
|
||||||
|
var self = this;
|
||||||
|
self.Transaction(
|
||||||
|
[storeName], function(trans) {
|
||||||
|
var store = trans.objectStore(storeName);
|
||||||
|
var req = store.openCursor(range);
|
||||||
|
req.onsuccess = success;
|
||||||
|
req.onerror = error || self.handleError;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.debug = debug;
|
||||||
|
self.Session(
|
||||||
|
function(e) {
|
||||||
|
self.debug && console.log("Database Init complete");
|
||||||
|
});
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
});
|
6
Android/DynamicBible/assets/js/jquery.ui.js
Normal file
6
Android/DynamicBible/assets/js/jquery.ui.js
Normal file
File diff suppressed because one or more lines are too long
73
Android/DynamicBible/assets/js/main.js
Normal file
73
Android/DynamicBible/assets/js/main.js
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui"],
|
||||||
|
function($, db, common, ref) {
|
||||||
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
$("#searchform").submit(function()
|
||||||
|
{
|
||||||
|
common.Search($("#searchvalue").val());
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#growfont").click(function()
|
||||||
|
{
|
||||||
|
common.Settings.IncreaseResultFontSize();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#shrinkfont").click(function()
|
||||||
|
{
|
||||||
|
common.Settings.DecreaseResultFontSize();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#switch-panes").click(function()
|
||||||
|
{
|
||||||
|
common.Settings.SwitchPanes();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#showhelp").click(function()
|
||||||
|
{
|
||||||
|
$("#help").dialog({
|
||||||
|
draggable:true,
|
||||||
|
width: 700,
|
||||||
|
height: 650,
|
||||||
|
resizable: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#showhidesearch").click(function()
|
||||||
|
{
|
||||||
|
common.Settings.ShowHideSearch();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$("#changefont").change(function()
|
||||||
|
{
|
||||||
|
common.Settings.ChangeResultFont($("#changefont").val());
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$(window).bind("resize", function()
|
||||||
|
{
|
||||||
|
$("#searchresults").css("height", window.innerHeight - 200);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#searchresults").css("height", window.innerHeight - 200);
|
||||||
|
|
||||||
|
$("#result").sortable({
|
||||||
|
handle: ".p-handle"
|
||||||
|
});
|
||||||
|
|
||||||
|
// load querystring
|
||||||
|
var ref = decodeURIComponent(common.Util.GetUrlVars().r);
|
||||||
|
if (ref !== "undefined") {
|
||||||
|
// remember the settings, first, because if you have results, the load process would wipe out the passage you want to load.
|
||||||
|
common.Settings.Load();
|
||||||
|
|
||||||
|
// now load the passage from the querystring.
|
||||||
|
common.Search(ref);
|
||||||
|
$("#searchvalue").val(ref);
|
||||||
|
} else {
|
||||||
|
common.Settings.Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
666
Android/DynamicBible/assets/js/reference.js
Normal file
666
Android/DynamicBible/assets/js/reference.js
Normal file
@ -0,0 +1,666 @@
|
|||||||
|
// This code was written by Jeremy and Jason Wall.
|
||||||
|
// Feel free to use, and if you can, include a link back to www.walljm.com
|
||||||
|
// Jason@walljm.com // www.walljm.com
|
||||||
|
// Jeremy@marzhillstudios.com // jeremy.marzhillstudios.com
|
||||||
|
|
||||||
|
define("reference",
|
||||||
|
function() {
|
||||||
|
String.prototype.trim = function() {
|
||||||
|
return this.replace(/^\s+|\s+$/g, "");
|
||||||
|
};
|
||||||
|
|
||||||
|
String.prototype.ltrim = function() {
|
||||||
|
return this.replace(/^\s+/, "");
|
||||||
|
};
|
||||||
|
|
||||||
|
String.prototype.rtrim = function() {
|
||||||
|
return this.replace(/\s+$/, "");
|
||||||
|
};
|
||||||
|
|
||||||
|
function parseReference(ref, r) {
|
||||||
|
var rest = parseBook(ref, r.start, r);
|
||||||
|
rest = parseFirstNum(rest, r.start, r);
|
||||||
|
rest = maybeParseSecondNum(rest, r.start, r);
|
||||||
|
rest = maybeParseRangeSep(rest, r, r);
|
||||||
|
rest = maybeParseBook(rest, r.end, r);
|
||||||
|
rest = maybeParseFirstNumOrVerse(rest, r.end, r);
|
||||||
|
rest = maybeParseSecondNum(rest, r.end, r);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseBook(ref, data, errAcc) {
|
||||||
|
ref = ref.toLowerCase().trim();
|
||||||
|
var fbook = ref.substring(0, ref.search(/\w\s+\d/i)+1);
|
||||||
|
var rest = ref.slice(ref.search(/\w\s+\d/i)+1);
|
||||||
|
|
||||||
|
if (fbook.search(/\b(genesis|gen|ge|gn)\b/i) != -1) {
|
||||||
|
data.book = 1;
|
||||||
|
data.bookname = "Genesis";
|
||||||
|
data.longbookname = "Genesis";
|
||||||
|
data.lastchapter = 50;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(exodus|ex|exo|exod|exd)\b/i) != -1) {
|
||||||
|
data.book = 2;
|
||||||
|
data.bookname = "Exodus";
|
||||||
|
data.longbookname = "Exodus";
|
||||||
|
data.lastchapter = 40;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(leviticus|lev|le|levi|lv)\b/i) != -1) {
|
||||||
|
data.book = 3;
|
||||||
|
data.bookname = "Leviticus";
|
||||||
|
data.longbookname = "Leviticus";
|
||||||
|
data.lastchapter = 27;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(numbers|num|nu|numb|number)\b/i) != -1) {
|
||||||
|
data.book = 4;
|
||||||
|
data.bookname = "Numbers";
|
||||||
|
data.longbookname = "Book_of_Numbers";
|
||||||
|
data.lastchapter = 36;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(deuteronomy|deut|de|dt|deu)\b/i) != -1)
|
||||||
|
{
|
||||||
|
data.book = 5;
|
||||||
|
data.bookname = "Deuteronomy";
|
||||||
|
data.longbookname = "Deuteronomy";
|
||||||
|
data.lastchapter = 34;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(joshua|josh|jos)\b/i) != -1) {
|
||||||
|
data.book = 6;
|
||||||
|
data.bookname = "Joshua";
|
||||||
|
data.longbookname = "Book_of_Joshua";
|
||||||
|
data.lastchapter = 24;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(judges|jud|ju|jdg|judg)\b/i) != -1)
|
||||||
|
{
|
||||||
|
data.book = 7;
|
||||||
|
data.bookname = "Judges";
|
||||||
|
data.longbookname = "Book_of_Judges";
|
||||||
|
data.lastchapter = 21;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(ruth|ru)\b/i) != -1) {
|
||||||
|
data.book = 8;
|
||||||
|
data.bookname = "Ruth";
|
||||||
|
data.longbookname = "Book_of_Ruth";
|
||||||
|
data.lastchapter = 4;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(samuel|sa|sam|sml)\b/i) != -1)
|
||||||
|
{
|
||||||
|
data.book = 9;
|
||||||
|
data.bookname = "1 Samuel";
|
||||||
|
data.longbookname = "First_Samuel";
|
||||||
|
data.lastchapter = 31;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(samuel|sa|sam|sml)\b/i) != -1) {
|
||||||
|
data.book = 10;
|
||||||
|
data.bookname = "2 Samuel";
|
||||||
|
data.longbookname = "Second_Samuel";
|
||||||
|
data.lastchapter = 24;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(kings|king|kgs|kn|k|ki)\b/i) != -1)
|
||||||
|
{
|
||||||
|
data.book = 11;
|
||||||
|
data.bookname = "1 Kings";
|
||||||
|
data.longbookname = "First_Kings";
|
||||||
|
data.lastchapter = 22;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(kings|king|kgs|kn|k|ki)\b/i) != -1) {
|
||||||
|
data.book = 12;
|
||||||
|
data.bookname = "2 Kings";
|
||||||
|
data.longbookname = "Second_Kings";
|
||||||
|
data.lastchapter = 25;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(chronicles|chron|ch|chr)\b/i) != -1)
|
||||||
|
{
|
||||||
|
data.book = 13;
|
||||||
|
data.bookname = "1 Chronicles";
|
||||||
|
data.longbookname = "First_Chronicles";
|
||||||
|
data.lastchapter = 29;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(chronicles|chron|ch|chr)\b/i) != -1) {
|
||||||
|
data.book = 14;
|
||||||
|
data.bookname = "2 Chronicles";
|
||||||
|
data.longbookname = "Second_Chronicles";
|
||||||
|
data.lastchapter = 36;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(ezra|ez|ezr)\b/i) != -1)
|
||||||
|
{
|
||||||
|
data.book = 15;
|
||||||
|
data.bookname = "Ezra";
|
||||||
|
data.longbookname = "Book_of_Ezra";
|
||||||
|
data.lastchapter = 10;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(nehemiah|neh|ne|nehamiah)\b/i) != -1) {
|
||||||
|
data.book = 16;
|
||||||
|
data.bookname = "Nehemiah";
|
||||||
|
data.longbookname = "Book_of_Nehemiah";
|
||||||
|
data.lastchapter = 13;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(esther|est|es|esth)\b/i) != -1) {
|
||||||
|
data.book = 17;
|
||||||
|
data.bookname = "Esther";
|
||||||
|
data.longbookname = "Book_of_Esther";
|
||||||
|
data.lastchapter = 10;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(job|jo|jb)\b/i) != -1) {
|
||||||
|
data.book = 18;
|
||||||
|
data.bookname = "Job";
|
||||||
|
data.longbookname = "Book_of_Job";
|
||||||
|
data.lastchapter = 42;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(psalms|ps|psa|psalm|psm)\b/i) != -1) {
|
||||||
|
data.book = 19;
|
||||||
|
data.bookname = "Psalm";
|
||||||
|
data.longbookname = "Psalm";
|
||||||
|
data.lastchapter = 150;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(proverbs|prov|pr|pro|proverb|prv|prvbs)\b/i) != -1) {
|
||||||
|
data.book = 20;
|
||||||
|
data.bookname = "Proverbs";
|
||||||
|
data.longbookname = "Book_of_Proverbs";
|
||||||
|
data.lastchapter = 31;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(ecclesiastes|eccl|ecc|eccles|ec|ecl|ecclesiaste)\b/i) != -1) {
|
||||||
|
data.book = 21;
|
||||||
|
data.bookname = "Ecclesiastes";
|
||||||
|
data.longbookname = "Ecclesiastes";
|
||||||
|
data.lastchapter = 12;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(song\sof\ssolomon|song\sof\ssongs|sos|ss|son|so|song|songs)\b/i) != -1) {
|
||||||
|
data.book = 22;
|
||||||
|
data.bookname = "Song of Solomon";
|
||||||
|
data.longbookname = "Song_of_Solomon";
|
||||||
|
data.lastchapter = 8;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(isaiah|is|is|isah|isai|ia)\b/i) != -1) {
|
||||||
|
data.book = 23;
|
||||||
|
data.bookname = "Isaiah";
|
||||||
|
data.longbookname = "Book_of_Isaiah";
|
||||||
|
data.lastchapter = 66;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(jerimiah|jeremiah|jer|je|jere)\b/i) != -1) {
|
||||||
|
data.book = 24;
|
||||||
|
data.bookname = "Jeremiah";
|
||||||
|
data.longbookname = "Book_of_Jeremiah";
|
||||||
|
data.lastchapter = 52;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(lamentations|lam|la|lamentation)\b/i) != -1) {
|
||||||
|
data.book = 25;
|
||||||
|
data.bookname = "Lamentations";
|
||||||
|
data.longbookname = "Book_of_Lamentations";
|
||||||
|
data.lastchapter = 5;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(ezekiel|eze|ez|ezk|ezek)\b/i) != -1) {
|
||||||
|
data.book = 26;
|
||||||
|
data.bookname = "Ezekiel";
|
||||||
|
data.longbookname = "Book_of_Ezekiel";
|
||||||
|
data.lastchapter = 48;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(daniel|dan|dn|dl|da)\b/i) != -1) {
|
||||||
|
data.book = 27;
|
||||||
|
data.bookname = "Daniel";
|
||||||
|
data.longbookname = "Book_of_Daniel";
|
||||||
|
data.lastchapter = 12;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(hosea|hos|ho)\b/i) != -1) {
|
||||||
|
data.book = 28;
|
||||||
|
data.bookname = "Hosea";
|
||||||
|
data.longbookname = "Book_of_Hosea";
|
||||||
|
data.lastchapter = 14;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(joel|joe|jl)\b/i) != -1) {
|
||||||
|
data.book = 29;
|
||||||
|
data.bookname = "Joel";
|
||||||
|
data.longbookname = "Book_of_Joel";
|
||||||
|
data.lastchapter = 3;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(amos|am|amo)\b/i) != -1) {
|
||||||
|
data.book = 30;
|
||||||
|
data.bookname = "Amos";
|
||||||
|
data.longbookname = "Book_of_Amos";
|
||||||
|
data.lastchapter = 9;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(obadiah|oba|ob|obad)\b/i) != -1) {
|
||||||
|
data.book = 31;
|
||||||
|
data.bookname = "Obadiah";
|
||||||
|
data.longbookname = "Book_of_Obadiah";
|
||||||
|
data.lastchapter = 1;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(jonah|jnh|jon)\b/i) != -1) {
|
||||||
|
data.book = 32;
|
||||||
|
data.bookname = "Jonah";
|
||||||
|
data.longbookname = "Book_of_Jonah";
|
||||||
|
data.lastchapter = 4;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(micah|mic|mi)\b/i) != -1) {
|
||||||
|
data.book = 33;
|
||||||
|
data.bookname = "Micah";
|
||||||
|
data.longbookname = "Book_of_Micah";
|
||||||
|
data.lastchapter = 7;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(nahum|nah|na)\b/i) != -1) {
|
||||||
|
data.book = 34;
|
||||||
|
data.bookname = "Nahum";
|
||||||
|
data.longbookname = "Book_of_Nahum";
|
||||||
|
data.lastchapter = 3;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(habakkuk|hab|ha|habakuk)\b/i) != -1) {
|
||||||
|
data.book = 35;
|
||||||
|
data.bookname = "Habakkuk";
|
||||||
|
data.longbookname = "Book_of_Habakkuk";
|
||||||
|
data.lastchapter = 3;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(zephaniah|zeph|zep)\b/i) != -1) {
|
||||||
|
data.book = 36;
|
||||||
|
data.bookname = "Zephaniah";
|
||||||
|
data.longbookname = "Book_of_Zephaniah";
|
||||||
|
data.lastchapter = 3;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(haggia|hag|hg|haggai)\b/i) != -1) {
|
||||||
|
data.book = 37;
|
||||||
|
data.bookname = "Haggai";
|
||||||
|
data.longbookname = "Book_of_Haggai";
|
||||||
|
data.lastchapter = 2;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(zechariah|zech|zch|zec)\b/i) != -1) {
|
||||||
|
data.book = 38;
|
||||||
|
data.bookname = "Zechariah";
|
||||||
|
data.longbookname = "Book_of_Zechariah";
|
||||||
|
data.lastchapter = 14;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(malachi|mal)\b/i) != -1) {
|
||||||
|
data.book = 39;
|
||||||
|
data.bookname = "Malachi";
|
||||||
|
data.longbookname = "Book_of_Malachi";
|
||||||
|
data.lastchapter = 4;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(matthew|mt|matt|mat)\b/i) != -1) {
|
||||||
|
data.book = 40;
|
||||||
|
data.bookname = "Matthew";
|
||||||
|
data.longbookname = "Gospel_of_Matthew";
|
||||||
|
data.lastchapter = 28;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(mark|mrk|mk|mr)\b/i) != -1) {
|
||||||
|
data.book = 41;
|
||||||
|
data.bookname = "Mark";
|
||||||
|
data.longbookname = "Gospel_of_Mark";
|
||||||
|
data.lastchapter = 16;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(luke|lu|lke|luk|lk)\b/i) != -1) {
|
||||||
|
data.book = 42;
|
||||||
|
data.bookname = "Luke";
|
||||||
|
data.longbookname = "Gospel_of_Luke";
|
||||||
|
data.lastchapter = 24;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(john|jn|jhn)\b/i) != -1) {
|
||||||
|
data.book = 43;
|
||||||
|
data.bookname = "John";
|
||||||
|
data.longbookname = "Gospel_of_John";
|
||||||
|
data.lastchapter = 21;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(acts|ac|act)\b/i) != -1) {
|
||||||
|
data.book = 44;
|
||||||
|
data.bookname = "Acts";
|
||||||
|
data.longbookname = "Acts_of_the_Apostles";
|
||||||
|
data.lastchapter = 28;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(romans|rom|ro|rm|roman)\b/i) != -1) {
|
||||||
|
data.book = 45;
|
||||||
|
data.bookname = "Romans";
|
||||||
|
data.longbookname = "Epistle_to_the_Romans";
|
||||||
|
data.lastchapter = 16;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) != -1) {
|
||||||
|
data.book = 46;
|
||||||
|
data.bookname = "1 Corinthians";
|
||||||
|
data.longbookname = "First_Epistle_to_the_Corinthians";
|
||||||
|
data.lastchapter = 16;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(corinthian|cor|corinthians|corinth|corin|corth|corint)\b/i) != -1) {
|
||||||
|
data.book = 47;
|
||||||
|
data.bookname = "2 Corinthians";
|
||||||
|
data.longbookname = "Second_Epistle_to_the_Corinthians";
|
||||||
|
data.lastchapter = 13;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(galatians|galatian|galations|gal|ga|gala|galation|galat)\b/i) != -1) {
|
||||||
|
data.book = 48;
|
||||||
|
data.bookname = "Galatians";
|
||||||
|
data.longbookname = "Epistle_to_the_Galatians";
|
||||||
|
data.lastchapter = 6;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(ephesians|eph|ep|ephes|ephe|ephs)\b/i) != -1) {
|
||||||
|
data.book = 49;
|
||||||
|
data.bookname = "Ephesians";
|
||||||
|
data.longbookname = "Epistle_to_the_Ephesians";
|
||||||
|
data.lastchapter = 6;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(philippians|phi|phil|ph|philip)\b/i) != -1) {
|
||||||
|
data.book = 50;
|
||||||
|
data.bookname = "Philippians";
|
||||||
|
data.longbookname = "Epistle_to_the_Philippians";
|
||||||
|
data.lastchapter = 4;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(colossians|col|co|colossian|colos|coloss)\b/i) != -1) {
|
||||||
|
data.book = 51;
|
||||||
|
data.bookname = "Colossians";
|
||||||
|
data.longbookname = "Epistle_to_the_Colossians";
|
||||||
|
data.lastchapter = 4;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) != -1) {
|
||||||
|
data.book = 52;
|
||||||
|
data.bookname = "1 Thessalonians";
|
||||||
|
data.longbookname = "First_Epistle_to_the_Thessalonians";
|
||||||
|
data.lastchapter = 5;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(thessalonians|the|thessa|thessalonian|thes|thess|th)\b/i) != -1) {
|
||||||
|
data.book = 53;
|
||||||
|
data.bookname = "2 Thessalonians";
|
||||||
|
data.longbookname = "Second_Epistle_to_the_Thessalonians";
|
||||||
|
data.lastchapter = 3;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(timothy|tim|ti|timoth|tm)\b/i) != -1) {
|
||||||
|
data.book = 54;
|
||||||
|
data.bookname = "1 Timothy";
|
||||||
|
data.longbookname = "First_Epistle_to_Timothy";
|
||||||
|
data.lastchapter = 6;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(timothy|tim|timoth|tm)\b/i) != -1) {
|
||||||
|
data.book = 55;
|
||||||
|
data.bookname = "2 Timothy";
|
||||||
|
data.longbookname = "Second_Epistle_to_Timothy";
|
||||||
|
data.lastchapter = 4;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(titus|tit)\b/i) != -1) {
|
||||||
|
data.book = 56;
|
||||||
|
data.bookname = "Titus";
|
||||||
|
data.longbookname = "Epistle_to_Titus";
|
||||||
|
data.lastchapter = 3;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(philemon|phlmn|phl|phm|phile|philem)\b/i) != -1) {
|
||||||
|
data.book = 57;
|
||||||
|
data.bookname = "Philemon";
|
||||||
|
data.longbookname = "Epistle_to_Philemon";
|
||||||
|
data.lastchapter = 1;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(hebrews|heb|he|hebrew)\b/i) != -1) {
|
||||||
|
data.book = 58;
|
||||||
|
data.bookname = "Hebrews";
|
||||||
|
data.longbookname = "Epistle_to_the_Hebrews";
|
||||||
|
data.lastchapter = 13;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(james|jam|ja|jas|jms|jame|jm)\b/i) != -1) {
|
||||||
|
data.book = 59;
|
||||||
|
data.bookname = "James";
|
||||||
|
data.longbookname = "Epistle_of_James";
|
||||||
|
data.lastchapter = 5;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(peter|pe|pet|pete|pt|p)\b/i) != -1) {
|
||||||
|
data.book = 60;
|
||||||
|
data.bookname = "1 Peter";
|
||||||
|
data.longbookname = "First_Epistle_of_Peter";
|
||||||
|
data.lastchapter = 5;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(peter|pe|pet|pete|pt|p)\b/i) != -1) {
|
||||||
|
data.book = 61;
|
||||||
|
data.bookname = "2 Peter";
|
||||||
|
data.longbookname = "Second_Epistle_of_Peter";
|
||||||
|
data.lastchapter = 3;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(1|i|1st|first)\s*(john|jn|jo)\b/i) != -1) {
|
||||||
|
data.book = 62;
|
||||||
|
data.bookname = "1 John";
|
||||||
|
data.longbookname = "First_Epistle_of_John";
|
||||||
|
data.lastchapter = 5;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(2|ii|2nd|second|sec)\s*(john|jn|jo)\b/i) != -1) {
|
||||||
|
data.book = 63;
|
||||||
|
data.bookname = "2 John";
|
||||||
|
data.longbookname = "Second_Epistle_of_John";
|
||||||
|
data.lastchapter = 1;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(3|iii|3rd|third)\s*(john|jn|jo)\b/i) != -1) {
|
||||||
|
data.book = 64;
|
||||||
|
data.bookname = "3 John";
|
||||||
|
data.longbookname = "Third_Epistle_of_John";
|
||||||
|
data.lastchapter = 1;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(jude|jud|ju)\b/i) != -1) {
|
||||||
|
data.book = 65;
|
||||||
|
data.bookname = "Jude";
|
||||||
|
data.longbookname = "Epistle_of_Jude";
|
||||||
|
data.lastchapter = 1;
|
||||||
|
}
|
||||||
|
if (fbook.search(/\b(revelation|rev|re|revelations|rv)\b/i) != -1) {
|
||||||
|
data.book = 66;
|
||||||
|
data.bookname = "Revelation";
|
||||||
|
data.longbookname = "Book_of_Revelations";
|
||||||
|
data.lastchapter = 22;
|
||||||
|
}
|
||||||
|
return rest;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseFirstNum(ref, r, errAcc) {
|
||||||
|
ref = ref.ltrim();
|
||||||
|
var found = false;
|
||||||
|
for (var i = 0; i <= ref.length; i++) {
|
||||||
|
var c = ref.charAt(i);
|
||||||
|
// Grab characters until we hit a non digit.
|
||||||
|
if ("0".charAt(0) <= c && c <= "9".charAt(0)) {
|
||||||
|
found = true;
|
||||||
|
r.first = r.first.concat(c);
|
||||||
|
} else {
|
||||||
|
// if the chapter is longer than 3 digits it's an error
|
||||||
|
if (r.first.length > 3) {
|
||||||
|
errAcc.err = "Chapter too long\"" + r.first + "\".";
|
||||||
|
return "";
|
||||||
|
} else if (!found) {
|
||||||
|
errAcc.err = "No chapter found" + ref;
|
||||||
|
}
|
||||||
|
return ref.slice(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseSecondNum(ref, r, errAcc, skipColon) {
|
||||||
|
ref = ref.toLowerCase().ltrim();
|
||||||
|
if (!skipColon) {
|
||||||
|
if (ref[0] != ":") {
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
ref = ref.slice(1);
|
||||||
|
}
|
||||||
|
ref = ref.toLowerCase().ltrim();
|
||||||
|
if (ref[0] == '*') {
|
||||||
|
r.second = '*';
|
||||||
|
return ref.slice(1);
|
||||||
|
}
|
||||||
|
for (var i = 0; i <= ref.length; i++) {
|
||||||
|
var c = ref.charAt(i);
|
||||||
|
if ("0".charAt(0) <= c && c <= "9".charAt(0)) {
|
||||||
|
r.second = r.second.concat(c);
|
||||||
|
} else {
|
||||||
|
if (r.second.length > 3) {
|
||||||
|
errAcc.err = "Verse too long \"" + r.second + "\".";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return ref.slice(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeDo(ref, r, errAcc, f) {
|
||||||
|
ref = ref.toLowerCase().ltrim();
|
||||||
|
if (ref != "") {
|
||||||
|
return f(ref, r, errAcc);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeParseBook(ref, r, errAcc) {
|
||||||
|
return maybeDo(ref, r, errAcc, parseBook);
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeParseSecondNum(ref, r, errAcc, skipColon) {
|
||||||
|
return maybeDo(ref, r, errAcc, function (ref, r, errAcc) {
|
||||||
|
return parseSecondNum(ref, r, errAcc, skipColon);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeParseFirstNumOrVerse(ref, r, errAcc) {
|
||||||
|
return maybeDo(ref, r, errAcc, function(ref, r, errAcc) {
|
||||||
|
if (typeof r.book != -1) {
|
||||||
|
if (ref.search(/:/) != -1) {
|
||||||
|
ref = parseFirstNum(ref, r, errAcc);
|
||||||
|
}
|
||||||
|
return parseSecondNum(ref, r, errAcc, true);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeParseRangeSep(ref, r, errAcc) {
|
||||||
|
return maybeDo(ref.ltrim(), r, errAcc, function(ref, r, errAcc) {
|
||||||
|
if (ref[0] == "-") {
|
||||||
|
return ref.slice(1).ltrim();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function Reference(ref)
|
||||||
|
{
|
||||||
|
var r = {
|
||||||
|
start: {
|
||||||
|
first: '',
|
||||||
|
second: ''
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
first: '',
|
||||||
|
second: ''
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// First collect all our tokens so to speak
|
||||||
|
parseReference(ref.toLowerCase().trim(), r);
|
||||||
|
this.book = r.start.book;
|
||||||
|
this.bookname = r.start.bookname;
|
||||||
|
this.longbookname = r.start.longbookname;
|
||||||
|
this.startchapter = r.start.first;
|
||||||
|
this.endchapter = r.start.first;
|
||||||
|
this.startverse = '1';
|
||||||
|
|
||||||
|
// Then start our statemachine.
|
||||||
|
// Determine start verse
|
||||||
|
if (r.start.second != '') {
|
||||||
|
this.startverse = r.start.second;
|
||||||
|
this.endverse = '*';
|
||||||
|
}
|
||||||
|
// Determine possible end verse
|
||||||
|
if (r.end.second != '') {
|
||||||
|
this.endverse = r.end.second;
|
||||||
|
}
|
||||||
|
// Enforce some general data cleanliness
|
||||||
|
if (r.end.second != '*' && Number(r.end.second) < Number(r.start.second)) {
|
||||||
|
this.endverse = this.startverse;
|
||||||
|
}
|
||||||
|
// Determine end chapter and verse
|
||||||
|
if (r.end.first == '') {
|
||||||
|
if (r.start.second == '' || typeof r.end.book != 'undefined') {
|
||||||
|
this.endchapter = r.end.second || r.start.first;
|
||||||
|
this.endverse = '*';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.endchapter = r.end.first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bookName(booknum) {
|
||||||
|
var book = new Array();
|
||||||
|
book[0] = "";
|
||||||
|
book[1] = "Genesis";
|
||||||
|
book[2] = "Exodus";
|
||||||
|
book[3] = "Leviticus";
|
||||||
|
book[4] = "Numbers";
|
||||||
|
book[5] = "Deuteronomy";
|
||||||
|
book[6] = "Joshua";
|
||||||
|
book[7] = "Judges";
|
||||||
|
book[8] = "Ruth";
|
||||||
|
book[9] = "1 Samuel";
|
||||||
|
book[10] = "2 Samuel";
|
||||||
|
book[11] = "1 Kings";
|
||||||
|
book[12] = "2 Kings";
|
||||||
|
book[13] = "1 Chronicles";
|
||||||
|
book[14] = "2 Chronicles";
|
||||||
|
book[15] = "Ezra";
|
||||||
|
book[16] = "Nehemiah";
|
||||||
|
book[17] = "Esther";
|
||||||
|
book[18] = "Job";
|
||||||
|
book[19] = "Psalm";
|
||||||
|
book[20] = "Proverbs";
|
||||||
|
book[21] = "Ecclesiastes";
|
||||||
|
book[22] = "Song of Songs";
|
||||||
|
book[23] = "Isaiah";
|
||||||
|
book[24] = "Jeremiah";
|
||||||
|
book[25] = "Lamentations";
|
||||||
|
book[26] = "Ezekiel";
|
||||||
|
book[27] = "Daniel";
|
||||||
|
book[28] = "Hosea";
|
||||||
|
book[29] = "Joel";
|
||||||
|
book[30] = "Amos";
|
||||||
|
book[31] = "Obadiah";
|
||||||
|
book[32] = "Jonah";
|
||||||
|
book[33] = "Micah";
|
||||||
|
book[34] = "Nahum";
|
||||||
|
book[35] = "Habakkuk";
|
||||||
|
book[36] = "Zephaniah";
|
||||||
|
book[37] = "Haggai";
|
||||||
|
book[38] = "Zechariah";
|
||||||
|
book[39] = "Malachi";
|
||||||
|
book[40] = "Matthew";
|
||||||
|
book[41] = "Mark";
|
||||||
|
book[42] = "Luke";
|
||||||
|
book[43] = "John";
|
||||||
|
book[44] = "Acts";
|
||||||
|
book[45] = "Romans";
|
||||||
|
book[46] = "1 Corinthians";
|
||||||
|
book[47] = "2 Corinthians";
|
||||||
|
book[48] = "Galatians";
|
||||||
|
book[49] = "Ephesians";
|
||||||
|
book[50] = "Philippians";
|
||||||
|
book[51] = "Colossians";
|
||||||
|
book[52] = "1 Thessalonians";
|
||||||
|
book[53] = "2 Thessalonians";
|
||||||
|
book[54] = "1 Timothy";
|
||||||
|
book[55] = "2 Timothy";
|
||||||
|
book[56] = "Titus";
|
||||||
|
book[57] = "Philemon";
|
||||||
|
book[58] = "Hebrews";
|
||||||
|
book[59] = "James";
|
||||||
|
book[60] = "1 Peter";
|
||||||
|
book[61] = "2 Peter";
|
||||||
|
book[62] = "1 John";
|
||||||
|
book[63] = "2 John";
|
||||||
|
book[64] = "3 John";
|
||||||
|
book[65] = "Jude";
|
||||||
|
book[66] = "Revelation";
|
||||||
|
|
||||||
|
return book[booknum];
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference.prototype.toString = function() {
|
||||||
|
var ref = this.bookname.concat(" ").
|
||||||
|
concat(this.startchapter).concat(":").
|
||||||
|
concat(this.startverse);
|
||||||
|
if (this.startchapter == this.endchapter) {
|
||||||
|
return ref.concat("-").concat(this.endverse);
|
||||||
|
}
|
||||||
|
return ref.concat("-").concat(this.endchapter)
|
||||||
|
.concat(":").concat(this.endverse);
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
Parse: function(ref) {return new Reference(ref);},
|
||||||
|
bookName: bookName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
11616
Android/DynamicBible/assets/js/require-jquery.js
Normal file
11616
Android/DynamicBible/assets/js/require-jquery.js
Normal file
File diff suppressed because it is too large
Load Diff
18
js/common.js
18
js/common.js
@ -36,6 +36,18 @@ define(['jquery', 'reference', 'jquery.ui'],
|
|||||||
Util.RemoveResult(e);
|
Util.RemoveResult(e);
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var Traverse = function (node, testament) {
|
var Traverse = function (node, testament) {
|
||||||
@ -139,13 +151,15 @@ define(['jquery', 'reference', 'jquery.ui'],
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
var Settings = {
|
var Settings = {
|
||||||
Load: function() {
|
Load: function(skipresults) {
|
||||||
if(typeof(Storage)!=="undefined") {
|
if(typeof(Storage)!=="undefined") {
|
||||||
|
// sometimes we want to load the settings, but not the results previously in the window.
|
||||||
|
if (skipresults == "undefined" || skipresults == false) {
|
||||||
if (localStorage.Panes !== "undefined") {
|
if (localStorage.Panes !== "undefined") {
|
||||||
$("#resultwrap").css("float", localStorage.Panes);
|
$("#resultwrap").css("float", localStorage.Panes);
|
||||||
$("#searchresultswrap").css("float", localStorage.Panes);
|
$("#searchresultswrap").css("float", localStorage.Panes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (localStorage.Search !== "undefined" && localStorage.Search == "none") {
|
if (localStorage.Search !== "undefined" && localStorage.Search == "none") {
|
||||||
$("#searchresultswrap").css("display", "none");
|
$("#searchresultswrap").css("display", "none");
|
||||||
$("#showhidesearch").html("Show Search");
|
$("#showhidesearch").html("Show Search");
|
||||||
|
23
js/main.js
23
js/main.js
@ -24,7 +24,12 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui"],
|
|||||||
});
|
});
|
||||||
$("#showhelp").click(function()
|
$("#showhelp").click(function()
|
||||||
{
|
{
|
||||||
$("#help").dialog({draggable:true, width: 700, height: 650, resizable: true});
|
$("#help").dialog({
|
||||||
|
draggable:true,
|
||||||
|
width: 700,
|
||||||
|
height: 650,
|
||||||
|
resizable: true
|
||||||
|
});
|
||||||
});
|
});
|
||||||
$("#showhidesearch").click(function()
|
$("#showhidesearch").click(function()
|
||||||
{
|
{
|
||||||
@ -48,7 +53,21 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui"],
|
|||||||
handle: ".p-handle"
|
handle: ".p-handle"
|
||||||
});
|
});
|
||||||
|
|
||||||
// remember the settings...
|
// load querystring
|
||||||
|
var ref = decodeURIComponent(common.Util.GetUrlVars().r);
|
||||||
|
if (ref !== "undefined") {
|
||||||
|
// remember the settings, first, because if you have results, the load process would wipe out the passage you want to load.
|
||||||
common.Settings.Load();
|
common.Settings.Load();
|
||||||
|
|
||||||
|
// now load the passage from the querystring.
|
||||||
|
common.Search(ref);
|
||||||
|
$("#searchvalue").val(ref);
|
||||||
|
} else {
|
||||||
|
common.Settings.Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user