49

GitHub links are posted in chat quite frequently, but the support of the appearance is somewhat poor:

<html><head><link rel="stylesheet" href="http://cdn-chat.sstatic.net/chat/css/chat.stackoverflow.com.css"></head><body><div id="transcript"><div class="monologue user-2246344"><div class="signature"><div class="tiny-signature"><div class="avatar avatar-16"><img width="16" height="16" src="http://i.stack.imgur.com/Y22En.png?s=128&amp;g=1&amp;g&amp;s=16" alt="Sam"></div><div class="username"><a href="http://chat.stackoverflow.com/users/2246344/sam" title="Sam">Sam</a></div></div></div><div class="messages"><div class="message" id="message-19853529"><a name="19853529" href="http://chat.stackoverflow.com/transcript/5?m=19853529#19853529"><span style="display:inline-block;" class="action-link edits"><span class="img menu"> </span></span></a><div class="content">Yeah, well apparently that's the only way to get the url :/</div><span class="flash"></span></div></div><div class="clear-both" style="height:0">&nbsp;</div></div><div class="monologue user-3622940 mine"><div class="signature"><div class="tiny-signature"><div class="avatar avatar-16"><img width="16" height="16" src="http://i.stack.imgur.com/w2od0.jpg?s=128&amp;g=1&amp;g&amp;s=16" alt="Unihedron"></div><div class="username"><a href="http://chat.stackoverflow.com/users/3622940/unihedron" title="Unihedron">Unihedron</a></div></div></div><div class="messages"><div class="message highlight" id="message-19853530"><a name="19853530" href="http://chat.stackoverflow.com/transcript/5?m=19853530#19853530"><span style="display:inline-block;" class="action-link"><span class="img menu"> </span></span></a><div class="content"><a href="https://github.com/Vincentyification/JavaBot/issues/7" rel="nofollow"><code>https://github.com/Vincentyification/JavaBot/issues/7</code></a></div><span class="flash"></span></div></div><div class="clear-both" style="height:0">&nbsp;</div></div><div class="monologue user-2246344"><div class="signature"><div class="tiny-signature"><div class="avatar avatar-16"><img width="16" height="16" src="http://i.stack.imgur.com/Y22En.png?s=128&amp;g=1&amp;g&amp;s=16" alt="Sam"></div><div class="username"><a href="http://chat.stackoverflow.com/users/2246344/sam" title="Sam">Sam</a></div></div></div><div class="messages"><div class="message" id="message-19853532"><a name="19853532" href="http://chat.stackoverflow.com/transcript/5?m=19853532#19853532"><span style="display:inline-block;" class="action-link"><span class="img menu"> </span></span></a><div class="content">Shame github doesn't onebox.</div></div></div><div class="clear-both" style="height:0">&nbsp;</div></div></div></body></html>

I suppose it would be prettier to one-box these issues, repositories and wiki posts etc into a one-boxed item, perhaps like this (hand-written CSS for prosperity):

.ob-github {
  padding: .8em 1.5em;
  background-color: White;
  color: #444444;
}
.ob-github-ticket img {
  height: 32px;
  width: 32px;
  float: left;
  margin-right: 4px;
}
.ob-github-ticket .title {
  margin-bottom: .5em;
  font-weight: 600;
}
.ob-github-ticket .title .title {
  margin-bottom: .5em;
  line-height: 1.1;
}
.ob-github-ticket .title .id,
.ob-github-ticket-meta .comments {
  margin-bottom: .5em;
  color: #aaa;
}
.ob-github-ticket-meta {
  color: #666666;
}
.ob-github-ticket-meta .author {
  font-weight: bold;
}
.ob-github-ticket-meta time {
  width: 87%;
}
.ob-github-ticket-meta p {
  font-weight: lighter;
}
<html><head><link rel="stylesheet" href="http://cdn-chat.sstatic.net/chat/css/chat.stackoverflow.com.css"></head><body><div id="transcript"><div class="monologue user-2246344"><div class="signature"><div class="tiny-signature"><div class="avatar avatar-16"><img width="16" height="16" src="http://i.stack.imgur.com/Y22En.png?s=128&amp;g=1&amp;g&amp;s=16" alt="Sam"></div><div class="username"><a href="http://chat.stackoverflow.com/users/2246344/sam" title="Sam">Sam</a></div></div></div><div class="messages"><div class="message" id="message-19853529"><a name="19853529" href="http://chat.stackoverflow.com/transcript/5?m=19853529#19853529"><span style="display:inline-block;" class="action-link edits"><span class="img menu"> </span></span></a><div class="content">Yeah, well apparently that's the only way to get the url :/</div><span class="flash"></span></div></div><div class="clear-both" style="height:0">&nbsp;</div></div><div class="monologue user-3622940 mine"><div class="signature"><div class="tiny-signature"><div class="avatar avatar-16"><img width="16" height="16" src="http://i.stack.imgur.com/w2od0.jpg?s=128&amp;g=1&amp;g&amp;s=16" alt="Unihedron"></div><div class="username"><a href="http://chat.stackoverflow.com/users/3622940/unihedron" title="Unihedron">Unihedron</a></div></div></div><div class="messages"><div class="message highlight" id="message-19853530"><a name="19853530" href="http://chat.stackoverflow.com/transcript/5?m=19853530#19853530"><span style="display:inline-block;" class="action-link"><span class="img menu"></span></span></a><div class="content"><div class="ob-github ob-github-ticket"><img title="Vogel612" src="https://avatars0.githubusercontent.com/u/7288995" /><a href="https://github.com/Vincentyification/JavaBot/issues/7" class="title"><span class="title">Sending messages with the mechanize approach fails</span>&nbsp;<span class="id">#7</span></a><div class="ob-github-ticket-meta"><span class="author">Vogel612</span> opened this issue <time datetime="2014-11-07T16:12:03Z" is="relative-time" title="Nov 8, 2014, 12:12 AM GMT+8">22 hours ago</time><p>Mechanize doesn't let us send messages yet. It seems that the Login to chat isn't succesfully mimicked yet, as the response is: "you must login to send messages"</p><p>A login to the SE-OpenId has been confirmed by checking the result page after login for the class "profile-me", that's given to<span>…</span>&nbsp;<span class="comments">9 comments</span></p></div></div></div><span class="flash"></span></div></div><div class="clear-both" style="height:0">&nbsp;</div></div><div class="monologue user-2246344"><div class="signature"><div class="tiny-signature"><div class="avatar avatar-16"><img width="16" height="16" src="http://i.stack.imgur.com/Y22En.png?s=128&amp;g=1&amp;g&amp;s=16" alt="Sam"></div><div class="username"><a href="http://chat.stackoverflow.com/users/2246344/sam" title="Sam">Sam</a></div></div></div><div class="messages"><div class="message" id="message-19853532"><a name="19853532" href="http://chat.stackoverflow.com/transcript/5?m=19853532#19853532"><span style="display:inline-block;" class="action-link"><span class="img menu"> </span></span></a><div class="content">Shame github doesn't onebox.</div></div></div><div class="clear-both" style="height:0">&nbsp;</div></div></div></body></html>

  • 16
    Nice stack snippets. – Infinite Recursion Nov 8 '14 at 16:06
  • 16
    "Shame github doesn't onebox." My famous last words... – Sam Nov 8 '14 at 16:27
  • 9
    Solid use of Snippets. You get my vote! – Haney Nov 11 '14 at 21:54
5

It's weird how this hasn't been implemented yet, seen as even XKCD comics are oneboxed. Github is an important place; at least more important than XKCD (yeah... I just said that ;).


Anyway, I've made a userscript to onebox links to Github on the client side; it will work for repos, issues, and pull requests.

You can install it from Github or view the source.

Thanks to you, U̶n̶i̶h̶e̶d̶r̶o̶n̶, for the CSS :)

If you're unsure on how to install userscripts, see the guide at StackApps.

This userscript is also on StackApps! :)

  • Looks like Unihedron is cancelled out and someone else gave the css – Universal Electricity Sep 24 '15 at 12:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .