Skip to content

Commit

Permalink
encapsulate banner in function
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed Jan 6, 2024
1 parent ac5ca27 commit 3980aaf
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 30 deletions.
2 changes: 1 addition & 1 deletion client/database/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<div class="toast-container position-fixed top-0 end-0 p-3">
<div id="funny-toast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header" style="background-color: yellow;">
<h1 class="me-auto text-danger">DO YOUR GRAD SCHOOL APPS</h1>
<h1 id="funny-toast-text" class="me-auto text-danger"></h1>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
Expand Down
4 changes: 0 additions & 4 deletions client/database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,6 @@ function QueryForm() {
});
setDifficulties(tempDifficulties);
});
const toast = new bootstrap.Toast(document.getElementById('funny-toast'));
if ((await getAccountUsername()) === 'forrestw') {
toast.show();
}
}, []);
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(CategoryModal, null), /*#__PURE__*/React.createElement("form", {
className: "mt-3",
Expand Down
5 changes: 0 additions & 5 deletions client/database/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,6 @@ function QueryForm() {
});
setDifficulties(tempDifficulties);
});

const toast = new bootstrap.Toast(document.getElementById('funny-toast'));
if (await getAccountUsername() === 'forrestw') {
toast.show();
}
}, []);

return (
Expand Down
2 changes: 1 addition & 1 deletion client/multiplayer/room.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<div class="toast-container position-fixed top-0 end-0 p-3">
<div id="funny-toast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header" style="background-color: yellow;">
<h1 class="me-auto text-danger">DO YOUR GRAD SCHOOL APPS</h1>
<h1 id="funny-toast-text" class="me-auto text-danger"></h1>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
Expand Down
7 changes: 0 additions & 7 deletions client/multiplayer/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -1088,10 +1088,3 @@ document.addEventListener('keypress', function (event) {
});

document.getElementById('username').value = username;

window.onload = async () => {
const toast = new bootstrap.Toast(document.getElementById('funny-toast'));
if (await getAccountUsername() === 'forrestw') {
toast.show();
}
};
2 changes: 1 addition & 1 deletion client/singleplayer/bonuses.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<div class="toast-container position-fixed top-0 end-0 p-3">
<div id="funny-toast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header" style="background-color: yellow;">
<h1 class="me-auto text-danger">DO YOUR GRAD SCHOOL APPS</h1>
<h1 id="funny-toast-text" class="me-auto text-danger"></h1>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
Expand Down
5 changes: 0 additions & 5 deletions client/singleplayer/bonuses.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,4 @@ window.onload = async () => {
document.getElementById('year-range-b').textContent = query.maxYear;

loadCategoryModal(query.categories, query.subcategories, query.alternateSubcategories);

const toast = new bootstrap.Toast(document.getElementById('funny-toast'));
if (await getAccountUsername() === 'forrestw') {
toast.show();
}
};
2 changes: 1 addition & 1 deletion client/singleplayer/tossups.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<div class="toast-container position-fixed top-0 end-0 p-3">
<div id="funny-toast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header" style="background-color: yellow;">
<h1 class="me-auto text-danger">DO YOUR GRAD SCHOOL APPS</h1>
<h1 id="funny-toast-text" class="me-auto text-danger"></h1>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
Expand Down
5 changes: 0 additions & 5 deletions client/singleplayer/tossups.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,4 @@ window.onload = async () => {
document.getElementById('year-range-b').textContent = query.maxYear;

loadCategoryModal(query.categories, query.subcategories, query.alternateSubcategories);

const toast = new bootstrap.Toast(document.getElementById('funny-toast'));
if (await getAccountUsername() === 'forrestw') {
toast.show();
}
};
15 changes: 15 additions & 0 deletions client/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,18 @@ function updateAlternateSubcategory(subcategory, validAlternateSubcategories) {
document.getElementById('report-question-submit').addEventListener('click', function () {
reportQuestion();
});


const banners = {
'forrestw': 'DO YOUR GRAD SCHOOL APPS',
};

getAccountUsername().then(username => {
const toast = new bootstrap.Toast(document.getElementById('funny-toast'));
const toastText = document.getElementById('funny-toast-text');

if (username in banners) {
toastText.textContent = banners[username];
toast.show();
}
});

0 comments on commit 3980aaf

Please sign in to comment.