Merge pull request #1430 from valadaptive/eslint-fixes-2

ESLint fixes, part 2 - bulky changes
This commit is contained in:
Cohee
2023-12-02 19:43:11 +02:00
committed by GitHub
29 changed files with 67 additions and 68 deletions

View File

@ -763,7 +763,7 @@ function sampleClassifyText(text) {
}
// Remove asterisks and quotes
let result = text.replace(/[\*\"]/g, '');
let result = text.replace(/[*"]/g, '');
const SAMPLE_THRESHOLD = 500;
const HALF_SAMPLE_THRESHOLD = SAMPLE_THRESHOLD / 2;

View File

@ -2416,7 +2416,7 @@ async function sdMessageButton(e) {
context.saveChat();
}
};
}
$("#sd_dropdown [id]").on("click", function () {
const id = $(this).attr("id");

View File

@ -151,7 +151,7 @@ function showKeysButton() {
function loadSettings() {
for (const key in defaultSettings) {
if (!extension_settings.translate.hasOwnProperty(key)) {
if (!Object.hasOwn(extension_settings.translate, key)) {
extension_settings.translate[key] = defaultSettings[key];
}
}

View File

@ -492,7 +492,7 @@ async function processTtsQueue() {
currentTtsJob = ttsJobQueue.shift()
let text = extension_settings.tts.narrate_translated_only ? (currentTtsJob?.extra?.display_text || currentTtsJob.mes) : currentTtsJob.mes
text = extension_settings.tts.narrate_dialogues_only
? text.replace(/\*[^\*]*?(\*|$)/g, '').trim() // remove asterisks content
? text.replace(/\*[^*]*?(\*|$)/g, '').trim() // remove asterisks content
: text.replaceAll('*', '').trim() // remove just the asterisks
if (extension_settings.tts.narrate_quoted_only) {

View File

@ -46,7 +46,7 @@ var speechUtteranceChunker = function (utt, settings, callback) {
newUtt = new SpeechSynthesisUtterance(chunk);
var x;
for (x in utt) {
if (utt.hasOwnProperty(x) && x !== 'text') {
if (Object.hasOwn(utt, x) && x !== 'text') {
newUtt[x] = utt[x];
}
}

View File

@ -145,7 +145,7 @@ const hashCache = {};
*/
function getStringHash(str) {
// Check if the hash is already in the cache
if (hashCache.hasOwnProperty(str)) {
if (Object.hasOwn(hashCache, str)) {
return hashCache[str];
}