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
Post a Comment