Add emojis to submission verdicts.
Fra
// ==UserScript==
// @name Emojiforces
// @namespace http://tampermonkey.net/
// @version 0.4.1
// @description Add emojis to submission verdicts.
// @author ExplodingKonjac
// @license GPLv3
// @match https://codeforces.com/*
// @match https://codeforc.es/*
// ==/UserScript==
(function() {
var newRotatingEmoji=function(text) {
var x=document.createElement('span');
x.className='rotating-emoji'
x.innerHTML=text
x.style.fontSize="200%"
return x
}
document.querySelectorAll('span[class="verdict-accepted"]').forEach(function(e) {
e.innerHTML+=' 😘'
})
document.querySelectorAll('span[class="verdict-rejected"]').forEach(function(ee) {
var e=ee.querySelector('span[class="verdict-format-judged"]')
var n=new Number(e.innerHTML)
var emj=new String("")
if(n==1) emj+='🤡'
if(n==2) emj+='🤔'
while(n>30) {
emj+='😅'; n-=30
}
if(emj!='') e.innerHTML+=' '+emj
})
document.querySelectorAll('span[submissionverdict="COMPILATION_ERROR"]').forEach(function(e) {
var x=newRotatingEmoji('🤣')
x.style.marginLeft='8pt'
e.appendChild(x)
})
document.querySelectorAll('span[submissionverdict="CHALLENGED"]').forEach(function(e) {
var x=newRotatingEmoji('🤬')
x.style.marginLeft='8pt'
e.appendChild(x)
})
document.querySelectorAll('span[class="cell-failed-system-test"]').forEach(function(e) {
e.innerHTML='<img src="https://s2.loli.net/2023/02/22/6s85lbvafzWphEr.gif" height="40" width="40"></img>'
})
document.querySelectorAll('span[class="verdict-challenged"]').forEach(function(e) {
e.innerHTML+=' 👏👏👏'
})
document.querySelectorAll('span[class="verdict-unsuccessful-challenge"]').forEach(function(e) {
if(e.innerHTML=='Unsuccessful hacking attempt') {
e.innerHTML+=' 👈🤣'
}
else if(e.innerHTML=='Invalid input') {
e.innerHTML+=' 😨'
}
else if(e.innerHTML=='Generator crashed') {
e.innerHTML+=' 🤯'
}
else if(e.innerHTML=='Generator compilation error') {
e.innerHTML='<img src="https://s2.loli.net/2023/02/22/6s85lbvafzWphEr.gif" height="40" width="40"></img>'
var x1=newRotatingEmoji('😅')
x1.style.marginRight='8pt'
e.parentNode.insertBefore(x1,e)
var x2=newRotatingEmoji('😅')
x2.style.marginLeft='8pt'
e.parentNode.appendChild(x2)
e.parentNode.title='Generator compilation error'
}
})
document.querySelectorAll('span[title="Difficulty"]').forEach(function(e) {
var x=/[0-9]+/.exec(e.innerHTML)[0]
var emj=''
if(x<1000) emj='😴' // [800,1000)
else if(x<1500) emj='🙂' // [1000,1500)
else if(x<2000) emj='😐' // [1500,2000)
else if(x<2400) emj='😨' // [2000,2400)
else if(x<2800) emj='😰' // [2400,2800)
else if(x<3100) emj='😡' // [2800,3100)
else if(x<3400) emj='🥵' // [3100,3400)
else emj='💀' // [3400,+∞)
e.innerHTML+=' '+emj
})
var sty=document.createElement("style")
sty.type="text/css"
sty.innerHTML='@keyframes rotation {\n'+
' 50% {\n'+
' transform: rotate(180deg) scale(2);\n'+
' }\n'+
' 100% {\n'+
' transform: rotate(360deg) scale(1);\n'+
' }\n'+
'}\n'+
'.rotating-emoji {\n'+
' display: inline-block;\n'+
' animation: rotation 2s infinite linear;\n'+
'}\n'+
'.ProblemRating {\n'+
' white-space: nowrap\n'+
'}'
document.getElementsByTagName('head')[0].appendChild(sty)
})();