심야 자동 식당

심챈 자동 복호화/국룰입력/다운(kiosk,mega)

目前为 2024-05-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 심야 자동 식당
  3. // @namespace http://tampermonkey.net/
  4. // @description 심챈 자동 복호화/국룰입력/다운(kiosk,mega)
  5. // @version 3.0
  6. // @author 김머시기
  7. // @match https://kiosk.ac/c/*
  8. // @match https://arca.live/b/*
  9. // @match https://mega.nz/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=kiosk.ac
  11. // @grant GM.setValue
  12. // @grant GM.getValue
  13. // @require https://openuserjs.org/src/libs/sizzle/GM_config.js
  14. // @grant GM.registerMenuCommand
  15. // @grant GM_registerMenuCommand
  16. // @grant GM_unregisterMenuCommand
  17. // @grant GM_getValue
  18. // @grant GM_setValue
  19. // @license MIT
  20. // @run-at document-end
  21. // ==/UserScript==
  22. 'use strict';
  23. const rpw = atob("c21wZW9wbGU=");
  24. let password = [rpw,"#"+rpw+"#",
  25. //============================== Settings ====================================
  26. // 추가하길 원하는 비밀번호 쉼표로 구분해서 바로 아래줄에 따옴표안에 넣으면 됨 ex) "1234","2024국룰","!국룰!"
  27.  
  28. ];
  29. let pageLoadtime = 1200; // 본인 컴퓨터, 인터넷 사양이 좋지 않아 페이지 로딩시간이 오래걸리면 해당 값 조절하세요(1000당 1초)
  30. let d = 1; // Kiosk 다운로드 옵션 0:Basic 1:Fast 2:일괄 다운로드
  31. //======================================================================================
  32. let rpt,pwi,pwb,btd,dtime,autoTab,autoDown,isDown,isTab;
  33. let DownId = null, TabId = null;
  34. let currentHost = document.URL.split("/")[2];
  35. const timer = ms => new Promise(res => setTimeout(res, ms))
  36. async function rnrfnf() {
  37. rpt = await GM.getValue("rpt");
  38. isDown = await GM.getValue("isDown",true);
  39. isTab = await GM.getValue("isTab",false);
  40. updateDown();
  41. updateTab();
  42. if(currentHost == "arca.live") {
  43. if(rpt != rpw) {
  44. const chk = prompt("국룰 확인");
  45. if(chk?.toLowerCase() == rpw) {
  46. await GM.setValue("rpt", rpw);
  47. } else {
  48. GM.setValue("rpt", false);
  49. alert("국룰이 일치하지 않습니다.");
  50. }
  51. }
  52. }
  53. }
  54. async function toggleDown() {
  55. isDown = !isDown;
  56. if(isDown === false && isTab === true) {
  57. isTab = false;
  58. await GM.setValue("isTab",isTab);
  59. }
  60. await GM.setValue("isDown",isDown);
  61. updateDown();
  62. updateTab();
  63. }
  64. async function toggleTab() {
  65. isTab = !isTab;
  66. if(isDown === false && isTab === true) {
  67. isDown = true;
  68. await GM.setValue("isDown",isDown);
  69. }
  70. await GM.setValue("isTab",isTab);
  71. updateDown();
  72. updateTab();
  73. }
  74. function updateDown() {
  75. if (DownId !== null) GM_unregisterMenuCommand(DownId);
  76. DownId = GM_registerMenuCommand(`자동 다운로드 ${isDown ? '켜짐' : '꺼짐'}`, toggleDown);
  77. if(isDown === true) autoDown = "on";
  78. if(isDown === false) autoDown = "off";
  79. }
  80. function updateTab() {
  81. if (TabId !== null) GM_unregisterMenuCommand(TabId);
  82. TabId = GM_registerMenuCommand(`자동 닫기 ${isTab ? '켜짐' : '꺼짐'}`, toggleTab);
  83. if(isTab === false) autoTab = "off";
  84. if(isTab === true) autoTab = "on";
  85. }
  86. function doDecode() {
  87. if(rpt==rpw) {
  88. const article = document.querySelector("body div.article-body > div.fr-view.article-content");
  89. function dec(reg) {
  90. try {
  91. while (reg.test(article.innerHTML)) {
  92. let decoded = reg.exec(article.innerHTML)[0];
  93. while (decoded.match(/aHR0c[0-9A-Za-z+/-]{8,}[=]{0,2}/) == null) {
  94. decoded = atob(decoded);
  95. } decoded = atob(decoded);
  96. article.innerHTML = article.innerHTML.replace(reg, `<a href=${decoded} target='_blank' rel='noreferrer'>${decoded}</a>`);
  97. }
  98. } catch(e) { console.log(e,article); }
  99. }
  100. dec(/aHR0c[0-9A-Za-z+/-]{20,}[=]{0,2}/);
  101. dec(/YUhSMGN[0-9A-Za-z+/-]{80,}[=]{0,2}/);
  102. dec(/[0-9A-Za-z+/-]{30,}[=]{1,2}/);
  103. dec(/[0-9A-Za-z+/-]{200,}[=]{0,2}/);
  104. }
  105. }
  106. async function pw() {
  107. if(rpt==rpw) {
  108. for (var i = 0; i < password.length; i++) {
  109. document.querySelector(pwi).value = password[i];
  110. document.querySelector(pwb).click();
  111. if(i < password.length-1) {
  112. if(password[i] != null && password[i] != "") await timer(700);
  113. } else {
  114. if(autoDown=="on") await setTimeout(dbtn,dtime);
  115. }
  116. }
  117. }
  118. }
  119. async function dbtn() {
  120. let downBtn = document.querySelector(btd);
  121. if(currentHost == "mega.nz") {
  122. let resumeBtn = document.querySelector('.mega-button.positive.resume.js-resume-download');
  123. await resumeBtn.click();
  124. }
  125. await downBtn.click();
  126. if(downBtn != null && autoTab == "on" && currentHost == "kiosk.ac") setTimeout(() => { window.open('','_self').close(); }, 1000);
  127. }
  128. rnrfnf();
  129. if(currentHost == "arca.live") setTimeout(doDecode, 100);
  130. if(currentHost == "mega.nz") {
  131. pwi = "#password-decrypt-input";
  132. pwb = ".mega-button.positive.fm-dialog-new-folder-button.decrypt-link-button";
  133. btd = ".mega-button.positive.js-default-download.js-standard-download";
  134. dtime = 4000;
  135. setTimeout(pw, pageLoadtime+1000);
  136. } if(currentHost == "kiosk.ac") {
  137. pwi = ".input.shadow-xl.flex-grow";
  138. pwb = ".btn.btn-ghost.w-full.mt-2.rounded-md";
  139. if(d==2) btd = ".flex.justify-between.w-full .flex.gap-2 .btn.btn-ghost";
  140. else btd = ".p-2 li:nth-child("+(d+2)+") button";
  141. dtime = 1000;
  142. setTimeout(pw, pageLoadtime);
  143. }