Update se_mes_im_ran.html
Browse files- se_mes_im_ran.html +69 -67
    	
        se_mes_im_ran.html
    CHANGED
    
    | @@ -5,77 +5,77 @@ | |
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
             
                <title>Send Messages with Image</title>
         | 
| 7 | 
             
                <style>
         | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
|  | |
|  | |
| 67 | 
             
                </style>
         | 
| 68 | 
             
            </head>
         | 
| 69 | 
             
            <body>
         | 
| 70 | 
            -
                <h1 | 
| 71 | 
             
                <div class="input-row">
         | 
| 72 | 
             
                    <input type="text" id="apiKeyInput" placeholder="Введите API ключ">
         | 
| 73 | 
             
                    <input type="number" id="minDelayInput" placeholder="Min Delay (ms)" value="500">
         | 
| 74 | 
             
                    <input type="number" id="maxDelayInput" placeholder="Max Delay (ms)" value="1000">
         | 
| 75 | 
             
                </div>
         | 
| 76 | 
            -
                < | 
| 77 | 
            -
                <input type="text" id="fileNameInput" placeholder="Введите название файла">
         | 
| 78 | 
            -
                <textarea id="messageInput" placeholder="Введите текст сообщения с картинкой."></textarea>
         | 
| 79 | 
             
                <div id="progressBarContainer">
         | 
| 80 | 
             
                    <div id="progressBar">
         | 
| 81 | 
             
                        <div id="progress">0%</div>
         | 
| @@ -87,8 +87,8 @@ | |
| 87 | 
             
                <script>
         | 
| 88 | 
             
                    document.getElementById('sendButton').addEventListener('click', function() {
         | 
| 89 | 
             
                        const apiKey = document.getElementById('apiKeyInput').value;
         | 
| 90 | 
            -
                        const urlFile =  | 
| 91 | 
            -
                        const fileName =  | 
| 92 | 
             
                        const messageTemplate = document.getElementById('messageInput').value;
         | 
| 93 | 
             
                        const minDelay = parseInt(document.getElementById('minDelayInput').value) || 500;
         | 
| 94 | 
             
                        const maxDelay = parseInt(document.getElementById('maxDelayInput').value) || 10000;
         | 
| @@ -97,11 +97,11 @@ | |
| 97 | 
             
                            return;
         | 
| 98 | 
             
                        }
         | 
| 99 | 
             
                        if (!urlFile) {
         | 
| 100 | 
            -
                            alert(' | 
| 101 | 
             
                            return;
         | 
| 102 | 
             
                        }
         | 
| 103 | 
             
                        if (!fileName) {
         | 
| 104 | 
            -
                            alert(' | 
| 105 | 
             
                            return;
         | 
| 106 | 
             
                        }
         | 
| 107 | 
             
                        if (!messageTemplate) {
         | 
| @@ -118,6 +118,8 @@ | |
| 118 | 
             
                            alert('Please select a file.');
         | 
| 119 | 
             
                            return;
         | 
| 120 | 
             
                        }
         | 
|  | |
|  | |
| 121 | 
             
                        const reader = new FileReader();
         | 
| 122 | 
             
                        reader.onload = function(event) {
         | 
| 123 | 
             
                            const text = event.target.result;
         | 
|  | |
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
             
                <title>Send Messages with Image</title>
         | 
| 7 | 
             
                <style>
         | 
| 8 | 
            +
            body {
         | 
| 9 | 
            +
                font-family: Arial, sans-serif;
         | 
| 10 | 
            +
                text-align: center;
         | 
| 11 | 
            +
                background-color: #f0f0f0;
         | 
| 12 | 
            +
                margin: 0;
         | 
| 13 | 
            +
                padding: 0;
         | 
| 14 | 
            +
                max-height: 250px; /* Устанавливаем максимальную высоту страницы */
         | 
| 15 | 
            +
            }
         | 
| 16 | 
            +
            h1 {
         | 
| 17 | 
            +
                background-color: #4CAF50;
         | 
| 18 | 
            +
                color: white;
         | 
| 19 | 
            +
                padding: 20px;
         | 
| 20 | 
            +
                margin: 0;
         | 
| 21 | 
            +
                border-bottom: 2px solid #388E3C;
         | 
| 22 | 
            +
            }
         | 
| 23 | 
            +
            .input-row {
         | 
| 24 | 
            +
                display: flex;
         | 
| 25 | 
            +
                justify-content: center;
         | 
| 26 | 
            +
                gap: 10px;
         | 
| 27 | 
            +
                margin-top: 20px;
         | 
| 28 | 
            +
            }
         | 
| 29 | 
            +
            .input-row input, .input-row textarea {
         | 
| 30 | 
            +
                padding: 10px;
         | 
| 31 | 
            +
                font-size: 16px;
         | 
| 32 | 
            +
                border: 1px solid #ccc;
         | 
| 33 | 
            +
                border-radius: 5px;
         | 
| 34 | 
            +
            }
         | 
| 35 | 
            +
            #messageInput {
         | 
| 36 | 
            +
                width: 80%;
         | 
| 37 | 
            +
                margin-top: 20px;
         | 
| 38 | 
            +
                height: 60px; /* Устанавливаем высоту поля ввода текста */
         | 
| 39 | 
            +
            }
         | 
| 40 | 
            +
            #progressBarContainer {
         | 
| 41 | 
            +
                width: 80%;
         | 
| 42 | 
            +
                margin: 20px auto;
         | 
| 43 | 
            +
            }
         | 
| 44 | 
            +
            #progressBar {
         | 
| 45 | 
            +
                width: 100%;
         | 
| 46 | 
            +
                background-color: #ddd;
         | 
| 47 | 
            +
            }
         | 
| 48 | 
            +
            #progress {
         | 
| 49 | 
            +
                width: 0%;
         | 
| 50 | 
            +
                height: 30px;
         | 
| 51 | 
            +
                background-color: #4CAF50;
         | 
| 52 | 
            +
                text-align: center;
         | 
| 53 | 
            +
                line-height: 30px;
         | 
| 54 | 
            +
                color: white;
         | 
| 55 | 
            +
            }
         | 
| 56 | 
            +
            #sendButton {
         | 
| 57 | 
            +
                color: white;
         | 
| 58 | 
            +
                background-color: #4CAF50;
         | 
| 59 | 
            +
                border: none;
         | 
| 60 | 
            +
                cursor: pointer;
         | 
| 61 | 
            +
                padding: 10px 20px;
         | 
| 62 | 
            +
                font-size: 16px;
         | 
| 63 | 
            +
                border-radius: 5px;
         | 
| 64 | 
            +
                margin-top: 20px;
         | 
| 65 | 
            +
            }
         | 
| 66 | 
            +
            #sendButton:hover {
         | 
| 67 | 
            +
                background-color: #388E3C;
         | 
| 68 | 
            +
            }
         | 
| 69 | 
             
                </style>
         | 
| 70 | 
             
            </head>
         | 
| 71 | 
             
            <body>
         | 
| 72 | 
            +
                <h1></h1>
         | 
| 73 | 
             
                <div class="input-row">
         | 
| 74 | 
             
                    <input type="text" id="apiKeyInput" placeholder="Введите API ключ">
         | 
| 75 | 
             
                    <input type="number" id="minDelayInput" placeholder="Min Delay (ms)" value="500">
         | 
| 76 | 
             
                    <input type="number" id="maxDelayInput" placeholder="Max Delay (ms)" value="1000">
         | 
| 77 | 
             
                </div>
         | 
| 78 | 
            +
                <textarea id="messageInput" placeholder="Введите текст сообщения под файлом (отправка ссылок на сторонние ресурсы поддерживается, показа превью в этом типе отправки нет)."></textarea>
         | 
|  | |
|  | |
| 79 | 
             
                <div id="progressBarContainer">
         | 
| 80 | 
             
                    <div id="progressBar">
         | 
| 81 | 
             
                        <div id="progress">0%</div>
         | 
|  | |
| 87 | 
             
                <script>
         | 
| 88 | 
             
                    document.getElementById('sendButton').addEventListener('click', function() {
         | 
| 89 | 
             
                        const apiKey = document.getElementById('apiKeyInput').value;
         | 
| 90 | 
            +
                        const urlFile = localStorage.getItem('fileUrl');
         | 
| 91 | 
            +
                        const fileName = localStorage.getItem('filename');
         | 
| 92 | 
             
                        const messageTemplate = document.getElementById('messageInput').value;
         | 
| 93 | 
             
                        const minDelay = parseInt(document.getElementById('minDelayInput').value) || 500;
         | 
| 94 | 
             
                        const maxDelay = parseInt(document.getElementById('maxDelayInput').value) || 10000;
         | 
|  | |
| 97 | 
             
                            return;
         | 
| 98 | 
             
                        }
         | 
| 99 | 
             
                        if (!urlFile) {
         | 
| 100 | 
            +
                            alert('URL of the file is not found in local storage.');
         | 
| 101 | 
             
                            return;
         | 
| 102 | 
             
                        }
         | 
| 103 | 
             
                        if (!fileName) {
         | 
| 104 | 
            +
                            alert('File name is not found in local storage.');
         | 
| 105 | 
             
                            return;
         | 
| 106 | 
             
                        }
         | 
| 107 | 
             
                        if (!messageTemplate) {
         | 
|  | |
| 118 | 
             
                            alert('Please select a file.');
         | 
| 119 | 
             
                            return;
         | 
| 120 | 
             
                        }
         | 
| 121 | 
            +
                        console.log('URL файла:', urlFile);
         | 
| 122 | 
            +
                        console.log('Имя файла:', fileName);
         | 
| 123 | 
             
                        const reader = new FileReader();
         | 
| 124 | 
             
                        reader.onload = function(event) {
         | 
| 125 | 
             
                            const text = event.target.result;
         |