Skip to content

Commit

Permalink
Fix: implement some proposed changes by validators
Browse files Browse the repository at this point in the history
  • Loading branch information
GwynethLlewelyn committed Apr 15, 2024
1 parent 179d379 commit e71adba
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

For a _much_ more detailed version, see the [commit history] on GitHub.
For a _much_ more detailed version, see the [commit history](https://github.com/GwynethLlewelyn/post-local-storage/commits/master/) on GitHub.

## 1.0.5
- Renamed `custom_functions.js` to `postlocalstorage_functions.js` as per validation suggestion
- Fix bad JSON indentation on `version_check.json` which prevented version checking from working at all

## 1.0.4

Expand Down
17 changes: 8 additions & 9 deletions gwynethllewelyn/postlocalstorage/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"type": "phpbb-extension",
"description": "A very simple phpBB3 extension to locally store the content of a post being written, to avoid losing everything after a crash or session expiration.",
"homepage": "https://github.com/GwynethLlewelyn/post-local-storage",
"version": "1.0.4",
"time": "2024-04-14",
"version": "1.0.5",
"time": "2024-04-15",
"license": "GPL-2.0-only",
"keywords": [
"phpbb",
Expand All @@ -31,13 +31,12 @@
"display-name": "Post Local Storage",
"soft-require": {
"phpbb/phpbb": ">=3.3"
},
"version-check": {
"host": "raw.githubusercontent.com",
"directory": "/GwynethLlewelyn/post-local-storage/master",
"filename": "version_check.json",
"ssl": true
}
},
"version-check":
{
"host": "raw.githubusercontent.com",
"directory": "/GwynethLlewelyn/post-local-storage/master",
"filename": "version_check.json",
"ssl": true
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% INCLUDEJS '@gwynethllewelyn_postlocalstorage/custom_functions.js' %}
{% INCLUDEJS '@gwynethllewelyn_postlocalstorage/postlocalstorage_functions.js' %}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
// You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

(function (message, doc) {
(function(message, doc) {
// If there is no localStorage support, give up
if (!message.localStorage) return;
// phpBB3 uses a textarea with id and name 'message'
Expand All @@ -17,12 +17,13 @@
var key = message.location.href;
// Firefox seems to have an odd bug which affects clicking backspace in quick succession.
// Kudos to @gvp9000 and for the fix below. (gwyneth 20240414)
// @see
// @see https://www.phpbb.com/customise/db/extension/postlocalstorage/support/topic/246616?p=877324#p877324
var count_hash_num = key.split("#").length - 1;
for (let i = 0; i < count_hash_num - 1; i++) {
key = key.substring(0, key.lastIndexOf('#'));
}
var item = null; var item = null;
var item = null;
var item = null;
// Use the 'pagehide' event in modern browsers or 'beforeunload' in older browsers.
var unloadEvent;
if ("onpagehide" in message) {
Expand Down Expand Up @@ -50,15 +51,14 @@
// When the user presses a key just *once* inside the textarea, run the storage function when the page is unloaded.
textarea.addEventListener(
"keyup",
function () {
function() {
message.addEventListener(unloadEvent, updateStorage);
message.setInterval(updateStorage, 10000);
},
{ once: true }
}, { once: true }
);
// When the form is submitted, delete the localStorage key/value pair.
textarea.form.addEventListener("submit", function () {
textarea.form.addEventListener("submit", function() {
message.localStorage.removeItem(key);
message.removeEventListener(unloadEvent, updateStorage);
});
})(this, this.document);
})(this, this.document);
4 changes: 2 additions & 2 deletions version_check.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"stable": {
"1.0": {
"current": "1.0.4",
"download": "https:\/\/github.com\/GwynethLlewelyn\/post-local-storage\/releases\/download\/v1.0.4\/postlocalstorage.zip",
"current": "1.0.5",
"download": "https:\/\/github.com\/GwynethLlewelyn\/post-local-storage\/releases\/download\/v1.0.5\/postlocalstorage.zip",
"announcement": "https:\/\/www.phpbb.com\/customise\/db\/extension\/postlocalstorage\/",
"eol": null,
"security": false
Expand Down

0 comments on commit e71adba

Please sign in to comment.