Skip to content

Commit

Permalink
Upload initial build.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeLollo21 authored Aug 31, 2021
1 parent 4e237d9 commit ecd0c20
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
Binary file added icons/icon128.png
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 icons/icon16.png
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 icons/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Ryanator",
"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": "",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"permissions": [
"https://*/*"
],
"content_scripts": [
{
"matches": ["https://*/*"],
"js": ["src/inject/inject.js"]
}
]
}
22 changes: 22 additions & 0 deletions package.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'rubygems'
require 'zip'

# Delete existing archive
folder = Dir.pwd
zipfile_name = folder + '/drumpfinator.zip'
File.delete(zipfile_name) if File.exist?(zipfile_name)

# Get files to zip
input_files = Dir.glob("**/*")
input_files.delete(File.basename(__FILE__))
input_files.delete('README.md')

# Create new archive
puts 'Packaging extension into file ' + zipfile_name
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
input_files.each do |filename|
print 'Adding file ' + filename + '...'
zipfile.add(filename, folder + '/' + filename)
print "Done\n"
end
end
30 changes: 30 additions & 0 deletions script.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 ecd0c20

Please sign in to comment.