Skip to content

Commit

Permalink
Merge pull request #378 from WilliamAnimate/dipshit
Browse files Browse the repository at this point in the history
replace all occurances of 'dishpit' with dipshit
  • Loading branch information
Dishpit authored Jan 6, 2025
2 parents 2cea682 + 9f8194b commit 0443d34
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions LIVE/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<script async src="https://sleepie.uk/oneko.js"></script>

<script async src="https://sleepie.dev/slopifyvids/loader.js"></script>

<script src="./src/static/js/dipshit.js" defer></script>
</head>

<body>
Expand Down
18 changes: 18 additions & 0 deletions LIVE/src/static/js/dipshit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function replaceWordInDOM(word, replacement) {
function traverse(node) {
if (node.nodeType === Node.TEXT_NODE) {
const text = node.textContent;
const newText = text.replace(new RegExp(`\\b${word}\\b`, 'gi'), replacement);
if (newText !== text) {
node.textContent = newText;
}
} else if (node.nodeType === Node.ELEMENT_NODE) {
Array.from(node.childNodes).forEach(traverse);
}
}

traverse(document.body);
}

replaceWordInDOM("dishpit", "dipshit");

0 comments on commit 0443d34

Please sign in to comment.