Easy Edunext

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

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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()}}()}();