Skip to content

Instantly share code, notes, and snippets.

View Explosion-Scratch's full-sized avatar

--Explosion-- Explosion-Scratch

View GitHub Profile
@Explosion-Scratch
Explosion-Scratch / darkmode.js
Last active October 16, 2020 19:36
Dark Mode Bookmarklet
$(document).ready(function(){
document.getElementById('input').addEventListener('input', (function() {
background();
}));
function background() {
$('#before').css('background-color', $('#input').val());
original = $('#input').val();
hsl = hexToHsl(original);
color = newcolor(hsl[0], hsl[1], hsl[2]);
$('#after').css('background-color', color);
@Explosion-Scratch
Explosion-Scratch / blur.js
Last active November 30, 2020 16:56
Blur with drag and drop
javascript: {
var x = null;
var y = null;
rect = null;
document.body.style.userSelect = "none";
document.body.style.pointerEvents = "none";
document.addEventListener("mousedown", (e) => {
document.addEventListener("mousemove", (e) => {
try {
rect.remove();
@Explosion-Scratch
Explosion-Scratch / click2blur.js
Last active November 30, 2020 17:06
Blur with click
javascript: {
var style = document.createElement("STYLE");
style.innerHTML = `.blur {filter: blur(4px) !important;}`;
document.body.appendChild(style);
document.addEventListener("click", (e) => {
e.preventDefault();
e.target.classList.toggle("blur");
});
}
@Explosion-Scratch
Explosion-Scratch / youtube.js
Created December 15, 2020 13:16
Download from YouTube bookmarklet
//Select the line below and drag it into your bookmarks bar. Then when on a YouTube video click it!
javascript: {var url=window.location.href;if(/https:\/\/(www|)\.youtube\.com\/watch\?v=[A-Za-z0-9]+/i.test(url)){var newurl=`https://4n8hm.sse.codesandbox.io/download?URL=${url}&format=${prompt("What format would you like to download?","mp4")||"cancel"}&quality=${prompt("What quality would you like to download? (highest, lowest, highestaudio, lowestaudio, highestvideo, lowestvideo)","highest")||"cancel"}`;newurl.includes("cancel")?alert("You canceled the download"):window.location.href=newurl}else alert("Invalid url!");}

Keybase proof

I hereby claim:

  • I am Explosion-Scratch on github.
  • I am explosionscratch (https://keybase.io/explosionscratch) on keybase.
  • I have a public key whose fingerprint is 1D0E EBC4 C6FD C06F 13C9 6796 C9C1 09EB C616 2A86

To claim this, I am signing this object:

const DI = window.DiscordInternals;
const hasLib = !!(DI && DI.versionCompare && DI.versionCompare(DI.version || "", "1.9") >= 0);
const WebpackModules = hasLib && DI.WebpackModules || (() => {
const req = typeof(webpackJsonp) == "function" ? webpackJsonp([], {
'__extra_id__': (module, exports, req) => exports.default = req
}, ['__extra_id__']).default : webpackJsonp.push([[], {
'__extra_id__': (module, exports, req) => module.exports = req
}, [['__extra_id__']]]);
delete req.m['__extra_id__'];
@Explosion-Scratch
Explosion-Scratch / preload.js
Last active April 28, 2021 18:24
Preloads a webpage through an iframe.
//Set window.load and window.show so that the child iframe element can access those functions.
window.load = load;
window.show = show;
//Convert all links to preload on hover.
[...document.querySelectorAll("a")].forEach((a) => {
a.addEventListener("click", (e) => {
e.preventDefault();
show(a.href);
});
a.addEventListener("mouseenter", (e) => {
@Explosion-Scratch
Explosion-Scratch / spreadsheets.md
Last active September 6, 2021 19:17
Fetch data from google sheets as a JavaScript object!!

Get data from google sheets!

This script gets data from a google sheets table and returns it in easy to use JSON. Tables must have a header 😃

How to get the spreadsheet ID:

Publish it to the web:

image

The ID is in the link that publish to the web gives you, NOT the webpage URL

((window) => {
var _fetch = window.fetch; //Get the original fetch functionm
window.fetch = (url, opts = {}) => {
if (!window.FETCH_CACHE) {
window.FETCH_CACHE = {};
}
return new Promise((resolve) => {
/*
Generate a sort of unique key about this fetch request.
@Explosion-Scratch
Explosion-Scratch / Useful stuff.md
Last active April 11, 2024 19:13
Useful stuff

Useful resources

Here you will find lots of useful resources to me as a developer, everything from font pairing, to regex finding, to tailwind resources is here! If you have any suggestions feel free to suggest them in a comment!

Fonts