PageSourceSearch

https://www.deroutdoorladen.com/wp-content/plugins/oneboxshop-page…/js/block-template-loader.js?ver=3.9.0

js deroutdoorladen.com collected 2026-10-08 07:15:03 UTC 3,802 bytes, 98 lines download raw bytes

1let obs_block_template_scripts = [];
2let obs_block_template_styles = [];
3
4jQuery(document).ready(function ($) {
5    'use strict';
6    // get the localized variable holding the paths of files to load.
7    let scripts_to_load = Object.keys(obs_block_template_loader_object.scripts).map(function (key) {
8        return obs_block_template_loader_object.scripts[key];
9    });
10    let styles_to_load = Object.keys(obs_block_template_loader_object.styles).map(function (key) {
11        return obs_block_template_loader_object.styles[key];
12    });
13
14    // add the already loaded scripts to the loaded scripts.
15    for (var k = 0; k < obs_block_template_loader_object.loaded_scripts.length; k++) {
16        let path = obs_block_template_loader_object.loaded_scripts[k];
17        if (path.startsWith(obs_block_template_loader_object.home_url)) {
18            // only add the version if it is a local script.
19            path += '?ver=' + obs_block_template_loader_object.plugin_version;
20        }
21        obs_block_template_scripts.push(path);
22    }
23
24    // add the already loaded scripts to the loaded styles.
25    for (var l = 0; l < obs_block_template_loader_object.loaded_styles.length; l++) {
26        let path = obs_block_template_loader_object.loaded_styles[l];
27        if (path.startsWith(obs_block_template_loader_object.home_url)) {
28            // only add the version if it is a local style.
29            path += '?ver=' + obs_block_template_loader_object.plugin_version;
30        }
31        obs_block_template_styles.push(path);
32    }
33
34    // load scripts.
35    for (var i = 0; i < scripts_to_load.length; i++) {
36        obs_template_loader_load_script(scripts_to_load[i]);
37    }
38
39    // load styles.
40    for (var j = 0; j < styles_to_load.length; j++) {
41        obs_template_loader_load_style(styles_to_load[j]);
42    }
43});
44
45/**
46 * Enqueue a script if it hasn't been enqueued with this function before
47 *
48 * @link https://developer.mozilla.org/de/docs/Web/API/HTMLScriptElement#Dynamically_importing_scripts
49 *
50 * @param path {string} The path of the script.
51 * @param on_load_function {function} Function to be called when successfully loaded.
52 */
53function obs_template_loader_load_script(path, on_load_function) {
54    'use strict';
55    if (path.startsWith(obs_block_template_loader_object.home_url)) {
56        path = path + '?ver=' + obs_block_template_loader_object.plugin_version;
57    }
58    if (0 > obs_block_template_scripts.indexOf(path)) {
59        // enqueue the script to the header.
60        let new_script = document.createElement("script");
61        new_script.onerror = function (oError) {
62            throw new URIError("The script " + oError.target.src + " didn't load correctly.");
63        };
64        if (on_load_function) {
65            new_script.onload = on_load_function;
66        }
67        document.body.appendChild(new_script);
68        new_script.src = path;
69        new_script.defer = true;
70
71        // add the script to the loaded scripts.
72        obs_block_template_scripts.push(path);
73    }
74}
75
76/**
77 * Enqueue a style if it hasn't been enqueued with this function before
78 *
79 * @param path {string} The path of the style.
80 */
81function obs_template_loader_load_style(path) {
82    'use strict';
83    if (path.startsWith(obs_block_template_loader_object.home_url)) {
84        path = path + '?ver=' + obs_block_template_loader_object.plugin_version;
85    }
86    if (0 > obs_block_template_styles.indexOf(path)) {
87        // enqueue the style to the header.
88        let new_style = document.createElement("link");
89        new_style.rel = 'stylesheet';
90        new_style.type = 'text/css';
91        new_style.href = path;
92        new_style.media = 'all';
93        document.body.appendChild(new_style);
94
95        // add the style to the loaded styles.
96        obs_block_template_styles.push(path);
97    }
98}

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.