BUGFIXES: All operations now work

* fixed display of search results
   * downloaded jquery files so no longer rely on inet connection
   * fixed storage of references for save/load
   * multiple Bookname misspelled as bookname
   * added return false to avoid page reload
This commit is contained in:
jason.wall 2014-12-24 22:56:03 -05:00
parent 9294028f0b
commit 61753ba299
9 changed files with 1051 additions and 1025 deletions

View File

@ -13,10 +13,7 @@ a:hover {
xmargin-right: 10px; xmargin-right: 10px;
padding: 0 10px 10px 10px; padding: 0 10px 10px 10px;
overflow:scroll; overflow:scroll;
height: 600px; height: 100%;
border-right: 2px solid #999;
border-bottom: 2px solid #999;
border-left: 2px solid #999;
margin-right: 16px; margin-right: 16px;
margin-left: 16px; margin-left: 16px;
background: #eee; background: #eee;

12
css/jquery.mobile-1.3.2.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -9,13 +9,13 @@
<title>The Bible with Strong's Numbers and Cross References</title> <title>The Bible with Strong's Numbers and Cross References</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" /> <link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" />
<link rel="stylesheet" href="css/themes/db.css" /> <link rel="stylesheet" href="css/themes/db.css" />
<style>@import "css/bible.css";</style> <style>@import "css/bible.css";</style>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="js/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script> <script src="js/jquery.mobile-1.3.2.min.js"></script>
<script data-main="js/main" type="text/javascript" src="js/require-jquery.js"></script> <script data-main="js/main" type="text/javascript" src="js/require-jquery.js"></script>
<style> <style>
@ -71,7 +71,7 @@
<div class="panel-content"> <div class="panel-content">
<h3>Settings</h3> <h3>Settings</h3>
<ul data-role="listview"> <ul data-role="listview">
<li><label><input type="checkbox" name="display-strongs-as-dialog" id="display-strongs-as-dialog" />Display Strong's in Dialog</label></li> <!--<li><label><input type="checkbox" name="display-strongs-as-dialog" id="display-strongs-as-dialog" />Display Strong's in Dialog</label></li>-->
<li><label>Select Font: <li><label>Select Font:
<select id="changefont"> <select id="changefont">
<option value="georgia" selected="selected">Georgia</option> <option value="georgia" selected="selected">Georgia</option>

View File

@ -1,7 +1,8 @@
(function() { (function() {
var CurrentReferences = {}; var CurrentReferences = {};
define(['jquery', 'reference', 'tagging', 'jquery.ui'], define(['jquery', 'reference', 'tagging', 'jquery.ui'],
function($, reference, tagging) { function($, reference, tagging) {
function SortNumeric(x, y) { function SortNumeric(x, y) {
return x - y; return x - y;
} }
@ -27,8 +28,9 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
Settings.SaveResults(); Settings.SaveResults();
}, },
RemoveResult: function(e) { RemoveResult: function(e) {
var ref = $(e.target).parent().parent().children(".resultbody").children("h2").children("a").text();
delete CurrentReferences[ref];
$(e.target).parent().parent().remove(); $(e.target).parent().parent().remove();
if (ref) delete CurrentReferences[ref.ToString()];
Settings.SaveResults(); Settings.SaveResults();
}, },
HandleError: function(e) { HandleError: function(e) {
@ -44,7 +46,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
// Read a page's GET URL variables and return them as an associative array. // Read a page's GET URL variables and return them as an associative array.
var vars = [], hash; var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++) for (var i = 0; i < hashes.length; i++)
{ {
hash = hashes[i].split('='); hash = hashes[i].split('=');
vars.push(hash[0]); vars.push(hash[0]);
@ -53,7 +55,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
return vars; return vars;
} }
}; };
var Traverse = function (node, testament) { var Traverse = function(node, testament) {
try { try {
var treeText = ""; var treeText = "";
if (node != null) { if (node != null) {
@ -92,7 +94,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
} }
return null; return null;
}; };
var Search = function (sv) { var Search = function(sv) {
try { try {
var qs = sv.split(";"); var qs = sv.split(";");
@ -121,12 +123,11 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
for (var result in results) { for (var result in results) {
// display results. // display results.
if ($("#display-strongs-as-dialog")[0].checked) { //if ($("#display-strongs-as-dialog")[0].checked) {
Strongs.DisplayStrongsDialog(results[result]); // Strongs.DisplayStrongsDialog(results[result]);
} else { //} else {
Strongs.DisplayStrongs(results[result]); Strongs.DisplayStrongs(results[result]);
//}
}
} }
} else { } else {
@ -141,7 +142,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
} }
} }
} }
$( "#result" ).sortable({ $("#result").sortable({
axis: "x", axis: "x",
handle: ".handle" handle: ".handle"
}); });
@ -155,47 +156,52 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
}; };
var Settings = { var Settings = {
Load: function(skipresults) { 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. // sometimes we want to load the settings, but not the results previously in the window.
if (skipresults == "undefined" || skipresults == false) { 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.FontSize !== "undefined") { if (localStorage.FontSize !== undefined) {
$("#result").css("font-size", localStorage.FontSize); $("#result").css("font-size", localStorage.FontSize);
} }
if (localStorage.Font !== "undefined") { if (localStorage.Font !== undefined) {
$("#result").css("font-family", localStorage.Font); $("#result").css("font-family", localStorage.Font);
$("#changefont").val(localStorage.Font); $("#changefont").val(localStorage.Font);
} }
if (localStorage.StrongsAsDialog !== "undefined" && localStorage.StrongsAsDialog == "false") { //if (localStorage.StrongsAsDialog !== undefined && localStorage.StrongsAsDialog == "false") {
$("#display-strongs-as-dialog")[0].checked = false; // $("#display-strongs-as-dialog")[0].checked = false;
} else { //} else {
$("#display-strongs-as-dialog")[0].checked = true; // $("#display-strongs-as-dialog")[0].checked = true;
} //}
if (typeof localStorage.Results !== "undefined") { if (localStorage.Results !== undefined) {
$.each( $.each(
localStorage.Results.replace(/;$/, '').split(';'), localStorage.Results.replace(/;$/, '').split(';'),
function(i, ref) { function(i, ref) {
console.log('showing ref', ref); if (ref != undefined && ref.trim() != "")
{
var myref = reference.Parse(ref); var myref = reference.Parse(ref);
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);
}
}); });
} }
if (typeof localStorage.SearchResults !== "undefined") { if (localStorage.SearchResults !== "undefined") {
$("#searchresultswrap").html(localStorage.SearchResults); $("#searchresultswrap").html(localStorage.SearchResults);
Words.AttachEvents($("#searchresultswrap")); Words.AttachEvents($("#searchresultswrap"));
} }
} }
}, },
Save: function() { Save: function() {
if(typeof(Storage)!=="undefined")
if (typeof (Storage) !== "undefined")
{ {
localStorage.Panes = $("#resultwrap").css("float"); localStorage.Panes = $("#resultwrap").css("float");
localStorage.Search = $("#searchresultswrap").css("display"); localStorage.Search = $("#searchresultswrap").css("display");
@ -203,6 +209,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
localStorage.Font = $("#result").css("font-family"); localStorage.Font = $("#result").css("font-family");
localStorage.StrongsAsDialog = $("#display-strongs-as-dialog")[0].checked; localStorage.StrongsAsDialog = $("#display-strongs-as-dialog")[0].checked;
} }
}, },
IncreaseResultFontSize: function() { IncreaseResultFontSize: function() {
var s = $("#result").css("font-size"); var s = $("#result").css("font-size");
@ -257,10 +264,10 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
strongs_pre = "G"; strongs_pre = "G";
} }
var sp = ""; var sp = "";
if (v.w[w].t.substr(v.w[w].t.length-1) == " ") { if (v.w[w].t.substr(v.w[w].t.length - 1) == " ") {
sp = " "; sp = " ";
} }
r += "<a href='javascript:void();' 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; r += "<a href='javascript:void();' 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 { } else {
r += v.w[w].t; r += v.w[w].t;
} }
@ -268,7 +275,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
r += "<br />"; r += "<br />";
} }
} }
var t = $("<div class='passage result'><a href='javascript:void();' class='removeresult' style='border: 0;'><img style='border: 0px;' src='images/delete.png' width='48' height='48' /></a><a href='#' class='trigger left'>&nbsp;</a><div class='tags panel left'></div><span class='resultbody'>" + "<h2><a href='http://www.dynamicbible.com/?r="+ ref.toString() + "'>" + ref.toString() + "</a></h2>" + r + "</span><br clear='all' /></div>"); var t = $("<div class='passage result'><a href='javascript:void();' class='removeresult' style='border: 0;'><img style='border: 0px;' src='images/delete.png' width='48' height='48' /></a><a href='#' class='trigger left'>&nbsp;</a><div class='tags panel left'></div><span class='resultbody'>" + "<h2><a href='http://www.dynamicbible.com/?r=" + ref.toString() + "'>" + ref.toString() + "</a></h2>" + r + "</span><br clear='all' /></div>");
var tagsform = $("<p>Tags: <br /><input type='text' class='input-addtag' /><button class='btn-addtag' type='button'>Update Tags</button></p>"); var tagsform = $("<p>Tags: <br /><input type='text' class='input-addtag' /><button class='btn-addtag' type='button'>Update Tags</button></p>");
tagging.GetTags( tagging.GetTags(
ref.toString(), { ref.toString(), {
@ -337,7 +344,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
for (i = start; i <= end; i++) { for (i = start; i <= end; i++) {
// we're using c based indexes here, so the index is 1 less than the verse #. // we're using c based indexes here, so the index is 1 less than the verse #.
vss.push(chapters[j].vss[i-1]); vss.push(chapters[j].vss[i - 1]);
} }
cs.push({ cs.push({
@ -358,7 +365,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
} }
return null; return null;
}, },
AttachEvents: function(t, ref){ AttachEvents: function(t, ref) {
t.find(".hiddenlink").click(function(e) { t.find(".hiddenlink").click(function(e) {
Util.HandleHiddenLink(e); Util.HandleHiddenLink(e);
}); });
@ -485,7 +492,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
$(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'>" + reference.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 />";
@ -540,14 +547,14 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
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: { buttons: {
"Close": function() { "Close": function() {
$( this ).dialog( "close" ); $(this).dialog("close");
} }
} }
}); });
@ -588,7 +595,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
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='" + reference.bookName(r[0]) + " " + r[1] + ":" + r[2] + "'>" + reference.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>";
@ -671,7 +678,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
}); });
// find the right word // find the right word
var refs = $.grep(r, function(o,i) { var refs = $.grep(r, function(o, i) {
return o.word == query; return o.word == query;
}); });
if (refs.length > 0) { if (refs.length > 0) {
@ -968,7 +975,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
// convert the references back into book, chapter and verse. // convert the references back into book, chapter and verse.
for (i = 0; i < result.length; i++) { for (i = 0; i < result.length; i++) {
ref = result[i]; ref = result[i];
result[i] = parseInt(ref / 100000000)+":"+parseInt((ref % 100000000) / 10000)+":"+((ref % 100000000) % 10000); result[i] = parseInt(ref / 100000000) + ":" + parseInt((ref % 100000000) / 10000) + ":" + ((ref % 100000000) % 10000);
} }
return result; return result;
@ -1021,7 +1028,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
} }
return null; return null;
}, },
AttachEvents: function(t){ AttachEvents: function(t) {
t.find(".link").click(function(e) { t.find(".link").click(function(e) {
Util.HandleLink(e); Util.HandleLink(e);
}); });

5
js/jquery-1.9.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

9
js/jquery.mobile-1.3.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,7 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "j
$("#searchvalue").keypress(function(event) { $("#searchvalue").keypress(function(event) {
if (event.which === 13) { if (event.which === 13) {
common.Search($("#searchvalue").val()); common.Search($("#searchvalue").val());
return false;
} }
}); });
$("#searchbtn").click(function() $("#searchbtn").click(function()
@ -22,11 +23,6 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "j
common.Settings.DecreaseResultFontSize(); common.Settings.DecreaseResultFontSize();
return false; return false;
}); });
$("#switch-panes").click(function()
{
common.Settings.SwitchPanes();
return false;
});
$("#showhelp").click(function() $("#showhelp").click(function()
{ {
$("#help").dialog({ $("#help").dialog({
@ -36,11 +32,6 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "j
resizable: true resizable: true
}); });
}); });
$("#showhidesearch").click(function()
{
common.Settings.ShowHideSearch();
return false;
});
$("#changefont").change(function() $("#changefont").change(function()
{ {
common.Settings.ChangeResultFont($("#changefont").val()); common.Settings.ChangeResultFont($("#changefont").val());
@ -67,6 +58,9 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "j
$(".my-breakpoint.ui-grid-c .ui-block-b").css("width", window.innerWidth - 230); $(".my-breakpoint.ui-grid-c .ui-block-b").css("width", window.innerWidth - 230);
$(".my-breakpoint.ui-grid-c .ui-block-c").css("width", 100); $(".my-breakpoint.ui-grid-c .ui-block-c").css("width", 100);
$(".my-breakpoint.ui-grid-c .ui-block-d").css("width", 55); $(".my-breakpoint.ui-grid-c .ui-block-d").css("width", 55);
$("#searchresults").css("height", window.innerHeight-100);
return false; return false;
}); });
@ -74,6 +68,8 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "j
$(".my-breakpoint.ui-grid-c .ui-block-b").css("width", window.innerWidth - 235); $(".my-breakpoint.ui-grid-c .ui-block-b").css("width", window.innerWidth - 235);
$(".my-breakpoint.ui-grid-c .ui-block-c").css("width", 100); $(".my-breakpoint.ui-grid-c .ui-block-c").css("width", 100);
$(".my-breakpoint.ui-grid-c .ui-block-d").css("width", 55); $(".my-breakpoint.ui-grid-c .ui-block-d").css("width", 55);
$("#searchresults").css("height", window.innerHeight-100);
}); });
}); });

View File

@ -28,7 +28,7 @@ define("reference",
return r; return r;
} }
function ParseBook(ref, data, errAcc) { function ParseBook(ref, data) {
ref = ref.toLowerCase().trim(); ref = ref.toLowerCase().trim();
var fbook = ref.substring(0, ref.search(/\w\s+\d/i)+1); var fbook = ref.substring(0, ref.search(/\w\s+\d/i)+1);
if (!fbook) fbook = ref; if (!fbook) fbook = ref;
@ -439,7 +439,7 @@ define("reference",
return rest; return rest;
} }
function parseFirstNum(ref, r, errAcr) { function parseFirstNum(ref, r, errAcc) {
ref = ref.ltrim(); ref = ref.ltrim();
var found = false; var found = false;
for (var i = 0; i <= ref.length; i++) { for (var i = 0; i <= ref.length; i++) {
@ -576,7 +576,7 @@ define("reference",
} }
} }
function bookName(booknum) { function BookName(booknum) {
var book = new Array(); var book = new Array();
book[0] = ""; book[0] = "";
book[1] = "Genesis"; book[1] = "Genesis";
@ -672,7 +672,7 @@ define("reference",
return { return {
Parse: function(ref) {return new Reference(ref);}, Parse: function(ref) {return new Reference(ref);},
ParseBook: ParseBook, ParseBook: ParseBook,
BookName: bookName BookName: BookName
}; };
} }
); );

BIN
mongoose-free-5.5.exe Normal file

Binary file not shown.