Embed Gloria Food KB

Author: Russ Michaels foodbooking.uk For Global Food / Gloria Food partners. Use this code to embed gloria food KB in your own website.# For WordPress, just insert a Custom HTML block and paste this code in.
 avatar
user_0735687274
html
3 years ago
2.7 kB
2
Indexable
<div id="helpjuice_js_widget_content"> <img class="helpjuice-loading-spinner" lazy-src="https://helpjuice.com/images/cube-theme/loading.gif"> </div> <script> let helpjuice_account_url = "https://orderingsystem.helpjuice.com/"; </script> <script src="https://s3.amazonaws.com/assets.helpjuice.com/helpjuice.min.js"></script> <script type="text/javascript"> var $lazyLoadedElements = jQuery && jQuery('[lazy-src]');var hasWebP = (document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp')==0);
jQuery && jQuery(document).ready(function () {
        setupLazyLoad();
    });
function setupLazyLoad() {
        if ($lazyLoadedElements.length === 0) {
            return;
        }

        $lazyLoadedElements.each(function(index, element) {
            var $element = jQuery(element);
            runOnIntersection($element, function() {
                element.getAttributeNames().filter(function(name) {return name.indexOf('lazy-') === 0;}).forEach(function(name) {
                    const currentSrc= element.getAttribute(name);
                    const currentExtension=currentSrc.substr(currentSrc.lastIndexOf('.')+1);
                    const currentCdnPrepend = 'https://d2skenm2jauoc1.cloudfront.net/assets/';
                    element.setAttribute(name.replace('lazy-',''), element.getAttribute(name)+((hasWebP && -1!==['png','jpg','jpeg','gif'].indexOf(currentExtension) && 0===currentSrc.indexOf(currentCdnPrepend))?'.webp':''));
                });
            });
        })
    }
function runOnIntersection($element, callback) {
        var viewportHeight = jQuery(window).height(),
            elementPosition = $element.offset().top,

            // preload when is half the viewport height away from scrolling
            loadPosition = Math.max(elementPosition - viewportHeight, 0);

        runOnceOnScrollPosition(loadPosition, callback);
    }
function runOnceOnScrollPosition(targetPosition, callback) {
        var lastScrollPosition = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
        if (lastScrollPosition >= targetPosition) {
            return callback();
        }

        var called = false,
            onScrollHandler = function() {
                lastScrollPosition = window.scrollY;
                if (!called && lastScrollPosition >= targetPosition) {
                    window.removeEventListener('scroll', onScrollHandler);
                    window.requestAnimationFrame(callback);
                    called = true;
                }
            };
        window.addEventListener('scroll', onScrollHandler);
    } </script>