-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
30 lines (24 loc) · 838 Bytes
/
index.js
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
var self = require("sdk/self");
var pageMod = require("sdk/page-mod");
// Load URL data from a flat txt file
var urls = self.data.load('urls.json');
urls = JSON.parse(urls);
for(var url_index in urls) {
var url = urls[url_index],
//split_url = url.trim().split(' '),
match = url.match,
title = url.title,
hidden = url.onion;
// if there's no wildcard, or protocol, then add http and https
if(match.indexOf("*") == -1 && match.indexOf("://") == -1) {
match = new RegExp("http(s?)://"+match+"(?:/.*)?");
}
// debugging
console.log("Line:", url);
console.log("Match:", match);
pageMod.PageMod({
include: match,
contentScriptFile: self.data.url("bottombar.js"),
contentScriptOptions: {hidden: hidden, title: title, match:match}
});
}