enotkrutoy commited on
Commit
b8069ed
·
verified ·
1 Parent(s): 9ac7320

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +87 -54
index.html CHANGED
@@ -209,59 +209,92 @@
209
  </div>
210
  </div>
211
  <script>
212
- function copyToClipboard(text) {
213
- navigator.clipboard.writeText(text).then(() => {
214
- const indicator = event.target.querySelector('.copy-indicator');
215
- indicator.classList.add('show');
216
- setTimeout(() => indicator.classList.remove('show'), 2000);
217
- });
218
- }
219
- document.getElementById('searchForm').addEventListener('submit', function(e) {
220
- e.preventDefault();
221
- const searchQuery = document.getElementById('searchInput').value;
222
- const maxWindows = parseInt(document.getElementById('windowsSelect').value, 10);
223
- searchGoogle(searchQuery, maxWindows);
224
- });
225
- function searchGoogle(search, maxWindows = 1) {
226
- if (typeof search !== 'string' || search.trim() === '') {
227
- console.error('Поисковый запрос должен быть строкой и не должен быть пустым.');
228
- return;
229
- }
230
- const words = search.split(" ").filter(Boolean);
231
- const wordsCount = words.length;
232
- if (wordsCount >= 32) {
233
- console.error('Количество слов в поисковом запросе должно быть меньше 32.');
234
- return;
235
- }
236
- const o = 32 - wordsCount;
237
- if (o <= 0) {
238
- console.error('Ошибка в расчете o.');
239
- return;
240
- }
241
- const template = "site:*.*.%NUM%.* |";
242
- let query = "";
243
- const urls = [];
244
- const maxUrls = Math.min(maxWindows, 10);
245
- try {
246
- for (let i = 0; i < Math.floor(256 / o) && i < maxUrls; i++) {
247
- query = "";
248
- for (let ii = 0; ii < (257 - (i * o)); ii++) {
249
- query += template.replace("%NUM%", ii);
250
- }
251
- query = query.slice(0, -1);
252
- query = `(${search}) (${query})`;
253
- const url = `https://www.google.com/search?q=${query}`;
254
- urls.push(url);
255
- }
256
- urls.forEach((url, index) => {
257
- setTimeout(() => {
258
- window.open(url, '_blank', 'noreferrer');
259
- }, index * 1000);
260
- });
261
- } catch (error) {
262
- console.error('Произошла ошибка:', error);
263
- }
264
- }
265
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  </body>
267
  </html>
 
209
  </div>
210
  </div>
211
  <script>
212
+ function copyToClipboard(text, evt) {
213
+ if (navigator.clipboard && window.isSecureContext) {
214
+ navigator.clipboard.writeText(text).then(() => {
215
+ var indicator = evt ? evt.target.querySelector('.copy-indicator') : document.querySelector('.copy-indicator');
216
+ if (indicator) {
217
+ indicator.classList.add('show');
218
+ setTimeout(() => indicator.classList.remove('show'), 2000);
219
+ }
220
+ }).catch(() => {
221
+ fallbackCopyText(text, evt);
222
+ });
223
+ } else {
224
+ fallbackCopyText(text, evt);
225
+ }
226
+ }
227
+ function fallbackCopyText(text, evt) {
228
+ var copyElement = document.createElement("div");
229
+ copyElement.style.position = "absolute";
230
+ copyElement.style.left = "-9999px";
231
+ copyElement.setAttribute("contenteditable", "true");
232
+ copyElement.textContent = text;
233
+ document.body.appendChild(copyElement);
234
+ var range = document.createRange();
235
+ range.selectNodeContents(copyElement);
236
+ var selection = window.getSelection();
237
+ selection.removeAllRanges();
238
+ selection.addRange(range);
239
+ try {
240
+ document.execCommand("copy");
241
+ var indicator = evt ? evt.target.querySelector('.copy-indicator') : document.querySelector('.copy-indicator');
242
+ if (indicator) {
243
+ indicator.classList.add('show');
244
+ setTimeout(() => indicator.classList.remove('show'), 2000);
245
+ }
246
+ } catch (err) {
247
+ console.error("Fallback: Unable to copy", err);
248
+ }
249
+ document.body.removeChild(copyElement);
250
+ }
251
+ document.getElementById('searchForm').addEventListener('submit', function(e) {
252
+ e.preventDefault();
253
+ var searchQuery = document.getElementById('searchInput').value;
254
+ var maxWindows = parseInt(document.getElementById('windowsSelect').value, 10);
255
+ searchGoogle(searchQuery, maxWindows);
256
+ });
257
+ function searchGoogle(search, maxWindows = 1) {
258
+ if (typeof search !== 'string' || search.trim() === '') {
259
+ console.error('Поисковый запрос должен быть строкой и не должен быть пустым.');
260
+ return;
261
+ }
262
+ var words = search.split(" ").filter(Boolean);
263
+ var wordsCount = words.length;
264
+ if (wordsCount >= 32) {
265
+ console.error('Количество слов в поисковом запросе должно быть меньше 32.');
266
+ return;
267
+ }
268
+ var o = 32 - wordsCount;
269
+ if (o <= 0) {
270
+ console.error('Ошибка в расчете o.');
271
+ return;
272
+ }
273
+ var template = "site:*.*.%NUM%.* |";
274
+ var query = "";
275
+ var urls = [];
276
+ var maxUrls = Math.min(maxWindows, 10);
277
+ try {
278
+ for (var i = 0; i < Math.floor(256 / o) && i < maxUrls; i++) {
279
+ query = "";
280
+ for (var ii = 0; ii < (257 - (i * o)); ii++) {
281
+ query += template.replace("%NUM%", ii);
282
+ }
283
+ query = query.slice(0, -1);
284
+ query = "(" + search + ") (" + query + ")";
285
+ var url = "https://www.google.com/search?q=" + encodeURIComponent(query);
286
+ urls.push(url);
287
+ }
288
+ urls.forEach(function(url, index) {
289
+ setTimeout(function() {
290
+ window.open(url, '_blank', 'noreferrer');
291
+ }, index * 1000);
292
+ });
293
+ } catch (error) {
294
+ console.error('Произошла ошибка:', error);
295
+ }
296
+ }
297
+ </script>
298
+
299
  </body>
300
  </html>