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

@ -2,6 +2,7 @@
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) {
@ -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 {
@ -155,46 +156,51 @@ 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");
@ -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");
@ -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 />";
@ -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>";

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.