您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This script is useful with AWS SSO cli tools, where it opens a browser tab to perform authentication.
// ==UserScript== // @name AWS-SSO-Auth-Close-Browser-Tab // @namespace http://tampermonkey.net/ // @version 0.2 // @description This script is useful with AWS SSO cli tools, where it opens a browser tab to perform authentication. // @description This script automatically closes the tab on successful finish. // @author John Polansky // @icon https://www.google.com/s2/favicons?domain=userscript.zone // @include https://d-906769c34d.awsapps.com/* // @run-at document-end // @license MIT // @noframes // @grant window.close // @grant window.focus // ==/UserScript== (function() { 'use strict'; switch (location.pathname) { case "/start/user-consent/authorize.html": var evt = document.createEvent ("HTMLEvents"); evt.initEvent ("click", true, true); document.getElementById('cli_login_button').dispatchEvent (evt); break; case "/start/user-consent/login-success.html": window.close() break; default: console.log("default case executed.. nothing happens"); } })();