PageSourceSearch

https://instach.art/instachart.min.js

js instach.art collected 2026-10-04 13:33:35 UTC 6,905 bytes, 11 lines download raw bytes

1const HOST="https://"+window.location.host;function toggleLoading(loading){document.getElementsByClassName("mode-nonloading")[0]?.classList?.toggle("d-none",loading);document.getElementsByClassName("mode-loading")[0]?.classList?.toggle("d-none",!loading)}function example(image){toggleLoading(true);setTimeout(()=>{if(image==="sketch.jpg"){window.location.href="/dashboard/b7a4d5b2-566d-4778-9124-956e818c63cc"}else{window.location.href="/dashboard/6ad57114-66ec-4e58-88fe-3d1648c24d5e"}},2500)}function connect(){window.location.href="https://oauth2.luzmo.com/?client_id=ci_luzmo_instachart&state=abcd&redirect_uri="+encodeURIComponent(window.location.href)}function edit(){window.location.href="https://app.luzmo.com/dashboard/"+document.getElementById("luzmoDashboard").getAttribute("dashboardId")}async function exchange(code){window.history.replaceState({},document.title,"/");fetch(HOST+"/api/v1/connect",{method:"POST",body:JSON.stringify({code:code}),headers:{"Content-Type":"application/json"},json:true}).then(response=>{return response.json()}).then(json=>{if(json.access_token){localStorage.setItem("name",json.name);localStorage.setItem("access_token",json.access_token);showAuthed()}}).catch(error=>{console.log("Error exchanging code:",error)})}function isAuthed(){return localStorage.getItem("access_token")&&localStorage.getItem("name")}function showAuthed(){if(isAuthed()){document.getElementById("login-unauthed").classList.add("d-none");document.getElementById("user-name").innerText=localStorage.getItem("name");document.getElementById("login-authed").classList.remove("d-none");document.getElementById("upload-public").classList.add("d-none");document.getElementById("upload-private").classList.remove("d-none")}}function getAuthHeader(){if(isAuthed()){return"Bearer "+localStorage.getItem("access_token")}else{return undefined}}function populateRecentlyGenerated(){fetch(HOST+"/api/v1/dashboards",{method:"GET",headers:{"Content-Type":"application/json"},json:true}).then(response=>{return response.json()}).then(dashboards=>{document.getElementById("ugc").innerHTML=dashboards.map((dashboard,i)=>{let featured="";if(dashboard.featured_at!==null){featured='<div class="card-header">featured</div>'}return`
2            <div class="mb-3 col col-12 col-md-4 col-sm-6 col-md-4 col-lg-3"">
3              <div class="card">
4                ${featured}
5                <img class="card-img-top img-fluid" src="/thumbnail/${dashboard.id}.png" alt="${dashboard.title}">
6                <div class="card-body">
7                <h6 class="card-title">${dashboard.title}</h6>
8                <a href="/dashboard/${dashboard.id}" onclick="dashboard(${dashboard.id})" class="btn btn-primary stretched-link">View</a>
9                </div>
10              </div>
11            </div>`}).join("")}).catch(error=>{console.log("Error retrieving dashboards:",error)})}function generateDashboard(){toggleLoading(true);const canvas=document.createElement("canvas");canvas.width=video.videoWidth;canvas.height=video.videoHeight;const context=canvas.getContext("2d");context.drawImage(video,0,0,canvas.width,canvas.height);canvas.toBlob(blob=>{fetchGenerate(blob)})}function generateDashboardByUpload(){toggleLoading(true);fetchGenerate(document.getElementById("fileInput").files[0])}function generateDashboardByPrompt(){toggleLoading(true);fetchPrompt(document.getElementById("promptInput").value)}function fetchGenerate(body){document.getElementById("alert").classList.add("d-none");fetch(HOST+"/api/v1/upload",{method:"POST",body:body,headers:{"Content-Type":"application/octet-stream",Authorization:getAuthHeader()},json:true}).then(response=>{if(!response.ok){throw new Error("Error "+response.status)}return response.json()}).then(body=>{window.location.href="/dashboard/"+body.id}).catch(error=>{toggleLoading(false);document.getElementById("alertMessage").innerText="Oops, we could not generate a dashboard for you. Please try again later.";document.getElementById("alert").classList.remove("d-none")})}function fetchPrompt(prompt){document.getElementById("alert").classList.add("d-none");fetch(HOST+"/api/v1/prompt",{method:"POST",body:JSON.stringify({prompt:prompt}),headers:{"Content-Type":"application/json",Authorization:getAuthHeader()},json:true}).then(response=>{if(!response.ok){throw new Error("Error "+response.status)}return response.json()}).then(body=>{console.log(body);window.location.href="/dashboard/"+body.id}).catch(error=>{toggleLoading(false);document.getElementById("alertMessage").innerText="Oops, we could not generate a dashboard for you. Please try again later.";document.getElementById("alert").classList.remove("d-none")})}function copyShareLink(){navigator.clipboard.writeText(window.location);const toastBootstrap=bootstrap.Toast.getOrCreateInstance(document.getElementById("liveToast"));toastBootstrap.show()}const video=document.getElementById("video");if(video){if(navigator.mediaDevices.getUserMedia){navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}}).then(stream=>{video.srcObject=stream}).catch(error=>{document.getElementById("alertMessage").innerText="Error accessing webcam: "+error;document.getElementById("alert").classList.remove("d-none")})}else{document.getElementById("alertMessage").innerText="This browser does not support retrieving video from a webcam. You can use upload instead!";document.getElementById("alert").classList.remove("d-none")}}const pathArray=window.location.pathname.split("/");if(window.location.pathname==="/"||window.location.pathname==="/upload"||window.location.pathname==="/prompt"||window.location.pathname==="/examples"){window.onkeydown=event=>{if(event.key==="Enter"&&window.location.pathname==="/upload"){generateDashboard()}else if(event.key==="Enter"&&window.location.pathname==="/prompt"){generateDashboardByPrompt()}};populateRecentlyGenerated()}else if(pathArray[1]==="upload"){document.getElementById("fileInput").addEventListener("dragover",()=>{document.getElementById("fileInput").classList.add("draghover")});document.getElementById("fileInput").addEventListener("dragleave",()=>{document.getElementById("fileInput").classList.remove("draghover")});document.getElementById("fileInput").addEventListener("drop",()=>{document.getElementById("fileInput").classList.remove("draghover")});populateRecentlyGenerated()}else if(pathArray[1]==="dashboard"){document.getElementById("luzmoDashboard").setAttribute("dashboardId",pathArray[2]);if(localStorage.getItem("access_token")){const accessToken=atob(localStorage.getItem("access_token")).split(":");document.getElementById("luzmoDashboard").setAttribute("authKey",accessToken[0]);document.getElementById("luzmoDashboard").setAttribute("authToken",accessToken[1])}}showAuthed();const url=new URLSearchParams(window.location.search);if(url.get("code")){exchange(url.get("code"))}
11document.getElementsByClassName("nav-version")[0].innerText="v202406";

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.