User:Gauransh Dingwani/common.js

function loadScripts(scripts) { console.log("here") var deferreds = []; $.each(scripts, function (i, script) {		// External script, use $.getScript		if (script.match(/^(https?:|\/\/)/)) {			deferreds.push($.getScript(script));		// Use mw.using, convert callbacks to Deferreds		} else {			var d = $.Deferred;			// TODO: make only one mw.loader.using call, passing an array of module names			mw.loader.using(script, d.resolve, d.reject);			deferreds.push(d);		}	}); return $.when.apply($, deferreds); }

var requires = [ 'oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-toolbars', 'oojs-ui-windows', 'oojs-ui.styles.icons-interactions', ];

loadScripts(requires).done(function {

hasContents = $( '.toc').length > 0; numContent = $('.toclevel-1').length;

console.log(hasContents) console.log(numContent)

$(".toclevel-1").each(function {   console.log($(this).html.firstChild); }); var button = new OO.ui.ButtonMenuSelectWidget( {	icon: 'menu',	label: 'Options',	menu: {		items: [			new OO.ui.MenuOptionWidget( { data: 'a', label: 'First' } ),			new OO.ui.MenuOptionWidget( { data: 'b', label: 'Second', indicator: 'clear' } ),			new OO.ui.MenuOptionWidget( { data: 'c', label: 'Third' } ),			new OO.ui.MenuOptionWidget( { data: 'c', label: 'The fourth option has an overly long label' } ),			new OO.ui.MenuOptionWidget( { icon: 'feedback', data: 'd', label: 'The fifth option has an icon' } )		]	} } )   $('#mw-content-text').append(button.$element) } );

// When using the `clearOnSelect` option, listen to the `choose` event // to avoid getting the null select event. // buttonMenu.getMenu.on( 'choose', function ( menuOption ) { //   console.log( menuOption.getData ); // } ); // });