dehezhang2 commited on
Commit
649dbdb
·
verified ·
1 Parent(s): f781a57

deploy rater (Docker/FastAPI): registration + completeness gate + /api/submit → dataset

Browse files
Files changed (2) hide show
  1. static/index.html +24 -1
  2. static/mobile.html +23 -1
static/index.html CHANGED
@@ -361,6 +361,29 @@
361
  </div>
362
 
363
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  /* =========================================================================
365
  * Rubric — 4 dimensions × 13 sub-questions
366
  * ========================================================================= */
@@ -1590,7 +1613,7 @@ function renderFooter() {
1590
  return el("footer", { class: "bottom" },
1591
  el("div", { class: "summary", id: "footerSummary" }),
1592
  el("a", {
1593
- href: "./mobile.html",
1594
  style: "font-size:11px;color:var(--muted);text-decoration:none;"
1595
  + "padding:4px 10px;border:1px solid var(--border);border-radius:12px;"
1596
  + "background:var(--panel-3);margin-right:8px",
 
361
  </div>
362
 
363
  <script>
364
+ /* =========================================================================
365
+ * Auto-redirect to mobile.html on phone-sized / touch-first devices.
366
+ * Run before anything else so the wrong page never renders.
367
+ * Override with `?force=desktop` (sticky for the rest of the tab session).
368
+ * ========================================================================= */
369
+ (function autoRedirectIfMobile() {
370
+ try {
371
+ const url = new URL(location.href);
372
+ if (url.searchParams.has("force")) {
373
+ sessionStorage.setItem("user_study_view_force", url.searchParams.get("force"));
374
+ }
375
+ const forced = sessionStorage.getItem("user_study_view_force");
376
+ if (forced === "desktop") return;
377
+ const ua = navigator.userAgent || "";
378
+ const isMobileUA = /Mobi|Android|iPhone|iPod|BlackBerry|Windows Phone/i.test(ua);
379
+ const isSmall = window.innerWidth < 720;
380
+ const isCoarse = window.matchMedia && window.matchMedia("(pointer: coarse)").matches;
381
+ if (forced === "mobile" || isMobileUA || (isSmall && isCoarse)) {
382
+ location.replace("./mobile.html");
383
+ }
384
+ } catch (e) { /* ignore — fall through to desktop */ }
385
+ })();
386
+
387
  /* =========================================================================
388
  * Rubric — 4 dimensions × 13 sub-questions
389
  * ========================================================================= */
 
1613
  return el("footer", { class: "bottom" },
1614
  el("div", { class: "summary", id: "footerSummary" }),
1615
  el("a", {
1616
+ href: "./mobile.html?force=mobile",
1617
  style: "font-size:11px;color:var(--muted);text-decoration:none;"
1618
  + "padding:4px 10px;border:1px solid var(--border);border-radius:12px;"
1619
  + "background:var(--panel-3);margin-right:8px",
static/mobile.html CHANGED
@@ -318,7 +318,7 @@
318
  </header>
319
  <div class="list" id="drawerList"></div>
320
  <div style="padding:10px 14px;border-top:1px solid var(--border);display:flex;gap:8px;align-items:center">
321
- <a href="./" class="desktop-link" style="flex:1;text-align:center">🖥 Desktop view</a>
322
  </div>
323
  </aside>
324
 
@@ -358,6 +358,28 @@
358
  </div>
359
 
360
  <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
361
  /* =========================================================================
362
  * Same rubric + i18n + admin list + API contract as desktop index.html.
363
  * Kept in sync manually for now (small enough). localStorage key is shared
 
318
  </header>
319
  <div class="list" id="drawerList"></div>
320
  <div style="padding:10px 14px;border-top:1px solid var(--border);display:flex;gap:8px;align-items:center">
321
+ <a href="./?force=desktop" class="desktop-link" style="flex:1;text-align:center">🖥 Desktop view</a>
322
  </div>
323
  </aside>
324
 
 
358
  </div>
359
 
360
  <script>
361
+ /* =========================================================================
362
+ * Auto-redirect to the desktop page on large / pointer-fine devices.
363
+ * `?force=mobile` overrides (sticky in sessionStorage for the tab).
364
+ * ========================================================================= */
365
+ (function autoRedirectIfDesktop() {
366
+ try {
367
+ const url = new URL(location.href);
368
+ if (url.searchParams.has("force")) {
369
+ sessionStorage.setItem("user_study_view_force", url.searchParams.get("force"));
370
+ }
371
+ const forced = sessionStorage.getItem("user_study_view_force");
372
+ if (forced === "mobile") return;
373
+ const ua = navigator.userAgent || "";
374
+ const isMobileUA = /Mobi|Android|iPhone|iPod|BlackBerry|Windows Phone/i.test(ua);
375
+ const isFine = window.matchMedia && window.matchMedia("(pointer: fine)").matches;
376
+ const isWide = window.innerWidth >= 900;
377
+ if (forced === "desktop" || (!isMobileUA && isFine && isWide)) {
378
+ location.replace("./");
379
+ }
380
+ } catch (e) { /* ignore — fall through to mobile */ }
381
+ })();
382
+
383
  /* =========================================================================
384
  * Same rubric + i18n + admin list + API contract as desktop index.html.
385
  * Kept in sync manually for now (small enough). localStorage key is shared