PageSourceSearch

https://tech.london/wp-content/plugins/tenweb-speed-optimizer/incl…/js/vanilla-lazyload/two_bg_vanilla.js

js tech.london collected 2026-09-26 00:05:47 UTC 2,090 bytes, 58 lines download raw bytes

1window.onload = function () {
2    two_replace_backgrounds();
3};
4window.addEventListener( 'elementor/frontend/init', () => {
5    elementorFrontend.hooks.addAction( 'frontend/element_ready/global', function( $scope ) {
6        $scope.find("*").addClass("two_elementor_element");
7        two_replace_backgrounds($scope.get( 0 ));
8    } );
9} );
10
11function two_replace_backgrounds(elementor_elements = false) {
12    let two_elements_list;
13    if(!elementor_elements){
14        two_elements_list = document.querySelectorAll("*:not(br):not(hr):not(iframe):not(pre)");
15    }else{
16        two_elements_list = elementor_elements.querySelectorAll(".two_elementor_element");
17    }
18    two_elements_list.forEach((elem) => {
19        let style = elem.currentStyle || window.getComputedStyle(elem, false);
20
21        let bg_image = style.backgroundImage;
22
23        if (bg_image === 'none' || bg_image.indexOf(window['two_svg_placeholder']) === -1) {
24            return;
25        }
26
27        bg_image = bg_image.replace(window['two_svg_placeholder'], "");
28        if (!bg_image) {
29            return;
30        }
31
32        elem.classList.add("two_bg");
33        elem.classList.add("lazy");
34        elem.classList.remove("two_elementor_element");
35        elem.setAttribute("data-bg-multi", bg_image);
36    });
37
38    if (typeof two_lazyLoadInstance === "undefined") {
39         window.two_lazyLoadInstance = new LazyLoad({
40            'callback_applied': function(element, instance){
41                let settings = instance._settings;
42                var bgDataValue = element.getAttribute("data-" + settings.data_bg_multi);
43                if (!bgDataValue) {
44                    return;
45                }
46
47                if(window.getComputedStyle(element).getPropertyValue("background-image") !== bgDataValue) {
48                    let style = element.getAttribute("style");
49                    style += "background-image: " + bgDataValue + " !important;";
50                    element.setAttribute("style", style);
51                }
52            }
53        });
54    } else {
55        two_lazyLoadInstance.update();
56    }
57}
58

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.