Jump to content

User:Omegatron/monobook.js/personalSidebar.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Move the personal links to the sidebar
// Originally from  http://meta.wikimedia.org/wiki/Help:User_styles#Make_the_user_toolbar_a_sidebox

// Make sure the page structure is compatible with the CSS
$(function () {
    content = document.getElementById("column-one");	// Find the main content column

    // Move the personal links into the side column (in case they have been moved elsewhere)
    personal = document.getElementById("p-personal");   // Find the personal links list
    personal.parentNode.removeChild(personal);          // Remove the personal links list from the content column
    content.insertBefore(personal,document.getElementById('p-logo').nextSibling);  // Place personal links list after the logo
});

// Include style sheet inline so that script is self-contained:
document.write('<style type="text/css">' +
'   /* Transform the user toolbar into a sidebox */                         '+
'                                                                           '+
'   #p-personal {                                                           '+
'       position:relative;                                                  '+
'       z-index:3;                                                          '+
'       width: 11.6em;                                                      '+
'   }                                                                       '+
'                                                                           '+
'   #p-personal .pBody {                                                    '+
'       width: 10.7em;                                                      '+
'       border: none;                                                       '+
'       margin: 0 0 0.1em 0em;                                              '+
'       float: none;                                                        '+
'       overflow: hidden;                                                   '+
'       font-size: 95%;                                                     '+
'       background: White;                                                  '+
'       border-collapse: collapse;                                          '+
'       border: 1px solid #aaaaaa;                                          '+
'       padding: 0 0.8em 0.3em .5em;                                        '+
'   }                                                                       '+
'                                                                           '+
'   #p-personal ul {                                                        '+
'      /* line-height: 1em !important; */                                   '+
'       line-height: inherit;                                               '+
'       list-style-type: square;                                            '+    
'       list-style-image: url("/style/monobook/bullet.gif");                '+
'       font-size:95%;                                                      '+
'       padding:0;                                                          '+
'       text-align:left;                                                    '+
'       text-transform: none;                                               '+
'       margin: 0 0 0 1em;                                                  '+
'   }                                                                       '+
'                                                                           '+
'   #p-personal li {                                                        '+
'       display: list-item;                                                 '+
'       line-height: 1em;                                                   '+
'       padding:0;                                                          '+
'       margin: 0 0 0 0;                                                    '+
'       font-size:95%                                                       '+
'   }                                                                       '+
'                                                                           '+
'   #p-personal h5 {                                                        '+
'       display: inline;                                                    '+
'       padding: 0em 1em 0em 0.5em;                                         '+
'   }                                                                       '+
'                                                                           '+
'   #p-personal a {                                                         '+
'       display: block;                                                     '+
'   }                                                                       '+
'                                                                           '+
'   li#pt-userpage {        /* Suppress the person icon by your username */ '+
'       background: none;                                                   '+
'   }                                                                       '+
'                                                                           '+
'<'+'/style>');