-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdvent of Code.js
More file actions
33 lines (28 loc) · 1008 Bytes
/
Advent of Code.js
File metadata and controls
33 lines (28 loc) · 1008 Bytes
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
// ==UserScript==
// @name Advent of Code
// @namespace dapeaoc
// @version 0.1
// @description AoC Helper
// @author dape
// @match https://adventofcode.com/*
// @icon https://adventofcode.com/favicon.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.addEventListener('contextmenu', (event) => {
if(window.location.href.includes("input") || event.target.tagName == "CODE") {
event.target.style.color = "green";
navigator.clipboard.writeText( event.target.textContent);
setTimeout(() => {
event.target.style.color = "#cccccc";
}, 200);
event.preventDefault();
}
});
window.addEventListener("paste", (event) => {
event.preventDefault();
document.querySelector("input[type='text']").value = event.clipboardData.getData("text/plain").trim();
document.querySelector("input[type='submit']").click();
});
})();