Skip to content

Instantly share code, notes, and snippets.

@LovroM
Created July 5, 2017 14:26
Show Gist options
  • Save LovroM/d0867f346a9033b8c5b5fba72f0ad5f2 to your computer and use it in GitHub Desktop.
Save LovroM/d0867f346a9033b8c5b5fba72f0ad5f2 to your computer and use it in GitHub Desktop.
mojcimer obvescevalnik
let lastApp;
const reg = /\<a href\=\"\/room\/(.{4})/;
const link = 'https://www.mojcimer.si/search?city=koper&type=&minarea=&maxarea=&bedrooms=&bathrooms=&minprice=&maxprice=';
$.ajax({ url: link, success: function(data) {
lastApp = reg.exec(data)[1];
}});
setInterval(dejPreveri, 30000);
function dejPreveri() {
$.ajax({ url: link, success: function(data) {
let match = reg.exec(data);
if (match[1]!==lastApp) {
alert("NOV OGLAS");
window.open("https://www.mojcimer.si/room/" + match[1], "_blank").focus();
lastApp = match[1];
}
else console.log("Nothing new...");
}});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment