Website: Android screenshots first for a visitor on Android
Seven phone screens one by one (home with a put-aside game, a database's games, the Opera game, Stockfish, the play sheet, «Who to play», a game against Rodent IV) open the gallery and the lightbox on Android, under «On the phone», before «On the computer»; the hero shows the four phone screens. Other visitors see the page as before. Nine languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
20d9d018bb
commit
12e4c7d5e9
59 changed files with 645 additions and 82 deletions
|
|
@ -262,6 +262,32 @@
|
|||
a.addEventListener("click", function () { remember(a.dataset.lang); });
|
||||
});
|
||||
|
||||
// --- Android: the phone's screenshots first ---------------------------------------
|
||||
// The phone screens open the gallery and the lightbox; the desktop ones follow, and
|
||||
// the hero shows the four phone screens instead of the desktop window.
|
||||
var phone = CP.phoneShots || [];
|
||||
if (sys.os === "android" && phone.length) {
|
||||
var desktop = CP.shots || [];
|
||||
document.querySelectorAll("[data-shot]").forEach(function (a) {
|
||||
a.dataset.shot = String(parseInt(a.dataset.shot, 10) + phone.length);
|
||||
});
|
||||
document.querySelectorAll("[data-phone]").forEach(function (a) { a.dataset.shot = a.dataset.phone; });
|
||||
CP.shots = phone.concat(desktop);
|
||||
$("phone-shots").hidden = false;
|
||||
var both = -1;
|
||||
desktop.forEach(function (s, i) { if (/06-android/.test(s.full)) both = i; });
|
||||
var hero = document.querySelector(".hero-shot");
|
||||
if (hero && both >= 0) {
|
||||
var s = desktop[both], stem = s.full.replace(/\.png$/, "");
|
||||
hero.querySelector("a").href = s.full;
|
||||
hero.querySelector("a").dataset.shot = String(phone.length + both + 1);
|
||||
hero.querySelector("source").srcset = stem + "-1280.webp 1280w, " + stem + "-1920.webp 1920w";
|
||||
hero.querySelector("img").src = s.fallback;
|
||||
hero.querySelector("img").alt = s.alt;
|
||||
hero.querySelector("figcaption").textContent = s.caption;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Lightbox --------------------------------------------------------------------
|
||||
var lb = $("lightbox"), img = $("lb-img"), cap = $("lb-cap"), count = $("lb-count"), full = $("lb-full");
|
||||
var shots = CP.shots || [], cur = 0, opener = null, viaHistory = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue