LoginSignup
3
5

More than 5 years have passed since last update.

Github ソースコード表示の印刷をキレイに

Last updated at Posted at 2017-02-13

Githubにあるソースコードを印刷して納品物とする為に、印刷レイアウトを調整する JavaScript を作ってみました。
元ネタは http://qiita.com/htkymtks/items/63decc78dbd14f7fc860 です。

ChromeでJavaScriptコンソールを開いて以下のコードを実行します。
印刷に都合が悪かったソースコードが折り返しされます。

[
    "header",
    "reponav",
    "commit-tease",
    "file-header",
    "select-menu",
    "branch-select-menu",
    "BtnGroup",
    "repohead-details-container",
    "site-footer-container"
].forEach(function (className) {
    document.getElementsByClassName(className)[0].style.display = "none";
});
var codeTags = Array.from(document.getElementsByClassName("blob-code-inner"));
codeTags.forEach(function (e) {
    e.style["word-break"] = "break-all";
    e.style["white-space"] = "normal";
});


3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5