Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Bookmarklet, DOM, auto-discovery

Quote Reply
Bookmarklet, DOM, auto-discovery
I have been working on my bookmarklet for Links SQL, and written about it in my blog. I want to use auto-discovery features (not spidering) but seek coding help getting things right. Basically, I need to get this to work:

Code:


javascript:void(d=document);void(el=d.getElementsByTagName('link'));for(i=0;i<el.length;i++){if(el.getAttribute('rel').indexOf('alternate')!=-1 && el.getAttribute('type').indexOf('application/rss+xml')!=-1){rssfeed=el.getAttribute('href'))};void(location.href = 'http://slashdemocracy.org/links/page.php?do=add&Contact_Name=John&Contact_Email=john@slashdemocracy.org&cat_id=84&URL=' + window.location.href + rssfeed + '&Title=' + document.title + '&Description=' + escape(metatagged));


Or something to the same effect.

Any ideas? I hope I'm missing something really simple, like a bracket or something, but I just can't get it right.

John
Quote Reply
Re: [gotze] Bookmarklet, DOM, auto-discovery In reply to
javascript:void(d=document);
void(el=d.getElementsByTagName('link'));
for(i=0;i<el.length;i++){
if(el.getAttribute('rel').indexOf('alternate')!=-1 && el.getAttribute('type').indexOf('application/rss+xml')!=-1){
rssfeed=el.getAttribute('href'))
};
void(location.href = 'http://slashdemocracy.org/links/page.php?do=add&Contact_Name=John&Contact_Email=john@slashdemocracy.org&cat_id=84&URL=' + window.location.href + rssfeed + '&Title=' + document.title + '&Description=' + escape(metatagged));

Check your parentheses.
Quote Reply
Re: [afinlr] Bookmarklet, DOM, auto-discovery In reply to
Thanks. I'm afraid the problem is more than the parentheses ... I removed the one you marked, but still get an error.

Since the forum screws up code, I have attached a quick write-up. Some advice /coding-help would be appreciated. I can't code Frown

John
Quote Reply
Re: [gotze] Bookmarklet, DOM, auto-discovery In reply to
Actually, I don't think it needed removing - it needed changing to a curly bracket - at least, it seems that your 'for' and 'if' statements are not both closed.

If that doesn't fix it, I think someone with more javascript expertise will need to step in.
Quote Reply
Re: [afinlr] Bookmarklet, DOM, auto-discovery In reply to
I've tried changing this and that, but can't get it to work Mad

Help! I'd really like this to work.

John