diff --git a/CHANGELOG.md b/CHANGELOG.md index c696243..39383ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,33 @@ Changelog ------------ - +[v0.0.2] - 2020-05-19 +--------------------- +[GitHub Release Page](https://github.com/ToranSharma/Xporcle-Extension/releases/tag/v0.0.2) +### Added +- Gecko browser specific settings extension ID for future Firefox storage API + support. +- Sending of a connection closed message from the background script to the + content script. +- Corresponding connection close message handing in the content script. +- Handling of quiz finished message to update internal state of the background + script. + +### Fixed +- Handling of changing page while a quiz is being played. +- Resetting of internal state variables in background script. +- Missing declaration of interfaceContainer. +- Width of interfaceBox to account for differing scroll bar size in Firefox. +- Handling of start quiz messages when quiz is already running. This only really + affects the host of a room. +- Clipboard writing to support Firefox. + +### Changed +- Content script renamed from script.js to xporcle.js. + +### Removed +- Debugging console messages from content and background scripts. + [v0.0.1] - 2020-05-18 --------------------- [GitHub Release Page](https://github.com/ToranSharma/Xporcle-Extension/releases/tag/v0.0.1) @@ -20,4 +47,5 @@ Changelog - Options page popup placeholder. [Unreleased]: https://github.com/ToranSharma/Xporcle-Extension/compare/master...develop -[v0.0.1]: https://github.com/ToranSharma/Xporcle-Extension/releases/tag/v1.0.0 +[v0.0.2]: https://github.com/ToranSharma/Xporcle-Extension/compare/v0.0.1...v0.0.2 +[v0.0.1]: https://github.com/ToranSharma/Xporcle-Extension/releases/tag/v0.0.1 diff --git a/background.js b/background.js index ceeeeb4..3565bd2 100644 --- a/background.js +++ b/background.js @@ -39,18 +39,14 @@ let playing = null; chrome.runtime.onConnect.addListener( (port) => { - console.log("Page connecting"); if (port.name === "messageRelay") { messagePort = port; port.onMessage.addListener( (message) => { - console.log("Page sent a message"); - console.log(message); if (message.type === "connectionStatus") { - console.log("Page is asking about the connection status"); // Request to see if we are still connected to a room if (ws !== null) { @@ -84,7 +80,7 @@ chrome.runtime.onConnect.addListener( if (message.type === "live_scores_update") { - playing = message["playing"] + playing = !message["finished"] } } } @@ -94,7 +90,6 @@ chrome.runtime.onConnect.addListener( port.onDisconnect.addListener( () => { - console.log("page disconnected"); messagePort = null; if (playing) @@ -112,8 +107,6 @@ chrome.runtime.onConnect.addListener( function startConnection(initialMessage) { - console.log("Connecting to server"); - username = initialMessage.username; if (initialMessage["code"] !== undefined) @@ -129,7 +122,8 @@ function startConnection(initialMessage) }; ws.onclose = (event) => { - console.log("connection closed"); + if (messagePort != null) + messagePort.postMessage({type: "connection_closed"}); reset(); }; ws.onopen = (event) => @@ -143,7 +137,6 @@ function startConnection(initialMessage) function forwardMessage(event) { const message = JSON.parse(event.data); - console.log(message); messageType = message["type"]; @@ -159,13 +152,16 @@ function forwardMessage(event) } else if (messageType === "scores_update") { - playing = false; - Object.assign(scores, message["scores"]); + scores = message["scores"]; } else if (messageType === "start_quiz") { playing = true; } + else if (messageType === "quiz_finished") + { + playing = false; + } else if (messageType === "url_update") { urls[message["username"]] = message["url"]; @@ -195,4 +191,8 @@ function reset() ws = null; username = null; roomCode = null; + host = null; + scores = {}; + urls = {}; + playing = null; } diff --git a/manifest.json b/manifest.json index 0a2d6e1..c78bea7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name" : "Xporcle", "description" : "Adds real-time multiplayer abilities to Sporcle.com", - "version" : "0.0.1", + "version" : "0.0.2", "manifest_version" : 2, "icons" : { @@ -32,7 +32,7 @@ "content_scripts" : [ { "matches" : ["https://www.sporcle.com/*"], - "js" : ["script.js"] + "js" : ["xporcle.js"] } ], @@ -42,4 +42,12 @@ "page" : "options.html", "open_in_tab" : false } + , + "browser_specific_settings": + { + "gecko": + { + "id": "Xporcle@toransharma.com" + } + } } diff --git a/options.html b/options.html index d2b8acf..882fd7c 100644 --- a/options.html +++ b/options.html @@ -5,7 +5,7 @@