1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-03 07:36:23 -07:00

refactor: replace template strings with regular string literals

Template literals are useful when you need:  1. [Interpolated strings](https://en.wikipedia.org/wiki/String_interpolation).
This commit is contained in:
deepsource-autofix[bot] 2023-05-14 07:10:46 +00:00 committed by GitHub
parent 1603a2eb7e
commit 8860f3dbec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View file

@ -228,8 +228,8 @@ export function addPostDropdown($post: JQuery<HTMLElement>) {
let showHide = isPostVisible(idNum)?"Hide":"Show"; let showHide = isPostVisible(idNum)?"Hide":"Show";
$ddownMenu.append( $ddownMenu.append(
`<option>${showHide} ${threadPost}</option>`, `<option>${showHide} ${threadPost}</option>`,
`<option>Edit post</option>`, "<option>Edit post</option>",
`<option>Report post</option>`, "<option>Report post</option>",
`<option>Delete ${threadPost}</option>`, `<option>Delete ${threadPost}</option>`,
).insertAfter($postInfo) ).insertAfter($postInfo)
.on("change", _e => { .on("change", _e => {
@ -237,7 +237,7 @@ export function addPostDropdown($post: JQuery<HTMLElement>) {
$ddownMenu.val("Actions"); $ddownMenu.val("Actions");
}); });
if(hasUpload) if(hasUpload)
$ddownMenu.append(`<option>Delete file</option>`); $ddownMenu.append("<option>Delete file</option>");
$post.trigger("postDropdownAdded", { $post.trigger("postDropdownAdded", {
post: $post, post: $post,
dropdown: $ddownMenu dropdown: $ddownMenu

View file

@ -23,12 +23,12 @@ let threadCooldown = 0;
let replyCooldown = 0; let replyCooldown = 0;
const qrButtonHTML = const qrButtonHTML =
`<input type="file" id="imagefile" name="imagefile" accept="image/jpeg,image/png,image/gif,video/webm,video/mp4"/>` + '<input type="file" id="imagefile" name="imagefile" accept="image/jpeg,image/png,image/gif,video/webm,video/mp4"/>' +
`<input type="submit" value="Post" style="float:right;min-width:50px"/>`; '<input type="submit" value="Post" style="float:right;min-width:50px"/>';
const qrTitleBar = const qrTitleBar =
`<div id="qr-title">` + '<div id="qr-title">' +
`<span id="qr-message"></span>` + '<span id="qr-message"></span>' +
`<span id="qr-buttons"><a href="javascript:toBottom();">${downArrow}</a>` + `<span id="qr-buttons"><a href="javascript:toBottom();">${downArrow}</a>` +
`<a href="javascript:toTop();">${upArrow}</a><a href="javascript:closeQR();">X</a></span></div>`; `<a href="javascript:toTop();">${upArrow}</a><a href="javascript:closeQR();">X</a></span></div>`;

View file

@ -39,7 +39,7 @@ function setupManagementEvents() {
const $post = $(el.parentElement); const $post = $(el.parentElement);
const isLocked = isThreadLocked($post); const isLocked = isThreadLocked($post);
if(!dropdownHasItem(el, "Staff Actions")) { if(!dropdownHasItem(el, "Staff Actions")) {
$el.append(`<option disabled="disabled">Staff Actions</option>`); $el.append('<option disabled="disabled">Staff Actions</option>');
} }
if($post.hasClass("op-post")) { if($post.hasClass("op-post")) {
if(isLocked) { if(isLocked) {

View file

@ -128,7 +128,7 @@ class NumberSetting extends Setting<number, HTMLInputElement> {
function createLightbox() { function createLightbox() {
let settingsHTML = let settingsHTML =
`<div id="settings-container" style="overflow:auto"><table width="100%"><colgroup><col span="1" width="50%"><col span="1" width="50%"></colgroup></table></div><div class="lightbox-footer"><hr /><button id="save-settings-button">Save Settings</button></div>`; '<div id="settings-container" style="overflow:auto"><table width="100%"><colgroup><col span="1" width="50%"><col span="1" width="50%"></colgroup></table></div><div class="lightbox-footer"><hr /><button id="save-settings-button">Save Settings</button></div>';
showLightBox("Settings", settingsHTML); showLightBox("Settings", settingsHTML);
$("button#save-settings-button").on("click", () => { $("button#save-settings-button").on("click", () => {
settings.forEach((setting, key) => { settings.forEach((setting, key) => {

View file

@ -59,7 +59,7 @@ function addThreadToMenu(thread: WatchedThreadJSON) {
function removeThreadFromMenu(threadID: number) { function removeThreadFromMenu(threadID: number) {
$watcherMenu.find(`div#thread${threadID}`).remove(); $watcherMenu.find(`div#thread${threadID}`).remove();
if($watcherMenu.find("div.watcher-item").length == 0) if($watcherMenu.find("div.watcher-item").length == 0)
$watcherMenu.append(`<i id="no-threads">no watched threads</i>`); $watcherMenu.append('<i id="no-threads">no watched threads</i>');
} }
function updateThreadInWatcherMenu(thread: WatchedThreadJSON) { function updateThreadInWatcherMenu(thread: WatchedThreadJSON) {
@ -101,7 +101,7 @@ $(() => {
$watcherMenu = $("<div/>").prop({ $watcherMenu = $("<div/>").prop({
id: "watchermenu", id: "watchermenu",
class: "dropdown-menu" class: "dropdown-menu"
}).append(`<b>Watched threads</b><br/><i id="no-threads">no watched threads</i>`); }).append('<b>Watched threads</b><br/><i id="no-threads">no watched threads</i>');
} }
if(watcherBtn === null) { if(watcherBtn === null) {
watcherBtn = new TopBarButton("Watcher", () => { watcherBtn = new TopBarButton("Watcher", () => {