Skip to content

Commit

Permalink
Retry.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeLollo21 authored Aug 31, 2021
1 parent ecd0c20 commit 33c515b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0",
"manifest_version": 2,
"description": "Are you a Veep fan? Do you actually believe what Jonah Ryan says? Well, now you can manifest that on your compooter!",
"homepage_url": "",
"homepage_url": "https://github.com/ChessPiece21/Ryanator",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
Expand Down
30 changes: 30 additions & 0 deletions src/inject/inject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
chrome.extension.sendMessage({}, function(response) {
var readyStateCheckInterval = setInterval(function() {
if (document.readyState === "complete") {
clearInterval(readyStateCheckInterval);

main();
}
}, 10);

function main() {
// Replace page title
document.title = generateReplacment(document.title);

// Get all text nodes to check
var textNodes = $('body *').contents().filter(function() {
return this.nodeType == Node.TEXT_NODE;
});

// Replace all text nodes
textNodes.each(function(index, textNode) {
textNode.nodeValue = generateReplacment(textNode.nodeValue);
});
}

function generateReplacment(text) {
var regex1 = /algebra/gi;
return text.replace(regex1, getName()).replace("algebra", "Al-Jazeera");
}

});

0 comments on commit 33c515b

Please sign in to comment.