1jQuery($ => { 2 "use strict"; 3 let $window = $(window); 4 let body = $("body"); 5 let $root = $("html, body"); 6 $('[data-toggle="tooltip"]').tooltip(); 7 8 $.ajaxSetup({ 9 headers: { 10 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 11 } 12 }); 13 14 window.localLinkClicked = false; 15 16 $("a.ext-check").on("click", function (e) { 17 e.preventDefault(); 18 var url = $(this).attr("href"); 19 if (url != 'javascript:void(0)' && url != '#') { 20 if (isExternal(url)) { 21 swal({ 22 title: "Are you sure ?", 23 text: "You are now leaving Kerala Police website and are going to a website that is not operated by Kerala Police. We are not responsible for the content or availability of linked site. !", 24 icon: "warning", 25 buttons: true, 26 dangerMode: true, 27 }) 28 .then((proceed) => { 29 if (proceed) { 30 window.open(url); 31 } 32 }); 33 } else { 34 window.location.href = url; 35 } 36 } 37 }); 38 39 $(".channgeFont").on("click", function (e) { 40 e.preventDefault(); 41 var font_size = $(this).attr("data-font-size"); 42 if(font_size) { 43 $('#a-minus').removeClass('active'); 44 $('#a-default').removeClass('active'); 45 $('#a-plus').removeClass('active'); 46 $(this).children().addClass('active'); 47 if(font_size == 'a-'){ 48 var minuslink = document.getElementById("a-minus-link"); 49 minuslink.disabled = false; 50 var pluslink = document.getElementById("a-plus-link"); 51 pluslink.disabled = true; 52 }else if(font_size == 'a+'){ 53 var minuslink = document.getElementById("a-minus-link"); 54 minuslink.disabled = true; 55 var pluslink = document.getElementById("a-plus-link"); 56 pluslink.disabled = false; 57 }else{ 58 var minuslink = document.getElementById("a-minus-link"); 59 minuslink.disabled = true; 60 var pluslink = document.getElementById("a-plus-link"); 61 pluslink.disabled = true; 62 } 63 } 64 }); 65 66 function isExternal(url) { 67 var match = url.match(/^([^:\/?#]+:)?(?:\/\/([^\/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/); 68 if (typeof match[1] === "string" && match[1].length > 0 && match[1].toLowerCase() !== location.protocol) return true; 69 if (typeof match[2] === "string" && match[2].length > 0 && match[2].replace(new RegExp(":(" + { 70 "http:": 80, 71 "https:": 443 72 } [location.protocol] + ")?$"), "") !== location.host) return true; 73 return false; 74 } 75 76 //search form 77 $("#searchInput").keyup(function (e) { 78 e.preventDefault(); 79 var search_query = $(this).val(); 80 var url = $(this).attr('data-url'); 81 getSearchResult(url, search_query); 82 }); 83 84 function getSearchResult(url, search_query) { 85 $("#searchModalBody").LoadingOverlay("show", { 86 background: "rgba(165, 190, 100, 0.2)", 87 size: 10 88 }); 89 $.ajax({ 90 url: url, 91 type: "POST", 92 data: { 93 search_query: search_query,_token: $('.search-box input[name="_token"]').val() 94 }, 95 success: function (data) { 96 if (data.success == true) { 97 $('#searchModalBody').html(data.html); 98 $("#searchModalBody").LoadingOverlay("hide"); 99 } else { 100 $('.submit-btn').prop('disabled', false); 101 $('#searchModalBody').html(data.message); 102 $("#searchModalBody").LoadingOverlay("hide"); 103 } 104 }, 105 error: function (reject) { 106 $('.submit-btn').prop('disabled', false); 107 $("#searchModalBody").LoadingOverlay("hide"); 108 if (reject.status === 422 || reject.status === 429) { 109 var errorData = $.parseJSON(reject.responseText); 110 $.each(errorData.errors, function (key, val) { 111 var errorElement = document.getElementById(key + "-error"); 112 if (errorElement) { 113 $("#" + key + "-error").html(val[0]); 114 $("#" + key + "-error").show(); 115 } else { 116 $("#" + key).parent().append('<label id="' + key + '-error"
116class="error" for="' + key + '">' + val[0] + '</label>'); 117 } 118 }); 119 } else { 120 $("#searchModalBody").LoadingOverlay("hide"); 121 } 122 } 123 }); 124 } 125 126 //search form 127 $("#know_station_district_list").change(function (e) { 128 e.preventDefault(); 129 var url = $(this).attr('data-url'); 130 var district_id = $(this).val(); 131 getPoliceStations(url, district_id); 132 }); 133 134 function getPoliceStations(url, district_id) { 135 $("#know_station_list").LoadingOverlay("show", { 136 background: "rgba(165, 190, 100, 0.2)", 137 size: 10 138 }); 139 $.ajax({ 140 url: url, 141 type: "POST", 142 data: { 143 district_id: district_id 144 }, 145 success: function (data) { 146 if (data.success == true) { 147 $('#know_station_list').html(data.html); 148 $("#know_station_list").LoadingOverlay("hide"); 149 } else { 150 $('#know_station_list').html(data.message); 151 $("#know_station_list").LoadingOverlay("hide"); 152 } 153 }, 154 error: function (reject) { 155 $("#know_station_list").LoadingOverlay("hide"); 156 if (reject.status === 422 || reject.status === 429) { 157 var errorData = $.parseJSON(reject.responseText); 158 $.each(errorData.errors, function (key, val) { 159 var errorElement = document.getElementById(key + "-error"); 160 if (errorElement) { 161 $("#" + key + "-error").html(val[0]); 162 $("#" + key + "-error").show(); 163 } else { 164 $("#" + key).parent().append('<label id="' + key + '-error" class="error" for="' + key + '">' + val[0] + '</label>'); 165 } 166 }); 167 } else { 168 if (reject.status == 419) { 169 alert('Page was idle for some time. Please reload the page.'); 170 } 171 $("#know_station_list").LoadingOverlay("hide"); 172 } 173 } 174 }); 175 } 176 177 178 //know police station select 179 $("#know_station_list").change(function (e) { 180 e.preventDefault(); 181 var url = $(this).attr('data-url'); 182 var police_station_id = $(this).val(); 183 getPoliceStationDetails(url, police_station_id); 184 }); 185 186 function getPoliceStationDetails(url, police_station_id) { 187 $("#know_station_list").LoadingOverlay("show", { 188 background: "rgba(165, 190, 100, 0.2)", 189 size: 10 190 }); 191 $.ajax({ 192 url: url, 193 type: "POST", 194 data: { 195 police_station_id: police_station_id 196 }, 197 //processData: false, 198 //contentType: false, 199 success: function (data) { 200 if (data.success) { 201 const myModal = new bootstrap.Modal(document.getElementById('popup1')); 202 myModal.show(); 203 $('#police_list').html(data.html); 204 $('#policeStationDetailsDiv').html(data.html); 205 $('#knowStationModal').modal('show'); 206 $("#know_station_list").LoadingOverlay("hide"); 207 } else { 208 $('#popup1').modal('hide'); 209 $('#policeStationDetailsDiv').html(data.message); 210 $("#know_station_list").LoadingOverlay("hide"); 211 } 212 }, 213 error: function (reject) { 214 $("#know_station_list").LoadingOverlay("hide"); 215 if (reject.status === 422 || reject.status === 429) { 216 var errorData = $.parseJSON(reject.responseText); 217 $.each(errorData.errors, function (key, val) { 218 var errorElement = document.getElementById(key + "-error"); 219 if (errorElement) { 220 $("#" + key + "-error").html(val[0]); 221 $("#" + key + "-error").show(); 222 } else { 223 $("#" + key).parent().append('<label id="' + key + '-error"
223class="error" for="' + key + '">' + val[0] + '</label>'); 224 } 225 }); 226 } else { 227 $("#know_station_list").LoadingOverlay("hide"); 228 } 229 } 230 }); 231 } 232 233 //search form 234 $(".knowPoliceStationCloseBtn").click(function (e) { 235 $('#know_station_list').html('<option>Please select a district first</option>'); 236 $("#know_station_district_list").val($("#know_station_district_list option:first").val()); 237 }); 238});
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.