1function createNewElement(element, elementName, elementValue) 2{ 3 var input = document.createElement('input'); 4 input.setAttribute('type', 'hidden'); 5 input.setAttribute('name', elementName); 6 input.setAttribute('value', elementValue); 7 element.appendChild(input); 8 9 return input; 10} 11 12function submitForm(app, sect, path, act, id, page, order, useSecure, jsonOptions) 13{ 14 // Determine Action URL 15 16 var url = "/egov/apps/manager/admin.egov"; 17 if (useSecure == 1) 18 { 19 url = "https://" + document.URL.split('/',3)[2] + url; 20 } 21 22 // Check to see if the form exists and remove it. 23 24 var quickEditForm = document.getElementById('eGov_QuickEditForm'); 25 if (quickEditForm !== null) quickEditForm.parentNode.removeChild(quickEditForm); 26 27 // Create Form 28 29 var form = document.createElement('form'); 30 form.setAttribute('id', 'eGov_QuickEditForm'); 31 form.setAttribute('target', '_blank'); 32 form.setAttribute('action', url); 33 form.setAttribute('method', 'post'); 34 35 document.body.appendChild(form); 36 37 // Add Elements 38 39 if (app.constructor == Array) 40 { 41 var len = app.length; 42 43 createNewElement(form, 'app', (len > 0) ? app[0] : ''); 44 createNewElement(form, 'sect', (len > 1) ? app[1] : ''); 45 createNewElement(form, 'path', (len > 2) ? app[2] : ''); 46 createNewElement(form, 'act', (len > 3) ? app[3] : ''); 47 createNewElement(form, 'id', (len > 4) ? app[4] : ''); 48 createNewElement(form, 'page', (len > 5) ? app[5] ? app[5] : app[0] + '_1' : app[0] + '_1'); 49 createNewElement(form, 'order', (len > 6) ? app[6] : ''); 50 } 51 else 52 { 53 createNewElement(form, 'app', app); 54 createNewElement(form, 'sect', sect); 55 createNewElement(form, 'path', path); 56 createNewElement(form, 'act', act); 57 createNewElement(form, 'id', id); 58 createNewElement(form, 'page', (page) ? page : app + '_1'); 59 createNewElement(form, 'order', (order) ? order : ''); 60 } 61 62 for (var key in jsonOptions) 63 { 64 if (key) 65 { 66 createNewElement(form, key, jsonOptions[key]); 67 } 68 } 69 70 // Submit Form 71 72 form.submit(); 73} 74 75function submitDelete(app, sect, path, act, id, page, order) 76{ 77 if (confirm('Are you sure you want to delete this item?\n\nClick \'OK\' to confirm, or \'Cancel\' to return without making any changes.')) 78 { 79 submitForm(app, sect, path, act, id, page, order); 80 } 81 else 82 { 83 return false; 84 } 85} 86 87function searchForm(app, sect, path, act, id, page, order, isModal, additionalValues) 88{ 89 // Check to see if the form exists and create it if it doesn't it. 90 91 var publicForm = document.getElementById('eGov_publicForm'); 92 var arrSkip = new Array('app','sect','path','act','id','page','order'); 93 94 if (publicForm === null) 95 { 96//alert('make it'); 97 publicForm = document.createElement('form'); 98 publicForm.setAttribute('id', 'eGov_publicForm'); 99 document.body.appendChild(publicForm); 100 } 101//else { alert('got it'); } 102 103 publicForm.setAttribute('method', 'get'); 104 publicForm.setAttribute('action', location.pathname); 105 106 // Add Elements 107 108 if (app.constructor == Array) 109 { 110 var len = app.length; 111 createNewElement(publicForm, 'app', (len > 0) ? app[0] : ''); 112 createNewElement(publicForm, 'sect', (len > 1) ? app[1] : ''); 113 createNewElement(publicForm, 'path', (len > 2) ? app[2] : ''); 114 createNewElement(publicForm, 'act', (len > 3) ? app[3] : ''); 115 createNewElement(publicForm, 'id', (len > 4) ? app[4] : ''); 116 createNewElement(publicForm, 'page', (len > 5) ? app[5] ? app[5] : app[0] + '_1' : app[0] + '_1'); 117 createNewElement(publicForm, 'order', (len > 6) ? app[6] : ''); 118 } 119 else 120 { 121 createNewElement(publicForm, 'app', app); 122 createNewElement(publicForm, 'sect', sect); 123 createNewElement(publicForm, 'path', path); 124 createNewElement(publicForm, 'act', act); 125 createNewElement(publicForm, 'id', id); 126 createNewElement(publicForm, 'page', (page) ? page : app + '_1'); 127 createNewElement(publicForm, 'order', (order) ? order : ''); 128 } 129 130 for (var key in additionalValues) 131 { 132 if (key) 133 { 134 createNewElement(publicForm, key, additionalValues[key]); 135 arrSkip.push(key); 136 } 137 } 138 139 // Handle Query String Elements 140 141 var queryString = window.location.search; 142 143 if (queryString) 144 { 145 queryString = queryString.replace(/^\?/, ''); 146 queryString = queryString.replace(/(&|;)$/, ''); 147 queryString = queryString.replace(/&/g, '~--AMPERSAND--~'); 148 queryString = queryString.replace(/&/g, ';'); 149 150 var arrPair = queryString.split(/;/); 151 for (var i = 0; i < arrPair.length; i++) 152 { 153 var arrKeyValue = arrPair[i].split(/=/); 154 if (arrKeyValue.length == 2) 155 {
156 if (eGov_publicGrep(arrKeyValue[0], arrSkip)) 157 { 158 continue; 159 } 160 arrKeyValue[1] = decodeURIComponent(arrKeyValue[1]); 161 arrKeyValue[1] = arrKeyValue[1].replace(/~--AMPERSAND--~/g, '&'); 162 if (publicForm.elements.namedItem( arrKeyValue[0] )) 163 { 164 if (publicForm[arrKeyValue[0]].type == 'hidden') 165 { 166 publicForm[arrKeyValue[0]].value = arrKeyValue[1]; 167 } 168 } 169 else 170 { 171 createNewElement(publicForm, arrKeyValue[0], arrKeyValue[1]); 172 } 173 } 174 } 175 } 176 177 // Submit Form 178 179 publicForm.submit(); 180} 181 182function eGov_publicGrep(strVal, arrCheck) 183{ 184 for (var i = 0; i < arrCheck.length; i++) 185 { 186 if (strVal == arrCheck[i]) 187 { 188 return true; 189 } 190 } 191 192 return false; 193} 194 195/* Type-ahead filter for the public Payment Center / Bill Pay item lists. 196 Handles BOTH the grouped view (eGov_groupHeader + <ul><li>, same structure as the 197 manager Accept Payments filter) and the non-grouped Browse view (a <table> of rows). 198 The filter input (#eGov_itemFilter) -- and, for the grouped view, the 199 #eGov_itemSelectNoMatch div -- are added in the public templates. Loaded on every 200 public page via public.js; no-ops when no filter input is present. */ 201function eGov_itemSelectFilter() 202{ 203 var objFilter = document.getElementById('eGov_itemFilter'); 204 if (!objFilter) return; 205 206 var strNeedle = objFilter.value.toLowerCase(); 207 var intShown = 0; 208 var objContainer = document.getElementById('eGov_groupGrouping'); 209 210 if (objContainer) 211 { 212 /* Grouped view: each group header is followed by a <ul> of <li> items. */ 213 Array.prototype.slice.call(objContainer.getElementsByClassName('eGov_groupHeader')).forEach(function (objHeader) { 214 var objList = objHeader.nextElementSibling; 215 while (objList && objList.tagName !== 'UL') objList = objList.nextElementSibling; 216 if (!objList) return; 217 218 var blnGroupMatch = objHeader.textContent.toLowerCase().indexOf(strNeedle) !== -1; 219 var intGroupShown = 0; 220 221 Array.prototype.slice.call(objList.getElementsByTagName('li')).forEach(function (objItem) { 222 var blnShow = strNeedle === '' || blnGroupMatch || objItem.textContent.toLowerCase().indexOf(strNeedle) !== -1; 223 objItem.style.display = blnShow ? '' : 'none'; 224 if (blnShow) intGroupShown++; 225 }); 226 227 objHeader.style.display = intGroupShown ? '' : 'none'; 228 objList.style.display = intGroupShown ? '' : 'none'; 229 intShown += intGroupShown; 230 }); 231 } 232 else 233 { 234 /* Non-grouped Browse view: the item list is table.eGov_listContent's tbody. 235 Target it by class -- a looser '.eGov_list tbody' can match a wrapping 236 layout table's tbody that precedes it in the DOM. */ 237 var objBody = document.querySelector('table.eGov_listContent > tbody') || document.querySelector('table.eGov_listContent tbody'); 238 if (objBody) 239 { 240 Array.prototype.slice.call(objBody.getElementsByTagName('tr')).forEach(function (objRow) { 241 var blnShow = strNeedle === '' || objRow.textContent.toLowerCase().indexOf(strNeedle) !== -1; 242 objRow.style.display = blnShow ? '' : 'none'; 243 if (blnShow) intShown++; 244 }); 245 } 246 } 247 248 var objNoMatch = document.getElementById('eGov_itemSelectNoMatch'); 249 if (objNoMatch) objNoMatch.style.display = intShown === 0 ? '' : 'none'; 250} 251 252document.addEventListener('DOMContentLoaded', function () { 253 var objFilter = document.getElementById('eGov_itemFilter'); 254 if (objFilter) 255 { 256 objFilter.addEventListener('input', eGov_itemSelectFilter); 257 objFilter.focus(); 258 } 259});
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.