iEMB+

Makes the new iEMB more tolerable

目前為 2017-11-04 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name iEMB+
  3. // @namespace http://yeoxingyee.ml/
  4. // @version 0.2.3
  5. // @description Makes the new iEMB more tolerable
  6. // @author YXY
  7. // @match *://iemb.hci.edu.sg/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function(){
  12. 'use strict';
  13. var link = document.createElement("link");
  14. link.href = "https://dl.dropboxusercontent.com/s/0highctaaf3h8cz/iemb%2B.css";
  15. link.type = "text/css";
  16. link.rel = "stylesheet";
  17. var script = document.createElement("script");
  18. script.src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js";
  19. document.getElementsByTagName("head")[0].appendChild(link);
  20. document.getElementsByTagName("head")[0].appendChild(script);
  21. })();
  22.  
  23.  
  24. window.onload=function(){
  25. console.log("iEMB+: Initialising...");
  26. var x = $('.messageboard').length;
  27. $("#allMsg a em").text(x);
  28. var reader = '<button id="reader" onClick="autoread()"><a style="text-decoration: none; color: white !important; font-weight: normal;" href="#">Read All</a></button>';
  29. $(".unread_mess_bg").append(reader);
  30. var scriptinject = document.createElement("script");
  31. scriptinject.innerHTML = ["var i = 0;",
  32. "var x = $('.messageboard').length;",
  33. "function autoread(){",
  34. " console.log('iEMB+: Running checks...');",
  35. " console.log('iEMB+: '+ x + ' messages remaining to read.');",
  36. " if (x=='0'){",
  37. " window.alert('iEMB+: All Messages are already Read!');",
  38. " location.reload();",
  39. " return;",
  40. " }",
  41. " var iframeread;",
  42. " iframeread = document.createElement('iframe');",
  43. " document.body.appendChild(iframeread);",
  44. " iframeread.height = '0';",
  45. " iframeread.src = $('a.messageboard')[i].href;",
  46. " x--;",
  47. " i++;",
  48. " checkread();",
  49. "}",
  50. "function checkread(){",
  51. " if (!x){",
  52. " console.log('Done!');",
  53. " location.reload();",
  54. " }",
  55. "else {",
  56. " console.log('iEMB+: Not done yet! rerunning...');",
  57. " autoread();",
  58. " }",
  59. "}",
  60.  
  61. ].join('\n');
  62. document.getElementsByTagName("head")[0].appendChild(scriptinject);
  63. var iframe = document.createElement("iframe");
  64. $('img[alt="Important"]').css("filter", "invert(0)");
  65. $('img[alt="Urgent"]').css("filter", "invert(0)");
  66. $('img[alt="Information"]').css("filter", "invert(0)");
  67. console.log("iEMB+: Initialisation complete! All systems green!");
  68. };