青丘白泽 / 时间戳进制转换

// ==UserScript==
// @name         时间戳进制转换
// @namespace    https://tool.lu/hexconvert/
// @version      2023-12-28
// @description  时间戳进制转换
// @author       青丘白泽
// @copyright    2023, 青丘白泽 (https://openuserjs.org/users/青丘白泽)
// @license      Apache-2.0
// @match        https://tool.lu/hexconvert/
// @icon         https://tool.lu/favicon.ico
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  // Your code here...
  let $ = window.$
  var txt1 = $('<a id="js_timer_start" href="javascript:;" style="display: inline;"><i class="fas fa-play"></i> 开始</a>');
  var txt2 = $('<a id="js_timer_stop" href="javascript:;" style="color: rgb(231, 76, 60); display: none;"><i class="fas fa-stop"></i> 停止</a>');
  $("#main_form p").append(txt1, txt2)
  var js_timer_start = $('#js_timer_start');
  var js_timer_stop = $('#js_timer_stop');
  var clock = function () {
    $('#num').val(+new Date());
    $("#main_form").submit();
  };
  var timer;
  js_timer_start.on('click', function (e) {
    js_timer_start.hide();
    e.preventDefault();
    if (timer) clearInterval(timer);
    timer = setInterval(clock, 200);
    js_timer_stop.show();
  });
  js_timer_stop.on('click', function (e) {
    js_timer_stop.hide();
    e.preventDefault();
    if (timer) clearInterval(timer);
    js_timer_start.show();
  });
})();