aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzefanja <zefanja@freenet.de>2014-04-16 14:00:24 +0700
committerzefanja <zefanja@freenet.de>2014-04-16 14:00:24 +0700
commitf8176bbbb3f506c08bd5a2ff649eb7771288657c (patch)
tree94a01708638d90a2d9bf7eabc211649866548838
parent1db24ed4cb8b629591cf9be8ad8fc882f0cff9bb (diff)
downloadbiblez-ng-f8176bbbb3f506c08bd5a2ff649eb7771288657c.tar.gz
* polished up moduleManager
* added item highlight * updated manifest and appcache
-rw-r--r--biblez.appcache2
-rw-r--r--manifest.deploy4
-rw-r--r--manifest.desktop4
-rw-r--r--source/App.css8
-rw-r--r--source/moduleManager.js94
5 files changed, 53 insertions, 59 deletions
diff --git a/biblez.appcache b/biblez.appcache
index 66aa58e..6f5e9c0 100644
--- a/biblez.appcache
+++ b/biblez.appcache
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# v12 - 2014-04-15
+# v13 - 2014-04-16
CACHE:
icon.png
index.html
diff --git a/manifest.deploy b/manifest.deploy
index 101357b..5094c25 100644
--- a/manifest.deploy
+++ b/manifest.deploy
@@ -1,6 +1,6 @@
{
"name": "BibleZ",
- "version": "1.3.4",
+ "version": "1.3.5",
"description": "BibleZ is an easy to use offline bible reader app for your FirefoxOS device! Enjoy the full bible at your fingertips. <b>Features:</b> <ul><li>many available bibles in different languages (e.g. ESV, KJV, NET (free version), ...)</li><li>notes</li><li>bookmarks</li><li>highlights</li><li>history of last read scriptures</li><li>no internet connection required (only for downloading modules)</li></ul> BibleZ is based on the SWORD Project (http://crosswire.org) and licenced under GPLv3. If you have any problems with this app just send an eMail to <a href:mailto:info@zefanjas.de>info@zefanjas.de</a>!",
"launch_path": "/index.html",
"icons": {
@@ -22,4 +22,4 @@
"description": "Required to download CrossWire's bible modules"
}
}
-} \ No newline at end of file
+}
diff --git a/manifest.desktop b/manifest.desktop
index a1d9c5c..d5befac 100644
--- a/manifest.desktop
+++ b/manifest.desktop
@@ -1,6 +1,6 @@
{
"name": "BibleZ",
- "version": "1.3.4",
+ "version": "1.3.5",
"description": "BibleZ is an easy to use offline bible reader app for your Firefox! Enjoy the full bible at your fingertips. <b>Features:</b> <ul><li>many available bibles in different languages (e.g. ESV, KJV, NET (free version), ...)</li><li>notes</li><li>bookmarks</li><li>highlights</li><li>history of last read scriptures</li><li>no internet connection required (only for downloading modules)</li></ul> BibleZ is based on the SWORD Project (http://crosswire.org) and licenced under GPLv3. If you have any problems with this app just send an eMail to <a href:mailto:info@zefanjas.de>info@zefanjas.de</a>!",
"launch_path": "/biblez-ng/app/index.html",
"icons": {
@@ -17,4 +17,4 @@
},
"default_locale": "en",
"appcache_path": "/biblez-ng/app/biblez.appcache"
-} \ No newline at end of file
+}
diff --git a/source/App.css b/source/App.css
index a18e106..961beb4 100644
--- a/source/App.css
+++ b/source/App.css
@@ -10,8 +10,8 @@
.app-panels > * {
width: 320px;
background-color: #EAEAEA;
- border-left: 1px solid #000;
- /* box-shadow: -4px -4px 4px rgba(0,0,0,0.3); */
+ /*border-left: 1px solid #000; */
+ box-shadow: -4px -4px 4px rgba(0,0,0,0.3);
}
/* on small devices, make each panel fit to the app width */
@@ -119,6 +119,10 @@
width: 50px;
}
+.list-selected {
+ background-color: #c4e3fe;
+}
+
.content-container {
margin: 10px;
}
diff --git a/source/moduleManager.js b/source/moduleManager.js
index 77cb32f..118e199 100644
--- a/source/moduleManager.js
+++ b/source/moduleManager.js
@@ -17,7 +17,7 @@ enyo.kind({
{name: "panelLang", kind: "enyo.FittableRows", components: [
{classes: "center", components: [{kind: "onyx.Spinner", name: "spinner", classes: "onyx-light center"}]},
{name: "langList", kind: "List", fit: true, onSetupItem: "setupLangItem", components: [
- {classes: "item", ontap: "handleLanguage", components: [
+ {name: "langItem", classes: "item", ontap: "handleLanguage", components: [
{kind: "enyo.FittableColumns", components: [
{name: "langShort", classes: "item-left"},
{name: "langName", style: "font-style: italic;"}
@@ -28,7 +28,7 @@ enyo.kind({
]},
{name: "panelModules", kind: "enyo.FittableRows", components: [
{name: "modList", kind: "List", fit: true, onSetupItem: "setupModItem", components: [
- {classes: "item", ontap: "handleModule", components: [
+ {name: "modItem", classes: "item", ontap: "handleModule", components: [
{name: "modName"}
]}
]}
@@ -37,7 +37,6 @@ enyo.kind({
{kind: enyo.Scroller, fit: true, components: [
{name: "detailsContainer", showing: false, classes: "content-container", components: [
{name: "detailsName", classes: "title"},
- //{kind: "onyx.ProgressBar", name: "progressBar", progress: 0, showing: false, showStripes: false},
{kind: "onyx.Button", ontap: "installModule", name: "btnInstall", classes: "onyx-affirmative", content: $L("Install Module"), style: "margin-left: 10px;"},
{kind: "onyx.Button", ontap: "removeModule", name: "btnRemove", showing: false, classes: "onyx-negative", content: $L("Remove Module"), style: "margin-left: 10px;"},
{name: "detailsDescription", allowHtml: true, classes: "nice-padding"}
@@ -50,7 +49,7 @@ enyo.kind({
{},
{name: "repoPicker", kind: "onyx.Picker", onSelect: "handleRepoChange"}
]},
- {kind: "onyx.ProgressBar", name: "progressBar", progress: 0, showing: false, showStripes: false, fit: true}
+ {kind: "onyx.ProgressBar", name: "progressBar", progress: 0, showing: false, showStripes: false, animateStripes: true, fit: true}
]}
],
@@ -193,13 +192,7 @@ enyo.kind({
//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);
+ this.handleGotRemoteModules(allModules, inModules, inRepo);
} else {
this.handleError((inError.message) ? inError.message : inError);
@@ -211,16 +204,9 @@ enyo.kind({
xhr.response(this, function (inSender, inModules) {
inModules = api.cleanArray(inModules).sort(api.dynamicSortMultiple("Lang", "moduleKey"));
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);
+ this.handleGotRemoteModules(allModules, inModules, inRepo);
});
xhr.error(this, function (inSender, inResponse) {
- //console.log(inSender, inResponse);
this.handleError({message: "Couldn't download Modules!"});
});
}
@@ -235,6 +221,16 @@ enyo.kind({
},
+ handleGotRemoteModules: function(allModules, inModules, inRepo) {
+ 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);
+ },
+
prepareLangList: function (inModules) {
this.$.spinner.hide();
this.lang = [];
@@ -248,7 +244,7 @@ enyo.kind({
}));
this.$.panelLang.reflow();
this.$.langList.setCount(this.lang.length);
- this.$.langList.refresh();
+ this.$.langList.reset();
},
@@ -257,7 +253,7 @@ enyo.kind({
var data = this.lang[inEvent.index];
this.$.langShort.setContent(data.lang);
this.$.langName.setContent(languages[data.lang]);
- //this.$.index.setContent(inEvent.index);
+ this.$.langItem.addRemoveClass("list-selected", inSender.isSelected(inEvent.index));
},
handleLanguage: function(inSender, inEvent) {
@@ -270,13 +266,14 @@ enyo.kind({
this.langModules.push(module);
}));
this.$.modList.setCount(this.langModules.length);
- this.$.modList.refresh();
+ this.$.modList.reset();
},
// Module List //
setupModItem: function (inSender, inEvent) {
var data = this.langModules[inEvent.index];
this.$.modName.setContent(data.Description);
+ this.$.modItem.addRemoveClass("list-selected", inSender.isSelected(inEvent.index));
},
handleModule: function (inSender, inEvent) {
@@ -303,26 +300,14 @@ enyo.kind({
this.$.progressBar.show();
this.$.bottomTB.render();
if(enyo.platform.firefoxOS) {
- sword.installMgr.installModule(this.currentModule.url, enyo.bind(this, function (inError, inModule) {
- if (!inError) {
- this.doInstalled();
- this.getInstalledModules();
- this.$.btnInstall.hide();
- this.$.btnRemove.show();
- } else {
- console.log(inError);
- this.handleError(inError);
- this.$.btnInstall.show();
- this.$.btnRemove.hide();
- }
- //console.log(inError, inModule);
-
-
- }),
+ this.$.progressBar.setShowStripes(false);
+ sword.installMgr.installModule(this.currentModule.url,
+ enyo.bind(this, this.handleInstalled),
enyo.bind(this, function (inEvent) {
this.$.progressBar.animateProgressTo(inEvent.loaded/inEvent.total*100);
}));
} else {
+ this.$.progressBar.setShowStripes(true);
var xhr = new XMLHttpRequest({mozSystem: true, mozAnon: true});
var url = "http://zefanjas.de/apps/biblezGetModule.php?modKey="+this.currentModule.moduleKey+"&type="+this.currentRepo.type;
xhr.open('GET', url, true);
@@ -331,25 +316,13 @@ enyo.kind({
//console.log(xhr.readyState, evt, xhr.status);
if (xhr.readyState == 4) {
if(xhr.status === 200)
- sword.installMgr.installModule(xhr.response, enyo.bind(this, function (inError, inModule) {
- if (!inError) {
- this.doInstalled();
- this.getInstalledModules();
- this.$.btnInstall.hide();
- this.$.btnRemove.show();
- } else {
- this.handleError((inError.message) ? inError.message : inError);
- }
- this.$.progressBar.hide();
- this.$.progressBar.setProgress(0);
- this.$.btnInstall.setDisabled(false);
- }));
+ sword.installMgr.installModule(xhr.response, enyo.bind(this, this.handleInstalled));
else
this.handleError({message: "Couldn't download module.", error: xhr.status});
}
});
xhr.onprogress = enyo.bind(this, function (inEvent) {
- this.$.progressBar.animateProgressTo(inEvent.loaded/4000000*100);
+ this.$.progressBar.animateProgressTo(100);
});
xhr.onerror = enyo.bind(this, function (inError) {
this.handleError({message: "Couldn't download Module!"});
@@ -361,6 +334,23 @@ enyo.kind({
},
+ handleInstalled: function (inError, inModule) {
+ if (!inError) {
+ this.doInstalled();
+ this.getInstalledModules();
+ this.$.btnInstall.hide();
+ this.$.btnRemove.show();
+ } else {
+ console.log(inError);
+ this.handleError(inError);
+ this.$.btnInstall.show();
+ this.$.btnRemove.hide();
+ }
+ this.$.progressBar.hide();
+ this.$.progressBar.setProgress(0);
+ this.$.btnInstall.setDisabled(false);
+ },
+
removeModule: function (inSender, inEvent) {
sword.installMgr.removeModule(this.currentModule.moduleKey, enyo.bind(this, function (inError) {
if(!inError) {