diff --git a/github-dark-script.user.js b/github-dark-script.user.js index b88db85..4e26f20 100644 --- a/github-dark-script.user.js +++ b/github-dark-script.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name GitHub Dark Script -// @version 2.5.4 +// @version 2.5.5 // @description GitHub Dark in userscript form, with a settings panel // @license MIT // @author StylishThemes @@ -152,8 +152,8 @@ "Monokai Spacegray Eighties": "monokai-spacegray-eighties", "Obsidian": "obsidian", "Pastel on Dark": "pastel-on-dark", - "Solarized Dark": "solarized-dark", "Railscasts": "railscasts", + "Solarized Dark": "solarized-dark", "Tomorrow Night": "tomorrow-night", "Tomorrow Night Blue": "tomorrow-night-blue", "Tomorrow Night Bright": "tomorrow-night-bright", @@ -613,9 +613,10 @@ icons next to a pre */ .ghd-wrap-toggle { padding: 3px 5px; position:absolute; right:3px; top:3px; -moz-user-select:none; -webkit-user-select:none; cursor:pointer; z-index:20; } .ghd-code-wrapper:not(:hover) .ghd-wrap-toggle { border-color:transparent !important; background:transparent !important; } + .ghd-menu { margin-top:45px; } /* file & diff code tables */ - .ghd-wrap-table .blob-code-inner { white-space:pre-wrap !important; word-break:break-all !important; } - .ghd-unwrap-table .blob-code-inner { white-space:pre !important; word-break:normal !important; } + .ghd-wrap-table .blob-code-inner:not(.blob-code-hunk) { white-space:pre-wrap !important; word-break:break-all !important; } + .ghd-unwrap-table .blob-code-inner:not(.blob-code-hunk) { white-space:pre !important; word-break:normal !important; } .ghd-wrap-toggle > *, .ghd-monospace > *, .ghd-file-toggle > * { pointer-events:none; vertical-align:middle !important; } /* icons for non-syntax highlighted code blocks; see https://github.com/gjtorikian/html-proofer/blob/master/README.md */ .markdown-body:not(.comment-body) .ghd-wrap-toggle:not(:first-child) { right:3.4em; } @@ -759,6 +760,14 @@ target.classList.add("ghd-code-wrapper"); } + function moveMenu(codeWrap) { + const menu = $("details", codeWrap); + if (menu) { + menu.classList.add("ghd-menu"); + codeWrap.parentNode.appendChild(menu); + } + } + // Add code wrap toggle function buildCodeWrap() { // mutation events happen quick, so we still add an update flag @@ -773,6 +782,7 @@ $$(".blob-wrapper").forEach(el => { if (el && !$(".ghd-wrap-toggle", el)) { addCodeWrapButton(icon, el); + moveMenu(el); // Fixes #66 } }); $$(` diff --git a/github-script-code-wrap.user.js b/github-script-code-wrap.user.js index 65bf140..276e5d0 100644 --- a/github-script-code-wrap.user.js +++ b/github-script-code-wrap.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name GitHub Toggle Code Wrap -// @version 1.1.9 +// @version 1.1.10 // @description A userscript that adds a code wrap toggle button // @license MIT // @author StylishThemes @@ -94,6 +94,14 @@ target.classList.add("ghd-code-wrapper"); } + function moveMenu(codeWrap) { + const menu = $("details", codeWrap); + if (menu) { + menu.classList.add("ghd-menu"); + codeWrap.parentNode.appendChild(menu); + } + } + // Add code wrap toggle function buildCodeWrap() { if (busy) { @@ -114,6 +122,7 @@ while (indx--) { if (!$(".ghd-wrap-toggle", wrapper[indx])) { addCodeWrapButton(button, wrapper[indx]); + moveMenu(wrapper[indx]); // Fixes #66 } } @@ -168,12 +177,15 @@ border-color: transparent !important; background: transparent !important; } + .ghd-menu { + margin-top: 45px; + } /* file & diff code tables */ - body .ghd-wrap-table td.blob-code-inner { + body .ghd-wrap-table td.blob-code-inner:not(.blob-code-hunk) { white-space: pre-wrap !important; word-break: break-all !important; } - body .ghd-unwrap-table td.blob-code-inner { + body .ghd-unwrap-table td.blob-code-inner:not(.blob-code-hunk) { white-space: pre !important; word-break: normal !important; }