מדיה ויקי:Gadget-moveVectorMenuToTabs.js: הבדלים בין גרסאות בדף

for vector skin: replace the links in the dropdown menu with regular tabs and hide the menu
 
מ 9 גרסאות של הדף wikipedia:he:מדיה_ויקי:Gadget-moveVectorMenuToTabs.js יובאו
 
(8 גרסאות ביניים של 2 משתמשים אינן מוצגות)
שורה 1: שורה 1:
// for vector skin: replace the links in the dropdown menu with regular tabs and hide the menu
// for vector skin: replace the links in the dropdown menu with regular tabs and hide the menu
// written by [[user:Mikimik]]
// written by [[user:Mikimik]]
function moveVectorMenuToTabs()
$(function() {
{
function doit() {
try {
$( '#p-cactions li a' ).wrap( '<span>' );
    var cactions = document.getElementById("p-cactions");
$( '#p-cactions li' ).insertAfter( $( '#ca-js-delete, #ca-js-block, #ca-watch, #ca-unwatch' ).eq( 0 ) );
    var place = document.getElementById("ca-js-delete") || document.getElementById("ca-js-block") || document.getElementById("ca-watch");
$('#p-cactions').toggle( false );
    if ( !cactions  || !cactions.className == "vectorMenu" || !place ) return;
}
 
doit();
    var item = cactions.getElementsByTagName("LI")[0];
$( document ).on( 'new-portlet-link', doit );
    while ( item && item.firstChild.nodeName == "A" )
});
    {
        if ( item.firstChild.firstChild.nodeName == "#text" )
        {
            var span = document.createElement("SPAN");
            span.appendChild ( document.createTextNode(item.firstChild.firstChild.nodeValue) );
            item.firstChild.replaceChild ( span, item.firstChild.firstChild );
        }
        place.parentNode.insertBefore ( item, place.nextSibling );
 
        item = cactions.getElementsByTagName("LI")[0];
    }
 
    cactions.style.display = "none";
  }
catch ( e )
  {
    return;
  }
}
 
if ( skin == "vector" ) addOnloadHook ( moveVectorMenuToTabs );