No edit summary
No edit summary
 
Line 35: Line 35:
             cardMeta: [
             cardMeta: [
                 { key: 'device_type',  cssClass: 'crt-meta-type' },
                 { key: 'device_type',  cssClass: 'crt-meta-type' },
                 { key: 'format_family' },
                 { key: 'format_family' }
                { key: 'supported_formats' }
             ],
             ],



Latest revision as of 01:42, 1 March 2026

/**
 * EveryCRT AV Device Search — page-specific configuration
 * Loads the shared search engine and passes AV device-specific filters, printouts, and card layout.
 */
(function() {
    'use strict';

    mw.loader.getScript(
        mw.config.get('wgScript') + '?title=MediaWiki:EveryCRT-SearchEngine.js&action=raw&ctype=text/javascript'
    ).then(function() {

        window.EveryCRTSearch({

            containerId: 'av-search-app',
            category: 'AV devices',
            resultLabel: 'devices',
            noImageEmoji: '\uD83D\uDCFC',
            defaultSort: 'brand',

            // ── Sort options ───────────────────────────────────────
            sortOptions: [
                { value: 'brand',       label: 'Brand',       property: 'Has brand',       printoutKey: 'brand' },
                { value: 'model',       label: 'Model',       property: 'Has model code',  printoutKey: 'model' },
                { value: 'device_type', label: 'Device Type', property: 'Has device type', printoutKey: 'device_type' }
            ],

            // ── Extra printouts (image, brand, model are always included) ──
            printouts: [
                { property: 'Has device type',   key: 'device_type' },
                { property: 'Has format family', key: 'format_family' },
                { property: 'Has supported formats',  key: 'supported_formats' }
            ],

            // ── Card meta fields ───────────────────────────────────
            cardMeta: [
                { key: 'device_type',   cssClass: 'crt-meta-type' },
                { key: 'format_family' }
            ],

            // ── Filter configuration ───────────────────────────────
            filterConfig: {
                general: {
                    label: 'General',
                    collapsed: false,
                    filters: {
                        brand: {
                            label: 'Brand',
                            type: 'select',
                            property: 'Has brand',
                            loadFrom: 'smw',
                            smwQuery: '[[Is AV brand category::Yes]]',
                            smwProperty: 'Brand name'
                        },
                        device_type: {
                            label: 'Device Type',
                            type: 'select',
                            property: 'Has device type',
                            loadFrom: 'smw',
                            smwQuery: '[[Is AV device type category::Yes]]',
                            smwProperty: 'Device type name'
                        },
                        format_family: {
                            label: 'Format Family',
                            type: 'select',
                            property: 'Has format family',
                            loadFrom: 'smw',
                            smwQuery: '[[Category:AV devices]][[Has format family::+]]',
                            smwProperty: 'Has format family'
                        },
                        plays: {
                            label: 'Plays',
                            type: 'select',
                            property: 'Has supported formats',
                            loadFrom: 'smw',
                            smwQuery: '[[Category:AV devices]][[Has supported formats::+]]',
                            smwProperty: 'Has supported formats'
                        }
                    }
                },
                tbc: {
                    label: 'TBC Capabilities',
                    collapsed: false,
                    filters: {
                        has_line_tbc: {
                            label: 'Line TBC',
                            type: 'checkbox',
                            property: 'TBC type',
                            containsValue: 'Line TBC'
                        },
                        has_frame_tbc: {
                            label: 'Frame synchronizer',
                            type: 'checkbox',
                            property: 'TBC type',
                            containsValue: 'Frame synchronizer'
                        }
                    }
                }
            }

        });

    }, function(error) {
        console.error('Failed to load EveryCRT search engine:', error);
        var el = document.getElementById('av-search-app');
        if (el) {
            el.innerHTML = '<div style="text-align:center;padding:64px;background:#2a2a2e;border-radius:12px;">' +
                '<p style="font-size:18px;color:#ddd;">Failed to load search engine.</p>' +
                '<p style="color:#888;font-size:13px;margin-top:12px;">Please try refreshing the page.</p></div>';
        }
    });

})();
MediaWiki Appliance - Powered by TurnKey Linux