This commit is contained in:
woohoo 2022-07-11 23:11:40 +08:00
parent 7eb1b1846d
commit 6c33d187d7
3 changed files with 9344 additions and 9285 deletions

View File

@ -1,6 +1,6 @@
{
"name": "wuhu-torn-helper",
"version": "0.4.3",
"version": "0.4.4",
"dependencies": {
"uglify-js": "^3.16.1"
},

File diff suppressed because one or more lines are too long

View File

@ -2882,6 +2882,8 @@
{ key: 'removeScripts', val: true },
// 外海警告
{ key: 'abroadWarning', val: true },
// 落地转跳
{ key: 'landedRedirect', val: '' },
// 危险行为⚠️
{ key: 'dangerZone', val: false },
@ -3054,6 +3056,8 @@
dictName: 'abroadWarning',
tip: '海外落地后每30秒通知警告',
});
// 落地转跳
setting_list.push({ domType: 'button', domId: '', domText: '落地转跳', clickFunc: landedRedirect });
// 公司
setting_list.push({
@ -4287,7 +4291,8 @@ z-index: 999999;}`);
'Mexico': '墨西哥', 'Canada': '加拿大', 'Cayman Islands': '开曼',
'Hawaii': '夏威夷', 'United Kingdom': '英国', 'Argentina': '阿根廷', 'Switzerland': '瑞士',
'Japan': '日本', 'China': '中国', 'United Arab Emirates': 'UAE', 'South Africa': '南非',
}[logo_node.attributes.title.nodeValue] || '回城';
}[logo_node.attributes['title'].nodeValue] || '回城';
else dest_cn = '回城';
const remaining_arr = node.innerText.trim().split(':');
const wh_trv_alarm = localStorage.getItem('wh_trv_alarm')
@ -4502,6 +4507,13 @@ display:none;
flying_index = (flying_index + 1) % flying_arr.length;
}, 1000);
});
// 落地转跳
if (getWhSettingObj()['landedRedirect'] && document.querySelector('#tcLogo[title]') === null) {
window.addEventListener('beforeunload', () => {
let obj = { url: getWhSettingObj()['landedRedirect'], timestamp: Date.now() };
sessionStorage['wh-landed-redirect'] = JSON.stringify(obj);
});
}
}
// 海外落地页面
@ -4529,6 +4541,14 @@ display:none;
page_title.before(msg);
}
}
// 回城转跳
else if (href.includes('index.php') && getSidebarData()['home'] && sessionStorage['wh-landed-redirect']) {
let { url, timestamp } = JSON.parse(sessionStorage['wh-landed-redirect']);
if (Date.now() - timestamp < 30000) {
sessionStorage.removeItem('wh-landed-redirect');
location.href = url;
}
}
// 起飞提醒
if (href.contains(/travelagency\.php/) && getWhSettingObj()['energyAlert']) {
@ -6844,7 +6864,7 @@ margin: 0 0 3px;
/**
* 添加全局style
* @param {string} css CSS Rules
* @param {CSSRule|String} css CSS Rules
*/
function addStyle(css) {
let wh_gStyle = document.querySelector('style#wh-trans-gStyle');
@ -10318,5 +10338,37 @@ z-index:100001;
else list.forEach(n => walkNode(n, handler));
}
// 落地转跳
function landedRedirect() {
let p = document.createElement('p');
let input = document.createElement('input');
let buttonSave = document.createElement('button');
let buttonCmp = document.createElement('button');
let buttonFct = document.createElement('button');
let buttonTest = document.createElement('button');
let br = document.createElement('br');
p.innerHTML = '飞机落地后转跳的页面,关闭功能请置空:';
input.placeholder = 'URL';
input.value = getWhSettingObj()['landedRedirect'] || '';
input.style.display = 'block';
input.style.textAlign = 'left';
input.style.width = '100%';
input.style.padding = '8px';
input.style.margin = '8px -8px';
buttonSave.innerHTML = '保存';
buttonCmp.innerHTML = '填入公司金库';
buttonFct.innerHTML = '填入帮派金库金库';
buttonTest.innerHTML = '测试链接';
buttonSave.addEventListener('click', () => setWhSetting('landedRedirect', input.value));
buttonCmp.addEventListener('click', () => input.value = 'https://www.torn.com/companies.php#/option=applications');
buttonFct.addEventListener('click', () => input.value = 'https://www.torn.com/factions.php?step=your#/tab=armoury');
buttonTest.addEventListener('click', () => window.open(input.value));
let node = popupMsg('', '落地转跳');
node.append(p, input, buttonSave, br, buttonCmp, buttonFct, buttonTest);
}
$zhongNode.initTimer.innerHTML = `助手加载时间 ${Date.now() - start_timestamp}ms`;
}();