您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Redirect to ChatGPT-4 model if not already set, avoiding redirect loops
当前为
// ==UserScript== // @name Force ChatGPT-4 Model // @namespace http://tampermonkey.net/ // @version 0.1 // @license GPLv3 // @description Redirect to ChatGPT-4 model if not already set, avoiding redirect loops // @author You // @match https://chatgpt.com/* // @grant none // ==/UserScript== (function() { 'use strict'; var checkInterval; // Variable to store the interval ID function findElementByAttributes() { // Use querySelector to find the first div that matches the criteria return document.querySelector('div[type="button"][id^="radix-:"]'); } function currentUrlHasModel() { // Check if the URL has the model query parameter const urlParams = new URLSearchParams(window.location.search); return urlParams.has('model'); } function checkAndRedirect() { if (currentUrlHasModel()) { console.log('ChatGPT-4 model is already set, stopping checks.'); clearInterval(checkInterval); // Stop the interval if model is already set return; } console.log('Checking for the element with specific attributes...'); var element = findElementByAttributes(); console.log('Element:', element); if (element) { console.log('Target element found. Redirecting to ChatGPT-4 model...'); window.location.href = "https://chatgpt.com/?model=gpt-4"; // Perform redirect } else { console.log('Target element not found, checking again...'); } } // Set up an interval to check for the element every 1000 milliseconds checkInterval = setInterval(checkAndRedirect, 1000); // Optional: Clear the interval on page unload to clean up resources window.addEventListener('unload', function() { clearInterval(checkInterval); }); })();