|
7 | 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. |
8 | 8 |
|
9 | 9 | (function(message, doc) { |
10 | | - var nIntervId; |
| 10 | + var nIntervId; // |
11 | 11 |
|
12 | 12 | // One year = 31536000000 milliseconds. |
13 | 13 | const FRESHNESS_INTERVAL = 365 * 24 * 60 * 60 * 1000; |
|
21 | 21 | var textarea = doc.querySelector('textarea[name="message"]'); |
22 | 22 | // no point in being around if this is nil; also: avoids crashing below (gwyneth 20220303) |
23 | 23 | if (!textarea) { |
24 | | - console.warn("no phpBB3 textarea found"); |
| 24 | + console.warn("no phpBB3 content body textarea found"); |
25 | 25 | return; |
26 | 26 | } |
27 | 27 | // phpBB3 usually gives the subject/topic the name 'subject' — same for QR and normal replies. |
28 | 28 | var subject = doc.querySelector('input[name="subject"]'); |
29 | 29 | if (!subject) { |
30 | | - console.debug("no phpBB3 subject found"); |
31 | | - // I have not decided what to do in this case! |
| 30 | + console.debug("no phpBB3 subject line found"); |
| 31 | + // I have not decided what to do in this case! Possibly just: |
| 32 | + // subject = "(no subject)"; |
32 | 33 | } |
33 | 34 | // The key for the key/value pair in localStorage is the current URL. |
34 | 35 | var key = message.location.href; |
|
93 | 94 | if (textarea.value) { |
94 | 95 | item = JSON.stringify({ "content": textarea.value, "subject": (subject?.value ?? ""), "timestamp": Date.now() }); |
95 | 96 | message.localStorage.setItem(key, item); |
96 | | - console.debug("Existing text saved to localStorage"); |
| 97 | + console.debug("Existing subject & content saved to localStorage"); |
97 | 98 | } else { |
98 | 99 | message.localStorage.removeItem(key); |
99 | | - console.debug("Empty textarea -- remove existing text in localStorage"); |
| 100 | + console.debug("Empty textarea -- remove existing content & subject in localStorage"); |
100 | 101 | } |
101 | 102 | // This event listener is no longer needed now so remove it. |
102 | 103 | // Once the user presses another key, it will be added again! |
|
0 commit comments