diff --git a/klite.embd b/klite.embd index 5a5bb8a13..e146ec7ba 100644 --- a/klite.embd +++ b/klite.embd @@ -5396,6 +5396,7 @@ Current version: 136 let nwi = { "key": itm.key[0], "keysecondary": (itm.keysecondary.length > 0 ? itm.keysecondary[0] : ""), + "keyanti": (itm.keyanti.length > 0 ? itm.keyanti[0] : ""), "content": itm.content, "comment": itm.comment, "folder": null, @@ -5537,6 +5538,7 @@ Current version: 136 let nwi = { "key": karr.join(","), "keysecondary": "", + "keyanti": "", "content": itm.entry, "comment": "", "folder": null, @@ -5567,6 +5569,7 @@ Current version: 136 let nwi = { "key": karr.join(","), "keysecondary": ((ksarr && ksarr.length) > 0 ? ksarr.join(",") : ""), + "keyanti": "", "content": itm.content, "comment": itm.comment, "folder": null, @@ -5704,6 +5707,7 @@ Current version: 136 let nwi = { "key": key, "keysecondary": "", + "keyanti": "", "content": itm.text, "comment": "", "folder": null, @@ -5763,6 +5767,7 @@ Current version: 136 let nwi = { "key": (keys ? keys : ""), "keysecondary": "", + "keyanti": "", "content": (entry ? entry : ""), "comment": "", "folder": null, @@ -9317,14 +9322,15 @@ Current version: 136 function replace_placeholders_direct(inputtxt) { - inputtxt = replaceAll(inputtxt,"{{user}}",localsettings.chatname?localsettings.chatname:"You",true); - inputtxt = replaceAll(inputtxt,"{{char}}",localsettings.chatopponent?localsettings.chatopponent:defaultchatopponent,true); inputtxt = replaceAll(inputtxt,instructstartplaceholder,get_instruct_starttag(false)); inputtxt = replaceAll(inputtxt,instructendplaceholder,get_instruct_endtag(false)); //failsafe to handle removing newline tags inputtxt = replaceAll(inputtxt,instructstartplaceholder.trim(),get_instruct_starttag(false)); inputtxt = replaceAll(inputtxt,instructendplaceholder.trim(),get_instruct_endtag(false)); + inputtxt = replaceAll(inputtxt,"{{user}}",localsettings.chatname?localsettings.chatname:"You",true); + inputtxt = replaceAll(inputtxt,"{{char}}",localsettings.chatopponent?localsettings.chatopponent:defaultchatopponent,true); + for(let i=0;i wimatch_context.includes(k.trim())); } else { shoulduse = wiks.some(k => wimatch_context.includes(k.trim().toLowerCase())); } - } else { - let wiks2 = wi.keysecondary.split(","); + } + else + { + let wikanti = []; + let wiks2 = []; + if(!invalidantikey) + { + wikanti = wi.keyanti.split(","); + } + if(!invalidseckey) + { + wiks2 = wi.keysecondary.split(","); + } + let t1=false, t2=false, t3=false; if (localsettings.case_sensitive_wi) { - let t1 = wiks.some(k => wimatch_context.includes(k.trim())); - let t2 = wiks2.some(k => wimatch_context.includes(k.trim())); - shoulduse = (t1 && t2); + t1 = wiks.some(k => wimatch_context.includes(k.trim())); + t2 = wiks2.some(k => wimatch_context.includes(k.trim())); + t3 = wikanti.some(k => wimatch_context.includes(k.trim())); } else { - let t1 = wiks.some(k => wimatch_context.includes(k.trim().toLowerCase())); - let t2 = wiks2.some(k => wimatch_context.includes(k.trim().toLowerCase())); + t1 = wiks.some(k => wimatch_context.includes(k.trim().toLowerCase())); + t2 = wiks2.some(k => wimatch_context.includes(k.trim().toLowerCase())); + t3 = wikanti.some(k => wimatch_context.includes(k.trim().toLowerCase())); + } + if(!invalidantikey && !invalidseckey) //all keys valid + { + shoulduse = (t1 && t2 && !t3); + } + else if(invalidantikey) + { shoulduse = (t1 && t2); } + else + { + shoulduse = (t1 && !t3); + } } } @@ -13441,14 +13472,17 @@ Current version: 136 ce.selective = !ce.selective; var tgt = document.getElementById("wiskt" + idx); var tgt2 = document.getElementById("wikeysec" + idx); + var tgt3 = document.getElementById("wikeyanti" + idx); if (ce.selective) { tgt.classList.add("witoggleron"); tgt.classList.remove("witoggleroff"); tgt2.classList.remove("hidden"); + tgt3.classList.remove("hidden"); } else { tgt.classList.remove("witoggleron"); tgt.classList.add("witoggleroff"); tgt2.classList.add("hidden"); + tgt3.classList.add("hidden"); } } @@ -13499,6 +13533,7 @@ Current version: 136 var ne = { "key": "", "keysecondary": "", + "keyanti": "", "content": "", "comment": "", "folder": null, @@ -13514,6 +13549,7 @@ Current version: 136 for (var i = 0; i < current_wi.length; ++i) { current_wi[i].key = document.getElementById("wikey" + i).value; current_wi[i].keysecondary = document.getElementById("wikeysec" + i).value; + current_wi[i].keyanti = document.getElementById("wikeyanti" + i).value; current_wi[i].content = document.getElementById("wival" + i).value; let prb = document.getElementById("wirng" + i).value; current_wi[i].probability = (prb?prb:100); @@ -13550,6 +13586,7 @@ Current version: 136 var winame = escapeHtml(curr.key); var witxt = escapeHtml(curr.content); var wisec = curr.keysecondary; + var wianti = curr.keyanti; var wirngval = (curr.probability?curr.probability:100); var ishidden = false; @@ -13566,9 +13603,10 @@ Current version: 136 +`` + ` - ` + ` + ` + ` + ` + ` - + 📑