Created
November 24, 2017 18:33
-
-
Save harunsmrkovic/ebd75bd1c47a712a63e6898d2b1952be to your computer and use it in GitHub Desktop.
pik poslana poruka
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
$.get('/poruke/outbox', data => { | |
const html = $.parseHTML(data) | |
const poruke = $( | |
html.filter(el => el.className && el.className.includes('container-poruke')) | |
) | |
.find('.jedna_konverzacija') | |
.map((i, poruka) => ({ | |
autor: $.trim( | |
$(poruka) | |
.find('.user') | |
.text() | |
.split(' (')[0] | |
), | |
oglas: $.trim( | |
$(poruka) | |
.find('.naslov') | |
.text() | |
) | |
})) | |
const naslov = $.trim($('#naslovartikla').text()) | |
const autor = $.trim($('.username > span').text()) | |
if ( | |
poruke.filter((i, poruka) => { | |
return poruka.autor === autor && naslov.includes(poruka.oglas) | |
}).length | |
) { | |
$('#posaljiporuku').before( | |
'<a class="linkovi_desno"><p>Vec poslana poruka</p></a>' | |
) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment