{"version":3,"sources":["Apfco.js","HttpPostedFileBase.js","IFormFile.js","ViewSharedLayoutPrimary.js"],"names":["Apfco","ConvertNodeListToArray","inputNodeList","elementList","i","length","node","nodeType","Node","ELEMENT_NODE","push","UpdateQueryString","key","value","url","window","location","href","hash","re","RegExp","test","replace","split","separator","indexOf","StripQueryStringAndHashFromUrl","Sleep","milliseconds","Promise","resolve","setTimeout","ReplaceAll","inputString","findString","replaceString","SetDisableFormButtonsOnSubmit","target","$","find","each","this","submit","event","attr","prop","currentForm","click","type","name","val","insertBefore","children","first","HttpPostedFileBase","targetInputFile","thisObj","elLabelWrapper","parentElement","elLabelSpan","getElementsByTagName","classList","add","contains","style","lineHeight","offsetHeight","toString","on","filename","files","pop","substring","e","innerHTML","HttpPostedFileBaseList","HttpPostedFileBasesByClass","document","getElementsByClassName","item","IFormFile","console","log","IFormFileList","elementsByClass","LayoutPrimary","disableFormButtonsOnSubmit","wrapTrademarkSymbolsWithSuperscriptTag","regexp","contents","filter","nodeValue","replaceWith","trigger","removeClass","blur","focus","not","DataTable","paging","info","searching","aaSorting","tooltip","prototype","layoutPrimaryList"],"mappings":"AAEA,IAAAA,OACA,SAAAA,GAeAA,EAAAC,uBAbA,SAAAC,GACA,IAAAC,EAAA,GACA,GAAAD,EACA,IAAA,IAAAE,EAAA,EAAAA,EAAAF,EAAAG,OAAAD,IAAA,CACA,IAAAE,EAAAJ,EAAAE,GAEAE,EAAAC,UAAAC,KAAAC,cACAN,EAAAO,KAAAJ,EAEA,CAEA,OAAAH,CACA,EA+BAH,EAAAW,kBA5BA,SAAAC,EAAAC,EAAAC,GACAA,IACAA,EAAAC,OAAAC,SAAAC,MACA,IAAAC,EAAAC,EAAA,IAAAC,OAAA,SAAAR,EAAA,kBAAA,MACA,GAAAO,EAAAE,KAAAP,GACA,OAAA,MAAAD,EACAC,EAAAQ,QAAAH,EAAA,KAAAP,EAAA,IAAAC,EAAA,SAEAK,EAAAJ,EAAAS,MAAA,KACAT,EAAAI,EAAA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AAA,2BAAAiE,SACA,GACA,CA2CA,OA1CAlB,EAAAmB,UAAAlB,2BAAA,WAIAhD,EAAAG,KAAAJ,QAAAE,KAAA,QAAAC,MAAA,WACAF,EAAAG,MAAAC,QAAA,SAAAC,GACAL,EAAAG,MAAAF,KAAA,uBAAAC,MAAA,WACAF,EAAAG,MAAAG,KAAA,2BACAN,EAAAG,MAAAI,KAAA,YAAA,EAEA,GACA,GACA,IACAP,EAAAG,KAAAJ,QAAAE,KAAA,QAAAC,MAAA,WACA,IAAAM,EAAAL,KACAH,EAAAG,MAAAF,KAAA,uBAAAC,MAAA,WACAF,EAAAG,MAAAG,KAAA,2BACAN,EAAAG,MAAAM,OAAA,SAAAJ,GACAL,EAAA,WAAAM,KAAA,CACAI,KAAA,SACAC,KAAAX,EAAAG,MAAAG,KAAA,QACA/B,MAAAyB,EAAAG,MAAAS,QACAC,aAAAb,EAAAQ,GAAAM,WAAAC,QACA,GAEA,GACA,GACA,EACAgC,EAAAmB,UAAAjB,uCAAA,WAEA,IAAAC,EAAA,SACAlD,EAAA,yBAAAmD,WAAAC,QAAA,WACA,OAAA,IAAAjD,KAAAlC,UAAAiF,EAAAnE,KAAAoB,KAAAkD,UACA,IAAAC,aAAA,WACA,OAAAnD,KAAAkD,UAAArE,QAAAkE,EAAA,gBACA,IACAlD,EAAA,yBAAAmD,WAAAC,QAAA,WACA,OAAA,IAAAjD,KAAAlC,QACA,IAAAqF,aAAA,WACA,OAAAnD,KAAAkD,UAAArE,QAAA,SAAA,gBACA,GACA,EACA+D,CACA,CA5FA,GA8FAoB,kBAAA,GACAnE,GAAA,WAEA,IADA,IAAA8C,EAAAP,SAAAC,uBAAA,iBACA1E,EAAA,EAAAA,EAAAgF,EAAA/E,OAAAD,IACAqG,kBAAA/F,KAAA,IAAA2E,cAAAD,EAAAL,KAAA3E,IAGA","file":"site.min.js","sourcesContent":["/// \n//Helper namespace containing several utility functions\nvar Apfco;\n(function (Apfco) {\n //Converts values returned by document.getElementsByClassName() - Taken from here: https://stackoverflow.com/questions/12686927/typescript-casting-htmlelement\n function ConvertNodeListToArray(inputNodeList) {\n var elementList = [];\n if (inputNodeList) {\n for (var i = 0; i < inputNodeList.length; i++) {\n var node = inputNodeList[i];\n // Make sure it's really an Element\n if (node.nodeType == Node.ELEMENT_NODE) {\n elementList.push(node);\n }\n }\n }\n return elementList;\n }\n Apfco.ConvertNodeListToArray = ConvertNodeListToArray;\n //Update query string parameters - Taken from here: https://stackoverflow.com/questions/5999118/add-or-update-query-string-parameter\n function UpdateQueryString(key, value, url) {\n if (!url)\n url = window.location.href;\n var re = new RegExp(\"([?&])\" + key + \"=.*?(&|#|$)(.*)\", \"gi\"), hash;\n if (re.test(url)) {\n if (typeof value !== 'undefined' && value !== null)\n return url.replace(re, '$1' + key + \"=\" + value + '$2$3');\n else {\n hash = url.split('#');\n url = hash[0].replace(re, '$1$3').replace(/(&|\\?)$/, '');\n if (typeof hash[1] !== 'undefined' && hash[1] !== null)\n url += '#' + hash[1];\n return url;\n }\n }\n else {\n if (typeof value !== 'undefined' && value !== null) {\n var separator = url.indexOf('?') !== -1 ? '&' : '?';\n hash = url.split('#');\n url = hash[0] + separator + key + '=' + value;\n if (typeof hash[1] !== 'undefined' && hash[1] !== null)\n url += '#' + hash[1];\n return url;\n }\n else\n return url;\n }\n }\n Apfco.UpdateQueryString = UpdateQueryString;\n //Example, changes http://localhost:61222/?test=123#NavContent to http://localhost:61222/ - From https://stackoverflow.com/questions/2540969/remove-querystring-from-url\n function StripQueryStringAndHashFromUrl(url) {\n return url.split(/[?#]/)[0];\n }\n Apfco.StripQueryStringAndHashFromUrl = StripQueryStringAndHashFromUrl;\n //Use in async functions to insert a delay before continuing processing. Example: await Apfco.Sleep(2000);\n function Sleep(milliseconds) {\n return new Promise(function (resolve) {\n setTimeout(resolve, milliseconds);\n });\n }\n Apfco.Sleep = Sleep;\n //Replace all instances of a value in a string - native string.replace() only works on first instance\n function ReplaceAll(inputString, findString, replaceString) {\n var inputStringRegEscaped = inputString.replace(/([.*+?^=!:${}()|\\[\\]\\/\\\\])/g, \"\\\\$1\");\n return inputString.replace(new RegExp(findString, 'g'), replaceString);\n }\n Apfco.ReplaceAll = ReplaceAll;\n //Use jQuery to disable all form buttons on the page when clicked on - except those marked with apfDontDisableOnSubmit\n //Combined into method as this code needs to be used on some of the review iframe views\n function SetDisableFormButtonsOnSubmit(target) {\n $(target).find('form').each(function () {\n $(this).submit(function (event) {\n $(this).find(':input[type=submit], :button').each(function () {\n if (!$(this).attr('apfDontDisableOnSubmit')) { //Don't disable if the apfDontDisableOnSubmit=\"true\" attribute exists on the button\n $(this).prop('disabled', true);\n }\n });\n });\n });\n $(target).find('form').each(function () {\n var currentForm = this; //Get the current form\n $(this).find(':input[type=submit], :button').each(function () {\n if (!$(this).attr('apfDontDisableOnSubmit')) { //Don't disable if the apfDontDisableOnSubmit=\"true\" attribute exists on the button\n $(this).click(function (event) {\n $('').attr({\n type: 'hidden',\n name: $(this).attr('name'),\n value: $(this).val()\n }).insertBefore($(currentForm).children().first()); //Append to the start of the current form, instead of next to the button itself or the end of the form. Otherwise it may mess with any last-child CSS selectors\n });\n }\n });\n });\n }\n Apfco.SetDisableFormButtonsOnSubmit = SetDisableFormButtonsOnSubmit;\n})(Apfco || (Apfco = {}));\n//# sourceMappingURL=Apfco.js.map","/// \n//Used in the HttpPostedFileBase editor template - scripts those inputs to show the name of the selected file\nvar HttpPostedFileBase = /** @class */ (function () {\n //Methods\n function HttpPostedFileBase(targetInputFile) {\n var thisObj = this;\n //Assign elements\n this.targetInputFile = targetInputFile;\n this.elLabelWrapper = targetInputFile.parentElement;\n this.elLabelSpan = this.elLabelWrapper.getElementsByTagName('span')[0];\n //All class to adjust styles\n this.elLabelWrapper.classList.add('HttpPostedFileBaseWrapper');\n if (this.targetInputFile.classList.contains('input-validation-error')) { //ASP.Net MVC - If a server-side validation error class was found on the , apply it to the wrapper\n this.elLabelWrapper.classList.add('input-validation-error');\n }\n this.elLabelSpan.style.lineHeight = this.elLabelWrapper.offsetHeight.toString() + 'px'; //Set the line height of the label to the rendered height of the select to vertically center the content inside\n //Assign events\n $(thisObj.target).on('change', function () {\n //Get the selected filename\n var filename = '';\n try {\n //Attempt to get the filename from available variables\n if (this.files) { //Attempt to use the files array first (should work in most newer browsers)\n filename = this.files[0].name;\n }\n else { //Fallback for IE9 - have to strip off full directory path\n filename = this.value.split(/(\\\\|\\/)/g).pop();\n }\n //Truncate the filename if necessary\n if (filename.length > 24)\n filename = filename.substring(0, 24) + '...';\n }\n catch (e) { //Worst-case fallback - just state that the file was selected\n filename = 'File Selected';\n }\n //Finally apply the formatted filename to the label\n thisObj.elLabelSpan.innerHTML = filename;\n });\n console.log('IFormFile initialized');\n }\n return IFormFile;\n}());\n//Instantiate on page load if matching HTML is found\n//let IFormFileList = [];\nvar IFormFileList = [];\n$(function () {\n var elementsByClass = document.getElementsByClassName(\"IFormFile\");\n for (var i = 0; i < elementsByClass.length; i++) {\n //IFormFileList.push(new IFormFile(elementsByClass.item(i)));\n IFormFileList.push(new IFormFile(elementsByClass.item(i)));\n }\n ;\n});\n//# sourceMappingURL=IFormFile.js.map","var LayoutPrimary = /** @class */ (function () {\n //Methods\n function LayoutPrimary(target) {\n var thisObj = this;\n this.disableFormButtonsOnSubmit();\n this.wrapTrademarkSymbolsWithSuperscriptTag();\n console.log('LayoutPrimary initialized');\n //Get all linked elements\n this.target = target;\n //Make it so every submit button found in every form on the site is diabled when the form is submitted (solves numerous issues)\n //Fixes include the \"The provided anti-forgery token was meant for user \"\", but the current user is \"ACT-2JFD6AMVSN7C\".\" which is caused by users double-clicking on the login button\n //Note that this is NOT for security, as users can diable JS. This is only for avoiding user-unfriendly or confusing error messages\n Apfco.SetDisableFormButtonsOnSubmit(this.target);\n //Wrap all registered trademark symbols with , as it applies to almost every design mockup we receive - see here https://stackoverflow.com/questions/19364581/adding-superscript-sup-tags-around-all-trademark-and-registered-trademark-symb\n var regexp = /[\\xAE]/;\n $('body :not(script,sup)').contents().filter(function () {\n return this.nodeType === 3 && (regexp.test(this.nodeValue));\n }).replaceWith(function () {\n return this.nodeValue.replace(regexp, '$&');\n });\n $('body :not(script,sup)').contents().filter(function () {\n return this.nodeType === 3;\n }).replaceWith(function () {\n return this.nodeValue.replace(/[™®©]/g, '$&');\n });\n //Bootstrap v4 - Hack to fix double-click requirement of navbar drop-downs. Click them once to bypass, and then hide/blur in cases where a particular browswer does actually display them\n $(\".dropdown-toggle\").trigger(\"click\");\n $('.dropdown').removeClass('show');\n $('.dropdown-toggle').attr('aria-expanded', 'false');\n $('.dropdown-menu').removeClass('show');\n $(\".dropdown-toggle\").blur();\n //Set the default focus to the first non-hidden input on all pages with a form. Makes pages easier to fill out with the keyboard\n if (document.getElementsByTagName('form').length > 0) {\n $('form:first *:input[type!=hidden]:first').focus();\n }\n //Apply datatables sort to all bootstrap tables in the site\n $(this.target).find('table.table').not('.noDataTable').each(function () {\n $(this).DataTable({\n \"paging\": false,\n \"info\": false,\n \"searching\": false,\n \"aaSorting\": [] //Make it so Datatables doesn't apply a default sort on page load - https://datatables.net/forums/discussion/1399/how-to-no-sort-by-default\n });\n });\n //Bootstrap v4 - enable tooltips everwhere: https://getbootstrap.com/docs/4.0/components/tooltips/\n $(function () {\n $('[data-toggle=\"tooltip\"]').tooltip();\n });\n }\n LayoutPrimary.prototype.disableFormButtonsOnSubmit = function () {\n //Make it so every submit button found in every form on the site is diabled when the form is submitted (solves numerous issues)\n //Fixes include the \"The provided anti-forgery token was meant for user \"\", but the current user is \"ACT-2JFD6AMVSN7C\".\" which is caused by users double-clicking on the login button\n //Note that this is NOT for security, as users can diable JS. This is only for avoiding user-unfriendly or confusing error messages\n $(this.target).find('form').each(function () {\n $(this).submit(function (event) {\n $(this).find(':input[type=submit]').each(function () {\n if (!$(this).attr('apfDontDisableOnSubmit')) { //Don't disable if the apfDontDisableOnSubmit=\"true\" attribute exists on the button\n $(this).prop('disabled', true);\n }\n });\n });\n });\n $(this.target).find('form').each(function () {\n var currentForm = this; //Get the current form\n $(this).find(':input[type=submit]').each(function () {\n if (!$(this).attr('apfDontDisableOnSubmit')) { //Don't disable if the apfDontDisableOnSubmit=\"true\" attribute exists on the button\n $(this).click(function (event) {\n $('').attr({\n type: 'hidden',\n name: $(this).attr('name'),\n value: $(this).val()\n }).insertBefore($(currentForm).children().first()); //Append to the start of the current form, instead of next to the button itself or the end of the form. Otherwise it may mess with any last-child CSS selectors\n });\n }\n });\n });\n };\n LayoutPrimary.prototype.wrapTrademarkSymbolsWithSuperscriptTag = function () {\n //Wrap all registered trademark symbols with , as it applies to almost every design mockup we receive - see here https://stackoverflow.com/questions/19364581/adding-superscript-sup-tags-around-all-trademark-and-registered-trademark-symb\n var regexp = /[\\xAE]/;\n $('body :not(script,sup)').contents().filter(function () {\n return this.nodeType === 3 && (regexp.test(this.nodeValue));\n }).replaceWith(function () {\n return this.nodeValue.replace(regexp, '$&');\n });\n $('body :not(script,sup)').contents().filter(function () {\n return this.nodeType === 3;\n }).replaceWith(function () {\n return this.nodeValue.replace(/[™®©]/g, '$&');\n });\n };\n return LayoutPrimary;\n}());\n//On page load, take all found elements with the classname and create objects for them to initialize\nvar layoutPrimaryList = [];\n$(function () {\n var elementsByClass = document.getElementsByClassName(\"LayoutPrimary\");\n for (var i = 0; i < elementsByClass.length; i++) {\n layoutPrimaryList.push(new LayoutPrimary(elementsByClass.item(i)));\n }\n ;\n});\n//# sourceMappingURL=ViewSharedLayoutPrimary.js.map"]}