aboutsummaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorzefanja <zefanja@freenet.de>2014-01-06 08:40:50 +0700
committerzefanja <zefanja@freenet.de>2014-01-06 08:40:50 +0700
commit71e1ceadf0b82130c3212ed348fc07adb6de6e07 (patch)
tree0a47aa48cd82e0866b4fa04f1677e5d3b1f71822 /source
parent67e7c121c5f6a7cd9cff715894e85ea62d2cb523 (diff)
downloadbiblez-ng-71e1ceadf0b82130c3212ed348fc07adb6de6e07.tar.gz
* fixed bug in note view
Diffstat (limited to 'source')
-rw-r--r--source/App.js1
-rw-r--r--source/main.js10
-rw-r--r--source/moduleManager.js68
-rw-r--r--source/notes.js6
4 files changed, 47 insertions, 38 deletions
diff --git a/source/App.js b/source/App.js
index 9550160..28732f2 100644
--- a/source/App.js
+++ b/source/App.js
@@ -93,7 +93,6 @@ enyo.kind({
openNotes: function (inSender, inEvent) {
this.$.notes.setOsisRef(inEvent.osisRef);
this.$.notes.setNoteId(inEvent.noteId);
- this.$.notes.setFocus();
this.$.panel.setIndex(5);
},
diff --git a/source/main.js b/source/main.js
index d7b8d28..663019b 100644
--- a/source/main.js
+++ b/source/main.js
@@ -15,11 +15,10 @@ enyo.kind({
passage: ""
},
components:[
- {kind: "Signals", onOrientationChange: "handleOrientation"},
+ //{kind: "Signals", onOrientationChange: "handleOrientation"},
{kind: "biblez.versePopup", name: "versePopup", onBookmark: "handleBookmark", onHighlight: "handleHighlight", onNoteTap: "handleNoteTap"},
{name: "fontMenu", kind: "biblez.fontMenu", onFontSize: "handleFontSize", onFont: "handleFont"},
{name: "notePopup", kind: "biblez.notePopup", onEdit: "handleNoteTap"},
- //{kind: "Signals", onbeforeunload: "handleUnload"},
{name: "messagePopup", kind: "onyx.Popup", centered: true, floating: true, classes: "message-popup"},
{name: "bcPopup", classes: "biblez-bc-popup", kind: "onyx.Popup", modal: true, floating: true, components: [
{kind: "biblez.bcSelector", name: "bcSelector", onSelect: "passageChanged", onBack: "closePopup"}
@@ -175,15 +174,15 @@ enyo.kind({
},
renderModuleMenu: function (inModules) {
+ var lastModule = null;
if(!inModules)
inModules = this.modules;
- if(this.settings)
- var lastModule = this.settings.lastModule;
+ if(this.settings.lastModule)
+ lastModule = this.settings.lastModule;
this.$.moduleMenu.destroyClientControls();
var mods = [];
this.modules.forEach(enyo.bind(this, function (mod, idx) {
if ((lastModule && lastModule === mod.modKey)) {
- //mods.push({content: mod.config.moduleKey, index: idx, active: true, style: "background-color: lightblue"});
this.$.btnModules.setContent(lastModule);
mods.push({active: true, components: [
{content: mod.config.moduleKey, index: idx},
@@ -366,7 +365,6 @@ enyo.kind({
},
handleNoteTap: function (inSender, inEvent) {
- //console.log(inEvent);
if (this.userData[inEvent.osisRef] && this.userData[inEvent.osisRef].noteId !== undefined)
inEvent["noteId"] = this.userData[inEvent.osisRef].noteId;
this.doOpenNotes(inEvent);
diff --git a/source/moduleManager.js b/source/moduleManager.js
index 5740d45..0c5badb 100644
--- a/source/moduleManager.js
+++ b/source/moduleManager.js
@@ -117,21 +117,26 @@ enyo.kind({
},
getRepos: function () {
- sword.installMgr.getRepositories(enyo.bind(this, function (inError, inRepos) {
- if (!inError) {
- api.put({id: "repos", repos: inRepos, lastRepoUpdate: {time: new Date().getTime()}},
- enyo.bind(this, function (inError, inId) {
- if(!inError)
- this.setupRepoPicker(inRepos);
- else
- this.handleError(inError);
- })
- );
+ if(navigator.onLine)
+ sword.installMgr.getRepositories(enyo.bind(this, function (inError, inRepos) {
+ if (!inError) {
+ api.put({id: "repos", repos: inRepos, lastRepoUpdate: {time: new Date().getTime()}},
+ enyo.bind(this, function (inError, inId) {
+ if(!inError)
+ this.setupRepoPicker(inRepos);
+ else
+ this.handleError(inError);
+ })
+ );
- } else {
- this.handleError(inError);
- }
- }));
+ } else {
+ this.handleError(inError);
+ }
+ }));
+ else {
+ this.$.spinner.stop();
+ this.handleError({message: $L("You need an internet connection to download modules!")});
+ }
},
setupRepoPicker: function (inRepos, currentRepo) {
@@ -163,22 +168,27 @@ enyo.kind({
this.modules = allModules[inRepo.name.replace(" ", "")].modules;
this.prepareLangList(this.modules);
} else {
- sword.installMgr.getModules(inRepo, enyo.bind(this, function (inError, inModules) {
- //enyo.log(inError, inModules, inModules.length);
- if(!inError) {
- if(!allModules) allModules = {id: "downloadedModules"};
- allModules[inRepo.name.replace(" ", "")] = {modules: inModules, name: inRepo.name};
- api.put(allModules, enyo.bind(this, function (inError, inId) {
- if(inError)
- this.handleError(inError);
- }));
- this.modules = inModules;
- this.prepareLangList(this.modules);
+ if (navigator.onLine)
+ sword.installMgr.getModules(inRepo, enyo.bind(this, function (inError, inModules) {
+ //enyo.log(inError, inModules, inModules.length);
+ if(!inError) {
+ if(!allModules) allModules = {id: "downloadedModules"};
+ allModules[inRepo.name.replace(" ", "")] = {modules: inModules, name: inRepo.name};
+ api.put(allModules, enyo.bind(this, function (inError, inId) {
+ if(inError)
+ this.handleError(inError);
+ }));
+ this.modules = inModules;
+ this.prepareLangList(this.modules);
- } else {
- this.handleError((inError.message) ? inError.message : inError);
- }
- }));
+ } else {
+ this.handleError((inError.message) ? inError.message : inError);
+ }
+ }));
+ else {
+ this.$.spinner.stop();
+ this.handleError({message: $L("You need an internet connection to download modules!")});
+ }
}
} else
this.handleError(inError);
diff --git a/source/notes.js b/source/notes.js
index 3507080..5f24983 100644
--- a/source/notes.js
+++ b/source/notes.js
@@ -36,11 +36,11 @@ enyo.kind({
},
osisRefChanged: function (inSender, inEvent) {
+ this.$.noteInput.setValue("");
this.$.label.setContent($L("Notes for") + " " + api.formatOsis(this.osisRef));
},
noteIdChanged: function () {
- this.$.noteInput.setValue("");
if (this.noteId !== null) {
api.getNote(this.noteId, enyo.bind(this, function (inError, inNote) {
if(!inError) {
@@ -74,8 +74,10 @@ enyo.kind({
},
handleBack: function() {
- if(this.$.noteInput.getValue() !== "")
+ if(this.$.noteInput.getValue() !== "" || this.$.noteInput.getValue() !== " ") {
this.updateNote();
+ this.$.noteInput.setValue(" ");
+ }
this.doBack();
},