1(function() { 2 if (typeof $ !== "undefined" && $.fn && $.fn.ajaxStart && $.fn.ajaxStop && typeof NProgress !== "undefined") { 3 var npt; 4 5 $(document).ajaxStart(function () { 6 clearTimeout(npt); 7 npt = setTimeout(NProgress.start, 200); 8 }); 9 10 $(document).ajaxStop(function () { 11 clearTimeout(npt); 12 NProgress.done(); 13 }); 14 } 15 16 function setCookie(name, value) { 17 name = encodeURIComponent(name); 18 19 if (value == null) { 20 document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/"; 21 return; 22 } 23 24 var date = new Date(); 25 date.setFullYear(date.getFullYear() + 1); 26 document.cookie = name + "=" + encodeURIComponent(value) + 27 ";expires=" + date.toGMTString() + ";path=/"; 28 } 29 30 function setupDataGridDefaults() { 31 Serenity.DataGrid.defaultRowHeight = 36; 32 Serenity.DataGrid.defaultHeaderHeight = 34; 33 Serenity.DataGrid.defaultColumnWidthDelta = 10; 34 Serenity.DataGrid.defaultColumnWidthScale = 14 / 13; 35 } 36 37 if (typeof Serenity !== "undefined") { 38 setupDataGridDefaults(); 39 } 40 41 if (typeof Q != "undefined" && Q.Config) 42 Q.Config.bootstrapMessages = true; 43 44 document.addEventListener('DOMContentLoaded', function () { 45 46 var sidebar = document.querySelector('.s-sidebar'); 47 sidebar && sidebar.addEventListener('click', function (e) { 48 var a, href, i, li, siblings, sli, sa, pane; 49 a = e.target.closest('.s-sidebar-band-link'); 50 if (!a || !(/^#s_sidebar_group/.test(a.getAttribute('href') || ""))) 51 return; 52 e.preventDefault(); 53 li = a.closest('li'); 54 if (!li || li.classList.contains('active')) 55 return; 56 siblings = li.parentNode.children; 57 for (i = 0; i < siblings.length; i++) { 58 sli = siblings[i]; 59 if (li !== sli && !sli.classList.contains('active')) 60 continue; 61 sli.classList.toggle('active', li === sli); 62 sa = sli.querySelector('.s-sidebar-band-link'); 63 if (!sa) 64 continue; 65 href = sa.getAttribute('href'); 66 if (!href || !(/^#s_sidebar_group/.test(href))) 67 continue; 68 pane = document.querySelector(href); 69 pane && pane.classList.toggle('active', li === sli); 70 } 71 }); 72 73 var languageMenus = document.querySelectorAll('.s-language-selection-menu') 74 if (languageMenus.length && typeof Q != "undefined" && Q.getLookupAsync) { 75 76 function languageClick(e) { 77 var a = e.target.closest('[data-language]'); 78 if (!a) 79 return; 80 81 setCookie("LanguagePreference", a.getAttribute('data-language')); 82 window.location.reload(true); 83 } 84 85 languageMenus.forEach(function (menu) { 86 menu.addEventListener('click', languageClick); 87 }); 88 89 Q.getLookupAsync("Administration.Language").then(function (lookup) { 90 for (var l of lookup.items) { 91 languageMenus.forEach(function (menu) { 92 var li = document.createElement('li'); 93 var a = li.appendChild(document.createElement('a')); 94 a.classList.add('dropdown-item'); 95 a.setAttribute('data-language', l.LanguageId); 96 a.setAttribute('href', 'javascript:;'); 97 a.textContent = l.LanguageName; 98 menu.appendChild(li); 99 }); 100 } 101 }); 102 } 103 104 document.querySelectorAll('.s-theme-selection-menu').forEach(function (menu) { 105 menu.addEventListener('click', function (e) { 106 var a = e.target.closest('[data-theme]'); 107 if (!a) 108 return; 109 var theme = 'theme-' + a.getAttribute('data-theme'); 110 var html = document.querySelector(':root'); 111 for (var i = html.classList.length - 1; i >= 0; i--) { 112 var klass = html.classList[i]; 113 if (klass && klass.startsWith('theme-')) { 114 if (theme == klass) 115 return; 116 html.classList.remove(klass); 117 } 118 } 119 html.classList.toggle('dark', theme.endsWith('-dark')); 120 html.classList.add(theme);
121 setCookie("ProThemeSelection", a.getAttribute('data-theme'), '/'); 122 }); 123 }); 124 125 var paneToggle = document.querySelector('.s-sidebar-pane-toggle-link'); 126 paneToggle && paneToggle.addEventListener('click', function (e) { 127 var collapsed = document.body.classList.toggle('s-sidebar-pane-collapsed'); 128 if (collapsed) 129 setCookie('SidebarPaneCollapsed', '1', '/'); 130 else 131 setCookie('SidebarPaneCollapsed', null, '/'); 132 }); 133 134 var toggler = document.querySelector('#s-sidebar-toggler'); 135 toggler && toggler.addEventListener('click', function (e) { 136 137 if (document.documentElement.classList.contains('s-classic-layout') && 138 window.innerWidth >= 1200) { 139 var collapsed = document.body.classList.toggle('s-sidebar-pane-collapsed'); 140 if (collapsed) 141 setCookie('SidebarPaneCollapsed', '1', '/'); 142 else 143 setCookie('SidebarPaneCollapsed', null, '/'); 144 } 145 else { 146 document.body.classList.toggle('s-sidebar-expanded'); 147 148 document.addEventListener('mouseup', function (e) { 149 if (!e.target || 150 (!e.target.closest('.s-sidebar') && 151 !e.target.closest('#s-sidebar-toggler'))) 152 document.body.classList.remove('s-sidebar-expanded'); 153 }); 154 } 155 }); 156 157 var removingHover = false; 158 var hoverTargets = document.querySelectorAll(".s-sidebar-band-groups, .s-sidebar-band-middle, .s-sidebar-pane"); 159 for (var i = 0; i < hoverTargets.length; i++) { 160 var el = hoverTargets[i];
161 el.addEventListener('mouseover', function () { 162 removingHover = false; 163 document.body.classList.add('s-sidebar-hovered'); 164 }); 165 166 el.addEventListener('mouseout', function () { 167 removingHover = true; 168 setTimeout(function () { 169 if (removingHover) 170 document.body.classList.remove('s-sidebar-hovered'); 171 }, 350); 172 }); 173 } 174 175 var getParents = function (elem) { 176 var parents = []; 177 for (; elem && elem !== document; elem = elem.parentNode) { 178 parents.push(elem); 179 } 180 return parents; 181 }; 182 183 var searchInput = document.querySelector('.s-sidebar-search-input'); 184 185 function searchInputChange() { 186 var searchText = (searchInput.value || '').trim(); 187 188 var sidebarGroups = document.querySelectorAll('.s-sidebar-group'); 189 sidebarGroups.forEach(function (grp) { 190 grp.classList.remove('is-match'); 191 grp.classList.remove('non-match'); 192 }); 193 194 var sidebarItems = document.querySelectorAll('.s-sidebar-item'); 195 sidebarItems.forEach(function (li) { 196 li.classList.remove('is-match'); 197 li.classList.remove('non-match'); 198 }); 199 200 var parts = searchText.split(' ').map(function (x) { 201 return x.trim(); 202 }).filter(function (x) { 203 return x.length; 204 }); 205 206 if (!parts.length) 207 return; 208 209 var normalize; 210 211 if (typeof Select2 !== "undefined" && 212 Select2.util && 213 Select2.util.stripDiacritics) { 214 normalize = function (text) { 215 return Select2.util.stripDiacritics(text.trim()).toUpperCase(); 216 } 217 } 218 else { 219 normalize = function (text) { 220 return text.trim().toUpperCase(); 221 } 222 } 223 224 for (var i = 0; i < parts.length; i++) { 225 parts[i] = normalize(parts[i]); 226 } 227 228 function getTitle(el) { 229 if (el.classList.contains('s-sidebar-item')) { 230 el = el.querySelector(':scope>.s-sidebar-link .s-sidebar-link-text,:scope>.s-sidebar-section-title'); 231 if (el) 232 return normalize(el.textContent); 233 } 234 else if (el.classList.contains('s-sidebar-group')) { 235 el = el.querySelector(':scope>.s-sidebar-group-title'); 236 if (el) 237 return normalize(el.textContent); 238 } 239 240 return ''; 241 } 242 243 var matches = []; 244 245 sidebarItems.forEach(function (li) { 246 var titles = []; 247 getParents(li).forEach(function (el) { 248 var txt = getTitle(el); 249 if (txt.length) 250 titles.push(txt); 251 }); 252 253 var match = true; 254 for (var p = 0; p < parts.length; p++) { 255 var pt = parts[p]; 256 if (!titles.some(function (t) { 257 return t.indexOf(pt) >= 0; 258 })) { 259 li.classList.add('non-match'); 260 match = false; 261 break; 262 } 263 } 264 265 if (match) 266 matches.push(li); 267 }); 268 269 matches.forEach(function (li) { 270 li.classList.add('is-match'); 271 getParents(li.parentNode).forEach(function (p) { 272 if (p.classList.contains('s-sidebar-item') || 273 p.classList.contains('s-sidebar-group')) { 274 p.classList.remove('non-match'); 275 p.classList.add('is-match'); 276 } 277 }); 278 }); 279 280 sidebarGroups.forEach(function (grp) { 281 if (!grp.classList.contains('is-match')) 282 grp.classList.add('non-match'); 283 }); 284 } 285 286 if (searchInput) { 287 searchInput.addEventListener('keyup', searchInputChange); 288 searchInput.addEventListener('change', searchInputChange); 289 } 290 });
vendor: 5 bytes, line 291
291})();
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.