Skip to content

Instantly share code, notes, and snippets.

@rn0
Created February 2, 2009 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rn0/57182 to your computer and use it in GitHub Desktop.
Save rn0/57182 to your computer and use it in GitHub Desktop.
/*
nawigacja pomiedzy nowymi komentarzami w wykop.pl
*/
$(document).ready(function() {
ids = [];
$('ul#wykop-comments div.comment-body-new').parent('li').each(function() {
ids.push($(this).attr('id'));
});
cnt = ids.length;
if(cnt > 0) {
$('#pokaz_komentarze').before('<a href="#' + ids[0] + '">Skocz do nowego komentarza</a> | ');
for(i = 0; i < cnt; i++) {
inlineLinks = $('#'+ids[i]+' ul.inline-links');
if(i >= 1) {
inlineLinks.append('<li><a href="#' + ids[i-1] + '">poprzedni nowy komentarz</a></li>');
}
if((i == 0 && cnt > 1) || i < cnt - 1) {
inlineLinks.append('<li><a href="#' + ids[i+1] + '">nastepny nowy komentarz</a></li>');
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment