-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e237d9
commit ecd0c20
Showing
6 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
|
||
}); |