GOG.com - Updated Thread Count in Title

Display a count of updated threads in the GOG forum list page title and icon and reload once an hour so a pinned tab can be used as an update notifier

当前为 2014-10-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GOG.com - Updated Thread Count in Title
  3. // @namespace ssokolow.com
  4. // @description Display a count of updated threads in the GOG forum list page title and icon and reload once an hour so a pinned tab can be used as an update notifier
  5. // @contributionURL http://tinyurl.com/kfgayrh
  6. // @match *://www.gog.com/forum
  7. // @require http://cdnjs.cloudflare.com/ajax/libs/tinycon/0.5/tinycon.min.js
  8.  
  9. // @version 5
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. // Set up hourly reload before anything that unexpected markup could break
  14. setTimeout(function() { window.location.reload(true); }, 3600 * 1000);
  15.  
  16. // Initialize with values indicating a soft error
  17. var bubble_bg = '#FF8000';
  18. var unviewed_count = '!';
  19.  
  20. var category = $(".topics .text:contains('My favourite topics')");
  21. if (category.length) { // If not some kind of "server overloaded" page...
  22. category = category.parents('h2').next('.category');
  23.  
  24. // Use an empty list of favourite topics to detect being logged out
  25. if (category.find('.item:not(.message)').length) {
  26. bubble_bg = '#9CC824';
  27. unviewed_count = category.find('.item:not(.visited) .name a').length;
  28. } else {
  29. bubble_bg = '#ff0000';
  30. unviewed_count = 'X';
  31. }
  32. }
  33.  
  34. Tinycon.setOptions({
  35. width: 7,
  36. height: 9,
  37. font: '10px arial',
  38. colour: '#ffffff',
  39. background: bubble_bg,
  40. fallback: false
  41. });
  42. Tinycon.setBubble(unviewed_count);
  43. $('title').text($('title').text() + ' (' + unviewed_count + ')');

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址