feat(store): add store and marketplace item views and image sources
Add catalogue filters, item detail views, and purchase and resale actions. Resolve images from the player's asset pack, public image URLs, or local game data. Add a utility for creating the optional local asset pack. Type checking and JavaScript syntax checks passed. Embedded browser appearance and in-game behavior still need acceptance.
This commit is contained in:
1 parent
a73635407d
commit
98812fa9c2
39 files changed
+1309
-400
No files matched your search
@@ -1,30 +1,37 @@
|
||||
// Local store page, shown in the game's built-in browser.
|
||||
// Local store page (implementation notes; layout after the official Gaijin.Net store,
|
||||
// implementation notes), shown in the game's built-in browser.
|
||||
// The game opens /store?item=<bundle GUID> for a gift vehicle's own pack (item_info.php `url`,
|
||||
// implementation notes); the page then shows that pack's detail view.
|
||||
'use strict';
|
||||
|
||||
const T = {
|
||||
zh: {
|
||||
title: 'WTOffline 本地商店', hint: '买完关闭本窗口,机库会自动刷新', toMarket: '前往交易所',
|
||||
eagles: '金鹰', lions: '银狮', premium: '高级账户', premiumOff: '未开通', premiumLeft: '剩余 {days} 天',
|
||||
tabPacks: '礼包载具', tabPremium: '高级账户', tabEagles: '金鹰', tabRedeem: '兑换码',
|
||||
search: '搜索礼包或载具名称', allCountries: '全部国家', allRanks: '全部等级', rank: '{rank} 级',
|
||||
includesUnit: '包含载具:{name}', containsEagles: '附赠 {n} 金鹰', containsSilver: '附赠 {n} 银狮', containsPremium: '附赠 {days} 天高级账户', premiumDays: '{days} 天高级账户',
|
||||
buy: '购买', freeBuy: '老福爷付过了', owned: '已拥有', pickAccount: '请先选择账号', redeem: '兑换', codePlaceholder: '输入兑换码', empty: '没有符合条件的商品',
|
||||
store: '商店', toMarket: '交易所', eagles: '金鹰', lions: '银狮', premium: '高级账户', premiumOff: '未开通', premiumLeft: '剩余 {days} 天',
|
||||
tabPacks: '高级载具', tabEagles: '金鹰', tabPremium: '高级帐户', tabRedeem: '优惠码',
|
||||
search: '搜索礼包或载具', allCountries: '所有国家', allRanks: '所有等级', rank: '{rank} 级', sortBest: '最畅销', sortPriceAsc: '价格从低到高', sortPriceDesc: '价格从高到低',
|
||||
vehicle: '{name}', containsEagles: '{n} 金鹰', containsSilver: '{n} 银狮', containsPremium: '{days} 天高级账户',
|
||||
buy: '购买', freeBuy: '老福爷付过了', owned: '已拥有', pickAccount: '请先在右上角选择账号', redeem: '兑换', codePlaceholder: '输入兑换码',
|
||||
empty: '没有符合条件的商品', includes: '本特惠包包含', back: '‹ 返回目录', bonusTitle: 'Premium bonuses', bonusText: '高级载具获得的银狮与研发点有加成,并可直接使用。',
|
||||
footer: 'WTOffline 本地商店 · 买完关闭本窗口,机库会自动刷新', badgeOwned: '已拥有', badgeHot: '人气商品',
|
||||
},
|
||||
en: {
|
||||
title: 'WTOffline Store', hint: 'Close this window after buying to refresh the hangar', toMarket: 'Go to Marketplace',
|
||||
eagles: 'Golden Eagles', lions: 'Silver Lions', premium: 'Premium', premiumOff: 'inactive', premiumLeft: '{days} days left',
|
||||
tabPacks: 'Vehicle packs', tabPremium: 'Premium Account', tabEagles: 'Golden Eagles', tabRedeem: 'Redeem code',
|
||||
search: 'Search packs or vehicles', allCountries: 'All nations', allRanks: 'All ranks', rank: 'Rank {rank}',
|
||||
includesUnit: 'Vehicle: {name}', containsEagles: '+{n} Golden Eagles', containsSilver: '+{n} Silver Lions', containsPremium: '+{days} days of Premium Account', premiumDays: '{days} days of Premium Account',
|
||||
buy: 'Buy', freeBuy: '老福爷付过了', owned: 'Owned', pickAccount: 'Pick an account first', redeem: 'Redeem', codePlaceholder: 'Enter a code', empty: 'Nothing matches the filters',
|
||||
store: 'Store', toMarket: 'Market', eagles: 'Golden Eagles', lions: 'Silver Lions', premium: 'Premium', premiumOff: 'inactive', premiumLeft: '{days} days left',
|
||||
tabPacks: 'Premium vehicles', tabEagles: 'Golden Eagles', tabPremium: 'Premium account', tabRedeem: 'Promo code',
|
||||
search: 'Search packs or vehicles', allCountries: 'All nations', allRanks: 'All ranks', rank: 'Rank {rank}', sortBest: 'Best-selling', sortPriceAsc: 'Price: low to high', sortPriceDesc: 'Price: high to low',
|
||||
vehicle: '{name}', containsEagles: '{n} Golden Eagles', containsSilver: '{n} Silver Lions', containsPremium: '{days} days of Premium Account',
|
||||
buy: 'Buy', freeBuy: '老福爷付过了', owned: 'Owned', pickAccount: 'Pick an account at the top right', redeem: 'Redeem', codePlaceholder: 'Enter a code',
|
||||
empty: 'Nothing matches the filters', includes: 'This pack includes', back: '‹ Back to catalog', bonusTitle: 'Premium bonuses', bonusText: 'Premium vehicles earn more Silver Lions and research points and are ready to use.',
|
||||
footer: 'WTOffline local store · close this window after buying to refresh the hangar', badgeOwned: 'Owned', badgeHot: 'Best seller',
|
||||
},
|
||||
};
|
||||
const ROMAN = ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
|
||||
const t = (key, params) => WtoUi.tr(T, key, params);
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const wantedGuid = (WtoUi.query.get('item') || '').toUpperCase();
|
||||
|
||||
let state = { accounts: [], activeUserId: '', balance: { gjnCents: 0, goldenEagles: 0, silverLions: 0 }, premiumDays: 0, products: [], redeemHelp: [] };
|
||||
let currentTab = 'vehicle-pack';
|
||||
let detailId = '';
|
||||
|
||||
function applyStaticTexts() {
|
||||
for (const el of document.querySelectorAll('[data-t]')) el.textContent = t(el.dataset.t);
|
||||
@@ -35,21 +42,18 @@ function applyStaticTexts() {
|
||||
|
||||
async function loadState(userId) {
|
||||
state = await WtoUi.getJson('/store/api/state' + (userId ? '?userId=' + encodeURIComponent(userId) : ''));
|
||||
if (userId && !state.activeUserId) {
|
||||
WtoUi.clearSavedAccount();
|
||||
return loadState('');
|
||||
}
|
||||
renderHeader();
|
||||
renderFilters();
|
||||
renderContent();
|
||||
}
|
||||
|
||||
function renderHeader() {
|
||||
if (userId && !state.activeUserId) { WtoUi.clearSavedAccount(); return loadState(''); }
|
||||
WtoUi.fillAccountSelect($('accountSelect'), state.accounts, state.activeUserId);
|
||||
$('gjnVal').textContent = WtoUi.gjn(state.balance.gjnCents);
|
||||
$('goldVal').textContent = WtoUi.num(state.balance.goldenEagles);
|
||||
$('silverVal').textContent = WtoUi.num(state.balance.silverLions);
|
||||
$('premVal').textContent = state.premiumDays > 0 ? t('premiumLeft', { days: state.premiumDays }) : t('premiumOff');
|
||||
if (wantedGuid && !detailId) {
|
||||
const wanted = state.products.find((p) => (p.guid || '').toUpperCase() === wantedGuid);
|
||||
if (wanted) { detailId = wanted.id; currentTab = wanted.kind; }
|
||||
}
|
||||
renderFilters();
|
||||
render();
|
||||
}
|
||||
|
||||
function fillSelect(select, firstText, values, textOf) {
|
||||
@@ -62,97 +66,116 @@ function fillSelect(select, firstText, values, textOf) {
|
||||
function renderFilters() {
|
||||
const packs = state.products.filter((p) => p.kind === 'vehicle-pack');
|
||||
fillSelect($('countryFilter'), t('allCountries'), [...new Set(packs.map((p) => p.country).filter(Boolean))], WtoUi.label);
|
||||
const allRanks = packs.flatMap((p) => p.ranks || (p.rank ? [p.rank] : []));
|
||||
fillSelect($('rankFilter'), t('allRanks'), [...new Set(allRanks)].sort((a, b) => a - b), (r) => t('rank', { rank: ROMAN[r] || r }));
|
||||
fillSelect($('rankFilter'), t('allRanks'), [...new Set(packs.flatMap((p) => p.ranks || []))].sort((a, b) => a - b), (r) => t('rank', { rank: ROMAN[r] || r }));
|
||||
}
|
||||
|
||||
function matchesFilters(product) {
|
||||
function matches(product) {
|
||||
if (product.kind !== currentTab) return false;
|
||||
if (currentTab !== 'vehicle-pack') return true;
|
||||
const country = $('countryFilter').value;
|
||||
const rank = $('rankFilter').value;
|
||||
const query = $('searchInput').value.trim().toLowerCase();
|
||||
if (country && product.country !== country) return false;
|
||||
if (rank && !(product.ranks || [product.rank]).map(String).includes(rank)) return false;
|
||||
if ($('countryFilter').value && product.country !== $('countryFilter').value) return false;
|
||||
if ($('rankFilter').value && !(product.ranks || []).map(String).includes($('rankFilter').value)) return false;
|
||||
if (!query) return true;
|
||||
const searchTerms = [product.title.zh, product.title.en, product.unitName];
|
||||
for (const v of product.vehicles || []) searchTerms.push(v.unitName, v.title && v.title.zh, v.title && v.title.en);
|
||||
return searchTerms.some((s) => (s || '').toLowerCase().includes(query));
|
||||
const terms = [product.title.zh, product.title.en];
|
||||
for (const v of product.vehicles || []) terms.push(v.unitName, v.title && v.title.zh, v.title && v.title.en);
|
||||
return terms.some((s) => (s || '').toLowerCase().includes(query));
|
||||
}
|
||||
|
||||
function renderContent() {
|
||||
const isRedeem = currentTab === 'redeem';
|
||||
$('redeemPanel').hidden = !isRedeem;
|
||||
$('grid').hidden = isRedeem;
|
||||
function render() {
|
||||
for (const tab of document.querySelectorAll('.snav-item')) tab.classList.toggle('active', tab.dataset.tab === currentTab);
|
||||
const product = detailId && state.products.find((p) => p.id === detailId);
|
||||
$('redeemPanel').hidden = currentTab !== 'redeem';
|
||||
$('catalog').hidden = currentTab === 'redeem' || !!product;
|
||||
$('detail').hidden = !product;
|
||||
$('packFilters').hidden = currentTab !== 'vehicle-pack';
|
||||
if (isRedeem) return renderRedeemHelp();
|
||||
|
||||
if (currentTab === 'redeem') return renderRedeemHelp();
|
||||
if (product) return renderDetail(product);
|
||||
const items = state.products.filter(matches);
|
||||
const mode = $('sortSelect').value;
|
||||
if (mode === 'priceAsc') items.sort((a, b) => a.gjnCostCents - b.gjnCostCents);
|
||||
if (mode === 'priceDesc') items.sort((a, b) => b.gjnCostCents - a.gjnCostCents);
|
||||
const grid = $('grid');
|
||||
grid.innerHTML = '';
|
||||
const items = state.products.filter(matchesFilters);
|
||||
if (items.length === 0) grid.innerHTML = '<div class="empty">' + WtoUi.escapeHtml(t('empty')) + '</div>';
|
||||
for (const product of items) grid.appendChild(productCard(product));
|
||||
if (!items.length) grid.innerHTML = '<div class="empty">' + WtoUi.escapeHtml(t('empty')) + '</div>';
|
||||
for (const item of items) grid.appendChild(productCard(item));
|
||||
}
|
||||
|
||||
function productImage(product, className) {
|
||||
if (product.unitName) return WtoUi.vehicleImg(product.unitName, className);
|
||||
return WtoUi.storeImg(product.guid, '', className ? className + ' cover' : 'cover');
|
||||
}
|
||||
|
||||
function contentsOf(product) {
|
||||
const lines = [];
|
||||
for (const v of product.vehicles || []) lines.push({ text: WtoUi.text(v.title), vehicle: v });
|
||||
if (product.premiumDays) lines.push({ text: t('containsPremium', { days: product.premiumDays }) });
|
||||
if (product.goldIncome) lines.push({ text: t('containsEagles', { n: WtoUi.num(product.goldIncome) }) });
|
||||
if (product.silverIncome) lines.push({ text: t('containsSilver', { n: WtoUi.num(product.silverIncome) }) });
|
||||
return lines;
|
||||
}
|
||||
|
||||
function buyButtons(product, mainClass, freeClass) {
|
||||
const disabled = product.owned || !state.activeUserId;
|
||||
const main = Object.assign(document.createElement('button'), { className: mainClass, disabled, textContent: product.owned ? t('owned') : (state.activeUserId ? t('buy') : t('pickAccount')) });
|
||||
main.onclick = (e) => { e.stopPropagation(); buy(product.id, 'gjn'); };
|
||||
const free = Object.assign(document.createElement('button'), { className: freeClass, disabled, textContent: t('freeBuy') });
|
||||
free.onclick = (e) => { e.stopPropagation(); buy(product.id, 'free'); };
|
||||
return [main, free];
|
||||
}
|
||||
|
||||
function productCard(product) {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'card';
|
||||
card.appendChild(productCardHead(product));
|
||||
|
||||
const contents = productContents(product);
|
||||
if (contents.length) {
|
||||
const list = document.createElement('ul');
|
||||
list.className = 'contents';
|
||||
for (const line of contents) list.appendChild(Object.assign(document.createElement('li'), { textContent: line }));
|
||||
card.appendChild(list);
|
||||
card.className = 'pw';
|
||||
card.innerHTML = '<div class="pw-poster"></div><div class="pw-desc"><div class="pw-game">War Thunder</div><div class="pw-title"></div><div class="pw-comment"></div><ul class="pw-contents"></ul></div><div class="pw-price"></div><div class="pw-buy"></div>';
|
||||
card.querySelector('.pw-poster').appendChild(productImage(product, ''));
|
||||
if (product.owned) card.querySelector('.pw-poster').appendChild(Object.assign(document.createElement('div'), { className: 'badge owned', textContent: t('badgeOwned') }));
|
||||
card.querySelector('.pw-title').textContent = WtoUi.text(product.title);
|
||||
if (product.country) {
|
||||
const comment = card.querySelector('.pw-comment');
|
||||
comment.appendChild(WtoUi.iconImg('flag', product.country, ''));
|
||||
comment.appendChild(document.createTextNode(WtoUi.label(product.country) + ', ' + t('rank', { rank: ROMAN[product.rank] || product.rank })));
|
||||
}
|
||||
|
||||
const foot = document.createElement('div');
|
||||
foot.className = 'card-foot';
|
||||
foot.innerHTML = '<span class="price"></span><div class="buy-actions"></div>';
|
||||
foot.querySelector('.price').textContent = WtoUi.gjn(product.gjnCostCents) + ' GJN';
|
||||
const actions = foot.querySelector('.buy-actions');
|
||||
if (product.owned || !state.activeUserId) {
|
||||
actions.appendChild(Object.assign(document.createElement('button'), {
|
||||
className: 'buy', textContent: product.owned ? t('owned') : t('pickAccount'), disabled: true,
|
||||
}));
|
||||
} else {
|
||||
const gjnBtn = Object.assign(document.createElement('button'), { className: 'buy', textContent: t('buy') });
|
||||
gjnBtn.onclick = () => buy(product.id, 'gjn');
|
||||
const freeBtn = Object.assign(document.createElement('button'), { className: 'buy free', textContent: t('freeBuy') });
|
||||
freeBtn.onclick = () => buy(product.id, 'free');
|
||||
actions.append(gjnBtn, freeBtn);
|
||||
}
|
||||
card.appendChild(foot);
|
||||
const list = card.querySelector('.pw-contents');
|
||||
for (const line of contentsOf(product).slice(1)) list.appendChild(Object.assign(document.createElement('li'), { textContent: line.text }));
|
||||
card.querySelector('.pw-price').textContent = '$' + WtoUi.gjn(product.gjnCostCents);
|
||||
card.querySelector('.pw-buy').append(...buyButtons(product, '', ''));
|
||||
card.onclick = () => { detailId = product.id; render(); window.scrollTo(0, 0); };
|
||||
return card;
|
||||
}
|
||||
|
||||
function productCardHead(product) {
|
||||
const head = document.createElement('div');
|
||||
head.className = 'card-head';
|
||||
if (product.unitName) head.appendChild(WtoUi.iconImg('vehicle', product.unitName, 'vehicle-icon'));
|
||||
const titles = document.createElement('div');
|
||||
titles.innerHTML = '<h3 class="card-title"></h3><div class="card-sub"></div>';
|
||||
titles.querySelector('.card-title').textContent = WtoUi.text(product.title);
|
||||
if (product.country) {
|
||||
const sub = titles.querySelector('.card-sub');
|
||||
sub.appendChild(WtoUi.iconImg('flag', product.country, 'flag'));
|
||||
sub.appendChild(document.createTextNode(WtoUi.label(product.country) + ' · ' + t('rank', { rank: ROMAN[product.rank] || product.rank })));
|
||||
function renderDetail(product) {
|
||||
const detail = $('detail');
|
||||
detail.innerHTML = '<span class="back"></span><h1></h1><div class="detail-cols"><div class="detail-left"><div class="media"></div><div class="thumbs"></div>'
|
||||
+ '<h2></h2><div class="bonus"><h3></h3><div></div></div></div><div class="detail-right"><div class="buy-panel"><div class="price"></div><div class="btns"></div>'
|
||||
+ '<div class="includes"><h4></h4><ul></ul></div></div></div></div>';
|
||||
detail.querySelector('.back').textContent = t('back');
|
||||
detail.querySelector('.back').onclick = () => { detailId = ''; render(); };
|
||||
detail.querySelector('h1').textContent = WtoUi.text(product.title);
|
||||
const media = detail.querySelector('.media');
|
||||
media.appendChild(productImage(product, ''));
|
||||
const thumbs = detail.querySelector('.thumbs');
|
||||
for (const v of product.vehicles || []) {
|
||||
const thumb = WtoUi.vehicleImg(v.unitName, v.unitName === product.unitName ? 'active' : '');
|
||||
thumb.onclick = () => { media.innerHTML = ''; media.appendChild(WtoUi.vehicleImg(v.unitName, '')); };
|
||||
thumbs.appendChild(thumb);
|
||||
}
|
||||
head.appendChild(titles);
|
||||
return head;
|
||||
}
|
||||
|
||||
function productContents(product) {
|
||||
const contents = [];
|
||||
if (product.vehicles && product.vehicles.length > 1) {
|
||||
for (const v of product.vehicles) contents.push(t('includesUnit', { name: WtoUi.text(v.title) }));
|
||||
detail.querySelector('.detail-left h2').textContent = product.vehicles ? product.vehicles.map((v) => WtoUi.text(v.title)).join(' / ') : WtoUi.text(product.title);
|
||||
detail.querySelector('.bonus h3').textContent = t('bonusTitle');
|
||||
detail.querySelector('.bonus div').textContent = t('bonusText');
|
||||
detail.querySelector('.bonus').hidden = product.kind !== 'vehicle-pack';
|
||||
detail.querySelector('.price').textContent = '$' + WtoUi.gjn(product.gjnCostCents) + ' (GJN)';
|
||||
detail.querySelector('.btns').append(...buyButtons(product, 'btn-main', 'btn-free'));
|
||||
detail.querySelector('.includes h4').textContent = t('includes');
|
||||
const list = detail.querySelector('.includes ul');
|
||||
for (const line of contentsOf(product)) {
|
||||
const li = document.createElement('li');
|
||||
if (line.vehicle && product.country) {
|
||||
li.appendChild(WtoUi.iconImg('flag', product.country, ''));
|
||||
li.appendChild(Object.assign(document.createElement('span'), { className: 'rank-chip', textContent: ROMAN[line.vehicle.rank] || line.vehicle.rank }));
|
||||
}
|
||||
li.appendChild(document.createTextNode(line.text));
|
||||
list.appendChild(li);
|
||||
}
|
||||
if (product.kind === 'premium-gjn') contents.push(t('premiumDays', { days: product.premiumDays }));
|
||||
else if (product.premiumDays) contents.push(t('containsPremium', { days: product.premiumDays }));
|
||||
if (product.kind === 'vehicle-pack' && product.goldIncome) contents.push(t('containsEagles', { n: WtoUi.num(product.goldIncome) }));
|
||||
if (product.kind === 'vehicle-pack' && product.silverIncome) contents.push(t('containsSilver', { n: WtoUi.num(product.silverIncome) }));
|
||||
return contents;
|
||||
}
|
||||
|
||||
function renderRedeemHelp() {
|
||||
@@ -174,21 +197,17 @@ async function redeem() {
|
||||
await loadState(state.activeUserId);
|
||||
}
|
||||
|
||||
$('accountSelect').onchange = (event) => {
|
||||
WtoUi.saveAccount(event.target.value);
|
||||
loadState(event.target.value);
|
||||
};
|
||||
$('searchInput').oninput = renderContent;
|
||||
$('countryFilter').onchange = renderContent;
|
||||
$('rankFilter').onchange = renderContent;
|
||||
$('accountSelect').onchange = (event) => { WtoUi.saveAccount(event.target.value); loadState(event.target.value); };
|
||||
$('searchInput').oninput = render;
|
||||
for (const id of ['countryFilter', 'rankFilter', 'sortSelect']) $(id).onchange = render;
|
||||
$('redeemBtn').onclick = redeem;
|
||||
$('tabs').onclick = (event) => {
|
||||
const tab = event.target.closest('.tab');
|
||||
const tab = event.target.closest('.snav-item');
|
||||
if (!tab) return;
|
||||
for (const other of document.querySelectorAll('.tab')) other.classList.toggle('active', other === tab);
|
||||
currentTab = tab.dataset.tab;
|
||||
renderContent();
|
||||
detailId = '';
|
||||
render();
|
||||
};
|
||||
|
||||
applyStaticTexts();
|
||||
WtoUi.loadLabels().then(() => loadState(WtoUi.savedAccount()));
|
||||
Promise.all([WtoUi.loadLabels(), WtoUi.loadImageSources()]).then(() => loadState(WtoUi.savedAccount()));
|
||||
@@ -3,47 +3,54 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>WTOffline</title>
|
||||
<link rel="stylesheet" href="/_wto/ui/common.css" />
|
||||
<title>Gaijin.Net Store · WTOffline</title>
|
||||
<link rel="stylesheet" href="/store/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<div class="brand-title" data-t="title"></div>
|
||||
<div class="brand-hint" data-t="hint"></div>
|
||||
<div class="page">
|
||||
<div class="gbar">
|
||||
<span class="gbar-logo">G</span>
|
||||
<span class="gbar-item active" data-t="store"></span>
|
||||
<a class="gbar-item" id="marketLink" data-t="toMarket"></a>
|
||||
<span class="gbar-right">
|
||||
<span class="gbar-money">GJN <b id="gjnVal">0</b></span>
|
||||
<span class="gbar-money"><span data-t="eagles"></span> <b id="goldVal">0</b></span>
|
||||
<span class="gbar-money"><span data-t="lions"></span> <b id="silverVal">0</b></span>
|
||||
<span class="gbar-money"><span data-t="premium"></span> <b id="premVal"></b></span>
|
||||
<select id="accountSelect"></select>
|
||||
</span>
|
||||
</div>
|
||||
<div class="wallet">
|
||||
<a class="link" id="marketLink" data-t="toMarket"></a>
|
||||
<select id="accountSelect"></select>
|
||||
<span class="pill">GJN<b id="gjnVal">0</b></span>
|
||||
<span class="pill"><span data-t="eagles"></span><b id="goldVal">0</b></span>
|
||||
<span class="pill"><span data-t="lions"></span><b id="silverVal">0</b></span>
|
||||
<span class="pill"><span data-t="premium"></span><b id="premVal"></b></span>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
<nav class="snav" id="tabs">
|
||||
<span class="wt-logo"><span class="wt-mark"></span>WAR THUNDER</span>
|
||||
<a class="snav-item active" data-tab="vehicle-pack" data-t="tabPacks"></a>
|
||||
<a class="snav-item" data-tab="eagles" data-t="tabEagles"></a>
|
||||
<a class="snav-item" data-tab="premium-gjn" data-t="tabPremium"></a>
|
||||
<a class="snav-item" data-tab="redeem" data-t="tabRedeem"></a>
|
||||
</nav>
|
||||
<div id="notice" class="notice"></div>
|
||||
<div class="tabs" id="tabs">
|
||||
<button class="tab active" data-tab="vehicle-pack" data-t="tabPacks"></button>
|
||||
<button class="tab" data-tab="premium-gjn" data-t="tabPremium"></button>
|
||||
<button class="tab" data-tab="eagles" data-t="tabEagles"></button>
|
||||
<button class="tab" data-tab="redeem" data-t="tabRedeem"></button>
|
||||
</div>
|
||||
<div class="filters" id="packFilters">
|
||||
<input id="searchInput" type="search" />
|
||||
<select id="countryFilter"></select>
|
||||
<select id="rankFilter"></select>
|
||||
</div>
|
||||
<div class="grid" id="grid"></div>
|
||||
<section id="catalog">
|
||||
<div class="frow" id="packFilters">
|
||||
<select id="countryFilter"></select>
|
||||
<select id="rankFilter"></select>
|
||||
<input id="searchInput" type="search" />
|
||||
<select id="sortSelect" class="sort">
|
||||
<option value="best" data-t="sortBest"></option>
|
||||
<option value="priceAsc" data-t="sortPriceAsc"></option>
|
||||
<option value="priceDesc" data-t="sortPriceDesc"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="grid" id="grid"></div>
|
||||
</section>
|
||||
<section class="detail" id="detail" hidden></section>
|
||||
<section class="redeem" id="redeemPanel" hidden>
|
||||
<div class="redeem-row">
|
||||
<input id="codeInput" type="text" />
|
||||
<button class="buy" id="redeemBtn" data-t="redeem"></button>
|
||||
<button class="btn-main" id="redeemBtn" data-t="redeem"></button>
|
||||
</div>
|
||||
<ul class="redeem-help" id="redeemHelp"></ul>
|
||||
</section>
|
||||
</main>
|
||||
<footer class="foot" data-t="footer"></footer>
|
||||
</div>
|
||||
<script src="/_wto/ui/common.js"></script>
|
||||
<script src="/store/app.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -1,7 +1,90 @@
|
||||
/* Store page only; the shared layout is /_wto/ui/common.css. */
|
||||
.contents { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
|
||||
.redeem { display: flex; flex-direction: column; gap: 12px; max-width: 760px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
|
||||
.redeem-row { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.redeem-row input { flex: 1 1 280px; }
|
||||
.redeem-help { margin: 0; padding-left: 18px; color: var(--muted); }
|
||||
.redeem-help li { margin: 2px 0; }
|
||||
/* Local store page, laid out like the official Gaijin.Net store (implementation notes
|
||||
section 3; Chromium 100: no :has(), container queries or CSS nesting). Fonts fall back to system fonts. */
|
||||
:root {
|
||||
--navy-5: #030c15; --navy-40: #27323f; --navy-60: #2d3a48; --navy-75: #424e5b;
|
||||
--text: #c0c4c8; --gray-50: #969ca4; --teal: #29b2bc; --teal-hi: #31eeda; --gold: #ffe8aa;
|
||||
--line: rgba(166, 221, 255, 0.1);
|
||||
--font: "Fira Sans", "Segoe UI", "Microsoft YaHei", sans-serif; --font-ui: "PT Root UI", var(--font);
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
[hidden] { display: none !important; }
|
||||
html, body { margin: 0; }
|
||||
body { background: var(--navy-40) linear-gradient(180deg, #1b2530 0%, #27323f 420px); color: var(--text); font: 16px/1.5 var(--font); min-width: 1024px; }
|
||||
.page { width: 1218px; max-width: calc(100% - 32px); margin: 0 auto; }
|
||||
|
||||
.gbar { display: flex; align-items: center; gap: 18px; height: 42px; padding: 0 12px; background: var(--navy-5); font-size: 13px; }
|
||||
.gbar-logo { width: 22px; height: 22px; border-radius: 4px; background: #d32f2f; color: #fff; font-weight: 700; text-align: center; line-height: 22px; }
|
||||
.gbar-item { color: var(--text); text-decoration: none; cursor: pointer; }
|
||||
.gbar-item.active { color: #fff; border-bottom: 2px solid #fff; padding-bottom: 2px; }
|
||||
.gbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
|
||||
.gbar-money b { color: var(--gold); font-weight: 500; }
|
||||
.gbar select { height: 28px; border: 1px solid var(--line); border-radius: 3px; background: #0d1823; color: #fff; font: inherit; }
|
||||
|
||||
.snav { display: flex; align-items: center; gap: 28px; height: 76px; border-bottom: 1px solid var(--line); font: 18px/27px var(--font-ui); }
|
||||
.wt-logo { display: flex; align-items: center; gap: 8px; color: #b8bcc1; letter-spacing: 0.12em; font-size: 15px; margin-right: 12px; }
|
||||
.wt-mark { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, #ff4b3a 30%, #b3170c 70%); }
|
||||
.snav-item { color: var(--text); text-decoration: none; cursor: pointer; transition: color 0.3s; }
|
||||
.snav-item:hover, .snav-item.active { color: var(--teal-hi); }
|
||||
|
||||
.frow { display: flex; align-items: center; gap: 14px; height: 56px; border-bottom: 1px solid var(--line); }
|
||||
.frow select, .frow input { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--text); font: 14px var(--font); }
|
||||
.frow select option { background: var(--navy-60); }
|
||||
.frow input { width: 260px; }
|
||||
.frow .sort { margin-left: auto; }
|
||||
|
||||
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 24px 0 40px; }
|
||||
.pw { position: relative; display: flex; flex-direction: column; height: 344px; background: var(--navy-60); overflow: hidden; cursor: pointer; transition: transform 0.3s; }
|
||||
.pw:hover { transform: translateY(-3px); }
|
||||
.pw-poster { position: relative; height: 162px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #33475a, var(--navy-60)); }
|
||||
.pw-poster img { max-width: 92%; max-height: 92%; object-fit: contain; }
|
||||
.pw-poster img.cover { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
|
||||
.badge { position: absolute; left: 0; right: 0; top: 0; height: 30px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; color: #fff; font-size: 14px; text-transform: uppercase; background: linear-gradient(90deg, #0050e0, #1a8cff); }
|
||||
.badge.owned { background: linear-gradient(90deg, #3a8a2a, #6cc04a); }
|
||||
.pw-desc { flex: 1; padding: 10px 14px 0; min-height: 0; overflow: hidden; }
|
||||
.pw-game { color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
|
||||
.pw-title { margin: 2px 0 4px; color: #fff; font-size: 18px; line-height: 1.3; max-height: 70px; overflow: hidden; }
|
||||
.pw-comment { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
|
||||
.pw-comment img { width: 26px; height: 17px; object-fit: contain; }
|
||||
.pw-contents { margin: 6px 0 0; padding-left: 16px; font-size: 13px; color: var(--gray-50); }
|
||||
.pw-price { padding: 0 14px 12px; text-align: right; color: var(--gold); font-size: 20px; }
|
||||
.pw-buy { display: flex; height: 40px; border-top: 1px solid var(--line); }
|
||||
.pw-buy button { flex: 1; border: none; border-right: 1px solid var(--line); background: transparent; color: var(--gold); font: 16px var(--font-ui); text-transform: uppercase; cursor: pointer; transition: background 0.3s; }
|
||||
.pw-buy button:last-child { border-right: none; }
|
||||
.pw-buy button:hover { background: #ffffff0f; }
|
||||
.pw-buy button:disabled { color: var(--gray-50); cursor: default; background: transparent; }
|
||||
.empty { grid-column: 1 / -1; color: var(--gray-50); padding: 40px 0; }
|
||||
|
||||
.detail { padding: 24px 0 40px; }
|
||||
.detail h1 { margin: 0 0 20px; color: #fff; font-size: 40px; font-weight: 700; }
|
||||
.back { color: var(--teal); cursor: pointer; font-size: 15px; display: inline-block; margin-bottom: 12px; }
|
||||
.detail-cols { display: flex; gap: 24px; align-items: flex-start; }
|
||||
.detail-left { flex: 1; min-width: 0; }
|
||||
.media { height: 452px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #3a4d60, #1b2633 75%); }
|
||||
.media img { max-width: 90%; max-height: 90%; object-fit: contain; }
|
||||
.media img.cover { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }
|
||||
.thumbs { display: flex; gap: 8px; padding: 8px 0; }
|
||||
.thumbs img { width: 132px; height: 85px; object-fit: contain; background: #1b2633; border: 2px solid transparent; cursor: pointer; }
|
||||
.thumbs img.active { border-color: #f9ae3d; }
|
||||
.detail-left h2 { color: #fff; font-size: 32px; font-weight: 300; margin: 24px 0 8px; }
|
||||
.bonus { margin-top: 24px; padding: 28px 32px; background: linear-gradient(90deg, #5c5030, #e8d08a); color: #3a2a10; }
|
||||
.bonus h3 { margin: 0 0 8px; font-size: 32px; text-transform: uppercase; }
|
||||
.detail-right { flex: none; width: 390px; }
|
||||
.buy-panel { padding: 24px 40px 28px; background: #1f2a36; text-align: center; }
|
||||
.buy-panel .price { color: #fff; font-size: 26px; margin: 8px 0 16px; }
|
||||
.btn-main { width: 310px; max-width: 100%; height: 56px; border: none; border-radius: 3px; background: linear-gradient(180deg, #ff7a2f, #d9381e); color: #fff; font: 26px var(--font-ui); text-transform: uppercase; box-shadow: 0 5px 13px rgba(89, 16, 0, 0.65); cursor: pointer; }
|
||||
.btn-free { width: 310px; max-width: 100%; height: 44px; margin-top: 12px; border: 1px solid var(--gold); border-radius: 3px; background: transparent; color: var(--gold); font: 18px var(--font-ui); cursor: pointer; }
|
||||
.btn-main:disabled, .btn-free:disabled { filter: grayscale(1); opacity: 0.7; cursor: default; }
|
||||
.includes { margin-top: 20px; text-align: left; }
|
||||
.includes h4 { margin: 0 0 8px; color: var(--text); font-size: 17px; font-weight: 400; }
|
||||
.includes li { list-style: none; display: flex; align-items: center; gap: 8px; color: #fff; padding: 3px 0; }
|
||||
.includes img { width: 26px; height: 17px; object-fit: contain; }
|
||||
.rank-chip { padding: 0 6px; border-radius: 2px; background: #f9ae3d; color: #1b1408; font-size: 13px; font-weight: 700; }
|
||||
|
||||
.notice { display: none; margin: 16px 0 0; padding: 10px 14px; border: 1px solid var(--line); }
|
||||
.notice.ok { display: block; color: #98ff87; } .notice.err { display: block; color: #ff9270; }
|
||||
.redeem { padding: 32px 0 48px; max-width: 760px; }
|
||||
.redeem-row { display: flex; gap: 12px; }
|
||||
.redeem-row input { flex: 1; height: 44px; padding: 0 12px; border: 1px solid var(--line); background: #1b2633; color: #fff; font: 16px var(--font); }
|
||||
.redeem-row .btn-main { width: 180px; height: 44px; font-size: 18px; }
|
||||
.redeem-help { color: var(--gray-50); padding-left: 18px; }
|
||||
.foot { padding: 32px 0; border-top: 1px solid var(--line); color: var(--gray-50); font-size: 13px; text-align: center; }
|
||||
Reference in new issue
Block a user