let config = { showKeyTips: true, showLiveWpm: true, smoothCaret: true, quickTab: false, punctuation: true, words: 100, time: 30, mode: "words" } //cookies function saveConfigToCookie() { let d = new Date(); d.setFullYear(d.getFullYear() + 1) $.cookie("config", JSON.stringify(config), { expires: d }) } function loadConfigFromCookie() { let newConfig = $.cookie('config'); if (newConfig) { newConfig = JSON.parse(newConfig); config = newConfig; setQuickTabMode(config.quickTab); setPunctuation(config.punctuation); setKeyTips(config.showKeyTips); changeTimeConfig(config.time); changeWordCount(config.words); changeMode(config.mode); restartTest(); } } //key tips function setKeyTips(keyTips) { config.showKeyTips = keyTips; if (config.showKeyTips) { $("#bottom .keyTips").removeClass("hidden"); } else { $("#bottom .keyTips").addClass("hidden"); } saveConfigToCookie(); } function toggleKeyTips() { config.showKeyTips = !config.showKeyTips; if (config.showKeyTips) { $("#bottom .keyTips").removeClass("hidden"); } else { $("#bottom .keyTips").addClass("hidden"); } saveConfigToCookie(); } //caret function toggleSmoothCaret() { config.smoothCaret = !config.smoothCaret; saveConfigToCookie(); } //quick tab function setQuickTabMode(mode) { config.quickTab = mode; if (!config.quickTab) { $(".pageTest").append('