mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-10 23:56:22 +08:00
renamed rate quote popup to quote rate popup to stay consistent
This commit is contained in:
parent
e5ce6014b2
commit
d45589354e
8 changed files with 39 additions and 39 deletions
|
@ -143,7 +143,7 @@ const refactoredSrc = [
|
|||
"./src/js/popups/quote-submit-popup.js",
|
||||
"./src/js/popups/quote-approve-popup.js",
|
||||
"./src/js/popups/quote-report-popup.js",
|
||||
"./src/js/popups/rate-quote-popup.js",
|
||||
"./src/js/popups/quote-rate-popup.js",
|
||||
"./src/js/popups/version-popup.js",
|
||||
"./src/js/popups/support-popup.js",
|
||||
"./src/js/popups/contact-popup.js",
|
||||
|
|
|
@ -10,12 +10,12 @@ let currentQuote = null;
|
|||
let quoteStats = null;
|
||||
|
||||
function reset() {
|
||||
$(`#rateQuotePopup .quote .text`).text("-");
|
||||
$(`#rateQuotePopup .quote .source .val`).text("-");
|
||||
$(`#rateQuotePopup .quote .id .val`).text("-");
|
||||
$(`#rateQuotePopup .quote .length .val`).text("-");
|
||||
$("#rateQuotePopup .ratingCount .val").text("-");
|
||||
$("#rateQuotePopup .ratingAverage .val").text("-");
|
||||
$(`#quoteRatePopup .quote .text`).text("-");
|
||||
$(`#quoteRatePopup .quote .source .val`).text("-");
|
||||
$(`#quoteRatePopup .quote .id .val`).text("-");
|
||||
$(`#quoteRatePopup .quote .length .val`).text("-");
|
||||
$("#quoteRatePopup .ratingCount .val").text("-");
|
||||
$("#quoteRatePopup .ratingAverage .val").text("-");
|
||||
}
|
||||
|
||||
export async function getQuoteStats(quote) {
|
||||
|
@ -50,16 +50,16 @@ export async function getQuoteStats(quote) {
|
|||
|
||||
function refreshStars(force) {
|
||||
let limit = force ? parseInt(force) : rating;
|
||||
$(`#rateQuotePopup .star`).removeClass("active");
|
||||
$(`#quoteRatePopup .star`).removeClass("active");
|
||||
for (let i = 1; i <= limit; i++) {
|
||||
$(`#rateQuotePopup .star[rating=${i}]`).addClass("active");
|
||||
$(`#quoteRatePopup .star[rating=${i}]`).addClass("active");
|
||||
}
|
||||
}
|
||||
|
||||
async function updateRatingStats() {
|
||||
if (!quoteStats) await getQuoteStats();
|
||||
$("#rateQuotePopup .ratingCount .val").text(quoteStats.ratings ?? "0");
|
||||
$("#rateQuotePopup .ratingAverage .val").text(
|
||||
$("#quoteRatePopup .ratingCount .val").text(quoteStats.ratings ?? "0");
|
||||
$("#quoteRatePopup .ratingAverage .val").text(
|
||||
quoteStats.average?.toFixed(1) ?? "-"
|
||||
);
|
||||
}
|
||||
|
@ -75,15 +75,15 @@ function updateData() {
|
|||
} else if (currentQuote.group == 3) {
|
||||
lengthDesc = "thicc";
|
||||
}
|
||||
$(`#rateQuotePopup .quote .text`).text(currentQuote.text);
|
||||
$(`#rateQuotePopup .quote .source .val`).text(currentQuote.source);
|
||||
$(`#rateQuotePopup .quote .id .val`).text(currentQuote.id);
|
||||
$(`#rateQuotePopup .quote .length .val`).text(lengthDesc);
|
||||
$(`#quoteRatePopup .quote .text`).text(currentQuote.text);
|
||||
$(`#quoteRatePopup .quote .source .val`).text(currentQuote.source);
|
||||
$(`#quoteRatePopup .quote .id .val`).text(currentQuote.id);
|
||||
$(`#quoteRatePopup .quote .length .val`).text(lengthDesc);
|
||||
updateRatingStats();
|
||||
}
|
||||
|
||||
export function show(quote, shouldReset = true) {
|
||||
if ($("#rateQuotePopupWrapper").hasClass("hidden")) {
|
||||
if ($("#quoteRatePopupWrapper").hasClass("hidden")) {
|
||||
if (shouldReset) {
|
||||
reset();
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ export function show(quote, shouldReset = true) {
|
|||
|
||||
refreshStars();
|
||||
updateData();
|
||||
$("#rateQuotePopupWrapper")
|
||||
$("#quoteRatePopupWrapper")
|
||||
.stop(true, true)
|
||||
.css("opacity", 0)
|
||||
.removeClass("hidden")
|
||||
|
@ -108,8 +108,8 @@ export function show(quote, shouldReset = true) {
|
|||
}
|
||||
|
||||
function hide() {
|
||||
if (!$("#rateQuotePopupWrapper").hasClass("hidden")) {
|
||||
$("#rateQuotePopupWrapper")
|
||||
if (!$("#quoteRatePopupWrapper").hasClass("hidden")) {
|
||||
$("#quoteRatePopupWrapper")
|
||||
.stop(true, true)
|
||||
.css("opacity", 1)
|
||||
.animate(
|
||||
|
@ -118,7 +118,7 @@ function hide() {
|
|||
},
|
||||
100,
|
||||
(e) => {
|
||||
$("#rateQuotePopupWrapper").addClass("hidden");
|
||||
$("#quoteRatePopupWrapper").addClass("hidden");
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -193,27 +193,27 @@ async function submit() {
|
|||
}
|
||||
}
|
||||
|
||||
$("#rateQuotePopupWrapper").click((e) => {
|
||||
if ($(e.target).attr("id") === "rateQuotePopupWrapper") {
|
||||
$("#quoteRatePopupWrapper").click((e) => {
|
||||
if ($(e.target).attr("id") === "quoteRatePopupWrapper") {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#rateQuotePopup .stars .star").hover((e) => {
|
||||
$("#quoteRatePopup .stars .star").hover((e) => {
|
||||
let ratingHover = $(e.currentTarget).attr("rating");
|
||||
refreshStars(ratingHover);
|
||||
});
|
||||
|
||||
$("#rateQuotePopup .stars .star").click((e) => {
|
||||
$("#quoteRatePopup .stars .star").click((e) => {
|
||||
let ratingHover = $(e.currentTarget).attr("rating");
|
||||
rating = parseInt(ratingHover);
|
||||
});
|
||||
|
||||
$("#rateQuotePopup .stars .star").mouseout((e) => {
|
||||
$(`#rateQuotePopup .star`).removeClass("active");
|
||||
$("#quoteRatePopup .stars .star").mouseout((e) => {
|
||||
$(`#quoteRatePopup .star`).removeClass("active");
|
||||
refreshStars();
|
||||
});
|
||||
|
||||
$("#rateQuotePopup .submitButton").click((e) => {
|
||||
$("#quoteRatePopup .submitButton").click((e) => {
|
||||
submit();
|
||||
});
|
|
@ -9,7 +9,7 @@ import * as ThemeColors from "./theme-colors";
|
|||
import * as DB from "./db";
|
||||
import * as TodayTracker from "./today-tracker";
|
||||
import * as PbCrown from "./pb-crown";
|
||||
import * as RateQuotePopup from "./rate-quote-popup";
|
||||
import * as QuoteRatePopup from "./quote-rate-popup";
|
||||
import * as TestLogic from "./test-logic";
|
||||
import * as Notifications from "./notifications";
|
||||
|
||||
|
@ -556,7 +556,7 @@ export function updateRateQuote(randomQuote) {
|
|||
.removeClass("far")
|
||||
.addClass("fas");
|
||||
}
|
||||
RateQuotePopup.getQuoteStats(randomQuote).then((quoteStats) => {
|
||||
QuoteRatePopup.getQuoteStats(randomQuote).then((quoteStats) => {
|
||||
$(".pageTest #result #rateQuoteButton .rating").text(
|
||||
quoteStats.average?.toFixed(1) ?? ""
|
||||
);
|
||||
|
|
|
@ -34,7 +34,7 @@ import * as TodayTracker from "./today-tracker";
|
|||
import * as WeakSpot from "./weak-spot";
|
||||
import * as Wordset from "./wordset";
|
||||
import * as ChallengeContoller from "./challenge-controller";
|
||||
import * as RateQuotePopup from "./rate-quote-popup";
|
||||
import * as QuoteRatePopup from "./quote-rate-popup";
|
||||
import * as BritishEnglish from "./british-english";
|
||||
import * as LazyMode from "./lazy-mode";
|
||||
import * as Result from "./result";
|
||||
|
@ -563,7 +563,7 @@ export function restart(
|
|||
$("#showWordHistoryButton").removeClass("loaded");
|
||||
$("#restartTestButton").blur();
|
||||
Funbox.resetMemoryTimer();
|
||||
RateQuotePopup.clearQuoteStats();
|
||||
QuoteRatePopup.clearQuoteStats();
|
||||
if (UI.getActivePage() == "pageTest" && window.scrollY > 0)
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
$("#wordsInput").val(" ");
|
||||
|
|
|
@ -18,7 +18,7 @@ import * as TestStats from "./test-stats";
|
|||
import * as Misc from "./misc";
|
||||
import * as TestUI from "./test-ui";
|
||||
import * as ChallengeController from "./challenge-controller";
|
||||
import * as RateQuotePopup from "./rate-quote-popup";
|
||||
import * as QuoteRatePopup from "./quote-rate-popup";
|
||||
import * as UI from "./ui";
|
||||
import * as TestTimer from "./test-timer";
|
||||
import * as ReportQuotePopup from "./quote-report-popup";
|
||||
|
@ -995,7 +995,7 @@ $(".pageTest #copyWordsListButton").click(async (event) => {
|
|||
});
|
||||
|
||||
$(".pageTest #rateQuoteButton").click(async (event) => {
|
||||
RateQuotePopup.show(TestLogic.randomQuote);
|
||||
QuoteRatePopup.show(TestLogic.randomQuote);
|
||||
});
|
||||
|
||||
$(".pageTest #reportQuoteButton").click(async (event) => {
|
||||
|
|
|
@ -98,8 +98,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
#rateQuotePopupWrapper {
|
||||
#rateQuotePopup {
|
||||
#quoteRatePopupWrapper {
|
||||
#quoteRatePopup {
|
||||
color: var(--sub-color);
|
||||
background: var(--bg-color);
|
||||
border-radius: var(--roundness);
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
}
|
||||
|
||||
@media only screen and (max-width: 1000px) {
|
||||
#rateQuotePopup {
|
||||
#quoteRatePopup {
|
||||
width: 90vw !important;
|
||||
}
|
||||
#bottom {
|
||||
|
@ -213,7 +213,7 @@
|
|||
}
|
||||
|
||||
@media only screen and (max-width: 650px) {
|
||||
#rateQuotePopup {
|
||||
#quoteRatePopup {
|
||||
.ratingStats {
|
||||
grid-template-columns: 1fr 1fr !important;
|
||||
}
|
||||
|
|
|
@ -286,8 +286,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="rateQuotePopupWrapper" class="popupWrapper hidden">
|
||||
<div id="rateQuotePopup" quoteId="">
|
||||
<div id="quoteRatePopupWrapper" class="popupWrapper hidden">
|
||||
<div id="quoteRatePopup" quoteId="">
|
||||
<div class="quote">
|
||||
<div class="text">-</div>
|
||||
<div class="id">
|
||||
|
|
Loading…
Add table
Reference in a new issue