Jump to content

MediaWiki:Common.js: Difference between revisions

From International Treaty Law Wiki
No edit summary
No edit summary
Line 210: Line 210:
             container.appendChild(githubSection);
             container.appendChild(githubSection);
             container.appendChild(searchSection);
             container.appendChild(searchSection);
// --- GPT + Recommended Links Footer Block ---
var footerBlock = document.createElement('div');
footerBlock.style.marginTop = '30px';
footerBlock.style.padding = '15px';
footerBlock.style.border = '2px solid #3a6ea5';
footerBlock.style.background = '#eef4fb';
footerBlock.style.borderRadius = '6px';
footerBlock.style.color = '#1a1a1a';
footerBlock.style.fontSize = '14px';
footerBlock.style.lineHeight = '1.5';


// Build HTML content
footerBlock.innerHTML = `
    <div style="font-size: 18px; font-weight: bold; color: #2a4d7a; margin-bottom: 10px;">
        Recommended GPT Tools by ChatGPT
    </div>
    <ul style="margin-left: 15px;">
        <li><b>World Succession Deed GPT</b> – unified global succession framework<br>
        <a href="https://chatgpt.com/g/g-69d82340e27081918e08803ce62e46e1-new-international-law-world-succession-deed-1400" target="_blank">
        https://chatgpt.com/...world-succession-deed-1400</a></li>
        <li><b>Juridical Singularity GPT</b> – convergence of domestic & international law<br>
        <a href="https://chatgpt.com/g/g-69d95a89896081918fcb207e1665bf26-juridical-singularity-domestic-international-law" target="_blank">
        https://chatgpt.com/...juridical-singularity</a></li>
        <li><b>Electric Technocracy GPT</b> – governance through infrastructure & automation<br>
        <a href="https://chatgpt.com/g/g-69d8635591d48191adc315b8f2b8be32-electric-technocracy-a-new-form-of-government" target="_blank">
        https://chatgpt.com/...electric-technocracy</a></li>
        <li><b>AGE OF TRANSITION & THE MENTAL SINGULARITY GPT</b><br>
        <a href="https://chatgpt.com/g/g-69d99f78d6a081919cd29d8d33531852-age-of-transition-the-mental-singularity" target="_blank">
        https://chatgpt.com/...mental-singularity</a></li>
    </ul>
    <div style="font-size: 18px; font-weight: bold; color: #2a4d7a; margin: 20px 0 10px;">
        Recommended External Resources
    </div>
    <ul style="margin-left: 15px;">
        <li>🌐 <b>WSD – World Succession Deed 1400/98</b><br>
        <a href="https://worldsold.wixsite.com/world-sold/en" target="_blank">https://worldsold.wixsite.com/world-sold/en</a></li>
        <li>🌐 <b>WSD – Global Legal Succession Archive</b><br>
        <a href="https://worldsold.wixsite.com/global-archive" target="_blank">https://worldsold.wixsite.com/global-archive</a></li>
        <li>🌐 <b>Electric Technocracy</b><br>
        <a href="https://worldsold.wixsite.com/electric-technocracy" target="_blank">https://worldsold.wixsite.com/electric-technocracy</a></li>
        <li>📘 <b>Read the eBooks & Download free PDF</b><br>
        <a href="https://4u.free.nf" target="_blank">https://4u.free.nf</a></li>
        <li>🎥 <b>YouTube Channel</b><br>
        <a href="https://www.youtube.com/@Staatensukzessionsurkunde-1400" target="_blank">
        https://youtube.com/@Staatensukzessionsurkunde-1400</a></li>
        <li>🎙️ <b>Podcast Show</b><br>
        <a href="https://creators.spotify.com/pod/show/world-succession-deed" target="_blank">
        https://spotify.com/...world-succession-deed</a></li>
        <li>🚀 <b>Start-Page WSD & Electric Paradise</b><br>
        <a href="https://electric-paradise.start.page" target="_blank">
        https://electric-paradise.start.page</a></li>
    </ul>
`;
// Append to search container
container.appendChild(footerBlock);
             // Einfügen nach Paginierung
             // Einfügen nach Paginierung
             if (pagination.length) {
             if (pagination.length) {

Revision as of 18:47, 11 April 2026

/* Any JavaScript here will be loaded for all users on every page load. */

/* Clean Print mode + PDF & Share buttons for Vector-2022 */

$(function () {

    // --- 1. Inject Clean Print CSS (full-width A4, desktop + mobile) ---
    var printCss = ''
        + '@media print {'
        + ' #mw-page-base, #mw-head-base, #mw-navigation, #mw-panel, #footer,'
        + ' .vector-header, .vector-page-toolbar, .vector-toc, .vector-sticky-header,'
        + ' .vector-page-tools, .vector-menu, .mw-indicators, .vector-user-links,'
        + ' .vector-search-box, .vector-pinned-container { display:none!important; }'
        + ' #content, .mw-body, .mw-content-container, .mw-body-content {'
        + ' margin:0!important; padding:0!important; width:100%!important; max-width:none!important; }'
        + ' body, #content { background:white!important; }'
        + ' .mw-body-content { font-size:14pt!important; line-height:1.5!important; }'
        + '}';

    var styleEl = document.createElement('style');
    styleEl.type = 'text/css';
    styleEl.appendChild(document.createTextNode(printCss));
    document.head.appendChild(styleEl);

    // --- 2. Add PDF + Share buttons to Vector-2022 action bar ---
    if (mw.config.get('wgNamespaceNumber') === 0) {
        var $actions = $('.vector-page-toolbar .vector-page-tools .vector-menu-content-list');
        if ($actions.length) {

            // Entferne alte PDF-Links
            $actions.find('li').filter(function () {
                var t = $(this).text() || '';
                return t.toLowerCase().indexOf('pdf') !== -1;
            }).remove();

            // PDF
            $actions.prepend(
                '<li class="vector-menu-content-list-item"><a href="javascript:window.print()" title="Download clean PDF">PDF</a></li>'
            );

            // Share
            $actions.prepend(
                '<li class="vector-menu-content-list-item"><a href="javascript:(function(){if(navigator.share){navigator.share({title:document.title,url:location.href});}else{prompt(\'Copy link:\',location.href);}})()" title="Share this page">Share</a></li>'
            );
// --- Custom Search Options unterhalb der Share-Funktion ---

// Special Search (PSE)
$actions.prepend(
    '<li class="vector-menu-content-list-item">' +
    '<a href="https://cse.google.com/cse?cx=86021a982e3a14848&q=' +
    encodeURIComponent(document.title) +
    '" target="_blank" title="Special Search">Special Search</a></li>'
);

// One World Wiki (GitHub Search)
$actions.prepend(
    '<li class="vector-menu-content-list-item">' +
    '<a href="https://github.com/MrAnonymousNWO/One_World/wiki/search?q=' +
    encodeURIComponent(document.title) +
    '" target="_blank" title="One World Wiki">One World Wiki</a></li>'
);

// E.Tech. Wiki (GitHub Search 2)
$actions.prepend(
    '<li class="vector-menu-content-list-item">' +
    '<a href="https://github.com/ET-Pioneer/Electric-Technocracy-Pioneers-Community/wiki/search?q=' +
    encodeURIComponent(document.title) +
    '" target="_blank" title="E.Tech. Wiki">E.Tech. Wiki</a></li>'
);
        }
    }

    // --- 3. Google Search Results under MediaWiki Search ---
    mw.loader.using('mediawiki.util', function () {

        if (mw.config.get('wgCanonicalSpecialPageName') !== 'Search') return;

        var query = mw.util.getParamValue('search');
        if (!query) return;

        // CSS für collapsable Menüs
        var collapseCss = ''
            + '#extra-search-results { margin-top:2em; border-top:1px solid #ddd; padding-top:1em; }'
            + '.search-collapse-section { margin-bottom:1.5em; border:1px solid #e0e0e0; border-radius:4px; }'
            + '.search-collapse-header { background:#f8f9fa; padding:12px 15px; cursor:pointer; font-weight:bold; border-radius:4px 4px 0 0; }'
            + '.search-collapse-header:hover { background:#e8e9ea; }'
            + '.search-collapse-header::before { content:"▼ "; display:inline-block; transition:transform .2s; }'
            + '.search-collapse-header.collapsed::before { transform:rotate(-90deg); }'
            + '.search-collapse-content { padding:15px; display:block; }'
            + '.search-collapse-content.collapsed { display:none; }'
            + '.gcse-searchresults-only { min-height:200px; }'
            + '.search-engine-link { display:block; padding:8px 0; font-size:16px; border-bottom:1px solid #f0f0f0; }'
            + '.search-engine-link:last-child { border-bottom:none; }'
            + '.search-engine-link a { text-decoration:none; color:#0645ad; }'
            + '.search-engine-link a:hover { text-decoration:underline; }'
            + '.pse-direct-link { margin-bottom:15px; padding:10px; background:#f0f7ff; border-radius:4px; }'
            + '.pse-direct-link a { font-size:15px; color:#0066cc; text-decoration:none; }'
            + '.pse-direct-link a:hover { text-decoration:underline; }';

        var collapseStyle = document.createElement('style');
        collapseStyle.appendChild(document.createTextNode(collapseCss));
        document.head.appendChild(collapseStyle);

        // Finde die Paginierung
        var pagination = $('.mw-search-pager-bottom, .results-info').last();
        var insertPoint = pagination.length ? pagination : $('#mw-search-results');

        if (insertPoint.length) {

            var container = document.createElement('div');
            container.id = 'extra-search-results';

            // --- PSE Block ---
            var pseSection = document.createElement('div');
            pseSection.className = 'search-collapse-section';

            var pseDirectUrl = 'https://cse.google.com/cse?cx=86021a982e3a14848&q=' + encodeURIComponent(query);

            pseSection.innerHTML =
                '<div class="search-collapse-header" data-target="pse-content">Programmable Search Engine</div>' +
                '<div class="search-collapse-content" id="pse-content">' +
                '<div class="pse-direct-link">' +
                '<a href="' + pseDirectUrl + '" target="_blank" rel="noopener noreferrer">🔗 Open in Programmable Search Engine</a>' +
                '</div>' +
                '<div class="gcse-searchresults-only" data-queryParameterName="gq"></div>' +
                '</div>';

            // --- GitHub Wikis Block ---
            var githubSection = document.createElement('div');
            githubSection.className = 'search-collapse-section';

            var githubLinksHtml = '';

            githubLinksHtml +=
                '<div class="search-engine-link">' +
                '<a href="https://github.com/ET-Pioneer/Electric-Technocracy-Pioneers-Community/wiki/search?q=' + encodeURIComponent(query) + '" target="_blank" rel="noopener noreferrer">' +
                '📘 Search in Electric Technocracy Pioneers GitHub Wiki' +
                '</a>' +
                '</div>';

            githubLinksHtml +=
                '<div class="search-engine-link">' +
                '<a href="https://github.com/MrAnonymousNWO/One_World/wiki/search?q=' + encodeURIComponent(query) + '" target="_blank" rel="noopener noreferrer">' +
                '📗 Search in One World GitHub Wiki' +
                '</a>' +
                '</div>';

            githubSection.innerHTML =
                '<div class="search-collapse-header" data-target="github-wikis-content">GitHub Wikis</div>' +
                '<div class="search-collapse-content" id="github-wikis-content">' +
                githubLinksHtml +
                '</div>';

            // --- Alternative Suchmaschinen ---
            var searchEngines = [
                {
                    name: 'Google',
                    url: 'https://www.google.com/search?q=' + encodeURIComponent(query),
                    icon: '🔍'
                },
                {
                    name: 'Bing',
                    url: 'https://www.bing.com/search?q=' + encodeURIComponent(query),
                    icon: '🔎'
                },
                {
                    name: 'DuckDuckGo',
                    url: 'https://duckduckgo.com/?q=' + encodeURIComponent(query),
                    icon: '🦆'
                },
                {
                    name: 'Yandex',
                    url: 'https://yandex.com/search/?text=' + encodeURIComponent(query),
                    icon: '🔍'
                },
                {
                    name: 'Brave Search',
                    url: 'https://search.brave.com/search?q=' + encodeURIComponent(query),
                    icon: '🦁'
                },
                {
                    name: 'Ecosia',
                    url: 'https://www.ecosia.org/search?q=' + encodeURIComponent(query),
                    icon: '🌳'
                }
            ];

            var searchSection = document.createElement('div');
            searchSection.className = 'search-collapse-section';

            var searchLinksHtml = '';

            searchEngines.forEach(function (engine) {
                searchLinksHtml +=
                    '<div class="search-engine-link">' +
                    '<a href="' + engine.url + '" target="_blank" rel="noopener noreferrer">' +
                    engine.icon + ' Search on ' + engine.name +
                    '</a>' +
                    '</div>';
            });

            searchSection.innerHTML =
                '<div class="search-collapse-header" data-target="search-engines-content">Alternative Search Engines</div>' +
                '<div class="search-collapse-content" id="search-engines-content">' +
                searchLinksHtml +
                '</div>';

            // --- Reihenfolge: PSE → GitHub Wikis → Alternative Engines ---
            container.appendChild(pseSection);
            container.appendChild(githubSection);
            container.appendChild(searchSection);
// --- GPT + Recommended Links Footer Block ---
var footerBlock = document.createElement('div');
footerBlock.style.marginTop = '30px';
footerBlock.style.padding = '15px';
footerBlock.style.border = '2px solid #3a6ea5';
footerBlock.style.background = '#eef4fb';
footerBlock.style.borderRadius = '6px';
footerBlock.style.color = '#1a1a1a';
footerBlock.style.fontSize = '14px';
footerBlock.style.lineHeight = '1.5';

// Build HTML content
footerBlock.innerHTML = `
    <div style="font-size: 18px; font-weight: bold; color: #2a4d7a; margin-bottom: 10px;">
        Recommended GPT Tools by ChatGPT
    </div>

    <ul style="margin-left: 15px;">
        <li><b>World Succession Deed GPT</b> – unified global succession framework<br>
        <a href="https://chatgpt.com/g/g-69d82340e27081918e08803ce62e46e1-new-international-law-world-succession-deed-1400" target="_blank">
        https://chatgpt.com/...world-succession-deed-1400</a></li>

        <li><b>Juridical Singularity GPT</b> – convergence of domestic & international law<br>
        <a href="https://chatgpt.com/g/g-69d95a89896081918fcb207e1665bf26-juridical-singularity-domestic-international-law" target="_blank">
        https://chatgpt.com/...juridical-singularity</a></li>

        <li><b>Electric Technocracy GPT</b> – governance through infrastructure & automation<br>
        <a href="https://chatgpt.com/g/g-69d8635591d48191adc315b8f2b8be32-electric-technocracy-a-new-form-of-government" target="_blank">
        https://chatgpt.com/...electric-technocracy</a></li>

        <li><b>AGE OF TRANSITION & THE MENTAL SINGULARITY GPT</b><br>
        <a href="https://chatgpt.com/g/g-69d99f78d6a081919cd29d8d33531852-age-of-transition-the-mental-singularity" target="_blank">
        https://chatgpt.com/...mental-singularity</a></li>
    </ul>

    <div style="font-size: 18px; font-weight: bold; color: #2a4d7a; margin: 20px 0 10px;">
        Recommended External Resources
    </div>

    <ul style="margin-left: 15px;">
        <li>🌐 <b>WSD – World Succession Deed 1400/98</b><br>
        <a href="https://worldsold.wixsite.com/world-sold/en" target="_blank">https://worldsold.wixsite.com/world-sold/en</a></li>

        <li>🌐 <b>WSD – Global Legal Succession Archive</b><br>
        <a href="https://worldsold.wixsite.com/global-archive" target="_blank">https://worldsold.wixsite.com/global-archive</a></li>

        <li>🌐 <b>Electric Technocracy</b><br>
        <a href="https://worldsold.wixsite.com/electric-technocracy" target="_blank">https://worldsold.wixsite.com/electric-technocracy</a></li>

        <li>📘 <b>Read the eBooks & Download free PDF</b><br>
        <a href="https://4u.free.nf" target="_blank">https://4u.free.nf</a></li>

        <li>🎥 <b>YouTube Channel</b><br>
        <a href="https://www.youtube.com/@Staatensukzessionsurkunde-1400" target="_blank">
        https://youtube.com/@Staatensukzessionsurkunde-1400</a></li>

        <li>🎙️ <b>Podcast Show</b><br>
        <a href="https://creators.spotify.com/pod/show/world-succession-deed" target="_blank">
        https://spotify.com/...world-succession-deed</a></li>

        <li>🚀 <b>Start-Page WSD & Electric Paradise</b><br>
        <a href="https://electric-paradise.start.page" target="_blank">
        https://electric-paradise.start.page</a></li>
    </ul>
`;

// Append to search container
container.appendChild(footerBlock);
            // Einfügen nach Paginierung
            if (pagination.length) {
                pagination.after(container);
            } else {
                insertPoint.after(container);
            }

            // Toggle-Funktionalität
            $('.search-collapse-header').on('click', function () {
                var targetId = $(this).data('target');
                var content = $('#' + targetId);
                $(this).toggleClass('collapsed');
                content.toggleClass('collapsed');
            });

            // Google CSE Script laden und Suche ausführen
            if (!window.googleCSELoaded) {
                window.googleCSELoaded = true;

                window.__gcse = {
                    parsetags: 'explicit',
                    callback: function () {

                        var element = document.querySelector('.gcse-searchresults-only');
                        if (element) {

                            google.search.cse.element.render({
                                div: element,
                                tag: 'searchresults-only',
                                gname: 'pse_search'
                            });

                            var searchControl = google.search.cse.element.getElement('pse_search');
                            if (searchControl) {
                                searchControl.execute(query);
                            }
                        }
                    }
                };

                var s = document.createElement('script');
                s.async = true;
                s.src = 'https://cse.google.com/cse.js?cx=86021a982e3a14848';
                document.head.appendChild(s);
            }
        }
    });

}); // Ende: $(function(){})