GT - Community Boosts Notifier

If hunters need you to boost them, a notification shows up above your trap setup (once per 15 minutes)

  1. // ==UserScript==
  2. // @name GT - Community Boosts Notifier
  3. // @version 3.0
  4. // @description If hunters need you to boost them, a notification shows up above your trap setup (once per 15 minutes)
  5. // @author Rani Kheir
  6. // @include *www.ghost-trappers.com/fb/hunt.php*
  7. // @include *www.ghost-trappers.com/fb/camp.php*
  8. // @include *www.ghost-trappers.com/fb/live_feed_boost.php?action=boostAll
  9. // @namespace https://greasyfork.org/users/4271
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var timeLastBoosted;
  16.  
  17. // check if storage is supported
  18. if (typeof(Storage) !== "undefined") {
  19.  
  20. // if it is, check if it doesnt exist
  21. if (!localStorage.gtCommunityBoostsNotifierTime) {
  22.  
  23. // if it doesnt exist, set it at current time in seconds - 900
  24. localStorage.gtCommunityBoostsNotifierTime = (new Date().getTime() / 1000 - 900);
  25. }
  26.  
  27. // get current time last boosted and store in variale
  28. timeLastBoosted = parseInt(localStorage.gtCommunityBoostsNotifierTime);
  29. }
  30.  
  31. // boost noticed, store time in seconds
  32. if (document.location.href.search("boostAll") > 0) {
  33. localStorage.gtCommunityBoostsNotifierTime = (new Date().getTime() / 1000);
  34. }
  35.  
  36. // do the following only if 15 minutes has passed (15 mins = 15 * 60 [900] seconds)
  37. if ((timeLastBoosted + 900) < (new Date().getTime() / 1000)) {
  38.  
  39. var x_x = $.get("/fb/live_feed_boost.php", function( response ) {
  40. var y_y = x_x.responseText;
  41. if (y_y.search("No team member needs help at the moment.") < 0) {
  42. var divElement = document.createElement("div");
  43. divElement.id = "community_boost_notif";
  44. var paragraphElement = document.createElement("a");
  45. divElement.appendChild(paragraphElement);
  46. paragraphElement.appendChild(document.createTextNode("Hunters need you to Boost 'em!")); // "You've got hunters to Boost!"
  47. paragraphElement.title = "Go to Boosts page..";
  48. paragraphElement.href = "/fb/live_feed_boost.php";
  49. paragraphElement.style.color = "white";
  50. paragraphElement.style.fontWeight = "bold";
  51. paragraphElement.style.textShadow = "3px 2px 1px #000000";
  52. paragraphElement.style.fontSize = "medium";
  53. paragraphElement.style.margin = "30px 0 0 0";
  54. paragraphElement.style.padding = "5px 0 5px 0";
  55. paragraphElement.style.display = "block";
  56. document.getElementsByClassName("slotMore")[0].parentElement.parentElement.parentElement.appendChild(divElement);
  57. }
  58. });
  59. }
  60. })();