PageSourceSearch

https://xgm.guru/public/mjs/79df25d1/ui/form.js

js xgm.guru collected 2026-09-24 10:34:19 UTC 1,037 bytes, 30 lines download raw bytes

1export const Form = {
2    /**
3     * @param {HTMLTextAreaElement} textarea
4     * @param {string} text
5     * @param {boolean} resetsel
6     * @param {boolean} newline
7     */
8    insertText: (textarea, text, {resetsel = false, newline = false} = {}) => {
9        if (newline && textarea.value.charAt(textarea.selectionStart + 1) !== '\n') text += '\n'
10        textarea.focus()
11        let newText = textarea.value.substring(0, textarea.selectionStart)
12        newText += text
13        newText += textarea.value.substring(textarea.selectionEnd)
14        const oldPos = textarea.scrollTop
15        const oldStart = textarea.selectionStart
16        textarea.value = newText
17        textarea.scrollTop = oldPos
18        textarea.selectionStart = oldStart
19        textarea.selectionEnd = oldStart + text.length - 1
20        if (resetsel) textarea.selectionStart = textarea.selectionEnd
21    },
22
23    /**
24     * @param {string} username
25     * @returns {string}
26     */
27    constructUserLink: username =>
28        '@'+username.replaceAll(' ', '+')
29}
30

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.