mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-09 17:04:39 +00:00
add more predefined styles
This commit is contained in:
parent
db77b562b1
commit
5cabb7a458
3 changed files with 72 additions and 3 deletions
|
@ -36,12 +36,81 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||||
var defaultStyles = [
|
var defaultStyles = [
|
||||||
{
|
{
|
||||||
title: 'Reddit Comments',
|
title: 'Reddit Comments',
|
||||||
url: 'reddit\.com\/r\/[^\/]+\/comments',
|
url: 'reddit\\.com\\/r\\/[^\\/]+\\/comments',
|
||||||
style: `.class {
|
style: `.class {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
`
|
||||||
|
},{
|
||||||
|
title: 'Wikipedia Article',
|
||||||
|
url: 'wikipedia\\.org\\/wiki\\/',
|
||||||
|
style: `#mw-navigation {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#footer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#mw-panel {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#mw-head {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
},{
|
||||||
|
title: 'YCombinator News Comments',
|
||||||
|
url: 'news\\.ycombinator\\.com\\/item\\?id=[0-9]+',
|
||||||
|
style: `#hnmain > tbody > tr:nth-child(1) > td > table {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.title, .storylink {
|
||||||
|
text-align: left;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.score {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.age {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.hnpast {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.togg {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.votelinks, .rank {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.votearrow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.yclinks {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
form {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
a.hnuser {
|
||||||
|
font-weight: bold;
|
||||||
|
color: black !important;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
.subtext > span, .subtext > a:not(:nth-child(2)) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
];
|
];
|
||||||
sendResponse({styles: defaultStyles});
|
sendResponse({styles: defaultStyles});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,7 +18,7 @@ var tmpIdsToNewCss = {};
|
||||||
var supportedCss = [
|
var supportedCss = [
|
||||||
'background-color',
|
'background-color',
|
||||||
'border', 'border-top', 'border-right', 'border-bottom', 'border-left',
|
'border', 'border-top', 'border-right', 'border-bottom', 'border-left',
|
||||||
'color', 'font',
|
'color', 'font', 'font-size', 'font-weight', 'font-family',
|
||||||
'letter-spacing', 'line-height',
|
'letter-spacing', 'line-height',
|
||||||
'list-style', 'outline',
|
'list-style', 'outline',
|
||||||
'padding', 'quotes',
|
'padding', 'quotes',
|
||||||
|
|
|
@ -35,7 +35,7 @@ function createStyleList(styles) {
|
||||||
var styleUrlRegex = null;
|
var styleUrlRegex = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
styleUrlRegex = new RegExp('.*' + styleUrl + '.*', 'i');
|
styleUrlRegex = new RegExp(styleUrl, 'i');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue