Jump to content

User:AThing/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by AThing (talk | contribs) at 03:28, 5 January 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
// <nowiki>
// This will add an [edit top] link at the top of all pages except preview pages
// by User:Pile0nades


// Add an [edit top] link to pages
function editTopLink() {
  // if this is preview page or generated page, stop
  if(document.getElementById("wikiPreview") || window.location.href.indexOf("/wiki/Special:") != -1) return;

  // get the page title
  var pageTitle = document.title.split(" - ")[0].replace(" ", "_"); 

  // create div and set innerHTML to link
  var divContainer = document.createElement("div");
  divContainer.innerHTML = '<div class="editsection" style="float:right;margin-left:5px;margin-top:3px;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="'+document.title.split(" - ")[0]+'">edit top</a>]</div>';

  // insert divContainer into the DOM before the h1
  if(window.location.href.indexOf("&action=edit") == -1)
    document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);

  if(window.location.href.indexOf("&action=edit&section=0") != -1)
    document.getElementById("wpSummary").value = "/* Intro */ ";
}


function morelinks() {
  var tabs = document.getElementById('p-cactions').cloneNode(true);
  tabs.id = 'mytabs';
  var listitems = tabs.getElementsByTagName('LI');
  for (i=0;i<listitems.length;i++) {
    if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
  }
  document.getElementById('column-content').appendChild(tabs);

 var boxclone = document.createElement("div");
 boxclone.id = 'p-navclone';
 boxclone.setAttribute("class","portlet");

 var titolo = document.createElement("h5");
 titolo.innerHTML = "strumenti extra";
 boxclone.appendChild(titolo);

 var corpo = document.createElement("div");
 corpo.setAttribute("class","pBody");
 var list_ul = document.createElement("ul");

 var list_a = document.createElement("li");
 list_a.id = 'v-sandbox';
 var link_a = document.createElement("a");
 link_a.href = '/wiki/Utente:Kormoran/Sandbox';
 link_a.innerHTML = 'Sandbox personale';
 list_a.appendChild(link_a);
 list_ul.appendChild(list_a);

 var list_b = document.createElement("li");
 list_b.id = 'v-tabelle';
 var link_b = document.createElement("a");
 link_b.href = '/wiki/Wikipedia:Come_usare_le_tabelle';
 link_b.innerHTML = 'Markup tabelle';
 list_b.appendChild(link_b);
 list_ul.appendChild(list_b);

 var list_c = document.createElement("li");
 list_c.id = 'v-makeup';
 var link_c = document.createElement("a");
 link_c.href = '/wiki/Aiuto:Markup_immagini';
 link_c.innerHTML = 'Markup immagini';
 list_c.appendChild(link_c);
 list_ul.appendChild(list_c);

 var list_d = document.createElement("li");
 list_d.id = 'v-tex';
 var link_d = document.createElement("a");
 link_d.href = '/wiki/Wikipedia:Formule_matematiche_TeX';
 link_d.innerHTML = 'Markup TeX';
 list_d.appendChild(link_d);
 list_ul.appendChild(list_d);

 corpo.appendChild(list_ul);
 boxclone.appendChild(corpo);
 document.getElementById("column-one").appendChild(boxclone);
}

/*
if (window.addEventListener) window.addEventListener("load",morelinks,false);
else if (window.attachEvent) window.attachEvent("onload",morelinks);
*/
addLoadEvent(morelinks);

// </nowiki>