Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. Meteor.publish("amon", function() {
  2. return Mon.find({}, {
  3. sort: {
  4. utctime: -1
  5. },
  6. limit: 250
  7. })
  8. })
  9.  
  10. $(window).scroll(function() {
  11. var livehistory = Session.get('livehistory')
  12. if (
  13. (document.getElementById('tabpage_1').style.display != "none") &&
  14. ($(document).height() - $(document).scrollTop() <= $(window).height() + 100) &&
  15. (livehistory < 2000)
  16. )
  17. {
  18. console.log("Scrolled Down");
  19. livehistory = livehistory + 200
  20. Session.set('livehistory', livehistory)
  21. }
  22. if ($(document).scrollTop() < $(window).height()*0.5) {
  23. // We're back to normal mode, so reduce displayed history and enable live mode.
  24. Session.set('livehistory', 80)
  25. Session.set('live', true)
  26. } else {
  27. Session.set('live', false)
  28. }
  29. });
  30.  
  31. Template.log.loglines = function() {
  32. var query = Mon.find({}, {
  33. sort: {
  34. utctime: -1
  35. },
  36. limit: Session.get('livehistory'),
  37. reactive: Session.get("live") || false
  38. })
  39. return query
  40. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement