Keep Grepolis Active

Prevents Grepolis from going idle in the background by periodically sending a request to the server.

  1. // ==UserScript==
  2. // @name Keep Grepolis Active
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.4
  5. // @description Prevents Grepolis from going idle in the background by periodically sending a request to the server.
  6. // @author Nyxia
  7. // @match *://*.grepolis.com/*
  8. // @license MIT
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Set the interval (in milliseconds) for how often to send a request. 5 minutes = 300000 ms
  16. const interval = 300000;
  17.  
  18. // Function to send a small request to keep the session active
  19. function keepSessionActive() {
  20. // This simulates a minor action, like retrieving a small amount of game data
  21. console.log("Keeping Grepolis session active...");
  22. $.ajax({
  23. url: '/game/player', // Endpoint to simulate a request (this can be adjusted)
  24. success: function(data) {
  25. console.log("Session kept active.");
  26. },
  27. error: function(err) {
  28. console.log("Error keeping session active: ", err);
  29. }
  30. });
  31. }
  32.  
  33. // Set the interval to run the function periodically
  34. setInterval(keepSessionActive, interval);
  35. })();