This commit is contained in:
RossAscends
2023-04-29 05:01:35 +09:00
8 changed files with 1432 additions and 2 deletions

7
public/css/bright.min.css vendored Normal file
View File

@ -0,0 +1,7 @@
/*!
Theme: Bright
Author: Chris Kempson (http://chriskempson.com)
License: ~ MIT (or more permissive) [via base16-schemes-source]
Maintainer: @highlightjs/core-team
Version: 2021.09.0
*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{color:#e0e0e0;background:#000}.hljs ::selection,.hljs::selection{background-color:#505050;color:#e0e0e0}.hljs-comment{color:#b0b0b0}.hljs-tag{color:#d0d0d0}.hljs-operator,.hljs-punctuation,.hljs-subst{color:#e0e0e0}.hljs-operator{opacity:.7}.hljs-bullet,.hljs-deletion,.hljs-name,.hljs-selector-tag,.hljs-template-variable,.hljs-variable{color:#fb0120}.hljs-attr,.hljs-link,.hljs-literal,.hljs-number,.hljs-symbol,.hljs-variable.constant_{color:#fc6d24}.hljs-class .hljs-title,.hljs-title,.hljs-title.class_{color:#fda331}.hljs-strong{font-weight:700;color:#fda331}.hljs-addition,.hljs-code,.hljs-string,.hljs-title.class_.inherited__{color:#a1c659}.hljs-built_in,.hljs-doctag,.hljs-keyword.hljs-atrule,.hljs-quote,.hljs-regexp{color:#76c7b7}.hljs-attribute,.hljs-function .hljs-title,.hljs-section,.hljs-title.function_,.ruby .hljs-property{color:#6fb3d2}.diff .hljs-meta,.hljs-keyword,.hljs-template-tag,.hljs-type{color:#d381c3}.hljs-emphasis{color:#d381c3;font-style:italic}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-meta .hljs-string{color:#be643c}.hljs-meta .hljs-keyword,.hljs-meta-keyword{font-weight:700}

View File

@ -12,6 +12,7 @@
<link href="css/fontawesome.css" rel="stylesheet"> <link href="css/fontawesome.css" rel="stylesheet">
<link href="css/solid.css" rel="stylesheet"> <link href="css/solid.css" rel="stylesheet">
<link href="css/jquery-ui.min.css" rel="stylesheet"> <link href="css/jquery-ui.min.css" rel="stylesheet">
<link href="css/bright.min.css" rel="stylesheet">
<link rel="apple-touch-icon" sizes="57x57" href="img/apple-icon-57x57.png" /> <link rel="apple-touch-icon" sizes="57x57" href="img/apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="img/apple-icon-72x72.png" /> <link rel="apple-touch-icon" sizes="72x72" href="img/apple-icon-72x72.png" />
@ -32,8 +33,10 @@
<script src="scripts/jquery.transit.min.js"></script> <script src="scripts/jquery.transit.min.js"></script>
<script src="scripts/jquery-cookie-1.4.1.min.js"></script> <script src="scripts/jquery-cookie-1.4.1.min.js"></script>
<script src="scripts/showdown.min.js"></script> <script src="scripts/showdown.min.js"></script>
<script src="scripts/showdown-katex.min.js"></script>
<script src="scripts/popper.js"></script> <script src="scripts/popper.js"></script>
<script src="scripts/purify.min.js"></script> <script src="scripts/purify.min.js"></script>
<script src="scripts/highlight.min.js"></script>
<script type="module" src="scripts/power-user.js"></script> <script type="module" src="scripts/power-user.js"></script>
<script type="module" src="scripts/swiped-events.js"></script> <script type="module" src="scripts/swiped-events.js"></script>
<link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="style.css">

View File

@ -164,8 +164,21 @@ export {
// API OBJECT FOR EXTERNAL WIRING // API OBJECT FOR EXTERNAL WIRING
window["SillyTavern"] = {}; window["SillyTavern"] = {};
let converter = new showdown.Converter({ emoji: "true" });
const gpt3 = new GPT3BrowserTokenizer({ type: 'gpt3' }); const gpt3 = new GPT3BrowserTokenizer({ type: 'gpt3' });
hljs.addPlugin({"before:highlightElement": ({ el }) => { el.textContent = el.innerText } });
let converter = new showdown.Converter({
emoji: "true",
underline: "true",
extensions: [
showdownKatex(
{
delimiters: [
{ left: '$$', right: '$$', display: true, asciimath: false },
{ left: '$', right: '$', display: false, asciimath: true },
]
}
)],
});
/* let bg_menu_toggle = false; */ /* let bg_menu_toggle = false; */
const systemUserName = "SillyTavern System"; const systemUserName = "SillyTavern System";
let default_user_name = "You"; let default_user_name = "You";
@ -901,8 +914,9 @@ function messageFormating(mes, ch_name, isSystem, forceAvatar) {
return match; return match;
} }
}); });
mes = mes.replaceAll('\\begin{align*}', '$$');
mes = mes.replaceAll('\\end{align*}', '$$');
mes = converter.makeHtml(mes); mes = converter.makeHtml(mes);
//mes = mes.replace(/{.*}/g, "");
mes = mes.replace(/{{(\*?.+?\*?)}}/g, ""); mes = mes.replace(/{{(\*?.+?\*?)}}/g, "");
mes = mes.replace(/\n/g, "<br/>"); mes = mes.replace(/\n/g, "<br/>");
@ -961,6 +975,7 @@ function addCopyToCodeBlocks(messageElement) {
document.body.removeChild(copiedMsg); document.body.removeChild(copiedMsg);
}, 2500); }, 2500);
}); });
hljs.highlightElement(codeBlocks.get(i));
} }
} }
@ -1286,6 +1301,7 @@ class StreamingProcessor {
onFinishStreaming(messageId, text) { onFinishStreaming(messageId, text) {
this.hideStopButton(this.messageId); this.hideStopButton(this.messageId);
this.onProgressStreaming(messageId, text); this.onProgressStreaming(messageId, text);
addCopyToCodeBlocks($(`#chat .mes[mesid="${messageId}"]`));
playMessageSound(); playMessageSound();
saveChatConditional(); saveChatConditional();
activateSendButtons(); activateSendButtons();

1361
public/scripts/highlight.min.js vendored Normal file

File diff suppressed because one or more lines are too long

36
public/scripts/showdown-katex.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -226,6 +226,8 @@ function onTagRemoveClick(event) {
const tagId = tag.attr("id"); const tagId = tag.attr("id");
tag.remove(); tag.remove();
removeTagFromMap(tagId); removeTagFromMap(tagId);
$(`${getInlineListSelector()} .tag[id="${tagId}"]`).remove();
printTags(); printTags();
saveSettingsDebounced(); saveSettingsDebounced();
} }

View File

@ -3575,6 +3575,10 @@ body.noShadows * {
text-shadow: none !important; text-shadow: none !important;
} }
.katex-html {
display: none;
}
/* ---------- @media queries must always go at the bottom ------------*/ /* ---------- @media queries must always go at the bottom ------------*/
/*will apply to anything 1000px or less. this catches ipads, horizontal phones, and vertical phones)*/ /*will apply to anything 1000px or less. this catches ipads, horizontal phones, and vertical phones)*/