修复报纸日期翻译问题
This commit is contained in:
parent
fad8478579
commit
28363bd87a
@ -1,8 +1,8 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @lastmodified 202112101911
|
// @lastmodified 202112111523
|
||||||
// @name Torn翻译
|
// @name Torn翻译
|
||||||
// @namespace WOOH
|
// @namespace WOOH
|
||||||
// @version 0.1.1210a
|
// @version 0.1.1211a
|
||||||
// @description Torn UI翻译
|
// @description Torn UI翻译
|
||||||
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
// @author Woohoo-[2687093] sabrina_devil[2696209]
|
||||||
// @match https://www.torn.com/*
|
// @match https://www.torn.com/*
|
||||||
@ -23,6 +23,11 @@
|
|||||||
todo: true,
|
todo: true,
|
||||||
cont: `baza npc商店 imarket及imarket搜索结果`,
|
cont: `baza npc商店 imarket及imarket搜索结果`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ver: '0.1.1211a',
|
||||||
|
date: '20211211',
|
||||||
|
cont: `修复报纸日期翻译问题`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ver: '0.1.1210a',
|
ver: '0.1.1210a',
|
||||||
date: '20211210',
|
date: '20211210',
|
||||||
@ -4179,9 +4184,28 @@
|
|||||||
// 公众号广告
|
// 公众号广告
|
||||||
$('div.price.left').contents()[2].nodeValue = '文章翻译请关注中文公众号Torncity';
|
$('div.price.left').contents()[2].nodeValue = '文章翻译请关注中文公众号Torncity';
|
||||||
// 日期翻译
|
// 日期翻译
|
||||||
const date = new Date($('span.date-label').text());
|
const $date_label = document.querySelector('span.date-label');
|
||||||
if (date.format('yyyy') !== 'NaN')
|
const date_reg = /^[FMSTW][adehinorstuy]+, [ADFJMNOS][abceglnoprtuvy]+ [1-3]?[0-9], 20[0-9][0-9]$/;
|
||||||
$('span.date-label').text(date.format('yyyy年MM月dd日'));
|
if ($date_label && $date_label.innerText.trim().contains(date_reg)) {
|
||||||
|
const date_format = $date_label.innerText.trim().replaceAll(',', '');
|
||||||
|
const date_spl = date_format.split(' ');
|
||||||
|
const date = {w: date_spl[0], m: date_spl[1], d: date_spl[2], y: date_spl[3]};
|
||||||
|
const month_trans = {
|
||||||
|
'Jan': 1,
|
||||||
|
'Feb': 2,
|
||||||
|
'Mar': 3,
|
||||||
|
'Apr': 4,
|
||||||
|
'May': 5,
|
||||||
|
'Jun': 6,
|
||||||
|
'Jul': 7,
|
||||||
|
'Aug': 8,
|
||||||
|
'Sep': 9,
|
||||||
|
'Oct': 10,
|
||||||
|
'Nov': 11,
|
||||||
|
'Dec': 12
|
||||||
|
};
|
||||||
|
$date_label.innerText = `${date.y}年${month_trans[date.m] || date.m}月${date.d}日`;
|
||||||
|
}
|
||||||
// 菜单下的信息 工作 壁纸 广告 悬赏
|
// 菜单下的信息 工作 壁纸 广告 悬赏
|
||||||
$('div.help-message').find('*').contents().each((i, e) => {
|
$('div.help-message').find('*').contents().each((i, e) => {
|
||||||
if (!e.nodeValue || e.nodeValue.trim() === '') return;
|
if (!e.nodeValue || e.nodeValue.trim() === '') return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user