Advertisement
Guest User

random request

a guest
Sep 25th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. external-text:" #? ","javascript:
  2. (function(){
  3. var posts = Array.from(document.querySelectorAll('.post.reply[id]'));
  4. var i = 0;
  5. var selected = posts[0];
  6. var current = location.hash.substr(1);
  7. if (posts.length > 0) {
  8. if (posts.length > 1) {
  9. do {
  10. i = Math.floor(Math.random()*posts.length);
  11. selected = posts[i];
  12. posts.splice(i, 1);
  13. } while(posts.length > 0 && (!selected.offsetParent || !/^p\d+$/.test(selected.id) || selected.id === current));
  14. }
  15. if (selected.offsetParent && /^p\d+$/.test(selected.id)) {
  16. location.href = '#'+ selected.id;
  17. }
  18. }
  19. }())
  20. "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement