icimdb

By knarf Last update Jun 26, 2011 — Installed 706 times.

Tampermonkey Beta / Chrome

in
Subscribe to Tampermonkey Beta / Chrome 1 post, 1 voice

derjanb Scriptwright
ChromeX11

This is working in Chrome with Tampermonkey Beta installed, but only if the icm_link function is replaced:

-// Get ICM link from the Add Movie result
-function icm_link (src) {
- var a = $x("id('content')//ul//a", src);
-
- if(a.length == 1&& a[0].href != "" && a[0].href.indexOf("http://www.imdb.com") == -1) {
- return 'http://icheckmovies.com'+a[0].href;
- }
-}

+// Get ICM link from the Add Movie result
+function icm_link (src) {
+ var a = $x("id('content')//ul//a", src);
+
+ if(a.length > 0) {
+ var href = a[0].getAttribute('href');
+ if (href != "" && href.indexOf("http://www.imdb.com") == -1) {
+ return 'http://icheckmovies.com'+href;
+ }
+ }
+}

It seems that Chrome forbids the direct access to the anchors href attribute. Maybe cause the parent document is created by the $x function and therefore has a different origin or something like this?!
However if the href attribute is retrieved via getAttribute() everything works fine.