csdn close notice

try to take over the world!

As of 2019-01-02. See the latest version.

  1. // ==UserScript==
  2. // @name csdn close notice
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://blog.csdn.net/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (async function() {
  12. 'use strict';
  13.  
  14. function sleep(ms) {
  15. return new Promise(resolve => setTimeout(resolve, ms));
  16. }
  17.  
  18. var a = $(".btn-close");
  19. var m = $("#btn-readmore");
  20.  
  21. var counter = 0;
  22. while (a.length == 0 || m.length == 0) {
  23. await sleep(2000);
  24. counter ++;
  25. if (counter > 16) {
  26. console.log('Waited 32 seconds, exiting...');
  27. return -1;
  28. }
  29. console.log("Length: a:", a.length, "m:", m.length);
  30. }
  31.  
  32. for (var i = 0; i < a.length; i++) {
  33. a[i].click();
  34. }
  35. console.log("a clicked");
  36. m[0].click()
  37. console.log("m clicked");
  38.  
  39. console.log("All Btns Clicked");
  40. return 0;
  41. })();