Doesn't work - quickfix

in
Subscribe to Doesn't work - quickfix 5 posts, 2 voices



RobinRosengren Scriptwright

First of all, great script!

But there seems like there has been a change to the imdb site since the script was introduced.
The findName() function returned for example "Freeman,%20Morgan%20(I)" but needed to return "Morgan%20Freeman%20(I)" in order for the script to work.

I made a quick fix by replacing

return personName;

with

var sep = personName.indexOf(',');
var num = personName.lastIndexOf('(');
if(num != -1) {
return (personName.substring(sep+4,num-3) + '%20' + personName.substring(0,sep)+ '%20' + personName.substring(num));
} else {
return (personName.substring(sep+4) + '%20' + personName.substring(0,sep));
}

Maybe not the prettiest fix, but it works...

 
Curtis Gibby Script's Author

Thanks Robin for pointing out the change on IMDB's side that broke the script. I had noticed a couple of actors with no Bacon Number, but didn't realize that it was completely kaput.

I'll try to update the script with your fix sometime this week.

 
Curtis Gibby Script's Author

Just released v 1.2 that fixes the error -- turns out it wasn't on IMDB's side but the Oracle of Bacon who changed their code.

 
RobinRosengren Scriptwright

Just found another problem. Haven't checked if it's just the new version or if it was there before. The script fails to aquire the bacon number for people with extended ascii characters in their name, like swedish actor 'Stellan Skarsgård' (http://www.imdb.com/name/nm0001745/).

I think adding an escape-function would fix it.

var personName = escape(document.title.replace(" - IMDB",""));

 
Curtis Gibby Script's Author

Just released 1.2.1 that adds the suggested escape function -- and it works for Stellan Skarsgård -- who, I was surprised to find out, has a better Center number than Kevin Bacon.

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