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

@ -1,7 +1,8 @@
(function() {
var CurrentReferences = {};
define(['jquery', 'reference', 'tagging', 'jquery.ui'],
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) {
@ -44,7 +46,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
// 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++)
for (var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
@ -53,7 +55,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
return vars;
}
};
var Traverse = function (node, testament) {
var Traverse = function(node, testament) {
try {
var treeText = "";
if (node != null) {
@ -92,7 +94,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
}
return null;
};
var Search = function (sv) {
var Search = function(sv) {
try {
var qs = sv.split(";");
@ -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 {
@ -141,7 +142,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
}
}
}
$( "#result" ).sortable({
$("#result").sortable({
axis: "x",
handle: ".handle"
});
@ -155,47 +156,52 @@ 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")
if (typeof (Storage) !== "undefined")
{
localStorage.Panes = $("#resultwrap").css("float");
localStorage.Search = $("#searchresultswrap").css("display");
@ -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");
@ -257,10 +264,10 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
strongs_pre = "G";
}
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 = " ";
}
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 {
r += v.w[w].t;
}
@ -268,7 +275,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
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>");
tagging.GetTags(
ref.toString(), {
@ -337,7 +344,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
for (i = start; i <= end; i++) {
// we're using c based indexes here, so the index is 1 less than the verse #.
vss.push(chapters[j].vss[i-1]);
vss.push(chapters[j].vss[i - 1]);
}
cs.push({
@ -358,7 +365,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
}
return null;
},
AttachEvents: function(t, ref){
AttachEvents: function(t, ref) {
t.find(".hiddenlink").click(function(e) {
Util.HandleHiddenLink(e);
});
@ -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 />";
@ -540,14 +547,14 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
var t = Strongs.BuildStrongs(r);
var d = $("<div></div>").append(t);
d.dialog({
draggable:true,
draggable: true,
width: 600,
height: 500,
resizable: true,
title: "Strongs Definition",
buttons: {
"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>";
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>";
@ -671,7 +678,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
});
// find the right word
var refs = $.grep(r, function(o,i) {
var refs = $.grep(r, function(o, i) {
return o.word == query;
});
if (refs.length > 0) {
@ -968,7 +975,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
// convert the references back into book, chapter and verse.
for (i = 0; i < result.length; 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;
@ -1021,7 +1028,7 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'],
}
return null;
},
AttachEvents: function(t){
AttachEvents: function(t) {
t.find(".link").click(function(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) {
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.