您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Alerts when receiving a friend request
// ==UserScript== // @name Idle Pixel Friend Request // @namespace http://tampermonkey.net/ // @version 1.0.0 // @description Alerts when receiving a friend request // @author Felipe Dounford // @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js // @match *://idle-pixel.com/login/play* // @icon https://www.google.com/s2/favicons?sz=64&domain=gf.qytechs.cn // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; class FriendRequestPlugin extends IdlePixelPlusPlugin { constructor() { super("friendRequest", { about: { name: GM_info.script.name + " (ver: " + GM_info.script.version + ")", version: GM_info.script.version, author: GM_info.script.author, description: GM_info.script.description } }); } onLogin() { IdlePixelPlus.plugins.friendRequest.changeaddFriendFunction() IdlePixelPlus.plugins.friendRequest.addUI() } addUI() { let FRDiv = document.createElement('div'); FRDiv.id = "friendRequest" FRDiv.style.cssText = "border: 2px solid rgb(0, 0, 77);padding: 10px;z-index: 10;position: absolute;top: 100px;left: 0px;margin-right: auto;margin-left: auto;width: 30%;background-color: rgb(230, 230, 255);border-radius: 10px;text-align: center;display: none;height: auto;right: 0px;" FRDiv.innerHTML = `<div class="modal-header"> <h5 class="modal-title text-secondary">Friend Request</h5> <button type="button" class="btn-close" onclick="this.parentNode.parentNode.style.display = 'none'"></button><input type="text" id="friendRequestName" style="display:none;"> </div> <div> <center><b><span id="friendRequestFriend">Player</span></b> wants to be your friend. <br> </center> </div> <div class="modal-footer"> <button onclick="this.parentNode.parentNode.style.display = 'none'"><span class="font-pixel hover">Ignore</span></button> <button class="background-primary float-end" onclick="IdlePixelPlus.plugins.friendRequest.acceptFR()"><span class="font-pixel hover">Accept Friend Request</span></button> </div>` document.getElementById('content').appendChild(FRDiv) } changeaddFriendFunction() { //Change Chat Class to call the request function Chat.add_friend_modal_submit = function() { var value = document.getElementById("modal-add-friend-input").value; websocket.send('ADD_FRIEND=' + value); IdlePixelPlus.plugins.friendRequest.sendFR(value) } } onCustomMessageReceived(player, content, callbackId) { if(content.startsWith("friendRequest")) { this.receiveFR(player); } } sendFR(username) { IdlePixelPlus.sendCustomMessage(username, { content: `friendRequest`, timout: 300000 }); } receiveFR(username) { document.getElementById('friendRequestName').value = username document.getElementById('friendRequestFriend').innerText = username document.getElementById('friendRequest').style.display = '' } acceptFR() { document.getElementById('friendRequest').style.display = 'none' let friend = document.getElementById('friendRequestName').value websocket.send('ADD_FRIEND=' + friend); } } const plugin = new FriendRequestPlugin(); IdlePixelPlus.registerPlugin(plugin); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址