diff options
Diffstat (limited to 'lib/main.js')
-rw-r--r-- | lib/main.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/main.js b/lib/main.js index eca533e..365d445 100644 --- a/lib/main.js +++ b/lib/main.js @@ -58,6 +58,18 @@ var bottomRow = {}; // ///////////////////////////////////////////////////////////////////////////// +function doReplace(window) { + for (var node in require("text-node").iterator(window.document.body)) { + var origText = node.textContent; + var newText = origText.replace("friend", "acquaintance", "g"); + newText = newText.replace("Friend", "Acquaintance", "g"); + if (newText != origText) { + node.textContent = newText; + } + } +} + +//////////////////////////////////////////////////////////////////////////////// let config = {}; config.matches = [ "https://bugzilla.redhat.com/show_bug.cgi", @@ -89,4 +101,18 @@ util.loadJSON(jetpack.storage.settings.JSONURL, function(parsedData) { }; jetpack.pageMods.add(callback, config); -}, this);
\ No newline at end of file +}, this); + +//////////////////////////////////////////////////////////////// + +// FIXME What are the real values of options and callbacks parameters? +exports.main = function main(options, callbacks) { + require("tab-browser").whenContentLoaded( + function(window) { + if (window.location.protocol == "http:" && + // options.matches + window.location.host.match(/facebook.com$/)) + require("persistent-page-mod").register(window, doReplace); + } + ); +};s
\ No newline at end of file |