Shorter in-app release notes with a link to GitHub, one release per hour at most
This commit is contained in:
parent
6b0f3d6eeb
commit
683b7bad3c
6 changed files with 60 additions and 3 deletions
|
|
@ -2248,4 +2248,7 @@
|
|||
"Replace ten of them and the cable pays for itself in about {n} months.":"Sostituiscine dieci e il cavo si ripaga in circa {n} mesi.",
|
||||
"Cuts still happen, anchors and sharks included, but the repair ship is yours to call.":"I tagli succedono lo stesso, ancore e squali compresi, ma la nave di riparazione la chiami tu.",
|
||||
"Lay the cable <small>{price}</small>":"Posa il cavo <small>{price}</small>",
|
||||
"…and {n} more change":"…e {n} altra modifica",
|
||||
"…and {n} more changes":"…e altre {n} modifiche",
|
||||
"Read the full notes on GitHub":"Leggi le note complete su GitHub",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3339,10 +3339,18 @@ function whatsNew(returning,force){
|
|||
try{seen=localStorage.getItem('sot-seen-version');localStorage.setItem('sot-seen-version',APP_VERSION);}catch(e){}
|
||||
if(!force&&(!returning||seen===APP_VERSION))return false;
|
||||
openModal(`<div style="display:flex;align-items:center"><div><div class="eyebrow">${tr('Release notes')}</div><h2 style="font-size:28px">${tr('New in Series of Tubes {v}',{v:esc(APP_VERSION)})}</h2></div><button class="x" data-act="${UI.started?'closeModal':'helpClose'}" aria-label="${tr('Close')}">×</button></div>
|
||||
<ul class="notes">${RELEASE_NOTES.map(n=>`<li>${esc(n)}</li>`).join('')}</ul>
|
||||
${notesHtml(RELEASE_NOTES,APP_VERSION)}
|
||||
${returning&&S?`<p class="note">${tr('Your network {name} was saved and is waiting for you.',{name:esc(S.name)})}</p>`:''}
|
||||
<div class="btns" style="margin-top:12px">${btn(UI.started?tr('Back to my network'):tr('Got it'),UI.started?'closeModal':'helpClose',{},'pink big')}<a class="b ghost" href="https://github.com/fjaeckel/seriesoftubes/blob/main/CHANGELOG.md" target="_blank" rel="noopener">${tr('Full changelog')}</a></div>`);
|
||||
<div class="btns" style="margin-top:12px">${btn(UI.started?tr('Back to my network'):tr('Got it'),UI.started?'closeModal':'helpClose',{},'pink big')}${notesLong(RELEASE_NOTES)?'':`<a class="b ghost" href="https://github.com/fjaeckel/seriesoftubes/blob/main/CHANGELOG.md" target="_blank" rel="noopener">${tr('Full changelog')}</a>`}</div>`);
|
||||
return true;}
|
||||
/* In-app notes stay short: at most NOTE_MAX changes, each cut to its first sentence. When anything was cut, a
|
||||
link leads to the full notes of this version on GitHub. The CHANGELOG and the GitHub release keep every word. */
|
||||
const NOTE_MAX=5,NOTE_CH=140;
|
||||
function slimNote(n){const m=String(n).match(/^(.+?[.!?])(\s|$)/);let t=m?m[1]:String(n);if(t.length>NOTE_CH)t=t.slice(0,NOTE_CH-1).replace(/\s+\S*$/,'')+'…';return t;}
|
||||
const notesLong=ns=>ns.length>NOTE_MAX||ns.some(n=>slimNote(n)!==n);
|
||||
function notesHtml(ns,ver){const more=Math.max(0,ns.length-NOTE_MAX);
|
||||
return `<ul class="notes">${ns.slice(0,NOTE_MAX).map(n=>`<li>${esc(slimNote(n))}</li>`).join('')}${more?`<li class="meta">${trn('…and {n} more change','…and {n} more changes',more)}</li>`:''}</ul>`+
|
||||
(notesLong(ns)?`<p style="margin:6px 0 0"><a class="b pink sm" href="https://github.com/fjaeckel/seriesoftubes/releases/tag/v${esc(ver)}" target="_blank" rel="noopener">${tr('Read the full notes on GitHub')}</a></p>`:'');}
|
||||
function newerVer(a,b){const x=String(a).split('.').map(Number),y=String(b).split('.').map(Number);for(let i=0;i<3;i++){if((x[i]||0)>(y[i]||0))return true;if((x[i]||0)<(y[i]||0))return false;}return false;}
|
||||
// While the game is open, look for a newer release now and then and offer a reload.
|
||||
function checkUpdate(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue