Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter sjones6

    (@sjones6)

    Much appreciated! I’ll update the plugin and ensure that this is fixed.

    Thread Starter sjones6

    (@sjones6)

    Hi,

    Right. But perhaps I have no explained the issue clearly enough. The issue comes that &#039 is still rendered as a single quotation mark in the browser. Thus, the caption parameter in the markup is still interrupted by this ‘, which creates the JS error.

    The code above replaces the simple &#039 with \&#039, which is rendered with \’ so that the single quotation mark is escaped and the JS parameter is not broken.

    If I var_dump the string as it return from the shortcode, you can see it is this:

    <a onclick="javascript: mg_image_carousel_open_lightbox('PATH_TO_IMAGE', 'on', '307', 'NAME on know Princeton's campus in New Jersey.');

    That’s all well and good, but the browser interprets it as follows:

    <a onclick="javascript: mg_image_carousel_open_lightbox('PATH_TO_IMAGE', 'on', '307', 'NAME on Princeton's campus in New Jersey.'); return false;"><img src="PATH_TO_IMAGE" alt="" title=""></a>

    There’s the obvious problem that this string ‘NAME on Princeton’s campus in New Jersey.’ is broken by ‘ in Princeton’s. When clicking, this generates the following JS error since the string parameter is incorrect:

    Uncaught SyntaxError: missing ) after argument list

    since the string is now broken.

    It should be as follows:
    <a onclick="javascript: mg_image_carousel_open_lightbox('PATH_TO_IMAGE', 'on', '307', 'NAME on Princeton\'s campus in New Jersey.'); return false;"><img src="PATH_TO_IMAGE" alt="" title=""></a>.

    If you add a \ before ' within JS string parameters, it avoids this error. The code in my original post replaces &#039 with \ &#039 so that the single quotation mark is escaped in the browser.

    I’m re-opening this issue.

    Thread Starter sjones6

    (@sjones6)

    Hi,

    I’ve just posted this at maxgalleria.com.

    Thanks.

    Thread Starter sjones6

    (@sjones6)

    Hi Bob,

    Thanks for prompt reply. One of my team members has the credentials for the account. I’ll see if I can get those and then I’ll post on the max galleria forum.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)