PageSourceSearch

https://chavavo.net/blog/wp-content/plugins/op-builder/public/asse…&ver=c28999de1ab0a3fc90c9dff723d13c14

js chavavo.net collected 2026-09-25 03:16:22 UTC 2,861 bytes, 55 lines download raw bytes

1/**
2 * DOMContentLoaded Event Deferral Helper
3 * 
4 * Intercepts DOMContentLoaded event listeners and automatically wraps their
5 * callbacks with requestAnimationFrame to prevent forced synchronous layouts
6 * (reflows) that negatively impact page performance metrics.
7 * 
8 * This approach maintains full backward compatibility while deferring layout-
9 * triggering operations (offsetHeight, getComputedStyle, etc.) until the next
10 * animation frame, allowing the browser to optimize rendering.
11 * 
12 * @see https://web.dev/avoid-large-complex-layouts-and-layout-thrashing/
13 */
14(function() {
15    'use strict';
16    
17    var originalAddEventListener = document.addEventListener;
18    var isDOMReady = document.readyState === 'complete' || document.readyState === 'interactive';
19    
20    /**
21     * Intercept document.addEventListener to defer DOMContentLoaded callbacks
22     * 
23     * @param {string} event - Event name
24     * @param {Function} callback - Event callback
25     * @param {Object|boolean} options - Event listener options
26     */
27    document.addEventListener = function(event, callback, options) {
28        if (event === 'DOMContentLoaded' && typeof callback === 'function') {
29            var deferredCallback = function(e) {
30                requestAnimationFrame(function() {
31                    callback.call(this, e);
32                }.bind(this));
33            };
34            
35            if (isDOMReady) {
36                // DOM already loaded, execute immediately but deferred
37                requestAnimationFrame(function() {
38                    callback.call(document, new Event('DOMContentLoaded'));
39                });
40            } else {
41                originalAddEventListener.call(document, event, deferredCallback, options);
42            }
43        } else {
44            originalAddEventListener.call(document, event, callback, options);
45        }
46    };
47    
48    // Track when DOM becomes ready
49    if (!isDOMReady) {
50        originalAddEventListener.call(document, 'DOMContentLoaded', function() {
51            isDOMReady = true;
52        });
53    }
54})();
55document.addEventListener("DOMContentLoaded",function(e){var n=window.location.search.slice(1).split("&").map(function(e){for(var n=e.split("=");n.length<2;)n.push("");return[n[0],e=n.slice(1).join("=")]}).reduce(function(e,n){var t=n.map(decodeURIComponent),o=t[0],a=t[1],i=o in e;return i&&"string"==typeof e[o]?e[o]=[e[o],a]:i?e[o].push(a):e[o]=a,e},{}),t="";for(var o in n)o&&(t+=(t?",":"")+'.op3-element [data-op-url-mapping="'+o+'"]:not(:disabled):not(input:read-only)');t&&document.querySelectorAll(t).forEach(function(e){var t=e.getAttribute("data-op-url-mapping"),o=n[t];e.matches("select")?e.querySelector('option[value="'+o+'"]')&&(e.value=o):e.matches('input[type="checkbox"],input[type="radio"]')?e.checked=-1===["false","unchecked","none","0",""].indexOf(o):e.value=o})});

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.