User:Ntrrgc/vector.js

$(function {  var panelShown = false;

// Remove Wikipedia picture $('#p-logo').remove;

// Create title button var titleButton = $(" ", {id: 'custom-title'}); $("#mw-head").prepend(titleButton);

// Add gradient decorations to menu $("#mw-panel").prepend($(" ", {class: 'border-gradient left'}),                        $(" ", {class: 'border-gradient right'}));

// Show function var showMenu = function { var targetPosition = { 'top': titleButton.offset.top + titleButton.height, 'left': titleButton.offset.left };     // Hook window resize event $(window).on("resize.customVector", function {        $("#mw-panel").css('left', titleButton.offset.left);      }); $("#mw-panel") .css(targetPosition) .fadeIn(200); panelShown = true; };

// Hide function var hideMenu = function { $("#mw-panel").fadeOut(200); panelShown = false; $(window).off("resize.customVector"); };

// Attach click event to title button titleButton.click(function(event) {     event.stopPropagation;

if (panelShown) { hideMenu; } else { showMenu; }  });

// Bind click event to document so it closes the popup $('html').click(function(event) {     if (panelShown) {         hideMenu;      }   });

// Bind click event in menu so menu is not hidden when an option is clicked $('#mw-panel').click(function(event) {     event.stopPropagation;   }); });