PageSourceSearch

https://istss.org/wp-content/plugins/joynpress-2/src/pub/js/joynpress-cachebuster.js?ver=0.0.000

js istss.org collected 2026-10-02 03:18:40 UTC 5,411 bytes, 146 lines download raw bytes

1window.$ = jQuery;
2var responseitems;
3
4function jp_cachebuster_pending_form(response) {
5    if (response.pendingform !== undefined && response.pendingform) {
6        JPAlert.spin();
7        setTimeout(() => {
8            checkCache();
9        }, 4500);
10    }
11}
12
13function jp_cachebuster_redirect(response) {
14    if (response.redirect !== undefined && response.redirect !== '') {
15        JPAlert.spin();
16        if (response.redirect === 'window.location.href') {
17            window.location.href = window.location.href;
18        } else {
19            window.location.href = response.redirect;
20        }
21    }
22}
23
24function jp_cachebuster_alert(response) {
25    if (response.alert !== undefined) {
26        if (jpcachebusterdata.alerttarget.includes(":after")) {
27            jpcachebusterdata.alerttarget = jpcachebusterdata.alerttarget.replace(":after", "");
28            jQuery(jpcachebusterdata.alerttarget).append(response.alert.content);
29        } else {
30            jQuery(jpcachebusterdata.alerttarget).prepend(response.alert.content);
31        }
32        jQuery("#JPAlertParent").hide();
33        jQuery("#JPAlertParent").slideDown();
34    }
35}
36
37function jp_cachebuster_widget(response) {
38    if (jpcachebusterdata.widget == "1") {
39        jQuery('.pmgLoginWidgetFull').html(response.widget_full)
40    }
41}
42
43function jp_cachebuster_header_items(response) {
44
45    if (response.header_items !== undefined) {
46        headerItems = response.header_items;
47        $.each(headerItems, function (index, element) {
48            if (element.text === null || element.remove) {
49                jQuery(element.target).remove();
50                return;
51            }
52            let headlink = document.createElement('a');
53            let linkText = document.createTextNode(element.text);
54            headlink.appendChild(linkText);
55            headlink.title = element.text;
56            headlink.href = element.a;
57            let newMenuItem = document.createElement("LI");
58            const cls = ["menu-item", "menu-item-type-custom", "menu-item-object-custom"];
59            newMenuItem.classList.add(...cls);
60            newMenuItem.appendChild(headlink);
61            if (element.ul !== undefined) {
62                newMenuItem.classList.add("menu-item-has-children");
63                let newDropDownMenu = document.createElement("UL");
64                newDropDownMenu.classList.add("sub-menu");
65                $.each(element.ul, function (submenuindex, submenuelement) {
66                    let newSubMenuItem = document.createElement("LI");
67                    let a = document.createElement('a');
68                    let linkText = document.createTextNode(submenuelement.text);
69                    a.appendChild(linkText);
70                    a.title = submenuelement.text;
71                    a.href = submenuelement.href;
72                    newSubMenuItem.appendChild(a);
73                    newDropDownMenu.appendChild(newSubMenuItem);
74                });
75                newMenuItem.appendChild(newDropDownMenu);
76            }
77            if (element.method !== undefined && element.method === "after") {
78                jQuery(element.target).after(newMenuItem);
79                return;
80            }
81            if (element.method !== undefined && element.method === "replace") {
82                jQuery(element.target).replaceWith(newMenuItem);
83                return;
84            }
85        });
86    }
87}
88
89function jp_cachebuster_homepage_items(response) {
90
91    if (response.homepage_items !== undefined) {
92        homepageItems = response.homepage_items;
93        $(homepageItems).each(function (index, element) {
94            //FIND QUICK LINKS REPLACE IT
95            if (element.replace !== undefined && element.content !== undefined) {
96                $(element.replace).replaceWith(element.content);
97                return true;
98            }
99            //AFTER JPInfo Put portal button
100            if (element.after !== undefined) {
101                $(element.after).after(element.content);
102                return true;
103            }
104            if (element.oldURL !== undefined) {
105                $(element.replace).find(`a[href*="${element.oldURL}"]`).attr('href', element.newURL);
106                return true;
107            }
108            if (element.before !== undefined) {
109                $(element.before).before(element.content)
110                return true;
111            }
112        });
113    }
114}
115
116function jp_cachebuster_header_login(response) {
117    if (response.headerlogin !== undefined) {
118        let header_login = document.querySelector('.jp_header_login') ?? document.querySelector('.apsardHeaderLogin') ?? document.createElement('div');
119        header_login.innerHTML = response.headerlogin;
120        if (typeof et_fix_page_container_position === "function") {
121            et_fix_page_container_position()
122        }
123    }
124}
125
126function checkCache() {
127    console.log("checkcache");
128    $.ajax({
129        url: jpcachebusterdata.rest.endpoints.getCacheBuster,
130        dataType: 'json',
131        type: 'GET',
132    }).complete(function (response) {
133        JPAlert.remove_spin();
134        jp_cachebuster_redirect(response);
135        jp_cachebuster_pending_form(response);
136        jp_cachebuster_alert(response);
137        jp_cachebuster_widget(response);
138        jp_cachebuster_header_items(response);
139        jp_cachebuster_homepage_items(response);
140        jp_cachebuster_header_login(response);
141
142
143    });
144}
145
146checkCache();

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.