diff --git a/torn-trans-zhcn.user.js b/torn-trans-zhcn.user.js
index ec3bf0d..dd55282 100644
--- a/torn-trans-zhcn.user.js
+++ b/torn-trans-zhcn.user.js
@@ -1,8 +1,8 @@
// ==UserScript==
-// @lastmodified 202201271811
+// @lastmodified 202201280112
// @name Torn翻译
// @namespace WOOH
-// @version 0.3.2
+// @version 0.3.3
// @description Torn UI翻译
// @author Woohoo[2687093] Sabrina_Devil[2696209]
// @match https://www.torn.com/*
@@ -23,13 +23,18 @@
if (window.WHTRANS) return;
window.WHTRANS = true;
// 版本
- const version = '0.3.2';
+ const version = '0.3.3';
// 修改历史
const changelist = [
{
todo: true,
cont: `翻译:baza npc商店、imarket、imarket搜索结果`,
},
+ {
+ ver: '0.3.3',
+ date: '20220128',
+ cont: `调整样式、减少初始设置的通知`,
+ },
{
ver: '0.3.2',
date: '20220127',
@@ -3093,7 +3098,7 @@
default_settings.forEach(_default => {
if (typeof wh_trans_settings[_default.key] !== typeof _default.val) wh_trans_settings[_default.key] = _default.val;
});
- saveSettings();
+ saveSettings(true);
const GS = {};
@@ -3104,47 +3109,9 @@
settingsArr.push({
domType: 'checkbox',
domId: 'wh-trans-enable',
- domText: ' 开启翻译 (施工中)',
+ domText: ' 开启翻译 ',
dictName: 'transEnable',
})
- // 更新词库按钮
- settingsArr.push({
- domType: 'button',
- domId: 'wh-trans-data-update',
- domText: '更新翻译词库数据',
- clickFunc: function (e) {
- e.target.blur();
- if (this.intervalID) return;
- const url = isDev() ? 'http://192.168.1.7:8080/' : 'https://jjins.github.io/gengxin/';
- const popup = window.open(url);
- let hsCount = 0;
- this.intervalID = window.setInterval(() => {
- if (hsCount > 20) {
- clearInterval(this.intervalID);
- this.intervalID = null;
- return;
- }
- popup.postMessage("connect", '*');
- hsCount++;
- }, 500);
- let connected = false;
- if (!this.msgEventCreated) {
- window.addEventListener("message", (e) => {
- this.msgEventCreated = true;
- if (e.data === 'connected') {
- connected = true;
- clearInterval(this.intervalID);
- this.intervalID = null;
- return;
- }
- if (connected) {
- // 传回的动态内容
- log(e.data);
- }
- }, false);
- }
- },
- })
// 12月时加入圣诞小镇选项
if (new Date().getMonth() === 11) {
settingsArr.push({
@@ -3306,7 +3273,7 @@
} else {
wh_trans_settings.autoStartFinish = false;
wh_trans_settings.attReload = 6;
- saveSettings();
+ saveSettings(true);
}
// 飞花库存
settingsArr.push({
@@ -3359,8 +3326,8 @@
() => window.location.href = 'https://www.torn.com/crimes.php');
return;
}
- // const popup_node = popupMsg(`加载中 ${loading_gif_html}
`, '飞贼助手加载');
if (!GS.LOADED) {
+ notify('正在加载...');
COFetch('https://cdn.staticfile.org/vue/2.2.2/vue.min.js')
.catch(err => notify(err))
.then(VueJS => {
@@ -3396,7 +3363,7 @@
}
window.eval(GSJS);
if (isDev()) window.GM_setValue("gsp_showContent", true);
- notify('飞贼助手已载入');
+ notify('已载入飞贼助手');
})
.catch(err => notify(`PDA API错误。${err}`));
});
@@ -3523,6 +3490,38 @@
// 左侧“中”标签
const $zhongNode = initIcon();
if ($zhongNode) {
+ // 更新词库按钮
+ $zhongNode.querySelector('#wh-trans-data-update').onclick = function () {
+ if (this.intervalID) return;
+ const url = isDev() ? 'http://192.168.1.7:8080/' : 'https://jjins.github.io/gengxin/';
+ const popup = window.open(url);
+ let hsCount = 0;
+ this.intervalID = window.setInterval(() => {
+ if (hsCount > 20) {
+ clearInterval(this.intervalID);
+ this.intervalID = null;
+ return;
+ }
+ popup.postMessage("connect", '*');
+ hsCount++;
+ }, 500);
+ let connected = false;
+ if (!this.msgEventCreated) {
+ window.addEventListener("message", (e) => {
+ this.msgEventCreated = true;
+ if (e.data === 'connected') {
+ connected = true;
+ clearInterval(this.intervalID);
+ this.intervalID = null;
+ return;
+ }
+ if (connected) {
+ // 传回的动态内容
+ log(e.data);
+ }
+ }, false);
+ }
+ }
// 小窗犯罪按钮
$zhongNode.querySelector('#wh-quick-crime-btn').onclick = () => {
// 弹出小窗口
@@ -3627,13 +3626,33 @@
// 开发详情按钮
$zhongNode.querySelector('#wh-devInfo').onclick = () => {
const date = new Date();
- const insert = `当前页面: ${window.location.href}
-分辨率: ${window.innerWidth}x${window.innerHeight}
-设备类型: ${getDeviceType()}
-脚本类型: ${getScriptEngine()}
-时间: ${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}
-插件版本: ${version}
-`;
+ let os = '未知';
+ try {
+ os = window.navigator.userAgentData.platform || window.navigator.platform
+ } catch {
+ }
+ let browser = window.navigator.appName;
+ try {
+ browser = window.navigator.userAgentData.brands[0].brand + ' ' + window.navigator.userAgentData.brands[0].version;
+ } catch {
+ }
+
+ const insert = `
| URL | ${window.location.href} |
| 页面尺寸 | ${window.innerWidth}x${window.innerHeight} |
| 设备类型 | ${getDeviceType().toUpperCase()} |
| 脚本运行方式 | ${{'gm':'油猴','raw':'直接运行','pda':'TornPDA'}[getScriptEngine()]} |
| 时间 | ${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()} |
| 插件版本 | ${version} |
| 操作系统 | ${os} |
| 浏览器 | ${browser} |
${title}
${title}