更新
This commit is contained in:
parent
ec60b88cbf
commit
f37641a955
13
CHANGELOG.md
13
CHANGELOG.md
@ -5,6 +5,19 @@
|
|||||||
|
|
||||||
# CHANGE
|
# CHANGE
|
||||||
|
|
||||||
|
## 0.6.0 pre
|
||||||
|
|
||||||
|
2022年10月日
|
||||||
|
|
||||||
|
### 修改
|
||||||
|
|
||||||
|
- 解毒提醒UI调整
|
||||||
|
- 传单助手UI调整
|
||||||
|
|
||||||
|
### 添加
|
||||||
|
|
||||||
|
- 更多设置
|
||||||
|
|
||||||
## 0.5.9
|
## 0.5.9
|
||||||
|
|
||||||
2022年10月14日
|
2022年10月14日
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import MDUtils from "./utils/MDUtils";
|
|||||||
import Test from "../test/Test";
|
import Test from "../test/Test";
|
||||||
import TornStyleSwitch from "./utils/TornStyleSwitch";
|
import TornStyleSwitch from "./utils/TornStyleSwitch";
|
||||||
import Global from "./Global";
|
import Global from "./Global";
|
||||||
|
import BuyBeerHelper from "./action/BuyBeerHelper";
|
||||||
|
|
||||||
export default class ZhongIcon extends WuhuBase {
|
export default class ZhongIcon extends WuhuBase {
|
||||||
public static ZhongNode: MyHTMLElement = null;
|
public static ZhongNode: MyHTMLElement = null;
|
||||||
@ -785,7 +786,7 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
private constructWuhuSettingList(): ZhongIcon {
|
private constructWuhuSettingList(): ZhongIcon {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
||||||
let { beer, popup_node } = ZhongIcon.glob;
|
let beer = BuyBeerHelper.getInstance();
|
||||||
|
|
||||||
let list: MenuItemConfig[] = [];
|
let list: MenuItemConfig[] = [];
|
||||||
|
|
||||||
@ -1176,7 +1177,7 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
list.push({
|
list.push({
|
||||||
domType: 'checkbox',
|
domType: 'checkbox',
|
||||||
domId: 'wh-dev-mode',
|
domId: 'wh-dev-mode',
|
||||||
domText: ` 开发者模式${ Log.debug() ? ' <button id="wh-devInfo">详情</button>' : '' }`,
|
domText: '开发模式',
|
||||||
dictName: 'isDev',
|
dictName: 'isDev',
|
||||||
isHide: true,
|
isHide: true,
|
||||||
});
|
});
|
||||||
@ -1186,20 +1187,35 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
domId: null,
|
domId: null,
|
||||||
domText: '查看日志',
|
domText: '查看日志',
|
||||||
clickFunc: () => {
|
clickFunc: () => {
|
||||||
let pop = new Popup('<textarea readonly style="width:100%;height:340px;"></textarea><br/><button>全选</button>', '查看日志');
|
let pop = new Popup('<textarea readonly style="width:100%;height:340px;"></textarea>', '查看日志');
|
||||||
let text = pop.getElement().querySelector('textarea');
|
let text = pop.getElement().querySelector('textarea');
|
||||||
text.innerHTML = Log.getLogs();
|
text.innerHTML = Log.getLogs();
|
||||||
pop.getElement().querySelector('button').onclick = () => text.select();
|
text.onclick = () => text.select();
|
||||||
//
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 更多设定
|
// 更多设定
|
||||||
if (Log.debug()) list.push({
|
list.push({
|
||||||
domType: 'button', domId: 'wh-otherBtn', domText: '更多设定',
|
domType: 'button', domId: 'wh-otherBtn', domText: '更多设定',
|
||||||
clickFunc: () => {
|
clickFunc: () => {
|
||||||
new Popup(`清空设置数据、请求通知权限、测试跨域请求`, '更多设定');
|
let pop = new Popup('', '更多设定');
|
||||||
|
let insertHtml = '<p><button class="torn-btn">清空设置数据</button></p><p><button class="torn-btn">请求通知权限</button></p><p><button class="torn-btn">测试跨域请求</button></p>';
|
||||||
|
pop.getElement().insertAdjacentHTML('beforeend', insertHtml);
|
||||||
|
let [btn1, btn2, btn3] = Array.from(pop.getElement().querySelectorAll('button'));
|
||||||
|
btn1.addEventListener('click', () => {
|
||||||
|
localStorage.setItem('wh_trv_alarm', '');
|
||||||
|
localStorage.setItem('wh_trans_settings', '');
|
||||||
|
localStorage.setItem('whuuid', '');
|
||||||
|
localStorage.setItem('wh-gs-storage', '');
|
||||||
|
localStorage.setItem('WHTEST', '');
|
||||||
|
new Alert('已清空,刷新页面');
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
btn2.addEventListener('click', () => {
|
||||||
|
});
|
||||||
|
btn3.addEventListener('click', () => {
|
||||||
|
});
|
||||||
},
|
},
|
||||||
isHide: true,
|
// isHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.settingItemList = list;
|
this.settingItemList = list;
|
||||||
|
|||||||
@ -19,14 +19,17 @@ export default class Alert extends WuhuBase {
|
|||||||
let { timeout, callback, sysNotify, } = options;
|
let { timeout, callback, sysNotify, } = options;
|
||||||
|
|
||||||
// 后台窗口、iframe内判断
|
// 后台窗口、iframe内判断
|
||||||
if (!WindowActiveState.getInstance().get() || (self !== top)) return null;
|
if (!WindowActiveState.getInstance().get() || (self !== top)) {
|
||||||
|
Log.warn('后台通知已被屏蔽');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 通知的容器
|
// 通知的容器
|
||||||
if (Alert.container === null) Alert.initContainer();
|
if (Alert.container === null) Alert.initContainer();
|
||||||
|
|
||||||
this.callback = callback || (() => null);
|
this.callback = callback || (() => null);
|
||||||
Alert.create(this, msg, timeout || 3);
|
Alert.create(this, msg, timeout || 3);
|
||||||
Log.info('创建新通知:', this);
|
Log.info('创建新通知:', this, msg);
|
||||||
if (sysNotify) NotificationUtils.getInstance().push(msg, options);
|
if (sysNotify) NotificationUtils.getInstance().push(msg, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import WuhuBase from "../WuhuBase";
|
import WuhuBase from "../WuhuBase";
|
||||||
import POPUP_HTML from "../../static/html/popup.html";
|
import POPUP_HTML from "../../static/html/popup.html";
|
||||||
|
import Log from "../Log";
|
||||||
|
|
||||||
export default class Popup extends WuhuBase {
|
export default class Popup extends WuhuBase {
|
||||||
protected className = 'Popup';
|
protected className = 'Popup';
|
||||||
@ -8,7 +9,11 @@ export default class Popup extends WuhuBase {
|
|||||||
|
|
||||||
constructor(innerHTML: string, title: string = '芜湖助手') {
|
constructor(innerHTML: string, title: string = '芜湖助手') {
|
||||||
super();
|
super();
|
||||||
if (Popup.glob.popup_node) Popup.glob.popup_node.close();
|
if (Popup.glob.popup_node) {
|
||||||
|
Log.info('关闭前一个弹窗');
|
||||||
|
Popup.glob.popup_node.close();
|
||||||
|
}
|
||||||
|
Log.info('新建弹窗', { innerHTML, title });
|
||||||
const popup = document.createElement('div');
|
const popup = document.createElement('div');
|
||||||
popup.id = 'wh-popup';
|
popup.id = 'wh-popup';
|
||||||
popup.innerHTML = POPUP_HTML.replace('{{}}', title).replace('{{}}', innerHTML);
|
popup.innerHTML = POPUP_HTML.replace('{{}}', title).replace('{{}}', innerHTML);
|
||||||
|
|||||||
@ -19,6 +19,9 @@ export default function adHelper() {
|
|||||||
clear_button.innerText = '清空所有聊天框';
|
clear_button.innerText = '清空所有聊天框';
|
||||||
paste_button.innerText = '粘贴剪切板';
|
paste_button.innerText = '粘贴剪切板';
|
||||||
style.innerHTML = '#chatRoot > div{z-index:199999 !important;}';
|
style.innerHTML = '#chatRoot > div{z-index:199999 !important;}';
|
||||||
|
place_button.classList.add('torn-btn');
|
||||||
|
clear_button.classList.add('torn-btn');
|
||||||
|
paste_button.classList.add('torn-btn');
|
||||||
|
|
||||||
place_button.addEventListener('click', () => {
|
place_button.addEventListener('click', () => {
|
||||||
let chats = Array.from(document.querySelectorAll('#chatRoot textarea[name="chatbox2"]') as NodeListOf<HTMLTextAreaElement>);
|
let chats = Array.from(document.querySelectorAll('#chatRoot textarea[name="chatbox2"]') as NodeListOf<HTMLTextAreaElement>);
|
||||||
|
|||||||
@ -7,7 +7,9 @@ import Alert from "../../class/utils/Alert";
|
|||||||
import ActionButtonUtils from "../../class/utils/ActionButtonUtils";
|
import ActionButtonUtils from "../../class/utils/ActionButtonUtils";
|
||||||
import WuhuConfig from "../../class/WuhuConfig";
|
import WuhuConfig from "../../class/WuhuConfig";
|
||||||
import CommonUtils from "../../class/utils/CommonUtils";
|
import CommonUtils from "../../class/utils/CommonUtils";
|
||||||
import Log from "../../class/Log";
|
import TRAVEL_ALARM_CSS from "../../static/css/travel_alarm.css";
|
||||||
|
import TRAVEL_ALARM_HTML from "../../static/html/travel_alarm.html";
|
||||||
|
import TornStyleBlock from "../../class/utils/TornStyleBlock";
|
||||||
|
|
||||||
export default async function travelHelper(): Promise<null> {
|
export default async function travelHelper(): Promise<null> {
|
||||||
let { href, bodyAttrs, device } = WuhuBase.glob;
|
let { href, bodyAttrs, device } = WuhuBase.glob;
|
||||||
@ -43,85 +45,11 @@ export default async function travelHelper(): Promise<null> {
|
|||||||
wh_trv_alarm_node.id = 'wh-trv-alarm';
|
wh_trv_alarm_node.id = 'wh-trv-alarm';
|
||||||
wh_trv_alarm_node.style.left = `${ wh_trv_alarm.node_pos[0] }px`;
|
wh_trv_alarm_node.style.left = `${ wh_trv_alarm.node_pos[0] }px`;
|
||||||
wh_trv_alarm_node.style.top = `${ wh_trv_alarm.node_pos[1] }px`;
|
wh_trv_alarm_node.style.top = `${ wh_trv_alarm.node_pos[1] }px`;
|
||||||
wh_trv_alarm_node.innerHTML = `<div id="wh-trv-error"><p><b>❌ 没有权限</b><br/>点击网页内任意位置以激活闹钟</p></div>
|
wh_trv_alarm_node.innerHTML = TRAVEL_ALARM_HTML
|
||||||
<div id="wh-trv-alarm-title">
|
.replace('{{}}', dest_cn === '回城' ? dest_cn : '飞往' + dest_cn)
|
||||||
<h5 id="wh-trv-alarm-header">飞行闹钟</h5>
|
.replace('{{}}', wh_trv_alarm.enable ? 'checked ' : '')
|
||||||
</div>
|
.replace('{{}}', wh_trv_alarm.alert_time || 30);
|
||||||
<div id="wh-trv-alarm-bottom">
|
CommonUtils.addStyle(TRAVEL_ALARM_CSS);
|
||||||
<div id="wh-trv-alarm-cont">
|
|
||||||
<p id="wh-trv-alarm-remaining"></p>
|
|
||||||
<p><span id="wh-trv-status">正在${ dest_cn === '回城' ? dest_cn : '飞往' + dest_cn } </span><span>✈</span></p>
|
|
||||||
<div><label><input type="checkbox" ${ wh_trv_alarm.enable ? 'checked ' : ' ' }/> 开启闹钟</label></div>
|
|
||||||
<div><label>落地前响铃时长(秒): <input type="number" value="${ wh_trv_alarm.alert_time || 30 }" /></label><button>确定</button></div>
|
|
||||||
<div class="wh-trv-alarm-stop-hide"><button>停止闹钟</button></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
CommonUtils.addStyle(`
|
|
||||||
#wh-trv-alarm{
|
|
||||||
position:absolute;
|
|
||||||
width:248px;
|
|
||||||
/*left:${ wh_trv_alarm.node_pos[0] || 240 }px;
|
|
||||||
top:${ wh_trv_alarm.node_pos[1] || 240 }px;*/
|
|
||||||
background:white;
|
|
||||||
border-radius:4px;
|
|
||||||
box-shadow:#0000001f 0 0 10px 4px;
|
|
||||||
border:solid 1px #aaa;
|
|
||||||
z-index:100001;
|
|
||||||
margin:2em;
|
|
||||||
}
|
|
||||||
#wh-trv-alarm button{
|
|
||||||
margin:0;
|
|
||||||
}
|
|
||||||
#wh-trv-error{
|
|
||||||
position:absolute;
|
|
||||||
width:100%;
|
|
||||||
height:100%;
|
|
||||||
/*display: table;*/
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
#wh-trv-error p{
|
|
||||||
background:#ffd0d0;
|
|
||||||
color:red;
|
|
||||||
display:table-cell;
|
|
||||||
vertical-align:middle;
|
|
||||||
padding:1em;
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
#wh-trv-alarm-title{
|
|
||||||
height: 30px;
|
|
||||||
border-bottom: solid #aaa 1px;
|
|
||||||
cursor: move;
|
|
||||||
}
|
|
||||||
/*#wh-trv-alarm-move-btn span{
|
|
||||||
background:url(/images/v2/home_main/move.svg);
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
float: right;
|
|
||||||
cursor: move;
|
|
||||||
}*/
|
|
||||||
h5#wh-trv-alarm-header{
|
|
||||||
height: 100%;
|
|
||||||
line-height: 30px;
|
|
||||||
padding:0 12px;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#wh-trv-alarm-bottom{
|
|
||||||
padding: 12px;
|
|
||||||
}
|
|
||||||
#wh-trv-alarm-remaining{
|
|
||||||
float:right;
|
|
||||||
color:red;
|
|
||||||
}
|
|
||||||
#wh-trv-alarm-cont input[type="number"]{
|
|
||||||
width: 42px;
|
|
||||||
border-bottom: solid 1px #aaa;
|
|
||||||
}
|
|
||||||
.wh-trv-alarm-stop-hide{
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
`);
|
|
||||||
document.body.append(wh_trv_alarm_node);
|
document.body.append(wh_trv_alarm_node);
|
||||||
// 报错dom
|
// 报错dom
|
||||||
const error_node = wh_trv_alarm_node.querySelector('#wh-trv-error') as HTMLElement;
|
const error_node = wh_trv_alarm_node.querySelector('#wh-trv-error') as HTMLElement;
|
||||||
@ -252,28 +180,6 @@ display:none;
|
|||||||
flying_ani.innerHTML = `${ flying_arr[flying_index] }`;
|
flying_ani.innerHTML = `${ flying_arr[flying_index] }`;
|
||||||
flying_index = (flying_index + 1) % flying_arr.length;
|
flying_index = (flying_index + 1) % flying_arr.length;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
Log.info({
|
|
||||||
dest_cn,
|
|
||||||
remaining_arr,
|
|
||||||
wh_trv_alarm,
|
|
||||||
wh_trv_alarm_node,
|
|
||||||
error_node,
|
|
||||||
remaining_node,
|
|
||||||
set_node,
|
|
||||||
cd_time,
|
|
||||||
count_down_notify,
|
|
||||||
stop_node,
|
|
||||||
enable_node,
|
|
||||||
remaining_sec,
|
|
||||||
land_timestamp,
|
|
||||||
audio,
|
|
||||||
audio_play_flag,
|
|
||||||
user_stop_alert,
|
|
||||||
audio_play_id,
|
|
||||||
flying_status,
|
|
||||||
flying_index,
|
|
||||||
id
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 落地转跳 落地前事件
|
// 落地转跳 落地前事件
|
||||||
@ -298,18 +204,20 @@ display:none;
|
|||||||
}
|
}
|
||||||
// 解毒提醒
|
// 解毒提醒
|
||||||
if (bodyAttrs['data-country'] === 'switzerland') {
|
if (bodyAttrs['data-country'] === 'switzerland') {
|
||||||
let page_title = document.querySelector('h4#skip-to-content');
|
let block = new TornStyleBlock('解毒提醒').insert2Dom();
|
||||||
let msg = document.createElement('div');
|
block.setContent('<p><a href="/index.php?page=rehab">❤️ 点击前往解毒</a></p>');
|
||||||
msg.innerHTML = `<div class="info-msg border-round">
|
// let page_title = document.querySelector('h4#skip-to-content');
|
||||||
<i class="info-icon"></i>
|
// let msg = document.createElement('div');
|
||||||
<div class="delimiter">
|
// msg.innerHTML = `<div class="info-msg border-round">
|
||||||
<div class="msg right-round" tabindex="0" role="alert">
|
// <i class="info-icon"></i>
|
||||||
<p><a href="/index.php?page=rehab">❤️ 点击前往解毒</a></p>
|
// <div class="delimiter">
|
||||||
</div>
|
// <div class="msg right-round" tabindex="0" role="alert">
|
||||||
</div>
|
// <p><a href="/index.php?page=rehab">❤️ 点击前往解毒</a></p>
|
||||||
</div>`;
|
// </div>
|
||||||
msg.classList.add('info-msg-cont', 'green', 'border-round', 'm-bottom10');
|
// </div>
|
||||||
page_title.before(msg);
|
// </div>`;
|
||||||
|
// msg.classList.add('info-msg-cont', 'green', 'border-round', 'm-bottom10');
|
||||||
|
// page_title.before(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -402,7 +310,7 @@ async function travelBack(): Promise<null> {
|
|||||||
new Alert(res);
|
new Alert(res);
|
||||||
if (!res.includes('error')) {
|
if (!res.includes('error')) {
|
||||||
new Alert('成功,即将刷新');
|
new Alert('成功,即将刷新');
|
||||||
setTimeout(() => location.reload(), 3000);
|
window.setTimeout(() => location.reload(), 3000);
|
||||||
} else {
|
} else {
|
||||||
new Alert('出错了');
|
new Alert('出错了');
|
||||||
}
|
}
|
||||||
|
|||||||
62
src/static/css/travel_alarm.css
Normal file
62
src/static/css/travel_alarm.css
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#wh-trv-alarm {
|
||||||
|
position: absolute;
|
||||||
|
width: 248px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: #0000001f 0 0 10px 4px;
|
||||||
|
border: solid 1px #aaa;
|
||||||
|
z-index: 100001;
|
||||||
|
margin: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wh-trv-alarm button {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wh-trv-error {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wh-trv-error p {
|
||||||
|
background: #ffd0d0;
|
||||||
|
color: red;
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 1em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wh-trv-alarm-title {
|
||||||
|
height: 30px;
|
||||||
|
border-bottom: solid #aaa 1px;
|
||||||
|
cursor: move;
|
||||||
|
}
|
||||||
|
|
||||||
|
h5#wh-trv-alarm-header {
|
||||||
|
height: 100%;
|
||||||
|
line-height: 30px;
|
||||||
|
padding: 0 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wh-trv-alarm-bottom {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wh-trv-alarm-remaining {
|
||||||
|
float: right;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wh-trv-alarm-cont input[type="number"] {
|
||||||
|
width: 42px;
|
||||||
|
border-bottom: solid 1px #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wh-trv-alarm-stop-hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
18
src/static/html/travel_alarm.html
Normal file
18
src/static/html/travel_alarm.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<div id="wh-trv-error"><p><b>❌ 没有权限</b><br/>点击网页内任意位置以激活闹钟</p></div>
|
||||||
|
<div id="wh-trv-alarm-title">
|
||||||
|
<h5 id="wh-trv-alarm-header">飞行闹钟</h5>
|
||||||
|
</div>
|
||||||
|
<div id="wh-trv-alarm-bottom">
|
||||||
|
<div id="wh-trv-alarm-cont">
|
||||||
|
<p id="wh-trv-alarm-remaining"></p>
|
||||||
|
<p><span id="wh-trv-status">正在{{}} </span><span>✈</span></p>
|
||||||
|
<div><input class="checkbox-css" id="WHTravelAlarmToggle" type="checkbox" {{}}/><label
|
||||||
|
class="non-selection marker-css" for="WHTravelAlarmToggle">开启闹钟</label></div>
|
||||||
|
<div><label>落地前响铃时长(秒): <input type="number" value="{{}}"/></label>
|
||||||
|
<button>确定</button>
|
||||||
|
</div>
|
||||||
|
<div class="wh-trv-alarm-stop-hide">
|
||||||
|
<button>停止闹钟</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Loading…
x
Reference in New Issue
Block a user