Last active
April 2, 2024 02:06
-
-
Save noromanba/baa3c522a81fe2bed2577381bc6b5091 to your computer and use it in GitHub Desktop.
open reader-view/mode aggressively for UserScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ZEN-mode | |
// @namespace http://noromanba.flavors.me | |
// @description open reader-view/mode aggressively for UserScript | |
// @include http://example.com/DIY | |
// @grant none | |
// @noframes | |
// @run-at document-end | |
// @version 2016.5.24.5 | |
// @homepage https://gist.github.com/noromanba/baa3c522a81fe2bed2577381bc6b5091 | |
// @downloadURL https://gist.github.com/noromanba/baa3c522a81fe2bed2577381bc6b5091/raw/zen-mode.user.js | |
// @contributor noromanba http://let.hatelabo.jp/noromanba/let/gYC-xpLD79PFdw | |
// @contributor noromanba http://let.hatelabo.jp/noromanba/let/gYC-x6_17M6-Kw (Fork of) | |
// @contributor noromanba http://let.hatelabo.jp/noromanba/let/hLHX8--x5Ok9 | |
// @license MIT License http://nrm.mit-license.org/2016 | |
// @author noromanba http://noromanba.flavors.me | |
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Japanese_Crest_janome.svg/256px-Japanese_Crest_janome.svg.png | |
// ==/UserScript== | |
// Icon (PD by Los688, Mukai) | |
// https://commons.wikimedia.org/wiki/File%3AJapanese_Crest_janome.svg | |
// Devel | |
// https://gist.github.com/noromanba/baa3c522a81fe2bed2577381bc6b5091 | |
// NOTE | |
// below famous scripts load js from these server, | |
// | |
// http://readable.tastefulwords.com | |
// http://readable.tastefulwords.com/target.js | |
// | |
// https://www.readability.com/bookmarklets | |
// https://www.readability.com/bookmarklet/read.js | |
// | |
// possible to violate your privacy | |
// | |
// extension | |
// https://www.readability.com/apps | |
// https://chrome.google.com/webstore/detail/oknpjjbmpnndlpmnhmekjpocelpnlfdi | |
// https://www.readability.com/extension/firefox | |
// https://www.readability.com/extension/safari | |
// Alt. | |
// | |
// Firefox; extends native Reader View Extensions, looks like safely code | |
// | |
// https://addons.mozilla.org/en-US/firefox/addon/activate-reader-view/ | |
// | |
// https://addons.mozilla.org/en-US/firefox/addon/automatic-reader-view/ | |
// https://addons.mozilla.org/en-US/firefox/addon/auto-reader-view/ | |
// https://github.com/pmarchwiak/auto-reader-view/ | |
// | |
// https://addons.mozilla.org/en-US/firefox/addon/better-reader/ | |
// https://darktrojan.github.io | |
// https://github.com/darktrojan/betterreader | |
// TODO | |
// - wrap text completely | |
// - e.g. table | |
// - toggle | |
// privacy safe, work in any pages, don't hidden images | |
(() => { | |
'use strict'; | |
const addStyle = (() => { | |
const parent = document.head || document.body || document.documentElement; | |
const style = document.createElement('style'); | |
style.type = 'text/css'; | |
parent.appendChild(style); | |
return (css) => { | |
style.appendChild(document.createTextNode(css + '\n')); | |
}; | |
})(); | |
Array.from(document.styleSheets, (css) => css.disabled = true); | |
// like a Firefox Reader View | |
const nightmode = ` | |
* { | |
margin-top: initial !important; | |
padding-top: initial !important; | |
} | |
body { | |
margin-left: auto !important; | |
margin-right: auto !important; | |
max-width: 70% !important; | |
font-size: 1.6em !important; | |
line-height: 1.25em !important; | |
background-color: #343A3A !important; | |
color: #FDFDFD !important; | |
white-space: pre-line !important; | |
} | |
h1 { | |
line-height: 1em !important; | |
} | |
a { | |
color: lightskyblue !important; | |
background-color: initial !important; | |
} | |
img { | |
max-width: 100% !important; | |
} | |
pre, code { | |
white-space: pre-wrap !important; | |
} | |
`; | |
addStyle(nightmode); | |
})(); | |
// DBG | |
// | |
// Firefox: MPL 2.0 | |
// chrome://global/skin/aboutReaderControls.css | |
// chrome://global/skin/aboutReaderContent.css | |
// Bookmarklet | |
// https://babeljs.io/repl/ | |
// https://chriszarate.github.io/bookmarkleter/ | |
// | |
// http://userjs.up.seesaa.net/js/bookmarklet.html | |
/* | |
javascript:(()=>{'use strict';const addStyle=(()=>{const parent=document.head||document.body||document.documentElement;const style=document.createElement('style');style.type='text/css';parent.appendChild(style);return(css)=>{style.appendChild(document.createTextNode(css+'\n'));};})();Array.from(document.styleSheets,(css)=>css.disabled=true);const nightmode=`*{margin-top:initial!important;padding-top:initial!important;}body{margin-left:auto!important;margin-right:auto!important;max-width:70%!important;font-size:1.6em!important;line-height:1.25em!important;background-color:#343A3A!important;color:#FDFDFD!important;white-space:pre-line!important;}h1{line-height:1em!important;}a{color:lightskyblue!important;background-color:initial!important;}img{max-width:100%!important;}pre,code{white-space:pre-wrap!important;}`;addStyle(nightmode);})(); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment