This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
popup.js
39 lines (36 loc) · 1.58 KB
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-35892158-1']);
_gaq.push(['_gat._anonymizeIp']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = 'https://ssl.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})()
document.addEventListener('DOMContentLoaded', function() {
var settings = new Store('settings', {
'show_mark_as_read': true,
'block_chat_seen': true,
'block_typing_indicator': false
// TODO
// 'block_group_seen': false
})
if (settings.get('block_chat_seen')) {
chrome.browserAction.setIcon({path: 'icon48.disabled.png'})
settings.set('block_chat_seen', false)
_gaq.push(['_trackEvent', 'Popup', 'quickToggle', 'disabled'])
var text = document.createTextNode('FB unseen disabled. All your friends will now see if you read their messages.')
} else {
chrome.browserAction.setIcon({path: 'icon48.png'})
settings.set('block_chat_seen', true)
_gaq.push(['_trackEvent', 'Popup', 'quickToggle', 'enabled'])
var text = document.createTextNode('FB unseen enabled. Your friends will not be notified when you read their messages.')
}
$('#message').html(text);
$.get('http://swege.github.io/fb-unseen/popup_news.html', function(data) {
$('#news').html(data);
$('#news a').click(function() {
_gaq.push(['_trackEvent', 'Popup', 'newsLinkClicked', $(this).text() + ' - ' + $(this).attr('href')]);
});
});
})