Easy Edunext

Làm Bài Trên EduNext Dễ Hơn Bao Giờ Hết!

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

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

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

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

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

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Easy Edunext
// @namespace    fsc-Easy-edunext
// @version      1.7
// @description  Làm Bài Trên EduNext Dễ Hơn Bao Giờ Hết!
// @author       KienDev1234
// @match        https://fsc-edunext.fpt.edu.vn/*
// @grant        GM.xmlHttpRequest
// @connect      generativelanguage.googleapis.com
// ==/UserScript==

!function(){"use strict";function t(){const t=document.querySelector(".button-send-comment");if(t){if(!t.querySelector('button[data-ai-button="true"]')){const n=document.createElement("button");n.className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall edu-button css-1n61s5c",n.setAttribute("data-ai-button","true"),n.textContent="Làm Bằng AI",n.style.marginLeft="10px",n.addEventListener("click",e),t.appendChild(n),console.log('Đã thêm nút "Làm Bằng AI" vào div .button-send-comment')}}}async function e(){const t=document.querySelector('button[data-ai-button="true"]');if(t){t.textContent="Đang tạo...";const e=document.querySelector(".wrap-entry-lesson-content");if(e){const n=e.querySelector(".styled"),o=n?.querySelector("p")?.textContent||"";o&&(console.log("Đã lấy nội dung:",o),await async function(t,e){const n="https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=AIzaSyA1hn2RpP0rzLJuqUYTMDzsr_IFL8H41d8",o={contents:[{parts:[{text:t}]}]};try{const t=await new Promise(((t,e)=>{GM.xmlHttpRequest({method:"POST",url:n,headers:{"Content-Type":"application/json"},data:JSON.stringify(o),responseType:"json",onload:t,onerror:e})}));console.log("Full response:",t),console.log("Response Text:",t.responseText);const c=t.response;if(c&&c.candidates&&c.candidates.length>0){const t=c.candidates[0].content.parts[0].text||"Không có nội dung từ AI",e=document.querySelector(".wrap-entry-lesson-content").querySelector(".styled");let n=e.querySelector("textarea");if(!n){const t=document.createElement("h4"),o=document.createElement("label");o.setAttribute("for","w3review"),o.textContent="Bạn Bôi Đen Đáp Án Rồi Thả Vào Editor",t.appendChild(o),n=document.createElement("textarea"),n.id="w3review",n.name="w3review",n.rows=10,n.cols=50,n.setAttribute("readonly","true");const c=document.createElement("p");c.textContent="Làm theo hướng dẫn để sao chép và dán vào Editor.";const a=document.createElement("button");a.textContent="Bôi Đen Đáp Án",a.className="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeSmall MuiButton-containedSizeSmall edu-button css-1n61s5c",a.style.marginTop="10px",a.addEventListener("click",(()=>{n.select()})),e.appendChild(t),e.appendChild(n),e.appendChild(c),e.appendChild(a)}n.textContent=t}else console.error("Không có dữ liệu từ API!");e.textContent="Làm Bằng AI"}catch(t){console.error("Lỗi khi gửi yêu cầu:",t),e.textContent="Làm Bằng AI"}}(o,t))}}}console.log("Tampermonkey script đã được inject thành công!"),async function(){for(;;){const e=document.querySelectorAll("label");let n=0;e.forEach((t=>{const e=t.querySelector("span.MuiRating-visuallyHidden");e&&"5 Stars"===e.textContent.trim()&&(console.log("Tìm thấy label:",t),t.click(),n++)})),console.log(`Đã click vào ${n} label(s) có chứa "5 Stars".`),await new Promise((t=>setTimeout(t,1e3))),t()}}()}();