mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-11 18:04:41 +00:00
chrome & ff
This commit is contained in:
parent
2c4e0d023d
commit
a391509e5d
16 changed files with 404 additions and 8781 deletions
|
@ -1,40 +1,30 @@
|
|||
// var chapterHolder = document.getElementById('chapters');
|
||||
var list = document.getElementById('chapters');
|
||||
var title = localStorage.getItem('title');
|
||||
if (title === null) {
|
||||
title = [];
|
||||
} else {
|
||||
title = JSON.parse(title);
|
||||
}
|
||||
var allPages = getEbookPages();
|
||||
|
||||
for (var i = 0; i < title.length; i++) {
|
||||
console.log(allPages.length);
|
||||
|
||||
for (var i = 0; i < allPages.length; i++) {
|
||||
if (!allPages[i]) {
|
||||
continue;
|
||||
}
|
||||
var listItem = document.createElement('li');
|
||||
var label = document.createElement('span');
|
||||
label.innerHTML = title[i].title;
|
||||
label.innerHTML = allPages[i].title;
|
||||
listItem.appendChild(label);
|
||||
list.appendChild(listItem);
|
||||
}
|
||||
|
||||
|
||||
document.getElementById('closeButton').onclick = function () {
|
||||
chrome.tabs.query({
|
||||
currentWindow: true,
|
||||
active: true
|
||||
// Select active tab of the current window
|
||||
}, function(tab) {
|
||||
chrome.tabs.sendMessage(
|
||||
// Send a message to the content script
|
||||
tab[0].id, { line: 'countparas' }
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
browser.runtime.onMessage.addListener(function(request) {
|
||||
console.log('cccccc', request);
|
||||
|
||||
|
||||
});
|
||||
|
||||
document.getElementById('saveButton').onclick = function () {
|
||||
window.open(window.location, '_self').close();
|
||||
};
|
||||
|
||||
document.getElementById('saveButton').onclick = function () {
|
||||
try {
|
||||
buildEbook();
|
||||
// window.open(window.location, '_self').close();
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue