Skip to content

Instantly share code, notes, and snippets.

@Aleksandar-Mitic
Forked from LovroM/script.js
Created July 6, 2017 09:13
Show Gist options
  • Save Aleksandar-Mitic/f1c46d1ef74bfb4b28f4b56c731f213e to your computer and use it in GitHub Desktop.
Save Aleksandar-Mitic/f1c46d1ef74bfb4b28f4b56c731f213e 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