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.

contentScript.js 950B

12345678910111213141516171819202122232425262728293031323334
  1. window.onload = () => {
  2. chrome.storage.sync.get([ "matchingPatterns", "exclusionPatterns", "mode" ],
  3. (result) => {
  4. killStickyIfMatch(result);
  5. });
  6. };
  7. function killStickyIfMatch(result) {
  8. if (typeof result.matchingPatterns == "undefined") return;
  9. var shouldKillSticky = false;
  10. let matchingPatterns = result.mode == "whitelist" ?
  11. [ ".*" ] :
  12. (typeof result.matchingPatterns != "undefined" ?
  13. result.matchingPatterns.split("\n") :
  14. [ ]);
  15. for (let pattern of matchingPatterns) {
  16. if (pattern && location.href.match(new RegExp(pattern))) {
  17. shouldKillSticky = true;
  18. break;
  19. }
  20. }
  21. let exclusionPatterns = typeof result.exclusionPatterns != "undefined" ?
  22. result.exclusionPatterns.split("\n") :
  23. [ ];
  24. for (let pattern of exclusionPatterns) {
  25. if (pattern && location.href.match(new RegExp(pattern))) {
  26. shouldKillSticky = false;
  27. break;
  28. }
  29. }
  30. if (!shouldKillSticky) return;
  31. killSticky();
  32. }