Skip to content

Instantly share code, notes, and snippets.

@Sarverott
Last active December 1, 2022 00:46
Show Gist options
  • Save Sarverott/e286064a0ad026f3c3980944d13ab9e7 to your computer and use it in GitHub Desktop.
Save Sarverott/e286064a0ad026f3c3980944d13ab9e7 to your computer and use it in GitHub Desktop.
/*
usefull in new study groups if your uniwersity email is based on "[email protected]" pattern, go to:
https://classroom.google.com/r/{ id of your classroom }/sort-last-name
inspect in devtools in browser one name of student, should be <span class="y4ihN YVvGBb">....
paste code it into console
*/
const CSS_SELECTOR_TARGET=prompt("insert css selector of all name fields", "span.y4ihN.YVvGBb");
const COLEDGE_MAIL_POSTFIX=prompt("insert students emails postfix", "@edu.your-colledge.pl");
console.log(
Array.from(
document.querySelectorAll(CSS_SELECTOR_TARGET)
).map(
function(student){
return student.innerHTML.toLowerCase().split(" ").join(".")+COLEDGE_MAIL_POSTFIX
}
)
.join("\n")
.replaceAll("ą", "a")
.replaceAll("ę", "e")
.replaceAll("ł", "l")
.replaceAll("ż", "z")
.replaceAll("ź", "z")
.replaceAll("ś", "s")
.replaceAll("ć", "c")
.replaceAll("ń", "n")
.replaceAll("ó", "o")
);
/*
list of mails with polish regional special characters replacement should be printed
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment