Auto Bank buttons under Browser Implants with Hide/Show toggle, state memory, and polished style.
当前为
// ==UserScript==
// @name Dead Frontier Auto Bank Buttons + Collapse + Remember State + Fancy
// @namespace http://tampermonkey.net/
// @version 4.2
// @description Auto Bank buttons under Browser Implants with Hide/Show toggle, state memory, and polished style.
// @match https://fairview.deadfrontier.com/onlinezombiemmo/index.php*
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (!window.BrowserImplant_AutoBank) {
window.BrowserImplant_AutoBank = true;
}
const origin = window.location.origin;
const path = window.location.pathname;
const params = new URLSearchParams(window.location.search);
const returnPage = params.get('originPage');
const currentPage = params.get('page') || '';
function makeReturnURL() {
return returnPage ? `${origin}${path}?page=${returnPage}` : `${origin}${path}`;
}
// BANK PAGE HANDLER
if (currentPage === '15' && params.has('scripts')) {
const action = params.get('scripts');
window.addEventListener('load', () => {
setTimeout(() => {
if (action === 'withdraw') {
const amount = params.get('amount') || '50000';
const input = document.querySelector('#withdraw');
const btn = document.querySelector('#wBtn');
if (input && btn) {
input.value = amount;
input.setAttribute('value', amount);
['input','change'].forEach(evt =>
input.dispatchEvent(new Event(evt, { bubbles:true }))
);
if (typeof withdraw === 'function') withdraw();
else btn.click();
}
} else if (action === 'withdrawAll') {
if (typeof withdraw === 'function') withdraw(1);
else {
const allBtn = document.querySelector("button[onclick='withdraw(1);']");
if (allBtn) allBtn.click();
}
} else if (action === 'deposit') {
if (typeof deposit === 'function') deposit(1);
else {
const depBtn = document.querySelector("button[onclick='deposit(1);']");
if (depBtn) depBtn.click();
}
}
}, 200);
setTimeout(() => {
if (returnPage === '35') {
sessionStorage.setItem('df_auto_restore', '1');
}
window.location.replace(makeReturnURL());
}, 500);
});
return;
}
document.addEventListener('DOMContentLoaded', () => {
function injectButtons() {
const panel = document.getElementById('browser-implant-panel');
if (!panel) return setTimeout(injectButtons, 200);
if (document.getElementById('auto-bank-fieldset')) return;
if (currentPage === '35' && sessionStorage.getItem('df_auto_restore')) {
sessionStorage.removeItem('df_auto_restore');
const searchInput = document.getElementById('searchField');
const last = localStorage.getItem('lastDFsearch');
if (searchInput && last) {
searchInput.value = last;
searchInput.dispatchEvent(new Event('input', { bubbles:true }));
setTimeout(() => {
const searchBtn = document.getElementById('makeSearch');
if (searchBtn) searchBtn.click();
}, 50);
}
}
const fieldset = document.createElement('fieldset');
fieldset.id = 'auto-bank-fieldset';
Object.assign(fieldset.style, {
border: '1px solid #666',
padding: '8px 12px',
marginTop: '8px',
background: 'rgba(0,0,0,0.35)',
borderRadius: '8px',
boxShadow: '0 4px 12px rgba(0,0,0,0.6)'
});
const legend = document.createElement('legend');
legend.innerHTML = `<span style="color:#ffd700;">Auto Bank</span> <button id="collapse-auto-bank" style="background:none;border:none;color:#ffd700;font-size:16px;cursor:pointer;">[–]</button>`;
Object.assign(legend.style, {
padding: '0 6px',
fontSize: '13px'
});
fieldset.appendChild(legend);
const btnContainer = document.createElement('div');
btnContainer.id = 'auto-bank-btn-container';
Object.assign(btnContainer.style, {
display: 'flex',
flexDirection: 'column',
gap: '4px',
marginTop: '8px'
});
fieldset.appendChild(btnContainer);
panel.appendChild(fieldset);
const collapseBtn = document.getElementById('collapse-auto-bank');
if (localStorage.getItem('autoBankCollapsed') === 'true') {
btnContainer.style.display = 'none';
collapseBtn.textContent = '[+]';
}
collapseBtn.addEventListener('click', () => {
if (btnContainer.style.display === 'none') {
btnContainer.style.display = 'flex';
collapseBtn.textContent = '[–]';
localStorage.setItem('autoBankCollapsed', 'false');
} else {
btnContainer.style.display = 'none';
collapseBtn.textContent = '[+]';
localStorage.setItem('autoBankCollapsed', 'true');
}
});
function createBtn(id, label, action, amount) {
const btn = document.createElement('button');
btn.id = id;
btn.textContent = label;
Object.assign(btn.style, {
width: '100%',
padding: '4px 8px',
backgroundColor: '#222',
color: '#ffd700',
border: '1px solid #666',
borderRadius: '4px',
fontSize: '12px',
cursor: 'pointer',
textAlign: 'center'
});
btn.addEventListener('click', () => {
if (currentPage === '35') {
const inp = document.getElementById('searchField');
if (inp) localStorage.setItem('lastDFsearch', inp.value);
}
let url = `${origin}${path}?page=15&scripts=${action}`;
if (amount) url += `&amount=${amount}`;
if (currentPage) url += `&originPage=${currentPage}`;
window.location.replace(url);
});
btnContainer.appendChild(btn);
}
createBtn('autoWithdraw50k', 'Withdraw 50k', 'withdraw', '50000');
createBtn('autoWithdraw150k', 'Withdraw 150k', 'withdraw', '150000');
createBtn('autoWithdraw5M', 'Withdraw 5M', 'withdraw', '5000000');
createBtn('autoWithdrawAll', 'Withdraw All', 'withdrawAll', null);
createBtn('autoDepositAll', 'Deposit All', 'deposit', null);
}
injectButtons();
});
})();