Commit d9b1316d authored by Troy A. Griffitts's avatar Troy A. Griffitts

Added and fixed support for preferredBible, preferredDevotional; h1 and h2...

Added and fixed support for preferredBible, preferredDevotional; h1 and h2 localization support; remember topBar open/close between runs;
parent 30a7a630
var app = {
version: '1.0.7', // change version here and in config.xml, near top
version: '1.3.4', // change version here and in config.xml, near top
backFunction: null,
enableBibleSync : true,
enableViewTypes : true,
......@@ -19,6 +19,7 @@ var app = {
defaultLocale : 'en',
defaultLocaleName : 'English',
preferredDevotional : 'SME',
preferredBible : 'KJV',
appLogo : 'img/swordlogo.png',
appName : 'Bishop',
topBarHeight : 3,
......@@ -393,6 +394,12 @@ console.log('closing topbar');
else {
app.closeFootnotes(true);
}
if (window.localStorage.getItem('showingTopBar') == 'true') {
app.openTopBar();
}
else {
app.closeTopBar();
}
var textDisplay = $('#textDisplay');
......@@ -877,6 +884,12 @@ console.log('************ received ' + locales.length + ' locales.');
buildLocaleNames(0, function() {
if (!mainMod && mods.length) {
var prefBibleExists = $.grep(mods, function(m) { return m.name == app.preferredBible; }).length;
console.log('*********** prefBibleExists: ' + prefBibleExists);
app.setCurrentMod1(prefBibleExists ? app.preferredBible : mods[0].name);
mainMod = app.getCurrentMod1();
}
for (var i = 0; i < mods.length; ++i) {
console.log('Installed module: ' + mods[i].name + '; features.length: ' + mods[i].features.length + '; features: ' + mods[i].features);
if (mods[i].category == SWORD.CATEGORY_BIBLES) {
......@@ -1014,7 +1027,6 @@ console.log('Installed module: ' + mods[i].name + '; features.length: ' + mods[i
app.setAppTheme(app.getAppTheme());
app.updateBibleSyncDisplay();
app.updateBookmarkDisplay();
if (!app.getCurrentMod1() && mods.length) app.setCurrentMod1(mods[0].name);
if (callback) callback();
});
}); // getAvailableLocales()
......@@ -1255,6 +1267,7 @@ console.log("****** closing menu");
if ($('#openTopBar').is(':checked')) return false;
console.log("****** opening topBar");
$('#openTopBar').prop('checked', true).change();
window.localStorage.setItem('showingTopBar', 'true');
return true;
},
......@@ -1262,6 +1275,7 @@ console.log("****** opening topBar");
if (!$('#openTopBar').is(':checked')) return false;
console.log("****** closing topBar");
$('#openTopBar').prop('checked', false).change();
window.localStorage.setItem('showingTopBar', 'false');
return true;
},
......@@ -1501,7 +1515,9 @@ console.log('parDispModules.length: ' + parDispModules.length);
setTimeout(function() {
if (app.getCurrentVerseKey().verse > 1) {
var new_position = $('.currentVerse').offset();
$('#textDisplay').scrollTop(new_position.top-$('#textDisplay').offset().top-(app.topBarHeight*app.emHeight));
if (new_position) {
$('#textDisplay').scrollTop(new_position.top-$('#textDisplay').offset().top-(app.topBarHeight*app.emHeight));
}
}
app.requestAuxDisplay(callback);
}, 500);
......@@ -1509,7 +1525,7 @@ console.log('parDispModules.length: ' + parDispModules.length);
};
if (!masterModule) {
return chapterDisplay('<center><h2 data-english="Nothing to display.">Nothing to display.</h2></center>');
return chapterDisplay('<br/><br/><br/><center><h2 data-english="Nothing to display.">Nothing to display.</h2></center>');
}
var usedCV = false;
//
......@@ -1546,7 +1562,7 @@ console.log('headerLoopContinue. mods.length: ' + mods.length + '; renderData.le
// assert we have something to display
if (!mods.length) {
return chapterDisplay('<center><h2>Nothing to display.</h2></center>');
return chapterDisplay('<br/><br/><br/><center><h2 data-english="Nothing to display.">Nothing to display.</h2></center>');
}
// table which contains all verse items
......@@ -1801,7 +1817,7 @@ console.log('refreshing sources complete');
break;
case 2:
$('#modSource').val('CrossWire');
installMgr.installModule('CrossWire', 'KJV', function() { ++app.basicStartupStage; app.basicStartup() });
installMgr.installModule('CrossWire', app.preferredBible, function() { ++app.basicStartupStage; app.basicStartup() });
break;
case 3:
installMgr.installModule('CrossWire', 'StrongsGreek', function() { ++app.basicStartupStage; app.basicStartup() });
......@@ -1819,7 +1835,7 @@ console.log('refreshing sources complete');
installMgr.installModule('CrossWire', app.preferredDevotional, function() { ++app.basicStartupStage; app.basicStartup() });
break;
case 8:
app.setCurrentMod1('KJV');
app.setCurrentMod1(app.preferredBible);
app.setCurrentMod2('WHNU');
app.setCurrentMod3('WLC');
app.show();
......@@ -1838,7 +1854,7 @@ console.log('refreshing sources complete');
},
setAppLocale: function(localeName, callback) {
if (!localeName) localeName = app.getAppLocale();
var englishSpans = $('div[data-english],button[data-english],span[data-english],option[data-english],th[data-english],p[data-english],label[data-english]');
var englishSpans = $('div[data-english],button[data-english],span[data-english],option[data-english],th[data-english],p[data-english],label[data-english],h1[data-english],h2[data-english]');
var reInit = (localeName != app.getAppLocale());
window.localStorage.setItem('appLocale', localeName);
SWORD.mgr.setDefaultLocale(localeName, function() {
......
......@@ -3,9 +3,12 @@ var dailyDevo = {
show: function() {
dailyDevo.whichDay = new Date();
var lastDevo = window.localStorage.getItem('lastDevo');
var prefDevoExists = $.grep(app.mods, function(m) { return m.name == app.preferredDevotional; }).length;
app.currentWindow = dailyDevo;
$('#main').html('<div id="toolbar"></div><div id="client"></div><div id="aux" class="dropdown-content"></div>');
dailyDevo.setupMenu(function(buttonList) {
console.log('****** !lastDevo ' + !lastDevo + '; prefDevoExists: ' + prefDevoExists + '; app.preferredDevotional: ' + app.preferredDevotional);
if ((!lastDevo || !lastDevo.length) && prefDevoExists) lastDevo = app.preferredDevotional;
console.log('****** buttonList: ' + buttonList);
console.log('****** lastDevo: ' + lastDevo);
if (buttonList && buttonList.length && lastDevo) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment