Revert "added word definition fetching on click"

This reverts commit 80ed5f3d63.
This commit is contained in:
Miodec 2022-01-04 12:30:08 +01:00
parent 80ed5f3d63
commit b8ef24485e
7 changed files with 5 additions and 99 deletions

View file

@ -152,7 +152,6 @@ const refactoredSrc = [
"./src/js/popups/custom-theme-popup.js",
"./src/js/popups/import-export-settings-popup.js",
"./src/js/popups/custom-background-filter.js",
"./src/js/popups/word-definition-popup.js",
"./src/js/settings/language-picker.js",
"./src/js/settings/theme-picker.js",

5
package-lock.json generated
View file

@ -11930,11 +11930,6 @@
"string-width": "^4.0.0"
}
},
"word-definition": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/word-definition/-/word-definition-2.1.6.tgz",
"integrity": "sha1-E4Ji5pPdri0uA5vPV8lxSDhVkAk="
},
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",

View file

@ -71,7 +71,6 @@
"string-similarity": "^4.0.4",
"tinycolor2": "^1.4.2",
"ua-parser-js": "^0.7.28",
"uuid": "^8.3.2",
"word-definition": "^2.1.6"
"uuid": "^8.3.2"
}
}

View file

@ -1,35 +0,0 @@
import * as Loader from "./loader";
const WD = require("word-definition");
function hide() {
$("#wordDefinitionPopupWrapper")
.css("opacity", 1)
.animate({ opacity: 0 }, 125, () => {
$("#wordDefinitionPopupWrapper").addClass("hidden");
});
}
export function show(word) {
Loader.show();
WD.getDef(word, "en", null, function (def) {
if (def.err) {
Loader.hide();
console.log(`Getting word definition for ${word} failed: ${def.err}`);
return;
}
Loader.hide();
$("#wordDefinitionPopup .title").text(word);
$("#wordDefinitionPopup .subtext").text(def.category);
$("#wordDefinitionPopup .text").text(def.definition);
$("#wordDefinitionPopupWrapper")
.css("opacity", 0)
.removeClass("hidden")
.animate({ opacity: 1 }, 125);
});
}
$(document.body).on("click", "#wordDefinitionPopupWrapper", (e) => {
if ($(e.target).attr("id") === "wordDefinitionPopupWrapper") {
hide();
}
});

View file

@ -21,7 +21,6 @@ import * as ChallengeController from "./challenge-controller";
import * as RateQuotePopup from "./rate-quote-popup";
import * as UI from "./ui";
import * as TestTimer from "./test-timer";
import * as WordDefinitionPopup from "./word-definition-popup";
export let currentWordElementIndex = 0;
export let resultVisible = false;
@ -735,11 +734,10 @@ async function loadWordsHistory() {
) {
wordEl = `<div class='word' burst="${
TestStats.burstHistory[i]
}" word="${word}"
input="${TestLogic.corrected
.getHistory(i)
.replace(/"/g, "&quot;")
.replace(/ /g, "_")}">`;
}" input="${TestLogic.corrected
.getHistory(i)
.replace(/"/g, "&quot;")
.replace(/ /g, "_")}">`;
} else {
wordEl = `<div class='word' burst="${
TestStats.burstHistory[i]
@ -1131,17 +1129,6 @@ $(document.body).on("click", "#showWordHistoryButton", () => {
toggleResultWords();
});
$(document.body).on(
"click",
"#result #resultWordsHistory .words .word",
(e) => {
let word = $(e.currentTarget).attr("word");
if (word) {
WordDefinitionPopup.show(word);
}
}
);
$(document.body).on("click", "#restartTestButtonWithSameWordset", () => {
if (Config.mode == "zen") {
Notifications.add("Repeat test disabled in zen mode");

View file

@ -740,38 +740,6 @@
}
}
#wordDefinitionPopupWrapper {
#wordDefinitionPopup {
// height: 400px;
overflow-y: scroll;
max-height: 100%;
background: var(--bg-color);
border-radius: var(--roundness);
padding: 2rem;
display: grid;
grid-template-rows: auto auto auto;
gap: 1rem;
@extend .ffscroll;
margin: 0 2rem;
max-width: 500px;
.title {
font-size: 2rem;
line-height: 2rem;
color: var(--main-color);
}
.text {
color: var(--text-color);
}
.subtext {
color: var(--sub-color);
font-style: italic;
}
}
}
#contactPopupWrapper {
#contactPopup {
// height: 400px;

View file

@ -773,13 +773,6 @@
</div>
</div>
</div>
<div id="wordDefinitionPopupWrapper" class="popupWrapper hidden">
<div id="wordDefinitionPopup">
<div class="title"></div>
<div class="subtext"></div>
<div class="text"></div>
</div>
</div>
<div id="commandLineWrapper" class="hidden">
<div id="commandLine">
<div