1/* "Continue playing" â reads the shared "gbkRecentlyPlayed" localStorage 2 list and renders it into #continuePlayingTrack on the homepage. 3 The list itself is written from the actual gamepage, not here â see 4 the recordContinuePlaying() function in gameplayer-controls.js, which 5 fires the moment a game is actually started (Play Now clicked), not 6 just when a link to it is clicked. That function keeps its own inline 7 copy of the write logic below (same storage key/shape) so every 8 already-generated gamepage records correctly without needing this 9 script added to it too. record() is still exposed here for any page 10 that does load this script directly. */ 11(function() { 12 const STORAGE_KEY = 'gbkRecentlyPlayed'; 13 const MAX_ITEMS = 12; 14 15 function loadList() { 16 try { 17 const stored = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]'); 18 return Array.isArray(stored) ? stored : []; 19 } catch (err) { 20 return []; 21 } 22 } 23 24 function saveList(list) { 25 try { 26 localStorage.setItem(STORAGE_KEY, JSON.stringify(list)); 27 } catch (err) {} 28 } 29 30 function record(game) { 31 if (!game || !game.url || !game.image || !game.name) return; 32 let list = loadList(); 33 list = list.filter((item) => item.url !== game.url); 34 list.unshift(game); 35 list = list.slice(0, MAX_ITEMS); 36 saveList(list); 37 } 38 39 function render(trackId) { 40 const track = document.getElementById(trackId); 41 if (!track) return; 42 const list = loadList(); 43 44 if (!list.length) { 45 track.innerHTML = '<div class="continue-playing-empty">No recently played games yet â start a game to see it show up here.</div>'; 46 return; 47 } 48 49 track.innerHTML = list.map((game) => { 50 return '<a href="' + game.url + '" title="' + game.name + '" class="continue-playing-item">' + 51 '<img src="' + game.image + '" alt="' + game.name + '" loading="lazy">' + 52 '</a>'; 53 }).join(''); 54 } 55 56 window.GBKRecent = { record: record, render: render, getList: loadList }; 57 58 document.addEventListener('DOMContentLoaded', function() { 59 render('continuePlayingTrack'); 60 }); 61})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.