Skip to content

Commit

Permalink
posts limit option added
Browse files Browse the repository at this point in the history
  • Loading branch information
avadhesh18 committed Jan 9, 2024
1 parent a9a569d commit e3c28c1
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 12 deletions.
3 changes: 2 additions & 1 deletion html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@


console.log(url);
url = url+'.json?limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'.json?limit='+limit;
if(getget('t') != null){
console.log(getget('t'));
url = url+'&t='+getget('t');
Expand Down
4 changes: 2 additions & 2 deletions html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
url = url+'search.json?q='+substoload+'';
}


url = url+'&limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'&limit='+limit;
if(getget('sort') != null){
console.log(getget('sort'));
url = url+'&sort='+getget('sort');
Expand Down
3 changes: 2 additions & 1 deletion html/subreddit.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@


console.log(url);
url = url+'.json?limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'.json?limit='+limit;
if(getget('t') != null){
console.log(getget('t'));
url = url+'&t='+getget('t');
Expand Down
3 changes: 2 additions & 1 deletion html/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@


console.log(url);
url = url+'.json?limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'.json?limit='+limit;
if(getget('sort') != null){
console.log(getget('sort'));
url = url+'&sort='+getget('sort');
Expand Down
3 changes: 2 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@


console.log(url);
url = url+'.json?limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'.json?limit='+limit;
if(getget('t') != null){
console.log(getget('t'));
url = url+'&t='+getget('t');
Expand Down
4 changes: 2 additions & 2 deletions public/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
url = url+'search.json?q='+substoload+'';
}


url = url+'&limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'&limit='+limit;
if(getget('sort') != null){
console.log(getget('sort'));
url = url+'&sort='+getget('sort');
Expand Down
12 changes: 11 additions & 1 deletion public/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

<b>Change display mode</b>
<li id="cthemew"><a onclick="toggletheme('dark')" id="themebtn" style="color:var(--linkc)">Change to Dark mode</a></li>
<b>Posts per page</b>
<li>
<input id="ppg" type="range" min="10" max="60" step="5" onchange="changedppg();"/> <span id="outppg">20</span>
</li>
<b>Export Subscriptions:</b>
<li>
<button onclick="exportData()">Export Data</button></li>
Expand All @@ -53,7 +57,13 @@
toggletheme('dark');
}
else {}

var curpp = localStorage.getItem('ppg') || 20;
document.getElementById('outppg').innerHTML = curpp;
document.getElementById('ppg').value = curpp;
function changedppg() {
localStorage.setItem('ppg',document.getElementById('ppg').value);
document.getElementById('outppg').innerHTML = document.getElementById('ppg').value + " (saved)";
}
function toggletheme(color){
if(color == 'dark'){
document.getElementById('cthemew').innerHTML = '<a style="color:var(--linkc)" onclick="toggletheme(\'light\')" id="themebtn">Change to Light mode</a>';
Expand Down
3 changes: 2 additions & 1 deletion public/subreddit.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@


console.log(url);
url = url+'.json?limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'.json?limit='+limit;
if(getget('t') != null){
console.log(getget('t'));
url = url+'&t='+getget('t');
Expand Down
3 changes: 2 additions & 1 deletion public/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@


console.log(url);
url = url+'.json?limit=20';
limit = localStorage.getItem('ppg') || 20;
url = url+'.json?limit='+limit;
if(getget('sort') != null){
console.log(getget('sort'));
url = url+'&sort='+getget('sort');
Expand Down
2 changes: 1 addition & 1 deletion run.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div id="leftbar" class="hidden">
<div class="list">
<a href="index.html" class="homelinks halfit">Home</a><a onClick="window.location.reload()" class="homelinks halfit">Refresh</a><a href="saved.html" class="homelinks halfit">Saved</a><a href="subreddit.html?r=popular" class="homelinks halfit">Popular</a>
<div id="subscribed">Subscribe to subreddits to view them here.</div> <div id="cthemew"><a onclick="toggletheme(\'dark\')" id="themebtn">Dark mode</a>
<div id="subscribed">Subscribe to subreddits to view them here.</div> <div id="cthemew"><a onclick="toggletheme(\'dark\')" id="themebtn">Dark mode</a> | | <a href="settings.html">Settings</a>
</div>
</div>
</div>
Expand Down

0 comments on commit e3c28c1

Please sign in to comment.