Search code examples
javascripttypo3lightwindow

How to validate lightwindow?


Even though its origin stickmanlabs.com seems to be down, lightwindow remains a popular javascript lightbox for various purpose. Particularly the TYPO3 community seems to like it thanks to an extension that neatly embeds it. However, unfortunately this extension uses an a tag attribute params which actually isn't an attribute. It's not valid? How can I fix this?


Solution

  • This might be a hack, but it validates lightwindow as HTML Transitional. Just use the hardly used rev tag to transport the lightwindow parameters to .js.

    e.g.:

    <a href="somelink.html" rev="lightwindow_type=external,lightwindow_width=870,
    lightwindow_height=650,lightwindow_show_images=2">
    

    Then just edit the javascript file (in TYPO3 it's located @: typo3conf/ext/wt_lightwindow/files/js/lightwindow.js ) like this:

    _setupWindowElements : function(link) {
        this.element = link;
        this.element.title = null ? '' : link.getAttribute('title');
        this.element.author = null ? '' : link.getAttribute('author');
        this.element.caption = null ? '' : link.getAttribute('caption');
        this.element.rel = null ? '' : link.getAttribute('rel');
        this.element.params = null ? '' : link.getAttribute('rev');
    

    (should be around line 550 of the current version). Just cmd+f for params.