Skip to content

Commit 179d379

Browse files
Bug: fix Firefox adds #preview to URL with backspc
Weird bug reported (and fixed) by @gvp9000; @see https://www.phpbb.com/customise/db/extension/postlocalstorage/support/topic/246616?p=877324#p877324
1 parent a5e2c20 commit 179d379

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
For a _much_ more detailed version, see the [commit history] on GitHub.
44

5+
## 1.0.4
6+
7+
- Fix the weirdest bug found on Firefox. Kudos to @gvp9000 for the fix!
8+
59
## 1.0.3
610

711
- Add functioning version check

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ There is no further configuration required.
3131
Many thanks to
3232
[@Tread](https://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=1973496) and [@cabot](https://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=1337922) for gently 'persuading' me to publish this code as a phpBB3.3 extension, by pointing me to all the appropriate bits and pieces of code to be 'assembled' into an extension. Yay!
3333

34+
Kudos to [@gvp9000](https://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=2227069) for finding & fixing an obscure bug that affects Firefox.
35+
3436
Logo designed by [DALL·E 2](https://openai.com/product/dall-e-2).
3537

3638
![phpBB3 Logo](https://img.shields.io/badge/phpBB-3.3-blue) [![CodeQL](https://github.com/GwynethLlewelyn/post-local-storage/actions/workflows/codeql.yml/badge.svg)](https://github.com/GwynethLlewelyn/post-local-storage/actions/workflows/codeql.yml) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/83a20d04433341baa65c78d29fc3410a)](https://www.codacy.com/gh/GwynethLlewelyn/post-local-storage/dashboard?utm_source=github.com&utm_medium=referral&utm_content=GwynethLlewelyn/post-local-storage&utm_campaign=Badge_Grade) [![Codacy Security Scan](https://github.com/GwynethLlewelyn/post-local-storage/actions/workflows/codacy.yml/badge.svg)](https://github.com/GwynethLlewelyn/post-local-storage/actions/workflows/codacy.yml) [![Liberapay](https://img.shields.io/liberapay/receives/GwynethLlewelyn.svg?logo=liberapay")](https://liberapay.com/GwynethLlewelyn/donate)

gwynethllewelyn/postlocalstorage/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"type": "phpbb-extension",
44
"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.",
55
"homepage": "https://github.com/GwynethLlewelyn/post-local-storage",
6-
"version": "1.0.3",
7-
"time": "2023-03-12",
6+
"version": "1.0.4",
7+
"time": "2024-04-14",
88
"license": "GPL-2.0-only",
99
"keywords": [
1010
"phpbb",

gwynethllewelyn/postlocalstorage/styles/all/template/custom_functions.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2023 Gwyneth Llewelyn
1+
// Copyright (C) 2023,2024 Gwyneth Llewelyn
22
//
33
// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2.
44
//
@@ -15,7 +15,14 @@
1515
if (!textarea) return;
1616
// The key for the key/value pair in localStorage is the current URL.
1717
var key = message.location.href;
18-
var item = null;
18+
// Firefox seems to have an odd bug which affects clicking backspace in quick succession.
19+
// Kudos to @gvp9000 and for the fix below. (gwyneth 20240414)
20+
// @see
21+
var count_hash_num = key.split("#").length - 1;
22+
for (let i = 0; i < count_hash_num - 1; i++) {
23+
key = key.substring(0, key.lastIndexOf('#'));
24+
}
25+
var item = null; var item = null;
1926
// Use the 'pagehide' event in modern browsers or 'beforeunload' in older browsers.
2027
var unloadEvent;
2128
if ("onpagehide" in message) {

version_check.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"stable": {
33
"1.0": {
4-
"current": "1.0.3",
5-
"download": "https:\/\/github.com\/GwynethLlewelyn\/post-local-storage\/releases\/download\/v1.0.3\/postlocalstorage.zip",
4+
"current": "1.0.4",
5+
"download": "https:\/\/github.com\/GwynethLlewelyn\/post-local-storage\/releases\/download\/v1.0.4\/postlocalstorage.zip",
66
"announcement": "https:\/\/www.phpbb.com\/customise\/db\/extension\/postlocalstorage\/",
77
"eol": null,
88
"security": false

0 commit comments

Comments
 (0)