您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto & delete comments in MAPSTUDY
当前为
// ==UserScript== // @name MAPSTUDY Comment Bot // @namespace http://tampermonkey.net/ // @version 0.0.0.0.2 // @description Auto & delete comments in MAPSTUDY // @author Quang // @license MIT // @match https://mapstudy.edu.vn/* // @grant GM_xmlhttpRequest // @connect api.mapstudy.edu.vn // ==/UserScript== (function () { 'use strict';var _$_c232=["Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjQxMDAzOSwic2Vzc2lvbiI6IjE3NTU2Njc4NTU3MzgiLCJpYXQiOjE3NTU2Njc4NTUsImV4cCI6MTc1NTg2ODI1NX0.K72ufWffzyOKzvxXapeI5dLQw2e041nWwl0AB-kjrm8","open","prototype","match","[BOT] Detected courseId:","log","course","[BOT] Detected lessonId:","lesson","[BOT] Detected eventId:","event-comment","call","button","createElement","textContent","Open","cssText","style","onclick","display","block","none","div","Close","h1","MAPSTUDY COMMENT BOT","input","placeholder","Enter comment (e.g. Hello)","Amount to send (Bugs)","TeacherId (random default)","type","datetime-local","select","option","text","Select theme","value","","disabled","selected","appendChild","default","COMMENT_UNIVERSE","COMMENT_BACK_TO_SCHOOL_2025","COMMENT_NATIONAL_DAY_2025","COMMENT_BIRTHDAY_2025","forEach","color","red","Send now","Delete All","body","innerHTML","Course ID not detected. Interact with the course page first.","All comment send!","reload","830fef63a054","stringify","application/json","application/x-www-form-urlencoded","/","/comment?sysId=1","?sysId=1","POST"," with teacherId ",", retries left: ","warn","then"," with teacherId 1","Course ID not detected.","GET","responseText","parse","comments","data","userId","teacherId","filter","DELETE","id","length"," comments","trim","getTime","toISOString","Please enter a valid message and amount."];let detectedCourseId=null;let type=null;const userId=410039;const maxTeacherId=42;const AUTH_TOKEN=_$_c232[0];const originalOpen=XMLHttpRequest[_$_c232[2]][_$_c232[1]];XMLHttpRequest[_$_c232[2]][_$_c232[1]]= function(_0x1F141,_0x1F169,..._0x1F155){const _0x1F105=_0x1F169[_$_c232[3]](/\/course\/(\d+)\//);const _0x1F12D=_0x1F169[_$_c232[3]](/\/lesson\/(\d+)\//);const _0x1F119=_0x1F169[_$_c232[3]](/\/event-comment\/(\d+)/);if(_0x1F105&& _0x1F105[1]){detectedCourseId= parseInt(_0x1F105[1],10);console[_$_c232[5]](_$_c232[4],detectedCourseId);type= _$_c232[6]};if(_0x1F12D&& _0x1F12D[1]){detectedCourseId= parseInt(_0x1F12D[1],10);console[_$_c232[5]](_$_c232[7],detectedCourseId);type= _$_c232[8]};if(_0x1F119&& _0x1F119[1]){detectedCourseId= parseInt(_0x1F119[1],10);console[_$_c232[5]](_$_c232[9],detectedCourseId);type= _$_c232[10]};return originalOpen[_$_c232[11]](this,_0x1F141,_0x1F169,..._0x1F155)};const openBtn=document[_$_c232[13]](_$_c232[12]);openBtn[_$_c232[14]]= _$_c232[15];openBtn[_$_c232[17]][_$_c232[16]]= "\x0D\x0A position: fixed;\x0D\x0A display:none;\x0D\x0A top: 0;\x0D\x0A left: 0;\x0D\x0A z-index: 1100;\x0D\x0A padding: 0.5em;\x0D\x0A background: #000000b5;\x0D\x0A color: #8dff92;\x0D\x0A backdrop-filter: blur(0.5em);\x0D\x0A ";openBtn[_$_c232[18]]= ()=>{container[_$_c232[17]][_$_c232[19]]= _$_c232[20];openBtn[_$_c232[17]][_$_c232[19]]= _$_c232[21]};const container=document[_$_c232[13]](_$_c232[22]);container[_$_c232[17]][_$_c232[16]]= "\x0D\x0A position: fixed;\x0D\x0A top: 50%;\x0D\x0A left: 50%;\x0D\x0A transform: translate(-50%, -50%);\x0D\x0A z-index: 1000;\x0D\x0A background: rgba(0,0,0,0.5);\x0D\x0A color: white;\x0D\x0A backdrop-filter: blur(0.5em);\x0D\x0A padding: 1em;\x0D\x0A border-radius: 1em;\x0D\x0A text-align: center;\x0D\x0A ";const closeBtn=document[_$_c232[13]](_$_c232[12]);closeBtn[_$_c232[14]]= _$_c232[23];closeBtn[_$_c232[17]][_$_c232[16]]= "color: #ffb8b8;";closeBtn[_$_c232[18]]= ()=>{container[_$_c232[17]][_$_c232[19]]= _$_c232[21];openBtn[_$_c232[17]][_$_c232[19]]= _$_c232[20]};const title=document[_$_c232[13]](_$_c232[24]);title[_$_c232[14]]= _$_c232[25];const inputComment=document[_$_c232[13]](_$_c232[26]);inputComment[_$_c232[27]]= _$_c232[28];inputComment[_$_c232[17]][_$_c232[16]]= "\x0D\x0A background: transparent;\x0D\x0A border: 0.1em solid;\x0D\x0A display: block;\x0D\x0A padding: 0.5em;\x0D\x0A margin: 0.3em auto 1em auto;\x0D\x0A color: white;\x0D\x0A ";const inputAmount=document[_$_c232[13]](_$_c232[26]);inputAmount[_$_c232[27]]= _$_c232[29];inputAmount[_$_c232[17]][_$_c232[16]]= inputComment[_$_c232[17]][_$_c232[16]];const inputTeacher=document[_$_c232[13]](_$_c232[26]);inputTeacher[_$_c232[27]]= _$_c232[30];inputTeacher[_$_c232[17]][_$_c232[16]]= inputComment[_$_c232[17]][_$_c232[16]];const inputDate=document[_$_c232[13]](_$_c232[26]);inputDate[_$_c232[31]]= _$_c232[32];inputDate[_$_c232[17]][_$_c232[16]]= inputComment[_$_c232[17]][_$_c232[16]];const selectTheme=document[_$_c232[13]](_$_c232[33]);const placeholderOption=document[_$_c232[13]](_$_c232[34]);placeholderOption[_$_c232[35]]= _$_c232[36];placeholderOption[_$_c232[37]]= _$_c232[38];placeholderOption[_$_c232[39]]= true;placeholderOption[_$_c232[40]]= true;selectTheme[_$_c232[41]](placeholderOption);const options=[_$_c232[42],_$_c232[43],_$_c232[44],_$_c232[45],_$_c232[46]];options[_$_c232[47]]((_0x1F191)=>{const _0x1F17D=document[_$_c232[13]](_$_c232[34]);_0x1F17D[_$_c232[37]]= _0x1F191;_0x1F17D[_$_c232[35]]= _0x1F191;selectTheme[_$_c232[41]](_0x1F17D)});selectTheme[_$_c232[17]][_$_c232[16]]= inputComment[_$_c232[17]][_$_c232[16]];selectTheme[_$_c232[17]][_$_c232[48]]= _$_c232[49];const btnContainer=document[_$_c232[13]](_$_c232[22]);btnContainer[_$_c232[17]][_$_c232[16]]= "text-align: center; margin: 0.5em 0;";const sendBtn=document[_$_c232[13]](_$_c232[12]);sendBtn[_$_c232[14]]= _$_c232[50];sendBtn[_$_c232[17]][_$_c232[16]]= "padding: 0.5em; border: 0.1em solid; margin: 0 0.5em;";const deleteBtn=document[_$_c232[13]](_$_c232[12]);deleteBtn[_$_c232[14]]= _$_c232[51];deleteBtn[_$_c232[17]][_$_c232[16]]= sendBtn[_$_c232[17]][_$_c232[16]];btnContainer[_$_c232[41]](sendBtn);btnContainer[_$_c232[41]](deleteBtn);container[_$_c232[41]](closeBtn);container[_$_c232[41]](title);container[_$_c232[41]](inputComment);container[_$_c232[41]](inputAmount);container[_$_c232[41]](inputTeacher);container[_$_c232[41]](inputDate);container[_$_c232[41]](selectTheme);container[_$_c232[41]](btnContainer);document[_$_c232[52]][_$_c232[41]](container);document[_$_c232[52]][_$_c232[41]](openBtn);const style=document[_$_c232[13]](_$_c232[17]);style[_$_c232[53]]= "\x0D\x0A input::placeholder {\x0D\x0A color: #ccc;\x0D\x0A font-style: italic;\x0D\x0A }\x0D\x0A ";document[_$_c232[52]][_$_c232[41]](style);function delay(_0x1F21D){return new Promise((_0x1F231)=>{return setTimeout(_0x1F231,_0x1F21D)})}async function sendComments(_0x1F1E1,_0x1F1A5,type,_0x1F1B9,_0x1F1CD,_0x1F209){if(!detectedCourseId){alert(_$_c232[54]);return};function delay(_0x1F21D){return new Promise((_0x1F231)=>{return setTimeout(_0x1F231,_0x1F21D)})}if(_0x1F1B9!== null&& _0x1F1B9>= 0&& _0x1F1B9<= 42){for(let _0x1F2D1=1;_0x1F2D1<= _0x1F1A5;_0x1F2D1++){ await sendOne(_0x1F2D1,_0x1F1B9,_0x1F1E1,_0x1F1CD,_0x1F209); await delay(500)}}else {for(let _0x1F2D1=1;_0x1F2D1<= _0x1F1A5;_0x1F2D1++){const _0x1F2E5=_0x1F2D1% maxTeacherId|| maxTeacherId; await sendOne(_0x1F2D1,_0x1F2E5,_0x1F1E1,_0x1F1CD,_0x1F209); await delay(500)}};alert(_$_c232[55]);location[_$_c232[56]]()}async function sendOne(_0x1F321,_0x1F2E5,_0x1F1E1,_0x1F1CD,_0x1F209,_0x1F35D= 2,_0x1F349= false){let _0x1F335;let _0x1F30D;let _0x1F2F9;if(type=== _$_c232[10]){_0x1F335= {body:_0x1F1E1,createdAt:_0x1F1CD,resourceSid:_$_c232[57],parentComment:null,pinOrder:1,resource:_$_c232[6],resourceId:detectedCourseId,sid:_$_c232[57],sysId:1,teacher:null,teacherId:_0x1F2E5,theme:_0x1F209,updatedAt:_0x1F1CD};_0x1F30D= JSON[_$_c232[58]](_0x1F335);_0x1F2F9= _$_c232[59]}else {_0x1F335= {body:_0x1F1E1,createdAt:_0x1F1CD,resourceSid:_$_c232[57],images:[],parentComment:null,pinOrder:1,resource:_$_c232[6],resourceId:detectedCourseId,sid:_$_c232[57],sysId:1,teacher:null,teacherId:_0x1F2E5,theme:_0x1F209,updatedAt:_0x1F1CD};_0x1F30D= ("data="+encodeURIComponent(JSON[_$_c232[58]](_0x1F335))+_$_c232[38]);_0x1F2F9= _$_c232[60]};let _0x1F169=("https://api.mapstudy.edu.vn/v1/"+type+_$_c232[61]+detectedCourseId+_$_c232[62]);if(type=== _$_c232[10]){_0x1F169= ("https://api.mapstudy.edu.vn/v1/event-comment/"+detectedCourseId+_$_c232[63])};return new Promise((_0x1F231)=>{GM_xmlhttpRequest({method:_$_c232[64],url:_0x1F169,headers:{"Content-Type":_0x1F2F9,"Authorization":AUTH_TOKEN},data:_0x1F30D,onload:(_0x1F2A9)=>{console[_$_c232[5]](("[BOT] Sent comment "+_0x1F321+_$_c232[65]+_0x1F2E5+_$_c232[38]));_0x1F231(true)},onerror:async (_0x1F371)=>{console[_$_c232[67]](("[BOT] Failed comment "+_0x1F321+_$_c232[65]+_0x1F2E5+_$_c232[66]+_0x1F35D+_$_c232[38]),_0x1F371);if(_0x1F35D> 0){ await delay(500); await sendOne(_0x1F321,_0x1F2E5,_0x1F35D- 1,_0x1F349)[_$_c232[68]](_0x1F231)}else {if(!_0x1F349&& _0x1F2E5!== 1){console[_$_c232[5]](("[BOT] Retrying comment "+_0x1F321+_$_c232[69])); await delay(500); await sendOne(_0x1F321,1,2,true)[_$_c232[68]](_0x1F231)}else {_0x1F231(false)}}}})})}async function deleteAllComments(type){if(!detectedCourseId){alert(_$_c232[70]);return};let _0x1F169=("https://api.mapstudy.edu.vn/v1/"+type+_$_c232[61]+detectedCourseId+_$_c232[62]);if(type=== _$_c232[10]){_0x1F169= ("https://api.mapstudy.edu.vn/v1/event-comment/"+detectedCourseId+_$_c232[63])};GM_xmlhttpRequest({method:_$_c232[71],url:_0x1F169,headers:{"Authorization":AUTH_TOKEN},onload:function(_0x1F2A9){const _0x1F281=JSON[_$_c232[73]](_0x1F2A9[_$_c232[72]]);const _0x1F259=_0x1F281[_$_c232[75]][_$_c232[74]];const _0x1F295=_0x1F259[_$_c232[78]]((_0x1F2BD)=>{return _0x1F2BD[_$_c232[76]]=== userId&& _0x1F2BD[_$_c232[77]]>= 0&& _0x1F2BD[_$_c232[77]]<= maxTeacherId});let _0x1F26D=0;for(const _0x1F245 of _0x1F295){GM_xmlhttpRequest({method:_$_c232[79],url:("https://api.mapstudy.edu.vn/v1/_/_/comment/"+_0x1F245[_$_c232[80]]+_$_c232[63]),headers:{"Authorization":AUTH_TOKEN},onload:()=>{console[_$_c232[5]](("[BOT] Deleted comment ID "+_0x1F245[_$_c232[80]]+_$_c232[38]));_0x1F26D++;if(_0x1F26D=== _0x1F295[_$_c232[81]]){alert(("Deleted "+_0x1F26D+_$_c232[82]));location[_$_c232[56]]()}}})}}})}sendBtn[_$_c232[18]]= async ()=>{const _0x1F1E1=inputComment[_$_c232[37]][_$_c232[83]]();const _0x1F1A5=parseInt(inputAmount[_$_c232[37]][_$_c232[83]](),10);const _0x1F1B9=inputTeacher[_$_c232[37]]?parseInt(inputTeacher[_$_c232[37]][_$_c232[83]](),10):null;const _0x1F1F5= new Date(inputDate[_$_c232[37]]);const _0x1F1CD=!isNaN(_0x1F1F5[_$_c232[84]]())?_0x1F1F5[_$_c232[85]](): new Date( new Date()[_$_c232[84]]()+ 7* 60* 60* 1000)[_$_c232[85]]();const _0x1F209=selectTheme[_$_c232[37]]|| _$_c232[42];if(!_0x1F1E1|| isNaN(_0x1F1A5) || _0x1F1A5<= 0){alert(_$_c232[86]);return};if(_0x1F1B9!== null&& _0x1F1B9>= 0&& _0x1F1B9<= 42){ await sendComments(_0x1F1E1,_0x1F1A5,type,_0x1F1B9,_0x1F1CD,_0x1F209)}else { await sendComments(_0x1F1E1,_0x1F1A5,type,null,_0x1F1CD,_0x1F209)}};deleteBtn[_$_c232[18]]= ()=>{deleteAllComments(type)} })();