Добрый день! Страница на php выводит сообщения, у каждого сообщения есть комментарии. Вопрос в следующем нужно при нажатии на ссылку у любого из сообщений подгружать его оставшиеся комментарии с БД. Поэтому, что лучше: 1. К каждому сообщению создавать свой js код на $.ajax, чтобы он отслеживал событие для своего сообщения? 2. Или использовать тег <a> и onclick? Нашел такой код: <a onclick="return wall.showReplies('-39561264_24725', false, false, event);" offs="3/12" href="..." > а в файле <script type="text/javascript" src="/page.js?796" ></SCRIPT>
| Код | repliesSideClick: function (post) { var postEl = ge('post' + post), r = ge('replies' + post), header = r && geByClass1('wr_header', r, 'a'), st = scrollGetY(), pos = getXY(r)[1];
if (st > pos) { scrollToY(pos - 100, 0); } hide('replies_side' + post); return Wall.showReplies(post, 3, false); }
showReply: function(post, reply) { if (cur.viewAsBox) return false; var p = ge('post' + reply); if (p) { Wall.highlightReply(p); } else { if (cur.wallLayer == post) { WkView.wallShowPreviousReplies(reply); } else { Wall.showReplies(post, false, reply); } } return false; }
updateRepliesHeader: function(post_raw, headerEl, shown, total) { if (cur.onepost) return; var headerText, href = headerEl.href, matches, showCount = 3, cls = 0;
if (!href && (matches = post_raw.match(/^(-?\d+)_(photo|video|note|topic|video|)(\d+)$/))) { var type = matches[2] || 'wall'; href = '/' + type + matches[1] + '_' + matches[3]; switch (type) { case 'topic': href += '?offset=last&scroll=1'; break; case 'wall': href += '?offset=last&f=replies'; break; } headerEl.href = href; } if (total > shown) { if (shown < 100) { if (total > 100) { headerText = getLang('wall_show_n_of_m_last', 100); headerText = headerText.replace('{count}', total); } else { headerText = getLang('wall_show_all_n_replies', total); } showCount = false; } else { headerText = getLang('wall_hide_replies'); } } else { headerText = getLang('wall_hide_replies'); cls = 1; } toggleClass(headerEl, 'wrh_all', cls); headerEl.innerHTML = '<div class="wrh_text" id="wrh_text' + post_raw + '">' + headerText + '</div><div class="progress wrh_prg" id="wrh_prg' + post_raw + '"></div>'; headerEl.onclick = Wall.showReplies.pbind(post_raw, showCount, false); headerEl.setAttribute('offs', shown + '/' + total); }
|
Во втором варианте не могу разобраться, что куда передается и по какому принципу работает. или посоветуете что-то другое использовать? Не могу найти, что такое repliesSideClick, showReply, updateRepliesHeader |