Answer the question
In order to leave comments, you need to log in
What should I write in js so that the interlocutor's name and photo are replaced in the VK dialog?
<a href="/durov" class="mem_link" target="_blank" wotsearchprocessed="true">Павел</a>
if (srvMsg) {
extend(row.insertCell(0), {colSpan: 5, className: 'im_srv_msg_td', innerHTML: '<div class="im_srv_msg">' + srvMsg + '</div>'});
} else {
if (peer_data && actual_peer && (user = peer_data.members[actual_peer])) {
user = [user.link, user.photo, user.name ];
} else {
if (out) {
user = ['/id' + cur.id , cur.photo, cur.name ]
} else {
var link = '/id' + fromId, photo = cur.tabs[peer_id].photo, name = cur.tabs[peer_id].name;
if (fromId < -2e9) {
if (peer_id > 2e9) {
name = 'Unknown';
link = '/im?sel=c'+(peer_id - 2e9);
} else {
link = '/im?sel=e'+(-fromId - 2e9);
}
photo = '/images/contact_50.gif';
} else if (peer_id > 2e9) {
name = 'Unknown';
photo = '/images/camera_c.gif';
}
user = [link, photo, name];
}
}
author_html = '<div class="im_log_author_chat_thumb"><a href="' + user[0] + '"><img src="' + user[1] + '" class="im_log_author_chat_thumb" width="32" height="32"/></a></div>';
message = '<div class="im_log_author_chat_name"><a href="' + user[0] + '" class="mem_link">'+ user[2] + '</a>' + msgInfo + '</div>' + message;
Answer the question
In order to leave comments, you need to log in
There is such a useful thing for such things, I used it on landing pages
https://github.com/protonet/jquery.inview
It works simply:
$('div').on('inview', function(event, isInView) {
if (isInView) {
// element is now visible in the viewport
} else {
// element has gone out of viewport
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question