diff --git a/qt/ts/src/deckbrowser.ts b/qt/ts/src/deckbrowser.ts index 40be7459e..34ac83b04 100644 --- a/qt/ts/src/deckbrowser.ts +++ b/qt/ts/src/deckbrowser.ts @@ -8,7 +8,7 @@ function init() { scroll: false, // can't use "helper: 'clone'" because of a bug in jQuery 1.5 - helper: function(event) { + helper: function (event) { return $(this).clone(false); }, delay: 200, diff --git a/qt/ts/src/editor.ts b/qt/ts/src/editor.ts index 6a59ff978..addb2f7a6 100644 --- a/qt/ts/src/editor.ts +++ b/qt/ts/src/editor.ts @@ -13,9 +13,9 @@ declare interface String { } /* kept for compatibility with add-ons */ -String.prototype.format = function() { +String.prototype.format = function () { const args = arguments; - return this.replace(/\{\d+\}/g, function(m) { + return this.replace(/\{\d+\}/g, function (m) { return args[m.match(/\d+/)]; }); }; @@ -41,7 +41,7 @@ function saveNow(keepFocus) { function triggerKeyTimer() { clearChangeTimer(); - changeTimer = setTimeout(function() { + changeTimer = setTimeout(function () { updateButtonState(); saveField("key"); }, 600); @@ -391,7 +391,7 @@ function hideDupes() { } /// If the field has only an empty br, remove it first. -let insertHtmlRemovingInitialBR = function(html: string) { +let insertHtmlRemovingInitialBR = function (html: string) { if (html !== "") { // remove
in empty field if (currentField && currentField.innerHTML === "
") { @@ -401,12 +401,12 @@ let insertHtmlRemovingInitialBR = function(html: string) { } }; -let pasteHTML = function(html, internal, extendedMode) { +let pasteHTML = function (html, internal, extendedMode) { html = filterHTML(html, internal, extendedMode); insertHtmlRemovingInitialBR(html); }; -let filterHTML = function(html, internal, extendedMode) { +let filterHTML = function (html, internal, extendedMode) { // wrap it in as we aren't allowed to change top level elements const top = $.parseHTML("" + html + "")[0] as Element; if (internal) { @@ -476,11 +476,11 @@ const allowedStyling = { "text-decoration-line": true, }; -let isNightMode = function(): boolean { +let isNightMode = function (): boolean { return document.body.classList.contains("nightMode"); }; -let filterExternalSpan = function(node) { +let filterExternalSpan = function (node) { // filter out attributes let toRemove = []; for (const attr of node.attributes) { @@ -520,7 +520,7 @@ allowedTagsExtended["SPAN"] = filterExternalSpan; Object.assign(allowedTagsExtended, allowedTagsBasic); // filtering from another field -let filterInternalNode = function(node) { +let filterInternalNode = function (node) { if (node.style) { node.style.removeProperty("background-color"); node.style.removeProperty("font-size"); @@ -533,7 +533,7 @@ let filterInternalNode = function(node) { }; // filtering from external sources -let filterNode = function(node, extendedMode) { +let filterNode = function (node, extendedMode) { // text node? if (node.nodeType === 3) { return; @@ -586,7 +586,7 @@ let filterNode = function(node, extendedMode) { } }; -let adjustFieldsTopMargin = function() { +let adjustFieldsTopMargin = function () { const topHeight = $("#topbuts").height(); const margin = topHeight + 8; document.getElementById("fields").style.marginTop = margin + "px"; @@ -594,16 +594,16 @@ let adjustFieldsTopMargin = function() { let mouseDown = 0; -$(function() { - document.body.onmousedown = function() { +$(function () { + document.body.onmousedown = function () { mouseDown++; }; - document.body.onmouseup = function() { + document.body.onmouseup = function () { mouseDown--; }; - document.onclick = function(evt: MouseEvent) { + document.onclick = function (evt: MouseEvent) { const src = evt.target as Element; if (src.tagName === "IMG") { // image clicked; find contenteditable parent @@ -618,11 +618,11 @@ $(function() { }; // prevent editor buttons from taking focus - $("button.linkb").on("mousedown", function(e) { + $("button.linkb").on("mousedown", function (e) { e.preventDefault(); }); - window.onresize = function() { + window.onresize = function () { adjustFieldsTopMargin(); }; diff --git a/qt/ts/src/overview.ts b/qt/ts/src/overview.ts index 2080381e0..a5b05139c 100644 --- a/qt/ts/src/overview.ts +++ b/qt/ts/src/overview.ts @@ -1,6 +1,6 @@ /* Copyright: Ankitects Pty Ltd and contributors * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ -$(function() { +$(function () { $("#study").focus(); }); diff --git a/qt/ts/src/reviewer-bottom.ts b/qt/ts/src/reviewer-bottom.ts index bc39285c3..8bb5e014f 100644 --- a/qt/ts/src/reviewer-bottom.ts +++ b/qt/ts/src/reviewer-bottom.ts @@ -4,16 +4,16 @@ var time: number; // set in python code let maxTime = 0; -$(function() { +$(function () { $("#ansbut").focus(); updateTime(); - setInterval(function() { + setInterval(function () { time += 1; updateTime(); }, 1000); }); -let updateTime = function() { +let updateTime = function () { let timeNode = $("#time"); if (!maxTime) { timeNode.text(""); diff --git a/qt/ts/src/reviewer.ts b/qt/ts/src/reviewer.ts index 257c6e853..46672e422 100644 --- a/qt/ts/src/reviewer.ts +++ b/qt/ts/src/reviewer.ts @@ -21,7 +21,7 @@ function _updateQA(html, fadeTime, onupdate, onshown) { // if a request to update q/a comes in before the previous content // has been loaded, wait a while and try again if (_updatingQA) { - setTimeout(function() { + setTimeout(function () { _updateQA(html, fadeTime, onupdate, onshown); }, 50); return; @@ -34,7 +34,7 @@ function _updateQA(html, fadeTime, onupdate, onshown) { // fade out current text var qa = $("#qa"); - qa.fadeTo(fadeTime, 0, function() { + qa.fadeTo(fadeTime, 0, function () { // update text try { qa.html(html); @@ -55,8 +55,8 @@ function _updateQA(html, fadeTime, onupdate, onshown) { MathJax.Hub.Queue(["Typeset", MathJax.Hub]); // and reveal when processing is done - MathJax.Hub.Queue(function() { - qa.fadeTo(fadeTime, 1, function() { + MathJax.Hub.Queue(function () { + qa.fadeTo(fadeTime, 1, function () { _runHook(onShownHook); _updatingQA = false; }); @@ -68,13 +68,13 @@ function _showQuestion(q, bodyclass) { _updateQA( q, qFade, - function() { + function () { // return to top of window window.scrollTo(0, 0); document.body.className = bodyclass; }, - function() { + function () { // focus typing area if visible typeans = document.getElementById("typeans"); if (typeans) { @@ -88,7 +88,7 @@ function _showAnswer(a, bodyclass) { _updateQA( a, aFade, - function() { + function () { if (bodyclass) { // when previewing document.body.className = bodyclass; @@ -100,7 +100,7 @@ function _showAnswer(a, bodyclass) { e[0].scrollIntoView(); } }, - function() {} + function () {} ); } diff --git a/qt/ts/src/webview.ts b/qt/ts/src/webview.ts index 6c812bef8..c25c29427 100644 --- a/qt/ts/src/webview.ts +++ b/qt/ts/src/webview.ts @@ -2,7 +2,7 @@ * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ // prevent backspace key from going back a page -document.addEventListener("keydown", function(evt: KeyboardEvent) { +document.addEventListener("keydown", function (evt: KeyboardEvent) { if (evt.keyCode !== 8) { return; }