Skip to content

Instantly share code, notes, and snippets.

@AstroCB
Last active Jun 4, 2020
Embed
What would you like to do?
Automatically changes your Stack Exchange chat messages to Sᴍᴀʟʟᴄᴀᴘs
// ==UserScript==
// @name Smallcaps.SE
// @author Cameron Bernhardt (AstroCB)
// @description Automatically changes your Stack Exchange chat messages to Sᴍᴀʟʟᴄᴀᴘs
// @version 1.1
// @namespace http://github.com/AstroCB
// @include *://chat.meta.stackexchange.com/rooms/*
// @include *://chat.stackexchange.com/rooms/*
// @include *://chat.stackoverflow.com/rooms/*
// ==/UserScript==
var smallCaps = {
"a": "ᴀ",
"b": "ʙ",
"c": "ᴄ",
"d": "ᴅ",
"e": "ᴇ",
"f": "ғ",
"g": "ɢ",
"h": "ʜ",
"i": "ɪ",
"j": "ᴊ",
"k": "ᴋ",
"l": "ʟ",
"m": "ᴍ",
"n": "ɴ",
"o": "ᴏ",
"p": "ᴘ",
"q": "ǫ",
"r": "ʀ",
"s": "s",
"t": "ᴛ",
"u": "ᴜ",
"v": "ᴠ",
"w": "ᴡ",
"x": "x",
"y": "ʏ",
"z": "ᴢ"
}
var field = document.getElementById("input");
field.addEventListener("keyup", function() {
var text = field.value;
text = text.replace(/([a-z])/g, function(match) {
return smallCaps[match];
});
field.value = text;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment