您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Order trophies by gold/silver/bronze in every userlookup and also shows the CSS code used in the browser's console
当前为
// ==UserScript== // @name [GC] UL Trophy ordering // @version 1.0 // @description Order trophies by gold/silver/bronze in every userlookup and also shows the CSS code used in the browser's console // @author Berna // @match https://www.grundos.cafe/userlookup/?user=* // @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe // @license MIT // @namespace https://greasyfork.org/users/1230396 // ==/UserScript== function extractUrlEndAndApplyCSS() { // Select all elements with class "ul__gametrophy" var elements = document.querySelectorAll('.ul__gametrophy'); // Initialize an object to track the CSS rules for each order var cssRulesByOrder = {}; // Iterate through each element elements.forEach(function (element) { // Extract the last class var lastClass = element.classList[element.classList.length - 1]; // Find the img element var imgElement = element.querySelector('img'); // If img element is found if (imgElement) { // Extract the src attribute var srcAttribute = imgElement.getAttribute('src'); // Extract the URL end var urlEnd = srcAttribute.substring(srcAttribute.lastIndexOf('/') + 1); // Extract the order from the URL end var orderMatch = urlEnd.match(/_(\d+)\.gif/); var order = orderMatch ? orderMatch[1] : ''; // Initialize CSS rule array for the order if not already present if (!cssRulesByOrder[order]) { cssRulesByOrder[order] = []; } // Add the CSS rule to the array for the order cssRulesByOrder[order].push('.' + lastClass + ','); } }); // Create a style element var styleElement = document.createElement('style'); // Append the style element to the head of the document document.head.appendChild(styleElement); // Iterate through each order and append the CSS rules to the style element for (var order in cssRulesByOrder) { var cssRules = cssRulesByOrder[order].join(' '); var cssRuleText = cssRules.slice(0, -1) + ' { order: ' + order + '; }'; // Log the CSS rule to the console console.log(cssRuleText); // Append the CSS rule to the style element styleElement.textContent += cssRuleText; } } // Call the function extractUrlEndAndApplyCSS();