Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better stylesheet management and user selection storage #155

Open
kaguy4 opened this issue Oct 22, 2024 · 1 comment
Open

Better stylesheet management and user selection storage #155

kaguy4 opened this issue Oct 22, 2024 · 1 comment
Labels
enhancement For stuff that needs to be improved

Comments

@kaguy4
Copy link
Member

kaguy4 commented Oct 22, 2024

Especially if there is a "textboard koko" instance on the subdomain where an 'imageboard koko" exists, each others' cookies may cause issues for the other

@kaguy4 kaguy4 added the enhancement For stuff that needs to be improved label Oct 22, 2024
@anonwaha
Copy link
Collaborator

anonwaha commented Oct 22, 2024

Perhaps there could be a file(s) (JSON?) that maps template files and CSS files, which will help determine which styles relate to which templates, as well as which reply templates are associated with which "parent" templates

Here's a quick mock-up:

{
  "templates": {
    "kokoimg": {
      "filename": "kokoimg.tpl",
      "css_styles": ["Futaba", "Burichan"]
    },
    "kokotxt": {
      "filename": "kokotxt.tpl",
      "css_styles": ["Pseud0ch", "Pseud0ch sans-serif"]
    },
    "kokotxtreply": {
      "filename": "kokotxtreply.tpl",
      "parent_template": "kokotxt"
    }
  },
  "styles": {
    "Futaba": {
      "filename": "futaba.css"
    },
    "Burichan": {
      "filename": "burichan.css"
    },
    "Pseud0ch": {
      "filename": "pseud0ch.css"
    },
    "Pseud0ch sans-serif": {
      "filename": "pseud0ch2.css"
    }
  }
}

Then the PHP side could potentially use this info to:

  • generate the appropriate list of <link>s for each template
  • determine a prefix for the localstorage location that stores the user-selected style (e.g. style_kokotxt: Pseud0ch), as well as (for example) know to use style_kokotxt when kokotxtreply.tpl is used
  • generate JS that saves/loads the user-selected style to/from the appropriate localstorage location

Potential issues:

  • if the correct localstorage location isn't immediately known on page load, the screen may flash white (terrible for dark styles) or the page may temporarily appear with the wrong style
  • there might be an entirely different and better solution that I failed to think of

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For stuff that needs to be improved
Projects
None yet
Development

No branches or pull requests

2 participants