Forum Moderators: open
// ==UserScript==
// @name Replace Dollar
// @description Replaces the USD symbol with GBP symbol
// @include http://www.w3schools.com/*
// ==/UserScript==
//Name: Replace Dollar
//Version: 0.1
//Author: Peter Foti
//Last update : 2010-06-26
//Note, my test page was
//http://www.w3schools.com/ajax/ajax_example.asp
//which has some AJAX that can pull in data
var NODE_SELECTORS = '#myDiv', // Replace with your own selector
POLL_INTERVAL = 1000, // This will run every 1 second
TOKEN = 'technique', // Replace with '$'
REPLACE_WITH = '£'; // This is what it will get replaced with
function each(list, callback) {
Array.prototype.forEach.call(list, callback);
};
function filter(list, callback) {
return Array.prototype.filter.call(list, callback);
};
(function () {
setTimeout(arguments.callee, POLL_INTERVAL);
var targetNodes = document.querySelectorAll(NODE_SELECTORS);
if (! targetNodes.length) {
return;
}
each(targetNodes, function(n){
var h = n.innerHTML;
h = h.replace(TOKEN,REPLACE_WITH);
n.innerHTML = h;
});
})();