• Resolved jomi0815

    (@jomi0815)


    Hello Support,

    I would like to stop the loading of external files, because in Europe this can have legal consequences without the user’s consent.

    Your plugin is great and I use it regularly. However, with the Lightbox variant “Fancybox” it loads a file from the CDN “cdn.cloudflare”:
    <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery-browser/0.1.0/jquery.browser.min.js?ver=3.30' id='fancybox-0-js'></script>

    Since I am embedding this file locally, I would like to avoid this external source.

    The following two attempts have been unsuccessful so far:

    function dequeue_footer_jquery() {
        wp_dequeue_script( 'fancybox-0' );
        wp_deregister_script('fancybox-0');
    }
    add_action( 'wp_print_scripts', 'dequeue_footer_jquery', 100 );
    function mywptheme_child_deregister_script() {
        wp_dequeue_script( 'fancybox-0' );
        wp_deregister_script('fancybox-0');
    }
    add_action( 'wp_enqueue_scripts', 'mywptheme_child_deregister_script', 100 );

    Please be so kind and give me a short instruction how to solve the problem.
    Thank you in advance!
    Jomi

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Imagely

    (@imagely)

    Hi @jomi0815,

    NextGen is pretty modular and you should be able to edit the
    wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/package.module.lightbox.php file then override adding it changed to "wp-content/ngg/modules/photocrati-lightbox"

    This will keep your custom change safe regardless the updates.

    Hope this helps

    • This reply was modified 2 years, 1 month ago by Imagely.
    • This reply was modified 2 years, 1 month ago by Imagely.
    • This reply was modified 2 years, 1 month ago by Imagely.
    Thread Starter jomi0815

    (@jomi0815)

    Thank you for your reply.
    Just to be sure I understood you correctly:

    • Edit the file “wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/package.module.lightbox.php” and leave it there?
    • And also make a copy of this edited file and put it into the folder “wp-content/ngg/modules/photocrati-lightbox”?

    I have tested this and it works:

    • because the original file is modified
    • and the file in the folder is not noticed/used.
    • => But the modifications are not update safe.

    ———

    Or did you mean:

    • Copy the original file “package.module.lightbox.php” into the folder “wp-content/ngg/modules/photocrati-lightbox”?
    • and make the changes to this file in there?

    I have also tested this and it does not work:

    • because the edited file “package.module.lightbox.php” in the folder “wp-content/ngg/modules/photocrati-lightbox” is not noticed/used.

    At the moment I don’t know if I didn’t understand you correctly and I made a mistake, or the system just doesn’t execute the instruction to overwrite…

    Could you please be so kind and clarify the correct procedure a little more?

    • This reply was modified 2 years, 1 month ago by jomi0815.
    • This reply was modified 2 years, 1 month ago by jomi0815.
    Plugin Contributor Imagely

    (@imagely)

    You are correct while assuming that the file needs to be copied to the customizable location "wp-content/ngg/modules/photocrati-lightbox"then edited and normally NGG should take care of loading the custom module instead of the default one from the plugin’s folder so perhaps there’s some caching or routing related issues preventing the moved file from applying.

    Let’s step back a bit for now because from what it seems like, the only occurrence of that CDN sourced JS file appears to be within the script register instance but it should actually be used and output locally as in the example from below:

    https://test.com/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js&#8217;

    Could you please let us know where are you getting the CDN version of it loading?

    • This reply was modified 2 years, 1 month ago by Imagely.
    • This reply was modified 2 years, 1 month ago by Imagely.
    • This reply was modified 2 years, 1 month ago by Imagely.
    • This reply was modified 2 years, 1 month ago by Imagely.
    Thread Starter jomi0815

    (@jomi0815)

    Unfortunately, not a single modified module is loaded from "/wp-content/ngg/modules/photocrati-XXX/" instead of the default plugin. I have tested it with different modules. BTW: No (third party) cache is used.

    The script that is loaded from the CDN is initiated in this file:
    /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/lightbox/package.module.lightbox.php

    (LINE: 67]
    $fancybox->scripts = array('https://cdnjs.cloudflare.com/ajax/libs/jquery-browser/0.1.0/jquery.browser.min.js', 'photocrati-lightbox#fancybox/jquery.easing-1.3.pack.js', 'photocrati-lightbox#fancybox/jquery.fancybox-1.3.4.pack.js', 'photocrati-lightbox#fancybox/nextgen_fancybox_init.js');

    Thread Starter jomi0815

    (@jomi0815)

    Any suggestions someone?

    Plugin Support Mihai Ceban

    (@mihaiimagely)

    Hi @jomi0815,

    We plan changing the CDN loading JS to local within one of the upcoming NextGen Gallery updates.

    In the meantime, you can try changing it directly within the file re-doing it after each plugin update until it is fixed from our side.

    • This reply was modified 2 years, 1 month ago by Mihai Ceban.
    Thread Starter jomi0815

    (@jomi0815)

    This seems to be a good solution. I will wait for the update.
    In the meantime, I can live with the mentioned workaround.

    Thanks for your support!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to disable loading the external script “jquery.browser”?’ is closed to new replies.