User:Monster Domosed/common.js: Difference between revisions

No edit summary
No edit summary
Line 2: Line 2:
( function () {
( function () {
'use strict';
'use strict';
console.log('[PatchFormatter] script loaded');


var L = '{' + '{';
var L = '{' + '{';
Line 158: Line 156:
// ---- OUTPUT ---------------------------------------------------------
// ---- OUTPUT ---------------------------------------------------------
function buildOutput( entries, heroes, abilities, items, gameModes ) {
function buildOutput( entries, heroes, abilities, items, gameModes ) {
console.log('[PatchFormatter] buildOutput');


var general = [];
var general = [];
Line 263: Line 259:
// ---- INIT -----------------------------------------------------------
// ---- INIT -----------------------------------------------------------
function init() {
function init() {
console.log('[PatchFormatter] init');


var app = document.getElementById( 'patchformatter' );
var app = document.getElementById( 'patchformatter' );


if ( !app ) {
if ( !app ) {
console.error('[PatchFormatter] container not found');
return;
return;
}
}
Line 294: Line 287:
var status = new OO.ui.LabelWidget();
var status = new OO.ui.LabelWidget();


var container = document.createElement('div');
var container = document.createElement( 'div' );


container.appendChild( inputWidget.$element[ 0 ] );
container.appendChild( inputWidget.$element[ 0 ] );
Line 334: Line 327:
} ).catch( function ( e ) {
} ).catch( function ( e ) {


console.error('[PatchFormatter] ERROR', e);
status.setLabel( 'Error' );
status.setLabel( 'Error' );


Line 350: Line 342:
}
}


// ---- BOOT -----------------------------------------------------------
mw.loader.using( [
mw.loader.using( [
'oojs-ui-core',
'oojs-ui-core',
Line 357: Line 348:
'mediawiki.util'
'mediawiki.util'
] ).then( function () {
] ).then( function () {
console.log('[PatchFormatter] loader OK');
init();
init();
} ).catch( function ( e ) {
console.error('[PatchFormatter] LOADER FAILED', e);
} );
} );