Commit 2ed07fa5 authored by Siong-Ui Te's avatar Siong-Ui Te

hide useless setting

parent f44fc4ba
......@@ -5,13 +5,15 @@ import (
"github.com/siongui/gopalilib/lib"
)
var storageKeyName = "PaliSetting"
func SavePaliSetting(setting lib.PaliSetting) {
str, _ := lib.PaliSettingToJsonString(setting)
LocalStorage.Set("PaliSetting", str)
LocalStorage.Set(storageKeyName, str)
}
func LoadPaliSetting() lib.PaliSetting {
setting, _ := lib.JsonStringToPaliSetting(LocalStorage.GetItem("PaliSetting"))
setting, _ := lib.JsonStringToPaliSetting(LocalStorage.GetItem(storageKeyName))
return setting
}
......@@ -26,12 +28,12 @@ func SetupPaliSetting() {
setting := lib.GetDefaultPaliSetting()
// check if there is saved setting in user browser
if s := LocalStorage.GetItem("PaliSetting"); s == "null" {
if LocalStorage.IsKeyExist(storageKeyName) {
// use saved setting
setting, _ = lib.JsonStringToPaliSetting(LocalStorage.GetItem(storageKeyName))
} else {
// no setting saved, use default setting
SavePaliSetting(setting)
} else {
// use saved setting
setting, _ = lib.JsonStringToPaliSetting(s)
}
// restore setting
......
{{define "setting"}}
<article class="message is-info setting-menu">
<div class="message-body">
<input type="checkbox" id="isShowWordPreview"/>
<span data-default-string="Input Word Explanation Preview">{{gettext "Input Word Explanation Preview"}}</span>
<br />
<br />
<input class="is-hidden" type="checkbox" id="isShowWordPreview"/>
<span class="is-hidden" data-default-string="Input Word Explanation Preview">{{gettext "Input Word Explanation Preview"}}</span>
<br class="is-hidden" />
<br class="is-hidden" />
<div>
<span data-default-string="What Languages of Dictionaries to Show?">{{gettext "What Languages of Dictionaries to Show?"}}</span>
<br />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment