UNPKG

@khabzox/ytb-shorts-blocker

Version:

Block YouTube Shorts and keep your feed clean

86 lines (76 loc) 2.78 kB
/** * YouTube Shorts Blocker - Developer Library * * A library that provides YouTube Shorts blocking functionality for developers. * Can be used to integrate shorts blocking into custom applications or extensions. * Built with functional programming principles. * * @package ytb-shorts-blocker * @version 1.0.4 * @author khabzox * @license MIT */ // Types and interfaces export interface BlockerSettings { enabled: boolean; blockingMode: 'hide' | 'remove' | 'redirect'; showNotifications: boolean; blockInSearch: boolean; blockInHome: boolean; blockInSubscriptions: boolean; blockInTrending: boolean; allowWhitelistedChannels: boolean; debugMode: boolean; } export interface BlockerState { settings: BlockerSettings; isActive: boolean; observer: MutationObserver | null; } // Default settings export declare const DEFAULT_SETTINGS: BlockerSettings; // Core functions export declare function createBlocker(settings?: Partial<BlockerSettings>): void; export declare function initBlocker(): void; export declare function setEnabled(enabled: boolean): void; export declare function setBlockingMode(mode: 'hide' | 'remove' | 'redirect'): void; export declare function blockShorts(): void; export declare function getSettings(): BlockerSettings; export declare function updateSettings(newSettings: Partial<BlockerSettings>): void; export declare function getState(): BlockerState; // Utility functions export declare function detectShorts(): HTMLElement[]; export declare function blockElement(element: HTMLElement, mode: 'hide' | 'remove' | 'redirect'): void; export declare function isYouTubePage(): boolean; export declare function isShortsPage(): boolean; export declare function isHomePage(): boolean; export declare function isSearchPage(): boolean; export declare function isSubscriptionsPage(): boolean; export declare function isTrendingPage(): boolean; // Constants export declare const SELECTORS: { readonly SHORTS: '[data-shorts-selector]'; readonly SHORTS_GRID: '[data-shorts-grid]'; readonly SHORTS_ITEM: '[data-shorts-item]'; }; export declare const BLOCKING_MODES: { readonly HIDE: 'hide'; readonly REMOVE: 'remove'; readonly REDIRECT: 'redirect'; }; // Package information export declare const VERSION: string; export declare const AUTHOR: string; export declare const LICENSE: string; // Extension metadata export declare const EXTENSION_INFO: { name: string; version: string; description: string; author: string; license: string; repository: string; homepage: string; }; // Default export - main function to initialize export default function initYouTubeShortsBlocker(settings?: Partial<BlockerSettings>): void;