Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Attempt to prevent forum FORM elements from a double-submit via stray double-clicks on the various submit buttons, as reported in forum post 6bd02466533aa131. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
600f171306d29f398e685bdf9713e1ff |
User & Date: | stephan 2023-10-24 20:27:52 |
Context
2023-10-24
| ||
20:53 | Remove stray JS console debug output. No functional changes. ... (check-in: 03bb48a3 user: stephan tags: trunk) | |
20:27 | Attempt to prevent forum FORM elements from a double-submit via stray double-clicks on the various submit buttons, as reported in forum post 6bd02466533aa131. ... (check-in: 600f1713 user: stephan tags: trunk) | |
12:04 | Update the built-in SQLite to the first 3.44.0 beta, for testing. ... (check-in: 39bcd310 user: drh tags: trunk) | |
Changes
Changes to src/fossil.page.forumpost.js.
1 2 | (function(F/*the fossil object*/){ "use strict"; | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | (function(F/*the fossil object*/){ "use strict"; /* JS code for /forumpost and friends. Requires fossil.dom and can optionally use fossil.pikchr. */ const P = F.page, D = F.dom; /** When the page is loaded, this handler does the following: - Installs expand/collapse UI elements on "long" posts and collapses them. - Any pikchr-generated SVGs get a source-toggle button added to them which activates when the mouse is over the image or it is tapped. This is a harmless no-op if the current page has neither forum post constructs for (1) nor any pikchr images for (2), nor will NOT running this code cause any breakage for clients with no JS support: this is all "nice-to-have", not required functionality. |
︙ | ︙ | |||
97 98 99 100 101 102 103 | rightTapZone.addEventListener('click', widgetEventHandler, false); refillTapZone(); })/*F.onPageLoad()*/; if(F.pikchr){ F.pikchr.addSrcView(); } | | > > > > > > > | > > > > > > > > > > > > | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | rightTapZone.addEventListener('click', widgetEventHandler, false); refillTapZone(); })/*F.onPageLoad()*/; if(F.pikchr){ F.pikchr.addSrcView(); } /* Attempt to keep stray double-clicks from double-posting. */ const formSubmitted = function(event){ const form = event.target; if( form.dataset.submitted ){ console.warn("Preventing double-submit."); event.preventDefault(); return; } form.dataset.submitted = '1'; /** If the user is left waiting "a long time," disable the resubmit protection. If we don't do this and they tap the browser's cancel button while waiting, they'll be stuck with an unsubmittable form. */ setTimeout(()=>{delete form.dataset.submitted}, 7000); return; }; document.querySelectorAll("form").forEach(function(form){ form.addEventListener('submit',formSubmitted); }); })/*F.onPageLoad callback*/; })(window.fossil); |