This is just sample script Paste your real code javascript or HTML her

 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
// This is just a sample script. Paste your real code (javascript or HTML) here.
console.log("background script");
var url = "https://vk.com/board176748083";
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.send();
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
var data = xhr.responseText;
f = new DOMParser().parseFromString(data, "text/html");
//alert(f);
var total = f.getElementById('blst_cont').childNodes.length;
setInterval(function rq() {
var new_url = "https://vk.com/board176748083";
var new_xhr = new XMLHttpRequest();
new_xhr.open('GET', url, true);
new_xhr.send();
new_xhr.onreadystatechange = function() {
if (new_xhr.readyState === XMLHttpRequest.DONE && new_xhr.status === 200) {
var new_data = new_xhr.responseText;
htm = new DOMParser().parseFromString(new_data, "text/html");
//alert(f);
var new_total = htm.getElementById('blst_cont').childNodes.length;
if (new_total > total) {
total++;
//alert("Все столько же заданий");
var title = htm.getElementById('blst_cont').children[0].children[1].children[0].children[0].innerText;
var link = "https://vk.com" + htm.getElementById('blst_cont').children[0].children[1].children[0].children[0].getAttribute('href');
var answer = confirm("Доступно новое задание: \n" + title + "\nПерейти к обсуждению?") if (answer) {
window.open(link);
}
}
}
}
}, 5000);
}
}