MediaWiki:CRT Search.js: Difference between revisions
No edit summary |
No edit summary Tag: Manual revert |
||
| (20 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
/** | /** | ||
* EveryCRT | * EveryCRT CRT Search — page-specific configuration | ||
* Loads the shared search engine and passes CRT-specific filters, printouts, and card layout. | |||
* | |||
*/ | */ | ||
(function() { | (function() { | ||
'use strict'; | 'use strict'; | ||
mw.loader.getScript( | |||
mw.config.get('wgScript') + '?title=MediaWiki:EveryCRT-SearchEngine.js&action=raw&ctype=text/javascript' | |||
).then(function() { | |||
window.EveryCRTSearch({ | |||
containerId: 'advanced-search-app', | |||
category: 'CRT models', | |||
resultLabel: 'CRTs', | |||
noImageEmoji: '\uD83D\uDCFA', | |||
subobjectParentProperty: 'Has CRT model', | |||
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: 'screen_size', label: 'Screen Size', property: 'Has screen size inches', printoutKey: 'size' }, | |||
{ value: 'type', label: 'Type', property: 'Has CRT type', printoutKey: 'type' } | |||
], | |||
// ── Extra printouts (image, brand, model are always included) ── | |||
printouts: [ | |||
{ property: 'Has CRT type', key: 'type' }, | |||
{ property: 'Has screen size inches', key: 'size' }, | |||
{ property: 'Has aspect ratio', key: 'aspect' }, | |||
{ property: 'Has TVL', key: 'tvl' } | |||
], | |||
// ── Card meta fields ─────────────────────────────────── | |||
cardMeta: [ | |||
{ key: 'type', cssClass: 'crt-meta-type' }, | |||
{ key: 'size', cssClass: 'crt-meta-size', suffix: '"' }, | |||
{ key: 'aspect', cssClass: 'crt-meta-aspect' }, | |||
{ key: 'tvl', cssClass: 'crt-meta-tvl', suffix: ' TVL' } | |||
], | |||
// ── Filter configuration ─────────────────────────────── | |||
filterConfig: { | |||
manufacturing: { | |||
label: 'Manufacturing', | |||
collapsed: false, | |||
filters: { | |||
brand: { | |||
label: 'Brand', | |||
type: 'select', | |||
property: 'Has brand', | |||
loadFrom: 'category', | |||
category: 'Manufacturers' | |||
}, | |||
oem: { | |||
label: 'OEM Manufacturer', | |||
type: 'select', | |||
property: 'Has OEM manufacturer', | |||
loadFrom: 'category', | |||
category: 'Manufacturers' | |||
}, | |||
series: { | |||
label: 'Series', | |||
type: 'select', | |||
property: 'Has series', | |||
loadFrom: 'category', | |||
category: 'Series' | |||
}, | |||
chassis: { | |||
label: 'Chassis', | |||
type: 'select', | |||
property: 'Has chassis', | |||
loadFrom: 'category', | |||
category: 'Chassis' | |||
}, | |||
chassis_family: { | |||
label: 'Chassis Family', | |||
type: 'select', | |||
property: 'Has chassis family', | |||
loadFrom: 'category', | |||
category: 'Chassis families' | |||
} | |||
} | } | ||
} | }, | ||
display: { | |||
label: 'Display', | |||
collapsed: false, | |||
filters: { | |||
crt_type: { | |||
label: 'Type', | |||
type: 'select', | |||
property: 'Has CRT type', | |||
loadFrom: 'category', | |||
category: 'CRT types', | |||
categoryMemberTypes: 'subcat' | |||
}, | |||
form_factor: { | |||
label: 'Form Factor', | |||
type: 'select', | |||
property: 'Has form factor', | |||
loadFrom: 'static', | |||
values: ['Standard', 'Console', 'Portable', 'Wall-mount', 'Other'] | |||
}, | |||
screen_size_min: { | |||
label: 'Screen Size (min)', | |||
type: 'number', | |||
property: 'Has screen size inches', | |||
comparison: '>=', | |||
placeholder: 'Min inches' | |||
}, | |||
screen_size_max: { | |||
label: 'Screen Size (max)', | |||
type: 'number', | |||
property: 'Has screen size inches', | |||
comparison: '<=', | |||
placeholder: 'Max inches' | |||
}, | |||
aspect_ratio: { | |||
label: 'Aspect Ratio', | |||
type: 'select', | |||
property: 'Has aspect ratio', | |||
loadFrom: 'static', | |||
values: ['4:3', '16:9'] | |||
}, | |||
tvl_min: { | |||
label: 'TVL (min)', | |||
type: 'number', | |||
property: 'Has TVL', | |||
comparison: '>=', | |||
placeholder: 'Min lines' | |||
} | |||
} | |||
} | } | ||
} | }, | ||
videoSpecs: { | |||
label: 'Video Specifications', | |||
collapsed: true, | |||
filters: { | |||
signal_format: { | |||
label: 'Signal Format', | |||
type: 'multiselect', | |||
subobjectQuery: true, | |||
subobjectProperty: 'Has video signal format', | |||
loadFrom: 'category', | |||
category: 'Video signal formats' | |||
}, | |||
connector: { | |||
label: 'Connector', | |||
type: 'multiselect', | |||
subobjectQuery: true, | |||
subobjectProperty: 'Has connector type', | |||
loadFrom: 'category', | |||
category: 'Connector types' | |||
} | |||
} | |||
} | } | ||
}, | |||
mods: { | |||
label: 'Modifications', | |||
collapsed: true, | |||
filters: { | |||
has_rgb_mod: { | |||
} | label: 'Has RGB Mod', | ||
type: 'checkbox', | |||
subobjectQuery: true, | |||
subobjectProperty: 'Has mod type', | |||
subobjectValue: 'RGB', | |||
subobjectExtraCondition: '[[Has mod feasible::Yes]]' | |||
}, | |||
has_svideo_mod: { | |||
label: 'Has S-Video Mod', | |||
type: 'checkbox', | |||
subobjectQuery: true, | |||
subobjectProperty: 'Has mod type', | |||
subobjectValue: 'S-video', | |||
subobjectExtraCondition: '[[Has mod feasible::Yes]]' | |||
} | |||
} | } | ||
} | }, | ||
tvSystem: { | |||
label: 'TV System', | |||
collapsed: true, | |||
filters: { | |||
av_system: { | |||
label: 'AV System', | |||
type: 'multiselect', | |||
property: 'AV system', | |||
loadFrom: 'category', | |||
category: 'AV systems' | |||
}, | |||
frequency: { | |||
label: 'AC Frequency', | |||
type: 'multiselect', | |||
property: 'Frequency', | |||
loadFrom: 'static', | |||
values: ['50Hz', '60Hz'] | |||
} | |||
} | } | ||
} | }, | ||
builtIn: { | |||
label: 'Built-in Devices', | |||
collapsed: true, | |||
filters: { | |||
built_in_vcr: { | |||
label: 'VCR', | |||
type: 'checkbox', | |||
property: 'Has built-in devices', | |||
containsValue: 'VCR' | |||
}, | |||
built_in_dvd: { | |||
label: 'DVD', | |||
type: 'checkbox', | |||
property: 'Has built-in devices', | |||
containsValue: 'DVD' | |||
} | |||
} | } | ||
} | } | ||
} | } | ||
}); | }); | ||
}, function(error) { | |||
console.error('Failed to load EveryCRT search engine:', error); | |||
var el = document.getElementById('advanced-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>'; | |||
if ( | |||
'< | |||
'< | |||
} | } | ||
}); | |||
} | |||
})(); | })(); | ||
Latest revision as of 21:42, 27 February 2026
/**
* EveryCRT CRT Search — page-specific configuration
* Loads the shared search engine and passes CRT-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: 'advanced-search-app',
category: 'CRT models',
resultLabel: 'CRTs',
noImageEmoji: '\uD83D\uDCFA',
subobjectParentProperty: 'Has CRT model',
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: 'screen_size', label: 'Screen Size', property: 'Has screen size inches', printoutKey: 'size' },
{ value: 'type', label: 'Type', property: 'Has CRT type', printoutKey: 'type' }
],
// ── Extra printouts (image, brand, model are always included) ──
printouts: [
{ property: 'Has CRT type', key: 'type' },
{ property: 'Has screen size inches', key: 'size' },
{ property: 'Has aspect ratio', key: 'aspect' },
{ property: 'Has TVL', key: 'tvl' }
],
// ── Card meta fields ───────────────────────────────────
cardMeta: [
{ key: 'type', cssClass: 'crt-meta-type' },
{ key: 'size', cssClass: 'crt-meta-size', suffix: '"' },
{ key: 'aspect', cssClass: 'crt-meta-aspect' },
{ key: 'tvl', cssClass: 'crt-meta-tvl', suffix: ' TVL' }
],
// ── Filter configuration ───────────────────────────────
filterConfig: {
manufacturing: {
label: 'Manufacturing',
collapsed: false,
filters: {
brand: {
label: 'Brand',
type: 'select',
property: 'Has brand',
loadFrom: 'category',
category: 'Manufacturers'
},
oem: {
label: 'OEM Manufacturer',
type: 'select',
property: 'Has OEM manufacturer',
loadFrom: 'category',
category: 'Manufacturers'
},
series: {
label: 'Series',
type: 'select',
property: 'Has series',
loadFrom: 'category',
category: 'Series'
},
chassis: {
label: 'Chassis',
type: 'select',
property: 'Has chassis',
loadFrom: 'category',
category: 'Chassis'
},
chassis_family: {
label: 'Chassis Family',
type: 'select',
property: 'Has chassis family',
loadFrom: 'category',
category: 'Chassis families'
}
}
},
display: {
label: 'Display',
collapsed: false,
filters: {
crt_type: {
label: 'Type',
type: 'select',
property: 'Has CRT type',
loadFrom: 'category',
category: 'CRT types',
categoryMemberTypes: 'subcat'
},
form_factor: {
label: 'Form Factor',
type: 'select',
property: 'Has form factor',
loadFrom: 'static',
values: ['Standard', 'Console', 'Portable', 'Wall-mount', 'Other']
},
screen_size_min: {
label: 'Screen Size (min)',
type: 'number',
property: 'Has screen size inches',
comparison: '>=',
placeholder: 'Min inches'
},
screen_size_max: {
label: 'Screen Size (max)',
type: 'number',
property: 'Has screen size inches',
comparison: '<=',
placeholder: 'Max inches'
},
aspect_ratio: {
label: 'Aspect Ratio',
type: 'select',
property: 'Has aspect ratio',
loadFrom: 'static',
values: ['4:3', '16:9']
},
tvl_min: {
label: 'TVL (min)',
type: 'number',
property: 'Has TVL',
comparison: '>=',
placeholder: 'Min lines'
}
}
},
videoSpecs: {
label: 'Video Specifications',
collapsed: true,
filters: {
signal_format: {
label: 'Signal Format',
type: 'multiselect',
subobjectQuery: true,
subobjectProperty: 'Has video signal format',
loadFrom: 'category',
category: 'Video signal formats'
},
connector: {
label: 'Connector',
type: 'multiselect',
subobjectQuery: true,
subobjectProperty: 'Has connector type',
loadFrom: 'category',
category: 'Connector types'
}
}
},
mods: {
label: 'Modifications',
collapsed: true,
filters: {
has_rgb_mod: {
label: 'Has RGB Mod',
type: 'checkbox',
subobjectQuery: true,
subobjectProperty: 'Has mod type',
subobjectValue: 'RGB',
subobjectExtraCondition: '[[Has mod feasible::Yes]]'
},
has_svideo_mod: {
label: 'Has S-Video Mod',
type: 'checkbox',
subobjectQuery: true,
subobjectProperty: 'Has mod type',
subobjectValue: 'S-video',
subobjectExtraCondition: '[[Has mod feasible::Yes]]'
}
}
},
tvSystem: {
label: 'TV System',
collapsed: true,
filters: {
av_system: {
label: 'AV System',
type: 'multiselect',
property: 'AV system',
loadFrom: 'category',
category: 'AV systems'
},
frequency: {
label: 'AC Frequency',
type: 'multiselect',
property: 'Frequency',
loadFrom: 'static',
values: ['50Hz', '60Hz']
}
}
},
builtIn: {
label: 'Built-in Devices',
collapsed: true,
filters: {
built_in_vcr: {
label: 'VCR',
type: 'checkbox',
property: 'Has built-in devices',
containsValue: 'VCR'
},
built_in_dvd: {
label: 'DVD',
type: 'checkbox',
property: 'Has built-in devices',
containsValue: 'DVD'
}
}
}
}
});
}, function(error) {
console.error('Failed to load EveryCRT search engine:', error);
var el = document.getElementById('advanced-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>';
}
});
})();