Last active
September 29, 2026 16:06
-
-
Save rvanbaalen/da6c3afecea9eefb77a7db946b241ec2 to your computer and use it in GitHub Desktop.
2026-PoC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(async()=>{const base=location.pathname.match(/^\/[\d.]+/)?.[0];if(!base)return alert('Open eerst een pagina binnen een bedrijf.');const firstName=prompt('Welke voornaam moeten alle werknemers krijgen?');if(!firstName?.trim())return;const scope=(prompt('Alleen de eerste vijf werknemers of alle werknemers? Antwoord met FIVE of ALL.')||'').trim().toUpperCase();if(!['ALL','FIVE'].includes(scope))return alert('Afgebroken: antwoord met FIVE of ALL.');const STATUSES=['active'];const ids=new Map();for(const status of STATUSES){for(let start=0,total=Infinity;start<total;start+=100){const body=new URLSearchParams({sEcho:1,iColumns:8,iDisplayStart:start,iDisplayLength:100,mDataProp_2:'LastName',iSortCol_0:2,sSortDir_0:'asc',iSortingCols:1,sSearch:'',ids:'',allChecked:0,status});const res=await fetch(`${base}/employees/list/view/json`,{method:'POST',body,headers:{'x-requested-with':'XMLHttpRequest'}});const json=await res.json();total=json.iTotalDisplayRecords;for(const row of json.aaData){const id=row.LastName.match(/details\/(\d+)/)?.[1];const name=row.LastName.replace(/<[^>]+>/g,'');if(id)ids.set(id,name);}if(!json.aaData.length)break;if(scope==='FIVE'&&ids.size>=5)break;}}if(scope==='FIVE')[...ids.keys()].slice(5).forEach(k=>ids.delete(k));if(!confirm(`${ids.size} werknemers krijgen de voornaam "${firstName}". Doorgaan?`))return;const failed=[];let i=0;for(const[id,name]of ids){i++;try{const url=`${base}/employees/personal/edit/${id}`;const html=await(await fetch(url)).text();const doc=new DOMParser().parseFromString(html,'text/html');const form=doc.querySelector('input[name="vf__dispatch"][value="employeeSectionForm"]')?.form;if(!form)throw new Error('formulier niet gevonden');const data=new FormData(form);data.set('first-name',firstName);const r=await fetch(url,{method:'POST',body:data});if(!r.url.includes(`/employees/details/${id}`))throw new Error('niet opgeslagen (validatie of lopende betaling)');console.log(`✅ ${i}/${ids.size} ${name}`);}catch(e){failed.push({id,name,error:e.message});console.warn(`❌ ${i}/${ids.size} ${name}: ${e.message}`);}}console.table(failed);alert(`Klaar. ${ids.size-failed.length} bijgewerkt, ${failed.length} mislukt (zie console).`);})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment