您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds custom UI enhancements
当前为
// ==UserScript== // @name AAC Enhanced // @namespace http://tampermonkey.net/ // @version 1.5.0 // @copyright 2024, Asriel(https://gf.qytechs.cn/de/users/1375984-asriel-aac) // @license MIT // @description Adds custom UI enhancements // @author Asriel // @icon https://i.ibb.co/z5CJ5zv/revanced.png // @supportURL https://gf.qytechs.cn/de/scripts/511351-aac-enhanced/feedback // @setupURL https://update.gf.qytechs.cn/scripts/511351/AAC%20Enhanced.user.js // @include /^https?:\/\/(www\.)?anime\.academy\/chat/ // @grant none // ==/UserScript== (function() { 'use strict'; const scriptName = GM_info.script.name; const scriptVersion = GM_info.script.version; window.aacEnhancedScriptID = `${scriptName.replace(/\s+/g, '-')}-${scriptVersion}`; console.log(window.aacEnhancedScriptID); // Main Application Namespace const AACApp = { init: function() { this.loadModules(); }, loadModules: function() { TopWrapperIcon.init(); WallpaperChanger.init(); ChatArea.init(); } }; // Top Wrapper Icon Module const TopWrapperIcon = { init: function() { this.addIconToTopWrapper(); }, addIconToTopWrapper: function() { const topWrapper = document.querySelector('.area'); if (topWrapper) { const iconButton = this.createIconButton(); iconButton.addEventListener('click', () => Menu.createPlaceholderMenu()); topWrapper.appendChild(iconButton); } else { console.warn('[AAC Enhanced] Top wrapper not found. Icon could not be added.'); } }, createIconButton: function() { const iconButton = document.createElement('div'); iconButton.id = 'aac-topWrapperIcon'; iconButton.style.width = '40px'; iconButton.style.height = '40px'; iconButton.style.borderRadius = '50%'; iconButton.style.display = 'flex'; iconButton.style.alignItems = 'center'; iconButton.style.justifyContent = 'center'; iconButton.style.cursor = 'pointer'; iconButton.style.marginRight = '10px'; iconButton.style.boxShadow = '0 0 5px rgba(0, 0, 0, 0.2)'; const iconImage = document.createElement('img'); iconImage.src = 'https://i.ibb.co/z5CJ5zv/revanced.png'; iconImage.alt = 'Menu Icon'; iconImage.style.width = '100%'; iconImage.style.height = '100%'; iconImage.style.borderRadius = '50%'; iconButton.appendChild(iconImage); return iconButton; } }; // Menu Module const Menu = { createPlaceholderMenu: function() { const existingMenu = document.querySelector('#aac-placeholderMenu'); if (existingMenu) { existingMenu.remove(); return; } const menu = this.createMenuElement(); document.body.appendChild(menu); ChatArea.updateToggleButton(); this.updateToggleLeftbarButton(); }, createMenuElement: function() { const menu = document.createElement('div'); menu.id = 'aac-placeholderMenu'; const iconButton = document.querySelector('#aac-topWrapperIcon'); const iconButtonRect = iconButton.getBoundingClientRect(); menu.style.position = 'absolute'; menu.style.top = `${iconButtonRect.bottom + window.scrollY + 10}px`; menu.style.left = `${iconButtonRect.left + window.scrollX}px`; menu.style.zIndex = '10001'; menu.style.padding = '20px'; menu.style.backgroundColor = '#fff'; menu.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)'; menu.style.borderRadius = '10px'; menu.style.textAlign = 'center'; const title = this.createTitleElement(); const wallpaperSectionTitle = document.createElement('h4'); wallpaperSectionTitle.innerText = 'Wallpaper Settings'; wallpaperSectionTitle.style.marginTop = '20px'; wallpaperSectionTitle.style.marginBottom = '10px'; const wallpaperChangerButton = WallpaperChanger.createWallpaperChangerButton(); const savedWallpapersButton = WallpaperChanger.createSavedWallpapersButton(); const uiSettingsSectionTitle = document.createElement('h4'); uiSettingsSectionTitle.innerText = 'UI Settings'; uiSettingsSectionTitle.style.marginTop = '20px'; uiSettingsSectionTitle.style.marginBottom = '10px'; const toggleChatAreaButton = ChatArea.createToggleChatAreaButton(); const toggleLeftbarButton = this.createToggleLeftbarButton(); const closeButton = this.createCloseButton(); menu.appendChild(title); menu.appendChild(wallpaperSectionTitle); menu.appendChild(wallpaperChangerButton); menu.appendChild(document.createElement('br')); menu.appendChild(savedWallpapersButton); menu.appendChild(document.createElement('br')); menu.appendChild(uiSettingsSectionTitle); menu.appendChild(toggleChatAreaButton); menu.appendChild(document.createElement('br')); menu.appendChild(toggleLeftbarButton); menu.appendChild(document.createElement('br')); menu.appendChild(closeButton); return menu; }, createTitleElement: function() { const title = document.createElement('h3'); title.innerText = 'AC-Enhanced Settings'; title.style.marginBottom = '20px'; return title; }, createToggleLeftbarButton: function() { const toggleLeftbarButton = document.createElement('button'); toggleLeftbarButton.id = 'aac-toggleLeftbarButton'; toggleLeftbarButton.style.padding = '10px'; toggleLeftbarButton.style.color = '#fff'; toggleLeftbarButton.style.border = 'none'; toggleLeftbarButton.style.borderRadius = '5px'; toggleLeftbarButton.style.cursor = 'pointer'; toggleLeftbarButton.style.marginBottom = '10px'; toggleLeftbarButton.addEventListener('click', () => Menu.toggleLeftbarVisibility()); return toggleLeftbarButton; }, createCloseButton: function() { const closeButton = document.createElement('button'); closeButton.innerText = 'Close'; closeButton.style.padding = '10px'; closeButton.style.backgroundColor = '#ccc'; closeButton.style.color = '#000'; closeButton.style.border = 'none'; closeButton.style.borderRadius = '5px'; closeButton.style.cursor = 'pointer'; closeButton.addEventListener('click', () => { const menu = document.querySelector('#aac-placeholderMenu'); if (menu) menu.remove(); }); return closeButton; }, toggleLeftbarVisibility: function() { const leftbar = document.querySelector('#leftbar'); const chatBox = document.querySelector('#chatverlaufbox'); if (!leftbar) return; if (leftbar.style.visibility === 'hidden') { leftbar.style.transition = 'visibility 0s, opacity 0.5s linear'; leftbar.style.opacity = '1'; leftbar.style.visibility = 'visible'; leftbar.style.pointerEvents = 'auto'; if (chatBox) chatBox.style.left = '250px'; // Adjust position to align with leftbar visible localStorage.setItem('aac-leftbarVisibility', 'visible'); } else { leftbar.style.transition = 'visibility 0s 0.5s, opacity 0.5s linear'; leftbar.style.opacity = '0'; leftbar.style.visibility = 'hidden'; leftbar.style.pointerEvents = 'none'; if (chatBox) chatBox.style.left = '0'; // Keep consistent position when leftbar is hidden localStorage.setItem('aac-leftbarVisibility', 'hidden'); } this.updateToggleLeftbarButton(); } }; Menu.updateToggleLeftbarButton = function() { const toggleLeftbarButton = document.querySelector('#aac-toggleLeftbarButton'); const leftbarVisible = localStorage.getItem('aac-leftbarVisibility') !== 'hidden'; if (toggleLeftbarButton) { if (leftbarVisible) { toggleLeftbarButton.innerText = 'Hide Leftbar'; toggleLeftbarButton.style.backgroundColor = '#573699'; } else { toggleLeftbarButton.innerText = 'Show Leftbar'; toggleLeftbarButton.style.backgroundColor = '#FF0000'; } } }; // Initialize the leftbar visibility state on load document.addEventListener('DOMContentLoaded', () => { sessionStorage.removeItem('aac-wallpaperChanged'); sessionStorage.removeItem('aac-chatAreaButtonState'); const leftbar = document.querySelector('#leftbar'); const chatBox = document.querySelector('#chatverlaufbox'); const toggleLeftbarButton = document.querySelector('#aac-toggleLeftbarButton'); if (leftbar) { const leftbarVisible = localStorage.getItem('aac-leftbarVisibility') !== 'hidden'; leftbar.style.transition = 'visibility 0s, opacity 0.5s linear'; leftbar.style.opacity = leftbarVisible ? '1' : '0'; leftbar.style.visibility = leftbarVisible ? 'visible' : 'hidden'; leftbar.style.pointerEvents = leftbarVisible ? 'auto' : 'none'; if (chatBox) { chatBox.style.left = leftbarVisible ? '250px' : '0'; // Ensure consistent positioning for chatbox } if (toggleLeftbarButton) { toggleLeftbarButton.innerText = leftbarVisible ? 'Hide Leftbar' : 'Show Leftbar'; toggleLeftbarButton.style.backgroundColor = leftbarVisible ? '#573699' : '#FF0000'; } } window.onbeforeunload = () => {}; // Disable confirmation popup when reloading the page }); // Wallpaper Changer Module const WallpaperChanger = { init: function() { this.applySavedBackground(); }, applySavedBackground: function() { const savedImageUrl = localStorage.getItem('aac-customBackgroundUrl'); if (savedImageUrl) { this.applyCustomBackground(savedImageUrl); } }, applyCustomBackground: function(url) { if (url) { document.documentElement.style.cssText = ` background-image: url("${url}") !important; background-color: #000 !important; background-position: center center !important; background-attachment: fixed !important; background-size: cover !important; background-repeat: no-repeat !important; `; document.body.style.cssText = ` background-image: url("${url}") !important; background-color: #000 !important; background-position: center center !important; background-attachment: fixed !important; background-size: cover !important; background-repeat: no-repeat !important; `; } }, createWallpaperChangerButton: function() { const button = document.createElement('button'); button.innerText = 'Change Wallpaper'; button.style.padding = '10px'; button.style.backgroundColor = '#573699'; button.style.color = '#fff'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; button.style.marginBottom = '10px'; button.addEventListener('click', () => { WallpaperChanger.createInputMenu(); const menu = document.querySelector('#aac-placeholderMenu'); if (menu) menu.remove(); }); return button; }, createSavedWallpapersButton: function() { const button = document.createElement('button'); button.innerText = 'Saved Wallpapers'; button.style.padding = '10px'; button.style.backgroundColor = '#573699'; button.style.color = '#fff'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; button.style.marginBottom = '10px'; button.addEventListener('click', () => { WallpaperChanger.createSavedWallpapersMenu(); }); return button; }, createSavedWallpapersMenu: function() { const menu = document.createElement('div'); menu.style.position = 'fixed'; menu.style.top = '50%'; menu.style.left = '50%'; menu.style.transform = 'translate(-50%, -50%)'; menu.style.zIndex = '10001'; menu.style.padding = '20px'; menu.style.backgroundColor = '#fff'; menu.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)'; menu.style.borderRadius = '10px'; menu.style.textAlign = 'center'; const title = document.createElement('h3'); title.innerText = 'Saved Wallpapers'; title.style.marginBottom = '20px'; menu.appendChild(title); const savedWallpapers = JSON.parse(localStorage.getItem('aac-savedWallpapers') || '[]'); savedWallpapers.forEach((wallpaper, index) => { const wallpaperButton = document.createElement('button'); wallpaperButton.innerText = wallpaper.name || `Wallpaper ${index + 1}`; wallpaperButton.style.padding = '10px'; wallpaperButton.style.marginBottom = '5px'; wallpaperButton.style.backgroundColor = '#573699'; wallpaperButton.style.color = '#fff'; wallpaperButton.style.border = 'none'; wallpaperButton.style.borderRadius = '5px'; wallpaperButton.style.cursor = 'pointer'; wallpaperButton.addEventListener('click', () => { WallpaperChanger.applyCustomBackground(wallpaper.url); }); const deleteButton = document.createElement('button'); deleteButton.innerText = '✕'; deleteButton.style.marginLeft = '5px'; deleteButton.style.padding = '2px'; // Reduce padding to make it smaller deleteButton.style.width = '20px'; // Set specific width deleteButton.style.height = '20px'; // Set specific height deleteButton.style.backgroundColor = '#FF0000'; deleteButton.style.color = '#fff'; deleteButton.style.border = 'none'; deleteButton.style.borderRadius = '3px'; deleteButton.style.cursor = 'pointer'; deleteButton.addEventListener('click', () => { WallpaperChanger.deleteWallpaper(index); menu.remove(); WallpaperChanger.createSavedWallpapersMenu(); }); menu.appendChild(wallpaperButton); menu.appendChild(deleteButton); menu.appendChild(document.createElement('br')); }); const closeButton = document.createElement('button'); closeButton.innerText = 'Close'; closeButton.style.padding = '10px'; closeButton.style.backgroundColor = '#ccc'; closeButton.style.color = '#000'; closeButton.style.border = 'none'; closeButton.style.borderRadius = '5px'; closeButton.style.cursor = 'pointer'; closeButton.addEventListener('click', () => { menu.remove(); }); menu.appendChild(closeButton); document.body.appendChild(menu); }, createInputMenu: function() { const menu = document.createElement('div'); menu.style.position = 'fixed'; menu.style.top = '50%'; menu.style.left = '50%'; menu.style.transform = 'translate(-50%, -50%)'; menu.style.zIndex = '10001'; menu.style.padding = '20px'; menu.style.backgroundColor = '#fff'; menu.style.boxShadow = '0 0 10px rgba(0, 0, 0, 0.5)'; menu.style.borderRadius = '10px'; menu.style.textAlign = 'center'; const input = document.createElement('input'); input.type = 'text'; input.placeholder = 'Enter image URL here...'; input.value = localStorage.getItem('aac-customBackgroundUrl') || ''; input.style.width = '300px'; input.style.padding = '10px'; input.style.marginBottom = '10px'; input.style.border = '1px solid #ccc'; input.style.borderRadius = '5px'; const nameInput = document.createElement('input'); nameInput.type = 'text'; nameInput.placeholder = 'Enter wallpaper name...'; nameInput.style.width = '300px'; nameInput.style.padding = '10px'; nameInput.style.marginBottom = '10px'; nameInput.style.border = '1px solid #ccc'; nameInput.style.borderRadius = '5px'; const fileInput = document.createElement('input'); fileInput.type = 'file'; fileInput.accept = 'image/*'; fileInput.style.marginBottom = '10px'; fileInput.addEventListener('change', (event) => { const file = event.target.files[0]; if (file) { const reader = new FileReader(); reader.onload = (e) => { const imageUrl = e.target.result; input.value = imageUrl; }; reader.readAsDataURL(file); } }); const applyButton = document.createElement('button'); applyButton.innerText = 'Apply Background'; applyButton.style.marginLeft = '10px'; applyButton.style.padding = '10px'; applyButton.style.backgroundColor = '#573699'; applyButton.style.color = '#fff'; applyButton.style.border = 'none'; applyButton.style.borderRadius = '5px'; applyButton.style.cursor = 'pointer'; applyButton.addEventListener('click', () => { const imageUrl = input.value.trim(); const wallpaperName = nameInput.value.trim() || `Wallpaper ${Date.now()}`; if (imageUrl) { localStorage.setItem('aac-customBackgroundUrl', imageUrl); WallpaperChanger.saveWallpaper(imageUrl, wallpaperName); sessionStorage.setItem('aac-wallpaperChanged', 'true'); WallpaperChanger.applyCustomBackground(imageUrl); menu.remove(); } else { alert('Please enter a valid URL.'); } }); const saveButton = document.createElement('button'); saveButton.innerText = 'Save Wallpaper'; saveButton.style.marginTop = '10px'; saveButton.style.padding = '10px'; saveButton.style.backgroundColor = '#573699'; saveButton.style.color = '#fff'; saveButton.style.border = 'none'; saveButton.style.borderRadius = '5px'; saveButton.style.cursor = 'pointer'; saveButton.addEventListener('click', () => { const imageUrl = input.value.trim(); const wallpaperName = nameInput.value.trim() || `Wallpaper ${Date.now()}`; if (imageUrl) { WallpaperChanger.saveWallpaper(imageUrl, wallpaperName); alert('Wallpaper saved successfully.'); } else { alert('Please enter a valid URL.'); } }); const closeButton = document.createElement('button'); closeButton.innerText = 'Close'; closeButton.style.marginTop = '10px'; closeButton.style.padding = '10px'; closeButton.style.backgroundColor = '#ccc'; closeButton.style.color = '#000'; closeButton.style.border = 'none'; closeButton.style.borderRadius = '5px'; closeButton.style.cursor = 'pointer'; closeButton.addEventListener('click', () => { menu.remove(); }); menu.appendChild(input); menu.appendChild(document.createElement('br')); menu.appendChild(nameInput); menu.appendChild(document.createElement('br')); menu.appendChild(fileInput); menu.appendChild(applyButton); menu.appendChild(document.createElement('br')); menu.appendChild(saveButton); menu.appendChild(document.createElement('br')); menu.appendChild(closeButton); document.body.appendChild(menu); }, saveWallpaper: function(url, name) { let savedWallpapers = JSON.parse(localStorage.getItem('aac-savedWallpapers') || '[]'); if (!savedWallpapers.some(wallpaper => wallpaper.url === url)) { savedWallpapers.push({ url, name }); localStorage.setItem('aac-savedWallpapers', JSON.stringify(savedWallpapers)); } }, deleteWallpaper: function(index) { let savedWallpapers = JSON.parse(localStorage.getItem('aac-savedWallpapers') || '[]'); savedWallpapers.splice(index, 1); localStorage.setItem('aac-savedWallpapers', JSON.stringify(savedWallpapers)); } }; // Chat Area Module const ChatArea = { isDraggable: false, init: function() { this.chatArea = document.querySelector('#graphicChatArea'); if (this.chatArea) { this.centerChatArea(); this.chatArea.style.position = 'absolute'; const savedState = localStorage.getItem('aac-isChatAreaDraggable'); if (savedState === 'true') { this.enableDraggable(); } } }, centerChatArea: function() { if (this.chatArea) { const windowWidth = window.innerWidth; const windowHeight = window.innerHeight; const chatWidth = this.chatArea.offsetWidth; const chatHeight = this.chatArea.offsetHeight; this.chatArea.style.left = `${(windowWidth - chatWidth) / 2}px`; this.chatArea.style.top = `${(windowHeight - chatHeight) / 2}px`; } }, toggleDraggable: function() { if (!this.chatArea) return; if (this.isDraggable) { this.disableDraggable(); } else { this.enableDraggable(); } this.updateToggleButton(); }, enableDraggable: function() { this.isDraggable = true; localStorage.setItem('aac-isChatAreaDraggable', 'true'); sessionStorage.setItem('aac-chatAreaButtonState', 'true'); $(this.chatArea).draggable({ containment: 'document', start: function() { ChatArea.chatArea.classList.add('ui-draggable-enabled'); }, stop: function() { ChatArea.chatArea.classList.remove('ui-draggable-enabled'); } }); console.log('[AAC Enhanced] Chat area is now draggable.'); }, disableDraggable: function() { this.isDraggable = false; localStorage.setItem('aac-isChatAreaDraggable', 'false'); if ($(this.chatArea).draggable('instance')) { $(this.chatArea).draggable('destroy'); } console.log('[AAC Enhanced] Draggable functionality has been disabled.'); }, updateToggleButton: function() { const toggleButton = document.querySelector('#aac-toggleChatAreaButton'); if (toggleButton) { if (this.isDraggable) { toggleButton.innerText = 'Disable Draggable Chat Area'; toggleButton.style.backgroundColor = '#FF0000'; } else { toggleButton.innerText = 'Enable Draggable Chat Area'; toggleButton.style.backgroundColor = '#573699'; } } }, createToggleChatAreaButton: function() { const button = document.createElement('button'); button.id = 'aac-toggleChatAreaButton'; button.style.padding = '10px'; button.style.color = '#fff'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; button.style.marginBottom = '10px'; button.addEventListener('click', () => ChatArea.toggleDraggable()); return button; } }; AACApp.init(); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址