您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirects Reddit's submit page for r/userscripts to the old Reddit interface to fix the bug accessing the new interfaces's submit page for the subreddit.
当前为
- // ==UserScript==
- // @name Reddit bug workaround to allow posting on the r/userscript subreddit.
- // @namespace https://gist.github.com/f-steff
- // @version 1.1
- // @description Redirects Reddit's submit page for r/userscripts to the old Reddit interface to fix the bug accessing the new interfaces's submit page for the subreddit.
- // @author Flemming Steffensen
- // @license MIT
- // @match https://www.reddit.com/r/userscripts/*
- // @grant none
- // @homepageURL https://gist.github.com/f-steff/cd4c5fafc574e5595fc7a153516792ab
- // @run-at document-idle
- // ==/UserScript==
- (function() {
- 'use strict';
- // Function to modify the "Create Post" button
- function modifyCreatePostButton() {
- const createPostButton = document.querySelector('a[data-testid="create-post"]');
- if (createPostButton && createPostButton.href.includes('www.reddit.com')) {
- createPostButton.href = createPostButton.href.replace('www.reddit.com', 'old.reddit.com');
- }
- }
- // Ensure the DOM is fully loaded before running
- function init() {
- modifyCreatePostButton();
- // Observe for dynamic changes to the page and reapply the modification if needed
- const observer = new MutationObserver(() => {
- modifyCreatePostButton();
- });
- observer.observe(document.body, { childList: true, subtree: true });
- }
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', init);
- } else {
- init();
- }
- })();