I need your help

Subscribe to I need your help 6 posts, 3 voices

 
ngn999 User

I want replace

<*input type='image' src='http://f.static.flickr.com/23/b.jpg' onclick="window.open('http://url.drleeuk.com/to/?aBn&z');return true;">

with

<*img src='http://f.static.flickr.com/23/b.jpg'>

all in the site: http://www.foobar.com

<* = <

Can you give me a full .user.js file?

my email is ngn999#126.com .

thank you very much !

 
znerp Scriptwright

It's completely untested, but the following should work...

// ==UserScript==
// @name           ngn999's script
// @include        http://www.foobar.com/
// ==/UserScript==

inputs = document.evaluate('//input[@src="http://f.static.flickr.com/23/b.jpg"]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null)

for (i = 0; i < inputs.snapshotLength; i++) {
  (thisInput = inputs.snapshotItem(i)).parentNode.insertBefore(document.createElement("img").src = "http://f.static.flickr.com/23/b.jpg", thisInput)
  thisInput.parentNode.removeChild(thisInput)  
}
Also, you didn't need to create this topic twice in different sections of the forum.

 
ngn999 User

thank yuo very much!
but
there are many images in my web page, and they have different url;
so...

 
znerp Scriptwright

// ==UserScript==
// @name           ngn999's script
// @include        http://www.foobar.com/
// ==/UserScript==

inputs = document.evaluate('//input[contains(@src,".jpg")]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null)

for (i = 0; i < inputs.snapshotLength; i++) {
  (thisInput = inputs.snapshotItem(i)).parentNode.insertBefore(document.createElement("img").src = thisInput.src, thisInput)
  thisInput.parentNode.removeChild(thisInput)  
}

 
ngn999 User

there is a problem:
could not convert javascript arg 0
why?

 
lambroger Scriptwright

because you don't have Greasemonkey installed?