您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Autofill switch role params
// ==UserScript== // @name AWS - Autofill Switch Role // @namespace https://github.com/ecklf // @version 0.1 // @description Autofill switch role params // @author ecklf // @icon https://aws.amazon.com/favicon.ico // @match https://*.signin.aws.amazon.com/switchrole* // @license MIT // ==/UserScript== const inputTypes = [ window.HTMLInputElement, window.HTMLSelectElement, window.HTMLTextAreaElement, ]; const triggerInputChange = (node, value = '') => { if ( inputTypes.indexOf(node.__proto__.constructor) >-1 ) { const setValue = Object.getOwnPropertyDescriptor(node.__proto__, 'value').set; const event = new Event('input', { bubbles: true }); setValue.call(node, value); node.dispatchEvent(event); } }; (function() { "use strict"; window.addEventListener('load', function() { const url = new URL(window.location.href); const computeParams = url.searchParams.get("compute_extension_params"); if (!computeParams) return; const params = JSON.parse(computeParams); const accountIdInput = document.getElementById("accountId"); if (accountIdInput) triggerInputChange(accountIdInput, params.accountId); const roleNameInput = document.getElementById("roleName"); if (roleNameInput) triggerInputChange(roleNameInput, params.roleName); const displayNameInput = document.getElementById("displayName"); if (displayNameInput) triggerInputChange(displayNameInput, params.displayName); }, false); })();