PageSourceSearch

https://www.karmanos.org/Integrations/Centralpoint/Resources/Controls/Page.js?v=20250821132728

js karmanos.org collected 2026-10-02 06:09:27 UTC 9,760 bytes, 240 lines download raw bytes

1function ClipboardCopy(text, removeFormat) {
2    copyToClipboard(text);
3}
4
5function copyToClipboard(text, message, callback) {
6    if (window.CpUtilities) {
7        CpUtilities.copyToClipboard(text, message, callback);
8        return;
9    } else {
10        console.error("CpUtilities is not available. Unable to copy to clipboard.", { text, message });
11    }
12}
13
14function showTemporaryNotification(message, isError = false) {
15    if (window.CpUtilities) {
16        CpUtilities.showTemporaryNotification(message, isError);
17        return;
18    } else {
19        console.error("CpUtilities is not available. Unable to show notification.", { message, isError });
20    }
21}
22
23function openHelpWindow(url) {
24    //openWindow(url, 'Help', 800, 600, -1, -1, false, true, false);
25	openWindow(url, 'Help', 1300, 1150, -1, -1, false, true, false);
26}
27
28function openPrintWindow(url) {
29    openWindow(url, 'Print', 600, 500, -1, -1, false, true, false);
30}
31
32function openPreviewWindow(url) {
33    openWindow(url, 'Preview', 820, 600, -1, -1, false, true, true);
34}
35
36function openWindow(url, name, width, height, left, top, popUnder, scrollBars, resizable, menuBar, status, toolBar, location, directories) {
37    if (name == null) name = 'OpenWindow';
38    if (width == null) width = 600;
39    if (height == null) height = 400;
40    if (left == null) left = -1;
41    if (top == null) top = -1;
42    if (popUnder == null) popUnder = false;
43    if (scrollBars == null) scrollBars = true;
44    if (resizable == null) resizable = true;
45    if (menuBar == null) menuBar = false;
46    if (status == null) status = false;
47    if (toolBar == null) toolBar = false;
48    if (location == null) location = false;
49    if (directories == null) directories = false;
50
51    var xpos = window.outerWidth / 2 + window.screenX - (width / 2)
52    var ypos = window.outerHeight / 2 + window.screenY - (height / 2)
53  
54    var newWindow = window.open(url, name, 'menubar=' + yesNo(menuBar) + ',status=' + yesNo(status) + ',scrollbars=' + yesNo(scrollBars)
55		+ ',resizable=' + yesNo(resizable) + ',height=' + height + ',width=' + width + ',left=' + xpos + ',top=' + ypos + ',screenX=' + xpos + ',screenY=' + ypos
56		+ ',toolbar=' + yesNo(toolBar) + ',location=' + yesNo(location) + ',directories=' + yesNo(directories) + '');
57
58    if (popUnder) newWindow.blur();
59}
60
61function yesNo(value) {
62    return value ? 'yes' : 'no';
63}
64
65function resizeText(control, percent) {
66    if (control.style.fontSize == '') control.style.fontSize = '100%';
67    control.style.fontSize = parseFloat(control.style.fontSize) + percent + '%';
68}
69
70function toggleDiv(divId, remember) {
71    var style = $get(divId).style;
72    if (style.display == 'block' || style.display == '') {
73        style.display = 'none';
74        if (remember) {
75            var now = new Date();
76            fixCookieDate(now);
77            now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
78            setCookie('CPTOGGLEDIV_' + divId, 'HIDE', now);
79        }
80    } else {
81        style.display = 'block';
82        if (remember) removeCookie('CPTOGGLEDIV_' + divId);
83    }
84}
85
86function findOffset(obj) {
87    var x = y = 0;
88    if (obj.offsetParent) {
89        do {
90            x += obj.offsetLeft;
91            y += obj.offsetTop;
92        } while (obj = obj.offsetParent);
93    }
94    return [x, y];
95}
96
97function setCookie(name, value, expires, path, domain, secure) {
98    var curCookie = name + '=' + escape(value)
99		+ ((expires) ? '; expires=' + expires.toGMTString() : '')
100		+ ((path) ? '; path=' + path : '; path=/')
101		+ ((domain) ? '; domain=' + domain : '')
102		+ ((secure) ? '; secure' : '');
103    document.cookie = curCookie;
104}
105
106function createCookie(name, value, days, path, domain, secure) {
107    var expires = "";
108    if (days) {
109        var date = new Date();
110        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
111        expires = "; expires=" + date.toGMTString();
112    }
113    var curCookie = name + "=" + value + expires;
114    curCookie += ((path) ? '; path=' + path : '; path=/');
115    curCookie += ((domain) ? '; domain=' + domain : '');
116    curCookie += ((secure) ? '; secure' : '');
117    document.cookie = curCookie;
118}
119
120function getCookie(name) {
121    var dc = document.cookie;
122    var prefix = name + '=';
123    var begin = dc.indexOf('; ' + prefix);
124    if (begin == -1) {
125        begin = dc.indexOf(prefix);
126        if (begin != 0) return null;
127    }
128    else
129        begin += 2;
130    var end = document.cookie.indexOf(';', begin);
131    if (end == -1) end = dc.length;
132    return unescape(dc.substring(begin + prefix.length, end));
133}
134
135function removeCookie(name, path, domain) {
136    if (getCookie(name)) {
137        document.cookie = name + '='
138            + ((path) ? '; path=' + path : '; path=/')
139            + ((domain) ? '; domain=' + domain : '')
140            + '; expires=Thu, 01-Jan-70 00:00:01 GMT';
141    }
142}
143
144function fixCookieDate(date) {
145    var base = new Date(0);
146    var skew = base.getTime();
147    if (skew > 0) date.setTime(date.getTime() - skew);
148}
149
150function cp_HighlightTextInContent($content, criteria, className, isFullTextCriteria) {
151    if (typeof criteria === 'string' && criteria.length > 0) {
152        var highlights = [];
153        var i = 0;
154        if (isFullTextCriteria) {
155            // highlights all words used in FTI search.  Modeled after WebSiteSearch class
156            var isPhrase = criteria.length > 1 && criteria[0] === '"' && criteria[criteria.length - 1] === '"';
157            if (isPhrase)
158                highlights.push(criteria.substring(1, criteria.length - 1));
159            else {
160                var words = criteria.match(/(\+)?(""[^""]+(""|$)|(\w|\-|')+)/g);
161                if (words == null) return;
162                var noise = ['about', 'after', 'all', 'also', 'an', 'and', 'another', 'any', 'are', 'as', 'at', 'be', 'because', 'been', 'before', 'being', 'between', 'both', 'but', 'by', 'came', 'can', 'come', 'could', 'did', 'do', 'does', 'each', 'else', 'for', 'from', 'get', 'got', 'has', 'had', 'he', 'have', 'her', 'here', 'him', 'himself', 'his', 'how', 'if', 'in', 'into', 'is', 'it', 'its', 'just', 'like', 'make', 'many', 'me', 'might', 'more', 'most', 'much', 'must', 'my', 'never', 'now', 'of', 'on', 'only', 'or', 'other', 'our', 'out', 'over', 're', 'said', 'same', 'see', 'should', 'since', 'so', 'some', 'still', 'such', 'take', 'than', 'that', 'the', 'their', 'them', 'then', 'there', 'these', 'they', 'this', 'those', 'through', 'to', 'too', 'under', 'up', 'use', 'very', 'want', 'was', 'way', 'we', 'well', 'were', 'what', 'when', 'where', 'which', 'while', 'who', 'will', 'with', 'would', 'you', 'your'];
163                for (i = 0; i < words.length; i++) {
164                    var w = words[i];
165                    if (w.length > 1 && noise.indexOf(w.toLowerCase()) < 0 && w.indexOf('-') !== 0) {
166                        if (w.indexOf('+') === 0) w = w.substring(1);
167                        if (highlights.indexOf(w) < 0) highlights.push(w);
168                    }
169                }
170            }
171        }
172        else
173            highlights.push(criteria);
174
175        for (i = 0; i < highlights.length; i++) {
176            var word = highlights[i];
177            var $nodes = [];
177 // stores text nodes within element & all its descendants
178            $content.each(function () {
179                var $el = $(this);
180                $nodes.push(
181                    $el.contents().filter(function () {
182                        return this.nodeType == 3 && this.nodeValue.toLowerCase().indexOf(word.toLowerCase()) >= 0;
183                    })
184                );
185                $nodes.push(
186                    $el.find('*').contents().filter(function () {
187                        return this.nodeType == 3 && this.nodeValue.toLowerCase().indexOf(word.toLowerCase()) >= 0;
188                    })
189                );
190            });
191            if ($nodes.length > 0) {
192                var regex = new RegExp(word.replace(/\(/g, "\\(").replace(/\)/g, "\\)"), "gi");
193                for (var j = 0; j < $nodes.length; j++) {
194                    var $n = $nodes[j];
195                    $n.each(function () {
196                        var $txt = $(this);
197                        if ($txt.parent('span.' + className).length === 1) return true;
198                        $txt.replaceWith(function () {
199                            return (this.nodeValue || "").replace(regex, function (match) {
200                                return '<span class=' + className + '>' + match + '</span>';
201                            });
202                        });
203                    });
204                }
205            }
206        }
207    }
208}
209
210function cp_RemoveHighlightTextInContent($content, className) {
211    $content.find('span.' + className).each(function () {
212        var $el = $(this);
213        var $parent = $el.parent();
214        $el.replaceWith(this.childNodes);
215        $parent[0].normalize();
216    });
217}
218
219function cpExecuteFeatureWebMethod(webMethodUrl, param, onSuccess) {
220    $('#featureLoadingOverlay').show();
221    $.ajax({
222        type: 'POST',
223        url: webMethodUrl,
224        data: JSON.stringify(param),
225        contentType: 'application/json; charset=utf-8',
226        dataType: 'json',
227        success: function (response) {
228            let data = response.d;
229            if (typeof onSuccess === 'function') {
230                onSuccess(data);
231            }
232            $('#featureLoadingOverlay').hide();
233        },
234        error: function (error) {
235            console.error(error);
236            $('#featureLoadingOverlay').hide();
237        }
238    });
239    return false;
240}

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.