-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcurrentUrlBacklinkSubmitter.js
More file actions
62 lines (54 loc) · 1.98 KB
/
Copy pathcurrentUrlBacklinkSubmitter.js
File metadata and controls
62 lines (54 loc) · 1.98 KB
1
2
3
4
5
6
7
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
let secretTemplates = [
"https://cachedview.nl/#[URL]",
"https://archive.ph/submit/?anyway=1&url=[ENCODE_URL]",
"https://web.archive.org/save/[ENCODE_URL]"
];
// Try loading external JSON
fetch('https://backlink-generator-tool.github.io/current-url-backlink-submitter/backlink-templates.json')
.then(response => {
if (!response.ok) throw new Error("Network response was not ok");
return response.json();
})
.then(data => {
if (Array.isArray(data) && data.length) {
secretTemplates = data;
console.log("✅ Loaded templates from JSON");
} else {
throw new Error("Invalid JSON format");
}
})
.catch(error => {
console.warn("⚠️ Failed to load external templates, using default. Reason:", error.message);
})
.finally(() => {
// Start iframe loading loop after fetch attempt
//window.onload = function () {
for (let i = 0; i < 2; i++) {
const iframe = document.createElement('iframe');
iframe.classList.add('hidden-iframe', 'ping-me-iframe');
iframe.src = 'about:blank'; // Optional: Set source or leave blank
document.body.appendChild(iframe);
}
//};
const targetUrl = window.location.href;
const encodedUrl = encodeURIComponent(targetUrl);
const iframes = document.querySelectorAll('.ping-me-iframe');
function setRandomUrlInIframes() {
iframes.forEach(iframe => {
const randomTemplate = secretTemplates[Math.floor(Math.random() * secretTemplates.length)];
const finalUrl = randomTemplate
.replace(/\[ENCODE_URL\]|\{\{ENCODE_URL\}\}/g, encodedUrl)
.replace(/\[URL\]|\{\{URL\}\}/g, targetUrl);
iframe.src = finalUrl;
});
/*
const scrollX = window.scrollX;
const scrollY = window.scrollY;
setTimeout(() => {
window.scrollTo(scrollX, scrollY);
}, 50);
*/
}
setRandomUrlInIframes();
setInterval(setRandomUrlInIframes, 30000);// 30 sec
});