DmitrMakeev
commited on
Commit
•
c52dcef
1
Parent(s):
e4aa7fc
Update up_gr.html
Browse files- up_gr.html +29 -3
up_gr.html
CHANGED
@@ -44,6 +44,18 @@
|
|
44 |
.create-button:hover {
|
45 |
background-color: #388E3C;
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
</style>
|
48 |
</head>
|
49 |
<body>
|
@@ -54,6 +66,9 @@
|
|
54 |
</div>
|
55 |
<input type="file" id="fileInput" accept=".txt">
|
56 |
<button class="create-button" id="createGroupButton">Create Group</button>
|
|
|
|
|
|
|
57 |
|
58 |
<script>
|
59 |
document.getElementById('createGroupButton').addEventListener('click', async function() {
|
@@ -74,11 +89,11 @@
|
|
74 |
chatIds: chatIds
|
75 |
};
|
76 |
try {
|
77 |
-
const
|
|
|
78 |
method: 'POST',
|
79 |
headers: {
|
80 |
-
'Content-Type': 'application/json'
|
81 |
-
'Authorization': `Bearer ${apiKey}`
|
82 |
},
|
83 |
body: JSON.stringify(payload)
|
84 |
});
|
@@ -86,6 +101,7 @@
|
|
86 |
throw new Error(`HTTP error! status: ${response.status}`);
|
87 |
}
|
88 |
const data = await response.json();
|
|
|
89 |
alert('Group created successfully!');
|
90 |
console.log('Response JSON:', data);
|
91 |
} catch (error) {
|
@@ -95,6 +111,16 @@
|
|
95 |
};
|
96 |
reader.readAsText(file);
|
97 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
</script>
|
99 |
</body>
|
100 |
</html>
|
|
|
44 |
.create-button:hover {
|
45 |
background-color: #388E3C;
|
46 |
}
|
47 |
+
.group-id-container {
|
48 |
+
margin-top: 20px;
|
49 |
+
}
|
50 |
+
.group-id {
|
51 |
+
color: #007BFF;
|
52 |
+
text-decoration: none;
|
53 |
+
font-size: 16px;
|
54 |
+
cursor: pointer;
|
55 |
+
}
|
56 |
+
.group-id:hover {
|
57 |
+
text-decoration: underline;
|
58 |
+
}
|
59 |
</style>
|
60 |
</head>
|
61 |
<body>
|
|
|
66 |
</div>
|
67 |
<input type="file" id="fileInput" accept=".txt">
|
68 |
<button class="create-button" id="createGroupButton">Create Group</button>
|
69 |
+
<div class="group-id-container">
|
70 |
+
<span class="group-id" id="groupIdToCopy" onclick="copyToClipboard(this)">Click here to copy the group ID</span>
|
71 |
+
</div>
|
72 |
|
73 |
<script>
|
74 |
document.getElementById('createGroupButton').addEventListener('click', async function() {
|
|
|
89 |
chatIds: chatIds
|
90 |
};
|
91 |
try {
|
92 |
+
const url = `https://api.green-api.com/waInstance1101952913/createGroup/${apiKey}`;
|
93 |
+
const response = await fetch(url, {
|
94 |
method: 'POST',
|
95 |
headers: {
|
96 |
+
'Content-Type': 'application/json'
|
|
|
97 |
},
|
98 |
body: JSON.stringify(payload)
|
99 |
});
|
|
|
101 |
throw new Error(`HTTP error! status: ${response.status}`);
|
102 |
}
|
103 |
const data = await response.json();
|
104 |
+
document.getElementById('groupIdToCopy').innerText = data.chatId;
|
105 |
alert('Group created successfully!');
|
106 |
console.log('Response JSON:', data);
|
107 |
} catch (error) {
|
|
|
111 |
};
|
112 |
reader.readAsText(file);
|
113 |
});
|
114 |
+
|
115 |
+
function copyToClipboard(element) {
|
116 |
+
const tempInput = document.createElement('input');
|
117 |
+
document.body.appendChild(tempInput);
|
118 |
+
tempInput.value = element.innerText;
|
119 |
+
tempInput.select();
|
120 |
+
document.execCommand('copy');
|
121 |
+
document.body.removeChild(tempInput);
|
122 |
+
alert('Group ID copied to clipboard!');
|
123 |
+
}
|
124 |
</script>
|
125 |
</body>
|
126 |
</html>
|