Can you post the source code so that people can examine it?
I'am not sure if this is the full code because I got other files but I guess this is the part that gets the PMs etc .. you could use an extention on google chrome that allow you to see source codes of extensions .
(function(window) {
var BTC = {
appversion: "1.0.1",
pms: [],
Init: function() {
BTC.OPT.Check();
BTC.bg.Init();
chrome.notifications.onButtonClicked.addListener(BTC.handlers.notificationButtonClicked);
},
handlers: {
notificationButtonClicked: function(notificationId, buttonIndex) {
if (notificationId.substr(0, 5) == 'BTCPM' && !isNaN(parseInt(notificationId.substr(5)))) {
var pm = BTC.pms[parseInt(notificationId.substr(5))];
if (buttonIndex == 0) {
chrome.tabs.create({
url: 'https://bitcointalk.org/index.php?action=pm#msg' + pm.id
});
} else {
chrome.tabs.create({
url: 'https://bitcointalk.org/index.php?action=profile;u=' + pm.sender.id
});
}
}
}
},
OPT: {
Get: function(c) {
return localStorage.getItem(c)
},
Set: function(c, d) {
return localStorage.setItem(c, d)
},
Remove: function(c) {
return localStorage.removeItem(c)
},
Reset: function() {
localStorage.clear();
BTC.OPT.Check();
},
Check: function() {
if (BTC.OPT.Get("APILastPM") == null) {
BTC.OPT.Set("APILastPM", 0)
}
if (BTC.OPT.Get("PMCheckDelay") == null || parseInt(BTC.OPT.Get("PMCheckDelay")) != BTC.OPT.Get("PMCheckDelay") || BTC.OPT.Get("PMCheckDelay") < 20 * 1000) {
BTC.OPT.Set("PMCheckDelay", 100000)
}
}
},
API: {
getPMS: function(callback) {
$.get('https://bitcointalk.org/index.php?action=pm')
.always(function(data) {
var pms = $($(data)[42])
.find('table > tbody > tr > td > form > table > tbody > tr[class^="windowbg"]');
if (pms.length > 0) {
var cleanpms = {};
pms.each(function() {
var pmdata = $(this)
.find('td');
var status = pmdata.eq(0)
.find('img')
.attr('alt');
var pminfo = {
subject: pmdata.eq(2)
.find('a')
.text(),
id: parseInt(pmdata.eq(2)
.find('a')
.attr('href')
.replace('#msg', '')),
readed: (status == 'Read' || status == 'Replied To'),
replied: (status == 'Replied To'),
date: pmdata.eq(1)
.text(),
sender: {
username: pmdata.eq(3)
.find('a')
.text(),
id: parseInt(pmdata.eq(3)
.find('a')
.attr('href')
.split(';u=')[1])
}
};
cleanpms[pminfo.id] = pminfo;
});
callback(cleanpms);
} else {
callback(false);
}
});
},
getAvatar: function(user, callback) {
$.get('https://bitcointalk.org/useravatars/avatar_' + user + '.png')
.always(function(plain, success, raw) {
callback((raw.status == 200) ? 'https://bitcointalk.org/useravatars/avatar_' + user + '.png' : '/assets/icon_128.png');
});
}
},
bg: {
timer: null,
Init: function(c) {
if (c != false) {
BTC.bg.tick();
}
},
tick: function() {
var delay = BTC.OPT.Get("PMCheckDelay") || 100000;
BTC.bg.timer = setTimeout(function() {
BTC.bg.tick()
}, delay);
BTC.API.getPMS(BTC.bg.handlePMS);
},
handlePMS: function(pms) {
BTC.pms = pms;
if (Object.keys(pms)
.length > 0) {
// More than 1 PM
var highestPM = BTC.OPT.Get("APILastPM");
$.each(pms, function() {
var pm = this;
if (pm.id > BTC.OPT.Get("APILastPM")) {
highestPM = Math.max(highestPM, pm.id);
BTC.API.getAvatar(pm.sender.id, function(avatar) {
chrome.notifications.create('BTCPM' + pm.id, {
type: 'basic',
iconUrl: avatar,
title: 'Private message from ' + pm.sender.username,
message: pm.subject,
buttons: [{
title: 'View PM'
}, {
title: 'View sender profile'
}],
isClickable: false
});
});
}
});
BTC.OPT.Set("APILastPM", highestPM);
}
}
}
};
window.BTC = BTC
})(window);
$(document)
.ready(window.BTC.Init);
{
"update_url": "https://clients2.google.com/service/update2/crx",
"name": "BitcoinTalk",
"description": "This application will give you a notification when you receive a private message on BitcoinTalk",
"version": "1.0.1",
"manifest_version": 2,
"icons": {
"32": "/assets/icon_32.png",
"57": "/assets/icon_57.png",
"64": "/assets/icon_64.png",
"128": "/assets/icon_128.png",
"256": "/assets/icon_256.png",
"512": "/assets/icon_512.png"
},
"homepage_url": "https://bitcointalk.org/",
"offline_enabled": false,
"background": {
"page": "/background.html"
},
"permissions": [
"notifications",
"tabs",
"webRequest",
"
"
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
}
@OP , could you please consider making an extension that checks and watch sections then notify us when a new thread it's made ? that would be awesome ! It's boring to click "Watchlist" each time and you don't know when there is one .