Advertisement
Guest User

Untitled

a guest
Oct 24th, 2015
1,754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. // ==UserScript==
  2. // @name 4chan Ø
  3. // @namespace 4chan-ø
  4. // @version 1.3
  5. // @grant none
  6. // @match http*://boards.4chan.org/*
  7. // @include http*://boards.4chan.org/*
  8. // ==/UserScript==
  9.  
  10. var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
  11.  
  12. window.onload = function() {
  13. window.onkeyup = function(e) {
  14. if (e.target.tagName.toLowerCase() === 'textarea') {
  15. if (isFirefox) {
  16. if (e.key.toLowerCase() !== 'ø') {
  17. return;
  18. }
  19. } else {
  20. if (e.keyCode !== 186 && e.keyCode !== 192) {
  21. return;
  22. }
  23. }
  24.  
  25. var elem = e.target;
  26.  
  27. var pos = elem.selectionStart;
  28.  
  29. elem.value = elem.value
  30. .replace(/Ø/g, 'Ǿ')
  31. .replace(/ø/g, 'ǿ');
  32.  
  33. elem.setSelectionRange(pos, pos);
  34. }
  35. };
  36. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement