Skip to content

Commit 4e6b07d

Browse files
Add logo (first version)
1 parent 63b4909 commit 4e6b07d

File tree

7 files changed

+144
-0
lines changed

7 files changed

+144
-0
lines changed

.editorconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
charset = utf-8
8+
indent_style = tab
9+
indent_size = tab
10+
tab_width = 4
11+
trim_trailing_whitespace = true
12+
13+
# The property below is not yet universally supported
14+
[*.md]
15+
max_line_length = 108
16+
word_wrap = true
17+
# Markdown sometimes uses two spaces at the end to
18+
# mark soft line breaks
19+
trim_trailing_whitespace = false
20+
21+
[*.css]
22+
indent_style = space
23+
indent_size = 2
24+
25+
# Linden Scripting Language abhors tabs
26+
[*.lsl]
27+
max_line_length = 108
28+
indent_style = space
29+
indent_size = 4

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
~*
2+
# Stupid macOS temporary files
3+
4+
# General
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
9+
# Icon must end with two \r
10+
Icon
11+
12+
13+
Icon?
14+
15+
# Thumbnails
16+
._*
17+
18+
# Files that might appear in the root of a volume
19+
.DocumentRevisions-V100
20+
.fseventsd
21+
.Spotlight-V100
22+
.TemporaryItems
23+
.Trashes
24+
.VolumeIcon.icns
25+
.com.apple.timemachine.donotpresent
26+
27+
# Directories potentially created on remote AFP share
28+
.AppleDB
29+
.AppleDesktop
30+
Network Trash Folder
31+
Temporary Items
32+
.apdisk
33+
34+
# Stuff from the Nova editor
35+
.nova
36+
node_modules
37+
package.json
38+
package-lock.json
39+
.eslintrc.yml
40+
.prettierrc.json
41+
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "gwynethllewelyn/postlocalstorage",
3+
"type": "phpbb-extension",
4+
"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.",
5+
"homepage": "https://gwynethllewelyn.net",
6+
"version": "1.0.0",
7+
"keywords": [
8+
"phpbb",
9+
"extension",
10+
"local storage"
11+
],
12+
"license": "MIT",
13+
"authors": [
14+
{
15+
"name": "gwynethllewelyn",
16+
"homepage": "https://gwynethllewelyn.net",
17+
"role": "Overall Coordination"
18+
}
19+
],
20+
"require": {
21+
"php": ">=8.2",
22+
"composer/installers": "~1.0.0",
23+
"phpbb/phpbb": ">=3.3"
24+
},
25+
"extra": {
26+
"display-name": "Locally store the content of a post",
27+
"soft-require": {
28+
"phpbb/phpbb": ">=3.3"
29+
}
30+
}
31+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
(function (message, doc) {
2+
// Cut the mustard.
3+
if (!message.localStorage) return;
4+
// You should probably use a more specific selector than this.
5+
var textarea = doc.querySelector('textarea');
6+
// The key for the key/value pair in localStorage is the current URL.
7+
var key = message.location.href;
8+
var item = null;
9+
// Use the 'pagehide' event in modern browsers or 'beforeunload' in older browsers.
10+
var unloadEvent;
11+
if ('onpagehide' in message) {
12+
unloadEvent = 'pagehide';
13+
} else {
14+
unloadEvent = 'beforeunload';
15+
}
16+
// If there's a localStorage entry for the current URL, update the textarea with the saved value.
17+
item = message.localStorage.getItem(key);
18+
if (item) {
19+
var data = JSON.parse(item);
20+
textarea.value = data.content;
21+
}
22+
// This function will store the current value of the textarea in localStorage (or delete it if the textarea is blank).
23+
function updateStorage() {
24+
if (textarea.value) {
25+
item = JSON.stringify({'content': textarea.value});
26+
message.localStorage.setItem(key, item);
27+
} else {
28+
message.localStorage.removeItem(key);
29+
}
30+
// This event listener is no longer needed now so remove it.
31+
message.removeEventListener(unloadEvent, updateStorage);
32+
}
33+
// When the user presses a key just *once* inside the textarea, run the storage function when the page is unloaded.
34+
textarea.addEventListener('keyup', function() {
35+
message.addEventListener(unloadEvent, updateStorage);
36+
message.setInterval(updateStorage, 10000);
37+
}, {'once': true});
38+
// When the form is submitted, delete the localStorage key/value pair.
39+
textarea.form.addEventListener('submit', function() {
40+
message.localStorage.removeItem(key);
41+
message.removeEventListener(unloadEvent, updateStorage);
42+
});
43+
}(this, this.document));

post-local-storage-logo.png

422 KB
Loading

post-local-storage-logo.psd

3.06 MB
Binary file not shown.

version_check.json

Whitespace-only changes.

0 commit comments

Comments
 (0)