Advertisement
Mobilpadde

All the images

Nov 7th, 2013
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @author      Mads Cordes ( @Mobilpadde ) - Idea by Virtual-Aidz ( No twttr D: )
  3. // @name        Puush Image loader (Lazyloader for Puush)
  4. // @website     http://twitter.com/Mobilpadde
  5. // @version     1.2.2
  6. // @description Makes puush even puushier!
  7. // @include     http://puush.me/account*
  8. // @copyright   Nothing really... Unless you take money for it.. You won't be able to hide.. I will find you...and I will kill you..
  9. // @updateURL   http://pastebin.com/raw.php?i=2yQU2D7Q
  10. // ==/UserScript==
  11.  
  12. var $ = unsafeWindow.jQuery;
  13. $(document).ready(function(){
  14.     var pID = (document.URL.indexOf("?page") > -1 ? (parseInt(document.URL.replace("http://puush.me/account?page=", "")) + 1) : 2),
  15.         waiting = false,
  16.         pagination = $("#pagination"),
  17.         lazyLoad = function(force){
  18.             if(($(window).scrollTop() + $(window).height() == $(document).height() && !waiting) || force){
  19.                 waiting = true;
  20.                 $("#puush_history").append("<div id='page" + pID + "'></div>");
  21.                 console.log(pID);
  22.                 $("#page" + pID).load("http://puush.me/account?page=" + pID + " .puush_tile", function(){
  23.                     if(pID < $("#pagination a")[$("#pagination a").length-2].text){
  24.                         waiting = false;
  25.                         pID++;
  26.                     }
  27.                 });
  28.             }
  29.         },
  30.         interval = setInterval(function(){
  31.             if($(window).scrollTop() == 0){
  32.                 lazyLoad(true);
  33.             }else{
  34.                 clearInterval(interval)
  35.             }
  36.         }, 500);
  37.    
  38.    
  39.     interval;
  40.     $(window).scroll(function() {
  41.         lazyLoad(false);
  42.     });
  43.     $("#pool_info").after(pagination);
  44. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement