Set ERP_CODE_VERSION Current Time

Set ERP_CODE_VERSION Current Time; like: 202101281552

当前为 2021-01-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Set ERP_CODE_VERSION Current Time
  3. // @namespace http://172.31.0.64:8080/*
  4. // @version 1.1
  5. // @description Set ERP_CODE_VERSION Current Time; like: 202101281552
  6. // @author You
  7. // @match http://172.31.0.64:8080/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. Date.prototype.Format = function (fmt) {
  15. var o = {
  16. "M+": this.getMonth() + 1, //月份
  17. "d+": this.getDate(), //日
  18. "h+": this.getHours(), //小时
  19. "m+": this.getMinutes(), //分
  20. "s+": this.getSeconds(), //秒
  21. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  22. "S": this.getMilliseconds() //毫秒
  23. };
  24. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  25. for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  26. return fmt;
  27. }
  28.  
  29. var now = new Date().Format("yyyyMMddhhmm");
  30.  
  31. console.log(now);
  32.  
  33. var S = "#main-panel > form > table > tbody:nth-child(1) > tr:nth-child(1) > td.setting-main > div > input.setting-input"
  34. document.querySelector(S).setAttribute('value', now);
  35.  
  36. // Your code here...
  37. })();