Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update up_gr.html
Browse files- up_gr.html +33 -62
    	
        up_gr.html
    CHANGED
    
    | @@ -3,8 +3,7 @@ | |
| 3 | 
             
            <head>
         | 
| 4 | 
             
                <meta charset="UTF-8">
         | 
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            -
                <title>Create Group with  | 
| 7 | 
            -
                <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
         | 
| 8 | 
             
                <style>
         | 
| 9 | 
             
                    body {
         | 
| 10 | 
             
                        font-family: Arial, sans-serif;
         | 
| @@ -32,20 +31,19 @@ | |
| 32 | 
             
                        border: 1px solid #ccc;
         | 
| 33 | 
             
                        border-radius: 5px;
         | 
| 34 | 
             
                    }
         | 
| 35 | 
            -
                     | 
| 36 | 
            -
                        width: 80%;
         | 
| 37 | 
             
                        margin-top: 20px;
         | 
| 38 | 
             
                    }
         | 
| 39 | 
            -
                     | 
| 40 | 
            -
                         | 
| 41 | 
            -
                         | 
| 42 | 
            -
                        padding: 10px;
         | 
| 43 | 
             
                        font-size: 16px;
         | 
| 44 | 
            -
                         | 
| 45 | 
            -
                        border-radius: 5px;
         | 
| 46 | 
            -
                        background-color: #fff;
         | 
| 47 | 
             
                    }
         | 
| 48 | 
            -
                     | 
|  | |
|  | |
|  | |
| 49 | 
             
                        color: white;
         | 
| 50 | 
             
                        background-color: #4CAF50;
         | 
| 51 | 
             
                        border: none;
         | 
| @@ -55,50 +53,41 @@ | |
| 55 | 
             
                        border-radius: 5px;
         | 
| 56 | 
             
                        margin-top: 20px;
         | 
| 57 | 
             
                    }
         | 
| 58 | 
            -
                     | 
| 59 | 
             
                        background-color: #388E3C;
         | 
| 60 | 
             
                    }
         | 
| 61 | 
             
                </style>
         | 
| 62 | 
             
            </head>
         | 
| 63 | 
             
            <body>
         | 
| 64 | 
            -
                <h1 | 
| 65 | 
             
                <div class="input-row">
         | 
| 66 | 
            -
                    <input type="text" id=" | 
| 67 | 
            -
                    <input type="text" id="groupNameInput" placeholder="Введите название группы">
         | 
| 68 | 
             
                </div>
         | 
| 69 | 
             
                <input type="file" id="fileInput" accept=".txt">
         | 
| 70 | 
            -
                <button id="createGroupButton" | 
| 71 | 
            -
                < | 
| 72 | 
            -
             | 
|  | |
| 73 |  | 
| 74 | 
            -
                <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
         | 
| 75 | 
             
                <script>
         | 
| 76 | 
             
                    document.getElementById('createGroupButton').addEventListener('click', async function() {
         | 
| 77 | 
            -
                        const apiKey = document.getElementById('apiKeyInput').value;
         | 
| 78 | 
             
                        const groupName = document.getElementById('groupNameInput').value;
         | 
| 79 | 
             
                        const fileInput = document.getElementById('fileInput');
         | 
| 80 | 
             
                        const file = fileInput.files[0];
         | 
| 81 | 
            -
                        if (! | 
| 82 | 
            -
                             | 
| 83 | 
            -
                                text: "Пожалуйста, заполните все поля и выберите файл.",
         | 
| 84 | 
            -
                                duration: 3000,
         | 
| 85 | 
            -
                                gravity: "top",
         | 
| 86 | 
            -
                                position: "right",
         | 
| 87 | 
            -
                                backgroundColor: "yellow",
         | 
| 88 | 
            -
                                stopOnFocus: true
         | 
| 89 | 
            -
                            }).showToast();
         | 
| 90 | 
             
                            return;
         | 
| 91 | 
             
                        }
         | 
| 92 | 
             
                        const reader = new FileReader();
         | 
| 93 | 
             
                        reader.onload = async function(event) {
         | 
| 94 | 
             
                            const text = event.target.result;
         | 
| 95 | 
            -
                            const  | 
| 96 | 
             
                            const payload = {
         | 
| 97 | 
             
                                groupName: groupName,
         | 
| 98 | 
            -
                                 | 
| 99 | 
             
                            };
         | 
| 100 | 
             
                            try {
         | 
| 101 | 
            -
                                const response = await fetch( | 
| 102 | 
             
                                    method: 'POST',
         | 
| 103 | 
             
                                    headers: {
         | 
| 104 | 
             
                                        'Content-Type': 'application/json'
         | 
| @@ -109,43 +98,25 @@ | |
| 109 | 
             
                                    throw new Error(`HTTP error! status: ${response.status}`);
         | 
| 110 | 
             
                                }
         | 
| 111 | 
             
                                const data = await response.json();
         | 
| 112 | 
            -
                                document.getElementById(' | 
| 113 | 
            -
                                 | 
| 114 | 
            -
                                    text: "Группа успешно создана.",
         | 
| 115 | 
            -
                                    duration: 3000,
         | 
| 116 | 
            -
                                    gravity: "top",
         | 
| 117 | 
            -
                                    position: "right",
         | 
| 118 | 
            -
                                    backgroundColor: "yellow",
         | 
| 119 | 
            -
                                    stopOnFocus: true
         | 
| 120 | 
            -
                                }).showToast();
         | 
| 121 | 
             
                            } catch (error) {
         | 
| 122 | 
             
                                console.error('Error creating group:', error);
         | 
| 123 | 
            -
                                 | 
| 124 | 
            -
                                    text: "Ошибка при создании группы.",
         | 
| 125 | 
            -
                                    duration: 3000,
         | 
| 126 | 
            -
                                    gravity: "top",
         | 
| 127 | 
            -
                                    position: "right",
         | 
| 128 | 
            -
                                    backgroundColor: "yellow",
         | 
| 129 | 
            -
                                    stopOnFocus: true
         | 
| 130 | 
            -
                                }).showToast();
         | 
| 131 | 
             
                            }
         | 
| 132 | 
             
                        };
         | 
| 133 | 
             
                        reader.readAsText(file);
         | 
| 134 | 
             
                    });
         | 
| 135 |  | 
| 136 | 
            -
                     | 
| 137 | 
            -
                        const  | 
| 138 | 
            -
                         | 
|  | |
|  | |
| 139 | 
             
                        document.execCommand('copy');
         | 
| 140 | 
            -
                         | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
                            gravity: "top",
         | 
| 144 | 
            -
                            position: "right",
         | 
| 145 | 
            -
                            backgroundColor: "yellow",
         | 
| 146 | 
            -
                            stopOnFocus: true
         | 
| 147 | 
            -
                        }).showToast();
         | 
| 148 | 
            -
                    });
         | 
| 149 | 
             
                </script>
         | 
| 150 | 
             
            </body>
         | 
| 151 | 
             
            </html>
         | 
|  | |
| 3 | 
             
            <head>
         | 
| 4 | 
             
                <meta charset="UTF-8">
         | 
| 5 | 
             
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            +
                <title>Create Group with Members</title>
         | 
|  | |
| 7 | 
             
                <style>
         | 
| 8 | 
             
                    body {
         | 
| 9 | 
             
                        font-family: Arial, sans-serif;
         | 
|  | |
| 31 | 
             
                        border: 1px solid #ccc;
         | 
| 32 | 
             
                        border-radius: 5px;
         | 
| 33 | 
             
                    }
         | 
| 34 | 
            +
                    .id-container {
         | 
|  | |
| 35 | 
             
                        margin-top: 20px;
         | 
| 36 | 
             
                    }
         | 
| 37 | 
            +
                    .id-container .group-id {
         | 
| 38 | 
            +
                        color: #007BFF;
         | 
| 39 | 
            +
                        text-decoration: none;
         | 
|  | |
| 40 | 
             
                        font-size: 16px;
         | 
| 41 | 
            +
                        cursor: pointer;
         | 
|  | |
|  | |
| 42 | 
             
                    }
         | 
| 43 | 
            +
                    .id-container .group-id:hover {
         | 
| 44 | 
            +
                        text-decoration: underline;
         | 
| 45 | 
            +
                    }
         | 
| 46 | 
            +
                    .create-button {
         | 
| 47 | 
             
                        color: white;
         | 
| 48 | 
             
                        background-color: #4CAF50;
         | 
| 49 | 
             
                        border: none;
         | 
|  | |
| 53 | 
             
                        border-radius: 5px;
         | 
| 54 | 
             
                        margin-top: 20px;
         | 
| 55 | 
             
                    }
         | 
| 56 | 
            +
                    .create-button:hover {
         | 
| 57 | 
             
                        background-color: #388E3C;
         | 
| 58 | 
             
                    }
         | 
| 59 | 
             
                </style>
         | 
| 60 | 
             
            </head>
         | 
| 61 | 
             
            <body>
         | 
| 62 | 
            +
                <h1>Create Group with Members</h1>
         | 
| 63 | 
             
                <div class="input-row">
         | 
| 64 | 
            +
                    <input type="text" id="groupNameInput" placeholder="Enter group name">
         | 
|  | |
| 65 | 
             
                </div>
         | 
| 66 | 
             
                <input type="file" id="fileInput" accept=".txt">
         | 
| 67 | 
            +
                <button class="create-button" id="createGroupButton">Create Group</button>
         | 
| 68 | 
            +
                <div class="id-container">
         | 
| 69 | 
            +
                    <span class="group-id" id="groupIdToCopy" onclick="copyToClipboard(this)">Click here to copy the group ID</span>
         | 
| 70 | 
            +
                </div>
         | 
| 71 |  | 
|  | |
| 72 | 
             
                <script>
         | 
| 73 | 
             
                    document.getElementById('createGroupButton').addEventListener('click', async function() {
         | 
|  | |
| 74 | 
             
                        const groupName = document.getElementById('groupNameInput').value;
         | 
| 75 | 
             
                        const fileInput = document.getElementById('fileInput');
         | 
| 76 | 
             
                        const file = fileInput.files[0];
         | 
| 77 | 
            +
                        if (!groupName || !file) {
         | 
| 78 | 
            +
                            alert('Please enter a group name and select a file.');
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 79 | 
             
                            return;
         | 
| 80 | 
             
                        }
         | 
| 81 | 
             
                        const reader = new FileReader();
         | 
| 82 | 
             
                        reader.onload = async function(event) {
         | 
| 83 | 
             
                            const text = event.target.result;
         | 
| 84 | 
            +
                            const members = text.split(',').map(member => member.trim()).filter(member => member);
         | 
| 85 | 
             
                            const payload = {
         | 
| 86 | 
             
                                groupName: groupName,
         | 
| 87 | 
            +
                                members: members
         | 
| 88 | 
             
                            };
         | 
| 89 | 
             
                            try {
         | 
| 90 | 
            +
                                const response = await fetch('https://api.example.com/createGroup', {
         | 
| 91 | 
             
                                    method: 'POST',
         | 
| 92 | 
             
                                    headers: {
         | 
| 93 | 
             
                                        'Content-Type': 'application/json'
         | 
|  | |
| 98 | 
             
                                    throw new Error(`HTTP error! status: ${response.status}`);
         | 
| 99 | 
             
                                }
         | 
| 100 | 
             
                                const data = await response.json();
         | 
| 101 | 
            +
                                document.getElementById('groupIdToCopy').innerText = data.groupId;
         | 
| 102 | 
            +
                                alert('Group created successfully!');
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 103 | 
             
                            } catch (error) {
         | 
| 104 | 
             
                                console.error('Error creating group:', error);
         | 
| 105 | 
            +
                                alert('Error creating group.');
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 106 | 
             
                            }
         | 
| 107 | 
             
                        };
         | 
| 108 | 
             
                        reader.readAsText(file);
         | 
| 109 | 
             
                    });
         | 
| 110 |  | 
| 111 | 
            +
                    function copyToClipboard(element) {
         | 
| 112 | 
            +
                        const tempInput = document.createElement('input');
         | 
| 113 | 
            +
                        document.body.appendChild(tempInput);
         | 
| 114 | 
            +
                        tempInput.value = element.innerText;
         | 
| 115 | 
            +
                        tempInput.select();
         | 
| 116 | 
             
                        document.execCommand('copy');
         | 
| 117 | 
            +
                        document.body.removeChild(tempInput);
         | 
| 118 | 
            +
                        alert('Group ID copied to clipboard!');
         | 
| 119 | 
            +
                    }
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 120 | 
             
                </script>
         | 
| 121 | 
             
            </body>
         | 
| 122 | 
             
            </html>
         |