-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.user.js
44 lines (35 loc) · 1.33 KB
/
report.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ==UserScript==
// @name 阿里内外周报系统标题自动更正
// @namespace com.popotang.weekly.title
// @description 阿里内外周报系统标题自动更正
// @include http*://work.alibaba-inc.com/work/sns/workreportModify*
// @grant unsafeWindow
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-end
// ==/UserScript==
var loopcnt = 0, timer = null;
timer = setInterval(function () {
if (++loopcnt == 100) {
clearInterval(timer)
timer = null;
console.warn("【周报标题插件】貌似匹配不到元素,先自行屏蔽插件吧");
return;
}
var tbTitle = document.querySelector("[name='reportTitle']"),
tbEndTime = document.querySelector(".endTimeReport");
if (tbTitle && tbTitle.nodeType == 1 && tbEndTime && tbEndTime.nodeType == 1 && !!tbEndTime.value) {
clearInterval(timer);
timer = null;
var m = null,
oldValue = "",
nickname = "",
datestr = "";
oldValue = tbTitle.value;
datestr = tbEndTime.value;
if (m = oldValue.match(/\((.+)\)/)) {
nickname = m[1];
}
tbTitle.value = "【前端】" + nickname + " 周报 " + datestr + " / [Front End] wuliang Weekly Report " + datestr;
}
}, 3000);