Skip to content

Instantly share code, notes, and snippets.

@ifyour
Last active May 10, 2020 02:04
Show Gist options
  • Save ifyour/06d1a2c75cee3e159937078bf943d935 to your computer and use it in GitHub Desktop.
Save ifyour/06d1a2c75cee3e159937078bf943d935 to your computer and use it in GitHub Desktop.
JavaScript 书签,生成工具:https://mrcoles.com/bookmarklet/
!window.isDebugging && (window.isDebugging = false);
isDebugging ? disableDebugger() : enableDebugger();
function enableDebugger() {
document.querySelectorAll("*").forEach((elm) => {
elm.style.outline =
"1px solid #" + (~~(Math.random() * (1 << 24))).toString(16);
});
isDebugging = true;
}
function disableDebugger() {
document.querySelectorAll("*").forEach((elm) => {
elm.style.outline = "none";
});
isDebugging = false;
}
[
// Commmon
"pre",
"code",
// GtiHub Gits
".js-comment-update",
// GtiHub Markdown
'.markdown-body h1',
'.markdown-body h2',
'.markdown-body h3',
].reduce((acc, curSelector) => {
const nodeList = document.querySelectorAll(curSelector);
return [...acc, ...nodeList];
}, [])
.forEach((elm) => elm.classList.add("notranslate"));
console.log("✅ No Translate Class Inject Success!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment