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 -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -