-
Notifications
You must be signed in to change notification settings - Fork 0
/
Field Raider Firefox-1.73.user.js
60 lines (50 loc) · 1.98 KB
/
Field Raider Firefox-1.73.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
// ==UserScript==
// @name Field Raider Firefox
// @namespace http://tampermonkey.net/
// @version 1.73
// @description Bypass field restrictions when pasting data from the clipboard (Ctrl + Alt + V)
// @author Seth@WiiPlaza
// @match :///*
// @icon https://pbs.twimg.com/media/FR11DSvX0AI1W44.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
const excludeRegex = /https?:\/\/.*?\.(facebook\.com|messenger\.com|google\.com|github\.com|imgur\.com).*/;
const includeRegex = /https?:\/\/.*/;
const allowCopyAndPaste = function(e) {
e.stopImmediatePropagation();
return true;
};
const isRestrictedSite = () => {
const location = window.location.href;
return includeRegex.test(location) && !excludeRegex.test(location);
};
const pasteCippi = async () => {
const elemsUndeRat = document.querySelectorAll(":hover");
const lastElemUndeRat = elemsUndeRat[elemsUndeRat.length - 1];
const textInClippi = await navigator.clipboard.readText();
if (lastElemUndeRat.tagName === 'INPUT' || lastElemUndeRat.tagName === 'TEXTAREA') {
lastElemUndeRat.value = textInClippi;
simulateKeyPresses(textInClippi);
}
};
const simulateKeyPresses = (text) => {
setTimeout(() => {
const event = new KeyboardEvent('keydown', { key: ' ' });
document.dispatchEvent(event);
const eventBackspace = new KeyboardEvent('keydown', { key: 'Backspace' });
document.dispatchEvent(eventBackspace);
}, 0.2);
};
const triggerMoi = (event) => {
if (event.altKey && event.ctrlKey && event.key === "y") {
pasteCippi();
}
};
document.addEventListener('keyup', triggerMoi, false);
if (isRestrictedSite()) {
document.addEventListener('copy', allowCopyAndPaste, true);
document.addEventListener('paste', allowCopyAndPaste, true);
}
})();