Skip to content
Merged
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
25 changes: 4 additions & 21 deletions assets/js/spelling-bee-assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
};
var targetUrl = "https://www.nytimes.com/puzzles/spelling-bee";

var version = "5.0.0";
var version = "5.0.1";

const storageKey = `${prefix$1}-settings`;
const state = {
Expand Down Expand Up @@ -1925,7 +1925,7 @@

var iconCoffee = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.042 15.915c-.418-.09-.867-.402-1.116-.776-.192-.289-.273-.558-.3-1C.561 13.06.517 5.163.574 4.573c.017-.185.032-.232.099-.314a.774.774 0 01.18-.156l.102-.059 7.291.007c6.859.006 7.304.01 7.52.053 1.545.312 2.778 1.251 3.324 2.531.125.293.21.592.284 1.008.089.492.09 1.307.004 1.734-.35 1.725-1.687 3.002-3.553 3.393a5.827 5.827 0 01-1.218.13c-.255.005-.427.02-.464.04-.102.055-.13.155-.147.528-.027.6-.119.996-.32 1.387-.253.492-.614.795-1.163.978l-.196.065-2.762.029c-3.94.04-7.293.034-7.513-.013zm13.386-4.909c.38-.033.602-.094.892-.243a2.398 2.398 0 001.257-1.645c.054-.266.055-.91.002-1.193-.166-.873-.74-1.596-1.492-1.88-.321-.12-.51-.142-1.232-.142h-.665l-.171.153-.008 2.365c-.004 1.3 0 2.392.008 2.426.008.033.046.09.083.124.067.062.078.063.538.063.258 0 .613-.013.788-.028z\" fill=\"#fff\"/><path d=\"M7.158 13.565c.191.064.255 0 .255 0s2.228-2.037 3.246-3.247c.892-1.082.955-2.8-.573-3.501-1.527-.7-2.8.764-2.8.764a2.508 2.508 0 00-3.502-.382l-.063.064c-.764.827-.51 2.228.063 2.992a38.304 38.304 0 003.247 3.183z\" fill=\"#ff5e5b\"/><path class=\"shape\" d=\"M.984 3.495a.266.266 0 00-.038.003c-.51.071-.903.498-.93 1.013a.266.266 0 000 .014v.191c0 .003-.064 6.17.064 9.56a.266.266 0 000 .004 2.364 2.364 0 002.368 2.225c.002 0 6.42 0 9.485-.064h.445a.266.266 0 00.064-.007c.965-.241 1.523-.842 1.803-1.481.244-.556.26-1.096.27-1.54 1.708.003 3.202-.561 4.19-1.59 1.036-1.077 1.523-2.622 1.193-4.35a4.436 4.436 0 00-1.96-3.04 5.15 5.15 0 00-2.95-.938zm.033.532h13.97a4.617 4.617 0 012.649.843.266.266 0 00.007.005 3.903 3.903 0 011.728 2.682.266.266 0 00.003.01c.304 1.58-.133 2.93-1.053 3.888s-2.338 1.522-4.024 1.461a.266.266 0 00-.276.268c0 .432-.034 1.032-.264 1.555-.227.519-.625.963-1.43 1.17h-.395a.266.266 0 00-.005 0c-3.048.064-9.48.063-9.48.063a.266.266 0 00-.002 0A1.823 1.823 0 01.612 14.25C.486 10.89.55 4.718.55 4.718a.266.266 0 000-.002v-.178a.545.545 0 01.467-.51zm13.271 1.886a.266.266 0 00-.266.268v4.583a.266.266 0 00.26.266c.48.012.961-.009 1.439-.065a.266.266 0 00.027-.005 2.4 2.4 0 001.86-2.557 2.535 2.535 0 00-.564-1.622 2.178 2.178 0 00-1.81-.868zm.267.534h.688a.266.266 0 00.009 0 1.643 1.643 0 011.37.656.266.266 0 00.006.01c.297.364.457.822.45 1.292a.266.266 0 00.002.03 1.862 1.862 0 01-1.443 2.002c-.359.041-.72.048-1.081.048z\"/></svg>";

var iconNew = "<svg version=\"1.1\" viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m2 6v20h24.1l4.05-7.2v-5.13l-4.96-7.68z\" fill=\"#fff\" stroke-width=\"0\"/>\n <path d=\"m31.4 13.9-5-8c-0.73-1.17-2.01-1.88-3.39-1.88h-19c-2.21 0-4 1.79-4 4v16c0 2.21 1.79 4 4 4h19c1.38 0 2.66-0.711 3.39-1.88l5-8c0.812-1.3 0.812-2.94 0-4.24zm-1.7 3.18-5 8c-0.367 0.588-1 0.939-1.7 0.939h-19c-1.1 0-2-0.898-2-2v-16c0-1.1 0.897-2 2-2h19c0.693 0 1.33 0.352 1.7 0.939l5 8c0.403 0.645 0.403 1.48 0 2.12z\" fill=\"#a10000\"/>\n <path d=\"m26.9 12-2.14 8h-1.51l-1.59-5.88-1.45 5.88h-1.48l-2.19-8h1.53l1.55 5.83 1.44-5.83h1.46l1.59 5.83 1.52-5.83zm-10.8 8h-5.2v-8h5.14v1.19h-3.7v2.17h2.98v1.16h-2.98v2.24h3.76zm-6.96 0h-1.4l-3.04-5.11q-0.0703-0.117-0.229-0.381-0.0703-0.117-0.217-0.369v5.86h-1.16v-8h1.59l2.8 4.71q0.0352 0.0586 0.51 0.861v-5.57h1.14z\" fill=\"#a10000\"/>\n</svg>\n";
var iconNew = "<svg version=\"1.1\" viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"m2 6v20h24.1l4.05-7.2v-5.13l-4.96-7.68z\" fill=\"#fff\" stroke-width=\"0\"/>\r\n <path d=\"m31.4 13.9-5-8c-0.73-1.17-2.01-1.88-3.39-1.88h-19c-2.21 0-4 1.79-4 4v16c0 2.21 1.79 4 4 4h19c1.38 0 2.66-0.711 3.39-1.88l5-8c0.812-1.3 0.812-2.94 0-4.24zm-1.7 3.18-5 8c-0.367 0.588-1 0.939-1.7 0.939h-19c-1.1 0-2-0.898-2-2v-16c0-1.1 0.897-2 2-2h19c0.693 0 1.33 0.352 1.7 0.939l5 8c0.403 0.645 0.403 1.48 0 2.12z\" fill=\"#a10000\"/>\r\n <path d=\"m26.9 12-2.14 8h-1.51l-1.59-5.88-1.45 5.88h-1.48l-2.19-8h1.53l1.55 5.83 1.44-5.83h1.46l1.59 5.83 1.52-5.83zm-10.8 8h-5.2v-8h5.14v1.19h-3.7v2.17h2.98v1.16h-2.98v2.24h3.76zm-6.96 0h-1.4l-3.04-5.11q-0.0703-0.117-0.229-0.381-0.0703-0.117-0.217-0.369v5.86h-1.16v-8h1.59l2.8 4.71q0.0352 0.0586 0.51 0.861v-5.57h1.14z\" fill=\"#a10000\"/>\r\n</svg>\r\n";

const versionToString = (version) => version.split(".").slice(0, 2).join("-");
const currentVersion = settings.get('options.version') || '0';
Expand Down Expand Up @@ -2591,24 +2591,7 @@
return JSON.parse(document.body.dataset[prefix(key)]);
}
getSyncData() {
let puzzleId = window.gameData.today.id.toString();
let gameData;
let lsKeysFiltered = Object.keys(localStorage).filter((key) => /^games-state-spelling_bee\/(\d+|ANON)$/.test(key));
if (!lsKeysFiltered.length) {
return [];
}
if (/nyt-auth-action=logout/.test(document.cookie)) {
return [];
}
gameData = JSON.parse(localStorage.getItem(lsKeysFiltered.shift()) || "{}");
if (!gameData.states) {
return [];
}
gameData.states = gameData.states.filter((item) => item.puzzleId === puzzleId);
if (!gameData.states.length) {
return [];
}
return gameData.states.shift().data.answers || [];
return Array.from(fn.$$('li', this.resultList)).map(li => li.textContent.trim());
}
envIs(env) {
return document.body.classList.contains("pz-" + env);
Expand All @@ -2632,9 +2615,9 @@
load() {
fn.waitFor(".sb-wordlist-items-pag", this.gameWrapper).then((resultList) => {
this.observer = this.buildObserver();
data.init(this, this.getSyncData());
this.modalWrapper = fn.$("#portal-game-modals .sb-modal-wrapper", this.gameWrapper);
this.resultList = resultList;
data.init(this, this.getSyncData());
this.add();
this.domSet("active", true);
shortcutRegistry.add(this.shortcut);
Expand Down
2 changes: 1 addition & 1 deletion assets/js/spelling-bee-assistant.min.js

Large diffs are not rendered by default.

Binary file removed build/build-4.4.2.zip
Binary file not shown.
Binary file added build/build-5.0.1.zip
Binary file not shown.
Binary file removed build/build.5.0.0.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion build/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Spelling Bee Assistant",
"description": "Spelling Bee Assistant is an add-on for Spelling Bee, the New York Times’ popular word puzzle",
"homepage_url": "https://spelling-bee-assistant.app/",
"version": "5.0.0",
"version": "5.0.1",
"content_scripts": [
{
"matches": [
Expand Down
25 changes: 4 additions & 21 deletions build/spelling-bee-assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
};
var targetUrl = "https://www.nytimes.com/puzzles/spelling-bee";

var version = "5.0.0";
var version = "5.0.1";

const storageKey = `${prefix$1}-settings`;
const state = {
Expand Down Expand Up @@ -1925,7 +1925,7 @@

var iconCoffee = "<svg viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2.042 15.915c-.418-.09-.867-.402-1.116-.776-.192-.289-.273-.558-.3-1C.561 13.06.517 5.163.574 4.573c.017-.185.032-.232.099-.314a.774.774 0 01.18-.156l.102-.059 7.291.007c6.859.006 7.304.01 7.52.053 1.545.312 2.778 1.251 3.324 2.531.125.293.21.592.284 1.008.089.492.09 1.307.004 1.734-.35 1.725-1.687 3.002-3.553 3.393a5.827 5.827 0 01-1.218.13c-.255.005-.427.02-.464.04-.102.055-.13.155-.147.528-.027.6-.119.996-.32 1.387-.253.492-.614.795-1.163.978l-.196.065-2.762.029c-3.94.04-7.293.034-7.513-.013zm13.386-4.909c.38-.033.602-.094.892-.243a2.398 2.398 0 001.257-1.645c.054-.266.055-.91.002-1.193-.166-.873-.74-1.596-1.492-1.88-.321-.12-.51-.142-1.232-.142h-.665l-.171.153-.008 2.365c-.004 1.3 0 2.392.008 2.426.008.033.046.09.083.124.067.062.078.063.538.063.258 0 .613-.013.788-.028z\" fill=\"#fff\"/><path d=\"M7.158 13.565c.191.064.255 0 .255 0s2.228-2.037 3.246-3.247c.892-1.082.955-2.8-.573-3.501-1.527-.7-2.8.764-2.8.764a2.508 2.508 0 00-3.502-.382l-.063.064c-.764.827-.51 2.228.063 2.992a38.304 38.304 0 003.247 3.183z\" fill=\"#ff5e5b\"/><path class=\"shape\" d=\"M.984 3.495a.266.266 0 00-.038.003c-.51.071-.903.498-.93 1.013a.266.266 0 000 .014v.191c0 .003-.064 6.17.064 9.56a.266.266 0 000 .004 2.364 2.364 0 002.368 2.225c.002 0 6.42 0 9.485-.064h.445a.266.266 0 00.064-.007c.965-.241 1.523-.842 1.803-1.481.244-.556.26-1.096.27-1.54 1.708.003 3.202-.561 4.19-1.59 1.036-1.077 1.523-2.622 1.193-4.35a4.436 4.436 0 00-1.96-3.04 5.15 5.15 0 00-2.95-.938zm.033.532h13.97a4.617 4.617 0 012.649.843.266.266 0 00.007.005 3.903 3.903 0 011.728 2.682.266.266 0 00.003.01c.304 1.58-.133 2.93-1.053 3.888s-2.338 1.522-4.024 1.461a.266.266 0 00-.276.268c0 .432-.034 1.032-.264 1.555-.227.519-.625.963-1.43 1.17h-.395a.266.266 0 00-.005 0c-3.048.064-9.48.063-9.48.063a.266.266 0 00-.002 0A1.823 1.823 0 01.612 14.25C.486 10.89.55 4.718.55 4.718a.266.266 0 000-.002v-.178a.545.545 0 01.467-.51zm13.271 1.886a.266.266 0 00-.266.268v4.583a.266.266 0 00.26.266c.48.012.961-.009 1.439-.065a.266.266 0 00.027-.005 2.4 2.4 0 001.86-2.557 2.535 2.535 0 00-.564-1.622 2.178 2.178 0 00-1.81-.868zm.267.534h.688a.266.266 0 00.009 0 1.643 1.643 0 011.37.656.266.266 0 00.006.01c.297.364.457.822.45 1.292a.266.266 0 00.002.03 1.862 1.862 0 01-1.443 2.002c-.359.041-.72.048-1.081.048z\"/></svg>";

var iconNew = "<svg version=\"1.1\" viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m2 6v20h24.1l4.05-7.2v-5.13l-4.96-7.68z\" fill=\"#fff\" stroke-width=\"0\"/>\n <path d=\"m31.4 13.9-5-8c-0.73-1.17-2.01-1.88-3.39-1.88h-19c-2.21 0-4 1.79-4 4v16c0 2.21 1.79 4 4 4h19c1.38 0 2.66-0.711 3.39-1.88l5-8c0.812-1.3 0.812-2.94 0-4.24zm-1.7 3.18-5 8c-0.367 0.588-1 0.939-1.7 0.939h-19c-1.1 0-2-0.898-2-2v-16c0-1.1 0.897-2 2-2h19c0.693 0 1.33 0.352 1.7 0.939l5 8c0.403 0.645 0.403 1.48 0 2.12z\" fill=\"#a10000\"/>\n <path d=\"m26.9 12-2.14 8h-1.51l-1.59-5.88-1.45 5.88h-1.48l-2.19-8h1.53l1.55 5.83 1.44-5.83h1.46l1.59 5.83 1.52-5.83zm-10.8 8h-5.2v-8h5.14v1.19h-3.7v2.17h2.98v1.16h-2.98v2.24h3.76zm-6.96 0h-1.4l-3.04-5.11q-0.0703-0.117-0.229-0.381-0.0703-0.117-0.217-0.369v5.86h-1.16v-8h1.59l2.8 4.71q0.0352 0.0586 0.51 0.861v-5.57h1.14z\" fill=\"#a10000\"/>\n</svg>\n";
var iconNew = "<svg version=\"1.1\" viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"m2 6v20h24.1l4.05-7.2v-5.13l-4.96-7.68z\" fill=\"#fff\" stroke-width=\"0\"/>\r\n <path d=\"m31.4 13.9-5-8c-0.73-1.17-2.01-1.88-3.39-1.88h-19c-2.21 0-4 1.79-4 4v16c0 2.21 1.79 4 4 4h19c1.38 0 2.66-0.711 3.39-1.88l5-8c0.812-1.3 0.812-2.94 0-4.24zm-1.7 3.18-5 8c-0.367 0.588-1 0.939-1.7 0.939h-19c-1.1 0-2-0.898-2-2v-16c0-1.1 0.897-2 2-2h19c0.693 0 1.33 0.352 1.7 0.939l5 8c0.403 0.645 0.403 1.48 0 2.12z\" fill=\"#a10000\"/>\r\n <path d=\"m26.9 12-2.14 8h-1.51l-1.59-5.88-1.45 5.88h-1.48l-2.19-8h1.53l1.55 5.83 1.44-5.83h1.46l1.59 5.83 1.52-5.83zm-10.8 8h-5.2v-8h5.14v1.19h-3.7v2.17h2.98v1.16h-2.98v2.24h3.76zm-6.96 0h-1.4l-3.04-5.11q-0.0703-0.117-0.229-0.381-0.0703-0.117-0.217-0.369v5.86h-1.16v-8h1.59l2.8 4.71q0.0352 0.0586 0.51 0.861v-5.57h1.14z\" fill=\"#a10000\"/>\r\n</svg>\r\n";

const versionToString = (version) => version.split(".").slice(0, 2).join("-");
const currentVersion = settings.get('options.version') || '0';
Expand Down Expand Up @@ -2591,24 +2591,7 @@
return JSON.parse(document.body.dataset[prefix(key)]);
}
getSyncData() {
let puzzleId = window.gameData.today.id.toString();
let gameData;
let lsKeysFiltered = Object.keys(localStorage).filter((key) => /^games-state-spelling_bee\/(\d+|ANON)$/.test(key));
if (!lsKeysFiltered.length) {
return [];
}
if (/nyt-auth-action=logout/.test(document.cookie)) {
return [];
}
gameData = JSON.parse(localStorage.getItem(lsKeysFiltered.shift()) || "{}");
if (!gameData.states) {
return [];
}
gameData.states = gameData.states.filter((item) => item.puzzleId === puzzleId);
if (!gameData.states.length) {
return [];
}
return gameData.states.shift().data.answers || [];
return Array.from(fn.$$('li', this.resultList)).map(li => li.textContent.trim());
}
envIs(env) {
return document.body.classList.contains("pz-" + env);
Expand All @@ -2632,9 +2615,9 @@
load() {
fn.waitFor(".sb-wordlist-items-pag", this.gameWrapper).then((resultList) => {
this.observer = this.buildObserver();
data.init(this, this.getSyncData());
this.modalWrapper = fn.$("#portal-game-modals .sb-modal-wrapper", this.gameWrapper);
this.resultList = resultList;
data.init(this, this.getSyncData());
this.add();
this.domSet("active", true);
shortcutRegistry.add(this.shortcut);
Expand Down
2 changes: 1 addition & 1 deletion build/spelling-bee-assistant.min.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spelling-bee-assistant",
"version": "5.0.0",
"version": "5.0.1",
"description": "Spelling Bee Assistant is an add-on for Spelling Bee, the New York Times’ popular word puzzle",
"main": "index.js",
"type": "module",
Expand Down
32 changes: 4 additions & 28 deletions src/js/modules/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,36 +53,12 @@ class App extends Widget {
}

/**
* Retrieve sync data from local storage
* Retrieve sync data from DOM
* @param {HTMLElement} resultsList
* @returns {Array}
*/
getSyncData() {
let puzzleId = window.gameData.today.id.toString();
let gameData;
let lsKeysFiltered = Object.keys(localStorage).filter((key) => /^games-state-spelling_bee\/(\d+|ANON)$/.test(key));

// if the user has never been logged in, e.g. in an incognito window
if (!lsKeysFiltered.length) {
return [];
}

// At this point the user is either logged or has been logged in at some point.
// `nyt-auth-action=logout` indicates, the user was logged in but is no longer
if (/nyt-auth-action=logout/.test(document.cookie)) {
return [];
}

gameData = JSON.parse(localStorage.getItem(lsKeysFiltered.shift()) || "{}");
if (!gameData.states) {
return [];
}

gameData.states = gameData.states.filter((item) => item.puzzleId === puzzleId);
if (!gameData.states.length) {
return [];
}

return gameData.states.shift().data.answers || [];
return Array.from(fn.$$('li', this.resultList)).map(li => li.textContent.trim());
}

/**
Expand Down Expand Up @@ -123,9 +99,9 @@ class App extends Widget {
fn.waitFor(".sb-wordlist-items-pag", this.gameWrapper).then((resultList) => {
// Observe game for various changes
this.observer = this.buildObserver();
data.init(this, this.getSyncData());
this.modalWrapper = fn.$("#portal-game-modals .sb-modal-wrapper", this.gameWrapper);
this.resultList = resultList;
data.init(this, this.getSyncData());

this.add();
this.domSet("active", true);
Expand Down