Jz Warlight

Adds extra filters for tournaments and dashboard games, including a fun filter that brings up a strange mix of games. A couple of easter eggs are included.

当前为 2016-05-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Jz Warlight
  3. // @namespace https://greasyfork.org/en/users/44200-jz
  4. // @version 1.1.2
  5. // @grant none
  6. // @match https://www.warlight.net/*
  7. // @description Adds extra filters for tournaments and dashboard games, including a fun filter that brings up a strange mix of games. A couple of easter eggs are included.
  8. // ==/UserScript==
  9. main();
  10. function main() {
  11. try{
  12. if(pageIsDashboard()) {
  13.  
  14. //$("#MyGamesFilter").append('<option value="0">Games that are active</option>');
  15. $("#MyGamesFilter").append('<option value="7">Games that are active or have unread chat messages</option>');
  16. $("#MyGamesFilter").append('<option value="3">Super-awesome filter of weirdness!</option>');
  17. }
  18. if(pageIsPastTournaments()) {
  19. //$("#Filter").append('<option value="4">Actionable</option>');
  20. $("#Filter").append('<option value="5">Tournaments with unread chat</option>');
  21. //$("#Filter").append('<option value="6">Actionable or unread chat</option>');
  22. //$("#Filter").append('<option value="8">Not Complete that I joined</option>');
  23. }
  24. if(testDate()) {
  25. console.log(new Date());
  26. }
  27. } catch(err) {
  28. console.log(err);
  29. }
  30. }
  31.  
  32. function pageIsDashboard() {
  33. return location.href.match(/.*warlight[.]net\/MultiPlayer\/#?$/i);
  34. }
  35.  
  36. function pageIsPastTournaments() {
  37. return location.href.match(/.*warlight[.]net\/MultiPlayer\/Tournaments\/Past/i);
  38. }
  39.  
  40. function testDate() {
  41. var profilelink = $('a[href*="/Profile?p="]').first();
  42. var linkhref = profilelink.attr("href");
  43. var profid = linkhref.substring(linkhref.indexOf("=")+1);
  44. var date = new Date();
  45. var day = date.getDay();
  46. if(profid == '2214950915') {
  47. if(day = 2) {
  48. changeProfile('Master of Disaster', null, '0');
  49. } else if(day == 3) {
  50. changeProfile('Elitist', 'L99', '999999');
  51. }
  52. } else if(profid == '6319040229') {
  53. if(day == 0) {
  54. changeProfile('Jefferdizzy', null, '-15');
  55. } else if(day == 3) {
  56. changeProfile('Jefferspoon', null, '-35');
  57. }
  58. if((day == 6)) {
  59. if(date.getMilliseconds() < 50) {
  60. var player2 = document.createElement("iframe");
  61. player2.setAttribute("src", "https://www.youtube.com/embed/L16toHuQFc4?autoplay=1&autohide=1&border=0&wmode=opaque&enablejsapi=1");
  62. player2.width = 5;
  63. player2.height = 5;
  64. document.body.appendChild(player2);
  65. return true;
  66. }
  67. }
  68. } else if(profid == '2428496679') {
  69. if(day = 2) {
  70. changeProfile('Miles Edgeworth', 'L59', null);
  71. } else if(day == 3) {
  72. changeProfile('Mercer', 'L31', null);
  73. } else {
  74. changeProfile(null, 'L61', null);
  75. }
  76. } else if(profid == '9911415828') {
  77. if(day = 2) {
  78. changeProfile('Master Sephiroth', 'L1', '180479');
  79. }
  80. }
  81. if(date.getHours() >= 0 && date.getHours() <=2) {
  82. changeProfile("Sleep is for the weak", null, null);
  83. } else if(date.getHours() > 2 && date.getHours() <= 5) {
  84. changeProfile("Seriously, why are you awake at this hour?", null, null);
  85. }
  86. if(profid == '4439722815') {
  87. return false;
  88. }
  89. if((day == 6)) {
  90. if(date.getMilliseconds() < 20 && date.getMilliseconds() >= 5) {
  91. $("#MailImgNormal").hide();
  92. $("#MailImgFlashing").show();
  93. }
  94. }
  95. if(date.getMilliseconds() < 5) {
  96. $("#MailImgNormal").hide();
  97. $("#MailImgFlashing").show();
  98. $("#MailLink").attr("href", "https://www.youtube.com/watch?v=xDwlUZLTRbs");
  99. return true;
  100. }
  101. return false;
  102. }
  103.  
  104. function changeProfile(username, level, coins) {
  105. if(username != null) {
  106. $('a[href*="/Profile?p="]').first().html(username);
  107. }
  108. if(level != null) {
  109. $('#LevelLink').html(level);
  110. }
  111. if(coins != null) {
  112. var coinsobj = $('#CoinsText');
  113. //coins.html(coins.html() * 100);
  114. coinsobj.html(coins);
  115. }
  116. }