Created
March 3, 2017 08:19
-
-
Save jiji262/6d6b0873fbe0dd5bea92e68a794ca15d to your computer and use it in GitHub Desktop.
remove Medium sites location hash (script for tampermonkey)
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
// ==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