Anonymous user
Rosetta Code:My Scripts Menu: Difference between revisions
Adding some code to handle the case where the user is not logged in
(Adding a page for a new My Scripts JS module that allows users to choose which JS modules they want) |
(Adding some code to handle the case where the user is not logged in) |
||
Line 158:
//find the user preferences button and add a new list item to the right of it
var prefsEl = document.getElementById("pt-preferences");
if(!prefsEl)
{
var personalEl = document.getElementById("p-personal");
if(!personalEl)
{
return;
}
var liEls = personalEl.getElementsByTagName("li");
if(!liEls || liEls.length < 2)
{
return;
}
prefsEl = liEls[liEls.length - 2];
}
var jsMenuEl = prefsEl.parentNode.insertBefore(document.createElement("li"), prefsEl.nextSibling);
jsMenuEl.setAttribute("id", "pt-jsgadgets");
|