aboutsummaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorzefanja <zefanja@freenet.de>2014-01-11 14:32:43 +0700
committerzefanja <zefanja@freenet.de>2014-01-11 14:32:43 +0700
commite169e6722d23eb1053d3c656d3914ca8171048c5 (patch)
tree05b94817e58a4ef35caff69315d40869f7903df1 /source
parent86c1fda7f74cea6ebe02f63e8f105399b537264c (diff)
downloadbiblez-ng-e169e6722d23eb1053d3c656d3914ca8171048c5.tar.gz
* fixes #5
* added new options to the preferences
Diffstat (limited to 'source')
-rw-r--r--source/App.css43
-rw-r--r--source/main.js65
-rw-r--r--source/popup.js22
-rw-r--r--source/settings.js23
4 files changed, 116 insertions, 37 deletions
diff --git a/source/App.css b/source/App.css
index 74c440b..87c4133 100644
--- a/source/App.css
+++ b/source/App.css
@@ -78,6 +78,19 @@
transition: background-color 500ms linear;
}
+.sword-cross-reference {
+ font-size: 0.8em;
+}
+
+.sword-cross-reference a {
+ text-decoration: none;
+}
+
+.sword-footnote {
+ text-decoration: none;
+
+}
+
/* MODULE MANAGER */
.item {
@@ -175,16 +188,6 @@
color: #010101;
}
-@media all and (max-width: 800px) {
- .verse-number {
- font-weight: bold;
- font-size: 1.2em;
- line-height: .9em;
- text-decoration: none;
- color: #010101;
- }
-}
-
h3, h1 {
font-size: 1.3em;
}
@@ -225,7 +228,8 @@ h3, h1 {
}
.note-popup {
- max-width: 300px;
+ max-width: 500px;
+ max-height: 300px;
}
/* DATA VIEW */
@@ -246,4 +250,21 @@ h3, h1 {
.main-toolbar {
padding: 5px;
+}
+
+/* SMALL SCREENS */
+@media all and (max-width: 800px) {
+ .verse-number {
+ font-weight: bold;
+ font-size: 1.2em;
+ line-height: .9em;
+ text-decoration: none;
+ color: #010101;
+ }
+
+ .note-popup {
+ max-width: 300px;
+ max-height: 300px;
+ }
+
} \ No newline at end of file
diff --git a/source/main.js b/source/main.js
index 0d74ecf..1b162de 100644
--- a/source/main.js
+++ b/source/main.js
@@ -19,6 +19,7 @@ enyo.kind({
{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"},
+ {name: "footnotePopup", kind: "biblez.footnotePopup"},
{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"}
@@ -106,6 +107,7 @@ enyo.kind({
history: [],
panelIndex: 2,
settings: {id: "settings"},
+ footnotes: {},
create: function () {
this.inherited(arguments);
@@ -142,7 +144,7 @@ enyo.kind({
api.get("settings", enyo.bind(this, function(inError, inSettings) {
if(!inError) {
this.settings = (inSettings) ? inSettings: this.settings;
- if(inEvent.setting === "linebreak")
+ if(inEvent.setting === "linebreak" || inEvent.setting === "footnotes" || inEvent.setting === "headings")
this.handlePassage();
} else {
this.handleError("Couldn't load settings!");
@@ -254,24 +256,31 @@ enyo.kind({
this.$.btnPassage.setContent(this.currentPassage.label);
//Adjust the TB Icons
this.$.topTB.reflow();
-
- this.currentModule.renderText(this.currentPassage.osis, {oneVersePerLine: this.settings.linebreak ? this.settings.linebreak : false}, enyo.bind(this, function (inError, inText) {
- this.$.spinner.stop();
- if(!inError) {
- this.$.main.setContent(inText);
- if (verseNumber < 2)
- this.$.verseScroller.scrollToTop();
- else {
- var e = enyo.dom.byId(this.currentPassage.osis+"."+verseNumber);
- this.$.verseScroller.scrollToNode(e);
- e.style.backgroundColor = "rgba(210,105,30,0.25)";
- //e.className = e.className + " active-verse";
- }
- this.handleUserData(this.currentPassage.osis);
- this.renderHistory();
- } else
- this.handleError(inError.message);
- }));
+ this.currentModule.renderText(this.currentPassage.osis,
+ {
+ oneVersePerLine: this.settings.linebreak ? this.settings.linebreak : false,
+ footnotes: this.settings.footnotes ? this.settings.footnotes : false,
+ headings: this.settings.hasOwnProperty("headings") ? this.settings.headings : true,
+ },
+ enyo.bind(this, function (inError, inResult) {
+ this.$.spinner.stop();
+ if(!inError) {
+ this.footnotes = inResult.footnotes;
+ this.$.main.setContent(inResult.text);
+ if (verseNumber < 2)
+ this.$.verseScroller.scrollToTop();
+ else {
+ var e = enyo.dom.byId(this.currentPassage.osis+"."+verseNumber);
+ this.$.verseScroller.scrollToNode(e);
+ e.style.backgroundColor = "rgba(210,105,30,0.25)";
+ //e.className = e.className + " active-verse";
+ }
+ this.handleUserData(this.currentPassage.osis);
+ this.renderHistory();
+ } else
+ this.handleError(inError.message);
+ })
+ );
},
renderHistory: function (inSender, inEvent) {
@@ -469,6 +478,24 @@ enyo.kind({
} else
this.handleError(inError);
}));
+ } else if (attributes.type === "footnote") {
+ this.footnotes[attributes.osisRef].forEach(enyo.bind(this, function(item) {
+ if(item.n === attributes.n)
+ this.$.footnotePopup.setText(item.note);
+ }));
+ this.$.footnotePopup.showAtEvent(inEvent);
+ } else if (attributes.type === "crossReference") {
+ this.currentModule.renderText(attributes.osisRef, {oneVersePerLine: false, footnotes: false, headings: false},
+ enyo.bind(this, function (inError, inResult) {
+ if(!inError) {
+ this.$.footnotePopup.setText(inResult.text);
+ this.$.footnotePopup.showAtEvent(inEvent);
+ } else {
+ this.$.footnotePopup.hide();
+ this.handleError(inError.message);
+ }
+ })
+ );
}
return true;
},
diff --git a/source/popup.js b/source/popup.js
index 1e93dfc..3131deb 100644
--- a/source/popup.js
+++ b/source/popup.js
@@ -190,7 +190,6 @@ enyo.kind({
enyo.kind({
name: "biblez.notePopup",
kind: "onyx.Popup",
- classes: "note-popup",
events: {
onEdit: ""
},
@@ -199,7 +198,7 @@ enyo.kind({
text: ""
},
components:[
- {kind: "enyo.Scroller", touch: true, fit: true, components: [
+ {kind: "enyo.Scroller", touch: true, fit: true, classes: "note-popup", components: [
{name: "noteText", content: "", allowHtml: true, ontap: "handleTap"}
]}
],
@@ -211,4 +210,23 @@ enyo.kind({
handleTap: function (inSender, inEvent) {
this.doEdit({osisRef: this.osisRef});
}
+});
+
+// FOOTNOTE VIEW POPUP //
+enyo.kind({
+ name: "biblez.footnotePopup",
+ kind: "onyx.Popup",
+ floating: true,
+ published: {
+ text: ""
+ },
+ components:[
+ {kind: "enyo.Scroller", touch: true, fit: true, classes: "note-popup", components: [
+ {name: "noteText", content: "", allowHtml: true}
+ ]}
+ ],
+
+ textChanged: function () {
+ this.$.noteText.setContent(this.text);
+ }
}); \ No newline at end of file
diff --git a/source/settings.js b/source/settings.js
index 9444e2c..c2b532c 100644
--- a/source/settings.js
+++ b/source/settings.js
@@ -18,8 +18,17 @@ enyo.kind({
{kind: "onyx.GroupboxHeader", content: $L("General")},
{kind: "enyo.FittableColumns", classes: "settings-row", components: [
{content: $L("Enable Linebreak"), classes: "settings-item", fit: true},
- {name: "tbLinebreak", kind: "onyx.ToggleButton", onChange: "toggleLinebreak"}
+ {name: "tbLinebreak", key: "linebreak", kind: "onyx.ToggleButton", onChange: "handleSettings"}
+ ]},
+ {kind: "enyo.FittableColumns", classes: "settings-row", components: [
+ {content: $L("Enable Headings"), classes: "settings-item", fit: true},
+ {name: "tbHeadings", key: "headings", kind: "onyx.ToggleButton", onChange: "handleSettings"}
+ ]},
+ {kind: "enyo.FittableColumns", classes: "settings-row", components: [
+ {content: $L("Enable Footnotes"), classes: "settings-item", fit: true},
+ {name: "tbFootnote", key: "footnotes", kind: "onyx.ToggleButton", onChange: "handleSettings"}
]}
+
]},
{tag: "br"},
/*{kind: "onyx.Groupbox", components: [
@@ -42,18 +51,22 @@ enyo.kind({
api.get("settings", enyo.bind(this, function(inError, inSettings) {
if(!inError) {
if(inSettings) {
- this.$.tbLinebreak.value = inSettings.linebreak ? true : false;
+ this.$.tbLinebreak.value = inSettings.hasOwnProperty("linebreak") ? inSettings.linebreak : false;
this.$.tbLinebreak.updateVisualState();
+ this.$.tbHeadings.value = inSettings.hasOwnProperty("headings") ? inSettings.headings : true;
+ this.$.tbHeadings.updateVisualState();
+ this.$.tbFootnote.value = inSettings.hasOwnProperty("footnotes") ? inSettings.footnotes : false;
+ this.$.tbFootnote.updateVisualState();
}
}
}));
},
- toggleLinebreak: function (inSender, inEvent) {
- api.putSetting("linebreak", inSender.getValue(), enyo.bind(this, function (inError, inId) {
+ handleSettings: function (inSender, inEvent) {
+ api.putSetting(inSender.key, inSender.getValue(), enyo.bind(this, function (inError, inId) {
if(!inError)
- this.doChange({setting: "linebreak", value: inSender.getValue()});
+ this.doChange({setting: inSender.key, value: inSender.getValue()});
}));
},