Created
December 2, 2015 15:05
-
-
Save azu/36ba5a80feb857c77a3a to your computer and use it in GitHub Desktop.
Medium: remove location hash
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 Medium: remove location hash | |
// @namespace http://efcl.info/ | |
// @description Remove location hash from medium | |
// @include https://medium.com/*#* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
function removeLocationHash(){ | |
var noHashURL = window.location.href.replace(/#.*$/, ''); | |
window.history.replaceState('', document.title, noHashURL) | |
} | |
window.addEventListener("popstate", function(event){ | |
removeLocationHash(); | |
}); | |
window.addEventListener("hashchange", function(event){ | |
event.preventDefault(); | |
removeLocationHash(); | |
}); | |
window.addEventListener("load", function(){ | |
removeLocationHash(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment