BenSiso commited on
Commit
590751e
·
verified ·
1 Parent(s): 8f3bd66

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +27 -33
index.html CHANGED
@@ -50,6 +50,8 @@
50
  .hint{color:var(--sub);font-weight:600}.hint small{display:block;color:var(--mut);font-weight:400;font-size:12px;margin-top:3px}
51
  .cta{width:100%;height:52px;margin-top:14px;border:none;border-radius:13px;background:var(--green);color:#04130d;font-weight:800;font-size:16px;cursor:pointer;transition:.15s}
52
  .cta:hover{background:var(--green2)}
 
 
53
  .trust{display:flex;flex-wrap:wrap;gap:6px 14px;justify-content:center;margin-top:14px;color:var(--mut);font-size:12.5px}
54
  .open{display:inline-block;margin-top:16px;padding:10px 18px;border:1px solid var(--line);border-radius:11px;color:var(--ink);font-weight:600}
55
  .open:hover{border-color:rgba(18,185,129,.5)}
@@ -89,7 +91,6 @@
89
  <p class="lead">Upload a profile picture and see who's really behind it across public social media and the web — spot a catfish, verify a match, or find out who you're really talking to.</p>
90
 
91
  <div class="card">
92
- <form id="searchForm" action="https://unfake.pro" method="GET" target="_blank">
93
  <img id="preview" alt="Selected photo preview" />
94
  <label class="drop" id="drop">
95
  <span class="ic" aria-hidden="true">
@@ -98,8 +99,7 @@
98
  <span class="hint" id="hint">Click, drag, or paste a photo<small>JPG, PNG or WEBP</small></span>
99
  <input id="file" type="file" name="image" accept="image/*" hidden />
100
  </label>
101
- <button type="submit" class="cta">Search this face →</button>
102
- </form>
103
  <div class="trust"><span>🔒 Photo deleted within 24h</span><span>⚡ Results in ~45 seconds</span><span>🕶️ 100% anonymous</span></div>
104
  <a class="open" href="https://unfake.pro" target="_blank" rel="noopener">Or open the full search on UnFake →</a>
105
  </div>
@@ -156,49 +156,43 @@
156
  </footer>
157
 
158
  <script>
159
- var file=document.getElementById("file"),drop=document.getElementById("drop"),img=document.getElementById("preview"),hint=document.getElementById("hint");
160
- function show(f){if(!f)return;img.src=URL.createObjectURL(f);img.style.display="block";hint.innerHTML=(f.name||"photo").slice(0,28)+" — ready<small>Tap search to crop &amp; scan it on UnFake</small>";}
161
- file.addEventListener("change",function(){show(file.files&&file.files[0]);});
162
- ["dragenter","dragover"].forEach(function(e){drop.addEventListener(e,function(v){v.preventDefault();drop.classList.add("drag");});});
163
- ["dragleave","drop"].forEach(function(e){drop.addEventListener(e,function(v){v.preventDefault();drop.classList.remove("drag");});});
164
- drop.addEventListener("drop",function(v){var f=v.dataTransfer.files&&v.dataTransfer.files[0];if(f){file.files=v.dataTransfer.files;show(f);}});
165
- window.addEventListener("paste",function(e){var it=(e.clipboardData||{}).items||[];for(var i=0;i<it.length;i++){if(it[i].type.indexOf("image")===0){var f=it[i].getAsFile();file.files=null;show(f);var dt=new DataTransfer();dt.items.add(f);file.files=dt.files;}}});
166
  // Are we embedded in Hugging Face's sandboxed iframe? (it blocks same-tab nav)
167
- var inFrame = (function(){ try { return window.top !== window.self; } catch(e){ return true; } })();
168
- // Hand off the uploaded photo to UnFake's crop step via URL fragment
169
- var form=document.getElementById("searchForm");
170
  function compress(file, cb){
171
  var im=new Image();
172
  im.onload=function(){
173
- var max=1600, s=Math.min(1, max/Math.max(im.width,im.height));
174
  var w=Math.round(im.width*s), h=Math.round(im.height*s);
175
  var c=document.createElement("canvas"); c.width=w; c.height=h;
176
  c.getContext("2d").drawImage(im,0,0,w,h);
177
- cb(c.toDataURL("image/jpeg",0.85));
178
  };
179
  im.onerror=function(){ cb(null); };
180
  im.src=URL.createObjectURL(file);
181
  }
182
- function openUnfake(url){
183
- if (inFrame) { window.open(url, "_blank"); } // HF iframe: only new tab works
184
- else { window.location.href = url; } // direct subdomain: same tab
185
- }
186
- form.addEventListener("submit",function(e){
187
- e.preventDefault();
188
- var f=file.files&&file.files[0];
189
- if(!f){ openUnfake("https://unfake.pro"); return; }
190
- // Open a blank tab NOW, inside the tap gesture, so mobile pop-up blockers
191
- // allow it; navigate it to UnFake once compression finishes.
192
- var tab = inFrame ? window.open("about:blank", "_blank") : null;
193
  compress(f,function(d){
194
- var url = d ? "https://unfake.pro/#photo="+encodeURIComponent(d) : "https://unfake.pro";
195
- if (inFrame) {
196
- if (tab && !tab.closed) { try { tab.location.href = url; return; } catch(err){} }
197
- window.open(url, "_blank");
198
- } else {
199
- window.location.href = url;
200
- }
201
  });
 
 
 
 
 
 
 
 
 
202
  });
203
  document.getElementById("yr").textContent=new Date().getFullYear();
204
  </script>
 
50
  .hint{color:var(--sub);font-weight:600}.hint small{display:block;color:var(--mut);font-weight:400;font-size:12px;margin-top:3px}
51
  .cta{width:100%;height:52px;margin-top:14px;border:none;border-radius:13px;background:var(--green);color:#04130d;font-weight:800;font-size:16px;cursor:pointer;transition:.15s}
52
  .cta:hover{background:var(--green2)}
53
+ a.cta{display:flex;align-items:center;justify-content:center;text-decoration:none}
54
+ .cta.busy{opacity:.6;pointer-events:none}
55
  .trust{display:flex;flex-wrap:wrap;gap:6px 14px;justify-content:center;margin-top:14px;color:var(--mut);font-size:12.5px}
56
  .open{display:inline-block;margin-top:16px;padding:10px 18px;border:1px solid var(--line);border-radius:11px;color:var(--ink);font-weight:600}
57
  .open:hover{border-color:rgba(18,185,129,.5)}
 
91
  <p class="lead">Upload a profile picture and see who's really behind it across public social media and the web — spot a catfish, verify a match, or find out who you're really talking to.</p>
92
 
93
  <div class="card">
 
94
  <img id="preview" alt="Selected photo preview" />
95
  <label class="drop" id="drop">
96
  <span class="ic" aria-hidden="true">
 
99
  <span class="hint" id="hint">Click, drag, or paste a photo<small>JPG, PNG or WEBP</small></span>
100
  <input id="file" type="file" name="image" accept="image/*" hidden />
101
  </label>
102
+ <a id="searchBtn" class="cta" href="https://unfake.pro" target="_blank" rel="noopener">Search this face →</a>
 
103
  <div class="trust"><span>🔒 Photo deleted within 24h</span><span>⚡ Results in ~45 seconds</span><span>🕶️ 100% anonymous</span></div>
104
  <a class="open" href="https://unfake.pro" target="_blank" rel="noopener">Or open the full search on UnFake →</a>
105
  </div>
 
156
  </footer>
157
 
158
  <script>
159
+ var file=document.getElementById("file"),drop=document.getElementById("drop"),img=document.getElementById("preview"),hint=document.getElementById("hint"),btn=document.getElementById("searchBtn");
 
 
 
 
 
 
160
  // Are we embedded in Hugging Face's sandboxed iframe? (it blocks same-tab nav)
161
+ var inFrame=(function(){ try { return window.top!==window.self; } catch(e){ return true; } })();
162
+ function show(f){if(!f)return;img.src=URL.createObjectURL(f);img.style.display="block";hint.innerHTML=(f.name||"photo").slice(0,28)+" ready<small>Tap search to crop &amp; scan it on UnFake</small>";}
 
163
  function compress(file, cb){
164
  var im=new Image();
165
  im.onload=function(){
166
+ var max=1280, s=Math.min(1, max/Math.max(im.width,im.height));
167
  var w=Math.round(im.width*s), h=Math.round(im.height*s);
168
  var c=document.createElement("canvas"); c.width=w; c.height=h;
169
  c.getContext("2d").drawImage(im,0,0,w,h);
170
+ cb(c.toDataURL("image/jpeg",0.82));
171
  };
172
  im.onerror=function(){ cb(null); };
173
  im.src=URL.createObjectURL(file);
174
  }
175
+ // Compress as soon as a photo is picked and preset the button href, so the
176
+ // tap is a plain native link (no window.open -> no mobile pop-up blocker).
177
+ function handleFile(f){
178
+ if(!f) return;
179
+ show(f);
180
+ btn.classList.add("busy");
181
+ btn.textContent="Preparing photo…";
 
 
 
 
182
  compress(f,function(d){
183
+ btn.href = d ? "https://unfake.pro/#photo="+encodeURIComponent(d) : "https://unfake.pro";
184
+ btn.classList.remove("busy");
185
+ btn.textContent="Search this face →";
 
 
 
 
186
  });
187
+ }
188
+ file.addEventListener("change",function(){ handleFile(file.files&&file.files[0]); });
189
+ ["dragenter","dragover"].forEach(function(e){drop.addEventListener(e,function(v){v.preventDefault();drop.classList.add("drag");});});
190
+ ["dragleave","drop"].forEach(function(e){drop.addEventListener(e,function(v){v.preventDefault();drop.classList.remove("drag");});});
191
+ drop.addEventListener("drop",function(v){var f=v.dataTransfer.files&&v.dataTransfer.files[0];if(f){file.files=v.dataTransfer.files;handleFile(f);}});
192
+ window.addEventListener("paste",function(e){var it=(e.clipboardData||{}).items||[];for(var i=0;i<it.length;i++){if(it[i].type.indexOf("image")===0){var f=it[i].getAsFile();file.files=null;handleFile(f);var dt=new DataTransfer();dt.items.add(f);file.files=dt.files;}}});
193
+ // Direct-subdomain visit: same tab. Inside HF's iframe: native target="_blank".
194
+ btn.addEventListener("click",function(e){
195
+ if(!inFrame){ e.preventDefault(); window.location.href = btn.href; }
196
  });
197
  document.getElementById("yr").textContent=new Date().getFullYear();
198
  </script>