ZachSaucier / Just-Read

A customizable read mode web extension.
https://justread.link/
1.19k stars 137 forks source link

Style changes aren't saved after closing options panel #19

Closed tprynn closed 7 years ago

tprynn commented 7 years ago

Repro: Update style in the options panel, style is set; close panel, style is reset

In the function closeStyleEditor() at line 699 of content_script.js, the styles are updated with the previous values rather than the updated values. Can be fixed with the following code:

    function closeStyleEditor() {
        if(!saved) {
            changeStylesheetRule(s, "body", "font-size", this.fontSize);
            changeStylesheetRule(s, ".simple-container", "max-width", this.maxWidth);
            changeStylesheetRule(s, "body", "color", this.textColor);
            changeStylesheetRule(s, "body", "background-color", this.backgroundColor);
            changeStylesheetRule(s, ".simple-author", "color", this.linkColor);
            changeStylesheetRule(s, "a[href]", "color", this.linkColor);
            changeStylesheetRule(s, "a[href]:hover", "color", this.linkHoverColor);
        }

        datGUI.destroy();

        closeBtn = null;
        saved = false;
    }
ZachSaucier commented 7 years ago

Hello tprynn and thanks the the report.

This behavior is done purposely so that users can test styles without fear of overriding their current styles. If you want to save the styles that you change, you need to click "saveAndClose" instead. Does this fix the supposed issue for you?


P.S. I found a different bug through testing while debugging this, so thank you!

tprynn commented 7 years ago

Haha, I definitely didn't notice that button before. It's surprisingly confusing to have it at the same level as the style changing options. But now that I know it's there, I'll use it from now on, though I think it might make more sense to have a reset button instead of two different close buttons?

Anyway, enjoying the extension, thanks for your work!

ZachSaucier commented 7 years ago

Yea, I've been meaning to change the style. I just updated the styling of the buttons so that they're more similar in b420e90 / 1.0.9:

btns

Thanks again for raising the issue