NPTEL Auto Answer

Auto selects answers on NPTEL assignments

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();
});