Naudotojas:Qwarc/monobook.js

Straipsnis iš Vikipedijos, laisvosios enciklopedijos.

Dėmesio: Išsaugoję turite išvalyti naršyklės spartinančią saugyklą (cache): Mozilla/Safari/Konqueror: spausdami Shift pasirinkite reload (arba Ctrl-Shift-R), IE: Ctrl-F5, Opera: F5.

function morelinks() {
  var tabs = document.getElementById('p-cactions').cloneNode(true);
  // don't use the same ids twice- replace the p-cactions id and prepend 'mytabs-' to the li's
  tabs.id = 'mytabs';
  // needs this to be set from js, it ignores the css width for some reason
  tabs.style.width = '100%';
  var listitems = tabs.getElementsByTagName('LI');
  for (i=0;i<listitems.length;i++) {
    if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
  }

  // prisidedam savaitės iniciatyvą gale
  var li = listitems[0].cloneNode(true);
  li.id = "mytabs-ca-nstab-iniciatyva";
  var a = li.getElementsByTagName('A')[0];
  a.innerText = "Sav.iniciatyva";
  a.href = "/wiki/Wikipedia:Savaitės_iniciatyva";
  document.getElementById('p-cactions').getElementsByTagName('UL')[0].appendChild(li);

  // paslepiam parama ir pagalba
  // document.getElementById('n-help').style.display='none';
  document.getElementById('n-sitesupport').style.display='none';

  // drop them at the bottom of the content area
  document.getElementById('column-content').appendChild(tabs);
}
if (window.addEventListener) window.addEventListener("load",morelinks,false);
else if (window.attachEvent) window.attachEvent("onload",morelinks);

/*
<s>;Usage :Include a call to <code>addForceSummary()</code> in your page load function</s>
;Possible improvements :Make any form submission force a summary
*/

/* <pre><nowiki> */

function addForceSummary()
{
    if(!/&action=edit/.test(window.location.href) && !/&action=submit/.test(window.location.href)) return;
    if(/&section=new/.test(window.location.href)) return;
    if(!document.forms.editform) return;
    document.forms.editform.wpSave.onclick = forceSummary;
}

function forceSummary()
{
    if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1'))
    {
        var r = prompt('Prašome įvesti komentarą:',document.forms.editform.wpSummary.value);
        if(r == null) { return false; }
        document.forms.editform.wpSummary.value = r;
    }
    return true;
}

addOnloadHook(addForceSummary);

/* </nowiki></pre> */