// ==UserScript== // @name AnimeJoy.ru скрипт // @name:en AnimeJoy.ru script // @namespace nyakonya_ajrup // @match https://animejoy.ru/* // @match https://animejoy.su/* // @match https://animejoy.site/* // @match https://anime-joy.ru/* // @match https://anime-joy.online/* // @match https://animejoy-2.ru/* // @match https://animejoya.ru/* // @match https://joyanime.ru/* // @match https://ajsubs.ru/* // @match https://jsub.online/* // @match https://ajsub.ru/* // @match https://ajsub.online/* // @match https://animejoy.su/* // @match https://animejoy.xyz/* // @version 0.5.1b // @author https://t.me/Nyako_TW // @description 15.07.2023, 19:46:44 // @description:en 15.07.2023, 19:46:44 // @license Apache License 2.0 // @downloadURL https://git.nekono.su/Nyako/script-dev-ru/raw/branch/main/nyakonya_ajrup/script.user.js // @updateURL https://git.nekono.su/Nyako/script-dev-ru/raw/branch/main/nyakonya_ajrup/script.user.js // @grant GM_registerMenuCommand // @grant GM_getValue // @grant GM_setValue // @compatible tampermonkey // @compatible violentmonkey // @incompatible greasemonkey // ==/UserScript== // Фунция безопасного запуска функций function safeRun(fn, name) { try { fn(); } catch (e) { console.error(`Ошибка в ${name}:`, e); } } // Фунции генерации конфигураций function registerToggle(key, defaultValue, title, enabledText, disabledText) { const isEnabled = GM_getValue(key, defaultValue); const menuText = `${isEnabled ? '✅' : '🔲'} ${title}`; GM_registerMenuCommand(menuText, () => { const newState = !isEnabled; GM_setValue(key, newState); alert( `Настройка изменена! ${title} ${ newState ? enabledText : disabledText }. Обновите страницу для применения настроек.` ); location.reload(); }); } // Генерация конфигураций function config_runner() { registerToggle( 'nyakonya_ajrup_comments', false, 'Комментарии', 'включены', 'выключены' ); registerToggle( 'nyakonya_ajrup_footer', true, 'Подвал сайта', 'включен', 'выключен' ); registerToggle( 'nyakonya_ajrup_screenshoot', true, 'Скриншоты', 'включен', 'выключен' ); registerToggle( 'nyakonya_ajrup_socnews', true, 'Соц. сети в новостях', 'включен', 'выключен' ); } // Переменные, параметры и пр. pathname = window.location.pathname; pathnamefirst = pathname.split('/')[1]; var info_anime_raw; paths_lists = [ "tv-serialy", "ongoing", "ova", "anime-films", "full_tv", "anons", "dorams", "news", "zhanry-anime.html", "favorites", "tags" ]; // Вспомогательные функции function num_include_test(text_input) { if (/[0-9]/.test(text_input)) {return true;} else {return false;} } // Фунции обработки страниц function remove_socnews() { SocnewsisEnabled = GM_getValue('nyakonya_ajrup_socnews', false); if (!SocnewsisEnabled){ news_list = document.getElementsByTagName("article"); for (let one_new of news_list) { if (one_new.innerText.includes("Телеграмм") || one_new.innerText.includes("Группа VK")) { one_new.remove(); } } } } function remove_screenshoot() { ScreenshootisEnabled = GM_getValue('nyakonya_ajrup_screenshoot', false); if (!ScreenshootisEnabled){ document.getElementsByClassName("mobfields")[0].remove(); } } function remove_comments() { СommentsisEnabled = GM_getValue('nyakonya_ajrup_comments', false); if (!СommentsisEnabled){ document.getElementById("dle-comments-form").remove(); document.getElementsByClassName("comments ignore-select")[0].remove(); } } function remove_footer() { footersisEnabled = GM_getValue('nyakonya_ajrup_footer', false); if (!footersisEnabled){ document.getElementById("footer").remove(); } } function color_sets() { const element = document.body; const bgColor = getComputedStyle(element).backgroundColor; if (bgColor === "rgb(255, 255, 255)") { bg_page_set = "background: #f5f5f5;"; } else if (bgColor === "rgb(0, 0, 0)") { bg_page_set = "background: #121212;"; } else { bg_page_set = "background: #f5f5f5;"; } document.body.setAttribute("style", bg_page_set); tmp_data_01 = document.getElementsByClassName("body"); tmp_data_01[0].setAttribute("style", bg_page_set); } function right_side_remove() { if (num_include_test(window.location.pathname)) { info_anime_raw = document.getElementsByClassName("abasel")[0]; } tmp_data_02 = document.getElementsByClassName("str_left")[0]; tmp_data_02.setAttribute("style", "float: left; width: 100%;"); document.getElementsByClassName("rightside_bg")[0].remove(); document.getElementById("rightside").remove(); } function move_search(move_to) { clonedNode = document.getElementById("rightside").getElementsByTagName("form")[0].cloneNode(true); clonedNode.setAttribute("action", "https://"+window.location.hostname+"/index.php?do=search"); move_to.appendChild(clonedNode); } function story_tools_remove() { let tmp_data_04 = document.querySelectorAll('.story_tools'); for( let i = 0; i < tmp_data_04.length; i++ ){ tmp_data_04[i].outerHTML = ""; } } function replace_data() { info_anime = document.getElementsByClassName("blkdesc")[0]; info_data = document.createElement("p"); info_data.setAttribute("class", "zerop"); info_set = "Друг. сайты:"; info_list = info_anime_raw.getElementsByTagName("a"); all_data = ""; for (let one_data of info_list) { all_data = all_data + " "+one_data.innerText+""; } info_set = info_set + all_data; info_data.innerHTML = info_set; info_anime.appendChild(info_data); } // Основной код if (window.location.search.includes("search")) { right_side_remove(); story_tools_remove(); } if (paths_lists.some(p => pathnamefirst.includes(p))) { move_search(document.getElementById("breadcrumbs")); right_side_remove(); story_tools_remove(); document.getElementById("dle-speedbar").remove(); if (pathnamefirst == "tv-serialy") { safeRun(remove_screenshoot, "remove_screenshoot"); remove_comments(); replace_data(); } if (pathnamefirst == "zhanry-anime.html") { container = document.getElementById("dle-content"); links = container.querySelectorAll("a[href]"); links.forEach(link => { const url = new URL(link.getAttribute("href"), window.location.href); url.hostname = window.location.hostname; url.protocol = window.location.protocol; link.href = url.toString(); }); } if (pathnamefirst == "user") { move_search(document.getElementById("breadcrumbs")); right_side_remove(); } } if (window.location.pathname.includes("/user/")) { move_search(document.getElementById("breadcrumbs")); right_side_remove(); } if (window.location.pathname == "/" || window.location.pathname.includes("/page/")) { tmp_data_01 = document.getElementsByClassName("shapka"); tmp_data_01[0].innerHTML = ''; move_search(document.getElementsByClassName("shapka")[0]); right_side_remove(); story_tools_remove(); } // Запуск основных функций safeRun(config_runner, "config_runner"); safeRun(color_sets, "color_sets"); safeRun(remove_footer, "remove_footer"); safeRun(remove_socnews, "remove_socnews");