Archived Comments (locked)

in
Subscribe to Archived Comments 9 posts, 4 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Anton Zawaq User
how i met your mother picture

http://www.imdb.com/title/tt0460649/
 
Anton Zawaq User

It doesn't seem to work, nothing happens. It's like I didn't had the script installed in the first place.

 
dob Script's Author

Try this version:

function $x(p, context) {
	if (!context) context = document;
	var i, arr = [], xpr = document.evaluate(p, context, null, 6, null);
	for (i=0; item=xpr.snapshotItem(i); i++) arr.push(item);
	return arr;
}

var links = $x("//a[contains(@href, 'imdb.com/title/')]");
if (links.length) {
	links.forEach(function(link,i) {
	if (!link.hasChildNodes()) {
			if (!GM_getValue(link.href)) {
				GM_xmlhttpRequest({
					method: "get",
					url: link.href,
					onload: rs(i)
				});
			}
		}
	});
}
function rs(i) {
	return function(e) {
		var title = e.responseText.split("<title>")[1].split("</title>")[0];
		links[i].textContent = title;
		GM_setValue(links[i].href, title);
	}
}

This is just alpha, I haven't tried it yet.

 
Anton Zawaq User

Thanks, but now it seems like something is wrong. The text-links doesn't change to the IMDb-title, and the images-links still changes to the IMDb-titles.

 
dob Script's Author

I updated the script so image links won't be changed.

 
Anton Zawaq User

Thanks for a very useful script, but how do I do so "jpg"- and "png"-files don't get replaced by the title?

 
dob Script's Author

Updated the script a little.
If the link has been changed before it will be saved, making the script work a lot faster.

Also, http://*.imdb.com will be excluded.
Thanks for the tip, Hiromacu.

 
Hiromacu Scriptwright

Need to add an exclude: http://us.imdb.com/* !!

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel