您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to copy the contents of <pre> on the Instagram GraphQL page
// ==UserScript== // @name Instagram GraphQL // @namespace http://tampermonkey.net/ // @version 1.0 // @description Adds a button to copy the contents of <pre> on the Instagram GraphQL page // @match https://www.instagram.com/graphql/query/* // @grant GM_setClipboard // @run-at document-end // @author Aligator // @license GNU GPLv3 // ==/UserScript== (function() { 'use strict'; // Wait for the <pre> element to appear in the DOM function waitForPreAndInsertButton() { const pre = document.querySelector('pre'); if (!pre) { setTimeout(waitForPreAndInsertButton, 300); // try again after 300ms return; } // Create the button const button = document.createElement('button'); button.textContent = '📋 Copy Content'; button.style.margin = '15px'; button.style.fontSize = '20px'; button.style.cursor = 'pointer'; // Copy function button.addEventListener('click', () => { const text = pre.innerText; if (typeof GM_setClipboard !== 'undefined') { GM_setClipboard(text); } else { // fallback for browsers without GM_setClipboard navigator.clipboard.writeText(text).then(() => { alert('Copied to clipboard!'); }).catch(err => { alert('Failed to copy: ' + err); }); } }); // Insert the button before <pre> pre.parentNode.insertBefore(button, pre); } waitForPreAndInsertButton(); })();