1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
enyo.kind({
name: "biblez.versePopup",
kind: "onyx.Popup",
classes: "verse-popup",
events: {
onBookmark: "",
onNote: "",
onHighlight: ""
},
published: {
osisRef: null,
bmExists: false,
noteExists: false,
bmId: null,
noteId: null,
hlId: null
},
components: [
{kind: "enyo.FittableRows", components: [
{kind: "enyo.FittableColumns", components: [
{name: "bmLabel", content: $L("Bookmark"), classes: "verse-popup-cell cell-top-left", ontap: "handleBookmark"},
{name: "noteLabel", content: $L("Note"), classes: "verse-popup-cell cell-top-right", ontap: "handleNote"},
]},
{kind: "enyo.FittableColumns", components: [
{content: $L("Highlight"), classes: "verse-popup-cell", ontap: "handleHighlight"},
{content: $L("Copy&Share"), classes: "verse-popup-cell cell-bottom-right", ontap: "handleCopyShare"},
]}
]}
],
setLabels: function () {
if(this.bmExists)
this.$.bmLabel.setContent($L("Bookmark") + " - ");
else
this.$.bmLabel.setContent($L("Bookmark") + " + ");
},
handleBookmark: function (inSender, inEvent) {
this.hide();
if (!this.bmExists)
api.putBookmark({osisRef: this.osisRef}, enyo.bind(this, function (inError, inId) {
if(!inError) {
this.doBookmark({action: "add"});
} else
console.log(inError);
}));
else
api.removeBookmark({id: this.bmId, osisRef: this.osisRef}, enyo.bind(this, function (inError) {
if(!inError) {
this.doBookmark({action: "remove", osisRef: this.osisRef});
} else
console.log(inError);
}));
}
});
|