Skip to content

Commit

Permalink
修改消息提醒文本、新增自动填写验证码(白名单机制)
Browse files Browse the repository at this point in the history
  • Loading branch information
Whuihuan committed Apr 13, 2021
1 parent 8c9969f commit 9d7f8e5
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 13 deletions.
8 changes: 6 additions & 2 deletions src/_locales/en_US/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,15 @@
"description":"Browser notification title"
},
"NotificationBody":{
"message":"You have $count$ unread notifications.",
"message":"You have $count$ unread notifications, such as <$msg>.",
"description":"Browser notification body",
"placeholders": {
"count": {
"msg": {
"content": "$1",
"example": "This is a Message."
},
"count": {
"content": "$2",
"example": "0"
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,15 @@
"description":"ブラウザ通知タイトル"
},
"NotificationBody":{
"message":"未読の通知が$count$つあります。 ",
"message":"「$msg$」などの未読通知が$count$つあります ",
"description":"ブラウザ通知本文",
"placeholders": {
"count": {
"msg": {
"content": "$1",
"example": "これはメッセージです。"
},
"count": {
"content": "$2",
"example": "0"
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,15 @@
"description": "浏览器通知标题"
},
"NotificationBody": {
"message": "你有$count$条未读信息",
"message": "你有<$msg$>等$count$条未读信息",
"description": "浏览器通知内容",
"placeholders": {
"count": {
"msg": {
"content": "$1",
"example": "这是一条消息"
},
"count": {
"content": "$2",
"example": "0"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "__MSG_extName__",
"version": "1.2.13",
"version": "1.2.14",
"default_locale": "zh_CN",
"description": "__MSG_extDescription__",
"manifest_version": 2,
Expand Down
Binary file not shown.
Binary file removed src/public/images/icon/edit-user-talk.png
Binary file not shown.
Binary file removed src/public/images/icon/edit.png
Binary file not shown.
Binary file removed src/public/images/icon/flow-topic-resolved.png
Binary file not shown.
Binary file removed src/public/images/icon/gratitude.png
Binary file not shown.
Binary file removed src/public/images/icon/linked.png
Binary file not shown.
Binary file removed src/public/images/icon/placeholder.png
Binary file not shown.
Binary file removed src/public/images/icon/site.png
Binary file not shown.
Binary file removed src/public/images/icon/user-rights.png
Binary file not shown.
24 changes: 22 additions & 2 deletions src/public/js/ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ var action = QueryString.GetValue("action");
var title = decodeURI(QueryString.GetValue("title"));

//Get Status
var editstatus = (action == "edit") ? true : false;
var editstatus = action == "edit";
var submitstatus = action == "submit";
var lyricstatus = (title.indexOf("歌词:") >= 0) ? true : false;

var loadCssCode = (code) => {
Expand Down Expand Up @@ -233,8 +234,27 @@ $().ready(() => {
// });
// }

//提交页面
if (submitstatus) {
setTimeout(() => {
//验证码自动获取
if ($("label[for='wpCaptchaWord']").length > 0) {
var question = $("label[for='wpCaptchaWord']").text();
$.get(CsiteApiUrl, {
action: "query",
format: "json",
formatversion: 2,
meta: "userinfo",
}, (result) => {
$.get(`${apiurl}Captcha.php?q=${question}&uid=${result.query.userinfo.id}`, (res) => {
$("input[name='wpCaptchaWord']").val(res);
});
});
}
}, 1000);
}
//修改页面
if (editstatus) {
else if (editstatus) {
var toolbarReady = null;
toolbarReady = setInterval(() => {
if ($(".wikiEditor-ui-toolbar .tabs").length > 0) {
Expand Down
10 changes: 6 additions & 4 deletions src/public/js/thb.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var checkUnreadNotificationNum = (username) => {
meta: 'notifications',
notformat: "model",
notlimit: 25,
notprop: 'count',
notprop: 'list|count',
uselang: Vlang,
notfilter: "!read"
},
Expand All @@ -40,15 +40,17 @@ var checkUnreadNotificationNum = (username) => {
chrome.browserAction.getBadgeText({}, res => {
let count = res || 0;
if (count < ncount) {
var msg = result.query.notifications.list[0]["*"].header.replace(/<.*?>/g, "");
var url = result.query.notifications.list[0]["*"].links.primary.url;
let options = {
body: getLang("NotificationBody", [ncount]),
body: getLang("NotificationBody", [msg, ncount]),
icon: "../public/images/logo-128.png",
tag: "THBWiki",
renotify: true
};
var notification = new Notification(getLang("NotificationTtile"), options);
notification.onclick = function () {
createTab("https://thwiki.cc/%E7%89%B9%E6%AE%8A:%E9%80%9A%E7%9F%A5");
createTab((ncount == 1) ? url : "https://thwiki.cc/%E7%89%B9%E6%AE%8A:%E9%80%9A%E7%9F%A5");
}
}
chrome.browserAction.setBadgeText({ text: String(ncount) });
Expand Down Expand Up @@ -353,7 +355,7 @@ var getCharTemplInfo = () => {
},
dataType: 'json',
success: (result) => {
var nresult=result.parse.text.replace("<p>","").replace("</p>","");
var nresult = result.parse.text.replace("<p>", "").replace("</p>", "");
res(nresult);
},
error: () => {
Expand Down

0 comments on commit 9d7f8e5

Please sign in to comment.