Last active
March 29, 2022 15:25
-
-
Save cornzz/f50d68d5cd29e16c3a7b6bc7606cf3ea to your computer and use it in GitHub Desktop.
Script that lets you browse peoples uploaded screenshots randomly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomId() { | |
let letters = 'abcdefghijklmnopqrstuvwxyz' | |
return ( | |
'aa'.split('').map(n => letters[Math.floor(Math.random() * 26)]).join('') + | |
'1111'.split('').map(l => Math.floor(Math.random() * 9)).join('') | |
) | |
} | |
function keydownHandler(e) { | |
if (e.key === 'ArrowRight') { | |
window.location.pathname = '/' + randomId(); | |
} else if (e.key === 'ArrowLeft') { | |
history.back() | |
} | |
} | |
document.addEventListener('keydown', keydownHandler) | |
console.log('prntsc browser loaded.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "prntsc_browser.js", | |
"description": "Browse peoples screenshots.", | |
"version": "1.0", | |
"manifest_version": 2, | |
"permissions": [ | |
"activeTab" | |
], | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"*://prnt.sc/*" | |
], | |
"run_at": "document_end", | |
"js": [ | |
"browse_prntsc.js" | |
], | |
"all_frames": true | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment