PageSourceSearch

https://aumsunschool.in/backend/js/common.js?1791292237

js aumsunschool.in collected 2026-10-06 13:10:59 UTC 30,234 bytes, 1,089 lines download raw bytes

1$(document).on("keyup blur", ".allowOnlyNumeric", function (event) {
2  var node = $(this);
3  node.val(node.val().replace(/[^0-9]/g, ""));
4});
5$(".allowOnlyNumeric").bind("input propertychange", function () {
6  var node = $(this);
7  node.val(node.val().replace(/[^0-9]/g, ""));
8});
9$(document).on("keyup blur", ".allowOnlyAlphabets", function (event) {
10  var node = $(this);
11  node.val(node.val().replace(/[^a-zA-Z ]/g, ""));
12});
13$(".allowOnlyAlphabets").bind("input propertychange", function () {
14  var node = $(this);
15  node.val(node.val().replace(/[^a-zA-Z ]/g, ""));
16});
17$(document).on("keyup blur", ".allowAlphaNumeric", function (event) {
18  var node = $(this);
19  node.val(node.val().replace(/[^a-zA-Z0-9]/g, ""));
20});
21$(document).on("keyup blur", ".nospace", function (event) {
22  var node = $(this);
23  node.val(node.val().replace(/ /g, ""));
24});
25$(".allowAlphaNumeric").bind("input propertychange", function () {
26  var node = $(this);
27  node.val(node.val().replace(/[^a-zA-Z0-9]/g, ""));
28});
29$(document).on("keyup blur", ".allowOnlyNumericSpace", function (event) {
30  var node = $(this);
31  node.val(node.val().replace(/[^0-9 ]/g, ""));
32});
33$(".allowOnlyNumericSpace").bind("input propertychange", function () {
34  var node = $(this);
35  node.val(node.val().replace(/[^0-9 ]/g, ""));
36});
37$(document).on("keyup blur", ".allowAlphaNumericSpace", function (event) {
38  var node = $(this);
39  node.val(node.val().replace(/[^a-zA-Z0-9 ]/g, ""));
40});
41$(".allowAlphaNumericSpace").bind("input propertychange", function () {
42  var node = $(this);
43  node.val(node.val().replace(/[^a-zA-Z0-9 ]/g, ""));
44});
45$(document).on("keyup blur", ".allowNumericFloat", function (event) {
46  var node = $(this);
47  node.val(node.val().replace(/[^0-9\.]/g, ""));
48});
49$(".allowNumericFloat").bind("input propertychange", function () {
50  var node = $(this);
51  node.val(node.val().replace(/[^0-9\.]/g, ""));
52});
53$(document).on("keyup blur", ".allowNumericAmount", function (event) {
54  var node = $(this);
55  //  node.val(node.val().replace(/[^0-9\s.]+|\.(?!\d)/g, ''));
56  node.val(node.val().replace(/[^0-9\.]/g, ""));
57});
58$(document).on("blur", ".validateFloat", function (event) {
59  var value = $(this).val();
60  var valid = value.match(/^-?\d*(\.\d+)?$/);
61  if (!valid) {
62    $(this).val(0);
63  }
64});
65$(document).on("keyup blur", ".makeAlphabetsCapital", function (event) {
66  this.value = this.value.toUpperCase();
67});
68$(document).on("keyup blur", ".removeChars", function (event) {
69  var node = $(this);
70  var stringToGoIntoTheRegex = $(this).data("regex");
71  var regex = new RegExp(stringToGoIntoTheRegex, "g");
72  node.val(node.val().replace(regex, ""));
73});
74
75$(document).on("keyup blur", ".removeChars_enter", function (event) {
76  if (Event.keyCode != 13) {
77    var node = $(this);
78    var stringToGoIntoTheRegex = $(this).data("regex");
79    var regex = new RegExp(stringToGoIntoTheRegex, "g");
80    node.val(node.val().replace(regex, ""));
81  }
82});
83
84$(".removeChars").bind("input propertychange", function () {
85  var node = $(this);
86  var stringToGoIntoTheRegex = $(this).data("regex");
87  var regex = new RegExp(stringToGoIntoTheRegex, "g");
88  node.val(node.val().replace(regex, ""));
89});
90
91$(document).on("blur", ".validateEmail", function (event) {
92  var userinput = $(this).val();
93  if (userinput != "") {
94    var pattern = /^\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i;
95    if (!pattern.test(userinput)) {
96      alert("Enter a valid e-mail address");
97      $(this).val("");
98      $(this).focus();
99    }
100  }
101});
102
103$(document).on("focusout", "input", function () {
104  var message = $(this).val();
105  if (
106    /<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE|a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video).*?>|<(video).*?<\/\2>/i.test(
107      message
108    ) == true
109  ) {
110    alert("HTML Tag are not allowed");
111    $(this).val("");
112    e.preventDefault();
113  }
114});
115
116$(document).on("keyup blur", ".removeChars", function (event) {
117  var node = $(this);
118  var stringToGoIntoTheRegex = $(this).data("regex");
119  var regex = new RegExp(stringToGoIntoTheRegex, "g");
120  node.val(node.val().replace(regex, ""));
121});
122
123function randomPassword() {
124  var length = 12;
125  var chars = "abcdefghjkmnpqrstuvwxyz!@#%*()-+ABCDEFGHJKMNP123456789";
126  //var chars = "1234567890";
127  var pass = "";
128  for (var x = 0; x < length; x++) {
129    var i = Math.floor(Math.random() * chars.length);
130    pass += chars.charAt(i);
131  }
132  return pass;
133}
134
135function generate() {
136  //$('.password').removeAttr('disabled');
137  $(".password").val(randomPassword());
138  var pass = $(".password")[0];
139  $(".password").select();
140  document.execCommand("copy");
141  $("#clipboard").fadeIn(2000);
142  $("#clipboard").fadeOut(2000);
143}
144
145function show_more(hide_id, show_id, btn_show_more) {
146  $("#" + hide_id).toggle();
147  $("#" + show_id).toggle();
148  var txt = $("#" + btn_show_more).text();
149  if (txt == "Show More") {
150    $("#" + btn_show_more).text("Show Less");
151  } else {
152    $("#" + btn_show_more).text("Show More");
153  }
154}
155
156function showpassword() {
157  if ($("input[name=password]").attr("type") === "password") {
158    $("input[name=password]").attr("type", "text");
159  } else {
160    $("input[name=password]").attr("type", "password");
161  }
162}
163
164function copyToclipboard(txt_id) {
165  $("#" + txt_id).select();
166  document.execCommand("copy");
167  $("#clipboard").fadeIn(500);
168  $("#clipboard").fadeOut(2000);
169  $("#" + txt_id).hide();
170}
171
172function fileUploadFileNames(inputId, outputId) {
173  var input = document.getElementById(inputId);
174  var output = document.getElementById(outputId);
175  var children = "";
176  for (var i = 0; i < input.files.length; ++i) {
177    if (i == 0) {
178      children += input.files.item(i).name;
179    } else {
180      children += ", " + input.files.item(i).name;
181    }
182  }
183  output.innerHTML =
184    "<b>" + children + " (" + input.files.length + " files are selected)</b>";
185}
186
187function countTextAreaChar(txtarea, maxLimit, label) {
188  var len = $(txtarea).val().length;
189  if (len > maxLimit) $(txtarea).val($(txtarea).val().slice(0, maxLimit));
190  else $("#" + label).text(len + "/" + maxLimit);
191}
192
193function fileUploadFileNames(inputId, outputId) {
194  var input = document.getElementById(inputId);
195  var output = document.getElementById(outputId);
196  var children = "";
197  for (var i = 0; i < input.files.length; ++i) {
198    if (i == 0) {
199      children += input.files.item(i).name;
200    } else {
201      children += ", " + input.files.item(i).name;
202    }
203  }
204  output.innerHTML =
205    "<b>" + children + " (" + input.files.length + " files are selected)</b>";
206}
207
208function countTextAreaChar(txtarea, maxLimit, label) {
209  var len = $(txtarea).val().length;
210  if (len > maxLimit) $(txtarea).val($(txtarea).val().slice(0, maxLimit));
211  else $("#" + label).text(len + "/" + maxLimit);
212}
213
214/**
215 * Sends an AJAX request to the server and handles the response.
216 *
217 * @param {string} from_id - the ID of the form to be submitted
218 * @param {string} modal_id - the ID of the modal window to be hidden (optional)
219 * @param {string} reload_table - determines how the table should be reloaded after the request (optional)
220 * @param {string} div_hide - the ID of the element to be hidden (optional)
221 * @param {string} div_show - the ID of the element to be shown (optional)
222 * @param {string} div_append - the ID of the element to append the response to (optional)
223 */
224function ajax_request_withoutform(
225  post_json_data,
226  request_url,
227  request_method,
228  return_type
229) {
230  /*var post_json_data = { tab : 'get_client_details', contact_num : 'contact_num' } */
231  return new Promise((resolve, reject) => {
232    $.ajax({
233      type: request_method,
234      url: request_url,
235      data: post_json_data,
236      beforeSend: function () {
237        //$( "#preloader").show();
238        start_loader();
239      },
240      success: function (data) {
241        //$( "#preloader").hide();
242        end_loader();
243        if (return_type == "JSON") {
244          resolve(data);
245        } else {
246          var obj = $.parseJSON(data);
247          console.log(obj.msg_code);
248          resolve(obj);
249        }
250      },
251      error: function (jqXHR, exception) {
252        // $( "#preloader" ).hide();
253        end_loader();
254        var msg = "";
255        if (jqXHR.status === 0) {
256          msg = "Not connect.\n Verify Network.";
257        } else if (jqXHR.status == 404) {
258          msg = "Requested page not found. [404]";
259        } else if (jqXHR.status == 500) {
260          msg = "Internal Server Error [500].";
261        } else if (exception === "parsererror") {
262          msg = "Requested JSON parse failed.";
263        } else if (exception === "timeout") {
264          msg = "Time out error.";
265        } else if (exception === "abort") {
266          msg = "Ajax request aborted.";
267        } else {
268          msg = "Uncaught Error.\n" + jqXHR.responseText;
269        }
270        var response = '{"msg_code":"500", "msg":msg, "data":null}';
271        if (return_type == "JSON") {
272          reject(response);
273        } else {
274          var obj = $.parseJSON(response);
275          reject(obj);
276        }
277      },
278    });
279  });
280}
281
282function common_ajax_request(
283  from_id,
284  modal_id,
285  reload_table,
286  div_hide = "",
287  div_show = "",
288  div_append = "",
289  source = ""
290) {
291  var frm = new FormData($("#" + from_id)[0]);
292  if (source == "website") {
293    var request_url = "backend/includes/common_ajax.php";
294  } else {
295    var request_url = "includes/common_ajax.php";
296  }
297
298  $.ajax({
299    type: "POST",
300    url: request_url,
301    data: frm,
302    processData: false,
303    contentType: false,
304    beforeSend: function () {
305      if (source == "website") {
306        website_loader_show();
307      }
308      if (reload_table != "NOP") {
309        //$( "#preloader" ).show();
310        start_loader();
311      }
312    },
313    success: function (data) {
314      if (source == "website") {
315        website_loader_hide();
316      }
317      end_loader();
318      //console.log( data );
319      try {
320        var obj = $.parseJSON(data);
321        var msg_code = obj.msg_code;
322        var msg = obj.msg;
323        //console.log( obj );
324        if (msg_code != "00") {
325          Swal.fire({
326            type: "error",
327            title: "Error",
328            text: msg,
329          });
330
331          if (msg_code == "007") {
332            window.location.reload();
333          }
334        } else {
335          Swal.fire({
336            type: "success",
337            title: "Success",
338            text: msg,
339            timer: 2000,
340          });
341
342          if (reload_table == "N") {
343            //console.log( 'redirect' );
344            if (modal_id != "") {
345              $("#" + modal_id).modal("hide");
346            }
347            setTimeout(function () {
348              if (obj.hasOwnProperty("redirect")) {
349                window.location.href = obj.redirect;
350              }
351            }, 2000);
352          } else if (reload_table == "Y") {
353            setTimeout(function () {
354              window.location.reload();
355            }, 2000);
356          } else if (reload_table == "DF") {
357            $("#" + from_id).remove();
358            setTimeout(function () {
359              window.location.reload();
360            }, 2000);
361          } else if (reload_table == "NW") {
362            if (obj.hasOwnProperty("redirect")) {
363              var win = window.open(obj.redirect, "_blank");
364              if (win) {
365                win.focus();
366              } else {
367                alert("Please allow popups for this website");
368              }
369              window.location.href = obj.redirect1;
370            }
371          } else if (reload_table == "append") {
372            if (div_show != "") {
373              $("#" + div_show).show();
374            }
375            if (div_append != "") {
376              $("#" + div_append).html(obj.data);
377            }
378          }
379        }
380      } catch (error) {
381        console.log("error");
382        Swal.fire({
383          type: "error",
384          title: "!!Error!!",
385          text: "Invalid response received from server",
386        });
387      }
388    },
389    error: function (jqXHR, exception) {
390      //$( "#preloader" ).hide();
391      end_loader();
392      var msg = "";
393      if (jqXHR.status === 0) {
394        msg = "Not connect.\n Verify Network.";
395      } else if (jqXHR.status == 404) {
396        msg = "Requested page not found. [404]";
397      } else if (jqXHR.status == 500) {
398        msg = "Internal Server Error [500].";
399      } else if (exception === "parsererror") {
400        msg = "Requested JSON parse failed.";
401      } else if (exception === "timeout") {
402        msg = "Time out error.";
403      } else if (exception === "abort") {
404        msg = "Ajax request aborted.";
405      } else {
406        msg = "Uncaught Error.\n" + jqXHR.responseText;
407      }
408      Swal.fire({
409        type: "error",
410        title: "!!Error!!",
411        text: msg,
412      });
413    },
414  });
415}
416
417function dyna_ddl_ajaxload(
418  sourse_ddl_option_field,
419  sourse_ddl_option_id,
420  destination_ddl_value,
421  destination_ddl_label,
422  destination_ddl_id,
423  tbl,
424  selected = ""
425) {
426  if (sourse_ddl_option_id == "") {
427    return false;
428  }
429  var request_url = "includes/common_ajax.php";
430  var action = $("#dyna_ddl_ajaxload").val();
431  $.ajax({
432    type: "POST",
433    url: request_url,
434    data:
435      "sourse_ddl_option_field=" +
436      sourse_ddl_option_field +
437      "&sourse_ddl_option_id=" +
438      sourse_ddl_option_id +
439      "&destination_ddl_value=" +
440      destination_ddl_value +
441      "&destination_ddl_label=" +
442      destination_ddl_label +
443      "&destination_ddl_id=" +
444      destination_ddl_id +
445      "&action=" +
446      action +
447      "&tbl=" +
448      tbl +
449      "&selected=" +
450      selected,
451    success: function (data) {
452      var obj = $.parseJSON(data);
453      var msg_code = obj.msg_code;
454      var msg = obj.msg;
455      var data = obj.data;
456      if (msg_code != "00") {
457        Swal.fire({
458          type: "error",
459          title: "Error",
460          text: msg,
461        });
462        return false;
463      } else {
464        //$('#select_id').empty();
465        $("#" + destination_ddl_id)
466          .find("option")
467          .remove()
468          .end()
469          .append(data)
470          .trigger("change");
471        $("#" + destination_ddl_id).prop("required", true);
472      }
473    },
474  });
475}
476
477/*
478function crop_image(
479  file_input_id,
480  crop_modal_id,
481  uploaded_image_id,
482  crop_button_id,
483  cropped_image_id,
484  txt_base64,
485  new_width = 150,
486  new_height = 150
487) {
488  
489  //<script src="js/croppie.min.js"></script>
490  // Remember to add "croppie" library before call the function
491  $("#" + file_input_id).on("change", function () {
492    var reader = new FileReader();
493    reader.onload = function (event) {
494      $image_crop
495        .croppie("bind", {
496          url: event.target.result,
497        })
498        .then(function () {
499          console.log("jQuery bind complete");
500        });
501    };
502    reader.readAsDataURL(this.files[0]);
503    $("#" + crop_modal_id).modal("show");
504  });
505  $image_crop = $("#" + uploaded_image_id).croppie({
506    enableExif: true,
507    viewport: {
508      width: new_width, // new width
509      height: new_height, // new height
510      type: "square", //circle
511    },
512    boundary: {
513      width: 600,
514      height: 600,
515    },
516  });
517
518  $("#" + crop_button_id).click(function (event) {
519    $image_crop
520      .croppie("result", {
521        type: "canvas",
522        size: "viewport",
523      })
524      .then(function (response) {
525        $("#" + crop_modal_id).modal("hide");
526        $("#" + cropped_image_id).attr("src", response);
527        $("#" + cropped_image_id).show();
528        $("#" + txt_base64).val(response);
529        $image_crop.croppie("destroy");
530      });
531  });
532}
533
534*/
535
536function crop_image(
537  file_input_id,
538  crop_modal_id,
539  uploaded_image_id,
540  crop_button_id,
541  cropped_image_id,
542  txt_base64,
543  new_width = 150,
544  new_height = 150
545) {
546  //<script src="js/croppie.min.js"></script>
547  // Remember to add "croppie" library before call the function
548  $("#" + file_input_id).on("change", function () {
549    var reader = new FileReader();
550    reader.onload = function (event) {
551      $image_crop
552        .croppie("bind", {
553          url: event.target.result,
554        })
555        .then(function () {
556          console.log("jQuery bind complete");
557        });
558    };
559    reader.readAsDataURL(this.files[0]);
560    $("#" + crop_modal_id).modal("show");
561  });
562  $image_crop = $("#" + uploaded_image_id).croppie({
563    enableExif: true,
564    viewport: {
565      width: new_width, // new width
566      height: new_height, // new height
567      type: "square", //circle
568    },
569    boundary: {
570      width: 600,
571      height: 600,
572    },
573  });
574
575  $("#" + crop_button_id).click(function (event) {
576    let endpoint = "";
577    $image_crop
578      .croppie("result", {
579        type: "blob",
580        size: "viewport",
581        format: "jpeg",
582        quality: 0.6,
583      })
584      .then(function (blob) {
585        const previewUrl = URL.createObjectURL(blob);
586        $("#" + cropped_image_id)
587          .attr("src", previewUrl)
588          .show();
589
590        const formData = new FormData();
591        formData.append("image", blob, "cropped.jpg");
592        if (window.location.href.includes("backend")) {
593          endpoint = "js/upload.php";
594        } else {
595          endpoint = "backend/js/upload.php";
596        }
597        fetch(endpoint, {
598          method: "POST",
599          body: formData,
600        })
601          .then((response) => {
602            if (!response.ok) {
603              throw new Error("Server error");
604            }
605            return response.json(); // 👈 expecting JSON
606          })
607          .then((data) => {
608            if (data.status === "success") {
609              console.log("Saved file:", data.filename);
610              $("#" + txt_base64).val(data.filename);
611            } else {
612              alert("Upload failed: " + data.message);
613            }
614          });
615        $("#" + crop_modal_id).modal("hide");
616      });
617  });
618}
619
620function loadDataTable(
621  tableID,
622  totalRecords,
623  orderByClumnIndex,
624  orderType,
625  columnObject
626) {
627  var search_form_data = $("#search_form").serializeArray();
628  var FormObject = {};
629  $.each(search_form_data, function (i, v) {
630    FormObject[v.name] = v.value;
631  });
632  var table = $("#" + tableID).dataTable({
633    processing: true,
634    serverSide: true,
635    dom: "Blfrtip",
636    autoWidth: true,
637    serverMethod: "post",
638    ajax: {
639      type: "POST",
640      url: "includes/dataTable.php",
641      data: {
642        request: "list_employees",
643        searchData: FormObject,
644      },
645    },
646    buttons: [
647      "colvis",
648      "csv",
649      "excel",
650      {
651        text: "Refresh",
652        action: function (e, dt, node, config) {
653          dt.ajax.reload();
654        },
655      },
656    ],
657    language: {
658      paginate: {
659        next: '<i class="fa-solid fa-angle-right"></i>',
660        previous: '<i class="fa-solid fa-angle-left"></i>',
661      },
662    },
663    pageLength: totalRecords,
664    aaSorting: [[orderByClumnIndex, orderType]],
665    columns: columnObject,
666  });
667  return table;
668}
669
670function waitforme(millisec) {
671  return new Promise((resolve) => {
672    setTimeout(() => {
673      resolve("");
674    }, millisec);
675  });
676}
677
678//#########################################################DataTable#########################################
679function dataTableLoad(page_no) {
680  //$("#preloader").show();
681  var search_form_data = $("#search_form").serialize();
682  var request_file = $("#url").val();
683  $.ajax({
684    type: "POST",
685    url: "includes/dataTable.php",
686    data: search_form_data + "&page=" + page_no,
687    beforeSend: function () {
688      $("#preloader").show();
689    },
690    success: function (msg) {
691      $("#preloader").hide();
692      $("#table_body").html(msg);
693      sortTbl();
694      var total_records = $("#total_records").val();
695      if (total_records > 0) {
696        $("#lbl_total").html("(<b>" + total_records + "</b>)");
697      } else {
698        $("#lbl_total").html("(<b>0</b>)");
699      }
700      /*
701                 var attrSort = $("#dynamic_table").attr('data-sort');
702                 console.log(attrSort);
703                 if (typeof attrSort !== 'undefined' && attrSort !== false)
704                 {
705                     $("#dynamic_table").tablesorter(); //https://mottie.github.io/tablesorter/docs/#Demo
706                 }
707                */
708
709      $("#btn_download").click(function () {
710        download_csv();
711      });
712
713      var limitt = $("#record_limit").val();
714      $("#record_limit_change").val(limitt);
715
716      $("#record_limit_change").change(function () {
717        //var page = $(".pagination").find(".active").attr('p');
718        $("#record_limit").val($(this).val());
719        dataTableLoad(1);
720      });
721
722      $("#live_search").on("keyup", function () {
723        var value = $(this).val().toLowerCase();
724        $("#table_body tbody tr").filter(function () {
725          $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
726          if ($("#tbody tr:visible").length < 10) {
727            $(".pagination").css("display", "none");
728          } else {
729            $(".pagination").css("display", "");
730          }
731        });
732      });
733
734      $("#checkAll").click(function () {
735        $("input:checkbox").not(this).prop("checked", this.checked);
736      });
737    },
738    error: function (jqXHR, exception) {
739      $("#preloader").hide();
740    },
741  });
742}
743
744function download_csv() {
745  Swal.fire({
746    title: "Do you want to download the data in excel format?",
747    showCancelButton: true,
748    confirmButtonText: "Yes",
749    cancelButtonText: "Cancel",
750    showLoaderOnConfirm: true,
751    preConfirm: (value) => {
752      if (!value) {
753        //return false;
754      } else {
755        download_csv2();
756      }
757      // You can process the user's input here or perform any other action.
758    },
759    allowOutsideClick: () => !Swal.isLoading(),
760  }).then((result) => {
761    if (result.isConfirmed) {
762      download_csv2();
763    }
764  });
765}
766function download_csv2() {
767  $("<input>")
768    .attr({
769      type: "hidden",
770      id: "export",
771      value: "export",
772      name: "export",
773    })
774    .appendTo("#search_form");
775
776  //$('#search').click();
777
778  const saveData = (function () {
779    const a = document.createElement("a");
780    document.body.appendChild(a);
781    a.style = "display: none";
782    return function (data, fileName) {
783      const blob = new Blob([data], { type: "octet/stream" }),
784        url = window.URL.createObjectURL(blob);
785      a.href = url;
786      a.download = fileName;
787      a.click();
788      window.URL.revokeObjectURL(url);
789    };
790  })();
791
792  var search_form_data = $("#search_form").serialize();
793  var request_file = $("#url").val();
794
795  $.ajax({
796    type: "POST",
797    url: "includes/dataTable.php",
798    data: search_form_data,
799    beforeSend: function () {
800      //$("#preloader").show()
801      start_loader();
802    },
803    success: function (data) {
804      const d = new Date();
805      let time = d.getTime();
806      var fileName = time + "attendance.csv";
807      saveData(data, fileName);
808      //$("#preloader").hide();
809      end_loader();
810      $("#export").remove();
811    },
812    error: function (jqXHR, exception) {
813      //$("#preloader").hide();
814      end_loader();
815    },
816  });
817}
818
819function sortTbl(tbl = "") {
820  if (tbl == "") {
821    var table = $("#dynamic_table");
822  } else {
823    var table = $("#dynamic_table123");
824  }
825  $(".sort")
826    .append('<i style="margin-left:3px;" class="fa fa-sort"></i>')
827    .each(function () {
828      var th = $(this),
829        thIndex = th.index(),
830        inverse = false;
831
832      th.click(function () {
833        table
834          .find("td")
835          .filter(function () {
836            return $(this).index() === thIndex;
837          })
838          .sortElements(
839            function (a, b) {
840              return $.text([a]) > $.text([b])
841                ? inverse
842                  ? -1
843                  : 1
844                : inverse
845                ? 1
846                : -1;
847            },
848            function () {
849              // parentNode is the element we want to move
850              return this.parentNode;
851            }
852          );
853
854        inverse = !inverse;
855      });
856    });
857}
858
859function exportToCsv() {
860  var download = $("#btn_download").data("url");
861  $("#download").val(download);
862  var search_form_data = $("#search_form").serialize();
863  var request_file = $("#url").val();
864  $.ajax({
865    type: "POST",
866    url: request_file, //'table_response.php',
867    data: search_form_data,
868    beforeSend: function () {
869      //$("#preloader").show();
870      start_loader();
871    },
872    timeout: 3000000,
873    success: function (msg) {
874      //alert(msg);
875      $("#download").val("");
876      window.location.href = trim(msg);
877      //$("#preloader").hide();
878      end_loader();
879    },
880    error: function (jqXHR, exception) {
881      //$("#preloader").hide();
882      end_loader();
883    },
884  });
885}
886
887function goto1(page) {
888  document.frm.page.value = page;
889  document.frm.submit();
890}
891
892function gosort(orderon, orderby) {
893  document.frm.orderby.value = orderby;
894  document.frm.orderon.value = orderon;
895  document.frm.submit();
896}
897
898$(document).on("click", "#table_body li.page-item.active", function () {
899  console.log("---------------------------");
900  var page = $(this).attr("p");
901  dataTableLoad(page);
902});
903
904$(document).on("click", "#search", function () {
905  dataTableLoad(1);
906});
907
908$(document).on("click", ".btn-modal-close", function () {
909  var page = $(".pagination").find(".active").attr("p");
910  //dataTableLoad(page);
911});
912
913//#########################################################DataTable#########################################
914
915function start_loader() {
916  //$('body').prepend('<div id="preloader"><div class="loader-holder"><div></div><div></div><div></div><div></div>');
917  //$("#main-wrapper").prepend('<div id="preloader"><div class="lds-ripple"><div></div><div></div></div></div>');
918  $("#preloader").show();
919}
920function end_loader() {
921  /*
922    $('#preloader').fadeOut('fast', function () {
923        $('#preloader').remove();
924    })
925    */
926  $("#preloader").hide();
927}
928
929// function
930window.alert_toast = function ($msg = "TEST", $bg = "success", $pos = "") {
931  var Toast = Swal.mixin({
932    toast: true,
933    position: $pos || "top-end",
934    showConfirmButton: false,
935    timer: 5000,
936  });
937  Toast.fire({
938    icon: $bg,
939    title: $msg,
940  });
941};
942
943$(document).on("select2:open", () => {
944  document.querySelector(".select2-search__field").focus();
945});
946
947function getUrlVars() {
948  var vars = [],
949    hash;
950  var hashes = window.location.href
951    .slice(window.location.href.indexOf("?") + 1)
952    .split("&");
953  for (var i = 0; i < hashes.length; i++) {
954    hash = hashes[i].split("=");
955    vars.push(hash[0]);
956    vars[hash[0]] = hash[1];
957  }
958
959  if (hashes.length == 0) {
960    return false;
961  } else {
962    return vars;
963  }
964  //var me = getUrlVars()["me"];
965  //var name2 = getUrlVars()["name2"];
966}
967
968function export_table_data_csv() {
969  var download = $("#download_btn").data("url");
970  var form_id = $("#download_btn").data("frm");
971  $("#download").val(download);
972  var ser_data = $("#" + form_id).serialize();
973  var request_url = "includes/dataTable.php";
974  $.ajax({
975    type: "POST",
976    url: request_url, //'table_response.php',
977    data: ser_data,
978    beforeSend: function () {
979      start_loader();
980    },
981    timeout: 3000000,
982    success: function (msg) {
983      end_loader();
984      $("#download").val("");
985      window.location.href = msg.trim();
986    },
987    error: function (jqXHR, exception) {
988      end_loader();
989    },
990  });
991}
992
993/* Website */
994
995function initLightGalleryById(divId) {
996  const galleryEl = document.getElementById(divId);
997
998  if (galleryEl) {
999    lightGallery(galleryEl, {
1000      plugins: [
1001        lgZoom,
1002        lgThumbnail,
1003        lgAutoplay,
1004        lgFullscreen,
1005        lgPager,
1006        lgRotate,
1007        lgHash,
1008        lgVideo,
1009      ],
1010      speed: 600,
1011    });
1012  } else {
1013    console.warn(`lightGallery: Element with id "${divId}" not found.`);
1014  }
1015}
1016
1017function loadData(section, target_div, waitTime) {
1018  return $.Deferred(function (defer) {
1019    var tab_check = $("." + section);
1020    if (tab_check.length === 0) {
1021      return false; // element not found
1022    }
1023    var tab = $("." + section).data("tab");
1024    var source = $("." + section).data("source");
1025    var loader = $("." + section).data("loader");
1026    setTimeout(function () {
1027      $.ajax({
1028        url: "backend/includes/common_ajax.php",
1029        type: "POST",
1030        data: { action: tab, source: source }, // sending tab value
1031        success: function (response) {
1032          $("." + loader).remove();
1033          $("." + target_div)
1034            .hide()
1035            .append(response)
1036            .fadeIn(200);
1037          defer.resolve(response); // resolve promise after success
1038        },
1039        error: function (xhr, status, error) {
1040          console.error("AJAX Error:", error);
1041          defer.reject(error);
1042        },
1043      });
1044    }, parseInt(waitTime));
1045  }).promise();
1046}
1047
1048// Start Contact
1049$(document).on("submit", "#website_frm_contact", function (e) {
1050  e.preventDefault();
1051  common_ajax_request("website_frm_contact", "", "N", "", "", "", "website");
1052});
1053// End Contact
1054
1055// Start Contact
1056$(document).on("submit", "#website_frm_transfer_certificate", function (e) {
1057  $("#certificate_verified_div").hide();
1058  $("#certificate_verified").empty();
1059  e.preventDefault();
1060  common_ajax_request(
1061    "website_frm_transfer_certificate",
1062    "",
1063    "append",
1064    "",
1065    "certificate_verified_div",
1066    "certificate_verified",
1067    "website"
1068  );
1069});
1070// End Contact
1071/*
1072$(document).ready(function () {
1073  $(document).on("shown.bs.modal", ".modal", function (e) {
1074    $(".modal").modal({
1075      backdrop: "static",
1076      keyboard: false,
1077    });
1078  });
1079});
1080*/
1081function website_loader_show() {
1082  $("#page-preloader").show();
1083  $("#page-preloader").css("opacity", "1");
1084}
1085
1086function website_loader_hide() {
1087  $("#page-preloader").hide();
1088  $("#page-preloader").css("opacity", "-131.537");
1089}

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.