mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Fixed lint errors
This commit is contained in:
parent
82fb23daab
commit
2a387cc433
12 changed files with 3978 additions and 3974 deletions
7866
dist/epub.js
vendored
7866
dist/epub.js
vendored
File diff suppressed because it is too large
Load diff
6
dist/epub.min.js
vendored
6
dist/epub.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -332,13 +332,15 @@ EPUBJS.Continuous.prototype.trim = function(){
|
||||||
var above = this.views.slice(0, firstIndex);
|
var above = this.views.slice(0, firstIndex);
|
||||||
var below = this.views.slice(lastIndex+1);
|
var below = this.views.slice(lastIndex+1);
|
||||||
|
|
||||||
|
// Erase all but last above
|
||||||
for (var i = 0; i < above.length-1; i++) {
|
for (var i = 0; i < above.length-1; i++) {
|
||||||
this.erase(above[i], above);
|
this.erase(above[i], above);
|
||||||
};
|
}
|
||||||
|
|
||||||
for (var i = 1; i < below.length; i++) {
|
// Erase all except first below
|
||||||
this.erase(below[i]);
|
for (var j = 1; j < below.length; j++) {
|
||||||
};
|
this.erase(below[j]);
|
||||||
|
}
|
||||||
|
|
||||||
task.resolve();
|
task.resolve();
|
||||||
return task.promise;
|
return task.promise;
|
||||||
|
@ -559,7 +561,7 @@ EPUBJS.Continuous.prototype.currentLocation = function(){
|
||||||
var visible = this.visible();
|
var visible = this.visible();
|
||||||
var startPage, endPage;
|
var startPage, endPage;
|
||||||
|
|
||||||
var container = this.container.getBoundingClientRect()
|
var container = this.container.getBoundingClientRect();
|
||||||
|
|
||||||
if(visible.length === 1) {
|
if(visible.length === 1) {
|
||||||
return this.map.page(visible[0]);
|
return this.map.page(visible[0]);
|
||||||
|
@ -573,7 +575,7 @@ EPUBJS.Continuous.prototype.currentLocation = function(){
|
||||||
return {
|
return {
|
||||||
start: startPage.start,
|
start: startPage.start,
|
||||||
end: endPage.end
|
end: endPage.end
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
14
src/core.js
14
src/core.js
|
@ -448,16 +448,16 @@ EPUBJS.core.bounds = function(el) {
|
||||||
|
|
||||||
widthProps.forEach(function(prop){
|
widthProps.forEach(function(prop){
|
||||||
width += parseFloat(style[prop]) || 0;
|
width += parseFloat(style[prop]) || 0;
|
||||||
})
|
});
|
||||||
|
|
||||||
heightProps.forEach(function(prop){
|
heightProps.forEach(function(prop){
|
||||||
height += parseFloat(style[prop]) || 0;
|
height += parseFloat(style[prop]) || 0;
|
||||||
})
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
height: height,
|
height: height,
|
||||||
width: width
|
width: width
|
||||||
}
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -472,16 +472,16 @@ EPUBJS.core.borders = function(el) {
|
||||||
|
|
||||||
widthProps.forEach(function(prop){
|
widthProps.forEach(function(prop){
|
||||||
width += parseFloat(style[prop]) || 0;
|
width += parseFloat(style[prop]) || 0;
|
||||||
})
|
});
|
||||||
|
|
||||||
heightProps.forEach(function(prop){
|
heightProps.forEach(function(prop){
|
||||||
height += parseFloat(style[prop]) || 0;
|
height += parseFloat(style[prop]) || 0;
|
||||||
})
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
height: height,
|
height: height,
|
||||||
width: width
|
width: width
|
||||||
}
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ EPUBJS.core.windowBounds = function() {
|
||||||
bottom: height,
|
bottom: height,
|
||||||
width: width,
|
width: width,
|
||||||
height: height
|
height: height
|
||||||
}
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -509,4 +509,4 @@ EPUBJS.EpubCFI.prototype.isCfiString = function(target) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
|
@ -19,7 +19,7 @@ EPUBJS.Hook.prototype.register = function(func){
|
||||||
EPUBJS.Hook.prototype.trigger = function(){
|
EPUBJS.Hook.prototype.trigger = function(){
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
var context = this.context;
|
var context = this.context;
|
||||||
var promises = []
|
var promises = [];
|
||||||
|
|
||||||
this.hooks.forEach(function(task, i) {
|
this.hooks.forEach(function(task, i) {
|
||||||
var executing = task.apply(context, args);
|
var executing = task.apply(context, args);
|
||||||
|
|
16
src/map.js
16
src/map.js
|
@ -52,7 +52,7 @@ EPUBJS.Map.prototype.findRanges = function(view){
|
||||||
start: this.findStart(view.document.body, start, end),
|
start: this.findStart(view.document.body, start, end),
|
||||||
end: this.findEnd(view.document.body, start, end)
|
end: this.findEnd(view.document.body, start, end)
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
return columns;
|
return columns;
|
||||||
};
|
};
|
||||||
|
@ -68,7 +68,7 @@ EPUBJS.Map.prototype.findStart = function(root, start, end){
|
||||||
|
|
||||||
found = this.walk($el, function(node){
|
found = this.walk($el, function(node){
|
||||||
var left, right;
|
var left, right;
|
||||||
var elPos
|
var elPos;
|
||||||
var elRange;
|
var elRange;
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ EPUBJS.Map.prototype.findEnd = function(root, start, end){
|
||||||
found = this.walk($el, function(node){
|
found = this.walk($el, function(node){
|
||||||
|
|
||||||
var left, right;
|
var left, right;
|
||||||
var elPos
|
var elPos;
|
||||||
var elRange;
|
var elRange;
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ EPUBJS.Map.prototype.findEnd = function(root, start, end){
|
||||||
right = elPos.right;
|
right = elPos.right;
|
||||||
|
|
||||||
if(left > end && $prev) {
|
if(left > end && $prev) {
|
||||||
return $prev
|
return $prev;
|
||||||
} else if(right > end) {
|
} else if(right > end) {
|
||||||
return node;
|
return node;
|
||||||
} else {
|
} else {
|
||||||
|
@ -172,7 +172,7 @@ EPUBJS.Map.prototype.findTextStartRange = function(node, start, end){
|
||||||
|
|
||||||
prev = range;
|
prev = range;
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
return ranges[0];
|
return ranges[0];
|
||||||
};
|
};
|
||||||
|
@ -196,7 +196,7 @@ EPUBJS.Map.prototype.findTextEndRange = function(node, start, end){
|
||||||
|
|
||||||
prev = range;
|
prev = range;
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
// Ends before limit
|
// Ends before limit
|
||||||
return ranges[ranges.length-1];
|
return ranges[ranges.length-1];
|
||||||
|
@ -266,7 +266,7 @@ EPUBJS.Map.prototype.rangePairToCfiPair = function(section, rangePair){
|
||||||
return {
|
return {
|
||||||
start: startCfi,
|
start: startCfi,
|
||||||
end: endCfi
|
end: endCfi
|
||||||
}
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ EPUBJS.Map.prototype.rangeListToCfiList = function(view, columns){
|
||||||
|
|
||||||
map.push(cifPair);
|
map.push(cifPair);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
};
|
};
|
|
@ -192,7 +192,7 @@ EPUBJS.Paginate.prototype.currentLocation = function(){
|
||||||
var visible = this.visible();
|
var visible = this.visible();
|
||||||
var startA, startB, endA, endB;
|
var startA, startB, endA, endB;
|
||||||
var pageLeft, pageRight;
|
var pageLeft, pageRight;
|
||||||
var container = this.container.getBoundingClientRect()
|
var container = this.container.getBoundingClientRect();
|
||||||
|
|
||||||
if(visible.length === 1) {
|
if(visible.length === 1) {
|
||||||
startA = container.left - visible[0].position().left;
|
startA = container.left - visible[0].position().left;
|
||||||
|
@ -217,7 +217,7 @@ EPUBJS.Paginate.prototype.currentLocation = function(){
|
||||||
return {
|
return {
|
||||||
start: pageLeft.start,
|
start: pageLeft.start,
|
||||||
end: pageRight.end
|
end: pageRight.end
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,7 +10,7 @@ EPUBJS.Queue.prototype.enqueue = function() {
|
||||||
var deferred, promise;
|
var deferred, promise;
|
||||||
var queued;
|
var queued;
|
||||||
var task = [].shift.call(arguments);
|
var task = [].shift.call(arguments);
|
||||||
var args = arguments
|
var args = arguments;
|
||||||
|
|
||||||
// Handle single args without context
|
// Handle single args without context
|
||||||
// if(args && !Array.isArray(args)) {
|
// if(args && !Array.isArray(args)) {
|
||||||
|
|
|
@ -237,14 +237,14 @@ EPUBJS.Rendition.prototype.render = function(view, show) {
|
||||||
return this.hooks.layout.trigger(view, this);
|
return this.hooks.layout.trigger(view, this);
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.then(function(){
|
.then(function(){
|
||||||
return view.display()
|
return view.display();
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.then(function(){
|
.then(function(){
|
||||||
return this.hooks.render.trigger(view, this);
|
return this.hooks.render.trigger(view, this);
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.then(function(){
|
.then(function(){
|
||||||
|
|
||||||
if(show != false && this.hidden === false) {
|
if(show !== false && this.hidden === false) {
|
||||||
this.q.enqueue(function(view){
|
this.q.enqueue(function(view){
|
||||||
view.show();
|
view.show();
|
||||||
}, view);
|
}, view);
|
||||||
|
@ -516,7 +516,7 @@ EPUBJS.Rendition.prototype.visible = function(){
|
||||||
visible.push(view);
|
visible.push(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
return visible;
|
return visible;
|
||||||
|
|
||||||
|
@ -542,7 +542,7 @@ EPUBJS.Rendition.prototype.displayed = function(){
|
||||||
if(view.displayed){
|
if(view.displayed){
|
||||||
displayed.push(view);
|
displayed.push(view);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
return displayed;
|
return displayed;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ EPUBJS.Rendition.prototype.show = function(){
|
||||||
if(view.displayed){
|
if(view.displayed){
|
||||||
view.show();
|
view.show();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
this.hidden = false;
|
this.hidden = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ EPUBJS.Rendition.prototype.hide = function(){
|
||||||
if(view.displayed){
|
if(view.displayed){
|
||||||
view.hide();
|
view.hide();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
this.hidden = true;
|
this.hidden = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ EPUBJS.Spine.prototype.load = function(_package) {
|
||||||
|
|
||||||
|
|
||||||
if(manifestItem.properties.length){
|
if(manifestItem.properties.length){
|
||||||
item.properties.push.apply(item.properties, manifestItem.properties)
|
item.properties.push.apply(item.properties, manifestItem.properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ EPUBJS.View.prototype.expand = function(force) {
|
||||||
// Otherwise assume content height hasn't changed
|
// Otherwise assume content height hasn't changed
|
||||||
width = this._contentWidth;
|
width = this._contentWidth;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// Expand Vertically
|
// Expand Vertically
|
||||||
if(width && !height) {
|
if(width && !height) {
|
||||||
|
@ -190,7 +190,7 @@ EPUBJS.View.prototype.contentWidth = function(min) {
|
||||||
// Reset iframe size back
|
// Reset iframe size back
|
||||||
this.iframe.style.width = prev;
|
this.iframe.style.width = prev;
|
||||||
return width;
|
return width;
|
||||||
}
|
};
|
||||||
|
|
||||||
EPUBJS.View.prototype.contentHeight = function(min) {
|
EPUBJS.View.prototype.contentHeight = function(min) {
|
||||||
var prev;
|
var prev;
|
||||||
|
@ -201,7 +201,7 @@ EPUBJS.View.prototype.contentHeight = function(min) {
|
||||||
height = this.document.body.scrollHeight;
|
height = this.document.body.scrollHeight;
|
||||||
this.iframe.style.height = prev;
|
this.iframe.style.height = prev;
|
||||||
return height;
|
return height;
|
||||||
}
|
};
|
||||||
|
|
||||||
EPUBJS.View.prototype.textWidth = function() {
|
EPUBJS.View.prototype.textWidth = function() {
|
||||||
var width;
|
var width;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue