QuickQR

Real QR Generator • Developer- Aayush Turkar

QuickQR Preview
History
`); w.document.close(); } function saveHistory(data){ let history= JSON.parse(localStorage.getItem("quickqr_history")||"[]"); history.unshift({ type:currentType, data:data, time:Date.now() }); history=history.slice(0,10); localStorage.setItem( "quickqr_history", JSON.stringify(history) ); } function showHistory(){ let history= JSON.parse(localStorage.getItem("quickqr_history")||"[]"); let box=document.getElementById("historyList"); if(!history.length){ box.innerHTML= "

No QR history yet.

"; return; } box.innerHTML=history.map((x,i)=>`
${escapeHTML(x.data)}
`).join(""); } function useHistory(i){ let history= JSON.parse(localStorage.getItem("quickqr_history")||"[]"); let item=history[i]; if(!item)return; qrData=item.data; let size=document.getElementById("size").value; let margin=document.getElementById("margin").value; let fg=document.getElementById("fg").value.substring(1); let bg=document.getElementById("bg").value.substring(1); qrURL= "https://quickchart.io/qr"+ "?size="+size+ "&margin="+margin+ "&dark="+fg+ "&light="+bg+ "&text="+encodeURIComponent(qrData); qr.style.display="block"; qr.src=qrURL+"&cache="+Date.now(); statusBox.textContent="QR loaded from history."; } function clearHistory(){ localStorage.removeItem("quickqr_history"); showHistory(); } function resetQR(){ qr.style.display="none"; qr.removeAttribute("src"); qrData=""; qrURL=""; statusBox.textContent=""; typeQR( "url", document.querySelector(".tabs button") ); } function escapeHTML(x){ return String(x) .replace(/&/g,"&") .replace(//g,">") .replace(/"/g,""") .replace(/'/g,"'"); } typeQR( "url", document.querySelector(".tabs button") ); showHistory();