Skip to content

Commit

Permalink
Merge pull request #32 from ayush-sleeping/main
Browse files Browse the repository at this point in the history
Added abusive word hider extension
  • Loading branch information
harshita214 authored Feb 5, 2022
2 parents 3cedfd6 + 8030f8e commit f9894f1
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Abusive Word Hider/Output SS/1.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Abusive Word Hider/Output SS/3.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions Abusive Word Hider/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<h1 align="center"> Abusive-Word Hider </h1>

<!-- ---------------------------------------------------------------------------------------------------------------------- -->
<div align="center">

So basically , After enabling this extension , it will hide abusive words from every heading and paragraphs .
and also remember ,

<strong>
Some abusive words are too bad and that's why I haven't add those in the code . </strong>

So, if you want to add all those jump to the " .js " and add those which ever you like ( Jump to the bottom, there I have shown how you can add more words, which you want to hide).

</div>

<!-- ---------------------------------------------------------------------------------------------------------------------- -->

<br>

#### Tech-Stack used :



![Javascript](https://img.shields.io/badge/JavaScript-323330?style=for-the-badge&logo=javascript&logoColor=F7DF1E)


<br>
<!-- ---------------------------------------------------------------------------------------------------------------------- -->

## Output :

<h3 align="center"> Before enabling the extension ( and as you can see , below the Website headng there are some abusive words . Let's hide them ...) - </h3>

<br>

<div align="center">

<img src = "https://github.com/ayush-sleeping/Chrome-Extension/blob/main/Abusive%20Word%20Hider/Output%20SS/1.%20Before%20enabling%20Extension.jpg" >

<img src = "https://github.com/ayush-sleeping/Chrome-Extension/blob/main/Abusive%20Word%20Hider/Output%20SS/1.1.png" >

</div>

<br>

<br>

<h3 align="center"> Enabling the extension - </h3>

<br>

<div align="center">

<img src = "https://github.com/ayush-sleeping/Chrome-Extension/blob/main/Abusive%20Word%20Hider/Output%20SS/2.%20Enabling%20the%20extension.png" >

</div>

<br>

<br>

<h3 align="center"> Output: And as you can see , It hides those abusive words ...- </h3>

<br>

<div align="center">

<img src = "https://github.com/ayush-sleeping/Chrome-Extension/blob/main/Abusive%20Word%20Hider/Output%20SS/3.%20%20After%20enabling%20extension.jpg" >

<img src = "https://github.com/ayush-sleeping/Chrome-Extension/blob/main/Abusive%20Word%20Hider/Output%20SS/3.1.png" >


</div>

<br>

<br>

<br>
<!-- ---------------------------------------------------------------------------------------------------------------------- -->

### And here you can add, more abusive words, Which you want to hide them... :
<h1> </h1>

<h3 align="center"> as you can see in below " .js code " where I have written some abusive words and basically that's where you have to add which ever you want to hide words ... </h3>

<br>

```
if (element.textContent.match(/(fuck|fuck you|shit|Piss off|Dick head|Asshole|Son of a bitch|Bastard|Bitch|Damn|Wanker|Taking the piss|Twat|Bloody Oath|Root|Get Stuffed|Bugger me|Fair suck of the sav)/gi))
element.parentElement.remove()
```



14 changes: 14 additions & 0 deletions Abusive Word Hider/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"manifest_version": 2,
"name": "Abusive-Word Hider",
"version": "0.0.1",
"content_scripts": [
{
"run_at": "document_idle",
"matches": ["<all_urls>"],
"js": ["script.js"],
"exclude_matches": ["*://.google.com/*"]
}
]
}

10 changes: 10 additions & 0 deletions Abusive Word Hider/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
replaceText(document.body)

function replaceText(element) {
if (element.hasChildNodes()) {
element.childNodes.forEach(replaceText)
} else if (element.nodeType === Text.TEXT_NODE) {
if (element.textContent.match(/(fuck|fuck you|shit|Piss off|Dick head|Asshole|Son of a bitch|Bastard|Bitch|Damn|Wanker|Taking the piss|Twat|Bloody Oath|Root|Get Stuffed|Bugger me|Fair suck of the sav)/gi))
element.parentElement.remove()
}
}

0 comments on commit f9894f1

Please sign in to comment.