您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Injects an emoji based on the country associated with the city into the AWS Console navigation menu button
当前为
// ==UserScript== // @name AWS Console Emoji Injector // @version 1.0 // @description Injects an emoji based on the country associated with the city into the AWS Console navigation menu button // @match *://*.console.aws.amazon.com/* // @grant GM_addStyle // @namespace https://greasyfork.org/users/1122649 // ==/UserScript== (function() { 'use strict'; // Function to determine the emoji based on the country function getEmoji(city) { const cityToCountry = { 'N. Virginia': '🇺🇸', 'Ohio': '🇺🇸', 'N. California': '🇺🇸', 'Oregon': '🇺🇸', 'Mumbai': '🇮🇳', 'Osaka': '🇯🇵', 'Seoul': '🇰🇷', 'Singapore': '🇸🇬', 'Sydney': '🇦🇺', 'Tokyo': '🇯🇵', 'Central': '🇨🇦', 'Frankfurt': '🇩🇪', 'Ireland': '🇮🇪', 'London': '🇬🇧', 'Paris': '🇫🇷', 'Stockholm': '🇸🇪', 'São Paulo': '🇧🇷', 'Cape Town': '🇿🇦', 'Hong Kong': '🇭🇰', 'Hyberabad': '🇮🇳', 'Jakarta': '🇮🇩', 'Melbourne': '🇦🇺', 'Milan': '🇮🇹', 'Spain': '🇪🇸', 'Zurich': '🇨🇭', 'Bahrain': '🇧🇭', 'UAE': '🇦🇪' }; return cityToCountry[city] || ''; } // Function to add the emoji to the navigation menu button function addEmoji() { const observer = new MutationObserver(mutations => { mutations.forEach(mutation => { const menuButton = mutation.target.querySelector( 'span[data-testid="awsc-nav-regions-menu-button"]' ); const city = menuButton.innerText.trim(); const emoji = getEmoji(city); menuButton.innerHTML += `<span class="aws-region-flag-emoji">${emoji}</span>`; }); }); const observerConfig = { childList: true, subtree: true }; const targetNode = document.documentElement || document.body; observer.observe(targetNode, observerConfig); } // Wait for the document to load before modifying the DOM window.addEventListener('load', () => { GM_addStyle(` span.aws-region-flag-emoji { font-size: 22px; vertical-align: middle; } `); addEmoji(); }); })();