Hanaz Writers

Free AI Story Refiner

Romance Drama Comedy Historical
(function(){ // =================================== // PREVENT MULTIPLE FREE USES // =================================== const STORAGE_KEY = "hanaz_refiner_used"; function getFingerprint(){ return btoa( navigator.userAgent + screen.width + screen.height + navigator.language + Intl.DateTimeFormat() .resolvedOptions() .timeZone ); } const browserFingerprint = getFingerprint(); let usedOnce = localStorage.getItem(STORAGE_KEY) === "used"; const API = "https://ai.hanazwriters.org/free/story-refiner"; document .getElementById("refineBtn") .addEventListener("click", refineStory); // =================================== // SHOW PREMIUM BOX IF ALREADY USED // =================================== if(usedOnce){ document .getElementById("refineBtn") .disabled = true; document .getElementById("resultBox") .innerHTML = `

Unlock Premium Version

Free version allows one refinement only.

`; } function list(arr){ if(!arr || !arr.length) return ""; return `
    ${arr.map(x => `
  • ${x}
  • `).join("")}
`; } async function refineStory(){ const box = document.getElementById("resultBox"); if(usedOnce){ box.innerHTML = `

Unlock Premium Version

Free version allows one refinement only.

`; return; } const title = document.getElementById("titleInput").value; const genre = document.getElementById("genreInput").value; const script = document.getElementById("scriptInput").value; box.innerHTML = "Refining..."; try{ const res = await fetch(API,{ method:"POST", headers:{ "Content-Type":"application/json" }, body:JSON.stringify({ title, genre, script, fingerprint:browserFingerprint }) }); const data = await res.json(); // =================================== // FREE LIMIT REACHED // =================================== if(res.status === 403){ box.innerHTML = `

Unlock Premium Version

Free version allows one refinement only.

`; localStorage.setItem( STORAGE_KEY, "used" ); document .getElementById("refineBtn") .disabled = true; return; } const a = data.analysis; box.innerHTML = `

Refined Script

${a.refinedScript}

Suggestion

${list(a.engagementSuggestions)} `; usedOnce = true; localStorage.setItem( STORAGE_KEY, "used" ); }catch(err){ box.innerHTML = `

${err.message}

`; } } })();