Created
October 12, 2018 08:08
-
-
Save kxxoling/72f6763c60f8e6fc893648d0fb8307b6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
document.querySelectorAll(".diff-table").forEach(table => { | |
table.onmouseover = evt => { | |
if (evt.target.tagName !== "TD") { | |
return; | |
} | |
const cellIndex = evt.target.cellIndex; | |
table | |
.querySelectorAll(`tr td.blob-code:nth-child(${cellIndex === 1 ? 2 : 4})`) | |
.forEach(el => { | |
el.style["userSelect"] = "auto"; | |
}); | |
table | |
.querySelectorAll(`tr td.blob-code:nth-child(${cellIndex === 1 ? 4 : 2})`) | |
.forEach(el => { | |
el.style["userSelect"] = "none"; | |
}); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment