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;
padding: 0 10px 10px 10px;
overflow:scroll;
height: 600px;
border-right: 2px solid #999;
border-bottom: 2px solid #999;
border-left: 2px solid #999;
height: 100%;
margin-right: 16px;
margin-left: 16px;
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>
<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" />
<style>@import "css/bible.css";</style>
<script src="http://code.jquery.com/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-1.9.1.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>
<style>
@ -71,7 +71,7 @@
<div class="panel-content">
<h3>Settings</h3>
<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:
<select id="changefont">
<option value="georgia" selected="selected">Georgia</option>

View File

@ -2,6 +2,7 @@
var CurrentReferences = {};
define(['jquery', 'reference', 'tagging', 'jquery.ui'],
function($, reference, tagging) {
function SortNumeric(x, y) {
return x - y;
}
@ -27,8 +28,9 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
Settings.SaveResults();
},
RemoveResult: function(e) {
var ref = $(e.target).parent().parent().children(".resultbody").children("h2").children("a").text();
delete CurrentReferences[ref];
$(e.target).parent().parent().remove();
if (ref) delete CurrentReferences[ref.ToString()];
Settings.SaveResults();
},
HandleError: function(e) {
@ -121,12 +123,11 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
for (var result in results) {
// display results.
if ($("#display-strongs-as-dialog")[0].checked) {
Strongs.DisplayStrongsDialog(results[result]);
} else {
//if ($("#display-strongs-as-dialog")[0].checked) {
// Strongs.DisplayStrongsDialog(results[result]);
//} else {
Strongs.DisplayStrongs(results[result]);
}
//}
}
} else {
@ -155,46 +156,51 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
};
var Settings = {
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 (skipresults == undefined || skipresults == false) {
if (localStorage.Panes !== undefined) {
$("#resultwrap").css("float", localStorage.Panes);
$("#searchresultswrap").css("float", localStorage.Panes);
}
}
if (localStorage.FontSize !== "undefined") {
if (localStorage.FontSize !== undefined) {
$("#result").css("font-size", localStorage.FontSize);
}
if (localStorage.Font !== "undefined") {
if (localStorage.Font !== undefined) {
$("#result").css("font-family", localStorage.Font);
$("#changefont").val(localStorage.Font);
}
if (localStorage.StrongsAsDialog !== "undefined" && localStorage.StrongsAsDialog == "false") {
$("#display-strongs-as-dialog")[0].checked = false;
} else {
$("#display-strongs-as-dialog")[0].checked = true;
}
//if (localStorage.StrongsAsDialog !== undefined && localStorage.StrongsAsDialog == "false") {
// $("#display-strongs-as-dialog")[0].checked = false;
//} else {
// $("#display-strongs-as-dialog")[0].checked = true;
//}
if (typeof localStorage.Results !== "undefined") {
if (localStorage.Results !== undefined) {
$.each(
localStorage.Results.replace(/;$/, '').split(';'),
function(i, ref) {
console.log('showing ref', ref);
if (ref != undefined && ref.trim() != "")
{
var myref = reference.Parse(ref);
var r = Bible.GetPassage(myref.book, myref.startchapter, myref.endchapter, myref.startverse, myref.endverse);
Bible.DisplayPassage(r.cs, myref, r.testament);
}
});
}
if (typeof localStorage.SearchResults !== "undefined") {
if (localStorage.SearchResults !== "undefined") {
$("#searchresultswrap").html(localStorage.SearchResults);
Words.AttachEvents($("#searchresultswrap"));
}
}
},
Save: function() {
if (typeof (Storage) !== "undefined")
{
localStorage.Panes = $("#resultwrap").css("float");
@ -203,6 +209,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
localStorage.Font = $("#result").css("font-family");
localStorage.StrongsAsDialog = $("#display-strongs-as-dialog")[0].checked;
}
},
IncreaseResultFontSize: function() {
var s = $("#result").css("font-size");
@ -485,7 +492,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
$(this).find("r").each(function(j) {
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 += "<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>";
for (var i = 0; i < results.length; i++) {
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>";

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) {
if (event.which === 13) {
common.Search($("#searchvalue").val());
return false;
}
});
$("#searchbtn").click(function()
@ -22,11 +23,6 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "j
common.Settings.DecreaseResultFontSize();
return false;
});
$("#switch-panes").click(function()
{
common.Settings.SwitchPanes();
return false;
});
$("#showhelp").click(function()
{
$("#help").dialog({
@ -36,11 +32,6 @@ require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "j
resizable: true
});
});
$("#showhidesearch").click(function()
{
common.Settings.ShowHideSearch();
return false;
});
$("#changefont").change(function()
{
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-c").css("width", 100);
$(".my-breakpoint.ui-grid-c .ui-block-d").css("width", 55);
$("#searchresults").css("height", window.innerHeight-100);
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-c").css("width", 100);
$(".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;
}
function ParseBook(ref, data, errAcc) {
function ParseBook(ref, data) {
ref = ref.toLowerCase().trim();
var fbook = ref.substring(0, ref.search(/\w\s+\d/i)+1);
if (!fbook) fbook = ref;
@ -439,7 +439,7 @@ define("reference",
return rest;
}
function parseFirstNum(ref, r, errAcr) {
function parseFirstNum(ref, r, errAcc) {
ref = ref.ltrim();
var found = false;
for (var i = 0; i <= ref.length; i++) {
@ -576,7 +576,7 @@ define("reference",
}
}
function bookName(booknum) {
function BookName(booknum) {
var book = new Array();
book[0] = "";
book[1] = "Genesis";
@ -672,7 +672,7 @@ define("reference",
return {
Parse: function(ref) {return new Reference(ref);},
ParseBook: ParseBook,
BookName: bookName
BookName: BookName
};
}
);

BIN
mongoose-free-5.5.exe Normal file

Binary file not shown.