PHPBB Jumpboxchanger

Changes Jumpbox in german firefox-forum. Unread will become red, unwished forums in BLACKLIST will become invisible.

目前为 2016-03-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PHPBB Jumpboxchanger
  3. // @namespace http://openuserjs.org/users/ardiman
  4. // @description Changes Jumpbox in german firefox-forum. Unread will become red, unwished forums in BLACKLIST will become invisible.
  5. // @description:de-DE Passt im deutschen Firefox-Forum die Box an, die bei Klick auf >Gehe zu< geöffnet wird. Ungelesene werden rot, unerwünschte Foren können per BLACKLIST ausgeblendet werden.
  6. // @grant none
  7. // @homepage https://github.com/ardiman/userscripts/tree/master/%name%
  8. // @icon https://raw.githubusercontent.com/ardiman/userscripts/master/scriptlogo.gif
  9. // @include https://www.camp-firefox.de/forum/*
  10. // @license CC BY-NC-SA 3.0; https://creativecommons.org/licenses/by-nc-sa/3.0/
  11. // @supportURL https://github.com/ardiman/userscripts/issues
  12. // @version 1.0.2
  13. // @date 2016-03-05
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. // Forentitel, die grundsätzlich nicht angezeigt werden sollen
  18. //var BLACKLIST = ["Firefox für Smart Devices (wie Smartphones, Tablets, Fernseher, IoT)","Firefox OS","Firefox für Android","Firefox für iOS"];
  19. // falls kein Ausblenden erwünscht, dann diese Zeile verwenden:
  20. var BLACKLIST =[];
  21.  
  22. if (!document.getElementById('jumpbox'))
  23. return;
  24. var button = document.querySelector('#jumpbox > span');
  25. button.addEventListener('click', function() {
  26. var req = new XMLHttpRequest();
  27. req.open('GET', './index.php');
  28. req.responseType = 'document';
  29. req.onload = function() {
  30. if (req.status == 200)
  31. doJumpbox();
  32. };
  33. req.send();
  34.  
  35. function doJumpbox() {
  36. // Ungelesene einfärben
  37. var A = req.responseXML.querySelectorAll('.forum_unread .forumtitle');
  38. for (var a of A) {
  39. var str = a.getAttribute('href');
  40. var a2 = document.querySelector('#jumpbox a[href="' + str + '"]');
  41. a2.style.color = 'red';
  42. };
  43. // zwischenzeitlich Gelesene wieder entfärben
  44. A = req.responseXML.querySelectorAll('.forum_read .forumtitle');
  45. for (var a of A) {
  46. var str = a.getAttribute('href');
  47. var a2 = document.querySelector('#jumpbox a[href="' + str + '"]');
  48. a2.style.color = 'rgb(16,82,137)';
  49. };
  50. // Blacklist abarbeiten
  51. var B = document.querySelectorAll('#jumpbox a');
  52. for (var b of B) {
  53. if (BLACKLIST.indexOf(b.innerHTML) !== -1) {
  54. b.parentElement.style.display = "none";
  55. }
  56. }
  57. };
  58. });
  59.  
  60. })();