Greasy Fork镜像 支持简体中文。

IdlePixel Websocket Messenger

Sends websocket messages

  1. // ==UserScript==
  2. // @name IdlePixel Websocket Messenger
  3. // @namespace lbtechnology.info
  4. // @version 1.1.1
  5. // @description Sends websocket messages
  6. // @author Lux-Ferre
  7. // @license MIT
  8. // @match *://idle-pixel.com/login/play*
  9. // @grant none
  10. // @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js?anticache=20220905
  11. // @require https://gf.qytechs.cn/scripts/491983-idlepixel-plugin-paneller/code/IdlePixel%2B%20Plugin%20Paneller.js?anticache=20240410
  12. // ==/UserScript==
  13. (function() {
  14. 'use strict';
  15. class WSMessengerPlugin extends IdlePixelPlusPlugin {
  16. constructor() {
  17. super("wsmessenger", {
  18. about: {
  19. name: GM_info.script.name,
  20. version: GM_info.script.version,
  21. author: GM_info.script.author,
  22. description: GM_info.script.description
  23. },
  24. });
  25. this.previous = "";
  26. }
  27.  
  28. createPanel(){
  29. IdlePixelPlus.addPanel("wsmessenger", "Websocket Messenger", function() {
  30. const content = `
  31. <div>
  32. <form onsubmit='event.preventDefault(); IdlePixelPlus.plugins.wsmessenger.sendMessage()'>
  33. <div class="d-flex flex-fill">
  34. <div class="col-11">
  35. <input type="text" class="w-100" id="wsmessenger_input" placeholder="message">
  36. </div>
  37. <div class="col-1">
  38. <input type="submit" class="w-100" value="Send">
  39. </div>
  40. </div>
  41. </form>
  42. </div>
  43. `
  44. return content
  45. });
  46. }
  47.  
  48. onLogin(){
  49. Paneller.registerPanel("wsmessenger", "Websocket Messenger")
  50. this.createPanel()
  51. }
  52. sendMessage(){
  53. const inputbox = $("#wsmessenger_input")
  54. const message = inputbox.val()
  55. inputbox.val("")
  56. IdlePixelPlus.sendMessage(message)
  57. }
  58. }
  59. const plugin = new WSMessengerPlugin();
  60. IdlePixelPlus.registerPlugin(plugin);
  61. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址