PageSourceSearch

https://wordy-rappinghood.net/lib/jquery_tiki/tiki-vue.js

js wordy-rappinghood.net collected 2026-10-04 19:57:10 UTC 2,918 bytes, 76 lines download raw bytes

1/** This is currently only used in the "old" vue 2 modules */
2function observeVueApp(vm_instance) {
3    // Options for the observer (which mutations to observe)
4    const config = { attributes: false, childList: true, subtree: true };
5
6    // Select the node that will be observed for mutations
7    const targetNode = $(vm_instance.$root.$el).closest('.modal')[0];
8
9    if (!targetNode) return;
10
11    // Create an observer instance linked to the callback function
12    const observer = new MutationObserver(callback);
13
14    // Start observing the target node for configured mutations
15    observer.observe(targetNode, config);
16
17    // Callback function to execute when mutations are observed
18    function callback(mutationsList, observer) {
19        // Use traditional 'for loops' for IE 11
20        for(const mutation of mutationsList) {
21            if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {
22                mutation.removedNodes.forEach(node => {
23                    if (node.className === 'modal-body') {
24                        vm_instance.$destroy();
25                        // Later, you can stop observing
26                        observer.disconnect();
27                    }
28                });
29            }
30        }
31    };
32}
33
34function addScopedStyleIdentifier(vm_instance, identifier) {
35    if (! vm_instance || ! identifier) return;
36    const rootEl = vm_instance.$root.$el;
37    if (rootEl && rootEl.parentElement) {
38        rootEl.parentElement.setAttribute(identifier, '');
39    }
40}
41
42/** This is currently only used in the "new" Vue3 modules */
43function onDOMElementRemoved(id, rootCallback) {
44    // Options for the observer (which mutations to observe)
45    const config = { attributes: false, childList: true, subtree: true };
46
47    // Select the node that will be observed for mutations
48    const targetNode = $('body')[0];
49
50    if (!targetNode) return;
51
52    // Create an observer instance linked to the callback function
53    const observer = new MutationObserver(callback);
54
55    // Start observing the target node for configured mutations
56    observer.observe(targetNode, config);
57
58    // Callback function to execute when mutations are observed
59    function callback(mutationsList, observer) {
60        // Use traditional 'for loops' for IE 11
61        for(const mutation of mutationsList) {
62            if (mutation.type === 'childList' && mutation.removedNodes.length > 0) {
63                mutation.removedNodes.forEach(node => {
64                    // If node is element (1)
65                    if (node.nodeType === 1) {
66                        if (node.id === id || node.querySelector(`#${$.escapeSelector(id)}`)) {
67                            rootCallback();
68                            // Later, you can stop observing
69                            observer.disconnect();
70                        }
71                    }
72                });
73            }
74        }
75    };
76}

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.