Skip to content

Commit 4698e7c

Browse files
authored
Update github-html-preview.user.js (#126)
1 parent 488eef2 commit 4698e7c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

github-html-preview.user.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222
const regex = /\.html?$/;
2323

2424
const link = document.createElement("a");
25-
link.className = "ghhp-btn btn btn-sm py-0 px-1 tooltipped tooltipped-n";
25+
link.className = "ghhp-btn btn btn-sm py-0 px-1 mx-1 v-align-baseline tooltipped tooltipped-n";
2626
link.setAttribute("aria-label", "Open in new tab");
2727
link.target = "_blank";
2828
link.innerHTML = `
29-
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
29+
<svg class="octicon v-align-text-bottom" xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="currentColor">
3030
<path d="M19 19H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/>
3131
</svg>`;
3232

3333
function addLink(el) {
34-
const cell = el.closest("td.content");
34+
const cell = el.closest(".js-navigation-item div:nth-child(2) span");
3535
if (!$(".ghhp-btn", cell)) {
3636
const preview = link.cloneNode(true);
3737
preview.href = prefix + el.href;
@@ -40,9 +40,9 @@
4040
}
4141

4242
function init() {
43-
if ($("table.files")) {
44-
const files = $(".file-wrap");
45-
$$("td.content .js-navigation-open", files).forEach(el => {
43+
if ($(".js-details-container")) {
44+
const files = $("#files").parentElement;
45+
$$(".js-navigation-item div:nth-child(2) .js-navigation-open", files).forEach(el => {
4646
if (regex.test(el.title)) {
4747
addLink(el);
4848
}

0 commit comments

Comments
 (0)