Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/manifest_chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"resources": [ "options.json" ]
}
],
"host_permissions": [ "https://aligueler.com/" ]
"host_permissions": [ "https://aligueler.com/", "https://www.playstation.com/" ]
}
2 changes: 1 addition & 1 deletion src/manifest_firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
"resources": [ "options.json" ]
}
],
"host_permissions": [ "https://aligueler.com/" ]
"host_permissions": [ "https://aligueler.com/", "https://www.playstation.com/" ]
}
89 changes: 88 additions & 1 deletion src/scripts/background.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,94 @@
// PS Plus game name lookup map (normalized name -> game data)
let psplusGamesMap = null;
let psplusLoadPromise = null;

// Load PS Plus games data
const loadPSPlusGames = async () => {
if (psplusGamesMap) return psplusGamesMap;
if (psplusLoadPromise) return psplusLoadPromise;

psplusLoadPromise = (async () => {
try {
const url = 'https://www.playstation.com/bin/imagic/gameslist?locale=en-us&categoryList=plus-games-list';
const response = await fetch(url);
const data = await response.json();

// Build normalized name lookup map
psplusGamesMap = new Map();
data.forEach(category => {
if (category.games) {
category.games.forEach(game => {
const normalizedName = normalizeName(game.nameEn || game.name);
psplusGamesMap.set(normalizedName, {
name: game.nameEn || game.name,
conceptUrl: game.conceptUrl,
device: game.device
});
});
}
});
return psplusGamesMap;
} catch (error) {
console.error('Failed to load PS Plus games:', error);
psplusGamesMap = new Map();
return psplusGamesMap;
}
})();

return psplusLoadPromise;
};

// Normalize game name for matching
const normalizeName = (name) => {
if (!name) return '';
return name
.toLowerCase()
.replace(/[™®©]/g, '')
.replace(/[:''"\-–—]/g, ' ')
.replace(/\s+/g, ' ')
.trim();
};

// Check if game matches PS Plus by name
const checkPSPlus = async (gameName) => {
const map = await loadPSPlusGames();
const normalized = normalizeName(gameName);
return map.get(normalized) || null;
};

// Add PS Plus info to game response
const addPSPlusToGames = async (games) => {
if (!games || !Array.isArray(games)) return games;

await loadPSPlusGames();

for (const game of games) {
if (game.name && game.status === 'found') {
const psplusMatch = await checkPSPlus(game.name);
if (psplusMatch) {
if (!game.subs) game.subs = {};
game.subs.psplus = {
status: 'active',
date: {
since: null,
until: null
},
link: psplusMatch.conceptUrl,
target: '_blank'
};
}
}
}

return games;
};

chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
switch (request.type) {
case 'fetch-game':
fetchData(request.data, 'game').then(r => sendResponse(r));
fetchData(request.data, 'game')
.then(r => addPSPlusToGames(r))
.then(r => sendResponse(r));
break;
case 'fetch-pass':
fetchData(request.data, 'pass').then(r => sendResponse(r));
Expand Down
5 changes: 3 additions & 2 deletions src/scripts/functions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******* Variables *******/
const version = chrome.runtime.getManifest().version;
const platforms = ["gamepasspc", "gamepasscon", "ubiplus", "eaplay", "eaplaypro"];
const platforms = ["gamepasspc", "gamepasscon", "ubiplus", "eaplay", "eaplaypro", "psplus"];

let save = {
options: {
Expand All @@ -9,7 +9,8 @@ let save = {
gamepasscon: true,
ubiplus: true,
eaplay: true,
eaplaypro: true
eaplaypro: true,
psplus: true
},
timeFrame: 30,
menuToggle: 'click',
Expand Down
19 changes: 15 additions & 4 deletions src/scripts/lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ switch (navigator.language) {
return "EA PLAY"
case "eaplaypro":
return "EA PLAY PRO"
case "psplus":
return "PS PLUS"
}
},
options: {
Expand Down Expand Up @@ -55,16 +57,25 @@ switch (navigator.language) {
},
long: {
active: function(platform, name, date) {
return name + " has been on " + lang.platform(platform) + " since " + lang.formatDate(date.since)
if (date && date.since) {
return name + " has been on " + lang.platform(platform) + " since " + lang.formatDate(date.since)
}
return name + " is available on " + lang.platform(platform)
},
left: function(platform, name, date) {
return name + " left " + lang.platform(platform) + " on " + lang.formatDate(date.until, false)
if (date && date.until) {
return name + " left " + lang.platform(platform) + " on " + lang.formatDate(date.until, false)
}
return name + " has left " + lang.platform(platform)
},
leaving: function(platform, name, date) {
return name + " is leaving " + lang.platform(platform) + " " + (date.until ? lang.formatDate(date.until) : "soon")
return name + " is leaving " + lang.platform(platform) + " " + (date && date.until ? lang.formatDate(date.until) : "soon")
},
soon: function(platform, name, date) {
return name + " is coming to " + lang.platform(platform) + " on " + lang.formatDate(date.since)
if (date && date.since) {
return name + " is coming to " + lang.platform(platform) + " on " + lang.formatDate(date.since)
}
return name + " is coming soon to " + lang.platform(platform)
},
missing: function(platform, name, date) {
return name + " is not on any subscription service"
Expand Down
2 changes: 1 addition & 1 deletion src/style.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1000 1000' fill='white' fill-rule='evenodd' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M896.824 803.809a96.956 96.956 0 015.516-.152v-.086c54.635 0 97.309 41.379 97.309 98.171 0 56.792-42.587 98.258-97.309 98.258-54.722 0-97.395-41.523-97.395-98.171 0-2.023.054-4.026.177-6.013a502.845 502.845 0 0091.702-92.007zm5.516 166.63c-36.088 0-64.815-28.755-64.815-68.697 0-39.941 28.755-68.697 64.815-68.697 36.059 0 64.786 28.756 64.786 68.697 0 39.942-28.755 68.697-64.786 68.697zM733.474 942.025V1000h-33.15v-41.935a496.377 496.377 0 0033.15-16.04z'/%3E%3Cpath d='M805.104 895.875a501.337 501.337 0 01-71.63 46.194V888.29c0-34.35 30.02-60.01 65.95-53.281v-31.57c-29.61-3.95-53.31 9.48-65.95 37.51l.088-33.238h-33.238v150.397c-54.998 24.147-115.165 38.67-178.334 41.414v-110.49h65.965c51.473 0 88.855-34.938 88.855-80.717 0-45.778-37.267-79.911-88.855-79.911H487.857v271.45C217.751 993.395 0 771.648 0 500.001 0 224.297 224.297-.001 499.999-.001 775.698-.001 1000 224.299 1000 500.001c0 114.17-38.465 219.526-103.12 303.796-50.098 2.57-88.996 40.364-91.776 92.078zm-162.053-87.56c0-29.1-21.739-49.287-55.096-49.287H521.99v100.127h65.965c32.58 0 55.096-21.336 55.096-50.84zm-.676-501.053L469.632 582.324H278.018l44.207-68.959H437.07l43.87-68.926H215.439l-43.861 68.926h62.896l-87.266 137.68h364.189l134.516-212.136 49.046 74.456h-44.224l-41.882 68.959h130.961l45.475 68.721h83.541L642.375 307.262zm-57.747-.658H302.054l-42.874 68.901h282.249l43.199-68.901z'/%3E%3C/svg%3E");
}

.alike_cont .psplus,
.ag_changes .ag_tab .game .psplus {
background-color: #0070d1;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 163.57 126.69'%3E%3Cpath d='M433.53,541c-6.13,4.09-4.09,11.85,9,15.53a88,88,0,0,0,42.5,3.27,17.7,17.7,0,0,0,2-.41v-13.9l-13.9,4.5a30.25,30.25,0,0,1-15.94.82c-4.09-1.23-3.27-3.68,1.63-5.72l28.2-9.81V520.17l-39.23,13.49A52.85,52.85,0,0,0,433.53,541Zm94.81-61.3v39.64c16.76,8.17,29.83,0,29.83-21.25,0-21.66-7.76-31.47-30.24-39.23a282.79,282.79,0,0,0-36.37-10.22V566.76l28.61,8.58V476c0-4.5,0-7.76,3.27-6.54C527.93,470.72,528.34,475.22,528.34,479.71Zm53.13,51.9a87,87,0,0,0-36.78-4.5,67,67,0,0,0-18.39,4.09l-1.23.41v15.94l26.56-9.81a30.25,30.25,0,0,1,15.94-.82c4.09,1.23,3.27,3.68-1.63,5.72l-40.87,15.12V573.3l56.4-20.84a31.5,31.5,0,0,0,11-6.95C595.36,541.43,594.14,535.7,581.47,531.62Z' transform='translate(-430.22 -448.65)' fill='white'/%3E%3C/svg%3E");
}

.alike_cont .alike {
background-color: #000000;
}
Expand Down