-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy_password_from_ovagames.user.js
69 lines (58 loc) · 2.49 KB
/
copy_password_from_ovagames.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
// ==UserScript==
// @name Copy Password from Ovagames
// @namespace http://tampermonkey.net/
// @version 1.4
// @description Copy "password: ###" from ovagames pages
// @author Your Name
// @match https://www.ovagames.com/*.html
// @grant GM_setClipboard
// ==/UserScript==
(function() {
'use strict';
console.log('Tampermonkey script loaded.');
// Function to create and show a notification
function showNotification(message) {
const notification = document.createElement('div');
notification.innerText = message;
notification.style.position = 'fixed';
notification.style.bottom = '10px';
notification.style.right = '10px';
notification.style.padding = '10px';
notification.style.backgroundColor = '#28a745';
notification.style.color = 'white';
notification.style.fontSize = '16px';
notification.style.borderRadius = '5px';
notification.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)';
notification.style.zIndex = '10000';
document.body.appendChild(notification);
setTimeout(() => {
notification.remove();
}, 3000); // Remove the notification after 3 seconds
}
// Function to find and copy the password
function copyPassword() {
console.log('Page loaded. Looking for password in #link_download...');
// Look for the element with ID 'link_download'
const downloadElement = document.getElementById('link_download');
if (downloadElement) {
console.log('#link_download element found:', downloadElement);
// Look for the specific pattern "password: ###" within the element
const passwordPattern = /\d{3}/i;
const elementText = downloadElement.innerText;
console.log('Element text content:', elementText);
const passwordText = elementText.match(passwordPattern);
console.log('Matched password:', passwordText);
if (passwordText) {
// Copy the password to the clipboard
GM_setClipboard(passwordText[0], 'text');
showNotification('Password copied to clipboard: ' + passwordText[0]);
} else {
console.log('Password not found in #link_download.');
}
} else {
console.log('#link_download element not found.');
}
}
// Wait for the page to load
window.addEventListener('load', copyPassword);
})();