您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Search and cleaners
当前为
// ==UserScript== // @name AZNude - Video Search & UI Tweaks // @namespace brazenvoid // @version 2.1.0 // @author brazenvoid // @license GPL-3.0-only // @description Search and cleaners // @include https://www.aznude.com/* // @include https://search.aznude.com/* // @require https://greasyfork.org/scripts/375557-base-resource/code/Base%20Resource.js?version=758018 // @grant GM_addStyle // @run-at document-idle // ==/UserScript== GM_addStyle(` section.form-section div.form-group { margin-bottom: 10px; padding: unset; } section.form-section input.form-input { height: unset; } section.form-section label { margin-bottom: unset; } `) // Settings & Defaults let settings = { duration: { // In Seconds minimum: 30, maximum: 0, }, showUIAlways: false, // Desktop Only removeAdBoxes: true, removeRecommendations: true, removeSponsoredVideos: true, debugLogging: false, } // Base Resource Initializations const scriptPrefix = 'az-sui-' let storage = new LocalStore(scriptPrefix + 'settings', settings) settings = storage.retrieve().get() let logger = new Logger(settings.debugLogging) let selectorGenerator = new SelectorGenerator(scriptPrefix) let statistics = new StatisticsRecorder(logger, selectorGenerator) let validator = new Validator(statistics) let UI = new UIGenerator(settings.showUIAlways, selectorGenerator) let sponsoredRegex = new RegExp('azncdn', 'ig') // Local Store Events let refreshUI = function () { let store = this.get() UI.setSettingsRangeInputValue('Duration', store.duration.minimum, store.duration.maximum) UI.setSettingsInputCheckedStatus('Always Show UI', store.showUIAlways) UI.setSettingsInputCheckedStatus('Sponsored', store.removeSponsoredVideos) } storage.onDefaultsLoaded = refreshUI storage.onRetrieval = refreshUI storage.onUpdated = refreshUI // Validators // -- Duration validation let validateDuration = function (videoItem) { let duration = videoItem.querySelector('.video-time') if ((duration !== null) && (settings.duration.minimum > 0 || settings.duration.maximum > 0)) { duration = duration.textContent.split(':') duration = (parseInt(duration[0]) * 60) + parseInt(duration[1]) return validator.validateRange('Duration', duration, [ settings.duration.minimum, settings.duration.maximum, ]) } return true } // -- Sponsored video validation let validateSponsoredVideo = function (videoItem) { let videoLink = videoItem.querySelector('.show-clip'); if (settings.removeSponsoredVideos && videoLink !== null) { let validationCheck = videoLink.href.match(sponsoredRegex) !== null statistics.record('Sponsored', validationCheck) return validationCheck } return true } // -- Compliance logic let complianceCallback = function () { let videoItems = document.querySelectorAll('.albuma, .albuma2') let videoComplies for (let videoItem of videoItems) { videoComplies = validateDuration(videoItem) && validateSponsoredVideo(videoItem) if (videoComplies) { videoItem.style.display = 'inline-block' } else { videoItem.style.display = 'none' } logger.logSeparator() } statistics.updateUI() } // UI Composition // -- Control Panel let section = UI.createSection('settings', '#ffa31a', '200px', '250px', [ UI.createFormRangeInputGroup('Duration', 'number', [ settings.duration.minimum, settings.duration.maximum, ]), UI.createFormInputGroup('Sponsored', 'checkbox', settings.removeSponsoredVideos), UI.createFormInputGroup('Always Show UI', 'checkbox', settings.showUIAlways), UI.createSeparator(), UI.createSettingsFormActions(storage, function () { settings.duration.minimum = UI.getSettingsRangeInputValue('Duration', true) settings.duration.maximum = UI.getSettingsRangeInputValue('Duration', false) settings.showUIAlways = UI.getSettingsInputCheckedStatus('Always Show UI') settings.removeSponsoredVideos = UI.getSettingsInputCheckedStatus('Sponsored') statistics.reset() complianceCallback() }), UI.createSeparator(), UI.createStoreFormSection(storage), UI.createSeparator(), UI.createStatisticsFormGroup('Duration', 'Short'), UI.createStatisticsFormGroup('Sponsored'), UI.createStatisticsFormGroup('Total'), UI.createSettingsHideButton('settings'), ]) UIGenerator.appendToBody(section) UIGenerator.appendToBody(UI.createSettingsShowButton('Search & Tweaks', section)) logger.logTaskCompletion('Building UI') // Remove Ad Boxes if (settings.removeAdBoxes) { let ads = document.querySelectorAll('.ad-box-video') for (const ad of ads) { ad.remove() } } // Remove Recommendations if (settings.removeRecommendations) { let recommendationSections = document.querySelectorAll('.recommended') for (const recommendationSection of recommendationSections) { recommendationSection.remove() } } // Script run complianceCallback()