Skip to content

Instantly share code, notes, and snippets.

@impliedgg
Created September 19, 2025 09:27
Show Gist options
  • Select an option

  • Save impliedgg/9e8549472e94a300487c8aff10d594a9 to your computer and use it in GitHub Desktop.

Select an option

Save impliedgg/9e8549472e94a300487c8aff10d594a9 to your computer and use it in GitHub Desktop.
stackoverflow user id gatekeeper
quick-and-dirty. update this yourself if you want better code.
// ==UserScript==
// @name StackOverflow UserID Gatekeeper
// @namespace github@impliedgg
// @match https://stackoverflow.com/*
// @grant none
// @version 1.0
// @author github@impliedgg
// @description For StackOverflow. Automatically strips UserID from your URLs before you copy them.
// ==/UserScript==
setTimeout(()=>{
if ($('#user-profile-button').length > 0) { // user signed in?
$("a.js-share-link").each((i, obj) => {
$(obj).removeAttr("data-se-share-sheet-subtitle"); // removes subtitle display from popover when created
let splitLink = $(obj).attr('href').split("/"); // remove second half of url w/ userid
splitLink.pop();
$(obj).attr('href', splitLink.join("/"));
})
}
}, 500); // long timeout for low speed connections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment