Comparing version 0.3.27 to 0.3.28
@@ -7,4 +7,2 @@ "use strict"; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -35,3 +33,3 @@ | ||
// Dom events to listen for | ||
var EVENTS = ["keydown", "keyup", "keypressed", "mouseup", "mousedown", "click", "touchend", "touchstart"]; | ||
var EVENTS = ["keydown", "keyup", "keypressed", "mouseup", "mousedown", "click", "touchend", "touchstart", "markClicked"]; | ||
@@ -825,2 +823,4 @@ var Contents = function () { | ||
value: function highlight(cfiRange) { | ||
var _this3 = this; | ||
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -839,2 +839,7 @@ var cb = arguments[2]; | ||
var h = this.pane.addMark(m); | ||
h.addEventListener("click", function () { | ||
_this3.emit("markClicked", cfiRange, data); | ||
}); | ||
if (cb) { | ||
@@ -848,2 +853,4 @@ h.element.addEventListener("click", cb); | ||
value: function underline(cfiRange) { | ||
var _this4 = this; | ||
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -862,2 +869,7 @@ var cb = arguments[2]; | ||
var h = this.pane.addMark(m); | ||
h.addEventListener("click", function () { | ||
_this4.emit("markClicked", cfiRange, data); | ||
}); | ||
if (cb) { | ||
@@ -871,2 +883,4 @@ h.element.addEventListener("click", cb); | ||
value: function mark(cfiRange) { | ||
var _this5 = this; | ||
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -885,14 +899,16 @@ var cb = arguments[2]; | ||
if (data) { | ||
Object.entries(data).forEach(function (_ref) { | ||
var _ref2 = _slicedToArray(_ref, 2), | ||
key = _ref2[0], | ||
val = _ref2[1]; | ||
parent.dataset[key] = val; | ||
Object.keys(data).forEach(function (key) { | ||
parent.dataset[key] = data[key]; | ||
}); | ||
} | ||
parent.addEventListener("click", function () { | ||
_this5.emit("markClicked", cfiRange, data); | ||
}); | ||
if (cb) { | ||
parent.addEventListener("click", cb); | ||
} | ||
return parent; | ||
} | ||
@@ -899,0 +915,0 @@ }, { |
{ | ||
"name": "epubjs", | ||
"version": "0.3.27", | ||
"version": "0.3.28", | ||
"description": "Parse and Render Epubs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,3 +9,3 @@ import EventEmitter from "event-emitter"; | ||
// Dom events to listen for | ||
const EVENTS = ["keydown", "keyup", "keypressed", "mouseup", "mousedown", "click", "touchend", "touchstart"]; | ||
const EVENTS = ["keydown", "keyup", "keypressed", "mouseup", "mousedown", "click", "touchend", "touchstart", "markClicked"]; | ||
@@ -771,2 +771,7 @@ class Contents { | ||
let h = this.pane.addMark(m); | ||
h.addEventListener("click", () => { | ||
this.emit("markClicked", cfiRange, data); | ||
}); | ||
if (cb) { | ||
@@ -789,2 +794,7 @@ h.element.addEventListener("click", cb); | ||
let h = this.pane.addMark(m); | ||
h.addEventListener("click", () => { | ||
this.emit("markClicked", cfiRange, data); | ||
}); | ||
if (cb) { | ||
@@ -807,7 +817,10 @@ h.element.addEventListener("click", cb); | ||
if (data) { | ||
Object.entries(data).forEach(([key, val]) => { | ||
parent.dataset[key] = val; | ||
Object.keys(data).forEach((key) => { | ||
parent.dataset[key] = data[key]; | ||
}); | ||
} | ||
parent.addEventListener("click", () => { | ||
this.emit("markClicked", cfiRange, data); | ||
}); | ||
@@ -818,2 +831,3 @@ if (cb) { | ||
return parent; | ||
} | ||
@@ -820,0 +834,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
37217
2210349