Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Clay-Ferguson committed Dec 8, 2023
1 parent dfe12b6 commit 17296c8
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/public/src/DomUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ export class DomUtil {
to replace on your whole web page */
public highlightText = (rootElm: HTMLElement, text: string) => {
if (text.startsWith("\"") && text.endsWith("\"")) {
text = text.replace("\"", "");
text = text.replaceAll("\"", "");
}
const reg = this.escapeRegEx(text);
const regex = new RegExp(reg, "i"); // case insensitive search
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/public/src/Render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ export class Render {
links += `<div class="tourLinkDiv"><span class="tourLink ui-run-cmd" data-cmd="tour:${tour.name}">${tour.name}</span></div>`
});
}
return val.replace("{{" + cmd + "}}", links);
return val.replaceAll("{{" + cmd + "}}", links);
}

injectAdminLink = (val: string, cmd: string, buttonText: string) => {
// NOTE: Our Singleton class puts a global copy of S on the browser 'window object', so that's why this script works.
return val.replace("{{" + cmd + "}}", `<span class="adminButton ui-run-cmd" data-cmd="${cmd}">${buttonText}</span>`);
return val.replaceAll("{{" + cmd + "}}", `<span class="adminButton ui-run-cmd" data-cmd="${cmd}">${buttonText}</span>`);
}

renderLinkLabel = (id: string) => {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/public/src/RpcUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ export class RpcUtil {
if (!this.logVerbose) {
let trace = res.stackTrace;
if (trace) {
trace = trace.replace("\\n", "\n");
trace = trace.replace("\\t", "\t");
trace = trace.replaceAll("\\n", "\n");
trace = trace.replaceAll("\\t", "\t");

// remove this so the prettyPrint doesn't contain it.
delete res.stackTrace;
Expand Down
24 changes: 12 additions & 12 deletions src/main/resources/public/src/SpeechEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,11 @@ export class SpeechEngine {

// Let's rip out all the hashtags and at symbols mainly just so we can read
// text full of hashtags and have it sound good.
sayThis = sayThis.replace("#", " ");
sayThis = sayThis.replaceAll("#", " ");

// replace backquote or else the engine will pronounce the actual word 'backquote' which we of courose
// do not want.
sayThis = sayThis.replace("`", "\"");
sayThis = sayThis.replaceAll("`", "\"");

utter = new SpeechSynthesisUtterance(sayThis);

Expand Down Expand Up @@ -433,16 +433,16 @@ export class SpeechEngine {
preProcessText = (text: string): string => {
if (!text) return;
// engine will SAY the 'quote' if you leave this here.
text = text.replace(".\"", ".");
text = text.replace(".'", ".");
text = text.replaceAll(".\"", ".");
text = text.replaceAll(".'", ".");

text = text.replace("!\"", "!");
text = text.replace("!'", "!");
text = text.replaceAll("!\"", "!");
text = text.replaceAll("!'", "!");

text = text.replace("?\"", "?");
text = text.replace("?'", "?");
text = text.replaceAll("?\"", "?");
text = text.replaceAll("?'", "?");

text = text.replace(/[@#_*]/g, " ");
text = text.replaceAll(/[@#_*]/g, " ");
return text;
}

Expand Down Expand Up @@ -506,8 +506,8 @@ export class SpeechEngine {
}

splitByQuotations = (text: string): string[] => {
text = text.replace("“", "\"");
text = text.replace("”", "\"");
text = text.replaceAll("“", "\"");
text = text.replaceAll("”", "\"");
const quoteCount = S.util.countChars(text, "\"");

let ret: string[] = null;
Expand Down Expand Up @@ -551,7 +551,7 @@ export class SpeechEngine {
// This is a dirty but clever hack to fix lots of initials like (J.F.K.)
// and make them not do any sentence breaks there.
for (const char of "ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
text = text.replace(char + ".", char + " ");
text = text.replaceAll(char + ".", char + " ");
}

// first split into sentences.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class NodeCompMarkdown extends Comp {
if (!urls || !val) return val;
urls.forEach((url: string) => {
if (val.indexOf("(" + url) == -1) {
val = val.replace(url, `[${url}](${url})`);
val = val.replaceAll(url, `[${url}](${url})`);
}
});
return val;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export class NodeCompRowHeader extends Div {
}
let fileName = S.props.getPropStr(J.NodeProp.FILE_NAME, this.node);
if (fileName) {
fileName = fileName.replace("/index.md", "/*");
fileName = fileName.replaceAll("/index.md", "/*");
floatUpperRightDiv.addChild(new Span(fileName, {
className: "nodeFileNameDisp",
title: "File for Markdown Export"
Expand Down
12 changes: 6 additions & 6 deletions src/main/resources/public/src/dlg/SearchContentDlg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,42 +95,42 @@ export class SearchContentDlg extends DialogBase {
}
},
getValue: (): boolean => this.getState<LS>().blockedWords
}) : null,
}, "marginTop") : null,
new Checkbox("Substring", null, {
setValue: (checked: boolean) => {
SearchContentDlg.dlgState.fuzzy = checked;
this.mergeState<LS>({ fuzzy: checked });
},
getValue: (): boolean => this.getState<LS>().fuzzy
}),
}, "marginTop"),
new Checkbox("Case Sensitive", null, {
setValue: (checked: boolean) => {
SearchContentDlg.dlgState.caseSensitive = checked;
this.mergeState<LS>({ caseSensitive: checked });
},
getValue: (): boolean => this.getState<LS>().caseSensitive
}),
}, "marginTop"),
new Checkbox("Recursive", null, {
setValue: (checked: boolean) => {
SearchContentDlg.dlgState.recursive = checked;
this.mergeState<LS>({ recursive: checked });
},
getValue: (): boolean => this.getState<LS>().recursive
}),
}, "marginTop"),
new Checkbox("Has Attachment", null, {
setValue: (checked: boolean) => {
SearchContentDlg.dlgState.requireAttachment = checked;
this.mergeState<LS>({ requireAttachment: checked });
},
getValue: (): boolean => this.getState<LS>().requireAttachment
}),
}, "marginTop"),
new Checkbox("Has Date", null, {
setValue: (checked: boolean) => {
SearchContentDlg.dlgState.requireDate = checked;
this.mergeState<LS>({ requireDate: checked });
},
getValue: (): boolean => this.getState<LS>().requireDate
})
}, "marginTop")
], "marginBottom"),

new FlexRowLayout([
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/public/src/tabs/TTSView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class TTSView extends AppTab<any, TTSView> {
this.makeVoiceChooser(C.LOCALDB_VOICE_INDEX, true),
S.speech.USE_VOICE2 ? this.makeVoiceChooser(C.LOCALDB_VOICE2_INDEX, false) : null,
this.makeRateChooser(),
new Checkbox("Text Input", { className: "bigMarginLeft" }, {
new Checkbox("Text Input", { className: "bigMarginLeft marginTop" }, {
setValue: (checked: boolean) => dispatch("setTtsInput", s => {
if (!checked) {
TTSView.textAreaState.setValue("");
Expand Down

0 comments on commit 17296c8

Please sign in to comment.