├── .gitignore
├── builder
├── assets
│ ├── compiled.txt
│ ├── original.txt
│ └── raw.txt
└── run.js
├── builds
├── packed
│ ├── firefox.xpi
│ ├── icon.png
│ ├── icon64.png
│ └── install.rdf
└── unpacked
│ └── firefox
│ ├── data
│ └── icons
│ │ ├── 128.png
│ │ ├── 16.png
│ │ ├── 19.png
│ │ ├── 24.png
│ │ ├── 256.png
│ │ ├── 32.png
│ │ ├── 38.png
│ │ ├── 48.png
│ │ ├── 64.png
│ │ └── disabled
│ │ ├── 128.png
│ │ ├── 16.png
│ │ ├── 19.png
│ │ ├── 24.png
│ │ ├── 256.png
│ │ ├── 32.png
│ │ ├── 38.png
│ │ ├── 48.png
│ │ └── 64.png
│ ├── lib
│ ├── common.js
│ ├── config.js
│ ├── firefox
│ │ └── firefox.js
│ └── utils
│ │ └── filter.js
│ └── package.json
├── drawings
├── icon.xcf
├── large tile.png
├── screenshot.png
└── screenshot.xcf
├── gulpfile.js
└── src
├── data
└── icons
│ ├── 128.png
│ ├── 16.png
│ ├── 19.png
│ ├── 24.png
│ ├── 256.png
│ ├── 32.png
│ ├── 38.png
│ ├── 48.png
│ ├── 64.png
│ └── disabled
│ ├── 128.png
│ ├── 16.png
│ ├── 19.png
│ ├── 24.png
│ ├── 256.png
│ ├── 32.png
│ ├── 38.png
│ ├── 48.png
│ └── 64.png
├── lib
├── chrome
│ ├── EventEmitter.js
│ ├── background.html
│ └── chrome.js
├── common.js
├── config.js
├── firefox
│ └── firefox.js
└── utils
│ └── filter.js
├── manifest.json
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | addon-sdk*
2 | node_modules/
3 | test/
4 | .DS_Store
5 | Thumbs.db
--------------------------------------------------------------------------------
/builder/assets/compiled.txt:
--------------------------------------------------------------------------------
1 | {"api-read.":{"api-read.facebook.com/restserver.php?api_key=":[[],[["||api-read.facebook.com/restserver.php?api_key=",["third-party"]]]]},"api.faceb":{"api.facebook.com":[[],[["||api.facebook.com^",["third-party"]]]]},"badge.fac":{"badge.facebook.com":[[],[["||badge.facebook.com^",["third-party"]]]]},"connect.f":{"connect.facebook.com":[[],[["||connect.facebook.com^",["third-party","domain=~facebook.net|~fb.com"]]]],"connect.facebook.net":[[["||connect.facebook.net*/all.js",["domain=salon.com|damnyouautocorrect.com|southpark.cc.com|sci2.tv|pogo.com|adultswim.com|interviewmagazine.com"]]],[["||connect.facebook.net^",["third-party","domain=~facebook.com|~fb.com"]]]]},"facebook.":{"facebook.com/connect/":[[],[["||facebook.com/connect/",["third-party"]]]],"facebook.com/dialog/oauth?display=popup":[[],[["||facebook.com/dialog/oauth?display=popup",["popup","domain=humorhub.org"]]]],"facebook.com/plugins/activity.php?":[[],[["||facebook.com/plugins/activity.php?",["third-party"]]]],"facebook.com/plugins/comments.php?":[[],[["||facebook.com/plugins/comments.php?",["third-party"]]]],"facebook.com/plugins/facepile.php?":[[],[["||facebook.com/plugins/facepile.php?",["third-party"]]]],"facebook.com/plugins/fan.php?":[[],[["||facebook.com/plugins/fan.php?",["third-party"]]]],"facebook.com/plugins/follow.php":[[],[["||facebook.com/plugins/follow.php",["third-party"]]]],"facebook.com/plugins/like.php?":[[],[["||facebook.com/plugins/like.php?",["third-party"]]]],"facebook.com/plugins/like_box.php":[[],[["||facebook.com/plugins/like_box.php",["third-party"]]]],"facebook.com/plugins/likebox.php?":[[],[["||facebook.com/plugins/likebox.php?",["third-party"]]]],"facebook.com/plugins/recommendations.php?":[[],[["||facebook.com/plugins/recommendations.php?",["third-party"]]]],"facebook.com/plugins/recommendations_bar.php?":[[],[["||facebook.com/plugins/recommendations_bar.php?",["third-party"]]]],"facebook.com/plugins/send.php?":[[],[["||facebook.com/plugins/send.php?",["third-party"]]]],"facebook.com/plugins/share_button.php?":[[],[["||facebook.com/plugins/share_button.php?",["third-party"]]]],"facebook.com/plugins/subscribe.php":[[],[["||facebook.com/plugins/subscribe.php",["third-party"]]]],"facebook.com/plugins/subscribe?":[[],[["||facebook.com/plugins/subscribe?",["third-party"]]]],"facebook.com/restserver.php?":[[],[["||facebook.com/restserver.php?*.getStats&",["third-party"]]]],"facebook.com/whitepages/wpminiprofile.php":[[],[["||facebook.com/whitepages/wpminiprofile.php",["third-party"]]]],"facebook.com/widgets/activity.php?":[[],[["||facebook.com/widgets/activity.php?",["third-party"]]]],"facebook.com/widgets/fan.php?":[[],[["||facebook.com/widgets/fan.php?",["third-party"]]]],"facebook.com/widgets/like.php?":[[],[["||facebook.com/widgets/like.php?",["third-party"]]]],"facebook.com/widgets/recommendations.php?":[[],[["||facebook.com/widgets/recommendations.php?",["third-party"]]]],"fbcdn-profile-a.akamaihd.net":[[],[["||fbcdn-profile-a.akamaihd.net^",["third-party","domain=~facebook.com"]]]],"graph.facebook.com/?id=":[[],[["||graph.facebook.com/?id=",["third-party"]]]],"graph.facebook.com":[[["||graph.facebook.com^",["xmlhttprequest","domain=theguardian.com"]]],[["||graph.facebook.com^",["xmlhttprequest","third-party"]]]],"profile.ak.fbcdn.net":[[],[["||profile.ak.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"scontent-a.":[[],[["||scontent-a.*.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"static.ak.fbcdn.net":[[],[["||static.ak.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"akamaihd.net/rsrc.php/":[[["||akamaihd.net/rsrc.php/",["domain=facebook.com"]]],[]],"channel.facebook.com":[[["||channel.facebook.com^",["domain=facebook.com"]]],[]],"facebook.com/ajax/browse/":[[["||facebook.com/ajax/browse/",["domain=facebook.com"]]],[]],"facebook.com/ajax/bz":[[["||facebook.com/ajax/bz",["domain=facebook.com"]]],[]],"facebook.com/ajax/chat/buddy_list.php":[[["||facebook.com/ajax/chat/buddy_list.php",["domain=facebook.com"]]],[]],"facebook.com/ajax/chat/hovercard/":[[["||facebook.com/ajax/chat/hovercard/",["domain=facebook.com"]]],[]],"facebook.com/ajax/hovercard/":[[["||facebook.com/ajax/hovercard/",["domain=facebook.com"]]],[]],"facebook.com/ajax/litestand/":[[["||facebook.com/ajax/litestand/",["domain=facebook.com"]]],[]],"facebook.com/ajax/notifications/":[[["||facebook.com/ajax/notifications/",["domain=facebook.com"]]],[]],"facebook.com/ajax/pagelet/":[[["||facebook.com/ajax/pagelet/",["domain=facebook.com"]]],[]],"facebook.com/ajax/photos/":[[["||facebook.com/ajax/photos/",["domain=facebook.com"]]],[]],"facebook.com/ajax/presence/":[[["||facebook.com/ajax/presence/",["domain=facebook.com"]]],[]],"facebook.com/ajax/typeahead/":[[["||facebook.com/ajax/typeahead/",["domain=facebook.com"]]],[]],"facebook.com/ajax/webstorage/":[[["||facebook.com/ajax/webstorage/",["domain=facebook.com"]]],[]],"facebook.com/chat/":[[["||facebook.com/chat/",["domain=facebook.com"]]],[]],"facebook.com/images/":[[["||facebook.com/images/",["domain=facebook.com"]]],[]],"fbcdn-photos-":[[["||fbcdn-photos-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbcdn-profile-":[[["||fbcdn-profile-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbcdn-sphotos-":[[["||fbcdn-sphotos-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbexternal-":[[["||fbexternal-*.akamaihd.net^",["domain=facebook.com"]]],[]],"scontent-":[[["||scontent-*.fbcdn.net^",["domain=facebook.com"]]],[]]},"google.co":{"google.com/js/plusone.js":[[["||google.com/js/plusone.js",["domain=abcnews.go.com|watch.nba.com"]]],[["||google.com/js/plusone.js",["third-party"]]]]},"spot.im/e":{"spot.im/embed/scripts/launcher.js":[[],[["||spot.im/embed/scripts/launcher.js",["third-party"]]]]}}
--------------------------------------------------------------------------------
/builder/assets/original.txt:
--------------------------------------------------------------------------------
1 | [Adblock Plus 2.0]
2 | ! Checksum: IFigFzsyqA63eW9uc9dqWg
3 | ! Title: Anti-Facebook List
4 | ! Expires: 4 days (update frequency)
5 | ! Homepage: http://www.fanboy.co.nz
6 | !
7 | ! Warning, will break on facebook-based comment sites and may also break on some facebook apps or games.
8 | !
9 | ! Thirdparty Filters
10 | !
11 | ||api-read.facebook.com/restserver.php?api_key=$third-party
12 | ||api.facebook.com^$third-party
13 | ||badge.facebook.com^$third-party
14 | ||connect.facebook.com^$third-party,domain=~facebook.net|~fb.com
15 | ||connect.facebook.net^$third-party,domain=~facebook.com|~fb.com
16 | ||facebook.com/connect/$third-party
17 | ||facebook.com/dialog/oauth?display=popup$popup,domain=humorhub.org
18 | ||facebook.com/plugins/activity.php?$third-party
19 | ||facebook.com/plugins/comments.php?$third-party
20 | ||facebook.com/plugins/facepile.php?$third-party
21 | ||facebook.com/plugins/fan.php?$third-party
22 | ||facebook.com/plugins/follow.php$third-party
23 | ||facebook.com/plugins/like.php?$third-party
24 | ||facebook.com/plugins/like_box.php$third-party
25 | ||facebook.com/plugins/likebox.php?$third-party
26 | ||facebook.com/plugins/recommendations.php?$third-party
27 | ||facebook.com/plugins/recommendations_bar.php?$third-party
28 | ||facebook.com/plugins/send.php?$third-party
29 | ||facebook.com/plugins/share_button.php?$third-party
30 | ||facebook.com/plugins/subscribe.php$third-party
31 | ||facebook.com/plugins/subscribe?$third-party
32 | ||facebook.com/restserver.php?*.getStats&$third-party
33 | ||facebook.com/whitepages/wpminiprofile.php$third-party
34 | ||facebook.com/widgets/activity.php?$third-party
35 | ||facebook.com/widgets/fan.php?$third-party
36 | ||facebook.com/widgets/like.php?$third-party
37 | ||facebook.com/widgets/recommendations.php?$third-party
38 | ||fbcdn-profile-a.akamaihd.net^$third-party,domain=~facebook.com
39 | ||google.com/js/plusone.js$third-party
40 | ||graph.facebook.com/?id=$third-party
41 | ||graph.facebook.com^$xmlhttprequest,third-party
42 | ||profile.ak.fbcdn.net^$third-party,domain=~facebook.com
43 | ||scontent-a.*.fbcdn.net^$third-party,domain=~facebook.com
44 | ||spot.im/embed/scripts/launcher.js$third-party
45 | ||static.ak.fbcdn.net^$third-party,domain=~facebook.com
46 | !
47 | ! Test Filters (For Gannett sites, which don't work anyways with Facebook blocked)
48 | !
49 | ##.util-bar-module-firefly-visible
50 | !
51 | ! Whitelist Filters
52 | !
53 | @@||akamaihd.net/rsrc.php/$domain=facebook.com
54 | @@||channel.facebook.com^$domain=facebook.com
55 | @@||facebook.com/ajax/browse/$domain=facebook.com
56 | @@||facebook.com/ajax/bz$domain=facebook.com
57 | @@||facebook.com/ajax/chat/buddy_list.php$domain=facebook.com
58 | @@||facebook.com/ajax/chat/hovercard/$domain=facebook.com
59 | @@||facebook.com/ajax/hovercard/$domain=facebook.com
60 | @@||facebook.com/ajax/litestand/$domain=facebook.com
61 | @@||facebook.com/ajax/notifications/$domain=facebook.com
62 | @@||facebook.com/ajax/pagelet/$domain=facebook.com
63 | @@||facebook.com/ajax/photos/$domain=facebook.com
64 | @@||facebook.com/ajax/presence/$domain=facebook.com
65 | @@||facebook.com/ajax/typeahead/$domain=facebook.com
66 | @@||facebook.com/ajax/webstorage/$domain=facebook.com
67 | @@||facebook.com/chat/$domain=facebook.com
68 | @@||facebook.com/images/$domain=facebook.com
69 | @@||fbcdn-photos-*.akamaihd.net^$domain=facebook.com
70 | @@||fbcdn-profile-*.akamaihd.net^$domain=facebook.com
71 | @@||fbcdn-sphotos-*.akamaihd.net^$domain=facebook.com
72 | @@||fbexternal-*.akamaihd.net^$domain=facebook.com
73 | @@||scontent-*.fbcdn.net^$domain=facebook.com
74 | !
75 | ! Problematic sites
76 | !
77 | @@||connect.facebook.net*/all.js$domain=salon.com|damnyouautocorrect.com|southpark.cc.com|sci2.tv|pogo.com|adultswim.com|interviewmagazine.com
78 | @@||google.com/js/plusone.js$domain=abcnews.go.com|watch.nba.com
79 | @@||graph.facebook.com^$xmlhttprequest,domain=theguardian.com
80 |
--------------------------------------------------------------------------------
/builder/assets/raw.txt:
--------------------------------------------------------------------------------
1 | ||api-read.facebook.com/restserver.php?api_key=$third-party
2 | ||api.facebook.com^$third-party
3 | ||badge.facebook.com^$third-party
4 | ||connect.facebook.com^$third-party,domain=~facebook.net|~fb.com
5 | ||connect.facebook.net^$third-party,domain=~facebook.com|~fb.com
6 | ||facebook.com/connect/$third-party
7 | ||facebook.com/dialog/oauth?display=popup$popup,domain=humorhub.org
8 | ||facebook.com/plugins/activity.php?$third-party
9 | ||facebook.com/plugins/comments.php?$third-party
10 | ||facebook.com/plugins/facepile.php?$third-party
11 | ||facebook.com/plugins/fan.php?$third-party
12 | ||facebook.com/plugins/follow.php$third-party
13 | ||facebook.com/plugins/like.php?$third-party
14 | ||facebook.com/plugins/like_box.php$third-party
15 | ||facebook.com/plugins/likebox.php?$third-party
16 | ||facebook.com/plugins/recommendations.php?$third-party
17 | ||facebook.com/plugins/recommendations_bar.php?$third-party
18 | ||facebook.com/plugins/send.php?$third-party
19 | ||facebook.com/plugins/share_button.php?$third-party
20 | ||facebook.com/plugins/subscribe.php$third-party
21 | ||facebook.com/plugins/subscribe?$third-party
22 | ||facebook.com/restserver.php?*.getStats&$third-party
23 | ||facebook.com/whitepages/wpminiprofile.php$third-party
24 | ||facebook.com/widgets/activity.php?$third-party
25 | ||facebook.com/widgets/fan.php?$third-party
26 | ||facebook.com/widgets/like.php?$third-party
27 | ||facebook.com/widgets/recommendations.php?$third-party
28 | ||fbcdn-profile-a.akamaihd.net^$third-party,domain=~facebook.com
29 | ||google.com/js/plusone.js$third-party
30 | ||graph.facebook.com/?id=$third-party
31 | ||graph.facebook.com^$xmlhttprequest,third-party
32 | ||profile.ak.fbcdn.net^$third-party,domain=~facebook.com
33 | ||scontent-a.*.fbcdn.net^$third-party,domain=~facebook.com
34 | ||spot.im/embed/scripts/launcher.js$third-party
35 | ||static.ak.fbcdn.net^$third-party,domain=~facebook.com
36 | @@||akamaihd.net/rsrc.php/$domain=facebook.com
37 | @@||channel.facebook.com^$domain=facebook.com
38 | @@||facebook.com/ajax/browse/$domain=facebook.com
39 | @@||facebook.com/ajax/bz$domain=facebook.com
40 | @@||facebook.com/ajax/chat/buddy_list.php$domain=facebook.com
41 | @@||facebook.com/ajax/chat/hovercard/$domain=facebook.com
42 | @@||facebook.com/ajax/hovercard/$domain=facebook.com
43 | @@||facebook.com/ajax/litestand/$domain=facebook.com
44 | @@||facebook.com/ajax/notifications/$domain=facebook.com
45 | @@||facebook.com/ajax/pagelet/$domain=facebook.com
46 | @@||facebook.com/ajax/photos/$domain=facebook.com
47 | @@||facebook.com/ajax/presence/$domain=facebook.com
48 | @@||facebook.com/ajax/typeahead/$domain=facebook.com
49 | @@||facebook.com/ajax/webstorage/$domain=facebook.com
50 | @@||facebook.com/chat/$domain=facebook.com
51 | @@||facebook.com/images/$domain=facebook.com
52 | @@||fbcdn-photos-*.akamaihd.net^$domain=facebook.com
53 | @@||fbcdn-profile-*.akamaihd.net^$domain=facebook.com
54 | @@||fbcdn-sphotos-*.akamaihd.net^$domain=facebook.com
55 | @@||fbexternal-*.akamaihd.net^$domain=facebook.com
56 | @@||scontent-*.fbcdn.net^$domain=facebook.com
57 | @@||connect.facebook.net*/all.js$domain=salon.com|damnyouautocorrect.com|southpark.cc.com|sci2.tv|pogo.com|adultswim.com|interviewmagazine.com
58 | @@||google.com/js/plusone.js$domain=abcnews.go.com|watch.nba.com
59 | @@||graph.facebook.com^$xmlhttprequest,domain=theguardian.com
--------------------------------------------------------------------------------
/builder/run.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | var fs = require('fs');
3 |
4 | var original = 'assets/original.txt';
5 | var raw = 'assets/raw.txt';
6 | var compiled = 'assets/compiled.txt';
7 |
8 | function read (path, callback) {
9 | fs.readFile(original, function (err, data) {
10 | if (err) {
11 | throw err;
12 | }
13 | callback(data);
14 | });
15 | }
16 |
17 | function write (path, content, callback) {
18 | fs.writeFile(path, content, function (err) {
19 | if (err) {
20 | throw err;
21 | }
22 | if (callback) {
23 | callback();
24 | }
25 | });
26 | }
27 |
28 | function cleanup (list) {
29 | return list.filter(function (item) {
30 | return item && item[0] !== '[' && item[0] !== '!';
31 | })
32 | .filter(function (item) {
33 | return item.indexOf('##') === -1 && item.indexOf('#@#') === -1;
34 | })
35 | .filter(function (item) { // we do not accept regex patterns yet
36 | var tmp = item.indexOf('a-z') === -1 && item.indexOf('{2}');
37 | if (!tmp) {
38 | console.error('[regex]', item);
39 | }
40 | return tmp;
41 | });
42 | }
43 |
44 | function extractKeyword (str) {
45 | return str
46 | .split('$').shift()
47 | .replace('@@||', '^')
48 | .replace('@@|', '^')
49 | .replace('@@', '^')
50 | .replace('||', '^')
51 | .replace('|', '^')
52 | .replace('*', '^')
53 | .replace(',', '^')
54 | .split('^')
55 | .filter(function (q) {
56 | return q;
57 | })[0];
58 | }
59 |
60 | var len = 9, ignored = 0;
61 |
62 | read(original, function (content) {
63 | content += '';
64 | var list = content.split(/\r?\n\r?/);
65 | list = cleanup(list);
66 | write(raw, list.join('\n'));
67 | console.error('[1]');
68 | var keywords = list
69 | .map(extractKeyword)
70 | .filter(function (keyword, i) {
71 | var tmp = keyword.length >= len;
72 | if (!tmp) {
73 | ignored += 1;
74 | console.log('[ignoring]', ignored, list[i]);
75 | }
76 | return tmp;
77 | });
78 | var shortKeywords = keywords
79 | .map(function (keyword) {
80 | return keyword.substr(0, len);
81 | })
82 | .filter(function (k, i, l) {
83 | return l.indexOf(k) === i;
84 | });
85 | console.log('[2]');
86 | var objs = {};
87 | list.forEach(function (filter) {
88 | var keyword = shortKeywords.reduce(function (p, c) {
89 | return p || (filter.indexOf(c) !== -1 ? c : null);
90 | }, null);
91 | objs[keyword] = objs[keyword] || {};
92 | var qqq = extractKeyword(filter);
93 | objs[keyword][qqq] = objs[keyword][qqq] || [[], []];
94 | var tmp = filter.split('$');
95 | var code = tmp[0];
96 | var exceptions = tmp[1] ? tmp[1].split(',') : [];
97 | if (code.substr(0, 2) === '@@') {
98 | objs[keyword][qqq][0].push([code.replace('@@||', '||').replace('@@|', '||'), exceptions]);
99 | }
100 | else {
101 | objs[keyword][qqq][1].push([code, exceptions]);
102 | }
103 | });
104 | console.error('[3]');
105 | write(compiled, JSON.stringify(objs));
106 | });
107 |
--------------------------------------------------------------------------------
/builds/packed/firefox.xpi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/packed/firefox.xpi
--------------------------------------------------------------------------------
/builds/packed/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/packed/icon.png
--------------------------------------------------------------------------------
/builds/packed/icon64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/packed/icon64.png
--------------------------------------------------------------------------------
/builds/packed/install.rdf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | jid0-dBgF7UkIiOsWqvBng4hYu@jetpack
5 | 2
6 | true
7 | false
8 | 0.1.3
9 | Facebook™ Disconnect
10 | Facebook™ Disconnect is an efficient firewall to disconnect third-party websites from accessing to your Facebook.
11 | Morni Colhkher
12 |
13 |
14 |
15 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
16 | 38.0a1
17 | 43.0
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/128.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/16.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/19.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/24.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/256.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/32.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/38.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/48.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/64.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/128.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/16.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/19.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/24.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/256.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/32.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/38.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/48.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/data/icons/disabled/64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/builds/unpacked/firefox/data/icons/disabled/64.png
--------------------------------------------------------------------------------
/builds/unpacked/firefox/lib/common.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | // definitions:
3 | // http://sub.name.co.uk/index.html
4 | // domain: name.co.uk
5 | // host: sub.name.co.uk
6 |
7 | /**** wrapper (start) ****/
8 | var isFirefox = typeof require !== 'undefined';
9 |
10 | if (isFirefox) {
11 | var app = require('./firefox/firefox');
12 | var config = require('./config');
13 | var filter = require('./utils/filter');
14 | }
15 | /**** wrapper (end) ****/
16 | var blocks = {}, tops = {};
17 |
18 | // welcome
19 | (function () {
20 | var version = config.welcome.version;
21 | if (app.version() !== version) {
22 | app.timer.setTimeout(function () {
23 | app.tabs.open(
24 | config.urls.welcome + '?v=' + app.version() +
25 | (version && version !== 'undefined' ? '&p=' + version + '&type=upgrade' : '&type=install')
26 | );
27 | config.welcome.version = app.version();
28 | }, config.welcome.timeout * 1000);
29 | }
30 | })();
31 |
32 | var onCommand = (function () {
33 | var state = true;
34 | return function (e, s) {
35 | if (typeof s !== 'undefined') {
36 | state = s;
37 | }
38 | else {
39 | state = !state;
40 | }
41 | var path = './icons' + (state ? '' : '/disabled');
42 | app.button.icon =
43 | isFirefox ? {
44 | '16': path + '/16.png',
45 | '32': path + '/32.png',
46 | '64': path + '/64.png'
47 | } : {
48 | path: '../../data/' + path + '/38.png'
49 | };
50 | app.button.label = 'Facebook™ Disconnect ' + (state ? '(enabled)' : '(disabled)');
51 | app.storage.write('enabled', state);
52 | app.emit('update-badge');
53 | };
54 | })();
55 | app.button.onCommand(onCommand);
56 |
57 | app.on('update-badge', function () {
58 | if (app.storage.read('enabled') === 'false') {
59 | blocks = {};
60 | app.button.badge = 0;
61 | return;
62 | }
63 | app.tabs.activeId().then(function (tabId) {
64 | if (tabId !== null) {
65 | app.button.badge = blocks[tabId];
66 | }
67 | });
68 | });
69 | app.tabs.on('activate', function () {
70 | app.emit('update-badge');
71 | });
72 | app.tabs.on('ready', function () {
73 | app.emit('update-badge');
74 | });
75 | app.once('install-blocker', function () {
76 | app.block(function (u, t) {
77 | // reset badge if page is reloading
78 | if (tops[u.tabId] !== t.url || t.url === u.url) {
79 | //console.error('-- Tab is refreshed --', u.tabId);
80 | blocks[u.tabId] = 0;
81 | tops[u.tabId] = t.url;
82 | app.emit('update-badge');
83 | }
84 | // filter selection
85 | var keywords = filter.match(u.url);
86 | if (keywords.black.length) {
87 | if (filter.block(keywords, u, t)) {
88 | blocks[u.tabId] = blocks[u.tabId] ? blocks[u.tabId] + 1 : 1;
89 | app.emit('update-badge');
90 | return true;
91 | }
92 | else {
93 | return false;
94 | }
95 | }
96 | });
97 | });
98 |
99 | filter.initialize().then(function () {
100 | onCommand(null, app.storage.read('enabled') === 'false' ? false : true);
101 | app.emit('install-blocker');
102 | });
103 |
--------------------------------------------------------------------------------
/builds/unpacked/firefox/lib/config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var isFirefox = typeof require !== 'undefined';
4 | var config;
5 | if (isFirefox) {
6 | var app = require('./firefox/firefox.js');
7 | config = exports;
8 | }
9 | else {
10 | config = {};
11 | }
12 |
13 | config.welcome = {
14 | get version () {
15 | return app.storage.read('version');
16 | },
17 | set version (val) {
18 | app.storage.write('version', val);
19 | },
20 | timeout: 3
21 | };
22 |
23 | config.filter = {
24 | split: 8
25 | };
26 |
27 | config.urls = {
28 | welcome: 'http://mybrowseraddon.com/facebook-disconnect.html'
29 | };
30 |
31 | // Complex get and set
32 | config.get = function (name) {
33 | return name.split('.').reduce(function (p, c) {
34 | return p[c];
35 | }, config);
36 | };
37 | config.set = function (name, value) {
38 | function set(name, value, scope) {
39 | name = name.split('.');
40 | if (name.length > 1) {
41 | set.call((scope || this)[name.shift()], name.join('.'), value)
42 | }
43 | else {
44 | this[name[0]] = value;
45 | }
46 | }
47 | set(name, value, config);
48 | };
49 |
--------------------------------------------------------------------------------
/builds/unpacked/firefox/lib/firefox/firefox.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | // Load Firefox based resources
3 | var self = require('sdk/self'),
4 | sp = require('sdk/simple-prefs'),
5 | tabs = require('sdk/tabs'),
6 | timers = require('sdk/timers'),
7 | loader = require('@loader/options'),
8 | unload = require('sdk/system/unload'),
9 | tUtils = require('sdk/tabs/utils'),
10 | wUtils = require('sdk/window/utils'),
11 | buttons = require('sdk/ui/button/action'),
12 | {resolve} = require('sdk/core/promise'),
13 | {viewFor} = require('sdk/view/core'),
14 | {on, off, once, emit} = require('sdk/event/core'),
15 | {Cu} = require('chrome'),
16 | prefs = sp.prefs;
17 |
18 | var {WebRequest} = Cu.import('resource://gre/modules/WebRequest.jsm', {});
19 |
20 | // Promise
21 | exports.Promise = {resolve};
22 |
23 | // Event Emitter
24 | exports.on = on.bind(null, exports);
25 | exports.once = once.bind(null, exports);
26 | exports.emit = emit.bind(null, exports);
27 | exports.removeListener = function removeListener (type, listener) {
28 | off(exports, type, listener);
29 | };
30 |
31 | //toolbar button
32 | exports.button = (function () {
33 | var onClick;
34 | var button = buttons.ActionButton({
35 | id: self.name,
36 | label: 'Facebook™ Seen Blocker',
37 | icon: {
38 | '16': './icons/disabled/16.png',
39 | '32': './icons/disabled/32.png'
40 | },
41 | badgeColor: '#1f88e1',
42 | onClick: function (e) {
43 | if (onClick) {
44 | onClick(e);
45 | }
46 | }
47 | });
48 |
49 | return {
50 | onCommand: function (c) {
51 | onClick = c;
52 | },
53 | set icon (obj) { // jshint ignore:line
54 | button.icon = obj;
55 | },
56 | set label (label) { // jshint ignore:line
57 | button.label = label;
58 | },
59 | set badge (num) { // jshint ignore:line
60 | button.state('window', {
61 | badge: num || ''
62 | });
63 | }
64 | };
65 | })();
66 |
67 | exports.storage = {
68 | read: function (id) {
69 | return (prefs[id] || prefs[id] + '' === 'false' || !isNaN(prefs[id])) ? (prefs[id] + '') : null;
70 | },
71 | write: function (id, data) {
72 | data = data + '';
73 | if (data === 'true' || data === 'false') {
74 | prefs[id] = data === 'true' ? true : false;
75 | }
76 | else if (parseInt(data) + '' === data) {
77 | prefs[id] = parseInt(data);
78 | }
79 | else {
80 | prefs[id] = data + '';
81 | }
82 | }
83 | };
84 |
85 | exports.tabs = (function () {
86 | var tmp = {};
87 | var cache = new WeakMap();
88 | tmp.on = on.bind(null, tmp);
89 | tmp.open = function (url, inBackground, inCurrent) {
90 | if (inCurrent) {
91 | tabs.activeTab.url = url;
92 | }
93 | else {
94 | tabs.open({
95 | url: url,
96 | inBackground: typeof inBackground === 'undefined' ? false : inBackground
97 | });
98 | }
99 | };
100 | tmp.activeId = function () {
101 | let tab = tabs.activeTab;
102 | if (cache.get(tab)) {
103 | return resolve(cache.get(tab));
104 | }
105 | if (tab) {
106 | let win = tUtils.getTabContentWindow(viewFor(tab));
107 | if (win) {
108 | let id = wUtils.getOuterId(win);
109 | if (id) {
110 | cache.set(tab, id);
111 | }
112 | return resolve(id);
113 | }
114 | }
115 | return null;
116 | };
117 | tabs.on('activate', function (tab) {
118 | emit(tmp, 'activate', tab.id);
119 | });
120 | tabs.on('ready', function (tab) {
121 | emit(tmp, 'ready', tab.id);
122 | });
123 | return tmp;
124 | })();
125 |
126 | exports.version = function () {
127 | return self.version;
128 | };
129 |
130 | exports.timer = timers;
131 |
132 | exports.getURL = function (path) {
133 | return loader.prefixURI + loader.name + '/' + path;
134 | };
135 |
136 | exports.block = (function () {
137 | let block, uris = {};
138 | let listener = function (details) {
139 | if (!details.browser) {
140 | return;
141 | }
142 | let url = details.url, host = url.split('//').slice(0,2).pop().split('/').shift();
143 | // detect top level url
144 | if (details.type === 'main_frame') {
145 | uris[details.windowId] = {url: url, host: host};
146 | }
147 | if (block && uris[details.windowId] && block({url: url, host: host, tabId: details.windowId}, uris[details.windowId])) {
148 | return {cancel: true};
149 | }
150 | };
151 | function refresh () {
152 | if (prefs.enabled) {
153 | WebRequest.onBeforeRequest.addListener(listener, {}, ['blocking']);
154 | }
155 | else {
156 | WebRequest.onBeforeRequest.removeListener(listener);
157 | }
158 | }
159 |
160 | refresh();
161 | sp.on('enabled', refresh);
162 | unload.when(() => WebRequest.onBeforeRequest.removeListener(listener));
163 |
164 | return function (c) {
165 | block = c;
166 | };
167 | })();
168 |
--------------------------------------------------------------------------------
/builds/unpacked/firefox/lib/utils/filter.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var isFirefox = typeof require !== 'undefined';
4 | var filter;
5 | if (isFirefox) {
6 | filter = exports;
7 | var app = require('../firefox/firefox');
8 | }
9 | else {
10 | filter = {};
11 | }
12 |
13 | (function () {
14 | var keywords;
15 |
16 | function toDomain (url) {
17 | var host = url.split('//').slice(0, 2).pop().split('/').shift();
18 | var domain = /[\w\-]+((\.\w{2,3})+)$/.exec(host);
19 | return domain && domain.length ? domain[0].replace(/\^/g, '').replace(/\*/g, '') : host;
20 | }
21 |
22 | function check (rule, u, t) {
23 | var code = rule[0],
24 | exceptions = rule[1],
25 | ud = toDomain(u.host),
26 | td = toDomain(t.host);
27 |
28 | if (exceptions.length) { // there are exceptions
29 | if (exceptions.indexOf('third-party') !== -1) {
30 | if (ud === td) {
31 | return false;
32 | }
33 | }
34 | if (exceptions.indexOf('~third-party') !== -1) {
35 | if (ud !== td) {
36 | return false;
37 | }
38 | }
39 | var dEx = exceptions.filter(function (e) {
40 | return e.indexOf('domain=') !== -1;
41 | })[0];
42 | if (dEx) {
43 | var domains = dEx.substr(7).split('|');
44 | var w = domains.filter(function (d) {
45 | return d[0] === '~';
46 | })
47 | .map(function (d) {
48 | return d.substr(1);
49 | });
50 | if (w.length && w.indexOf(td) !== -1) {
51 | return false;
52 | }
53 | var b = domains.filter(function (d) {
54 | return d[0] !== '~';
55 | });
56 | if (b.length && b.indexOf(td) === -1) {
57 | return false;
58 | }
59 | }
60 | }
61 | code = code.replace(/([\:\/\.\?])/g, '\\$1') // special chars
62 | .replace(/^\|\|/, '[\\.\\/]') // ||
63 | .replace(/\^/g, '[^\\w\\d\\_\\-\\.\\%]') // ^
64 | .replace(/\*/g, '.*') // *
65 | .replace(/^\|/, '^') // |...
66 | .replace(/\|$/, '$'); // ...|
67 | return new RegExp(code, 'i').test(u.url);
68 | }
69 |
70 | filter.initialize = function () {
71 | keywords = {
72 | "api-read.":{"api-read.facebook.com/restserver.php?api_key=":[[],[["||api-read.facebook.com/restserver.php?api_key=",["third-party"]]]]},
73 | "api.faceb":{"api.facebook.com":[[],[["||api.facebook.com^",["third-party"]]]]},"badge.fac":{"badge.facebook.com":[[],[["||badge.facebook.com^",["third-party"]]]]},
74 | "connect.f":{"connect.facebook.com":[[],[["||connect.facebook.com^",["third-party","domain=~facebook.net|~fb.com"]]]],"connect.facebook.net":[[["||connect.facebook.net*/all.js",["domain=salon.com|damnyouautocorrect.com|southpark.cc.com|sci2.tv|pogo.com|adultswim.com|interviewmagazine.com"]]],[["||connect.facebook.net^",["third-party","domain=~facebook.com|~fb.com"]]]]},
75 | "facebook.":{"facebook.com/connect/":[[],[["||facebook.com/connect/",["third-party"]]]],"facebook.com/dialog/oauth?display=popup":[[],[["||facebook.com/dialog/oauth?display=popup",["popup","domain=humorhub.org"]]]],"facebook.com/plugins/activity.php?":[[],[["||facebook.com/plugins/activity.php?",["third-party"]]]],"facebook.com/plugins/comments.php?":[[],[["||facebook.com/plugins/comments.php?",["third-party"]]]],"facebook.com/plugins/facepile.php?":[[],[["||facebook.com/plugins/facepile.php?",["third-party"]]]],"facebook.com/plugins/fan.php?":[[],[["||facebook.com/plugins/fan.php?",["third-party"]]]],"facebook.com/plugins/follow.php":[[],[["||facebook.com/plugins/follow.php",["third-party"]]]],"facebook.com/plugins/like.php?":[[],[["||facebook.com/plugins/like.php?",["third-party"]]]],"facebook.com/plugins/like_box.php":[[],[["||facebook.com/plugins/like_box.php",["third-party"]]]],"facebook.com/plugins/likebox.php?":[[],[["||facebook.com/plugins/likebox.php?",["third-party"]]]],"facebook.com/plugins/recommendations.php?":[[],[["||facebook.com/plugins/recommendations.php?",["third-party"]]]],"facebook.com/plugins/recommendations_bar.php?":[[],[["||facebook.com/plugins/recommendations_bar.php?",["third-party"]]]],"facebook.com/plugins/send.php?":[[],[["||facebook.com/plugins/send.php?",["third-party"]]]],"facebook.com/plugins/share_button.php?":[[],[["||facebook.com/plugins/share_button.php?",["third-party"]]]],"facebook.com/plugins/subscribe.php":[[],[["||facebook.com/plugins/subscribe.php",["third-party"]]]],"facebook.com/plugins/subscribe?":[[],[["||facebook.com/plugins/subscribe?",["third-party"]]]],"facebook.com/restserver.php?":[[],[["||facebook.com/restserver.php?*.getStats&",["third-party"]]]],"facebook.com/whitepages/wpminiprofile.php":[[],[["||facebook.com/whitepages/wpminiprofile.php",["third-party"]]]],"facebook.com/widgets/activity.php?":[[],[["||facebook.com/widgets/activity.php?",["third-party"]]]],"facebook.com/widgets/fan.php?":[[],[["||facebook.com/widgets/fan.php?",["third-party"]]]],"facebook.com/widgets/like.php?":[[],[["||facebook.com/widgets/like.php?",["third-party"]]]],"facebook.com/widgets/recommendations.php?":[[],[["||facebook.com/widgets/recommendations.php?",["third-party"]]]],"fbcdn-profile-a.akamaihd.net":[[],[["||fbcdn-profile-a.akamaihd.net^",["third-party","domain=~facebook.com"]]]],"graph.facebook.com/?id=":[[],[["||graph.facebook.com/?id=",["third-party"]]]],"graph.facebook.com":[[["||graph.facebook.com^",["xmlhttprequest","domain=theguardian.com"]]],[["||graph.facebook.com^",["xmlhttprequest","third-party"]]]],"profile.ak.fbcdn.net":[[],[["||profile.ak.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"scontent-a.":[[],[["||scontent-a.*.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"static.ak.fbcdn.net":[[],[["||static.ak.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"akamaihd.net/rsrc.php/":[[["||akamaihd.net/rsrc.php/",["domain=facebook.com"]]],[]],"channel.facebook.com":[[["||channel.facebook.com^",["domain=facebook.com"]]],[]],"facebook.com/ajax/browse/":[[["||facebook.com/ajax/browse/",["domain=facebook.com"]]],[]],"facebook.com/ajax/bz":[[["||facebook.com/ajax/bz",["domain=facebook.com"]]],[]],"facebook.com/ajax/chat/buddy_list.php":[[["||facebook.com/ajax/chat/buddy_list.php",["domain=facebook.com"]]],[]],"facebook.com/ajax/chat/hovercard/":[[["||facebook.com/ajax/chat/hovercard/",["domain=facebook.com"]]],[]],"facebook.com/ajax/hovercard/":[[["||facebook.com/ajax/hovercard/",["domain=facebook.com"]]],[]],"facebook.com/ajax/litestand/":[[["||facebook.com/ajax/litestand/",["domain=facebook.com"]]],[]],"facebook.com/ajax/notifications/":[[["||facebook.com/ajax/notifications/",["domain=facebook.com"]]],[]],"facebook.com/ajax/pagelet/":[[["||facebook.com/ajax/pagelet/",["domain=facebook.com"]]],[]],"facebook.com/ajax/photos/":[[["||facebook.com/ajax/photos/",["domain=facebook.com"]]],[]],"facebook.com/ajax/presence/":[[["||facebook.com/ajax/presence/",["domain=facebook.com"]]],[]],"facebook.com/ajax/typeahead/":[[["||facebook.com/ajax/typeahead/",["domain=facebook.com"]]],[]],"facebook.com/ajax/webstorage/":[[["||facebook.com/ajax/webstorage/",["domain=facebook.com"]]],[]],"facebook.com/chat/":[[["||facebook.com/chat/",["domain=facebook.com"]]],[]],"facebook.com/images/":[[["||facebook.com/images/",["domain=facebook.com"]]],[]],"fbcdn-photos-":[[["||fbcdn-photos-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbcdn-profile-":[[["||fbcdn-profile-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbcdn-sphotos-":[[["||fbcdn-sphotos-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbexternal-":[[["||fbexternal-*.akamaihd.net^",["domain=facebook.com"]]],[]],"scontent-":[[["||scontent-*.fbcdn.net^",["domain=facebook.com"]]],[]]},
76 | "google.co":{"google.com/js/plusone.js":[[["||google.com/js/plusone.js",["domain=abcnews.go.com|watch.nba.com"]]],[["||google.com/js/plusone.js",["third-party"]]]]},
77 | "spot.im/e":{"spot.im/embed/scripts/launcher.js":[[],[["||spot.im/embed/scripts/launcher.js",["third-party"]]]]}
78 | };
79 |
80 | return app.Promise.resolve();
81 | };
82 |
83 | filter.match = function (url) {
84 | var n = url.length - 8; // keyword length is 8
85 | var black = [], white = [];
86 | for (var i = 0; i < n; i++) {
87 | var keyword = keywords[url.substr(i, 9)];
88 | if (keyword) {
89 | for (var fullKeyword in keyword) {
90 | if (url.indexOf(fullKeyword) !== -1) {
91 | white = white.concat(keyword[fullKeyword][0]);
92 | black = black.concat(keyword[fullKeyword][1]);
93 | }
94 | }
95 | }
96 | }
97 | return {
98 | black: black,
99 | white: white
100 | };
101 | };
102 |
103 | filter.block = function (keywords, u, t) {
104 | for (var j = 0; j < keywords.white.length; j++) {
105 | if (check(keywords.white[j], u, t)) {
106 | //console.error('[passed]', keywords.white[j], u.url);
107 | return false;
108 | }
109 | }
110 | for (var l = 0; l < keywords.black.length; l++) {
111 | if (check(keywords.black[l], u, t)) {
112 | //console.error('[blocked]', keywords.black[l], u.url);
113 | return true;
114 | }
115 | }
116 | return false;
117 | };
118 | })();
119 |
--------------------------------------------------------------------------------
/builds/unpacked/firefox/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "fullName": "Facebook™ Disconnect",
3 | "name": "isbffacebook",
4 | "description": "Facebook™ Disconnect is an efficient firewall to disconnect third-party websites from accessing to your Facebook.",
5 | "id": "jid0-dBgF7UkIiOsWqvBng4hYu@jetpack",
6 | "license": "mozilla public license 1.1",
7 | "version": "0.1.3",
8 | "author": "Morni Colhkher",
9 | "main": "./lib/common.js",
10 | "url": "http://mybrowseraddon.com/facebook-disconnect.html",
11 | "icon": "data/icons/32.png",
12 | "icon64": "data/icons/64.png",
13 | "permissions": {
14 | "private-browsing": true
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/drawings/icon.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/drawings/icon.xcf
--------------------------------------------------------------------------------
/drawings/large tile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/drawings/large tile.png
--------------------------------------------------------------------------------
/drawings/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/drawings/screenshot.png
--------------------------------------------------------------------------------
/drawings/screenshot.xcf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/drawings/screenshot.xcf
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var gulp = require('gulp');
4 | var change = require('gulp-change');
5 | var babel = require('gulp-babel');
6 | var gulpif = require('gulp-if');
7 | var gulpFilter = require('gulp-filter');
8 | var shell = require('gulp-shell');
9 | var wait = require('gulp-wait');
10 | var clean = require('gulp-clean');
11 | var zip = require('gulp-zip');
12 | var rename = require('gulp-rename');
13 | var util = require('gulp-util');
14 | var runSequence = require('run-sequence');
15 |
16 | /* clean */
17 | gulp.task('clean', function () {
18 | return gulp.src([
19 | 'builds/unpacked/chrome/*',
20 | 'builds/unpacked/firefox/*',
21 | ], {read: false})
22 | .pipe(clean());
23 | });
24 | /* chrome build */
25 | gulp.task('chrome-build', function () {
26 | gulp.src([
27 | 'src/**/*'
28 | ])
29 | .pipe(gulpFilter(function (f) {
30 | if (f.relative.indexOf('.DS_Store') !== -1 || f.relative.indexOf('Thumbs.db') !== -1) {
31 | return false;
32 | }
33 | if (f.relative.indexOf('firefox') !== -1 && f.relative.indexOf('firefox.png') === -1) {
34 | return false;
35 | }
36 | if (f.path.indexOf('/locale') !== -1) {
37 | return false;
38 | }
39 | if (f.relative.indexOf('safari') !== -1) {
40 | return false;
41 | }
42 | if (f.relative.split('/').length === 1) {
43 | return f.relative === 'manifest.json' ? true : false;
44 | }
45 | return true;
46 | }))
47 | .pipe(gulpif(function (f) {
48 | return f.path.indexOf('.js') !== -1 && f.path.indexOf('.json') === -1;
49 | }, change(function (content) {
50 | return content.replace(/\/\*\* wrapper[\s\S]*\\*\*\*\//m, '');
51 | })))
52 | .pipe(gulpif(function (f) {
53 | return f.path.indexOf('.html') !== -1;
54 | }, change(function (content) {
55 | return content.replace(/.*shadow_index\.js.*/, ' \n ');
56 | })))
57 | .pipe(gulp.dest('builds/unpacked/chrome'))
58 | .pipe(zip('chrome.zip'))
59 | .pipe(gulp.dest('builds/packed'));
60 | });
61 | gulp.task('chrome-install', function () {
62 | gulp.src('')
63 | .pipe(wait(1000))
64 | .pipe(shell([
65 | '"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --load-and-launch-app=`pwd` &'
66 | ], {
67 | cwd: './builds/unpacked/chrome'
68 | }));
69 | });
70 |
71 | /* firefox build */
72 | gulp.task('firefox-build', function () {
73 | gulp.src([
74 | 'src/**/*'
75 | ])
76 | .pipe(gulpFilter(function (f) {
77 | if (f.relative.indexOf('.DS_Store') !== -1 || f.relative.indexOf('Thumbs.db') !== -1) {
78 | return false;
79 | }
80 | if (f.path.indexOf('_locales') !== -1) {
81 | return false;
82 | }
83 | if (f.relative.indexOf('chrome') !== -1 &&
84 | f.relative !== 'chrome.manifest' &&
85 | f.relative.indexOf('chrome.png') === -1 &&
86 | f.relative.indexOf('firefox/chrome') === -1
87 | ) {
88 | return false;
89 | }
90 | if (f.relative.indexOf('shadow_index.js') !== -1) {
91 | return false;
92 | }
93 | if (f.relative.indexOf('safari') !== -1) {
94 | return false;
95 | }
96 | if (f.relative.split('/').length === 1) {
97 | return ['package.json', 'chrome.manifest'].indexOf(f.relative) !== -1;
98 | }
99 | return true;
100 | }))
101 | .pipe(gulpif(function (f) {
102 | return f.path.indexOf('.html') !== -1;
103 | }, change(function (content) {
104 | return content.replace(/\n.*shadow_index\.js.*/, '');
105 | })))
106 | .pipe(gulp.dest('builds/unpacked/firefox'));
107 | });
108 | /* firefox pack */
109 | gulp.task('firefox-pack', function () {
110 | gulp.src('')
111 | .pipe(wait(1000))
112 | .pipe(shell([
113 | 'jpm xpi',
114 | 'mv *.xpi ../../packed/firefox.xpi',
115 | 'jpm post --post-url http://localhost:8888/'
116 | ], {
117 | cwd: './builds/unpacked/firefox'
118 | }))
119 | .pipe(shell([
120 | 'zip firefox.xpi install.rdf icon.png icon64.png',
121 | ], {
122 | cwd: './builds/packed'
123 | }));
124 | });
125 | /* */
126 | gulp.task('chrome', function (callback) {
127 | runSequence('clean', 'chrome-build', 'chrome-install', callback);
128 | });
129 | gulp.task('firefox', function (callback) {
130 | runSequence('clean', 'firefox-build', 'firefox-pack', callback);
131 | });
132 |
--------------------------------------------------------------------------------
/src/data/icons/128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/128.png
--------------------------------------------------------------------------------
/src/data/icons/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/16.png
--------------------------------------------------------------------------------
/src/data/icons/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/19.png
--------------------------------------------------------------------------------
/src/data/icons/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/24.png
--------------------------------------------------------------------------------
/src/data/icons/256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/256.png
--------------------------------------------------------------------------------
/src/data/icons/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/32.png
--------------------------------------------------------------------------------
/src/data/icons/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/38.png
--------------------------------------------------------------------------------
/src/data/icons/48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/48.png
--------------------------------------------------------------------------------
/src/data/icons/64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/64.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/128.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/16.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/19.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/24.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/256.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/32.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/38.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/48.png
--------------------------------------------------------------------------------
/src/data/icons/disabled/64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cluclead/facebook-disconnect/d38d6d63e58cb3f683731955868ce2543c987df3/src/data/icons/disabled/64.png
--------------------------------------------------------------------------------
/src/lib/chrome/EventEmitter.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * EventEmitter v4.2.11 - git.io/ee
3 | * Unlicense - http://unlicense.org/
4 | * Oliver Caldwell - http://oli.me.uk/
5 | * @preserve
6 | */
7 |
8 | ;(function () {
9 | 'use strict';
10 |
11 | /**
12 | * Class for managing events.
13 | * Can be extended to provide event functionality in other classes.
14 | *
15 | * @class EventEmitter Manages event registering and emitting.
16 | */
17 | function EventEmitter() {}
18 |
19 | // Shortcuts to improve speed and size
20 | var proto = EventEmitter.prototype;
21 | var exports = this;
22 | var originalGlobalValue = exports.EventEmitter;
23 |
24 | /**
25 | * Finds the index of the listener for the event in its storage array.
26 | *
27 | * @param {Function[]} listeners Array of listeners to search through.
28 | * @param {Function} listener Method to look for.
29 | * @return {Number} Index of the specified listener, -1 if not found
30 | * @api private
31 | */
32 | function indexOfListener(listeners, listener) {
33 | var i = listeners.length;
34 | while (i--) {
35 | if (listeners[i].listener === listener) {
36 | return i;
37 | }
38 | }
39 |
40 | return -1;
41 | }
42 |
43 | /**
44 | * Alias a method while keeping the context correct, to allow for overwriting of target method.
45 | *
46 | * @param {String} name The name of the target method.
47 | * @return {Function} The aliased method
48 | * @api private
49 | */
50 | function alias(name) {
51 | return function aliasClosure() {
52 | return this[name].apply(this, arguments);
53 | };
54 | }
55 |
56 | /**
57 | * Returns the listener array for the specified event.
58 | * Will initialise the event object and listener arrays if required.
59 | * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
60 | * Each property in the object response is an array of listener functions.
61 | *
62 | * @param {String|RegExp} evt Name of the event to return the listeners from.
63 | * @return {Function[]|Object} All listener functions for the event.
64 | */
65 | proto.getListeners = function getListeners(evt) {
66 | var events = this._getEvents();
67 | var response;
68 | var key;
69 |
70 | // Return a concatenated array of all matching events if
71 | // the selector is a regular expression.
72 | if (evt instanceof RegExp) {
73 | response = {};
74 | for (key in events) {
75 | if (events.hasOwnProperty(key) && evt.test(key)) {
76 | response[key] = events[key];
77 | }
78 | }
79 | }
80 | else {
81 | response = events[evt] || (events[evt] = []);
82 | }
83 |
84 | return response;
85 | };
86 |
87 | /**
88 | * Takes a list of listener objects and flattens it into a list of listener functions.
89 | *
90 | * @param {Object[]} listeners Raw listener objects.
91 | * @return {Function[]} Just the listener functions.
92 | */
93 | proto.flattenListeners = function flattenListeners(listeners) {
94 | var flatListeners = [];
95 | var i;
96 |
97 | for (i = 0; i < listeners.length; i += 1) {
98 | flatListeners.push(listeners[i].listener);
99 | }
100 |
101 | return flatListeners;
102 | };
103 |
104 | /**
105 | * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
106 | *
107 | * @param {String|RegExp} evt Name of the event to return the listeners from.
108 | * @return {Object} All listener functions for an event in an object.
109 | */
110 | proto.getListenersAsObject = function getListenersAsObject(evt) {
111 | var listeners = this.getListeners(evt);
112 | var response;
113 |
114 | if (listeners instanceof Array) {
115 | response = {};
116 | response[evt] = listeners;
117 | }
118 |
119 | return response || listeners;
120 | };
121 |
122 | /**
123 | * Adds a listener function to the specified event.
124 | * The listener will not be added if it is a duplicate.
125 | * If the listener returns true then it will be removed after it is called.
126 | * If you pass a regular expression as the event name then the listener will be added to all events that match it.
127 | *
128 | * @param {String|RegExp} evt Name of the event to attach the listener to.
129 | * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
130 | * @return {Object} Current instance of EventEmitter for chaining.
131 | */
132 | proto.addListener = function addListener(evt, listener) {
133 | var listeners = this.getListenersAsObject(evt);
134 | var listenerIsWrapped = typeof listener === 'object';
135 | var key;
136 |
137 | for (key in listeners) {
138 | if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
139 | listeners[key].push(listenerIsWrapped ? listener : {
140 | listener: listener,
141 | once: false
142 | });
143 | }
144 | }
145 |
146 | return this;
147 | };
148 |
149 | /**
150 | * Alias of addListener
151 | */
152 | proto.on = alias('addListener');
153 |
154 | /**
155 | * Semi-alias of addListener. It will add a listener that will be
156 | * automatically removed after its first execution.
157 | *
158 | * @param {String|RegExp} evt Name of the event to attach the listener to.
159 | * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
160 | * @return {Object} Current instance of EventEmitter for chaining.
161 | */
162 | proto.addOnceListener = function addOnceListener(evt, listener) {
163 | return this.addListener(evt, {
164 | listener: listener,
165 | once: true
166 | });
167 | };
168 |
169 | /**
170 | * Alias of addOnceListener.
171 | */
172 | proto.once = alias('addOnceListener');
173 |
174 | /**
175 | * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
176 | * You need to tell it what event names should be matched by a regex.
177 | *
178 | * @param {String} evt Name of the event to create.
179 | * @return {Object} Current instance of EventEmitter for chaining.
180 | */
181 | proto.defineEvent = function defineEvent(evt) {
182 | this.getListeners(evt);
183 | return this;
184 | };
185 |
186 | /**
187 | * Uses defineEvent to define multiple events.
188 | *
189 | * @param {String[]} evts An array of event names to define.
190 | * @return {Object} Current instance of EventEmitter for chaining.
191 | */
192 | proto.defineEvents = function defineEvents(evts) {
193 | for (var i = 0; i < evts.length; i += 1) {
194 | this.defineEvent(evts[i]);
195 | }
196 | return this;
197 | };
198 |
199 | /**
200 | * Removes a listener function from the specified event.
201 | * When passed a regular expression as the event name, it will remove the listener from all events that match it.
202 | *
203 | * @param {String|RegExp} evt Name of the event to remove the listener from.
204 | * @param {Function} listener Method to remove from the event.
205 | * @return {Object} Current instance of EventEmitter for chaining.
206 | */
207 | proto.removeListener = function removeListener(evt, listener) {
208 | var listeners = this.getListenersAsObject(evt);
209 | var index;
210 | var key;
211 |
212 | for (key in listeners) {
213 | if (listeners.hasOwnProperty(key)) {
214 | index = indexOfListener(listeners[key], listener);
215 |
216 | if (index !== -1) {
217 | listeners[key].splice(index, 1);
218 | }
219 | }
220 | }
221 |
222 | return this;
223 | };
224 |
225 | /**
226 | * Alias of removeListener
227 | */
228 | proto.off = alias('removeListener');
229 |
230 | /**
231 | * Adds listeners in bulk using the manipulateListeners method.
232 | * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
233 | * You can also pass it a regular expression to add the array of listeners to all events that match it.
234 | * Yeah, this function does quite a bit. That's probably a bad thing.
235 | *
236 | * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
237 | * @param {Function[]} [listeners] An optional array of listener functions to add.
238 | * @return {Object} Current instance of EventEmitter for chaining.
239 | */
240 | proto.addListeners = function addListeners(evt, listeners) {
241 | // Pass through to manipulateListeners
242 | return this.manipulateListeners(false, evt, listeners);
243 | };
244 |
245 | /**
246 | * Removes listeners in bulk using the manipulateListeners method.
247 | * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
248 | * You can also pass it an event name and an array of listeners to be removed.
249 | * You can also pass it a regular expression to remove the listeners from all events that match it.
250 | *
251 | * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
252 | * @param {Function[]} [listeners] An optional array of listener functions to remove.
253 | * @return {Object} Current instance of EventEmitter for chaining.
254 | */
255 | proto.removeListeners = function removeListeners(evt, listeners) {
256 | // Pass through to manipulateListeners
257 | return this.manipulateListeners(true, evt, listeners);
258 | };
259 |
260 | /**
261 | * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
262 | * The first argument will determine if the listeners are removed (true) or added (false).
263 | * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
264 | * You can also pass it an event name and an array of listeners to be added/removed.
265 | * You can also pass it a regular expression to manipulate the listeners of all events that match it.
266 | *
267 | * @param {Boolean} remove True if you want to remove listeners, false if you want to add.
268 | * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
269 | * @param {Function[]} [listeners] An optional array of listener functions to add/remove.
270 | * @return {Object} Current instance of EventEmitter for chaining.
271 | */
272 | proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
273 | var i;
274 | var value;
275 | var single = remove ? this.removeListener : this.addListener;
276 | var multiple = remove ? this.removeListeners : this.addListeners;
277 |
278 | // If evt is an object then pass each of its properties to this method
279 | if (typeof evt === 'object' && !(evt instanceof RegExp)) {
280 | for (i in evt) {
281 | if (evt.hasOwnProperty(i) && (value = evt[i])) {
282 | // Pass the single listener straight through to the singular method
283 | if (typeof value === 'function') {
284 | single.call(this, i, value);
285 | }
286 | else {
287 | // Otherwise pass back to the multiple function
288 | multiple.call(this, i, value);
289 | }
290 | }
291 | }
292 | }
293 | else {
294 | // So evt must be a string
295 | // And listeners must be an array of listeners
296 | // Loop over it and pass each one to the multiple method
297 | i = listeners.length;
298 | while (i--) {
299 | single.call(this, evt, listeners[i]);
300 | }
301 | }
302 |
303 | return this;
304 | };
305 |
306 | /**
307 | * Removes all listeners from a specified event.
308 | * If you do not specify an event then all listeners will be removed.
309 | * That means every event will be emptied.
310 | * You can also pass a regex to remove all events that match it.
311 | *
312 | * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
313 | * @return {Object} Current instance of EventEmitter for chaining.
314 | */
315 | proto.removeEvent = function removeEvent(evt) {
316 | var type = typeof evt;
317 | var events = this._getEvents();
318 | var key;
319 |
320 | // Remove different things depending on the state of evt
321 | if (type === 'string') {
322 | // Remove all listeners for the specified event
323 | delete events[evt];
324 | }
325 | else if (evt instanceof RegExp) {
326 | // Remove all events matching the regex.
327 | for (key in events) {
328 | if (events.hasOwnProperty(key) && evt.test(key)) {
329 | delete events[key];
330 | }
331 | }
332 | }
333 | else {
334 | // Remove all listeners in all events
335 | delete this._events;
336 | }
337 |
338 | return this;
339 | };
340 |
341 | /**
342 | * Alias of removeEvent.
343 | *
344 | * Added to mirror the node API.
345 | */
346 | proto.removeAllListeners = alias('removeEvent');
347 |
348 | /**
349 | * Emits an event of your choice.
350 | * When emitted, every listener attached to that event will be executed.
351 | * If you pass the optional argument array then those arguments will be passed to every listener upon execution.
352 | * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
353 | * So they will not arrive within the array on the other side, they will be separate.
354 | * You can also pass a regular expression to emit to all events that match it.
355 | *
356 | * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
357 | * @param {Array} [args] Optional array of arguments to be passed to each listener.
358 | * @return {Object} Current instance of EventEmitter for chaining.
359 | */
360 | proto.emitEvent = function emitEvent(evt, args) {
361 | var listeners = this.getListenersAsObject(evt);
362 | var listener;
363 | var i;
364 | var key;
365 | var response;
366 |
367 | for (key in listeners) {
368 | if (listeners.hasOwnProperty(key)) {
369 | i = listeners[key].length;
370 |
371 | while (i--) {
372 | // If the listener returns true then it shall be removed from the event
373 | // The function is executed either with a basic call or an apply if there is an args array
374 | listener = listeners[key][i];
375 |
376 | if (listener.once === true) {
377 | this.removeListener(evt, listener.listener);
378 | }
379 |
380 | response = listener.listener.apply(this, args || []);
381 |
382 | if (response === this._getOnceReturnValue()) {
383 | this.removeListener(evt, listener.listener);
384 | }
385 | }
386 | }
387 | }
388 |
389 | return this;
390 | };
391 |
392 | /**
393 | * Alias of emitEvent
394 | */
395 | proto.trigger = alias('emitEvent');
396 |
397 | /**
398 | * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
399 | * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
400 | *
401 | * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
402 | * @param {...*} Optional additional arguments to be passed to each listener.
403 | * @return {Object} Current instance of EventEmitter for chaining.
404 | */
405 | proto.emit = function emit(evt) {
406 | var args = Array.prototype.slice.call(arguments, 1);
407 | return this.emitEvent(evt, args);
408 | };
409 |
410 | /**
411 | * Sets the current value to check against when executing listeners. If a
412 | * listeners return value matches the one set here then it will be removed
413 | * after execution. This value defaults to true.
414 | *
415 | * @param {*} value The new value to check for when executing listeners.
416 | * @return {Object} Current instance of EventEmitter for chaining.
417 | */
418 | proto.setOnceReturnValue = function setOnceReturnValue(value) {
419 | this._onceReturnValue = value;
420 | return this;
421 | };
422 |
423 | /**
424 | * Fetches the current value to check against when executing listeners. If
425 | * the listeners return value matches this one then it should be removed
426 | * automatically. It will return true by default.
427 | *
428 | * @return {*|Boolean} The current value to check for or the default, true.
429 | * @api private
430 | */
431 | proto._getOnceReturnValue = function _getOnceReturnValue() {
432 | if (this.hasOwnProperty('_onceReturnValue')) {
433 | return this._onceReturnValue;
434 | }
435 | else {
436 | return true;
437 | }
438 | };
439 |
440 | /**
441 | * Fetches the events object and creates one if required.
442 | *
443 | * @return {Object} The events storage object.
444 | * @api private
445 | */
446 | proto._getEvents = function _getEvents() {
447 | return this._events || (this._events = {});
448 | };
449 |
450 | /**
451 | * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
452 | *
453 | * @return {Function} Non conflicting EventEmitter class.
454 | */
455 | EventEmitter.noConflict = function noConflict() {
456 | exports.EventEmitter = originalGlobalValue;
457 | return EventEmitter;
458 | };
459 |
460 | // Expose the class either via AMD, CommonJS or the global object
461 | if (typeof define === 'function' && define.amd) {
462 | define(function () {
463 | return EventEmitter;
464 | });
465 | }
466 | else if (typeof module === 'object' && module.exports){
467 | module.exports = EventEmitter;
468 | }
469 | else {
470 | exports.EventEmitter = EventEmitter;
471 | }
472 | }.call(this));
473 |
--------------------------------------------------------------------------------
/src/lib/chrome/background.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/lib/chrome/chrome.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var app = new EventEmitter();
4 | app.on('load', function () {
5 | var script = document.createElement('script');
6 | document.body.appendChild(script);
7 | script.src = '../common.js';
8 | });
9 |
10 | app.Promise = Promise;
11 |
12 | app.storage = (function () {
13 | var objs = {};
14 | chrome.storage.local.get(null, function (o) {
15 | objs = o;
16 | app.emit('load');
17 | });
18 | return {
19 | read: function (id) {
20 | return objs[id] + '';
21 | },
22 | write: function (id, data) {
23 | objs[id] = data;
24 | var tmp = {};
25 | tmp[id] = data;
26 | chrome.storage.local.set(tmp, function () {});
27 | }
28 | };
29 | })();
30 |
31 | app.button = (function () {
32 | var onCommand;
33 | chrome.browserAction.onClicked.addListener(function () {
34 | if (onCommand) {
35 | onCommand();
36 | }
37 | });
38 | return {
39 | onCommand: function (c) {
40 | onCommand = c;
41 | },
42 | set icon (obj) {
43 | chrome.browserAction.setIcon(obj);
44 | },
45 | set label (label) {
46 | chrome.browserAction.setTitle({
47 | title: label
48 | });
49 | },
50 | set badge (num) {
51 | chrome.browserAction.setBadgeText({
52 | text: num ? num + '' : ''
53 | });
54 | chrome.browserAction.setBadgeBackgroundColor({
55 | color: config.ui.backgroundColor
56 | });
57 | }
58 | };
59 | })();
60 |
61 | app.tabs = (function () {
62 | var tmp = new EventEmitter();
63 | tmp.open = function (url, inBackground, inCurrent) {
64 | if (inCurrent) {
65 | chrome.tabs.update(null, {url: url});
66 | }
67 | else {
68 | chrome.tabs.create({
69 | url: url,
70 | active: typeof inBackground === 'undefined' ? true : !inBackground
71 | });
72 | }
73 | };
74 | tmp.activeId = function () {
75 | return new app.Promise(function (resolve) {
76 | chrome.tabs.query({active: true}, function (tabs) {
77 | var activeTab = tabs.reduce(function (p, c) {
78 | return p || (c.selected ? c : null);
79 | }, null) || tabs[0];
80 | resolve(activeTab ? activeTab.id : -1);
81 | });
82 | });
83 | };
84 | chrome.tabs.onActivated.addListener(function (activeInfo) {
85 | tmp.emit('activate', activeInfo.tabId);
86 | });
87 | chrome.tabs.onUpdated.addListener(function (tabId) {
88 | tmp.emit('ready', tabId);
89 | });
90 | return tmp;
91 | })();
92 |
93 | app.get = function (url) {
94 | var xhr = new XMLHttpRequest();
95 | var d = app.Promise.defer();
96 | xhr.onreadystatechange = function () {
97 | if (xhr.readyState === 4) {
98 | if (xhr.status !== 200) {
99 | d.reject(new Error(xhr.statusText));
100 | }
101 | else {
102 | d.resolve(xhr.responseText);
103 | }
104 | }
105 | };
106 | xhr.open('GET', url, true);
107 | xhr.send();
108 | return d.promise;
109 | };
110 |
111 | app.version = function () {
112 | return chrome[chrome.runtime && chrome.runtime.getManifest ? 'runtime' : 'extension'].getManifest().version;
113 | };
114 |
115 | app.timer = window;
116 |
117 | app.getURL = function (path) {
118 | return chrome.extension.getURL(path);
119 | };
120 |
121 | app.block = (function () {
122 | var block, uris = {};
123 | var listener = function (details) {
124 | var url = details.url, host = url.split('//').slice(0,2).pop().split('/').shift();
125 | // detect top level url
126 | if (details.type === 'main_frame') {
127 | uris[details.tabId] = {url: url, host: host};
128 | }
129 | if (block && uris[details.tabId] && block({url: url, host: host, tabId: details.tabId}, uris[details.tabId])) {
130 | return {cancel: true};
131 | }
132 | };
133 | function refresh () {
134 | if (app.storage.read('enabled') === 'true') {
135 | chrome.webRequest.onBeforeRequest.addListener(listener, {urls: ['']}, ['blocking']);
136 | }
137 | else {
138 | chrome.webRequest.onBeforeRequest.removeListener(listener);
139 | }
140 | }
141 |
142 | app.on('load', refresh);
143 | chrome.storage.onChanged.addListener(function (changes) {
144 | if (changes.enabled) {
145 | refresh();
146 | }
147 | });
148 |
149 | return function (c) {
150 | block = c;
151 | };
152 | })();
153 |
--------------------------------------------------------------------------------
/src/lib/common.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | // definitions:
3 | // http://sub.name.co.uk/index.html
4 | // domain: name.co.uk
5 | // host: sub.name.co.uk
6 |
7 | /**** wrapper (start) ****/
8 | var isFirefox = typeof require !== 'undefined';
9 |
10 | if (isFirefox) {
11 | var app = require('./firefox/firefox');
12 | var config = require('./config');
13 | var filter = require('./utils/filter');
14 | }
15 | /**** wrapper (end) ****/
16 | var blocks = {}, tops = {};
17 |
18 | // welcome
19 | (function () {
20 | var version = config.welcome.version;
21 | if (app.version() !== version) {
22 | app.timer.setTimeout(function () {
23 | app.tabs.open(
24 | config.urls.welcome + '?v=' + app.version() +
25 | (version && version !== 'undefined' ? '&p=' + version + '&type=upgrade' : '&type=install')
26 | );
27 | config.welcome.version = app.version();
28 | }, config.welcome.timeout * 1000);
29 | }
30 | })();
31 |
32 | var onCommand = (function () {
33 | var state = true;
34 | return function (e, s) {
35 | if (typeof s !== 'undefined') {
36 | state = s;
37 | }
38 | else {
39 | state = !state;
40 | }
41 | var path = './icons' + (state ? '' : '/disabled');
42 | app.button.icon =
43 | isFirefox ? {
44 | '16': path + '/16.png',
45 | '32': path + '/32.png',
46 | '64': path + '/64.png'
47 | } : {
48 | path: '../../data/' + path + '/38.png'
49 | };
50 | app.button.label = 'Facebook™ Disconnect ' + (state ? '(enabled)' : '(disabled)');
51 | app.storage.write('enabled', state);
52 | app.emit('update-badge');
53 | };
54 | })();
55 | app.button.onCommand(onCommand);
56 |
57 | app.on('update-badge', function () {
58 | if (app.storage.read('enabled') === 'false') {
59 | blocks = {};
60 | app.button.badge = 0;
61 | return;
62 | }
63 | app.tabs.activeId().then(function (tabId) {
64 | if (tabId !== null) {
65 | app.button.badge = blocks[tabId];
66 | }
67 | });
68 | });
69 | app.tabs.on('activate', function () {
70 | app.emit('update-badge');
71 | });
72 | app.tabs.on('ready', function () {
73 | app.emit('update-badge');
74 | });
75 | app.once('install-blocker', function () {
76 | app.block(function (u, t) {
77 | // reset badge if page is reloading
78 | if (tops[u.tabId] !== t.url || t.url === u.url) {
79 | //console.error('-- Tab is refreshed --', u.tabId);
80 | blocks[u.tabId] = 0;
81 | tops[u.tabId] = t.url;
82 | app.emit('update-badge');
83 | }
84 | // filter selection
85 | var keywords = filter.match(u.url);
86 | if (keywords.black.length) {
87 | if (filter.block(keywords, u, t)) {
88 | blocks[u.tabId] = blocks[u.tabId] ? blocks[u.tabId] + 1 : 1;
89 | app.emit('update-badge');
90 | return true;
91 | }
92 | else {
93 | return false;
94 | }
95 | }
96 | });
97 | });
98 |
99 | filter.initialize().then(function () {
100 | onCommand(null, app.storage.read('enabled') === 'false' ? false : true);
101 | app.emit('install-blocker');
102 | });
103 |
--------------------------------------------------------------------------------
/src/lib/config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var isFirefox = typeof require !== 'undefined';
4 | var config;
5 | if (isFirefox) {
6 | var app = require('./firefox/firefox.js');
7 | config = exports;
8 | }
9 | else {
10 | config = {};
11 | }
12 |
13 | config.welcome = {
14 | get version () {
15 | return app.storage.read('version');
16 | },
17 | set version (val) {
18 | app.storage.write('version', val);
19 | },
20 | timeout: 3
21 | };
22 |
23 | config.filter = {
24 | split: 8
25 | };
26 |
27 | config.urls = {
28 | welcome: 'http://mybrowseraddon.com/facebook-disconnect.html'
29 | };
30 |
31 | // Complex get and set
32 | config.get = function (name) {
33 | return name.split('.').reduce(function (p, c) {
34 | return p[c];
35 | }, config);
36 | };
37 | config.set = function (name, value) {
38 | function set(name, value, scope) {
39 | name = name.split('.');
40 | if (name.length > 1) {
41 | set.call((scope || this)[name.shift()], name.join('.'), value)
42 | }
43 | else {
44 | this[name[0]] = value;
45 | }
46 | }
47 | set(name, value, config);
48 | };
49 |
--------------------------------------------------------------------------------
/src/lib/firefox/firefox.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | // Load Firefox based resources
3 | var self = require('sdk/self'),
4 | sp = require('sdk/simple-prefs'),
5 | tabs = require('sdk/tabs'),
6 | timers = require('sdk/timers'),
7 | loader = require('@loader/options'),
8 | unload = require('sdk/system/unload'),
9 | tUtils = require('sdk/tabs/utils'),
10 | wUtils = require('sdk/window/utils'),
11 | buttons = require('sdk/ui/button/action'),
12 | {resolve} = require('sdk/core/promise'),
13 | {viewFor} = require('sdk/view/core'),
14 | {on, off, once, emit} = require('sdk/event/core'),
15 | {Cu} = require('chrome'),
16 | prefs = sp.prefs;
17 |
18 | var {WebRequest} = Cu.import('resource://gre/modules/WebRequest.jsm', {});
19 |
20 | // Promise
21 | exports.Promise = {resolve};
22 |
23 | // Event Emitter
24 | exports.on = on.bind(null, exports);
25 | exports.once = once.bind(null, exports);
26 | exports.emit = emit.bind(null, exports);
27 | exports.removeListener = function removeListener (type, listener) {
28 | off(exports, type, listener);
29 | };
30 |
31 | //toolbar button
32 | exports.button = (function () {
33 | var onClick;
34 | var button = buttons.ActionButton({
35 | id: self.name,
36 | label: 'Facebook™ Seen Blocker',
37 | icon: {
38 | '16': './icons/disabled/16.png',
39 | '32': './icons/disabled/32.png'
40 | },
41 | badgeColor: '#1f88e1',
42 | onClick: function (e) {
43 | if (onClick) {
44 | onClick(e);
45 | }
46 | }
47 | });
48 |
49 | return {
50 | onCommand: function (c) {
51 | onClick = c;
52 | },
53 | set icon (obj) { // jshint ignore:line
54 | button.icon = obj;
55 | },
56 | set label (label) { // jshint ignore:line
57 | button.label = label;
58 | },
59 | set badge (num) { // jshint ignore:line
60 | button.state('window', {
61 | badge: num || ''
62 | });
63 | }
64 | };
65 | })();
66 |
67 | exports.storage = {
68 | read: function (id) {
69 | return (prefs[id] || prefs[id] + '' === 'false' || !isNaN(prefs[id])) ? (prefs[id] + '') : null;
70 | },
71 | write: function (id, data) {
72 | data = data + '';
73 | if (data === 'true' || data === 'false') {
74 | prefs[id] = data === 'true' ? true : false;
75 | }
76 | else if (parseInt(data) + '' === data) {
77 | prefs[id] = parseInt(data);
78 | }
79 | else {
80 | prefs[id] = data + '';
81 | }
82 | }
83 | };
84 |
85 | exports.tabs = (function () {
86 | var tmp = {};
87 | var cache = new WeakMap();
88 | tmp.on = on.bind(null, tmp);
89 | tmp.open = function (url, inBackground, inCurrent) {
90 | if (inCurrent) {
91 | tabs.activeTab.url = url;
92 | }
93 | else {
94 | tabs.open({
95 | url: url,
96 | inBackground: typeof inBackground === 'undefined' ? false : inBackground
97 | });
98 | }
99 | };
100 | tmp.activeId = function () {
101 | let tab = tabs.activeTab;
102 | if (cache.get(tab)) {
103 | return resolve(cache.get(tab));
104 | }
105 | if (tab) {
106 | let win = tUtils.getTabContentWindow(viewFor(tab));
107 | if (win) {
108 | let id = wUtils.getOuterId(win);
109 | if (id) {
110 | cache.set(tab, id);
111 | }
112 | return resolve(id);
113 | }
114 | }
115 | return null;
116 | };
117 | tabs.on('activate', function (tab) {
118 | emit(tmp, 'activate', tab.id);
119 | });
120 | tabs.on('ready', function (tab) {
121 | emit(tmp, 'ready', tab.id);
122 | });
123 | return tmp;
124 | })();
125 |
126 | exports.version = function () {
127 | return self.version;
128 | };
129 |
130 | exports.timer = timers;
131 |
132 | exports.getURL = function (path) {
133 | return loader.prefixURI + loader.name + '/' + path;
134 | };
135 |
136 | exports.block = (function () {
137 | let block, uris = {};
138 | let listener = function (details) {
139 | if (!details.browser) {
140 | return;
141 | }
142 | let url = details.url, host = url.split('//').slice(0,2).pop().split('/').shift();
143 | // detect top level url
144 | if (details.type === 'main_frame') {
145 | uris[details.windowId] = {url: url, host: host};
146 | }
147 | if (block && uris[details.windowId] && block({url: url, host: host, tabId: details.windowId}, uris[details.windowId])) {
148 | return {cancel: true};
149 | }
150 | };
151 | function refresh () {
152 | if (prefs.enabled) {
153 | WebRequest.onBeforeRequest.addListener(listener, {}, ['blocking']);
154 | }
155 | else {
156 | WebRequest.onBeforeRequest.removeListener(listener);
157 | }
158 | }
159 |
160 | refresh();
161 | sp.on('enabled', refresh);
162 | unload.when(() => WebRequest.onBeforeRequest.removeListener(listener));
163 |
164 | return function (c) {
165 | block = c;
166 | };
167 | })();
168 |
--------------------------------------------------------------------------------
/src/lib/utils/filter.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var isFirefox = typeof require !== 'undefined';
4 | var filter;
5 | if (isFirefox) {
6 | filter = exports;
7 | var app = require('../firefox/firefox');
8 | }
9 | else {
10 | filter = {};
11 | }
12 |
13 | (function () {
14 | var keywords;
15 |
16 | function toDomain (url) {
17 | var host = url.split('//').slice(0, 2).pop().split('/').shift();
18 | var domain = /[\w\-]+((\.\w{2,3})+)$/.exec(host);
19 | return domain && domain.length ? domain[0].replace(/\^/g, '').replace(/\*/g, '') : host;
20 | }
21 |
22 | function check (rule, u, t) {
23 | var code = rule[0],
24 | exceptions = rule[1],
25 | ud = toDomain(u.host),
26 | td = toDomain(t.host);
27 |
28 | if (exceptions.length) { // there are exceptions
29 | if (exceptions.indexOf('third-party') !== -1) {
30 | if (ud === td) {
31 | return false;
32 | }
33 | }
34 | if (exceptions.indexOf('~third-party') !== -1) {
35 | if (ud !== td) {
36 | return false;
37 | }
38 | }
39 | var dEx = exceptions.filter(function (e) {
40 | return e.indexOf('domain=') !== -1;
41 | })[0];
42 | if (dEx) {
43 | var domains = dEx.substr(7).split('|');
44 | var w = domains.filter(function (d) {
45 | return d[0] === '~';
46 | })
47 | .map(function (d) {
48 | return d.substr(1);
49 | });
50 | if (w.length && w.indexOf(td) !== -1) {
51 | return false;
52 | }
53 | var b = domains.filter(function (d) {
54 | return d[0] !== '~';
55 | });
56 | if (b.length && b.indexOf(td) === -1) {
57 | return false;
58 | }
59 | }
60 | }
61 | code = code.replace(/([\:\/\.\?])/g, '\\$1') // special chars
62 | .replace(/^\|\|/, '[\\.\\/]') // ||
63 | .replace(/\^/g, '[^\\w\\d\\_\\-\\.\\%]') // ^
64 | .replace(/\*/g, '.*') // *
65 | .replace(/^\|/, '^') // |...
66 | .replace(/\|$/, '$'); // ...|
67 | return new RegExp(code, 'i').test(u.url);
68 | }
69 |
70 | filter.initialize = function () {
71 | keywords = {
72 | "api-read.":{"api-read.facebook.com/restserver.php?api_key=":[[],[["||api-read.facebook.com/restserver.php?api_key=",["third-party"]]]]},
73 | "api.faceb":{"api.facebook.com":[[],[["||api.facebook.com^",["third-party"]]]]},"badge.fac":{"badge.facebook.com":[[],[["||badge.facebook.com^",["third-party"]]]]},
74 | "connect.f":{"connect.facebook.com":[[],[["||connect.facebook.com^",["third-party","domain=~facebook.net|~fb.com"]]]],"connect.facebook.net":[[["||connect.facebook.net*/all.js",["domain=salon.com|damnyouautocorrect.com|southpark.cc.com|sci2.tv|pogo.com|adultswim.com|interviewmagazine.com"]]],[["||connect.facebook.net^",["third-party","domain=~facebook.com|~fb.com"]]]]},
75 | "facebook.":{"facebook.com/connect/":[[],[["||facebook.com/connect/",["third-party"]]]],"facebook.com/dialog/oauth?display=popup":[[],[["||facebook.com/dialog/oauth?display=popup",["popup","domain=humorhub.org"]]]],"facebook.com/plugins/activity.php?":[[],[["||facebook.com/plugins/activity.php?",["third-party"]]]],"facebook.com/plugins/comments.php?":[[],[["||facebook.com/plugins/comments.php?",["third-party"]]]],"facebook.com/plugins/facepile.php?":[[],[["||facebook.com/plugins/facepile.php?",["third-party"]]]],"facebook.com/plugins/fan.php?":[[],[["||facebook.com/plugins/fan.php?",["third-party"]]]],"facebook.com/plugins/follow.php":[[],[["||facebook.com/plugins/follow.php",["third-party"]]]],"facebook.com/plugins/like.php?":[[],[["||facebook.com/plugins/like.php?",["third-party"]]]],"facebook.com/plugins/like_box.php":[[],[["||facebook.com/plugins/like_box.php",["third-party"]]]],"facebook.com/plugins/likebox.php?":[[],[["||facebook.com/plugins/likebox.php?",["third-party"]]]],"facebook.com/plugins/recommendations.php?":[[],[["||facebook.com/plugins/recommendations.php?",["third-party"]]]],"facebook.com/plugins/recommendations_bar.php?":[[],[["||facebook.com/plugins/recommendations_bar.php?",["third-party"]]]],"facebook.com/plugins/send.php?":[[],[["||facebook.com/plugins/send.php?",["third-party"]]]],"facebook.com/plugins/share_button.php?":[[],[["||facebook.com/plugins/share_button.php?",["third-party"]]]],"facebook.com/plugins/subscribe.php":[[],[["||facebook.com/plugins/subscribe.php",["third-party"]]]],"facebook.com/plugins/subscribe?":[[],[["||facebook.com/plugins/subscribe?",["third-party"]]]],"facebook.com/restserver.php?":[[],[["||facebook.com/restserver.php?*.getStats&",["third-party"]]]],"facebook.com/whitepages/wpminiprofile.php":[[],[["||facebook.com/whitepages/wpminiprofile.php",["third-party"]]]],"facebook.com/widgets/activity.php?":[[],[["||facebook.com/widgets/activity.php?",["third-party"]]]],"facebook.com/widgets/fan.php?":[[],[["||facebook.com/widgets/fan.php?",["third-party"]]]],"facebook.com/widgets/like.php?":[[],[["||facebook.com/widgets/like.php?",["third-party"]]]],"facebook.com/widgets/recommendations.php?":[[],[["||facebook.com/widgets/recommendations.php?",["third-party"]]]],"fbcdn-profile-a.akamaihd.net":[[],[["||fbcdn-profile-a.akamaihd.net^",["third-party","domain=~facebook.com"]]]],"graph.facebook.com/?id=":[[],[["||graph.facebook.com/?id=",["third-party"]]]],"graph.facebook.com":[[["||graph.facebook.com^",["xmlhttprequest","domain=theguardian.com"]]],[["||graph.facebook.com^",["xmlhttprequest","third-party"]]]],"profile.ak.fbcdn.net":[[],[["||profile.ak.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"scontent-a.":[[],[["||scontent-a.*.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"static.ak.fbcdn.net":[[],[["||static.ak.fbcdn.net^",["third-party","domain=~facebook.com"]]]],"akamaihd.net/rsrc.php/":[[["||akamaihd.net/rsrc.php/",["domain=facebook.com"]]],[]],"channel.facebook.com":[[["||channel.facebook.com^",["domain=facebook.com"]]],[]],"facebook.com/ajax/browse/":[[["||facebook.com/ajax/browse/",["domain=facebook.com"]]],[]],"facebook.com/ajax/bz":[[["||facebook.com/ajax/bz",["domain=facebook.com"]]],[]],"facebook.com/ajax/chat/buddy_list.php":[[["||facebook.com/ajax/chat/buddy_list.php",["domain=facebook.com"]]],[]],"facebook.com/ajax/chat/hovercard/":[[["||facebook.com/ajax/chat/hovercard/",["domain=facebook.com"]]],[]],"facebook.com/ajax/hovercard/":[[["||facebook.com/ajax/hovercard/",["domain=facebook.com"]]],[]],"facebook.com/ajax/litestand/":[[["||facebook.com/ajax/litestand/",["domain=facebook.com"]]],[]],"facebook.com/ajax/notifications/":[[["||facebook.com/ajax/notifications/",["domain=facebook.com"]]],[]],"facebook.com/ajax/pagelet/":[[["||facebook.com/ajax/pagelet/",["domain=facebook.com"]]],[]],"facebook.com/ajax/photos/":[[["||facebook.com/ajax/photos/",["domain=facebook.com"]]],[]],"facebook.com/ajax/presence/":[[["||facebook.com/ajax/presence/",["domain=facebook.com"]]],[]],"facebook.com/ajax/typeahead/":[[["||facebook.com/ajax/typeahead/",["domain=facebook.com"]]],[]],"facebook.com/ajax/webstorage/":[[["||facebook.com/ajax/webstorage/",["domain=facebook.com"]]],[]],"facebook.com/chat/":[[["||facebook.com/chat/",["domain=facebook.com"]]],[]],"facebook.com/images/":[[["||facebook.com/images/",["domain=facebook.com"]]],[]],"fbcdn-photos-":[[["||fbcdn-photos-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbcdn-profile-":[[["||fbcdn-profile-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbcdn-sphotos-":[[["||fbcdn-sphotos-*.akamaihd.net^",["domain=facebook.com"]]],[]],"fbexternal-":[[["||fbexternal-*.akamaihd.net^",["domain=facebook.com"]]],[]],"scontent-":[[["||scontent-*.fbcdn.net^",["domain=facebook.com"]]],[]]},
76 | "google.co":{"google.com/js/plusone.js":[[["||google.com/js/plusone.js",["domain=abcnews.go.com|watch.nba.com"]]],[["||google.com/js/plusone.js",["third-party"]]]]},
77 | "spot.im/e":{"spot.im/embed/scripts/launcher.js":[[],[["||spot.im/embed/scripts/launcher.js",["third-party"]]]]}
78 | };
79 |
80 | return app.Promise.resolve();
81 | };
82 |
83 | filter.match = function (url) {
84 | var n = url.length - 8; // keyword length is 8
85 | var black = [], white = [];
86 | for (var i = 0; i < n; i++) {
87 | var keyword = keywords[url.substr(i, 9)];
88 | if (keyword) {
89 | for (var fullKeyword in keyword) {
90 | if (url.indexOf(fullKeyword) !== -1) {
91 | white = white.concat(keyword[fullKeyword][0]);
92 | black = black.concat(keyword[fullKeyword][1]);
93 | }
94 | }
95 | }
96 | }
97 | return {
98 | black: black,
99 | white: white
100 | };
101 | };
102 |
103 | filter.block = function (keywords, u, t) {
104 | for (var j = 0; j < keywords.white.length; j++) {
105 | if (check(keywords.white[j], u, t)) {
106 | //console.error('[passed]', keywords.white[j], u.url);
107 | return false;
108 | }
109 | }
110 | for (var l = 0; l < keywords.black.length; l++) {
111 | if (check(keywords.black[l], u, t)) {
112 | //console.error('[blocked]', keywords.black[l], u.url);
113 | return true;
114 | }
115 | }
116 | return false;
117 | };
118 | })();
119 |
--------------------------------------------------------------------------------
/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Facebook™ Disconnect",
3 | "short_name": "ifdisconnect",
4 | "description": "Facebook™ Disconnect is an efficient firewall to disconnect third-party websites from accessing to your Facebook.",
5 | "author": "Morni Colhkher",
6 | "version": "0.1.3",
7 | "manifest_version": 2,
8 | "permissions": [
9 | "storage",
10 | "tabs",
11 | "background",
12 | "webRequest",
13 | "webRequestBlocking",
14 | ""
15 | ],
16 | "web_accessible_resources": [],
17 | "browser_action": {
18 | "default_icon": "data/icons/16.png"
19 | },
20 | "background": {
21 | "page": "lib/chrome/background.html"
22 | },
23 | "homepage_url": "http://mybrowseraddon.com/facebook-disconnect.html",
24 | "icons": {
25 | "16": "data/icons/16.png",
26 | "19": "data/icons/19.png",
27 | "38": "data/icons/38.png",
28 | "48": "data/icons/48.png",
29 | "128": "data/icons/128.png"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "fullName": "Facebook™ Disconnect",
3 | "name": "isbffacebook",
4 | "description": "Facebook™ Disconnect is an efficient firewall to disconnect third-party websites from accessing to your Facebook.",
5 | "id": "jid0-dBgF7UkIiOsWqvBng4hYu@jetpack",
6 | "license": "mozilla public license 1.1",
7 | "version": "0.1.3",
8 | "author": "Morni Colhkher",
9 | "main": "./lib/common.js",
10 | "url": "http://mybrowseraddon.com/facebook-disconnect.html",
11 | "icon": "data/icons/32.png",
12 | "icon64": "data/icons/64.png",
13 | "permissions": {
14 | "private-browsing": true
15 | }
16 | }
17 |
--------------------------------------------------------------------------------