Code Injection & Javascript that only works with one function

Hi, I am a hobbyist, doing HTML on and off for abt 20 years for fun, and adding CSS/JS later. Right now I am trying Ghost.org.

I am very new to JS. I am trying to do something so, so basic: giving a user the option to change color theme. And it works! But if I try to add more than one option/function, all functions become non-working :(

I have tried looking up all sorts of solutions, but the issues others have encountered (and the solutions) are waaaaaay more complex than this. I'm sure I am missing something obvious.

A second pair of eyes would be appreciated.

HTML (applied to page through a block element)

<form id="post-display">

<fieldset id="color-scheme">
  <legend>Color Scheme</legend>
    <input type="radio" id="eink" name="color-scheme" value="E-Ink" checked onclick="schemeScript1()">
      <label for="eink">E-Ink</label>
  
    <input type="radio" id="lightmode" name="color-scheme" value="Light Mode" onclick="schemeScript2()">
      <label for="lightmode">Light Mode</label><br>
  
    <input type="radio" id="darkmode" name="color-scheme" value="JavaScript" onclick="schemeScript3()">
      <label for="darkmode">Dark Mode</label><br>
</fieldset>
</form>

JAVASCRIPT (Injected into page footer)

Text<script>
const posts = document.getElementsByClassName("post");

//default checked radio button
function schemeScript1() {
posts[0].style.color = #181818;
posts[0].style.backgroundColor = #EBEBEB;
    return
};

// This one works if it is alone
function schemeScript2() {
posts[0].style.color = "black";
posts[0].style.backgroundColor = "white";
};
    
function schemeScript3() {
posts[0].style.color = #EBEBEB;
posts[0].style.backgroundColor = #181818;
    return
};
</script>

I also tried an if/then/else (a single function called schemeScript() )to keep it more organized but it did not work at all, at any point.

// runs any time a radio button is clicked
function schemeScript() {
if (document.getElementId("lightmode").checked = true;) { 
      posts[0].style.color = "black";
      posts[0].style.backgroundColor = "white";}
    else if (document.getElementId("darkmode").checked = true;) { 
      posts[0].style.color = #EBEBEB;
      posts[0].style.backgroundColor = #181818;}
    else { 
      posts[0].style.color = #181818;
      posts[0].style.backgroundColor = #EBEBEB;}
}
reddit.com
u/ThrowRA10044 — 5 days ago

HELP! Deleted 5 years of work!

I was trying to create a collection, which I guess isn't separate from the files in the binder.

I deleted everything from the collection, and now it is gone from the binder.

It is not in the trash.

What do I do please help. WHY is this even possible!? Why can you just mass delete things that go NOWHERE with NO WARNING.

reddit.com
u/ThrowRA10044 — 1 month ago

Subscription Platform without Censorship or Identity Scraping?

Is there anywhere that allows adult writing with a subscription model and no censorship anymore?

I tried to start a Patreon to write, and because it contained a red flag word, I was immediately deplatformed, and they demanded an ID.

The crazy thing is, they already have my ID for banking purposes: Patreon explicitly wanted my ID (and permission) to submit my entire identity to Persona, a database that has already been caught selling/feeding information to the US government.

Wordpress actually has terms that you cannot use their builder for "explicit" content. iirc, wix and myriad other builders have the same terms: no explicit content, not even in writing.

Stripe has prohibited business terms, and are driving a great deal of the current censorship pushes afaik. This rules out places like Ko-Fi and so on.

Is the only solution a self-hosted website built from scratch? I would still need a payment processor, how does that work when Stripe, Paypal, Visa, etc. all restrict content?

reddit.com
u/ThrowRA10044 — 1 month ago

Subscription Platform without Censorship or Identity Scraping?

Is there anywhere that allows adult writing with a subscription model and no censorship anymore?

I tried to start a Patreon to write, and because it contained a red flag word, I was immediately deplatformed, and they demanded an ID.

The crazy thing is, they already have my ID for banking purposes: Patreon explicitly wanted my ID (and permission) to submit my entire identity to Persona, a database that has already been caught selling/feeding information to the US government.

Wordpress actually has terms that you cannot use their builder for "explicit" content. iirc, wix and myriad other builders have the same terms: no explicit content, not even in writing.

Stripe has prohibited business terms, and are driving a great deal of the current censorship pushes afaik. This rules out places like Ko-Fi and so on.

Is the only solution a self-hosted website built from scratch? I would still need a payment processor, how does that work when Stripe, Paypal, Visa, etc. all restrict content?

reddit.com
u/ThrowRA10044 — 1 month ago