Created
August 8, 2023 14:42
-
-
Save Fooftilly/08d41aef2dd410f65e99b95b7878f4c8 to your computer and use it in GitHub Desktop.
Remove tracking from Spotify links when pasting them
This file contains 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
// ==UserScript== | |
// @name Remove Spotify si parameter | |
// @version 1.0 | |
// @description Automatically remove the si parameter from Spotify links when pasting them | |
// @match *://*/* | |
// @author ChatGPT | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.addEventListener('paste', function(e) { | |
var text = e.clipboardData.getData('text'); | |
if (text.includes('open.spotify.com')) { | |
var url = new URL(text); | |
url.searchParams.delete('si'); | |
e.preventDefault(); | |
document.execCommand('insertText', false, url.toString()); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment