NPTEL Auto Answer

Auto selects answers on NPTEL assignments

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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();
});