Greasemonkey script to replace text in html -


this question exact duplicate of:

i want make greasemonkey script replace text in html this:

<img src="http://example.com/image.jpg" data-gifsrc="http://example.com/image.gif">

to

<img src="http://example.com/image.gif">

in website thechive.com

please me, thanks.

while cannot find data-gifsrc attribute on mentioned website, youi cannot assume jquery present , available greasemonkey.

// attribute name var attrname='data-gifsrc';  // list images var imgs=document.getelementsbytagname("img");  // loop every images for(var i=0;i<imgs.length;i++) {   // check attribute   if(imgs[i].attributes[attrname]) {     // set image source     imgs[i].src=imgs[i].attributes[attrname].value;     // remove attribute     imgs[i].attributes.removenameditem(attrname);   } } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -