Created
July 5, 2017 14:26
-
-
Save LovroM/d0867f346a9033b8c5b5fba72f0ad5f2 to your computer and use it in GitHub Desktop.
mojcimer obvescevalnik
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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