您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Extracts the session parameter from the iFrame URL and copies it to the clipboard
- // ==UserScript==
- // @name Extract Session from CityIndex iFrame
- // @namespace http://tampermonkey.net/
- // @version 1.0
- // @description Extracts the session parameter from the iFrame URL and copies it to the clipboard
- // @match https://www.cityindex.com/*/forex-trading/*/
- // @license MIT
- // @grant GM_setClipboard
- // ==/UserScript==
- (function() {
- 'use strict';
- function extractSession() {
- const iframe = document.getElementsByTagName("iframe")[0];
- if (!iframe) {
- console.log("No iframe found.");
- return;
- }
- const url = new URL(iframe.src);
- const session = url.searchParams.get("session");
- if (session) {
- GM_setClipboard(session);
- console.log("Session copied to clipboard:", session);
- } else {
- console.log("Session parameter not found.");
- }
- }
- // Wait for the iframe to load
- window.addEventListener('load', () => {
- setTimeout(extractSession, 3000); // Wait a bit to ensure the iframe is loaded
- });
- })();