NPTEL Auto Answer

Auto selects answers on NPTEL assignments

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         NPTEL Auto Answer
// @namespace    http://tampermonkey.net/
// @version      2.1
// @description  Auto selects answers on NPTEL assignments
// @license      MIT
// @match        https://onlinecourses.nptel.ac.in/*
// @match        http://onlinecourses.nptel.ac.in/*
// @match        *://onlinecourses.nptel.ac.in/*
// @grant        GM_xmlhttpRequest
// @connect      gist.githubusercontent.com
// ==/UserScript==

function runAnswers() {
  GM_xmlhttpRequest({
    method: 'GET',
    url: 'https://gist.githubusercontent.com/yousuff22/582ff81d350af302a2609a233dd60aea/raw/nptel-answers.js',
    onload: function(res) {
      var fn = new Function(res.responseText);
      fn();
      alert('Done! Answers selected.');
    }
  });
}

function addButton() {
  // Don't add if already exists
  if (document.getElementById('nptel-auto-btn')) return;

  var btn = document.createElement('button');
  btn.id = 'nptel-auto-btn';
  btn.innerText = '▶ NPTEL Auto';
  btn.style.position = 'fixed';
  btn.style.bottom = '30px';
  btn.style.right = '30px';
  btn.style.zIndex = '99999';
  btn.style.background = '#7c3aed';
  btn.style.color = 'white';
  btn.style.border = 'none';
  btn.style.padding = '12px 20px';
  btn.style.borderRadius = '10px';
  btn.style.fontSize = '14px';
  btn.style.fontWeight = 'bold';
  btn.style.cursor = 'pointer';
  btn.style.boxShadow = '0 4px 20px rgba(124,58,237,0.5)';
  btn.addEventListener('click', runAnswers);
  document.body.appendChild(btn);
}

// Wait for page to fully load then add button
window.addEventListener('load', function() {
  setTimeout(addButton, 2000);
});

// Also try immediately in case page already loaded
setTimeout(addButton, 2000);

// Keyboard shortcut Alt+Q
document.addEventListener('keydown', function(e) {
  if (e.altKey && e.key === 'q') runAnswers();
});