From a4847a7c5e27547a365e132069ba87b8287fbea8 Mon Sep 17 00:00:00 2001 From: lauri457 <55710064+lauri457@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:44:39 +1000 Subject: [PATCH 1/4] Create gFormModal.js --- .../Open g_form modal/gFormModal.js | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 Specialized Areas/Browser Bookmarklets/Open g_form modal/gFormModal.js diff --git a/Specialized Areas/Browser Bookmarklets/Open g_form modal/gFormModal.js b/Specialized Areas/Browser Bookmarklets/Open g_form modal/gFormModal.js new file mode 100644 index 0000000000..3dcaf19ccf --- /dev/null +++ b/Specialized Areas/Browser Bookmarklets/Open g_form modal/gFormModal.js @@ -0,0 +1,193 @@ +(function () { + const makeDraggable = (element, cleanupHandlers) => { + let isDragging = false; + let offsetX = 0; + let offsetY = 0; + + const header = document.createElement('div'); + header.style.cursor = 'move'; + header.style.height = '20px'; + header.style.marginBottom = '10px'; + header.style.background = "rgba(100, 100, 100, 0.3)"; + header.style.borderRadius = "8px"; + element.prepend(header); + + const mouseMoveHandler = (e) => { + if (isDragging) { + element.style.left = `${e.clientX - offsetX}px`; + element.style.top = `${e.clientY - offsetY}px`; + element.style.position = 'absolute'; + } + }; + + const mouseUpHandler = () => { + isDragging = false; + document.body.style.userSelect = ''; + }; + + header.addEventListener('mousedown', (e) => { + isDragging = true; + offsetX = e.clientX - element.offsetLeft; + offsetY = e.clientY - element.offsetTop; + document.body.style.userSelect = 'none'; + }); + + document.addEventListener('mousemove', mouseMoveHandler); + document.addEventListener('mouseup', mouseUpHandler); + + cleanupHandlers.push(() => { + document.removeEventListener('mousemove', mouseMoveHandler); + document.removeEventListener('mouseup', mouseUpHandler); + }); + }; + + const createOverlay = (g_form, fieldArray) => { + const overlay = document.createElement('div'); + overlay.id = "gform-modal-overlay"; + overlay.style.position = 'fixed'; + overlay.style.top = 0; + overlay.style.left = 0; + overlay.style.width = '100vw'; + overlay.style.height = '100vh'; + overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.6)'; + overlay.style.zIndex = 9999; + overlay.style.display = 'flex'; + overlay.style.justifyContent = 'center'; + overlay.style.alignItems = 'center'; + + + const container = document.createElement('div'); + container.id = "modal-container"; + container.style.background = '#fff'; + container.style.padding = '20px'; + container.style.borderRadius = '8px'; + container.style.boxShadow = '0 0 10px rgba(0,0,0,0.3)'; + container.style.maxWidth = '1000px'; + container.style.textAlign = 'center'; + container.style.maxHeight = '70vh'; + + const modal = document.createElement('div'); + modal.style.overflowY = 'auto'; + modal.style.overflowX = 'hidden'; + modal.style.maxHeight = '60vh'; + container.appendChild(modal) + + let listItems = ''; + fieldArray.forEach(element => { + const fieldName = element.fieldName; + const isReadOnly = g_form.isReadOnly(fieldName); + const isMandatory = g_form.isMandatory(fieldName); + const isVisible = g_form.isVisible(fieldName); + + listItems += ` +
| Field | +ReadOnly | +Mandatory | +Display | +Value | ++ |
|---|
| Field | \nReadOnly | \nMandatory | \nDisplay | \nValue | \n\n |
|---|
_RZ8Zr?w6ciMijI=lq3JSpk3JTT;5&pw+YsP~8@dNDwloExi
zo*+5;7<{r2kr#o2s*OW=F@pOTBRNWIxj;do_y6YuJ?v0w3I+8JmJt_G_0&IIyB8x~
zXhL|ZK|V&r?9@;}8`=!^0nPYqyEtEXU6eeBuXgWsxm;MuD0n-O@SU#>72mImeEFKs
zxUOG_g-Fl57}%>%ZV}8*0W!b4)v8}m$IX2;CW~PiA~5-XzM8-yX7G9QB1X&uPL8Q8
zP2XAB>RH&?zjXhc(WT(uiv~AVocICGc{nwIdXuoHeUy54yvFf8k*Ela8jFN7zML|5`)p8fL
z+}Tutc7wpMI2agWZDImqpY
L^XPz9C`MlSxjOq@x?`)KA_hf%EdQ9=N2xF2ody{vGz_KSZb
z=Dy^%ln9&Fv9$p~R7sp%3Kz3seE$<)MxJypO`UJwYNc`5I>)s{*r4ltB&vDB=V}{^
zLQ|T2)+IO-pud5<+!l##sPS5VR@?3^tSKGon+c*i5oCGG8l5m7vjm?8p5x^^x_Tl!
z1w!}sp^G{Di3m**USq9Jc