osu! profile HL

highlights all plays that player got in last 14days

当前为 2015-08-11 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name osu! profile HL
  3. // @namespace
  4. // @version 0.1
  5. // @description highlights all plays that player got in last 14days
  6. // @author Piotrekol
  7. // @match http*://osu.ppy.sh/u/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function addJQuery(callback) {
  12. var script = document.createElement("script");
  13. script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
  14. script.addEventListener('load', function() {
  15. var script = document.createElement("script");
  16. script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
  17. document.body.appendChild(script);
  18. }, false);
  19. document.body.appendChild(script);
  20. }
  21.  
  22. addJQuery(function() {
  23. var NOW = new Date();
  24. NOW.setDate(NOW.getDate() - 14);
  25. $('#leader').bind('DOMNodeInserted DOMNodeRemoved', function(event) {
  26. if (event.type == 'DOMNodeInserted') {
  27. jQ('#leader .timeago').each(function() {
  28. if (new Date(this.attributes.title.value) > NOW)
  29. jQ(this.parentNode.parentNode.parentNode).css({
  30. "background-color": "lightgreen"
  31. });
  32. });
  33. }
  34. });
  35. });