User:A. Amritesh/common.js

// importScript('User:SSethi (WMF)/Sandbox/SimpleUserScriptExamples.js'); mw.loader.using( 'oojs-ui-widgets' ).done(function{ var buttonIcon = new OO.ui.ButtonWidget( { icon: 'upTriangle', title: 'Up', classes:[ 'my-button'] } );   $( '#mw-content-text' ).after(buttonIcon.$element ); // buttonIcon.setIcon( 'upTriangle' ); $('.my-button').css('float','right'); $('.my-button').css('padding','0.5em 0em'); buttonIcon.on('click', function{$(window).scrollTop(0);}); // .onClick(document.getElementById(firstHeading).focus({preventScroll:false})) }); mw.loader.using( 'oojs-ui-widgets' ).done(function{ var toggleSwitch = new OO.ui.PopupButtonWidget({ label: 'Dark Focus', classes:[ 'my-togglebtn'], popup: { $content: $( ' Reload to disable. ' ), padded: true, align: 'forwards' } });

$('#bodyContent').prepend( toggleSwitch.$element ); $('.my-togglebtn').css('float','right'); $('.my-togglebtn').css('padding','0.5em 0em'); toggleSwitch.on('click',function focus{	$('.my-togglebtn').css('background-color','black');	$('.my-togglebtn').css('color','white');	$("p").on({ mouseenter: function{ $(this).css("background-color", "black"); $(this).css("color", "white"); }, mouseleave: function{ $(this).css("background-color", "white"); $(this).css("color", "black"); }	});

$("pre,code,table").on({ mouseenter: function{    $(this).css("background-color", "black");    $(this).css("color", "white");  },  mouseleave: function{    $(this).css("background-color", "#f8f9fa");    $(this).css("color", "black");    }  }); } ); });