-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wayback_Check-0.6.user.js
106 lines (96 loc) · 4.6 KB
/
Wayback_Check-0.6.user.js
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// ==UserScript==
// @name Archive.org Status Checker
// @namespace https://www.brainhub24.com
// @version 0.6
// @description Check if the current website is already present on archive.org, if not you will get a negative status with some instructions.
// @author Jan Gebser (Brainhub24.com)
// @match *://*/*
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
// Function to check if the current page is archived @archive.org
function checkArchive(url) {
// Construct the API URL for checking if the URL is archived
var apiUrl = 'https://archive.org/wayback/available?url=' + encodeURIComponent(url);
// Make a GET request to the API
GM_xmlhttpRequest({
method: 'GET',
url: apiUrl,
onload: function(response) {
var data = JSON.parse(response.responseText);
// Check if the URL is archived
if (data.archived_snapshots && data.archived_snapshots.closest) {
// URL is archived
displayBanner('This website is present @archive.org 😎', 'rgba(255, 255, 255, 0.7)');
} else {
// URL is not archived
displayBanner('This website is not present @archive.org 🧐', 'rgba(255, 255, 255, 0.7)');
}
}
});
}
// Function to display the banner
function displayBanner(text, backgroundColor) {
var banner = document.createElement('div');
banner.innerHTML = text;
banner.style.position = 'fixed';
banner.style.bottom = '0';
banner.style.left = '0';
banner.style.width = '100%';
banner.style.backgroundColor = backgroundColor;
banner.style.color = '#000000'; // Text color changed to black
banner.style.textAlign = 'center';
banner.style.padding = '10px';
banner.style.zIndex = '999';
banner.style.backdropFilter = 'blur(5px)';
// Close button
var closeButton = document.createElement('span');
closeButton.innerHTML = '×';
closeButton.style.position = 'absolute';
closeButton.style.top = '5px';
closeButton.style.right = '10px';
closeButton.style.cursor = 'pointer';
closeButton.style.fontSize = '20px';
closeButton.style.fontWeight = 'bold';
closeButton.addEventListener('click', function() {
banner.parentNode.removeChild(banner);
});
banner.appendChild(closeButton);
document.body.appendChild(banner);
// Create hamburger menu
var hamburgerMenu = document.createElement('div');
hamburgerMenu.innerHTML = `
<div id="hamburger-menu" style="position: fixed; bottom: 10px; left: 10px; width: 30px; height: 30px; cursor: pointer; z-index: 999;">
<div style="width: 100%; height: 4px; background-color: #000000; margin: 5px 0;"></div>
<div style="width: 100%; height: 4px; background-color: #000000; margin: 5px 0;"></div>
<div style="width: 100%; height: 4px; background-color: #000000; margin: 5px 0;"></div>
</div>
`;
document.body.appendChild(hamburgerMenu);
// Create start menu
var startMenu = document.createElement('div');
startMenu.innerHTML = `
<div id="start-menu" style="display: none; position: fixed; bottom: 50px; left: 10px; width: 200px; background-color: #ffffff; padding: 10px; border: 1px solid #000000; z-index: 998; backdrop-filter: blur(5px); transition: all 0.3s ease;">
<h3>Webservice</h3>
<ul>
<li><a href="https://seo.webservice.digital/">Create SEO-Reports</a></li>
<li><a href="https://github.com/Brainhub24/Web-Archiv-Status">Visit the reporsitory</a></li>
</ul>
</div>
`;
document.body.appendChild(startMenu);
// Toggle start menu on hamburger menu click
var hamburger = document.getElementById('hamburger-menu');
var startMenuElement = document.getElementById('start-menu');
hamburger.addEventListener('click', function() {
if (startMenuElement.style.display === 'none') {
startMenuElement.style.display = 'block';
} else {
startMenuElement.style.display = 'none';
}
});
}
// Check if the current page is archived
checkArchive(window.location.href);
})();