Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getVisibleText(node, skipOlderText, skipNewText, skipMenuText)
- {
- var text = "";
- if (node.classList)
- {
- if (node.classList.contains("fa")) return "";
- if (node.classList.contains("fa-stack")) return "";
- if (node.classList.contains("deco-font")) return "";
- if (skipOlderText && node.classList.contains("current")) return "";
- if (skipOlderText && node.classList.contains("old")) return "";
- if (skipOlderText && node.classList.contains("veryold")) return "";
- if (skipNewText && node.classList.contains("newest")) return "";
- if (skipMenuText && node.classList.contains("trans")) return "";
- }
- if (node.nodeName.toLowerCase() == "br") return "\n";
- if (node.nodeType === Node.TEXT_NODE) return node.textContent.replace(/\n/g, "");
- var style = getComputedStyle(node);
- if (style && style.display === "none") return "";
- for (var i=0; node.childNodes.length > i; i++)
- text += getVisibleText(node.childNodes[i], skipOlderText, skipNewText, skipMenuText);
- text = text.replace(/\n\n+/g, "\n\n").replace(/ +/g, " ").replace(/\n /g, "\n");
- if (node.classList.contains("tooltiptext") ||
- node.classList.contains("tooltiptext-small") ||
- node.classList.contains("tooltiptext-large") ||
- node.classList.contains("tooltiptext-corner"))
- text = "[TOOLTIP: " + text + "]";
- return text;
- }
- function getText(skipOlderText, skipNewText, skipMenuText)
- {
- return getVisibleText(document.body, skipOlderText, skipNewText, skipMenuText);
- }
- function getAllText()
- {
- return getText(false, false, true);
- }
- function getNewText()
- {
- return getText(true, false, true);
- }
- function getMenuText()
- {
- return getText(true, true, false);
- }
- var ESOTERIC_PASTE_TARGET = undefined;
- function setPasteTarget(node)
- {
- ESOTERIC_PASTE_TARGET = node;
- }
- function pasteText(text)
- {
- if (ESOTERIC_PASTE_TARGET)
- ESOTERIC_PASTE_TARGET.value += text;
- }
Advertisement
Add Comment
Please, Sign In to add comment