Skip to content

Instantly share code, notes, and snippets.

@austintaylor
Forked from banderson623/userscript.js
Last active February 17, 2016 22:58
Show Gist options
  • Save austintaylor/1eddb0394e94988813b0 to your computer and use it in GitHub Desktop.
Save austintaylor/1eddb0394e94988813b0 to your computer and use it in GitHub Desktop.
My customizations for Slack in Fluid.app
.bot_message {
background: #F2F2F2 !important;
border-top: 8px solid #F2F2F2;
color: #666;
margin: 0 !important;
}
.message {
margin: 4px 0;
}
.message_content {
margin-left: 200px !important;
}
.message_content > .message_sender {
position: absolute !important;
width: 130px !important;
left: 80px !important;
text-align: right !important;
white-space: nowrap;
text-transform: capitalize;
overflow: hidden;
text-overflow: ellipsis;
}
.bot_label {
display: none !important;
}
#channel_creator_name {
display: none !important;
}
.inline_attachment[data-real-src*=".giphy.com"] {
display: none;
}
var clickOverrides = function(){
// Automatically mark ALL as read and scroll to it
// when clicking on a channel (stared or normal)
$('#channel-list, #starred-list').on('click',function(){
TS.ui.forceMarkAllRead();
TS.ui.scrollMsgsSoFirstUnreadMsgIsInView();
});
};
var onMessageClick = function(){
TS.ui.forceMarkAllRead();
TS.ui.scrollMsgsSoFirstUnreadMsgIsInView();
};
// Setup and use notification center! Yay.
function wkNotify(title,content,clickCallBack) {
if (!window.Notification) {
console.log('not supported');
return;
}
if (Notification.permission === 'denied') {
console.log("Can't show notification here");
} else if (Notification.permission === 'default') {
// Get permission
Notification.requestPermission(function() {
notify();
});
} else if (Notification.permission === 'granted') {
var wkNotification = window.webkitNotifications.createNotification(null, title, content);
if(typeof clickCallBack === "function"){
wkNotification.onclick = clickCallBack;
}
// Show that thing!
try {wkNotification.show();}
catch (e) {alert('error: '+e);}
}
}
// override the growl and use notification center
// wait 10 seconds for everything to load, then do this
setTimeout(function(){
clickOverrides();
wkNotify("Loaded custom scripts","");
TS.ui.growls.show = function(title, text, a,b,c){
wkNotify(title,text,onMessageClick);
};
},10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment