let config = { theme: 'dark', showKeyTips: true, showLiveWpm: false, smoothCaret: true, quickTab: false, punctuation: false, words: 50, 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); setTheme(newConfig.theme); setQuickTabMode(newConfig.quickTab); setPunctuation(newConfig.punctuation); setKeyTips(newConfig.showKeyTips); changeTimeConfig(newConfig.time); changeWordCount(newConfig.words); changeMode(newConfig.mode); config = newConfig; restartTest(); } } function showTestConfig() { $("#top .config").removeClass('hidden').css("opacity",1); } function hideTestConfig() { $("#top .config").css("opacity",0).addClass('hidden'); } //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 setSmoothCaret(mode) { config.smoothCaret = mode; saveConfigToCookie(); } function toggleSmoothCaret() { config.smoothCaret = !config.smoothCaret; saveConfigToCookie(); } //quick tab function setQuickTabMode(mode) { config.quickTab = mode; if (!config.quickTab) { // $(".pageTest").append('