WebDevSimplified / Coronavirus-Chrome-Extension

35 stars 15 forks source link

How to add exemption for google.com? #2

Open AndriusVegan opened 4 years ago

AndriusVegan commented 4 years ago

Great info, however, I encountered a problem, if you search 'coronavirus' on google in chrome, all results are blocked by this extension, so for this extension to work, youneed to enter specific URL (open a specific webpage that contains the word 'coronavirus'. Any ways to go around it? I guess, need to add url exemption for google.com

WebDevSimplified commented 4 years ago

This is expected behavior since the extension is meant to block any text of coronavirus.

On Fri, Feb 7, 2020, 12:04 PM AndriusVegan notifications@github.com wrote:

Great info, however, I encountered a problem, if you search 'coronavirus' on google in chrome, all results are blocked by this extension, so for this extension to work, youneed to enter specific URL (open a specific webpage that contains the word 'coronavirus'. Any ways to go around it? I guess, need to add url exemption for google.com

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/WebDevSimplified/Coronavirus-Chrome-Extension/issues/2?email_source=notifications&email_token=AJPAR2ZOOIYRRRVBSY255C3RBWPDHA5CNFSM4KRSTYFKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IL4HQ7A, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJPAR23LANKVKBDNM2IJLTTRBWPDHANCNFSM4KRSTYFA .

micalevisk commented 4 years ago

Prevent the replace to occur in SCRIPT or NOSCRIPT tags due to Google's markup

const tagsToIgnore = ['SCRIPT', 'NOSCRIPT', 'STYLE', 'SOURCE']
function replaceText(element) {
  if (tagsToIgnore.includes(element.nodeName)) return
// ...
originalakilan commented 2 years ago

Hi @AndriusVegan "exclude_matches": ["*://.google.com/*"], Please add this code to your manifest.json file,This will exclude google.com and its child as well as parent URLs.

I Have Shared you the full code just replace yours's with the new one given below

{
  "manifest_version": 2,
  "name": "Coronavirus Immunity",
  "version": "0.1.0",
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["script.js"],
      "exclude_matches": ["*://.google.com/*"],
      "css": ["styles.css"]
    }
  ]
}