Skip to content

Instantly share code, notes, and snippets.

@cho45
Created March 18, 2011 12:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cho45/875989 to your computer and use it in GitHub Desktop.
Save cho45/875989 to your computer and use it in GitHub Desktop.
// ==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); } ';
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