Skip to content

Commit

Permalink
fixed infinite scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
avadhesh18 committed Jun 18, 2024
1 parent c8909e9 commit 7294bb6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions public/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ titlesx = titlesx.replace("/.json", "");
document.title = titlesx;
posts = jsonResponse['data']['children'];
for(var item in posts) {
console.log("xx" + item);
//console.log("xx" + item);
pid = posts[item]['data'];
fill += postbuilder(pid);
}
Expand All @@ -103,6 +103,7 @@ document.getElementById('body').innerHTML = fill;
document.getElementById('body').insertAdjacentHTML("afterbegin",'<div id="rdxapp" style="display:none;">rdx iPhone app is here <a class="dlbtnapp" href="https://apps.apple.com/us/app/rdx-for-reddit/id6503479190">Install</a> <span class="axeit" onclick="exit();">X</span></div>');
runhsl();
if(curinfi == "true") {
// console.log('running observe');
observe();
}

Expand All @@ -127,20 +128,22 @@ async function makereq(url) {

let posts = jsonResponse['data']['children'];
for (let item of posts) {
console.log("xx" + item);
// console.log("xx" + item);
let pid = item['data'];
fill += postbuilder(pid);
}

fill += '<div class="navigate">';
let curpage = window.location.href.replace(/\&after.*/, '');
if (jsonResponse['data']['after'] != null) {

if (curpage.indexOf("?") === -1) {
curpage = curpage + '?a=b';
}
fill += '<a class="next" href="' + curpage + '&after=' + jsonResponse['data']['after'] + '">Next page</a><div id="sxpy"></div><div id="sentinel"> </div>';
let nextseturl = curpage + '&after=' + jsonResponse['data']['after'];
let nexturl = url.split('&after')[0] + "&after=" + jsonResponse['data']['after'];
nexturl = url.split('&after')[0] + "&after=" + jsonResponse['data']['after'];

}
fill += '</div>';
document.getElementById('body').innerHTML = fill;
Expand All @@ -157,7 +160,9 @@ async function makereq(url) {
}

function scorllmore() {

const url = nexturl;

let fill = '';
if(nexturl != '') {console.log(nexturl); } else {return false;}
var req = new XMLHttpRequest();
Expand Down Expand Up @@ -192,15 +197,15 @@ nexturl = '';
req.send(null);
}
function axit(){
localStorage.setItem('appshown', 'yes');
localStorage.setItem('appshown1', 'yes');
document.getElementById('rdxapp').style.display = 'none';
}


function observe() {
if (localStorage.getItem('appshown') !== 'yes') {
if (localStorage.getItem('appshown1') !== 'yes') {

document.getElementById('body').insertAdjacentHTML("afterbegin",'<div id="rdxapp" >rdx iPhone app is here <a class="dlbtnapp" href="https://apps.apple.com/us/app/rdx-for-reddit/id6503479190">Install</a> <span class="axeit" onclick="axit();">X</span></div>');
document.getElementById('body').insertAdjacentHTML("afterbegin",'<div id="rdxapp" >rdx iPhone app v1.2 is here <a class="dlbtnapp" href="https://apps.apple.com/us/app/rdx-for-reddit/id6503479190">Install</a> <span class="axeit" onclick="axit();">X</span></div>');
}
const options = {
root: null,
Expand Down
2 changes: 1 addition & 1 deletion run.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
{
$data = str_replace('<!-- rdx -->','<div class="infotext">
<h1>Explore RDX for Reddit: A Fast and Light weight Web Viewer Inspired by Apollo</h1>
<p>Discover a seamless Reddit browsing experience with rdx, a mobile-friendly web viewer designed for speed and simplicity. Based on the now closed Apollo app, rdx allows you to navigate Reddit without the distraction of ads.</p>
<p>Discover a seamless Reddit browsing experience with rdx, a mobile-friendly web viewer designed for speed and simplicity. Based on the now closed Apollo app, rdx allows you to navigate Reddit without the distraction of ads.</p>
<h2>Enjoy Reddit Anywhere: rdx\'s Mobile Friendly Design and Dark Mode</h2>
<p>Experience the freedom of browsing Reddit on the mobile easily with rdx\'s mobile-friendly design. The interface is optimized for various devices, ensuring a smooth experience across different screen sizes. Additionally, rdx offers a Dark Mode for users who prefer a more comfortable and eye-friendly viewing experience, making it easy to enjoy Reddit in any lighting condition.</p>
</div> ',$data);
Expand Down

0 comments on commit 7294bb6

Please sign in to comment.