-
-
Save hail2u/912092 to your computer and use it in GitHub Desktop.
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 縦書き | |
// @namespace http://lowreal.net/ | |
// @include http://www.aozora.gr.jp/cards/*/files/*.html | |
// ==/UserScript== | |
// | |
var styles = document.styleSheets; | |
for (var i = 0, it; it = styles[i]; i++) { | |
it.disabled = true; | |
} | |
var css = ' html { background: #222; } body { font-family: serif; font-size: 12pt; line-height: 1.66; color: #090909; background: #FFF5ED; padding: 2em; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; overflow-y: hidden; max-height: 40em; text-align: justify; box-shadow: 0 0 1em 0 rgba(0, 0, 0, 0.9); glyph-orientation-vertical: 90deg; } '; | |
var style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.appendChild(document.createTextNode(css)); | |
document.querySelector('head').appendChild(style); | |
// bug for rendering ruby elements | |
document.body.innerHTML = document.body.innerHTML; | |
document.body.addEventListener('mousewheel', function (e) { | |
if (e.wheelDeltaX) { | |
document.body.scrollLeft -= e.wheelDeltaX; | |
} else { | |
document.body.scrollLeft += e.wheelDelta; | |
} | |
e.preventDefault(); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment