Agar.io Custom Skin Loader for the non modded game

Load custom skins in Agar.io

  1. // ==UserScript==
  2. // @name Agar.io Custom Skin Loader for the non modded game
  3. // @version 0.1
  4. // @description Load custom skins in Agar.io
  5. // @author New Jack 🕹️
  6. // @homepage https://youtu.be/2IZlIlnK37c?si=ghQBCHXkmFcDj1ps
  7. // @match *://*.agar.io/*
  8. // @grant unsafeWindow
  9. // @license Mit
  10. // @namespace https://greasyfork.org/users/1049139
  11. // ==/UserScript==
  12. // thank you to Bee Chasny Agario
  13. (function() {
  14. 'use strict';
  15.  
  16. function addCustomSkinField() {
  17. const mainPanel = document.querySelector('#mainPanel');
  18.  
  19. if (mainPanel) {
  20. // Create a container for the input and button
  21. const container = document.createElement('div');
  22. container.style.marginBottom = '10px';
  23.  
  24. // Create the input field for the URL
  25. const urlInput = document.createElement('input');
  26. urlInput.placeholder = 'Enter skin URL...';
  27. urlInput.style.marginRight = '5px';
  28.  
  29. // Create the button
  30. // Create the button
  31. const loadButton = document.createElement('button');
  32. loadButton.style.backgroundColor = "#54c800"; // Set button color to #54c800
  33. loadButton.style.color = "#FFFFFF"; // Set text color to white
  34. loadButton.style.border = "none"; // Remove any default borders
  35. loadButton.style.padding = "5px 10px"; // Add some padding for better appearance
  36. loadButton.style.cursor = "pointer"; // Change cursor to pointer on hover for better UX
  37. loadButton.innerText = 'Turn Skin on';
  38.  
  39. // Add hover effect for the button
  40. loadButton.onmouseover = function() {
  41. this.style.backgroundColor = "#347f01"; // Change color on hover
  42. };
  43. loadButton.onmouseout = function() {
  44. this.style.backgroundColor = "#54c800"; // Reset color when hover is removed
  45. };
  46.  
  47. loadButton.addEventListener('click', () => {
  48. const skinURL = urlInput.value;
  49. console.log(`Setting skin to ${skinURL}`);
  50. try {
  51. unsafeWindow.core.registerSkin(null, "%SubscribeToBeeChasnyAgario", skinURL, 2, null);
  52. unsafeWindow.core.loadSkin("%SubscribeToBeeChasnyAgario");
  53. } catch (e) {
  54. console.error("Error loading the skin:", e);
  55. }
  56. });
  57.  
  58. // Append the input and button to the container
  59. container.appendChild(urlInput);
  60. container.appendChild(loadButton);
  61.  
  62. // Insert the container at the top of the main panel
  63. mainPanel.insertBefore(container, mainPanel.firstChild);
  64. } else {
  65. console.warn('Main panel not found. Cannot insert skin loader.');
  66. }
  67. }
  68.  
  69. // Try to add the custom skin field as soon as the main panel is available
  70. const checkInterval = setInterval(() => {
  71. if (document.querySelector('#mainPanel')) {
  72. clearInterval(checkInterval);
  73. addCustomSkinField();
  74. }
  75. }, 1000);
  76. })();