Skip to content

Instantly share code, notes, and snippets.

@syoichi
Forked from cho45/screen-capture.png
Created March 19, 2011 14:44
Show Gist options
  • Save syoichi/877517 to your computer and use it in GitHub Desktop.
Save syoichi/877517 to your computer and use it in GitHub Desktop.
自分の環境(Windows XP, 12.0.707.0 canary)だと縦書きにならなかったり、User Scriptを読み込んだ時に、headの内容が何故か読み込まれていない場合があったので修正した。 追記:江添さんのChrome拡張版: http://j.mp/euuSQl
// ==UserScript==
// @name 縦書き
// @namespace http://lowreal.net/
// @include http://www.aozora.gr.jp/cards/*/files/*.html
// ==/UserScript==
var b = document.body;
document.head.innerHTML += '<style type="text/css"> html { background: #222; } body { font-family: "@MS 明朝"; font-size: 14pt; line-height: 1.66 !important; 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); margin: 8px !important; } </style>';
// bug for rendering ruby elements
b.innerHTML = b.innerHTML;
b.addEventListener('mousewheel', function (e) {
b.scrollLeft += -e.wheelDeltaX || e.wheelDelta;
e.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment