-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbriskapp.js
More file actions
34 lines (31 loc) · 911 Bytes
/
briskapp.js
File metadata and controls
34 lines (31 loc) · 911 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
30
31
32
33
34
angular.module('briskChromeExtension', ['palette'])
.controller('MainCtrl', function($scope, paletteService, $timeout) {
var commands = [
{
name: "Google",
cmd: 'extLink',
data: 'https://google.com'
},
{
name: "Reddit",
cmd: 'extLink',
data: 'http://reddit.com'
}
];
var links = document.getElementsByTagName('a');
for(var i = 0, l = links.length ; i < l ; i++){
if(links[i].textContent !== ''){
commands.push({
name: 'GOTO: ' + links[i].textContent,
cmd: 'extLink',
data: links[i].href
});
}
}
chrome.runtime.sendMessage({command: "getBookmarks"}, function (bookmarks) {
console.log(commands.length);
commands.push.apply(commands, bookmarks);
console.log(commands.length);
paletteService.exportCommands(commands);
});
});