Skip to content

Commit 0993840

Browse files
committed
Add more PR trophies
* Repeating digits trophy: Awarded if the ID is greater than 100 and consists of only one repeated digit (e.g. 1111, 2222). * 42: The answer to life, the universe, and everything. * 404: Not found. * 418: I'm a teapot. * 666: The number of the beast. * 777: Lucky sevens. * 31337 elite leetspeak. (1337 is already available)
1 parent 76412dc commit 0993840

1 file changed

Lines changed: 48 additions & 8 deletions

File tree

src/azdo-pr-dashboard.user.js

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,27 +1315,67 @@
13151315

13161316
const trophiesAwarded = [];
13171317

1318+
/* eslint-disable brace-style */
1319+
13181320
// Milestone trophy: Awarded if pull request ID is greater than 1000 and is a non-zero digit followed by only zeroes (e.g. 1000, 5000, 10000).
13191321
if (prId >= 1000 && prId.toString().match('^[1-9]0+$')) {
13201322
const milestoneTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🏆 ${prAuthor} got pull request #${prId}`);
13211323
trophiesAwarded.push(milestoneTrophyMessage);
13221324
}
1323-
1324-
// Fish trophy: Give a man a fish, he'll waste hours trying to figure out why. (Awarded if the ID is a palindrome.)
1325-
// Requires an id with at least three numbers.
1326-
if (prId > 100 && prId.toString() === prId.toString().split('').reverse().join('')) {
1325+
// Repeating digits trophy: Awarded if the ID is greater than 100 and consists of only one repeated digit (e.g. 1111, 2222).
1326+
else if (prId > 100 && /^(\d)\1+$/.test(prId.toString())) {
1327+
const repeatingDigitMessage = $('<div>').addClass('bolt-table-cell-content').text(`🔢 ${prAuthor} got a fancy pull request #${prId}`);
1328+
trophiesAwarded.push(repeatingDigitMessage);
1329+
}
1330+
// Fish trophy: Give a man a fish, he'll waste hours trying to figure out why.
1331+
// Awarded if the ID is greater than 100 and is a palindrome (e.g. 12321).
1332+
else if (prId > 100 && prId.toString() === prId.toString().split('').reverse().join('')) {
13271333
const fishTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🐠 ${prAuthor} got a fish trophy`);
13281334
trophiesAwarded.push(fishTrophyMessage);
13291335
}
13301336

1337+
// First PR.
1338+
if (prId === 1) {
1339+
const firstPrTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🥇 ${prAuthor} is first`);
1340+
trophiesAwarded.push(firstPrTrophyMessage);
1341+
}
1342+
// 42: The answer to life, the universe, and everything.
1343+
else if (prId === 42) {
1344+
const meaningOfLifeMessage = $('<div>').addClass('bolt-table-cell-content').text(`🌌 ${prAuthor} found the answer to life, the universe, and everything`);
1345+
trophiesAwarded.push(meaningOfLifeMessage);
1346+
}
1347+
// 404: Not found.
1348+
else if (prId === 404) {
1349+
const notFoundMessage = $('<div>').addClass('bolt-table-cell-content').text(`🔍 ${prAuthor}'s pull request was not found (just kidding, here it is)`);
1350+
trophiesAwarded.push(notFoundMessage);
1351+
}
1352+
// 418: I'm a teapot.
1353+
else if (prId === 418) {
1354+
const teapotMessage = $('<div>').addClass('bolt-table-cell-content').text(`🫖 ${prAuthor} is a teapot`);
1355+
trophiesAwarded.push(teapotMessage);
1356+
}
1357+
// 666: The number of the beast.
1358+
else if (prId === 666) {
1359+
const beastMessage = $('<div>').addClass('bolt-table-cell-content').text(`😈 ${prAuthor} is a beast`);
1360+
trophiesAwarded.push(beastMessage);
1361+
}
1362+
// 777: Lucky sevens.
1363+
else if (prId === 777) {
1364+
const luckyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🎰 ${prAuthor} hit the jackpot`);
1365+
trophiesAwarded.push(luckyMessage);
1366+
}
13311367
// 1337 leetspeak.
1332-
if (prId === 1337) {
1368+
else if (prId === 1337) {
13331369
const leetMessage = $('<div>').addClass('bolt-table-cell-content').text(`👨‍💻 ${prAuthor} speaks leet`);
13341370
trophiesAwarded.push(leetMessage);
1335-
} else if (prId === 1) { // First PR.
1336-
const firstPrTrophyMessage = $('<div>').addClass('bolt-table-cell-content').text(`🥇 ${prAuthor} is first`);
1337-
trophiesAwarded.push(firstPrTrophyMessage);
13381371
}
1372+
// 31337 elite leetspeak.
1373+
else if (prId === 31337) {
1374+
const eliteLeetMessage = $('<div>').addClass('bolt-table-cell-content').text(`🧠 ${prAuthor} speaks elite!`);
1375+
trophiesAwarded.push(eliteLeetMessage);
1376+
}
1377+
1378+
/* eslint-enable brace-style */
13391379

13401380
if (trophiesAwarded.length > 0) {
13411381
const header = $('<div/>').addClass('bolt-header-title body-xl m').text('Trophies');

0 commit comments

Comments
 (0)