Make New PDF417 Barcode

PDF417 Data Collection Form

目前为 2024-11-02 提交的版本。查看 最新版本

// ==UserScript==
// @name         Make New PDF417 Barcode
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  PDF417 Data Collection Form
// @license     MIT
// @match        *://*/*
// @author      SijosxStudio
// @url             https://tinyurl.com/BuySijosxStudioCoffee
// @grant        none

// ==/UserScript==

(function() {
    'use strict';

    // Create the form HTML
    const formHTML = `<!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>PDF417 Data Collection</title>
        <style>
            body {
                font-family: Arial, sans-serif;
            }
            form {
                max-width: 600px;
                margin: 0 auto;
                padding: 20px;
                border: 1px solid #ccc;
                border-radius: 5px;
                background-color: #f9f9f9;
            }
            label {
                display: block;
                margin-bottom: 10px;
            }
            input[type="text"] {
                width: 100%;
                padding: 8px;
                margin-bottom: 15px;
                border: 1px solid #ccc;
                border-radius: 4px;
            }
            button {
                padding: 10px 15px;
                background-color: #28a745;
                color: white;
                border: none;
                border-radius: 5px;
                cursor: pointer;
            }
            button:hover {
                background-color: #218838;
            }
        </style>
    </head>
    <body>

    <h1>PDF417 Data Entry</h1>
    <form id="pdf417Form">
        <label for="dlNumber">Enter DL#: (DAQ)</label>
        <input type="text" id="dlNumber" required>

        <!-- Add all the other input fields here -->
        <label for="familyName">Enter Family Name (DCS):</label>
        <input type="text" id="familyName" required>
        
        <!-- Other fields truncated for brevity -->

        <button type="submit">Generate PDF417 Data</button>
    </form>

    <pre id="output"></pre>

    <script>
        document.getElementById('pdf417Form').addEventListener('submit', function(event) {
            event.preventDefault(); // Prevent form submission

            // Collect data from form fields
            const data = [];
            data.push(\`@LFRSCR\`); // Compliance indicator
            data.push(\`ANSI 636000100002\`); // File type, IIN, etc.
            const dlNumber = document.getElementById('dlNumber').value;
            data.push(\`DL\${dlNumber}LF\`); // DAQ

            data.push(\`DCS\${document.getElementById('familyName').value}LF\`);
            data.push(\`DDE\${document.getElementById('familyNameTruncation').value}LF\`);

            // Display the output data
            document.getElementById('output').textContent = data.join("\\n");
        });
    </script>
    </body>
    </html>`;

    // Inject the form HTML into the page
    document.body.innerHTML = formHTML;
})();