mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-27 01:19:52 -04:00
88 lines
3.9 KiB
JavaScript
88 lines
3.9 KiB
JavaScript
/// <reference path="Globals.ts"/>
|
|
var SettingsProp = {
|
|
Panes: "Panes",
|
|
FontSize: "FontSize",
|
|
Font: "Font",
|
|
BreakOnVerses: "BreakOnVerses",
|
|
Results: "Results",
|
|
SearchResults: "SearchResults"
|
|
};
|
|
var Settings = (function () {
|
|
function Settings() {
|
|
}
|
|
Settings.Load = function (skipresults) {
|
|
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.getItem(SettingsProp.Panes) !== null) {
|
|
$("#resultwrap").css("float", localStorage.getItem(SettingsProp.Panes));
|
|
$("#searchresultswrap").css("float", localStorage.getItem(SettingsProp.Panes));
|
|
}
|
|
}
|
|
if (localStorage.getItem(SettingsProp.FontSize) !== null) {
|
|
$("#result").css("font-size", localStorage.getItem(SettingsProp.FontSize));
|
|
}
|
|
if (localStorage.getItem(SettingsProp.Font) !== null) {
|
|
$("#result").css("font-family", localStorage.getItem(SettingsProp.Font));
|
|
$("#changefont").val(localStorage.getItem(SettingsProp.Font));
|
|
}
|
|
if (localStorage.getItem(SettingsProp.BreakOnVerses) !== null && localStorage.getItem(SettingsProp.BreakOnVerses) == "false") {
|
|
$('#break-on-verses').prop('checked', false).checkboxradio('refresh');
|
|
}
|
|
else {
|
|
$('#break-on-verses').prop('checked', true).checkboxradio('refresh');
|
|
}
|
|
if (localStorage.getItem(SettingsProp.Results) !== null) {
|
|
$.each(localStorage.getItem(SettingsProp.Results).replace(/;$/, '').split(';'), function (i, ref) {
|
|
if (ref != undefined && ref.trim() != "") {
|
|
Search(ref);
|
|
}
|
|
});
|
|
}
|
|
if (localStorage.getItem(SettingsProp.SearchResults) !== null) {
|
|
$("#searchresultswrap").html(localStorage.getItem(SettingsProp.SearchResults));
|
|
Words.AttachEvents($("#searchresultswrap"));
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
Settings.Save = function () {
|
|
if (typeof (Storage) !== "undefined") {
|
|
localStorage.setItem(SettingsProp.Panes, $("#resultwrap").css("float"));
|
|
localStorage.setItem(SettingsProp.SearchResults, $("#searchresultswrap").css("display"));
|
|
localStorage.setItem(SettingsProp.FontSize, $("#result").css("font-size"));
|
|
localStorage.setItem(SettingsProp.Font, $("#result").css("font-family"));
|
|
localStorage.setItem(SettingsProp.BreakOnVerses, $("#break-on-verses").prop("checked"));
|
|
}
|
|
};
|
|
Settings.IncreaseResultFontSize = function () {
|
|
var s = $("#result").css("font-size");
|
|
$("#result").css("font-size", parseInt(s) + 1);
|
|
this.Save();
|
|
};
|
|
Settings.DecreaseResultFontSize = function () {
|
|
var s = $("#result").css("font-size");
|
|
$("#result").css("font-size", parseInt(s) - 1);
|
|
this.Save();
|
|
};
|
|
Settings.ChangeResultFont = function (fontfamily) {
|
|
$("#result").css("font-family", fontfamily);
|
|
this.Save();
|
|
};
|
|
Settings.ChangeDisplayStrongsInDialog = function () {
|
|
this.Save();
|
|
};
|
|
Settings.SaveResults = function () {
|
|
if (typeof localStorage != 'undefined') {
|
|
var results = "";
|
|
for (var ref in CurrentReferences) {
|
|
results += ref + ';';
|
|
}
|
|
localStorage.setItem(SettingsProp.Results, results);
|
|
localStorage.setItem(SettingsProp.SearchResults, $("#searchresultswrap").html());
|
|
}
|
|
};
|
|
return Settings;
|
|
}());
|
|
;
|
|
//# sourceMappingURL=Settings.js.map
|