Skip to content

Instantly share code, notes, and snippets.

Created May 22, 2016 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6993b7c4b379b06613705e8dd503e7c4 to your computer and use it in GitHub Desktop.
Save anonymous/6993b7c4b379b06613705e8dd503e7c4 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name 4chan Ø
// @namespace 4chan-ø
// @version 1.3
// @grant none
// @match https*://boards.4chan.org/*
// @include https*://boards.4chan.org/*
// ==/UserScript==
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
window.onload = function() {
window.onkeyup = function(e) {
if (e.target.tagName.toLowerCase() === 'textarea') {
if (isFirefox) {
if (e.key.toLowerCase() !== 'ø') {
return;
}
} else {
if (e.keyCode !== 186 && e.keyCode !== 192) {
return;
}
}
var elem = e.target;
var pos = elem.selectionStart;
elem.value = elem.value
.replace(/Ø/g, 'Ǿ')
.replace(/ø/g, 'ǿ');
elem.setSelectionRange(pos, pos);
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment