-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeys.js
More file actions
29 lines (26 loc) · 747 Bytes
/
Copy pathkeys.js
File metadata and controls
29 lines (26 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$(function(){
$('body').bind('keydown',function(e){
var url;
var item = $('.hovered-stream-item');
var links = $('.hovered-stream-item .tweet-text a');
if (links.length == 1){
if (links.attr('href').indexOf('twitter') == -1 && links.attr('href').indexOf('/') != 0 ) {
url = links.attr('href')
}
} else {
links.each(function() {
if(this.href.indexOf('twitter') == -1){
url = this.href;
}
});
}
if( url && e.which==79 && e.shiftKey ) {
window.open(url);
item.css({'background':'yellow'});
} else if ( url && e.which == 79 ) {
var msg = {"url": url};
chrome.extension.connect().postMessage(msg);
item.css({'background':'yellow'});
}
});
});