לדלג לתוכן

מדיה ויקי:Gadget-moveVectorMenuToTabs.js

מתוך צפונות ויקי
גרסה מ־14:14, 3 ביולי 2010 מאת wikipedia:he>Mikimik (for vector skin: replace the links in the dropdown menu with regular tabs and hide the menu)
(הבדל) → הגרסה הקודמת | הגרסה האחרונה (הבדל) | הגרסה הבאה ← (הבדל)

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
// for vector skin: replace the links in the dropdown menu with regular tabs and hide the menu
// written by [[user:Mikimik]]
function moveVectorMenuToTabs()
{
 try {
    var cactions = document.getElementById("p-cactions");
    var place = document.getElementById("ca-js-delete") || document.getElementById("ca-js-block") || document.getElementById("ca-watch");
    if ( !cactions  || !cactions.className == "vectorMenu" || !place ) return;

    var item = cactions.getElementsByTagName("LI")[0];
    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 );