Skip to content

Commit

Permalink
fixed some css
Browse files Browse the repository at this point in the history
  • Loading branch information
avadhesh18 committed Jan 19, 2024
1 parent 6a73a70 commit 0a0d188
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
2 changes: 1 addition & 1 deletion public/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ document.getElementById('subscribed').innerHTML = subslisted;

function toggletheme(){
const curtheme = localStorage.getItem('tname') || "default";
if(curtheme != 'default'){
if(curtheme != 'default' && curtheme != 'Default'){
document.documentElement.style.setProperty('--bodyc', localStorage.getItem('bodyc'));
document.documentElement.style.setProperty('--textc', localStorage.getItem('textc'));
document.documentElement.style.setProperty('--linkc', localStorage.getItem('linkc'));
Expand Down
2 changes: 2 additions & 0 deletions public/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ a.next {
padding: 5px;
margin: 10px;
border-radius: 6px;
background: var(--linkc);
color: var(--bodyc);
}

div#subssearch {
Expand Down
38 changes: 33 additions & 5 deletions public/themes.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
span#outfnm {
padding: 0px 10px;
}
.theme.current {
background: var(--linkc);
color: var(--bodyc);
}
</style>
</head>

Expand Down Expand Up @@ -207,6 +211,7 @@
<option value="Lexend">Lexend</option>
</optgroup>
<optgroup label="Sans-serif">
<option value="Jost">Jost</option>
<option value="Arimo">Arimo</option>
<option value="Roboto">Roboto</option>
<option value="Raleway">Raleway</option>
Expand Down Expand Up @@ -237,7 +242,6 @@
<option value="Handlee">Handlee</option>

<option value="Dosis">Dosis</option>
<option value="Jost">Jost</option>
<option value="Caveat">Caveat</option>
<option value="Satisfy">Satisfy</option>
<option value="Kalam">Kalam</option>
Expand All @@ -263,12 +267,13 @@
</div>
<script>

var curfont = localStorage.getItem('fname') || "default";
var curfont = localStorage.getItem('fname') || "Default";
document.getElementById('outfnm').innerHTML = "Current: " + curfont;
function changedfont() {
if(document.getElementById('fnm').value == "em") {return false;}
localStorage.setItem('fname',document.getElementById('fnm').value);
document.getElementById('outfnm').innerHTML = "Current: "+document.getElementById('fnm').value;

togglefont();
}

Expand All @@ -284,9 +289,21 @@
toggletheme();
}
function toggletheme(){
const curtheme = localStorage.getItem('tname') || "default";
const curtheme = localStorage.getItem('tname') || "Default";
document.getElementById('curthm').innerHTML = curtheme;
if(curtheme != 'default'){

var themes = document.querySelectorAll('.theme');
themes.forEach(theme => {
console.log(theme.textContent.trim());
if (theme.textContent.trim() == curtheme) {
theme.classList.add('current');
} else {
theme.classList.remove('current');
}
});


if(curtheme != 'Default'){
document.documentElement.style.setProperty('--bodyc', localStorage.getItem('bodyc'));
document.documentElement.style.setProperty('--textc', localStorage.getItem('textc'));
document.documentElement.style.setProperty('--linkc', localStorage.getItem('linkc'));
Expand All @@ -303,7 +320,17 @@
}
function togglefont(){
const curfont = localStorage.getItem('fname') || "default";
if(curfont != 'default'){

var fontOptions = document.querySelectorAll('#fnm option');
fontOptions.forEach(option => option.removeAttribute('selected'));
currfont = document.getElementById('fnm').value;
var selectedFontOption = document.querySelector(`#fnm option[value="${curfont}"]`);
if (selectedFontOption) {
selectedFontOption.setAttribute('selected', 'selected');
}


if(curfont != 'default' && curfont != "Default"){
const le = document.createElement('link');
le.rel = 'stylesheet';
le.href = 'https://fonts.googleapis.com/css2?family='+curfont+'&display=swap';
Expand All @@ -313,6 +340,7 @@
else {
document.body.style.fontFamily = 'sans-serif';
}

}
togglefont();
toggletheme();
Expand Down
12 changes: 6 additions & 6 deletions run.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$headhtml = '<!DOCTYPE html><html><head>
<title>rdx - Apollo For Reddit Inspired Web Viewer</title>
<meta name="description" content="rdx is a fast, lightweight mobile Web Viewer for Reddit based on Apollo. Mobile friendly reader for Reddit. Browse Reddit without Ads."/>
<title>RDX for Reddit - Apollo For Reddit Inspired Web Viewer</title>
<meta name="description" content="rdx for reddit is a fast, lightweight mobile Web Viewer for Reddit based on Apollo. Mobile friendly reader for Reddit. Browse Reddit without Ads."/>
<link rel="shortcut icon" href="favicon.ico">
<link rel="icon" href="favicon.png">
<link rel="manifest" href="/manifest.json" /> <meta name="apple-mobile-web-app-capable" content="yes" />
Expand All @@ -28,8 +28,8 @@
<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 href="themes.html" id="themebtn">Change Theme</a> | <a href="settings.html">Settings</a>
</div> </div>
<div id="subscribed">Subscribe to subreddits to view them here.</div> <div id="cthemew"><a href="themes.html" id="themebtn">Change Theme</a> | <a href="settings.html">Settings</a> | <a href="https://www.buymeacoffee.com/overdevsapps" rel="nofollow">Support RDX</a>
</div></div>
</div>
<div id="rightbar" class="hidden"></div>
</div>
Expand All @@ -45,15 +45,15 @@
$data = str_replace('<!--headhtml-->',$headhtml,$data);


$data = str_replace('</body>','<div class="footer"><a href="https://www.buymeacoffee.com/overdevsapps" class="bmac"><img src="bmac.png" width="140" alt="donate"></a><br>If you use rdx for Reddit&reg; please provide <a href="contact.html">Feedback</a> and <a href="https://www.buymeacoffee.com/overdevsapps">Donate</a>.<br><br><small><a href="new.html">What\'s new?</a> | <a href="settings.html">Settings</a> | <a href="https://github.com/avadhesh18/rdx/">Star on Github</a></small></div> <div id="popitup" style="display:none;">
$data = str_replace('</body>','<div class="footer"><a rel="nofollow" href="https://www.buymeacoffee.com/overdevsapps" class="bmac"><img src="bmac.png" width="140" alt="donate"></a><br>If you use rdx for Reddit&reg; please provide <a href="contact.html">Feedback</a> and <a href="https://www.buymeacoffee.com/overdevsapps" rel="nofollow">Donate</a>.<br><br><small><a href="new.html">What\'s new?</a> | <a href="settings.html">Settings</a> | <a href="https://github.com/avadhesh18/rdx/">Star on Github</a></small></div> <div id="popitup" style="display:none;">
<span onclick="document.getElementById(\'popitup\').style.display=\'none\'">Cancel</span>
<div id="helptext"></div><textarea class="cmntarea" id="commentText" placeholder="Write a reply!" required></textarea>
<input id="cmtid" value="" type="hidden"/> <input id="actype" value="" type="hidden"/> <button id="cmntbtn" onclick="apiAction();">Submit</button>
</div> <!-- rdx --></body>',$data);
if($file == 'html/index.html')
{
$data = str_replace('<!-- rdx -->','<div class="infotext">
<h1>Explore Reddit with rdx: A Fast and Lightweight Web Viewer Inspired by Apollo</h1>
<h1>Explore RDX for Reddit: A Fast and Lightweight 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>
<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>
Expand Down

0 comments on commit 0a0d188

Please sign in to comment.