mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -04:00
- added support for html localStorage for settings (should work on tablet now)
- added support to save strong dialog option, and results.
This commit is contained in:
parent
185579e1df
commit
be32335b40
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="walljm.dynamicbible"
|
||||
android:versionCode="6"
|
||||
android:versionName="1.3.3" >
|
||||
android:versionCode="7"
|
||||
android:versionName="1.3.4" >
|
||||
<supports-screens
|
||||
android:smallScreens="false"
|
||||
android:normalScreens="true"
|
||||
|
@ -52,6 +52,11 @@
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
@ -106,7 +106,8 @@ function Search(sv) {
|
||||
$( "#result" ).sortable({
|
||||
axis: "x",
|
||||
handle: ".handle"
|
||||
});
|
||||
});
|
||||
Settings.SaveResults();
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
@ -118,14 +119,12 @@ function Search(sv) {
|
||||
|
||||
var Settings = {
|
||||
Load: function() {
|
||||
var str = $.cookie('settings');
|
||||
if (str != null) {
|
||||
var s = str.split(",");
|
||||
if(typeof(Storage)!=="undefined")
|
||||
{
|
||||
$("#resultwrap").css("float", localStorage.Panes);
|
||||
$("#searchresultswrap").css("float", localStorage.Panes);
|
||||
|
||||
$("#resultwrap").css("float", s[0]);
|
||||
$("#searchresultswrap").css("float", s[0]);
|
||||
|
||||
if (s[1] == "none") {
|
||||
if (localStorage.Search == "none") {
|
||||
$("#searchresultswrap").css("display", "none");
|
||||
$("#showhidesearch").html("Show Search");
|
||||
$("#resultwrap").css("width", "100%");
|
||||
@ -136,22 +135,39 @@ var Settings = {
|
||||
$("#resultwrap").css("width", "70%");
|
||||
}
|
||||
|
||||
$("#result").css("font-size", s[2]);
|
||||
$("#result").css("font-family", s[3]);
|
||||
$("#result").css("font-size", localStorage.FontSize);
|
||||
$("#result").css("font-family", localStorage.Font);
|
||||
$("#changefont").val(localStorage.Font);
|
||||
|
||||
if (localStorage.StrongsAsDialog == "false") {
|
||||
$("#display-strongs-as-dialog")[0].checked = false;
|
||||
} else {
|
||||
$("#display-strongs-as-dialog")[0].checked = true;
|
||||
}
|
||||
|
||||
$("#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() {
|
||||
var s = {};
|
||||
s.Panes = $("#resultwrap").css("float");
|
||||
s.Search = $("#searchresultswrap").css("display");
|
||||
s.FontSize = $("#result").css("font-size");
|
||||
s.Font = $("#result").css("font-family");
|
||||
|
||||
var str = s.Panes + "," + s.Search + "," + s.FontSize + "," + s.Font;
|
||||
|
||||
$.cookie('settings', str, {
|
||||
expires: 365
|
||||
});
|
||||
if(typeof(Storage)!=="undefined")
|
||||
{
|
||||
localStorage.Panes = $("#resultwrap").css("float");
|
||||
localStorage.Search = $("#searchresultswrap").css("display");
|
||||
localStorage.FontSize = $("#result").css("font-size");
|
||||
localStorage.Font = $("#result").css("font-family");
|
||||
localStorage.StrongsAsDialog = $("#display-strongs-as-dialog")[0].checked;
|
||||
localStorage.Results = $("#result").html();
|
||||
}
|
||||
},
|
||||
ShowHideSearch: function() {
|
||||
var o = $("#showhidesearch");
|
||||
@ -196,23 +212,37 @@ var Settings = {
|
||||
ChangeResultFont: function(fontfamily) {
|
||||
$("#result").css("font-family", fontfamily);
|
||||
this.Save();
|
||||
},
|
||||
ChangeDisplayStrongsInDialog: function(fontfamily) {
|
||||
this.Save();
|
||||
},
|
||||
SaveResults: function()
|
||||
{
|
||||
localStorage.Results = $("#resultwrap").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;
|
||||
}
|
||||
};
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="walljm.dynamicbible"
|
||||
android:versionCode="6"
|
||||
android:versionName="1.3.3" >
|
||||
android:versionCode="7"
|
||||
android:versionName="1.3.4" >
|
||||
<supports-screens
|
||||
android:smallScreens="false"
|
||||
android:normalScreens="true"
|
||||
|
@ -52,6 +52,11 @@
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
72
js/common.js
72
js/common.js
@ -106,7 +106,8 @@ function Search(sv) {
|
||||
$( "#result" ).sortable({
|
||||
axis: "x",
|
||||
handle: ".handle"
|
||||
});
|
||||
});
|
||||
Settings.SaveResults();
|
||||
}
|
||||
catch (err) {
|
||||
Util.HandleError(err);
|
||||
@ -118,14 +119,12 @@ function Search(sv) {
|
||||
|
||||
var Settings = {
|
||||
Load: function() {
|
||||
var str = $.cookie('settings');
|
||||
if (str != null) {
|
||||
var s = str.split(",");
|
||||
if(typeof(Storage)!=="undefined")
|
||||
{
|
||||
$("#resultwrap").css("float", localStorage.Panes);
|
||||
$("#searchresultswrap").css("float", localStorage.Panes);
|
||||
|
||||
$("#resultwrap").css("float", s[0]);
|
||||
$("#searchresultswrap").css("float", s[0]);
|
||||
|
||||
if (s[1] == "none") {
|
||||
if (localStorage.Search == "none") {
|
||||
$("#searchresultswrap").css("display", "none");
|
||||
$("#showhidesearch").html("Show Search");
|
||||
$("#resultwrap").css("width", "100%");
|
||||
@ -136,22 +135,39 @@ var Settings = {
|
||||
$("#resultwrap").css("width", "70%");
|
||||
}
|
||||
|
||||
$("#result").css("font-size", s[2]);
|
||||
$("#result").css("font-family", s[3]);
|
||||
$("#result").css("font-size", localStorage.FontSize);
|
||||
$("#result").css("font-family", localStorage.Font);
|
||||
$("#changefont").val(localStorage.Font);
|
||||
|
||||
if (localStorage.StrongsAsDialog == "false") {
|
||||
$("#display-strongs-as-dialog")[0].checked = false;
|
||||
} else {
|
||||
$("#display-strongs-as-dialog")[0].checked = true;
|
||||
}
|
||||
|
||||
$("#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() {
|
||||
var s = {};
|
||||
s.Panes = $("#resultwrap").css("float");
|
||||
s.Search = $("#searchresultswrap").css("display");
|
||||
s.FontSize = $("#result").css("font-size");
|
||||
s.Font = $("#result").css("font-family");
|
||||
|
||||
var str = s.Panes + "," + s.Search + "," + s.FontSize + "," + s.Font;
|
||||
|
||||
$.cookie('settings', str, {
|
||||
expires: 365
|
||||
});
|
||||
if(typeof(Storage)!=="undefined")
|
||||
{
|
||||
localStorage.Panes = $("#resultwrap").css("float");
|
||||
localStorage.Search = $("#searchresultswrap").css("display");
|
||||
localStorage.FontSize = $("#result").css("font-size");
|
||||
localStorage.Font = $("#result").css("font-family");
|
||||
localStorage.StrongsAsDialog = $("#display-strongs-as-dialog")[0].checked;
|
||||
localStorage.Results = $("#result").html();
|
||||
}
|
||||
},
|
||||
ShowHideSearch: function() {
|
||||
var o = $("#showhidesearch");
|
||||
@ -196,23 +212,37 @@ var Settings = {
|
||||
ChangeResultFont: function(fontfamily) {
|
||||
$("#result").css("font-family", fontfamily);
|
||||
this.Save();
|
||||
},
|
||||
ChangeDisplayStrongsInDialog: function(fontfamily) {
|
||||
this.Save();
|
||||
},
|
||||
SaveResults: function()
|
||||
{
|
||||
localStorage.Results = $("#resultwrap").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;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user