您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Style the profile section on PixelPlace
当前为
// ==UserScript== // @name Custom Profile Background // @namespace http://tampermonkey.net/ // @version 1 // @description Style the profile section on PixelPlace // @author Ghost // @match https://pixelplace.io/* // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // ==/UserScript== // Retrieve the last set background image URL from local storage const lastBackgroundImage = GM_getValue('lastBackgroundImage', ''); // Add an event listener to handle Ctrl+M key press document.addEventListener('keydown', function(event) { if (event.ctrlKey && event.key === 'm') { // Prompt the user to upload an image const input = document.createElement('input'); input.type = 'file'; input.accept = 'image/*'; input.addEventListener('change', function() { const file = input.files[0]; if (file) { // Read the image file as data URL const reader = new FileReader(); reader.onload = function() { const imageUrl = reader.result; // Store the image URL in local storage GM_setValue('lastBackgroundImage', imageUrl); // Apply the image as background applyBackgroundImage(imageUrl); }; reader.readAsDataURL(file); } }); input.click(); } }); // Function to apply the background image function applyBackgroundImage(imageUrl) { GM_addStyle(` /* Styling for the profile section */ .box-x { background-image: url('${imageUrl}'); background-size: cover; /* Adjust as needed */ background-position: center; /* Adjust as needed */ background-repeat: no-repeat; /* Prevents the image from repeating */ } `); } // Apply the last set background image on page load if (lastBackgroundImage) { applyBackgroundImage(lastBackgroundImage); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址