Last active
September 6, 2022 15:01
-
-
Save brysgo/1d7bb86ffb93e59e30ea74a71b7fb877 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function()%7Bconst%20scrollToBottom%20%3D%20(className)%20%3D%3E%20%7B%0A%20%20%20%20const%20element%20%3D%20document.getElementsByClassName(className)%5B0%5D%3B%0A%20%20%20%20element.scrollTop%20%3D%20element.scrollHeight%3B%0A%7D%0Alet%20shuffle%20%3D%20(array)%20%3D%3E%20%7B%0A%20%20let%20currentIndex%20%3D%20array.length%2C%20%20randomIndex%3B%0A%0A%20%20%2F%2F%20While%20there%20remain%20elements%20to%20shuffle.%0A%20%20while%20(currentIndex%20!%3D%200)%20%7B%0A%0A%20%20%20%20%2F%2F%20Pick%20a%20remaining%20element.%0A%20%20%20%20randomIndex%20%3D%20Math.floor(Math.random()%20*%20currentIndex)%3B%0A%20%20%20%20currentIndex--%3B%0A%0A%20%20%20%20%2F%2F%20And%20swap%20it%20with%20the%20current%20element.%0A%20%20%20%20%5Barray%5BcurrentIndex%5D%2C%20array%5BrandomIndex%5D%5D%20%3D%20%5B%0A%20%20%20%20%20%20array%5BrandomIndex%5D%2C%20array%5BcurrentIndex%5D%5D%3B%0A%20%20%7D%0A%0A%20%20return%20array%3B%0A%7D%0Alet%20shuffledNames%20%3D%20shuffle(Array.from(document.getElementsByClassName(%22c-member__secondary-name%22)).map((e)%20%3D%3E%20e.textContent))%3B%0Adocument.getElementsByClassName(%22c-sk-modal__close_button%22)%5B0%5D.click()%3B%0Alet%20i%20%3D%200%3B%0Alet%20result%20%3D%20''%3B%0Awhile%20(i%2B1%20%3C%20shuffledNames.length)%20%7B%0Aresult%20%3D%20result%20%2B%20'%5Cn%40'%2BshuffledNames%5Bi%5D%20%2B%20'%20%40'%2BshuffledNames%5Bi%2B1%5D%3B%0Ai%20%3D%20i%20%2B%202%3B%0A%7D%0Adocument.getElementsByClassName(%22ql-editor%22)%5B0%5D.innerText%20%3D%20result%3B%7D)()%3B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scrollToBottom = (className) => { | |
const element = document.getElementsByClassName(className)[0]; | |
element.scrollTop = element.scrollHeight; | |
} | |
let shuffle = (array) => { | |
let currentIndex = array.length, randomIndex; | |
// While there remain elements to shuffle. | |
while (currentIndex != 0) { | |
// Pick a remaining element. | |
randomIndex = Math.floor(Math.random() * currentIndex); | |
currentIndex--; | |
// And swap it with the current element. | |
[array[currentIndex], array[randomIndex]] = [ | |
array[randomIndex], array[currentIndex]]; | |
} | |
return array; | |
} | |
let shuffledNames = shuffle(Array.from(document.getElementsByClassName("c-member__secondary-name")).map((e) => e.textContent)); | |
document.getElementsByClassName("c-sk-modal__close_button")[0].click(); | |
let i = 0; | |
let result = ''; | |
while (i < shuffledNames.length) { | |
if (i % 2 == 0) { | |
result = result + '\n'; | |
} | |
result = result + ' @'+shuffledNames[i]; | |
i++; | |
} | |
document.getElementsByClassName("ql-editor")[0].innerText = result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment