BenSiso commited on
Commit
26a18fe
·
verified ·
1 Parent(s): 590751e

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +12 -3
index.html CHANGED
@@ -172,17 +172,26 @@ a.cta{display:flex;align-items:center;justify-content:center;text-decoration:non
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]); });
 
172
  im.onerror=function(){ cb(null); };
173
  im.src=URL.createObjectURL(file);
174
  }
175
+ // Navigate to UnFake. On the direct subdomain (not in HF's iframe) this is a
176
+ // same-tab redirect and works automatically; inside the iframe it opens a new
177
+ // tab (which mobile browsers may only allow right after a user tap).
178
+ function navigate(url){
179
+ if (!inFrame) { window.location.href = url; }
180
+ else { window.open(url, "_blank"); }
181
+ }
182
+ // Compress as soon as a photo is picked, then auto-move to UnFake. The button
183
+ // href is also preset so the button still works as a manual fallback.
184
  function handleFile(f){
185
  if(!f) return;
186
  show(f);
187
  btn.classList.add("busy");
188
  btn.textContent="Preparing photo…";
189
  compress(f,function(d){
190
+ var url = d ? "https://unfake.pro/#photo="+encodeURIComponent(d) : "https://unfake.pro";
191
+ btn.href = url;
192
  btn.classList.remove("busy");
193
  btn.textContent="Search this face →";
194
+ navigate(url);
195
  });
196
  }
197
  file.addEventListener("change",function(){ handleFile(file.files&&file.files[0]); });