Created
July 30, 2020 14:39
-
-
Save jun66j5/dd669a75a6f386fa1b829f01b95f3506 to your computer and use it in GitHub Desktop.
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:(function(b,k,e,l,s) { b = document.body; k = new Set(); e = function(event) { var m = /^\w[\w\d]*/.exec(event.target.textContent); if (m) b.className += ' x-highlight-' + m[0]; }; l = function(event) { var m = /^\w[\w\d]*/.exec(event.target.textContent); if (m) b.className = b.className.replace(' x-highlight-' + m[0], ''); }; document.querySelectorAll('dl em, dl span.pre').forEach(function(node) { var m = /^\w[\w\d]*/.exec(node.textContent); if (m) { node.className += ' x-highlight-' + m[0]; node.addEventListener('mouseenter', e); node.addEventListener('mouseleave', l); k.add(m[0]); } }); s = document.createElement('style'); k = Array.from(k.keys()); s.textContent = k.map(v => 'body.@ .@'.replace(/@/g, 'x-highlight-' + v)) .join(', ') + ' { background-color: lightgreen }'; b.appendChild(s); })() |
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
(function(b,k,e,l,s) { | |
b = document.body; | |
k = new Set(); | |
e = function(event) { | |
var m = /^\w[\w\d]*/.exec(event.target.textContent); | |
if (m) | |
b.className += ' x-highlight-' + m[0]; | |
}; | |
l = function(event) { | |
var m = /^\w[\w\d]*/.exec(event.target.textContent); | |
if (m) | |
b.className = b.className.replace(' x-highlight-' + m[0], ''); | |
}; | |
document.querySelectorAll('dl em, dl span.pre').forEach(function(node) { | |
var m = /^\w[\w\d]*/.exec(node.textContent); | |
if (m) { | |
node.className += ' x-highlight-' + m[0]; | |
node.addEventListener('mouseenter', e); | |
node.addEventListener('mouseleave', l); | |
k.add(m[0]); | |
} | |
}); | |
s = document.createElement('style'); | |
k = Array.from(k.keys()); | |
s.textContent = k.map(v => 'body.@ .@'.replace(/@/g, 'x-highlight-' + v)) | |
.join(', ') + | |
' { background-color: yellow }'; | |
b.appendChild(s); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment