<?xml version="1.0"?>
<!-- /**
 * @Author: nguyen
 * @Date:   2020-02-12 14:01:01
 * @Last Modified by:   nguyen
 * @Last Modified time: 2020-06-22 18:55:34
 */ -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <magepow_speedoptimizer>
            <general>
                <enabled>1</enabled>
                <loading_body>0</loading_body>
                <loading_img>1</loading_img>
                <exclude_img>loaded, notlazy</exclude_img>
                <placeholder>1</placeholder>
                <regex_block><![CDATA[<main id="maincontent"]]></regex_block>
                <lazy_ajax>0</lazy_ajax>
                <exclude_html_desktop><![CDATA[//*[@data-exclude_html_desktop="1"]]]></exclude_html_desktop>
                <exclude_html_tablet><![CDATA[//*[@data-exclude_html_tablet="1"]]]></exclude_html_tablet>
                <exclude_html_mobile><![CDATA[//*[@data-exclude_html_mobile="1"]]]></exclude_html_mobile>
                <minify_html>1</minify_html>
                <minify_js>1</minify_js>
                <defer_js>0</defer_js>
                <body_includes><![CDATA[
                    <script type="text/javascript"> 
                        require(["jquery", "magepow/lazyload", "domReady!"], function($, lazyload){
                        var imgLazy = $('.lazyload').not(".loaded"); 
                        imgLazy.lazyload(); 
                        imgLazy.on('load',function(){
                            var img = $(this);
                            if(img.hasClass( "loaded" )) return;
                            if(img.attr('src') == img.data('src')){img.addClass('loaded');}
                            else {img.lazyload();}
                            if($.equalheight) $.fn.equalheight();
                        });
                        $('body').on('contentUpdated', function () {
                            var lazy = $(this).find("img.lazyload").not(".loaded").lazyload();
                            lazy.on('load',function(){
                                var img = $(this);
                                if(img.hasClass( "loaded" )) return;
                                if(img.attr('src') == img.data('src')){img.addClass('loaded');}
                                else {img.lazyload();}
                                if($.equalheight) $.fn.equalheight();
                            });
                        });
                        $('body').removeClass('loading_body');
                        }); 
                    </script>]]>
                </body_includes>
            </general>
        </magepow_speedoptimizer>    
    </default>
</config>
