Page MenuHomeWickedGov Phorge

init.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
const
Vue = require( 'vue' ),
{ createPinia } = require( 'pinia' ),
App = require( './components/App.vue' ),
config = require( './config.json' );
/**
* Initialize the command palette
*
* @return {void}
*/
function initApp() {
const teleportTarget = require( 'mediawiki.page.ready' ).teleportTarget;
// We can't mount directly to the teleportTarget or it will break OOUI overlays
const overlay = document.createElement( 'div' );
overlay.classList.add( 'citizen-command-palette-overlay' );
teleportTarget.appendChild( overlay );
const app = Vue.createMwApp( App, {}, config );
const pinia = createPinia();
app.use( pinia );
const commandPalette = app.mount( overlay );
registerButton( commandPalette );
}
/**
* Setup the button to open the command palette
* This is very hacky, but it works for now.
*
* @param {Vue} commandPalette
* @return {void}
*/
function registerButton( commandPalette ) {
const details = document.getElementById( 'citizen-search-details' );
// Remove the search card from the DOM so it won't be triggered by the button
document.getElementById( 'citizen-search__card' )?.remove();
details.open = false;
details.addEventListener( 'click', () => {
commandPalette.open();
} );
}
initApp();

File Metadata

Mime Type
text/plain
Expires
Wed, Aug 19, 03:53 (6 d, 9 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
72/07/854239d8a1d1e76d9c8b0f17924c
Default Alt Text
init.js (1 KB)

Event Timeline