Greasy Fork

Greasy Fork is available in English.

Auto Simya

심챈 자동 복호화/국룰입력/다운(Kiosk,Mega,GoogleDrive)

当前为 2024-05-30 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name		Auto Simya
// @name:ko		심야 자동 식당
// @namespace	http://tampermonkey.net/
// @description	심챈 자동 복호화/국룰입력/다운(Kiosk,Mega,GoogleDrive)
// @version		3.8
// @author		김머시기
// @match		https://kiosk.ac/c/*
// @match		https://arca.live/b/*
// @match		https://mega.nz/*
// @match		https://drive.google.com/file/d/*
// @match		https://drive.google.com/drive/folders/*
// @match		https://drive.usercontent.google.com/download?id*
// @icon		https://lh3.google.com/u/0/d/1jDk6_Mt15I4k9ZfqpfeYZ-Qb5xOWV_uQ=w1854-h959-iv1
// @grant		GM.setValue
// @grant		GM.getValue
// @require		https://openuserjs.org/src/libs/sizzle/GM_config.js
// @grant		GM.registerMenuCommand
// @grant		GM_registerMenuCommand
// @grant		GM_unregisterMenuCommand
// @grant		GM_getValue
// @grant		GM_setValue
// @license		MIT
// @run-at		document-end
// ==/UserScript==
'use strict';
const rpw = atob("c21wZW9wbGU=");
let password = [rpw,"#"+rpw+"#",
// ==============================      Settings      ====================================
//	추가하길 원하는 비밀번호 쉼표로 구분해서 바로 아래줄에 따옴표안에 넣으면 됨  ex) "1234","2024국룰","!국룰!"
                
];
let pageLoadTime = 1200;	//	본인 컴퓨터, 인터넷 사양이 좋지 않아 페이지 로딩시간이 오래걸리면 해당 값 조절하세요(1000당 1초)
let d_Option = 1;			//	Kiosk 다운로드 옵션  0:Basic   1:Fast   2:일괄 다운로드
// ======================================================================================
let rpt,pwi,pwb,btd,dtime,tabTime,autoTab,autoDown,isDown,isTab;
let DownId = null, TabId = null;
let currentHost = document.URL.split("/")[2];
const timer = ms => new Promise(res => setTimeout(res, ms))
async function rnrfnf() {
    rpt = await GM.getValue("rpt");
    isDown = await GM.getValue("isDown",true);
    isTab = await GM.getValue("isTab",false);
    updateDown();
    updateTab();
    if(currentHost == "arca.live") {
        if(rpt != rpw)	{
            const chk = prompt("국룰 확인");
            if(chk?.toLowerCase() == rpw) {
                await GM.setValue("rpt", rpw);
            } else {
                GM.setValue("rpt", false);
                alert("국룰이 일치하지 않습니다.");
            }
        }
    }
}
async function toggleDown() {
    isDown = !isDown;
    if(isDown === false && isTab === true) {
        isTab = false;
        await GM.setValue("isTab",isTab);
    }
    await GM.setValue("isDown",isDown);
    updateDown();
    updateTab();
}
async function toggleTab() {
    isTab = !isTab;
    if(isDown === false && isTab === true) {
        isDown = true;
        await GM.setValue("isDown",isDown);
    }
    await GM.setValue("isTab",isTab);
    updateDown();
    updateTab();
}
function updateDown() {
    if(DownId !== null) GM_unregisterMenuCommand(DownId);
    DownId = GM_registerMenuCommand(`자동 다운로드  ${isDown ? '켜짐' : '꺼짐'}`, toggleDown);
    if(isDown === true) autoDown = "on";
    if(isDown === false) autoDown = "off";
}
function updateTab() {
    if(TabId !== null) GM_unregisterMenuCommand(TabId);
    TabId = GM_registerMenuCommand(`자동 탭 닫기  ${isTab ? '켜짐' : '꺼짐'}`, toggleTab);
    if(isTab === false) autoTab = "off";
    if(isTab === true) autoTab = "on";
}
function doDecode() {
    if(rpt == rpw) {
        const article = document.querySelector("body div.article-body > div.fr-view.article-content");
        function dec(reg) {
            try {
                while(reg.test(article.innerHTML)) {
                    let decoded = reg.exec(article.innerHTML)[0];
                    while(decoded.match(/aHR0c[0-9A-Za-z+/-]{8,}[=]{0,2}/) == null) {
                        decoded = atob(decoded);
                    } decoded = atob(decoded);
                    article.innerHTML = article.innerHTML.replace(reg, `<a href=${decoded} target='_blank' rel='noreferrer'>${decoded}</a>`);
                }
            } catch(e) { console.log(e,article); }
        }
        dec(/aHR0c[0-9A-Za-z+/-]{20,}[=]{0,2}/);
        dec(/YUhSMGN[0-9A-Za-z+/-]{80,}[=]{0,2}/);
        dec(/[0-9A-Za-z+/-]{30,}[=]{1,2}/);
        dec(/[0-9A-Za-z+/-]{200,}[=]{0,2}/);
    }
}
async function pw() {
    if(rpt == rpw) {
        for(var i = 0; i < password.length; i++) {
            document.querySelector(pwi).value = password[i];
            document.querySelector(pwb).click();
            if(i < password.length-1) {
                if(password[i] != null && password[i] != "") await timer(800);
            } else {
                if(autoDown == "on") await setTimeout(dbtn,dtime);
            }
        }
    }
}
async function dbtn() {
	let downBtn = document.querySelector(btd);
    if(currentHost == "mega.nz") {
        let resumeBtn = document.querySelector('.mega-button.positive.resume.js-resume-download');
        await resumeBtn.click();
    }
    await downBtn.click();
    if(downBtn != null && autoTab == "on" && currentHost != "mega.nz") setTimeout(() => { window.open('','_self').close(); }, tabTime);

}
rnrfnf();
if(currentHost == "arca.live") setTimeout(doDecode, 100);
if(currentHost == "mega.nz") {
    pwi = "#password-decrypt-input";
    pwb = ".mega-button.positive.fm-dialog-new-folder-button.decrypt-link-button";
    btd = ".mega-button.positive.js-default-download.js-standard-download";
    dtime = 4000;
    tabTime = 1000;
    setTimeout(pw, pageLoadTime+1000);
}
if(currentHost == "kiosk.ac") {
    pwi = ".input.shadow-xl.flex-grow";
    pwb = ".btn.btn-ghost.w-full.mt-2.rounded-md";
    if(d_Option == 2) btd = ".flex.justify-between.w-full .flex.gap-2 .btn.btn-ghost";
    else btd = ".p-2 li:nth-child("+(d_Option+2)+") button";
    dtime = 1000;
    tabTime = 1000;
    setTimeout(pw, pageLoadTime);
}
if(currentHost == "drive.google.com") {
    let googleHost = document.URL.split("/")[3]+document.URL.split("/")[4];
    if(googleHost == "filed") window.location.href = `https://drive.usercontent.google.com/download?id=${document.URL.split("/")[5]}&export=download`;
    if(googleHost == "drivefolders") {
        btd = ".pc7nUb.kXQBpc.Dk9rmd:nth-child(2)";
        tabTime = 5300;
        setTimeout(() => { if(autoDown == "on") setTimeout(dbtn, 1500)},pageLoadTime);
    }
}
if(currentHost == "drive.usercontent.google.com") {
    btd = ".goog-inline-block.jfk-button.jfk-button-action";
    tabTime = 1000;
    setTimeout(() => { if(autoDown == "on") dbtn()},(pageLoadTime/1000));
}