mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-15 03:39:51 +00:00
move default styles
This commit is contained in:
parent
9e3ed840fd
commit
ad1abc5f61
2 changed files with 14 additions and 11 deletions
|
@ -32,7 +32,18 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||||
if (request.type === 'get styles') {
|
if (request.type === 'get styles') {
|
||||||
chrome.storage.local.get('styles', function (data) {
|
chrome.storage.local.get('styles', function (data) {
|
||||||
if (!data || !data.styles) {
|
if (!data || !data.styles) {
|
||||||
sendResponse({styles: []});
|
// TODO move defaultStyles in a different file/location ?
|
||||||
|
var defaultStyles = [
|
||||||
|
{
|
||||||
|
title: 'reddit',
|
||||||
|
url: 'reddit.com',
|
||||||
|
style: `.class: {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
];
|
||||||
|
sendResponse({styles: defaultStyles});
|
||||||
} else {
|
} else {
|
||||||
sendResponse({styles: data.styles});
|
sendResponse({styles: data.styles});
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,7 @@ if (tmp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var allPagesRef = null;
|
var allPagesRef = null;
|
||||||
var allStyles = [{
|
var allStyles = [];
|
||||||
title: 'reddit',
|
|
||||||
url: 'reddit.com',
|
|
||||||
style: `
|
|
||||||
.class: {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
`
|
|
||||||
}];
|
|
||||||
var currentStyle = null;
|
var currentStyle = null;
|
||||||
var currentStyleIndex = -1;
|
var currentStyleIndex = -1;
|
||||||
|
|
||||||
|
@ -177,7 +169,7 @@ function showEditor() {
|
||||||
|
|
||||||
function createStyleList(allStylesTmp) {
|
function createStyleList(allStylesTmp) {
|
||||||
if (allStylesTmp && allStylesTmp.length > 0) {
|
if (allStylesTmp && allStylesTmp.length > 0) {
|
||||||
allStyles = allStyles.slice(0, 0).concat(allStylesTmp);
|
allStyles = allStyles.concat(allStylesTmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (existingStyles.hasChildNodes() && existingStyles.childElementCount > 1) {
|
while (existingStyles.hasChildNodes() && existingStyles.childElementCount > 1) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue