<commit_before><script>

    /**
     * System
     * A special connector that allows to use manga links from the clipboard.
     * This connector does not implement the connector base class, because it operates different.
     */
    class ClipboardConnector {

        /**
         *
         */
        constructor() {
            // Public members for usage in UI (mandatory)
            this.id       = 'clipboard';
            this.label    = ' 【Clipboard】';
            this.icon     = '/img/connectors/' + this.id;
            this.tags     = [];
            this.isLocked = false;
            // Private members for internal usage only (convenience)
            this.url      = undefined;
            this.referer  = undefined;
            this.agent    = undefined;
            // Private members for internal use that can be configured by the user through settings menu (set to undefined or false to hide from settings menu!)
            this.config = undefined;

            this.linkMap = [];
        }

        /**
         *
         */
        _getLinksFromClipboard() {
            // TODO: get links from clipboard...
            // navigator.clipboard.readText().then( text => console.log( 'DBG:', text) );
            return [];
        }

        /**
         *
         */
        initialize( mangaLinks ) {
            /*
            Sample Clipboard Data:
                https://mangadex.org/title/19531/the-promised-neverland
                https://fanfox.net/manga/yakusoku_no_neverland/
                https://mangapark.org/series/86171/yakusoku-no-neverland
                https://www.mangapanda.com/the-promised-neverland
                https://mangadex.org
                MEOW
            */
            let links = mangaLinks || this._getLinksFromClipboard();
            links = links.map( link => {
                try {
                    let uri = new URL( link );
                    let connector = Engine.Connectors.find( c => c.url === uri.origin );
                    connector = connector || Engine.Connectors.find( c => c.url && c.url.includes( uri.hostname ) );
                    if( !connector ) {
                        throw new Error( 'No suitable connector found for URL ' + link );
                    }
                    if( uri.pathname.length < 2 ) {
                        throw new Error( 'The URL path seems invalid ' + uri.pathname );
                    }
                    return {
                        uri: uri,
                        connector: connector
                    };
                } catch( error ) {
                    console.warn( 'CLIPBOARD:', error.message, link );
                    return null;
                }
            } );
            this.linkMap = links.filter( link => link );
            return this.linkMap.length > 0;
        }

        /**
         *
         */<commit_msg>Improved website detection from clipboard link(s) references fmd-project-team/FMD#275<commit_after><script>

    /**
     * System
     * A special connector that allows to use manga links from the clipboard.
     * This connector does not implement the connector base class, because it operates different.
     */
    class ClipboardConnector {

        /**
         *
         */
        constructor() {
            // Public members for usage in UI (mandatory)
            this.id       = 'clipboard';
            this.label    = ' 【Clipboard】';
            this.icon     = '/img/connectors/' + this.id;
            this.tags     = [];
            this.isLocked = false;
            // Private members for internal usage only (convenience)
            this.url      = undefined;
            this.referer  = undefined;
            this.agent    = undefined;
            // Private members for internal use that can be configured by the user through settings menu (set to undefined or false to hide from settings menu!)
            this.config = undefined;

            this.linkMap = [];
        }

        /**
         *
         */
        _getLinksFromClipboard() {
            // TODO: get links from clipboard...
            // navigator.clipboard.readText().then( text => console.log( 'DBG:', text) );
            return [];
        }

        /**
         *
         */
        initialize( mangaLinks ) {
            let links = mangaLinks || this._getLinksFromClipboard();
            links = links.map( link => {
                try {
                    let uri = new URL( link );
                    if( uri.pathname.length < 2 ) {
                        throw new Error( 'The URL path seems invalid ' + uri.pathname );
                    }
                    let connectors = Engine.Connectors.filter( connector => connector.url === uri.origin );
                    if( !connectors.length ) {
                        connectors =  Engine.Connectors.filter( connector => connector.url && connector.url.includes( uri.hostname ) );
                    }
                    if( connectors.length > 1 ) {
                        connectors = connectors.filter( connector => uri.pathname.startsWith( new URL( connector.url ).pathname ) );
                    }
                    if( !connectors.length ) {
                        throw new Error( 'No matching connector found for URL ' + link );
                    }
                    if( connectors.length > 1 ) {
                        throw new Error( 'To many matching connectors found for URL ' + link );
                    }
                    return {
                        uri: uri,
                        connector: connectors[0]
                    };
                } catch( error ) {
                    console.warn( 'CLIPBOARD:', error.message, link );
                    return null;
                }
            } );
            this.linkMap = links.filter( link => link );
            return this.linkMap.length > 0;
        }

        /**
         *
         */
{'fraction_non_alphanumeric': 0.09956273124789775, 'fraction_numerical': 0.003363605785401951, 'mean_word_length': 1.1855935317897832, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 20, 'https://': 5, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3015160', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1399, 'n_words': 386}