New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

epubjs

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epubjs - npm Package Compare versions

Comparing version 0.3.8 to 0.3.9

78

lib/navigation.js

@@ -92,3 +92,59 @@ "use strict";

}
}, {
key: "createTocItem",
value: function createTocItem(linkElement, id) {
var list = [],
tocLinkElms = linkElement.childNodes,
tocLinkArry = Array.prototype.slice.call(tocLinkElms);
var index = id ? id : 0;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = tocLinkArry[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var linkElm = _step.value;
if (linkElm.nodeName === 'li') {
var tocLink = (0, _core.qs)(linkElm, 'a'),
tocLinkData = {
id: -1,
href: tocLink.getAttribute('href'),
label: tocLink.textContent,
parent: null
},
subItemElm = (0, _core.qs)(linkElm, 'ol');
index++;
tocLinkData.id = index;
if (id) {
tocLinkData.parent = id;
}
list.push(tocLinkData);
if (subItemElm) {
var subitems = this.createTocItem(subItemElm, index);
if (subitems && subitems.length > 0) {
index = index + subitems.length;
list = list.concat(subitems);
}
}
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return list;
}
/**

@@ -105,23 +161,3 @@ * Parse from a Epub > 3.0 Nav

var navElement = (0, _core.querySelectorByType)(navHtml, "nav", "toc");
var navItems = navElement ? (0, _core.qsa)(navElement, "li") : [];
var length = navItems.length;
var i;
var toc = {};
var list = [];
var item, parent;
if (!navItems || length === 0) return list;
for (i = 0; i < length; ++i) {
item = this.navItem(navItems[i]);
toc[item.id] = item;
if (!item.parent) {
list.push(item);
} else {
parent = toc[item.parent];
parent.subitems.push(item);
}
}
return list;
return this.createTocItem((0, _core.qs)(navElement, "ol"));
}

@@ -128,0 +164,0 @@

@@ -680,3 +680,3 @@ "use strict";

contents.addStylesheetRules([["img", ["max-width", this._layout.columnWidth + "px"], ["max-height", this._layout.height + "px"]]]);
contents.addStylesheetRules([["img", ["max-width", this._layout.columnWidth + "px; !important"], ["max-height", this._layout.height + "px; !important"], ["object-fit", "contain"], ["page-break-inside", "avoid"]]]);
return new Promise(function (resolve, reject) {

@@ -683,0 +683,0 @@ // Wait to apply

{
"name": "epubjs",
"version": "0.3.8",
"version": "0.3.9",
"description": "Parse and Render Epubs",

@@ -16,7 +16,7 @@ "main": "lib/index.js",

"lint": "./node_modules/.bin/eslint -c .eslintrc.js src; exit 0",
"start": "webpack-dev-server --inline --d",
"build": "webpack --progress",
"minify": "NODE_ENV=production webpack --progress",
"legacy": "NODE_ENV=production LEGACY=true webpack --progress",
"compile": "babel --optional runtime -d lib/ src/",
"start": "./node_modules/.bin/webpack-dev-server --inline --d",
"build": "./node_modules/.bin/webpack --progress",
"minify": "NODE_ENV=production npm run build",
"legacy": "NODE_ENV=production LEGACY=true npm run build",
"compile": "./node_modules/.bin/babel --optional runtime -d lib/ src/",
"prepublish": "npm run compile && npm run build && npm run minify && npm run legacy"

@@ -23,0 +23,0 @@ },

@@ -72,2 +72,37 @@ import {qs, qsa, querySelectorByType} from "./utils/core";

createTocItem(linkElement, id) {
var list = [],
tocLinkElms = linkElement.childNodes,
tocLinkArry = Array.prototype.slice.call(tocLinkElms);
var index = id ? id : 0;
for (var linkElm of tocLinkArry) {
if (linkElm.nodeName === 'li') {
var tocLink = qs(linkElm, 'a'),
tocLinkData = {
id: -1,
href: tocLink.getAttribute('href'),
label: tocLink.textContent,
parent: null
},
subItemElm = qs(linkElm, 'ol');
index++;
tocLinkData.id = index;
if (id) {
tocLinkData.parent = id;
}
list.push(tocLinkData);
if (subItemElm) {
var subitems = this.createTocItem(subItemElm, index);
if (subitems && subitems.length > 0) {
index = index + subitems.length;
list = list.concat(subitems);
}
}
}
}
return list;
}
/**

@@ -81,23 +116,3 @@ * Parse from a Epub > 3.0 Nav

var navElement = querySelectorByType(navHtml, "nav", "toc");
var navItems = navElement ? qsa(navElement, "li") : [];
var length = navItems.length;
var i;
var toc = {};
var list = [];
var item, parent;
if(!navItems || length === 0) return list;
for (i = 0; i < length; ++i) {
item = this.navItem(navItems[i]);
toc[item.id] = item;
if(!item.parent) {
list.push(item);
} else {
parent = toc[item.parent];
parent.subitems.push(item);
}
}
return list;
return this.createTocItem(qs(navElement, "ol"));
}

@@ -104,0 +119,0 @@

@@ -586,4 +586,6 @@ import EventEmitter from "event-emitter";

["img",
["max-width", (this._layout.columnWidth) + "px"],
["max-height", (this._layout.height) + "px"]
["max-width", (this._layout.columnWidth) + "px; !important"],
["max-height", (this._layout.height) + "px; !important"],
["object-fit", "contain"],
["page-break-inside", "avoid"]
]

@@ -590,0 +592,0 @@ ]);

@@ -7,3 +7,3 @@ var webpack = require("webpack");

var hostname = "localhost";
var port = "8080";
var port = 8080;
var enter = LEGACY ? {

@@ -10,0 +10,0 @@ "epub.legacy": ["babel-polyfill", "./libs/url/url.js", "./src/epub.js"]

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc