[Greasemonkey] Parenthesis

Oatka oatka at yahoo.com
Mon Mar 27 07:26:50 EST 2006


Go to www.cnn.com. the video's show the time in this format News Video Title
(1:34). i want to change that to display News Video Title 1:34. that's not
really the page i'm trying to do this on, but that's an example since the
other page you'd have to log into to see.

i've tried this (a simple text replacement function i found online):

(function() {
  var replacements, regex, key, textnodes, node, s; 

  replacements = { 
    	
	"(": "",

	}; 



regex = {}; 
for (key in replacements) { 
    regex[key] = new RegExp(key, 'g'); 
} 

textnodes = document.evaluate( "//body//text()", document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 

for (var i = 0; i < textnodes.snapshotLength; i++) { 
    node = textnodes.snapshotItem(i); 
    s = node.data; 
    for (key in replacements) { 
        s = s.replace(regex[key], replacements[key]); 
    } 
    node.data = s; 
} 

--
View this message in context: http://www.nabble.com/Parenthesis-t1349074.html#a3611499
Sent from the MozDev - greasemonkey forum at Nabble.com.



More information about the Greasemonkey mailing list