Skip to content

Instantly share code, notes, and snippets.

@shithead
Forked from eri451/night.penta
Last active December 17, 2015 09:29
Show Gist options
  • Save shithead/5587815 to your computer and use it in GitHub Desktop.
Save shithead/5587815 to your computer and use it in GitHub Desktop.
" night.penta
" A darkening style for all websides
" integrated to Pentadactyl
" copyright eri! <hans.orter@gmx.de>
" copyright vetinari <vetinari.userstyles@inode.at>
javascript gBrowser.mCurrentTab.gray = false
javascript let nightshift ="body,html { min-height: 100%!important; } html, body { background-color:#111!important } body>*:not(:empty){ background-color:#222!important } body>*>*:not(:empty){ background-color:#222!important } body>*>*>*:not(:empty){ background-color:#282828!important } body>*>*>*>*:not(:empty){ background-color:#282828!important } body>*>*>*>*>*:not(:empty){ background-color:#383838!important } body>*>*>*>*>* *{ background-color:#383838!important } body table[border=\"0\"] td{ background-color:#111!important } body table table[border=\"0\"] td{ background-color:#333!important } body table table table[border=\"0\"] td{ background-color:#222!important } body table table table table[border=\"0\"] td{ background-color:#444!important } body *:empty{ background-color: #252525!important } body p:not(:empty), body p *, body h1, body h1 *, body h2, body h2 *, body h3, body h3 *, body h4, body h4 *, body h5, body h5 *, body strong>*, body b>*, body em>*, body i>*, body span>*:not(img) { background:transparent none!important } body h1, body h1 *, body h2, body h2 *, p>strong:only-of-type, p>b:only-of-type { color: #a98!important } body h3, body h3 *, body h4, body h4 *{ color: #aaa!important } *:not([onclick]):not(input):not(a):not(img):not([class^=\"UI\"]), body a:not(:empty), div:not([onclick]) { background-image:none!important; text-indent:0!important } *[onclick] { color:#79a!important } *[onclick]:hover { color:#99a8aa!important } body hr { background: #666 none!important; color: #666!important; border:1px solid #666!important; height: 1px!important; overflow:hidden!important; display: block!important } * { color: #c0c0c0!important; border-color:#666!important; } * body a, body a * { color: #B6AA7B!important; } body a:hover, body a:hover * { color: #D9C077!important; text-decoration: underline!important } body img,a[href] img, a[href] button, input[type=\"image\"],*[onclick]:empty, body a:empty { opacity:.5!important } body img:hover,a[href]:hover img, a[href]:hover button, *[onclick]:empty:hover, body a:empty:hover { opacity:1!important } body input[type], body textarea[name], body input[name], body input[id], body select[name]{ -moz-appearance:none!important; color: #bbb!important; -moz-border-radius:4px !important; border-width: 1px!important; border-color: #778!important; border-style:solid!important; background:#555 none !important } body select[name] { -moz-appearance:none!important; color: #bbb!important; -moz-border-radius:4px !important; border-width: 1px!important; border-color: #778!important; border-style:solid!important; background-color:#555!important } body input>*, body textarea>* { background:transparent none !important; color: #bbb!important; border-style:solid!important; border-width: 0px!important; } body select * { background-color:transparent !important; color: #bbb!important; border-style:solid!important; border-width: 0px!important; } pre:not(:empty), code:not(:empty) , cite:not(:empty), pre:not(:empty) *, code:not(:empty) *, cite:not(:empty) * { background-image:url(data:image/gif;base64,R0lGODlhBAAEAIAAABERESIiIiH5BAAAAAAALAAAAAAEAAQAAAIGTACXaHkFADs=)!important; color: #bcc8dc!important;}"
autocmd LocationChange * -javascript <<EOF
if (gBrowser.mCurrentTab.gray === true)
{
ex.delstyle(gBrowser.mCurrentTab.lastHref);
gBrowser.mCurrentTab.lastHref = gBrowser.mCurrentBrowser.contentDocument.location.href;
ex.style(
gBrowser.mCurrentBrowser.contentDocument.location.href,
plugins.night.nightshift );
}
EOF
map gv -javascript <<EOF
if (!gBrowser.mCurrentTab.gray)
{
gBrowser.mCurrentTab.lastHref = gBrowser.mCurrentBrowser.contentDocument.location.href;
gBrowser.mCurrentTab.gray = true;
ex.style(
gBrowser.mCurrentTab.linkedBrowser.contentDocument.location.href,
plugins.night.nightshift );
}
else
{
gBrowser.mCurrentTab.gray = false
ex.delstyle(gBrowser.mCurrentBrowser.contentDocument.location.href);
}
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment