1// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification 2// for details on configuring this project to bundle and minify static web assets. 3 4// TEMP FIX FOR CONSOLE ERROR: jQuery 3.x compatibility polyfill for jQuery Mobile 5// $.event.props and $.event.mouseHooks were apparently removed in jQuery 3.x 6(function($) { 7 if (!$.event.props) { 8 $.event.props = []; 9 } 10 if (!$.event.mouseHooks) { 11 $.event.mouseHooks = { props: [] }; 12 } 13})(jQuery); 14 15// Write your JavaScript code. 16 17 18var loadPartial = async function (action, controller, routeData) { 19 var path = controller + '/' + action; 20 var queryString = ""; 21 if (typeof routeData === 'object' && routeData !== null && 'area' in routeData) 22 path = routeData.area + '/' + path; 23 24 25 if (typeof routeData === 'object' && routeData !== null) 26 queryString = "?" + new URLSearchParams(routeData).toString(); 27 28 return resp = await fetch(Utils.baseUrl + path + queryString, { 29 method: "GET", 30 }) 31}; 32 33var executeCallback = function (callback, newElement) { 34 if (callback !== null && callback.length > 0) { 35 36 var fn = window[callback]; 37 if (typeof fn === 'function') { 38 39 try { 40 fn(newElement); 41 } catch (e) { 42 console.log('error executing callback'); 43 console.log(e); 44 } 45 46 } else { 47 console.log('callback is not a function'); 48 } 49 } 50}; 51 52var hasLoadedPartials = false; 53 54//on document ready scan for ajaxpartials to execute 55//note: this could be further optimized to trigger the partials sooner than wait for the full document. although that would invali
55date priority queueing 56document.addEventListener("readystatechange", async (event) => { 57 58 if (event.target.readyState === "loading" || hasLoadedPartials) 59 return; 60 61 hasLoadedPartials = true; 62 63 //sort partials by their priority score. 64 const sortedPartials = Array.from(document.querySelectorAll('.js-ajax-partial')).sort((a, b) => $(b).data('requestpriority') - $(a).data('requestpriority')); 65 for (const ajaxPartial of sortedPartials) { 66 var priority = $(ajaxPartial).data('requestpriority'); 67 //console.log('request sort value: ' + priority); 68 var self = $(ajaxPartial); 69 var action = self.data('action'); 70 var controller = self.data('controller'); 71 var routeData = self.data('routeValues'); 72 var callback = self.data('callback'); 73 74 //await each partial - they get queued by IIS/.net in a synchronous fashion on server side anyway. this allows 75 //us to have more control over the order here. 76 var resp = await loadPartial(action, controller, routeData) 77 if (resp.ok) { 78 var html = await resp.text(); 79 var newElement = $(html); 80 self.replaceWith(newElement); 81 executeCallback(callback, newElement.get(0)); 82 } 83 else { 84 console.log('error loading partial: ' + action + ' controller: ' + controller); 85 var errorMessage = { 86 "Url": window.location.href, 87 "Message": "error loading partial", 88 "Error": JSON.stringify({ error: 'there was an error', action: action, controller: controller, routeData: routeData }) 89 } 90 //log.Error(errorMessage); 91 } 92 }; 93});
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.