🏠 Home 

Greasy Fork is available in English.

Remove highlight from Mobilism

Removes unnecessary highlight from Mobilism pages triggered when clicking on a search r###lt to prevent potential issues with external links.


安装此脚本?
  1. // ==UserScript==
  2. // @name Remove highlight from Mobilism
  3. // @namespace https://github.com/AbdurazaaqMohammed
  4. // @author Abdurazaaq Mohammed
  5. // @version 1.0.2
  6. // @description Removes unnecessary highlight from Mobilism pages triggered when clicking on a search r###lt to prevent potential issues with external links.
  7. // @match https://forum.mobilism.org/viewtopic.php?f=*
  8. // @match https://forum.mobilism.me/viewtopic.php?f=*
  9. // @match https://forum.mobilism.org/search.php?*
  10. // @match https://forum.mobilism.me/search.php?*
  11. // @grant none
  12. // @run-at document-start
  13. // @homepage https://github.com/AbdurazaaqMohammed/userscripts
  14. // @supportURL https://github.com/AbdurazaaqMohammed/userscripts/issues
  15. // @license The Unlicense
  16. // ==/UserScript==
  17. (function() {
  18. 'use strict';
  19. const url = window.location.href;
  20. if (url.includes('viewtopic')) {
  21. const index = url.indexOf("&hilit");
  22. if (index > -1) window.location.href = url.substring(0, index);
  23. } else {
  24. addEventListener("load", (event) => {
  25. const topics = document.querySelectorAll('.topictitle');
  26. const latestPosts = document.querySelectorAll('a[rel="tooltip"]');
  27. const toBeReplaced = '&hilit=' + document.querySelector('h3 > [href^="./search.php"]').innerText.replaceAll(' ', '+');
  28. for (let i = 0; i < topics.length; i++) {
  29. const topic = topics[i];
  30. const latestPost = latestPosts[i];
  31. const topicLink = $(topic).attr('href').toString();
  32. const latestPostLink = $(latestPost).attr('href').toString();
  33. topic.setAttribute('href', topicLink.replace(toBeReplaced, ''));
  34. latestPost.setAttribute('href', latestPostLink.replace(toBeReplaced, ''));
  35. }
  36. });
  37. }
  38. })();