Last active
May 11, 2021 08:39
-
-
Save hkuno9000/4665e682f27ce71728341317c3e73aad to your computer and use it in GitHub Desktop.
GitBucket print ready Bookmarklet and User-defined CSS
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
/** GitBuckect 4.3x's User-defined CSS にて gitbucket-print-ready.js と同等の印刷結果を得る */ | |
/* コードブロックの背景色とボーダ設定が上書きされているので、さらに上書きする. */ | |
div.markdown-body pre.prettyprint { | |
border: 1px solid #888!important; | |
background-color: #f5f5f5; | |
} | |
@media print { | |
/* コードブロックのスクロールバーは印刷時には無意味なので、行折り返しに変更する */ | |
div.markdown-body pre.prettyprint { | |
margin-left: 2em; | |
white-space: pre-wrap; | |
word-wrap: break-word; | |
} | |
/* 編集操作関連の要素はすべて印刷対象から外す. */ | |
form, *.octicon, a.btn, div.wiki-sidebar-dotted, div.discussion-item { | |
display: none; | |
} | |
/* Label,Priority,Milestone,Assignの設定と記録も印刷対象から外す. 印刷したい場合はコメントアウトする. */ | |
div.col-md-3, div.discussion-item { | |
display: none; | |
} | |
} |
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
javascript: | |
var e=document.getElementsByClassName("col-md-9")[0]||document.getElementsByClassName("wiki-main")[0]; | |
var h=document.getElementsByClassName("show-title")[1]||document.getElementsByClassName("body-title")[0]; | |
document.body.innerHTML="<h1>"+h.innerHTML+"</h1>"+e.innerHTML; | |
for(var p of document.getElementsByClassName("prettyprint")) | |
{p.style="margin-left:2em;white-space:pre-wrap;font-size:small;border:solid";} | |
alert('Ready to print out'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How To Install the bookmarklet