PHPBB Jumpboxchanger

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

  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/phpbbjumpboxchanger
  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/legalcode
  11. // @license MIT; https://opensource.org/licenses/MIT
  12. // @supportURL https://github.com/ardiman/userscripts/issues
  13. // @version 1.0.4
  14. // @date 2017-11-19
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. // Forentitel, die grundsätzlich nicht angezeigt werden sollen
  19. //var BLACKLIST = ["Firefox für Smart Devices (wie Smartphones, Tablets, Fernseher, IoT)","Firefox OS","Firefox für Android","Firefox für iOS"];
  20. // falls kein Ausblenden erwünscht, dann diese Zeile verwenden:
  21. var BLACKLIST =[];
  22.  
  23. if (!document.getElementById('jumpbox'))
  24. return;
  25. var button = document.querySelector('#jumpbox > span');
  26. button.addEventListener('click', function() {
  27. var req = new XMLHttpRequest();
  28. req.open('GET', './index.php');
  29. req.responseType = 'document';
  30. req.onload = function() {
  31. if (req.status == 200)
  32. doJumpbox();
  33. };
  34. req.send();
  35.  
  36. function doJumpbox() {
  37. // Ungelesene einfärben
  38. var A = req.responseXML.querySelectorAll('.forum_unread .forumtitle');
  39. for (var a of A) {
  40. var str = a.getAttribute('href');
  41. var a2 = document.querySelector('#jumpbox a[href="' + str + '"]');
  42. a2.style.color = 'red';
  43. };
  44. // zwischenzeitlich Gelesene wieder entfärben
  45. A = req.responseXML.querySelectorAll('.forum_read .forumtitle');
  46. for (var a of A) {
  47. var str = a.getAttribute('href');
  48. var a2 = document.querySelector('#jumpbox a[href="' + str + '"]');
  49. a2.style.color = 'rgb(16,82,137)';
  50. };
  51. // Blacklist abarbeiten
  52. var B = document.querySelectorAll('#jumpbox a');
  53. for (var b of B) {
  54. if (BLACKLIST.indexOf(b.innerHTML) !== -1) {
  55. b.parentElement.style.display = "none";
  56. }
  57. }
  58. };
  59. });
  60.  
  61. })();