Bitcointalk.org Autoreload

Automatically reloads the watchlist/unread posts

  1. // ==UserScript==
  2. // @name Bitcointalk.org Autoreload
  3. // @name:de Bitcointalk.org Autoreload
  4. // @homepage http://greatest.deepsurf.us/scripts/19125-bitcointalk-org-autoreload/
  5. // @homepage http://openuserjs.org/scripts/LsHallo/Bitcointalk.org_Autoreload
  6. // @version 0.64
  7. // @iconURL https://greatest.deepsurf.us/system/screenshots/screenshots/000/003/979/thumb/logo.png?1461614733
  8. // @description Automatically reloads the watchlist/unread posts
  9. // @description:de Automatischer reload der post seiten bei bitcointalk
  10. // @author LsHallo
  11. // @match https://bitcointalk.org/index.php?action=watchlist
  12. // @match https://bitcointalk.org/index.php?action=unreadreplies
  13. // @namespace https://greatest.deepsurf.us/en/scripts/19125-bitcointalk-org-autoreload/
  14. // ==/UserScript==
  15.  
  16. load();
  17. var y, x, link;
  18.  
  19. function changeTitle(state) {
  20. if(state === 0) {
  21. document.title = x + " Unread Posts";
  22. document.getElementById('faviconprovider').href = 'https://greatest.deepsurf.us/system/screenshots/screenshots/000/003/979/thumb/logo.png?1461614733';
  23. setTimeout(function(){changeTitle(1);},2000);
  24. } else {
  25. document.title = y;
  26. document.getElementById('faviconprovider').href = 'https://bitcointalk.org/favicon.ico';
  27. setTimeout(function(){changeTitle(0);},2000);
  28. }
  29. }
  30.  
  31. function load() {
  32. y = document.title;
  33. time = ~~(Math.random()*75953+105896);
  34. console.log("Idle time: " + ~~(time/1000) + " seconds (" + ((time/1000).toFixed(0)/60).toFixed(2)+" minutes)");
  35. setTimeout(function(){location.reload();},time);
  36.  
  37. d = new Date();
  38. if(d.getHours() < 10) Hours = "0"+d.getHours(); else Hours = d.getHours();
  39. if(d.getMinutes() < 10) Minutes = "0"+d.getMinutes(); else Minutes = d.getMinutes();
  40. if(d.getSeconds() < 10) Seconds = "0"+d.getSeconds(); else Seconds = d.getSeconds();
  41.  
  42. console.log("Last reload: " + Hours + ":" + Minutes + ":" + Seconds);
  43.  
  44. x = document.getElementsByClassName("windowbg").length/3;
  45. if(x > 0) {
  46. link = document.createElement('link');
  47. link.type = 'image/x-icon';
  48. link.rel = 'shortcut icon';
  49. link.id = 'faviconprovider';
  50. link.href = 'https://greatest.deepsurf.us/system/screenshots/screenshots/000/003/979/thumb/logo.png?1461614733';
  51. document.getElementsByTagName('head')[0].appendChild(link);
  52. changeTitle(0);
  53. }
  54. }