Supercharge the Brave search engine.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

BraveSearchPlus.user.js 1.8 KiB

il y a 2 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // ==UserScript==
  2. // @name Brave Search Plus
  3. // @namespace https://ikibani.com
  4. // @version 0.1
  5. // @description Supercharge the Brave search engine.
  6. // @author afycyro
  7. // @match https://search.brave.com/
  8. // @match https://search.brave.com/search?q=*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=brave.com
  10. // @grant none
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14. let search = {
  15. origTerms: "",
  16. terms: "",
  17. exclude: [],
  18. }
  19. const searchBox = document.querySelector('input#searchbox');
  20. document.querySelector('form.form').addEventListener('submit', () => {
  21. let searchValue = searchBox.value.trim();
  22. search.origTerms = searchValue;
  23. searchValue = searchValue.toLowerCase().split(' ').filter(t => !t.startsWith('-')).join(' ');
  24. search.exclude = searchBox.value.split(' ').filter(term => term.startsWith('-')).map(term => term.slice(1));
  25. search.terms = searchValue;
  26. window.localStorage.setItem('searchOptions', JSON.stringify(search));
  27. searchBox.value = search.terms;
  28. return true;
  29. });
  30. if (window.location.href.split('/').filter(c => !!c).length > 2) {
  31. search = JSON.parse(window.localStorage.getItem('searchOptions'));
  32. searchBox.value = search.origTerms;
  33. document.querySelector('head title').innerText = `${search.origTerms} - Brave Search`
  34. const results = document.querySelectorAll('.snippet.fdb');
  35. for (let result of results) {
  36. let resultLoc = result.querySelector('.netloc');
  37. for (let exclusion of search.exclude) {
  38. if (resultLoc.innerText.toLowerCase().includes(exclusion)) {
  39. result.style.display = 'none';
  40. }
  41. }
  42. };
  43. }
  44. })();