// ==UserScript== // @name BCA SQTF Auto War Controller // @namespace http://tampermonkey.net/ // @version 1.0 // @description BCA SQTF automation controller // @match https://pub.lasmana.com/bca.html // @match https://webform.bca.co.id/marketers/sqtf/2026/reg* // @grant GM_getValue // @grant GM_setValue // ==/UserScript== (() => { "use strict"; // ================================================== // STORAGE // ================================================== const KEY = { card: "noKartu", email: "email", day: "tanggal", month: "bulan", year: "tahun", schedule: "startTimes", enabled: "enabled" }; const get = (key, def="") => GM_getValue(key, def); const set = (key, value) => GM_setValue(key, value); // ================================================== // CONFIG // ================================================== function getConfig(){ return { card: get(KEY.card), email: get(KEY.email), day: get(KEY.day, "01"), month: get(KEY.month, "01"), year: get(KEY.year, "1990"), schedule: get( KEY.schedule, "10:00,14:00" ) }; } // ================================================== // UI // ================================================== const panel = document.createElement("div"); panel.id = "bca-panel"; panel.innerHTML = `
๐Ÿฐ BCA SQTF

Status: OFF
`; const style = document.createElement("style"); style.textContent = ` #bca-panel { position:fixed; top:20px; right:20px; width:280px; padding:15px; background:white; border:2px solid #0050a4; border-radius:12px; z-index:999999; font-family:Arial; box-shadow:0 5px 20px #0005; } .bca-title { font-size:18px; font-weight:bold; margin-bottom:10px; } #bca-panel label { display:block; font-weight:bold; margin-top:6px; } #bca-panel input { width:100%; box-sizing:border-box; padding:6px; } .row { display:flex; gap:5px; } .row div { flex:1; } #bca-panel button { width:100%; margin-top:7px; padding:8px; cursor:pointer; } `; document.head.appendChild(style); document.body.appendChild(panel); const $ = id => document.getElementById(id); // ================================================== // LOAD CONFIG TO UI // ================================================== function loadUI(){ const c = getConfig(); $("cfg-card").value = c.card; $("cfg-email").value = c.email; $("cfg-day").value = c.day; $("cfg-month").value = c.month; $("cfg-year").value = c.year; $("cfg-schedule").value = c.schedule; } loadUI(); function status(msg){ $("bca-status").innerHTML = msg; } // ================================================== // SAVE CONFIG // ================================================== $("btn-save").onclick = () => { set( KEY.card, $("cfg-card").value ); set( KEY.email, $("cfg-email").value ); set( KEY.day, $("cfg-day").value ); set( KEY.month, $("cfg-month").value ); set( KEY.year, $("cfg-year").value ); set( KEY.schedule, $("cfg-schedule").value ); status( "๐Ÿ’พ Config saved" ); }; // ================================================== // FORM HELPER // ================================================== function setInputValue( element, value ){ if(!element) return; const setter = Object.getOwnPropertyDescriptor( HTMLInputElement.prototype, "value" ).set; setter.call( element, value ); element.dispatchEvent( new Event( "input", { bubbles:true } ) ); element.dispatchEvent( new Event( "change", { bubbles:true } ) ); } // ================================================== // FILL BCA FORM // ================================================== function fillForm(){ const c = getConfig(); const card = document.querySelector( 'input[placeholder*="No. Kartu"]' ); if(!card){ console.log( "[BCA] card input not found" ); return false; } setInputValue( card, c.card ); const email = document.querySelector( 'input[placeholder*="Email"]' ); setInputValue( email, c.email ); const selects = document.querySelectorAll( "select" ); if(selects.length >= 3){ selects[0].value = c.day; selects[0].dispatchEvent( new Event( "change", { bubbles:true } ) ); selects[1].value = c.month; selects[1].dispatchEvent( new Event( "change", { bubbles:true } ) ); selects[2].value = c.year; selects[2].dispatchEvent( new Event( "change", { bubbles:true } ) ); } console.log( "[BCA] form filled" ); return true; } // ================================================== // FIND REGISTER BUTTON // ================================================== function findRegisterButton(){ const elements = [ ...document.querySelectorAll( "button,input,a,div" ) ]; return elements.find( el => { const text = ( el.innerText || el.value || "" ) .trim() .toLowerCase(); return ( text.includes( "registrasi" ) || text.includes( "register" ) || text.includes( "submit" ) || text.includes( "lanjut" ) || text.includes( "daftar" ) ); } ); } function stopAutomation(){ GM_setValue( KEY.enabled, false ); if(scheduleTimer){ clearInterval(scheduleTimer); } if(warTimer){ clearInterval(warTimer); } status( "โœ… SUBMITTED - STOPPED" ); console.log( "[BCA] automation stopped" ); } // ================================================== // CLICK REGISTER // ================================================== function clickRegister(){ const btn = document.querySelector( "#btnsubmit" ); if(!btn){ console.log( "Submit button tidak ditemukan" ); return false; } console.log( "Click submit..." ); btn.click(); stopAutomation(); return true; } // ================================================== // TEST // ================================================== $("btn-test").onclick = () => { if( fillForm() ){ setTimeout( () => { clickRegister(); }, 500 ); status( "๐Ÿงช Test submit executed" ); } else{ status( "โš  Form not found" ); } }; // ================================================== // TIME // ================================================== function secondsNow(){ const d = new Date(); return ( d.getHours()*3600 + d.getMinutes()*60 + d.getSeconds() ); } function getTargets(){ return get( KEY.schedule, "10:00,14:00" ) .split(",") .map( t => { const p = t.trim() .split(":") .map(Number); return ( (p[0] || 0) * 3600 + (p[1] || 0) * 60 + (p[2] || 0) ); } ); } // ================================================== // WAR LOOP // ================================================== let warTimer = null; function startWar(){ status( "๐Ÿš€ Searching form..." ); warTimer = setInterval( () => { if( fillForm() ){ clearInterval( warTimer ); status( "๐ŸŸข Filling done" ); setTimeout( () => { clickRegister(); }, 300 ); } else{ console.log( "[BCA] refresh" ); location.reload(); } }, 500 ); } // ================================================== // SCHEDULER // ================================================== let scheduleTimer = null; function waitLaunch(){ scheduleTimer = setInterval( () => { const now = secondsNow(); const targets = getTargets(); console.log( "[TIME]", now, targets ); const hit = targets.some( t => now >= t && now <= t + 30 ); if(hit){ clearInterval( scheduleTimer ); startWar(); } }, 100 ); } // ================================================== // START STOP // ================================================== $("btn-start").onclick = () => { set( KEY.enabled, true ); status( "โณ Waiting launch time" ); waitLaunch(); }; $("btn-stop").onclick = () => { set( KEY.enabled, false ); if( scheduleTimer ) clearInterval( scheduleTimer ); if( warTimer ) clearInterval( warTimer ); status( "๐Ÿ”ด OFF" ); }; // ================================================== // AUTO RESUME // ================================================== if( get( KEY.enabled, false ) ){ status( "โณ Waiting launch time" ); waitLaunch(); } })();