| Kaedrin Weblog | |
|
Sunday, August 06, 2006
IMDB Bookmarklet In last week's post, I ended up linking to a whole bunch of movies on the IMDB. The process was somewhat tedious, and I lamented the lack of movable type plugins that would help. There are a few plugins that could potentially help, but not in the exact context I'm looking for (MT-Textile does have some IMDB shortcuts, but they're for IMDB searches). So after a looking around, I decided that the best way to go would be to write a bookmarklet that would generate the code to insert a link to IMDB. I'm no expert on this stuff and I'm sure there's something wrong with the below code, but it appears to work passably well (maybe I should just call it IMDB Bookmarklet - Beta). Basically, all you need to do is go to the movie you want to link to on IMDB, click the bookmarklet in your browser, then copy and paste the text into your post (IE actually has a function that will copy a string directly to your clipboard, but no other browser will do so because of obvious security reasons. Therefore, I simply used a prompt() function to display the generated text which you have to then copy manually.) This turned out to be something of a pain, mainly because I primarily use the Opera web browser, which is apparently more strict about javascript than any other browser. My first attempt at the bookmarklet appeared to work fine when I just pasted it into the location bar, but when I actually set up the bookmark, it choked. This apparently had something to do with single and double quotes (I thought you were supposed to be able to use both in javascript, but for whatever reason, Opera kept throwing syntax errors.) Anyway, here's the code: javascript:mname=document.title;murl=document.location;mdatepos=mname.lastIndexOf(' (');if(mdatepos!=-1){mname2=mname.slice(0,mdatepos);}else{mname2=mname;} temp=prompt('Copy text for a link to IMDB movie:','<a href=\''+murl+'\' title=\'IMDB: '+ mname2 +'\'>'+mname2+'</a>');focus();Or just use this link: Generate IMDB Link Again, all you need to do is go to the movie you want to link to on IMDB, click the bookmarklet in your browser, then copy and paste the text into your post. This is the output of the bookmarklet when you use it on IMDB's Miami Vice page: <a href='http://imdb.com/title/tt0430357/' title='IMDB: Miami Vice'>Miami Vice</a>A few nerdy coding things to note here:
I realize this post has next to no appeal to the grand majority of my readers, but I ended up spending more time on this than I wanted. I'll see if I can make another post during the week this week... Posted by Mark at 07:10 PM
Categories: Computers & Internet |
Where am I?
This post is part of the Kaedrin Weblog. It's been categorized under
Computers & Internet
and was originally published in August 2006.
Inside Weblog Archives Best Entries Fake Webcam email me ![]() |
|
Comments
I will confess that I have no idea what most of that is really telling me, given my extremely limited knowledge of the web programing, but what's the advantage of doing all of that over, say, doing an "a href" link? I mean, I can put in by copying and pasting the addy, and it took me, I don't know, a couple of seconds to type in the title. I haven't tried yours, yet, because I'm at work, but I'm just not clear on what advantage it presents. Posted by: Samael on August 7, 2006 9:52 AM
Hmmm. For the record, I put a link to Pirates of the Caribbean in there, but I forgot that it doesn't seem to like links in the comments area. Or, at least, it doesn't like my links. =P Posted by: Samael on August 7, 2006 9:53 AM
Well, to be sure, it's probably only saving a few seconds for each link... but in a post like last week, where I linked to 10+ movies, it sort of adds up. The advantage is that the "a href" tag is generated, as opposed to me having to type "<a href='linky' title='movie name'>movie name</a>" Again, it probably only saves a few seconds, but it's still nice. My ideal solution would be the ability to say something like "[Miami Vice]" and write a plugin for movable type that would interpret that and generate the link for me... So yes, this is definitely a modest effort, but I think it will be helpful for me, especially in cases where I am linking to a lot of movies... Posted by: Mark on August 7, 2006 1:43 PM
[content removed] Posted by: funny r*ngtones on August 8, 2006 2:55 AM
Okay, that makes sense, then. I don't know anything about movable type. I should probably look into that at some point. It seems to get mentioned a lot. Oh, hey. I was wondering where I could get ringtones free. Posted by: Samael on August 8, 2006 8:07 AM
Comments are closed for this entry. Thank you for your interest and sorry for any inconvience. |
|
Copyright © 1999 - 2007 by Mark Ciocco.
|