Greasy Fork镜像 支持简体中文。

Set ERP_CODE_VERSION Current Time

Set ERP_CODE_VERSION Current Time; like: 202101281552

  1. // ==UserScript==
  2. // @name Set ERP_CODE_VERSION Current Time
  3. // @namespace http://172.31.0.64:8080/*
  4. // @version 4.3
  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. // @Download_url https://gf.qytechs.cn/zh-CN/scripts/420801-set-erp-code-version-current-time
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. Date.prototype.Format = function (fmt) {
  16. var o = {
  17. "M+": this.getMonth() + 1, //月份
  18. "d+": this.getDate(), //日
  19. "h+": this.getHours(), //小时
  20. "m+": this.getMinutes(), //分
  21. "s+": this.getSeconds(), //秒
  22. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  23. "S": this.getMilliseconds() //毫秒
  24. };
  25. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  26. 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)));
  27. return fmt;
  28. }
  29.  
  30. var now = new Date().Format("yyyyMMddhhmm");
  31.  
  32. //console.log(now);
  33.  
  34. var white_list = ['ERP_CODE_VERSION', 'ERP_FILE_VERSION', 'ODOO_CODE_VERSION', 'ODOO_DB_VERSION'];
  35.  
  36. var S = "#main-panel > form > table > tbody:nth-child(1) > tr:nth-child(1) > td.setting-main > div > input.setting-input";
  37. var col = "#main-panel > form > table > tbody:nth-child(1) > tr:nth-child(1) > td.setting-name";
  38.  
  39. //console.log(document.querySelector(col).innerHTML);
  40. //console.log(white_list.indexOf(document.querySelector(col).innerHTML));
  41.  
  42. if(white_list.indexOf(document.querySelector(col).innerHTML) >= 0){
  43. document.querySelector(S).setAttribute('value', now);
  44. };
  45.  
  46. // Your code here...
  47. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址