You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
984 B

  1. $(function () {
  2. $("#log tr.ok").on("click", function() {
  3. $("#ping-details-body").text("Updating...");
  4. $('#ping-details-modal').modal("show");
  5. $.get(this.dataset.url, function(data) {
  6. $("#ping-details-body" ).html(data);
  7. });
  8. return false;
  9. });
  10. function switchDateFormat(format) {
  11. $("#log tr").each(function(index, row) {
  12. var dt = moment(row.getAttribute("data-dt"));
  13. format == "local" ? dt.local() : dt.utc();
  14. $(".date", row).text(dt.format("MMM D"));
  15. $(".time", row).text(dt.format("HH:mm"));
  16. })
  17. }
  18. $("#format-switcher").click(function(ev) {
  19. var format = ev.target.getAttribute("data-format");
  20. switchDateFormat(format);
  21. });
  22. switchDateFormat("local");
  23. // The table is initially hidden to avoid flickering as we convert dates.
  24. // Once it's ready, set it to visible:
  25. $("#log").css("visibility", "visible");
  26. });