-
-
Save cyancey76/ff5db81cbc948c9e92b4cd18a9f9adc8 to your computer and use it in GitHub Desktop.
Chat numbers for #indiediscotheque
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
var chatsolab = 1; | |
$("#chat-txt-message").bind("keyup", function() { | |
var start = this.selectionStart; | |
var lastChar = String.fromCharCode(this.value.charCodeAt(start - 1)); | |
if( lastChar == "@" ) { | |
$("#chat-txt-message").val("@"); | |
} else if( lastChar == "!" ) { | |
$("#chat-txt-message").val("!"); | |
} else if( event.which == 13 ) { | |
var chatsolab = Math.floor(Math.random() * 1000) + 1; | |
if (chatsolab < 10) { | |
chatsolab = "0" + chatsolab; | |
} | |
$("#chat-txt-message").val("`"+chatsolab+"` "); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment