WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: jQuery Colorbox] Stop displaying full javascript code in page source (3 posts)

  1. JamesBB
    Member
    Posted 4 years ago #

    Hello,

    I was wondering if there is any way we can remove the following from the page source and put it in an external file?

    <!-- jQuery Colorbox 3.4 | by Arne Franken, http://www.techotronic.de/ -->
    <script type="text/javascript">
    // <![CDATA[
    jQuery(document).ready(function($) {
    $("a:has(img):not(.colorbox-off)").each(function(index, obj) {
    if ($(obj).attr("href").match(/\.(?:jpe?g|gif|png|bmp)/i)) {
    var $nestedElement = $(obj).children(0);
    if ($nestedElement.is("img")) {
    var $nestedElementClassAttribute = $nestedElement.attr("class");
    var $groupId = $nestedElementClassAttribute.match('colorbox-[0-9]+') || $nestedElementClassAttribute.match('colorbox-manual');
    if ($groupId && !$nestedElementClassAttribute.match('colorbox-off')) {
    $groupId = $groupId.toString();
    if ($groupId == "colorbox-manual") {
    $groupId = "nofollow";
    }
    $(obj).colorbox({
    rel:$groupId,
    title:$nestedElement.attr("title"),
    maxWidth:"95%",maxHeight:"100%",slideshow:true, opacity:"0.85",
    transition:"elastic",
    speed:650,
    slideshowSpeed:2500,
    close:"close",
    next:"next",
    previous:"previous",
    slideshowStart:"start slideshow",
    slideshowStop:"stop slideshow",
    current:"{current} of {total} images"
    });
    }
    }
    }
    });
    });
    // ]]>
    </script> <!-- jQuery Colorbox 3.4 | by Arne Franken, http://www.techotronic.de/ -->

    Thank you!
    Jamy

    http://wordpress.org/extend/plugins/jquery-colorbox/

  2. techotronic
    Member
    Posted 4 years ago #

    Hi James,

    yeah, I thought about that a few times already... I also do not like to put the CSS for the Internet Explorer workarounds directly into the HTML.

    I'll change all that in one of the next versions.

    Caveat: for that to work, every user has to set a subdirectory of the plugin to be writable by the plugin...

    Cheers,
    Arne

  3. JamesBB
    Member
    Posted 4 years ago #

    THANK YOU very much Arne for your quick answer!

    You always react very quickly and it is much appreciated.
    Will contact you soon for donation.
    Thanks again,

    James

Topic Closed

This topic has been closed to new replies.

About this Topic