Skip to content

Instantly share code, notes, and snippets.

@jeffrafter
Last active December 19, 2015 06:09
Show Gist options
  • Save jeffrafter/5909617 to your computer and use it in GitHub Desktop.
Save jeffrafter/5909617 to your computer and use it in GitHub Desktop.
A Theme for Slack or This is my theme for English B.
// What?! http://stackoverflow.com/a/5571069/700536
function multiline(f) {
return f.toString().
replace(/^[^\/]+\/\*!?/, '').
replace(/\*\/[^\/]+$/, '');
}
var overrides = multiline(function() {/*!
#messages_container {
background-color: #dfdfdf;
}
*/});
$('head').append("<style>"+overrides+"</style>");
var audio = document.createElement('audio');
$(audio).attr('src', "http://meaganproctorkavouras.com/levi.wav");
TS.ui.sounds.new_message = audio;
TS.ui.playSound('new_message');
// Leave reset false when you say something
function say(message, skipReset) {
if (!skipReset) {
window.channels = [];
$('a.channel_name').each(function() {
window.channels.push($(this).attr('href').replace('/channels/', ''));
});
}
setTimeout(function() {
if (window.channels.length == 0) return;
var chan = window.channels.pop();
$('#message-input').val('/open '+chan);
$('#message-input').parents('form').submit();
setTimeout(function() {
$('#message-input').val(message);
$('#message-input').parents('form').submit();
say(message, true);
}, 100);
}, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment