Amazon Chooser Plugin

Creating and modifying plugins.
mjxg
Regular
Posts: 11
Joined: Thu Apr 07, 2005 2:30 pm
Contact:

Validation Code Adjustment

Post by mjxg »

martoq wrote:heres the change in .js basically just added in some customization...

Code: Select all

    img = "<img class='serendipity_amazonchr_pic' border='0' hspace='0' src='" + ImageUrl + "' alt='" + prodname + "' />";
    block = '<table>'
            +   '<tr>'
            +    '<td align="center" valign="top" rowspan="1">'
            +    '<a href="'
            +    url
            +    '">'
            +    img
            +    '</a>'
            +    '<td valign="top"> <div class="serendipity_amazonchr_head"><b>'
            +    '<a href="'
            +    url
            +    '">'
            +    prodname
            +    '</a>'
            +  ('+ catalog +')alog +')</div>'
            +    '<div class="serendipity_amazonchr_txt">'
            +    extra
            +    '<br />'
            +    'Released: '
            +    released
            +    '<br />'
            +    '</div></td>'
            +    '</td>'
            +   '</tr>'
            +   '</table>'

    self.opener.serendipity_imageSelector_addToBody(block, textarea);
Cheers...
I recently noticed that the js portion of the code (noted above) causes the feed to be invalid. The below code is what I modified it to so it would validate (the short reason, the first 'td' and 'div' tags are closed at the end, when they should be closed before the next 'td' tag)

Code: Select all

 block = '<table>'
            +   '<tr>'
            +    '<td align="center" valign="top" rowspan="1">'
            +    '<a href="'
            +    url
            +    '">'
            +    img
            +    '</a>'
            +    '<div class="serendipity_amazonchr_txt"></div></td>'
            +    '<td valign="top"> <div class="serendipity_amazonchr_title">'
            +    '<a href="'
            +    url
            +    '">'
            +    prodname
            +    '</a></div>'
            +    '<div class="serendipity_amazonchr_catalog">('+ catalog +')</div>'
            +    '<div class="serendipity_amazonchr_extra">'
            +    extra
            +    '<br />'
            +    'Released: '
            +    released
            +    '<br />'
            +    '</div>'
            +    '</td>'
            +   '</tr>'
            +   '</table>'
This change was tested and the feed now validates (I am using the Atom 0.3 feed for syndication into Livejournal). Incase anyone has any issues with the validation in the future, or if you want to throw that into cvs for the next release, I figured I'd throw this out there :D

--Mike
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Thanks for looking at that!

I actually posted an update on 4/16/05 (just two days ago) to fix this issue... Can you test the most recent cvs to make sure I got it working?

changed it to this, specifically:

Code: Select all

    block = '<table>'
            +   '<tr>'
            +    '<td align="center" valign="top" rowspan="1">'
            +    '<a href="'
            +    url
            +    '">'
            +    img
            +    '</a></td>'
            +    '<td valign="top"> <div class="serendipity_amazonchr_title">'
            +    '<a href="'
            +    url
            +    '">'
            +    prodname
            +    '</a></div>'
            +    '<div class="serendipity_amazonchr_catalog">('+ catalog +')</div>'
            +    '<div class="serendipity_amazonchr_extra">'
            +    extra
            +    '<br />'
            +    'Released: '
            +    released
            +    '<br />'
            +    '</div>'
            +    '</td>'
            +   '</tr>'
            +   '</table>' 
I got rid of the class serendipity_amazonchr_txt completely, because it was empty, and updated the css accordingly...

Sorry about that... I'm not a css/design guy...
mjxg
Regular
Posts: 11
Joined: Thu Apr 07, 2005 2:30 pm
Contact:

Post by mjxg »

lol, sorry about that then :)

I pulled the plugin down yesterday from the site that you posted the link to. I am not sure if the latest version was there, but I'm sure the changes you made are most excellent and will work :)

Thanks again!

--Mike
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

DOH!

Yeah, I forgot to update the version on my site... *sigh*

Sorry about that... my fault...

Hope it is working well for you!
Post Reply