mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-08 00:19:09 +00:00
misc
This commit is contained in:
parent
f7705a8660
commit
e85fc7b13f
1 changed files with 7 additions and 5 deletions
|
@ -219,11 +219,11 @@ function getSelectedNodes() {
|
|||
return document.selection.createRange();
|
||||
}
|
||||
var selection = window.getSelection();
|
||||
if (selection.rangeCount > 0) {
|
||||
var range = selection.getRangeAt(0);
|
||||
var selectionContents = range.cloneContents();
|
||||
return selectionContents;
|
||||
var docfrag = [];
|
||||
for (var i = 0; i < selection.rangeCount; i++) {
|
||||
docfrag.push(selection.getRangeAt(i).cloneContents());
|
||||
}
|
||||
return docfrag;
|
||||
}
|
||||
|
||||
/////
|
||||
|
@ -322,7 +322,9 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
|||
tmpContent = getContent(pageSrc);
|
||||
} else if (request.type === 'extract-selection') {
|
||||
pageSrc = getSelectedNodes();
|
||||
tmpContent = getContent(pageSrc);
|
||||
pageSrc.forEach(function (page) {
|
||||
tmpContent += getContent(page);
|
||||
});
|
||||
}
|
||||
|
||||
if (tmpContent.trim() === '') {
|
||||
|
|
Loading…
Add table
Reference in a new issue