add more predefined styles

This commit is contained in:
Alex Adam 2017-09-06 21:47:33 +03:00
parent db77b562b1
commit 5cabb7a458
3 changed files with 72 additions and 3 deletions

View file

@ -36,12 +36,81 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
var defaultStyles = [
{
title: 'Reddit Comments',
url: 'reddit\.com\/r\/[^\/]+\/comments',
url: 'reddit\\.com\\/r\\/[^\\/]+\\/comments',
style: `.class {
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});
} else {

View file

@ -18,7 +18,7 @@ var tmpIdsToNewCss = {};
var supportedCss = [
'background-color',
'border', 'border-top', 'border-right', 'border-bottom', 'border-left',
'color', 'font',
'color', 'font', 'font-size', 'font-weight', 'font-family',
'letter-spacing', 'line-height',
'list-style', 'outline',
'padding', 'quotes',

View file

@ -35,7 +35,7 @@ function createStyleList(styles) {
var styleUrlRegex = null;
try {
styleUrlRegex = new RegExp('.*' + styleUrl + '.*', 'i');
styleUrlRegex = new RegExp(styleUrl, 'i');
} catch (e) {
}