PageSourceSearch

https://www.airocide.com/wp-content/plugins/360deg-javascript-viewer/public/js/jsv.js?ver=1.7.33

js airocide.com collected 2026-09-29 09:59:07 UTC 6,313 bytes, 170 lines download raw bytes

1/* global JSV:[] */
2class JsvInstance {
3    constructor(node) {
4        this.data = this.getData(node)
5        if (window.JavascriptViewer !== undefined && Object.keys(this.data).length !== 0) {
6            this.mainHolderId = this.getMainHolderId(node)
7            this.jsv = new JavascriptViewer(this.data)
8            this.jsv.start()
9                .then(() => {
10                    const elements = document.getElementsByClassName('360-viewer-ignore')
11                    for (let element of elements) {
12                        if (element.nodeName === 'A') {
13                            element.setAttribute('href', '#')
14                        }
15                        element.addEventListener('click', (e) => {
16                            e.stopPropagation()
17                            e.preventDefault()
18                        })
19                    }
20                })
21                .catch((reason => {
22                    console.error('Error starting JavascriptViewer, check your configuration, still having trouble> ' +
23                        'Contact us at https://www.360-javascriptviewer.com/contact en send the information below', this.data, node)
24                    console.warn(reason)
25                }))
26        } else {
27            console.warn('JavascriptViewer is not loaded')
28        }
29    }
30
31    destroy() {
32        if (this.jsv) {
33            this.jsv.destroy()
34        }
35    }
36
37    getMainHolderId(node) {
38        return node.id
39    }
40
41    deepen(obj) {
42        const result = {}
43
44        // For each object path (property key) in the object
45        for (const objectPath in obj) {
46            // Split path into component parts
47            const parts = objectPath.split('_')
48
49            // Create sub-objects along path as needed
50            let target = result
51            while (parts.length > 1) {
52                const part = parts.shift()
53                target = target[this.camelCase(part)] = target[part] || {}
54            }
55
56            // Set value at end of path
57            target[this.camelCase(parts[0])] = obj[objectPath]
58        }
59
60        return result
61    }
62
63    camelCase(str) {
64        const delimiters = '-'
65        const DEFAULT_REGEX = /[-_]+(.)?/g
66
67        const toUpper = (match, group1) => {
68            return group1 ? group1.toUpperCase() : ''
69        }
70        return str.replace(delimiters ?
71            new RegExp('[' + delimiters + ']+(.)?', 'g') :
72            DEFAULT_REGEX, toUpper)
73    };
74
75    getData(node) {
76        let data = {}
77
78        if (typeof node.attributes !== 'undefined') {
79            [].forEach.call(node.attributes, (attr) => {
80                if (/^data-/.test(attr.name)) {
81                    let val = parseInt(attr.value) || attr.value
82                    val = val.toString().length === attr.value.length ? val : attr.value
83                    if (typeof val === 'string' && (val.toLowerCase() === 'true' || val.toLowerCase() === 'false')) {
84                        val = val.toLowerCase() === 'true'
85                    }
86
87                    data[this.camelCase(attr.name.substr(5), '-')] = val
88
89                }
90            })
91        }
92
93        return this.deepen(data)
94    }
95}
96
97// Initialize the container for referencing the viewer.
98window.JSV = {
99    items: [],
100    errors: []
101}
102
103// Search for presentations.
104window.addEventListener('load', () => {
105    window.JSV.run = (reference, cb) => {
106        let found = false
107        for (let index = 0; index < window.JSV.items.length; ++index) {
108            if (window.JSV.items[index].mainHolderId === 'jsv-holder-' + reference) {
109                cb.call(window.JSV.items[index].jsv, window.JSV.items[index].jsv)
110                found = true
111            }
112        }
113        if (!found) {
114            window.JSV.errors.push('JSV with reference ' + reference + ' not found')
115        }
116    }
117    const nodes = document.getElementsByClassName('jsv-holder')
118    for (let index = 0; index < nodes.length; ++index) {
119        const parent = nodes[index].parentElement
120        if (!parent.classList.contains('360-viewer-ignore')) {
121            window.JSV.items.push(new JsvInstance(nodes[index]))
122        }
123    }
124
125    // add observer for mutations in elementor-popup-modal class elements
126    const jsvObserver = new MutationObserver((mutationsList, observer) => {
127        for (let mutation of mutationsList) {
128            if (mutation.type === 'childList') {
129                for (let node of mutation.addedNodes) {
130                    if (node.classList && node.classList.contains('elementor-popup-modal')) {
131                        const nodes = node.getElementsByClassName('jsv-holder')
132                        for (let index = 0;
132 index < nodes.length; ++index) {
133                            let found = false
134                            let jsvIndex = 0
135
136                            for (let jsvIndex = 0; jsvIndex < window.JSV.items.length; ++jsvIndex) {
137                                if (window.JSV.items[jsvIndex].mainHolderId === nodes[index].id) {
138                                    found = true
139                                    break;
140                                }
141                            }
142                            if (found) {
143                                found = false
144
145                                // cleaning partial elements that are left behind
146                                const children = nodes[index].children
147                                for (let i = 0; i < children.length; i++) {
148                                    if (!children[i].id.includes('jsv-img')) {
149                                        nodes[index].removeChild(children[i])
150                                    }
151                                }
152
153                                window.JSV.items[jsvIndex].jsv.destroy().then(() => {
154                                    window.JSV.items.splice(jsvIndex, 1)
155                                    window.JSV.items.push(new JsvInstance(nodes[index]))
156                                });
157
158                            } else {
159                                window.JSV.items.push(new JsvInstance(nodes[index]))
160                            }
161                        }
162                    }
163                }
164            }
165        }
166    })
167
168    jsvObserver.observe(document.body, {childList: true, subtree: true})
169})
170

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.