Forum moderator: bigblog  
New page auto load when scrolling down
adnet
Posts: 45
Reputation: 2

Message # 46 | 11:23 AM
Paradox, Do you have any idea to make this script work?

bigblog code
Code
<span class="lenta">$BODY$</span>   
<div id="ShowMore" pagenum="1"></div>   
<div id="more1"></div>   
<script type="text/javascript">   
$(window).scroll(function(){   
if ($(document).height() - $(window).height() <= $(window).scrollTop() + 50) {   
var $showclick = $('#ShowMore' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .attr('pagenum' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ;   
$('#more'+$showclick).after('<div id="more'+(parseInt($showclick)+1)+'"></div>' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ;   
$showclick++;   
$('#more'+$showclick).load('$MODULE_URL$0'+'-'+$showclick+' .lenta' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ;   
$('#ShowMore' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .attr('pagenum',parseInt($showclick));   
return false;   
} } <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ;
</script>
Soldierdevil
Posts: 154
Reputation: 1

Message # 47 | 12:43 PM
Paradox, seems you have some ideas about this. Please help us make the script work. I only say characters in the script i don't understand anything so i can manipulate it so please kindly we request. tongue
Systems developer
Cyberdasm
Posts: 640
Reputation: 7

Message # 48 | 12:45 PM
adnet, that is not bigblog's code Madam sunny made that.
1F4BF3B
Paradox
Old Guard
Posts: 3284
Reputation: 145

Message # 49 | 1:06 PM
adnet, Soldierdevil, no guarantees but I'll have a tinker and see what I can come up with.

Cyberdasm, bigblog made some changes to the code Sunny posted. smile That's his version posted above on this page.

Jack of all trades in development, design, strategy.
Working as a Support Engineer.
Been here for 13 years and counting.
Cyberdasm
Posts: 640
Reputation: 7

Message # 50 | 1:03 PM
Soldierdevil,
QuoteSoldierdevil ()
Paradox, seems you have some ideas about this. Please help us make the script work. I only say characters in the script i don't understand anything so i can manipulate it so please kindly we request.

adnet,
Quoteadnet ()
Do you have any idea to make this script work?


I have now the code for that Kindly check and scroll down up to the bottom of this page or this. I included the root domain incase my paid domain will expire tomorrow.

I will put the code here tomorrow morning during office hours. 6:30 AM GMT+8. I

1F4BF3B
Post edited by Cyberdasm - Monday, 2016-12-05, 1:07 PM
Soldierdevil
Posts: 154
Reputation: 1

Message # 51 | 3:23 PM
Cyberdasm, please do so. I cant wait....oh my God. I am waiting impatiently
Systems developer
Cyberdasm
Posts: 640
Reputation: 7

Message # 52 | 11:12 PM
Soldierdevil, ahahah just be patient bro...
QuoteSoldierdevil ()
Cyberdasm, please do so. I cant wait....oh my God. I am waiting impatiently

Okay, here it is just replace your body and page selector of your website:
Code
<div id="conter">$BODY$</div>
<div class="selector" id="selector" style="display:none">$PAGE_SELECTOR$</div>

<script type="text/javascript">  
  if ($("#selector").find(".swchItem:contains('»' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ").text() == '»' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> {  
  $("#selector").after('<div id="nextCont" class="input_submit alt"><div class="u_pos"></div></div>' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ;  
  };  

$(window).scroll(function() {
if($('.u_pos' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .position().top-$(window).scrollTop() < 1000) {
Conte.to()
}
});

  Conte = {  
  to:function(){  
  $("#nextCont").html('<div align="center"><img src="/.s/img/icon/ajsml.gif" border="0" /></div>' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ;  
  nextik = $("#selector").find(".swchItem:contains('»' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ").attr('onclick' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> .toString();  
  num = nextik.match(/\d/);  
  $.get('/publ/0-'+num, function(next){  
  $("#conter").append( $("#conter", next).html() );  
  $("#selector").html( $("#selector", next).html() );  
  $("#nextCont").html('<div class="u_pos"></div>' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ;  
  if ($("#selector", next).find(".swchItem:contains('»' <img src="/.s/sm/1/wink.gif" border="0" align="absmiddle" alt="wink" /> ").html() == null) { $("#nextCont").fadeOut(); };  
  });  
  }  
  }  
  </script>


Hope this helps. It work on mine and I'm sure it will work on yours.

Added (2016-12-05, 11:12 PM)
---------------------------------------------
If you have time join as at discord.


1F4BF3B
Post edited by Cyberdasm - Monday, 2016-12-05, 11:03 PM
Soldierdevil
Posts: 154
Reputation: 1

Message # 53 | 5:07 AM
Cyberdasm, sad sad sad sad cant make it work on my site. Dont know why

Added (2016-12-06, 5:07 AM)
---------------------------------------------

Quote
If you have time join as at discord.

what is discord

Systems developer
Paradox
Old Guard
Posts: 3284
Reputation: 145

Message # 54 | 8:43 AM
Soldierdevil, what site module are you using? Cyber's code is for the Publisher module.

And Discord is a community chat/VOIP application. smile

Jack of all trades in development, design, strategy.
Working as a Support Engineer.
Been here for 13 years and counting.
Soldierdevil
Posts: 154
Reputation: 1

Message # 55 | 8:55 AM
Quote
Cyber's code is for the Publisher module.
i thought it could work for every module. I tried on photo, blog and video

Systems developer
Paradox
Old Guard
Posts: 3284
Reputation: 145

Message # 56 | 9:06 AM
Soldierdevil, unfortunately not. You've got to change the code for each module. cool

Code
$.get('/publ/0-'+num, function(next){

This line of code is the trick. Take note of the following parameters:
  • The /publ region is the URI slug to the module. So for news it would be /news.
  • The next string is the URI slug that makes up the pagination for the module. Most modules are standard however, take note just in case they aren't. So in this case, the script is looking up /0-+num. 0- is simply the module pagination code, +num represents the current page value within the script, so by default it will start at 1, then every time the script is run it will increment the existing number by one.

On top of this you must also make sure that your entries have the correct class wrapper around them so they can be dynamically loaded from the page content. I can't find the specific class in the script, it's not so fantastically commented or readable, however, I'm sure @Cyberdasm will have an idea.

Jack of all trades in development, design, strategy.
Working as a Support Engineer.
Been here for 13 years and counting.
Soldierdevil
Posts: 154
Reputation: 1

Message # 57 | 9:38 AM
Quote
+num represents the current page value within the script, so by default it will start at 1,
So in this case you are trying to mean that i replace +num with +1?

Systems developer
Paradox
Old Guard
Posts: 3284
Reputation: 145

Message # 58 | 9:57 AM
QuoteSoldierdevil ()
So in this case you are trying to mean that i replace +num with +1?


Nope. Don't change it. Was just explaining the script so you have an idea as to how it works. smile The value you may need to change is the:

Code
0-

It depends on how the modules paginate.

Jack of all trades in development, design, strategy.
Working as a Support Engineer.
Been here for 13 years and counting.
Soldierdevil
Posts: 154
Reputation: 1

Message # 59 | 5:11 AM
Paradox, do you have any solution or idea about this code to make it work in photo album. The code owner seems to have disappeared since yesterday and i have been waiting all in vain sad
Systems developer
VZ
Posts: 189
Reputation: 3

Message # 60 | 6:04 AM
Soldierdevil,
Quote Soldierdevil ()
photo album

Should work on Main, Section and Categories Page(s)
Code
<div id="conter">$BODY$</div>
<div class="selector" id="selector" style="display:none">$PAGE_SELECTOR$</div>

<script type="text/javascript">
if ($("#selector").find(".swchItem:contains('»')").text() == '»') {
$("#selector").after('<div id="nextCont" class="input_submit alt"><div class="u_pos"></div></div>');
};

$(window).scroll(function() {
if($(".u_pos").length != 0) {
if($('.u_pos').position().top-$(window).scrollTop() < 1000) {
Conte.to()
}
}
});
Conte = {
to:function(){
$("#nextCont").html('<div align="center"><img src="/.s/img/icon/ajsml.gif" border="0" /></div>');
nextik = $("#selector").find(".swchItem:contains('»')").attr('href');
if(nextik !=undefined) {
<?ifnot($PAGE_ID$ == "main" || $PAGE_ID$ == "main_page" )?>
     num = nextik.split(/\s*-\s*/)[1];
     <?else?>
     num = nextik.match(/\d/);
<?endif?>
$.get('/$MODULE_ID$/<?ifnot($PAGE_ID$ == "main")?><?substr($URI_ID$,-1)?><?else?>0<?endif?>-'+num, function(next){
$("#conter").append( $("#conter", next).html() );
$("#selector").html( $("#selector", next).html() );
$("#nextCont").html('<div class="u_pos"></div>');
if ($("#selector", next).find(".swchItem:contains('»')").html() == null) { $("#nextCont").fadeOut(); };
});
}
}
}
  </script>


I modified it slightly to not throw any errors when a variable is undefined.

Update: Seems to work on File Catalog well...

Hit that "Thanks" button. :)
In life there's ALWAYS limits but do not plan above them.
Post edited by VZ - Friday, 2017-01-20, 7:11 AM
Search: