From d755b19c15a45d43c4ccb5abe5bb2ba7d80e5c63 Mon Sep 17 00:00:00 2001 From: shibao Date: Sat, 20 Apr 2024 19:09:17 -0400 Subject: [PATCH] turn into misskey-always-show-replies --- README.md | 9 ++--- bypass-twitter-sensitive.user.js | 61 ----------------------------- misskey-always-show-replies.user.js | 58 +++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 66 deletions(-) delete mode 100644 bypass-twitter-sensitive.user.js create mode 100644 misskey-always-show-replies.user.js diff --git a/README.md b/README.md index a8eb9eb..1c44092 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -# Bypass Twitter Sensitive -This userscript bypasses Twitter's "Caution: This profile may include -potentially sensitive content" screen for profiles and "The following media -includes potentially sensitive content" warnings for tweets. Use with caution! +# Misskey Always Show Replies +This userscript always clicks on Misskey's "Show replies" button whenever it is +visible. ## Installation First, install Violentmonkey for @@ -9,7 +8,7 @@ First, install Violentmonkey for [Chrome](https://chrome.google.com/webstore/detail/violentmonkey/jinjaccalgkegednnccohejagnlnfdag), or any other userscript manager of your choice, and then [click here to install the -userscript](https://gitea.bubbletea.dev/shibao/bypass-twitter-sensitive/raw/branch/stable/bypass-twitter-sensitive.user.js). +userscript](https://gitea.bubbletea.dev/shibao/misskey-always-show-replies/raw/branch/stable/misskey-always-show-replies.user.js). ## License This userscript is licensed under GPL v3.0 or later. diff --git a/bypass-twitter-sensitive.user.js b/bypass-twitter-sensitive.user.js deleted file mode 100644 index 0c6c408..0000000 --- a/bypass-twitter-sensitive.user.js +++ /dev/null @@ -1,61 +0,0 @@ -// ==UserScript== -// @name Bypass Twitter Sensitive -// @namespace https://bubbletea.dev/ -// @version 2.2 -// @description Bypasses Twitter's "Caution: This profile may include potentially sensitive content" page and "The following media includes potentially sensitive content" warnings. -// @author shibao -// @include /^https://twitter.com.*$/ -// @include /^https://mobile.twitter.com.*$/ -// @downloadURL https://gitea.bubbletea.dev/shibao/bypass-twitter-sensitive/raw/branch/stable/bypass-twitter-sensitive.user.js -// @updateURL https://gitea.bubbletea.dev/shibao/bypass-twitter-sensitive/raw/branch/stable/bypass-twitter-sensitive.user.js -// @grant none -// ==/UserScript== - -// from https://developer.mozilla.org/en-US/docs/Web/API/Node#recurse_through_child_nodes -function eachNode(rootNode, callback) { - if (!callback) { - const nodes = [] - eachNode(rootNode, function (node) { - nodes.push(node) - }) - return nodes - } - - if (false === callback(rootNode)) { - return false - } - - if (rootNode.hasChildNodes()) { - const nodes = rootNode.childNodes - for (let i = 0, l = nodes.length; i < l; ++i) { - if (false === eachNode(nodes[i], callback)) { - return - } - } - } -} - -(function () { - 'use strict'; - - const observer = new MutationObserver(function (mutationList) { - for (const mutation of mutationList) { - for (const addedNode of mutation.addedNodes) { - // recurses through all child nodes as well - eachNode(addedNode, function (node) { - if (node.nodeName == 'SPAN' && (node.innerHTML == 'Yes, view profile' || node.innerHTML == 'View')) { - const viewProfileBtn = node.closest("div[role='button']"); - if (viewProfileBtn) { viewProfileBtn.click(); } - } - }); - } - }; - }); - - observer.observe(document, { - childList: true, - subtree: true, - attributes: true, - attributeFilter: ["role"] - }); -})(); diff --git a/misskey-always-show-replies.user.js b/misskey-always-show-replies.user.js new file mode 100644 index 0000000..7a16d47 --- /dev/null +++ b/misskey-always-show-replies.user.js @@ -0,0 +1,58 @@ +// ==UserScript== +// @name Misskey Always Show Replies +// @namespace https://bubbletea.dev/ +// @version 1.0 +// @description Automatically clicks the "Show replies" button on Misskey and misskey instances +// @author shibao +// @include /^https://.*misskey.*$/ +// @downloadURL https://gitea.bubbletea.dev/shibao/misskey-always-show-replies/raw/branch/stable/misskey-always-show-replies.user.js +// @updateURL https://gitea.bubbletea.dev/shibao/misskey-always-show-replies/raw/branch/stable/misskey-always-show-replies.user.js +// @grant none +// ==/UserScript== + +// from https://developer.mozilla.org/en-US/docs/Web/API/Node#recurse_through_child_nodes +function eachNode(rootNode, callback) { + if (!callback) { + const nodes = []; + eachNode(rootNode, function (node) { + nodes.push(node); + }); + return nodes; + } + + if (false === callback(rootNode)) { + return false; + } + + if (rootNode.hasChildNodes()) { + const nodes = rootNode.childNodes; + for (let i = 0, l = nodes.length; i < l; ++i) { + if (false === eachNode(nodes[i], callback)) { + return; + } + } + } +} + +(function () { + "use strict"; + + const observer = new MutationObserver(function (mutationList) { + for (const mutation of mutationList) { + for (const addedNode of mutation.addedNodes) { + eachNode(addedNode, function (node) { + node.nodeName == "DIV" && + node.innerHTML == "Show replies" && + node.closest("button._button")?.click(); + }); + } + } + }); + + observer.observe(document, { + childList: true, + subtree: true, + attributes: true, + attributeFilter: ["role"], + }); +})();