We've been using slack for new projects at work lately. We used Skype in the past and still do for calls, screen sharing and one-on-one chats but slack channels are a far better fit for team chats and keeping track of conversations related to a specific projects.
One thing that has always annoyed me a tiny bit is the delay when clicking on links due to slack linking to slack-redir.net
which then redirects to the actual link location. Popping open the Chrome dev-tools reveals that slack uses an onclick
handler to change the anchor element's href
to https://slack-redir.net...
:
<a href="http://www.danyow.net/aurelia-binding-behaviors/" data-referer-safe="1" onclick="this.href="https://slack-redir.net/link?url=http%3A%2F%2Fwww.danyow.net%2Faurelia-binding-behaviors%2F"" onmouseover="this.href=TS.utility.referer_safe_url_map["http%3A%2F%2Fwww.danyow.net%2Faurelia-binding-behaviors%2F"]" rel="noreferrer" target="_blank">http://www.danyow.net/aurelia-binding-behaviors/</a>
With a few lines of javascript we can replace these "slow" links with direct ones:
var links = document.querySelectorAll('a[onclick^=this\\.href\\=\\"https\\:\\/\\/slack-redir]'),
link,
i = links.length;
while (i--) {
link = links[i];
link.removeAttribute('onclick');
link.parentNode.replaceChild(link.cloneNode(true), link);
}
And with a few more lines of json this can be rolled into a chrome extension:
{
"manifest_version": 2,
"name": "slack-direct",
"description": "Love Slack? Hate slack-redir? Use slack-direct!",
"author": "Jeremy Danyow",
"icons": {
"128": "icon128.png"
},
"version": "1.0",
"content_scripts": [
{
"matches": ["https://*.slack.com/*"],
"js": ["main.js"]
}
]
}
Which brings me to...
slack-direct
A Chrome extension that removes pesky trip to slack-redir.net
when clicking on links in slack.
Get slack-direct at the Chrome Web Store. Checkout the source code on GitHub.