Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Friction Design Archive

This archive collects Tactics, Patterns, Models, Taxonomies, Toolkits, Archetypes, Principles, Symptoms, Philosophies, Manifestos, and Emerging Approaches related to Friction Design.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
Tag: Reverted
No edit summary
 
(16 intermediate revisions by the same user not shown)
Line 62: Line 62:




//test site notice
/* Inject Unloop Banner at the very top of the page */
/* Inject Unloop Banner above everything */
$(document).ready(function() {
(function() {
     // Check if it already exists to prevent double-injection
     var banner = document.createElement('div');
    if ($('#unloop-symposium-banner').length === 0) {
    banner.id = 'unloop-symposium-banner';
        var banner = document.createElement('div');
    banner.innerHTML = '<strong>UNLOOP SYMPOSIUM:</strong> June 26, 2026 — <a href="https://frictiondesign.fba.up.pt/unloop/" style="color: inherit; text-decoration: underline;">Visit the page</a>';
        banner.id = 'unloop-symposium-banner';
   
       
    // Style it directly for high priority
        banner.innerHTML = 'Friction Design Archive is under construction, please pardon our dust.<br>' +
    banner.style.cssText = 'background: #00ff00; color: #143109; text-align: center; padding: 12px; font-family: "Hanken Grotesk", sans-serif; font-size: 14px; position: relative; border-bottom: 1px solid #143109;';
            '<a href="https://frictiondesign.fba.up.pt/unloop/" style="color: inherit; text-decoration: underline;">' +
   
            'Meanwhile, check <strong>UNLOOP SYMPOSIUM:</strong> June 26, 2026!' +
    // This places it at the absolute top of the <body>
            '</a>';
    document.body.prepend(banner);
       
})();
        banner.style.cssText = 'background: #00ff00; color: #143109; text-align: center; padding: 15px; font-family: "Hanken Grotesk", sans-serif; font-size: 14px; line-height: 1.5; position: relative; width: 100%; box-sizing: border-box;';
       
        $('body').prepend(banner);
    }
});

Latest revision as of 21:12, 9 February 2026

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

// Test if JavaScript is loading
console.log('MediaWiki:Common.js is loaded!');

// Wait for the document to be fully ready
jQuery(function($) {
    // Check if the button exists on the page
    var button = document.getElementById('trigger-citizen-search');
    if (!button) {
        console.log('Search button not found.');
        return;
    }

    // Add the click event listener
    button.addEventListener('click', function() {
        console.log('Search button was clicked!'); // Check if this appears in console

        // Try multiple possible selectors for the Citizen search trigger
        var selectors = [
            '#citizen-search-details summary',
            '.citizen-search-trigger',
            '.citizen-search__button',
            '[title*="earch"]' // Matches elements with "search" in the title
        ];

        var triggerClicked = false;
        for (var i = 0; i < selectors.length; i++) {
            var element = document.querySelector(selectors[i]);
            if (element) {
                console.log('Found trigger with selector:', selectors[i]);
                element.click();
                triggerClicked = true;
                break; // Stop after the first successful click
            }
        }

        // Fallback if no trigger was found
        if (!triggerClicked) {
            console.log('No search trigger found. Falling back to search page.');
            window.location.href = mw.config.get('wgScriptPath') + '/Special:Search';
        }
    });
});

//Homepage About Button

$( function() {
    mw.loader.using( 'oojs-ui' ).then( function() {
        var aboutButton = new OO.ui.ButtonWidget( {
            label: 'MORE ABOUT THIS PROJECT',
            href: 'https://frictiondesign.fba.up.pt/mediawiki/index.php/Frictiondesign:About',
            target: '_self',
            flags: [ 'progressive' ],
            classes: [ 'fda-hero-button' ]
        } );
        
        // Append to your specific container
        $( '#fda-button-container' ).append( aboutButton.$element );
    } );
} );


/* Inject Unloop Banner at the very top of the page */
$(document).ready(function() {
    // Check if it already exists to prevent double-injection
    if ($('#unloop-symposium-banner').length === 0) {
        var banner = document.createElement('div');
        banner.id = 'unloop-symposium-banner';
        
        banner.innerHTML = 'Friction Design Archive is under construction, please pardon our dust.<br>' +
            '<a href="https://frictiondesign.fba.up.pt/unloop/" style="color: inherit; text-decoration: underline;">' +
            'Meanwhile, check <strong>UNLOOP SYMPOSIUM:</strong> June 26, 2026!' +
            '</a>';
        
        banner.style.cssText = 'background: #00ff00; color: #143109; text-align: center; padding: 15px; font-family: "Hanken Grotesk", sans-serif; font-size: 14px; line-height: 1.5; position: relative; width: 100%; box-sizing: border-box;';
        
        $('body').prepend(banner);
    }
});