Skip to content

Instantly share code, notes, and snippets.

@tjperovich
Last active May 13, 2016 15:07
Show Gist options
  • Save tjperovich/45dfc7ba1a3ef487df6f to your computer and use it in GitHub Desktop.
Save tjperovich/45dfc7ba1a3ef487df6f to your computer and use it in GitHub Desktop.
Prevents Slack Desktop Notifications from closing themselves after 5/10 seconds has passed.
// ==UserScript==
// @name Persist Slack Desktop Notification
// @version 1.0
// @author TJP
// @match https://custom-domain.slack.com/messages/*
// @description Prevents Slack notifications from closing themselves.
// @grant none
// ==/UserScript==
window.oldSetTimeout = window.setTimeout;
window.setTimeout = function(func, delay) {
/*
* Even though the code reads:
* "function(){"
* we need to add a space since the js engine converts it to:
* "function (){"
*/
if (func && (func + '').indexOf("function (){if(f.cancel){f.cance")==0)
return;
return window.oldSetTimeout(func, delay);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment