Użytkownik:Pandecybel/monobook.js: Różnice pomiędzy wersjami

Z Nonsensopedii, polskiej encyklopedii humoru
Linia 1: Linia 1:
// Dołączenie skryptu ze strony: [[Wikipedysta:ChP94/scripts/quickek.js]]
// QuickEK script by [[:pl:User:ChP94]]
// based on quickimgdelete.js script written by [[:en:User:Howcheng]]
document.write('<script type="text/javascript" src="'+
// Released under the [http://www.gnu.org/licenses/gpl.txt GNU Public License (GPL)]
'http://pl.wikipedia.org/w/index.php?title=Wikipedysta:ChP94/scripts/quickek.js\
// <pre><nowiki>
&action=raw&ctype=text/javascript&dontcountme=s"></script>');
var quickek_autosave = true;
// From [[en:User:Lupin/autoedit.js]]
function getParamValue(paramName) {
var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
var h=document.location;
var m=cmdRe.exec(h);
if (m) {
try {
return decodeURIComponent(m[1]);
} catch (someError) {}
}
return null;
}
function quickek_ekIt () {
var reason = prompt("Dlaczego chcesz zEKować ten art?", '');
if((reason) && (reason != "")) {
var title = encodeURIComponent(wgPageName);
window.location.href= "http://nonsensopedia.wikia.com/index.php?title" + title + "&action=edit&fakeaction=quickek&reason=" + encodeURIComponent(reason);
}
}

function quickek_fastEk () {
var title = encodeURIComponent(wgPageName);
window.location.href= "http://nonsensopedia.wikia.com/index.php?title=" + title + "&action=edit&fakeaction=fastek";
}
function quickek_onload() {
if (document.getElementById('ca-edit') == null) // not editable by non-admin
return;
addPortletLink('p-tb', 'javascript:quickek_fastEk()', "Błyskawiczne kasowanko", 'fast-ek', "Zgłoś artykuł do ekspresowego kasowanka bez podawania powodu");
addPortletLink('p-tb', 'javascript:quickek_ekIt()', "Ekspresowe kasowanko", 'quick-ek', "Zgłoś artykuł do ekspresowego kasowanka");
var fakeaction = getParamValue('fakeaction');
if(fakeaction=="quickek") {
var reason = decodeURIComponent(getParamValue('reason'));
editformval = document.editform.wpTextbox1.value;
if((editformval) && (editformval != "") && !(editformval.match("{{ek")) && (reason) && (reason != "")) {
editformval = "{{ek|1="+reason+"}}\n" + editformval;
document.editform.wpTextbox1.value = editformval;
document.editform.wpSummary.value = "[[Kategoria:EK" + "|ek]], powód: " + reason;
if(quickek_autosave) { document.editform.wpSave.click(); }
}
}
else if(fakeaction=="fastek") {
editformval = document.editform.wpTextbox1.value;
if((editformval) && (editformval != "") && !(editformval.match("{{ek"))) {
editformval = "{{ek" +"}}\n" + editformval;
document.editform.wpTextbox1.value = editformval;
document.editform.wpSummary.value = "[[Kategoria:EK" + "|ek]]";
if(quickek_autosave) { document.editform.wpSave.click(); }
}
}
}
addOnloadHook(quickek_onload);
//</nowiki></pre>

Wersja z 20:10, 22 lut 2009

 // QuickEK script by [[:pl:User:ChP94]]
 // based on quickimgdelete.js script written by [[:en:User:Howcheng]]
 // Released under the [http://www.gnu.org/licenses/gpl.txt GNU Public License (GPL)]
// <pre><nowiki>
 
var quickek_autosave = true;
 
// From [[en:User:Lupin/autoedit.js]]
function getParamValue(paramName) {
  var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
  var h=document.location;
  var m=cmdRe.exec(h);
  if (m) {
    try {
      return decodeURIComponent(m[1]);
    } catch (someError) {}
  }
  return null;
}
 
function quickek_ekIt () {
   var reason = prompt("Dlaczego chcesz zEKować ten art?", '');
   if((reason) && (reason != "")) {
       var title = encodeURIComponent(wgPageName);
       window.location.href= "http://nonsensopedia.wikia.com/index.php?title" + title + "&action=edit&fakeaction=quickek&reason=" + encodeURIComponent(reason);
   }
}

function quickek_fastEk () {
   var title = encodeURIComponent(wgPageName);
   window.location.href= "http://nonsensopedia.wikia.com/index.php?title=" + title + "&action=edit&fakeaction=fastek";
}
 
function quickek_onload() {
  if (document.getElementById('ca-edit') == null) // not editable by non-admin
    return;
  addPortletLink('p-tb', 'javascript:quickek_fastEk()', "Błyskawiczne kasowanko", 'fast-ek', "Zgłoś artykuł do ekspresowego kasowanka bez podawania powodu");
  addPortletLink('p-tb', 'javascript:quickek_ekIt()', "Ekspresowe kasowanko", 'quick-ek', "Zgłoś artykuł do ekspresowego kasowanka");
 
  var fakeaction = getParamValue('fakeaction');
  if(fakeaction=="quickek") {
     var reason = decodeURIComponent(getParamValue('reason'));
     editformval = document.editform.wpTextbox1.value;
     if((editformval) && (editformval != "") && !(editformval.match("{{ek")) && (reason) && (reason != "")) {
        editformval = "{{ek|1="+reason+"}}\n" + editformval;
        document.editform.wpTextbox1.value = editformval;
        document.editform.wpSummary.value = "[[Kategoria:EK" + "|ek]], powód: " + reason;
        if(quickek_autosave) { document.editform.wpSave.click(); }
    }
  }
  else if(fakeaction=="fastek") {
     editformval = document.editform.wpTextbox1.value;
     if((editformval) && (editformval != "") && !(editformval.match("{{ek"))) {
        editformval = "{{ek" +"}}\n" + editformval;
        document.editform.wpTextbox1.value = editformval;
        document.editform.wpSummary.value = "[[Kategoria:EK" + "|ek]]";
        if(quickek_autosave) { document.editform.wpSave.click(); }
     }
  }
}
 
addOnloadHook(quickek_onload);
//</nowiki></pre>