fix: Add toasts for new features · feildmaster/UnderScript@6f79e52 · GitHub
Skip to content

Commit 6f79e52

Browse files
committed
fix: Add toasts for new features
1 parent b795e6d commit 6f79e52

7 files changed

Lines changed: 20 additions & 8 deletions

File tree

src/base/chatContext.js

Lines changed: 3 additions & 2 deletions

src/base/enterOnCustom.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
onPage('GamesList', function fixEnter() {
22
let toast = fn.infoToast({
33
text: 'You can now press enter on the Create Game window.',
4-
onClose: () => {
4+
onClose: (reason) => {
55
toast = null;
6+
return reason !== 'processed';
67
}
78
}, 'underscript.notice.customGame', '1');
89

@@ -15,7 +16,7 @@ onPage('GamesList', function fixEnter() {
1516
input.on('keydown.script', (e) => {
1617
if (e.which === 13) {
1718
if (toast) {
18-
toast.close();
19+
toast.close('processed');
1920
}
2021
e.preventDefault();
2122
$('.bootstrap-dialog-footer-buttons button:first').trigger('click');

src/base/indexRefresh.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ onPage('', function refreshGameList() {
3030
document.addEventListener('visibilitychange', refresh);
3131
// Queue initial refresh
3232
setup();
33+
fn.infoToast('The game list now refreshes automatically, every 10 seconds.', 'underscript.notice.refreshIndex', '1');
3334
});

src/base/mentionOpponent.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
onPage('Game', () => {
22
const regex = /(^| )@o\b/g;
3+
let toast = fn.infoToast('You can mention opponents with @o', 'underscript.notice.mention', '1');
4+
35
function convert() {
6+
if (toast) {
7+
toast.close('processed');
8+
toast = null;
9+
}
410
$(this).val($(this).val()
5-
.replace(regex, `$1${$('#enemyUsername').text()}`));
11+
.replace(regex, `$1${$('#enemyUsername').text()}`));
612
}
713
function onEnter(e) {
814
if (e.which === 13) {

src/base/tag.friend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ eventManager.on('ChatDetected', function friendWrapper() {
2525
eventManager.on('Chat:getMessage', function tagFriends(data) {
2626
processMessage(JSON.parse(data.chatMessage), data.room);
2727
});
28+
29+
fn.infoToast('<span class="friend">Friends</span> are now highlighted in chat.', 'underscript.notice.highlighting', '1');
2830
});

src/meta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// @name UnderCards script
33
// @description Various changes to undercards game
44
// @require https://unpkg.com/axios@0.18.0/dist/axios.min.js
5-
// @require https://raw.githubusercontent.com/feildmaster/SimpleToast/1.12.0/simpletoast.js
5+
// @require https://raw.githubusercontent.com/feildmaster/SimpleToast/2.0.0/simpletoast.js
66
// @require https://unpkg.com/luxon@1.8.2/build/global/luxon.min.js
77
// @require https://www.googletagmanager.com/gtag/js?id=UA-38424623-4
88
// @version 0.20.0

src/utils/menu.js

Lines changed: 3 additions & 2 deletions

0 commit comments

Comments
 (0)