Skip to content

Instantly share code, notes, and snippets.

@nmanumr
Last active June 1, 2023 18:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmanumr/9037d9b3304f74d5515ff0af691ed850 to your computer and use it in GitHub Desktop.
Save nmanumr/9037d9b3304f74d5515ff0af691ed850 to your computer and use it in GitHub Desktop.
This script can automatically mark feedback for CUOnline Students Portal
let stars = () => 1 + Math.round(Math.random() * 4);
// uncomment this if you want fixed stars
// stars = () => 3;
// 'SUBJECT_CODE': [COURSE_STARS, FACULTY_STARS]
// for example `'CSE356': [1, 1]`
const specialSubjects = {
}
if (window.location.pathname == '/Feedback') {
(function() {
$(".quiz_listing tr").each((i, el) => {
if(
$(el).attr("onclick")
&& $(el).attr("onclick").toString().match(/window/)
&& !$(el).text().match(/UnAvailable/i)
){
$(el).click();
return;
}
});
})();
}
else if (window.location.pathname.match(/Survey/)) {
$(`.rating`).each((i, e) => {
for (let ss in specialSubjects) {
let title = $(".content_area>div:first-of-type").text();
let isFaculty = title.match("Faculty");
if (title.toLowerCase().match(ss.toLowerCase())) {
let s
if (Array.isArray(specialSubjects[ss]) && specialSubjects[ss].length > 1) {
s = specialSubjects[ss][isFaculty ? 1 : 0];
} else if (typeof specialSubjects[ss] === 'number') {
s = specialSubjects[ss];
} else {
s = stars();
}
$(e).find(`[value=${6 - s}]`).click();
return;
}
}
$(e).find(`[value=${6 - stars()}]`).click();
})
$("#txtcomments").val('WowCoolPostThanksForSharing<3');
$('#SubmitBtn').click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment