您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Self-contained Auto Bank buttons with collapse/remember state (no Browser Implants dependency), positioned under QuickBuy.
// ==UserScript== // @name Dead Frontier Auto Bank Standalone // @namespace http://tampermonkey.net/ // @version 4.6 // @description Self-contained Auto Bank buttons with collapse/remember state (no Browser Implants dependency), positioned under QuickBuy. // @match https://fairview.deadfrontier.com/onlinezombiemmo/index.php* // @grant none // @run-at document-idle // ==/UserScript== (function() { 'use strict'; console.log('[AutoBank] initializing'); 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') || ''; // --- 1) BANK PAGE HANDLER --- if (currentPage === '15' && params.has('scripts')) { console.log('[AutoBank] bank action:', params.get('scripts')); const action = params.get('scripts'); window.addEventListener('load', () => { setTimeout(() => { if (action === 'withdraw') { const amt = params.get('amount') || '50000'; const input = document.querySelector('#withdraw'); const btn = document.querySelector('#wBtn'); if (input && btn) { input.value = amt; input.setAttribute('value', amt); ['input','change'].forEach(e => input.dispatchEvent(new Event(e, { bubbles:true }))); (typeof withdraw==='function'? withdraw(): btn.click()); } } else if (action === 'withdrawAll') { if (typeof withdraw==='function') withdraw(1); else document.querySelector("button[onclick='withdraw(1);']")?.click(); } else if (action === 'deposit') { if (typeof deposit==='function') deposit(1); else document.querySelector("button[onclick='deposit(1);']")?.click(); } },200); setTimeout(() => { if (returnPage==='35') sessionStorage.setItem('df_auto_restore','1'); window.location.replace(`${origin}${path}?page=${returnPage}`); },500); }); return; } // --- 2) MAIN PAGE: WAIT FOR QUICKBUY, THEN INJECT PANEL/BUTTONS --- function injectPanel() { const qb = document.getElementById('quickbuy-fieldset'); if (!qb) { console.log('[AutoBank] QuickBuy panel not yet present, retrying...'); return setTimeout(injectPanel,200); } console.log('[AutoBank] QuickBuy found, injecting panel'); const rightTd = qb.parentElement; rightTd.style.position = 'relative'; let panel = document.getElementById('auto-bank-panel'); if (!panel) { panel = document.createElement('div'); panel.id = 'auto-bank-panel'; Object.assign(panel.style, { position: 'absolute', top: `${qb.offsetTop + qb.offsetHeight + 8}px`, left: qb.style.left || '10px', background: 'rgba(0,0,0,0.3)', border: '1px solid #666', borderRadius: '8px', color: '#ffd700', padding: '8px', width: '180px', zIndex: '10000' }); const title = document.createElement('strong'); title.textContent = 'Auto Bank'; title.style.display = 'block'; title.style.textAlign = 'center'; title.style.marginBottom = '6px'; panel.appendChild(title); rightTd.insertBefore(panel, qb.nextSibling); console.log('[AutoBank] Panel inserted under QuickBuy'); } buildButtons(panel); } function buildButtons(panel) { if (document.getElementById('auto-bank-fieldset')) return; console.log('[AutoBank] Building buttons'); // restore search if returning if (currentPage==='35' && sessionStorage.getItem('df_auto_restore')) { sessionStorage.removeItem('df_auto_restore'); const inp = document.getElementById('searchField'); const last = localStorage.getItem('lastDFsearch'); if (inp && last) { inp.value = last; inp.dispatchEvent(new Event('input',{bubbles:true})); setTimeout(()=> document.getElementById('makeSearch')?.click(),50); } } const fieldset = document.createElement('fieldset'); fieldset.id = 'auto-bank-fieldset'; Object.assign(fieldset.style, { border: '1px solid #666', padding: '6px 10px', margin: '4px 0', background: 'rgba(0,0,0,0.35)', borderRadius: '6px' }); panel.appendChild(fieldset); const legend = document.createElement('legend'); legend.innerHTML = `<span>Controls</span> <button id="collapse-auto-bank" style="background:none;border:none;color:#ffd700;cursor:pointer;">[–]</button>`; Object.assign(legend.style,{fontSize:'12px',padding:'0 4px'}); fieldset.appendChild(legend); const container = document.createElement('div'); container.id = 'auto-bank-btn-container'; Object.assign(container.style, { display:'flex', flexDirection:'column', gap:'4px', marginTop:'6px' }); fieldset.appendChild(container); const collapse = document.getElementById('collapse-auto-bank'); if (localStorage.getItem('autoBankCollapsed')==='true') { container.style.display='none'; collapse.textContent='[+]'; } collapse.addEventListener('click',()=>{ const hidden = container.style.display==='none'; container.style.display = hidden?'flex':'none'; collapse.textContent = hidden?'[–]':'[+]'; localStorage.setItem('autoBankCollapsed', hidden?'false':'true'); }); // button definitions const defs = [ ['autoWithdraw50k','Withdraw 50k','withdraw','50000'], ['autoWithdraw150k','Withdraw 150k','withdraw','150000'], ['autoWithdraw5M','Withdraw 5M','withdraw','5000000'], ['autoWithdrawAll','Withdraw All','withdrawAll',null], ['autoDepositAll','Deposit All','deposit',null] ]; defs.forEach(([id,label,act,amt])=>{ const btn = document.createElement('button'); btn.id=id; btn.textContent=label; Object.assign(btn.style,{width:'100%',padding:'4px 0',background:'#222',color:'#ffd700',border:'1px solid #666',borderRadius:'4px',fontSize:'12px',cursor:'pointer'}); btn.addEventListener('click',()=>{ if (currentPage==='35') { const si = document.getElementById('searchField'); if(si) localStorage.setItem('lastDFsearch',si.value); } let url = `${origin}${path}?page=15&scripts=${act}`; if (amt) url+=`&amount=${amt}`; if (currentPage) url+=`&originPage=${currentPage}`; window.location.replace(url); }); container.appendChild(btn); }); } // initialize function init(){ injectPanel(); } if(document.readyState==='loading') document.addEventListener('DOMContentLoaded',init); else init(); })();