GithubHelp home page GithubHelp logo

hust-surveys-skipper's Introduction

Hust-Surveys-Skipper

At the end of every semester, my school force students to do surveys for each class they attended to. This script skips it.

Browser Console Guide

Open your browser Dev Tools (most likely F12). Move to Console tab then copy the following code to your browser console and press enter. Repeat.

let interval = setInterval(() => {
    // Check if the URL contains the word "survey"
    if (!window.location.href.includes('Survey')) {
        // Stop the script if the URL does not contain the word "survey"
        clearInterval(interval);
        return;
    }

    // Get all the radio buttons
    let radioButtons = document.querySelectorAll('input[type="text"][name*="RBL_"]');

    // Group the radio buttons by question
    let questions = {};
    radioButtons.forEach(radioButton => {
        let questionId = radioButton.name.split('$').slice(-2, -1)[0];
        if (!questions[questionId]) {
            questions[questionId] = [];
        }
        questions[questionId].push(radioButton);
    });

    // Select the first radio button for each question
    Object.values(questions).forEach(question => {
        question[0].click();
    });

    // Click the submit button
    document.querySelector('#ctl00_ctl00_contentPane_MainPanel_MainContent_formLayout_submitButton').click();
}, 1000);

Tampermonkey Guide

If you don't want to repeat pasting the code and entering, install Tempermonkey extension and add the following script. You can disable the script or the extension after finishing the surveys.

//Tampermonkey script
// ==UserScript==
// @name         Form Filler
// @namespace    http://tampermonkey.net/
// @version      1
// @description  Automatically fill out forms
// @match        https://ctt-sis.hust.edu.vn/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let interval = setInterval(() => {
        // Check if the URL contains the word "survey"
        if (!window.location.href.includes('Survey')) {
            // Stop the script if the URL does not contain the word "survey"
            clearInterval(interval);
            return;
        }

        // Get all the radio buttons
        let radioButtons = document.querySelectorAll('input[type="text"][name*="RBL_"]');

        // Group the radio buttons by question
        let questions = {};
        radioButtons.forEach(radioButton => {
            let questionId = radioButton.name.split('$').slice(-2, -1)[0];
            if (!questions[questionId]) {
                questions[questionId] = [];
            }
            questions[questionId].push(radioButton);
        });

        // Select the first radio button for each question
        Object.values(questions).forEach(question => {
            question[0].click();
        });

        // Click the submit button
        document.querySelector('#ctl00_ctl00_contentPane_MainPanel_MainContent_formLayout_submitButton').click();
    }, 1000);
})();

hust-surveys-skipper's People

Contributors

ngozz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.