User:Abigor/fu.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
Documentation for this user script can be added at User:Abigor/fu. |
- Report page listing warnings and errors.
var aeArray = new Array()
//Let's do some fun; Aething let you edit custom buttons!
// Number should start at 0 and should be increased with 1 each time...
// 2,3,4 and 5 are to fool the form, otherwise subst: and 3,4,5 times ~ are solved in this script instead of adding the actual line :S
// Break these thing to cut the phrase between ~~ and ~~ and somewhere in subst
//aeArray[number] = new aeButton('Buttontext','Summarytext','Editformtext','2','3','4','5');
aeArray[0] = new aeButton('Huib\'s thing','A little bit information regarding [[Commons:Fairuse|Fair use]] on Commons','{{sub','st:user:Abigor/fairuse}}~~','~~');
aeArray[1] = new aeButton('Place','[[:Category:Commons_protected_edit_requests|Edit protected request is done]]','');
/* Please don't edit after this line */
function aeButton(butt,summ,edit,edit2,edit3,edit4,edit5) {
if(edit2) edit+=edit2
if(edit3) edit+=edit3
if(edit4) edit+=edit4
if(edit5) edit+=edit5
this.butt = butt
this.summ = summ
this.edit = edit
}
function addAutoEditStuff() {
var o1 = document.getElementById('wpSummaryLabel')
//Defined enough!
var t1 = "AE: "
for (var c1 = 0; c1<aeArray.length; c1++) {
t1 += "<input type=\"button\" value=\""
+ aeArray[c1].butt
+ "\" onclick=\"aeMagic("+c1+")\"> "
}
var div = document.createElement('div')
div.innerHTML=t1
o1.insertBefore(div,null)
}
if(wgAction=="edit"||wgAction=="submit") {
$(addAutoEditStuff);
//Code when above doesn't listen :S
//if (window.addEventListener) {
//window.addEventListener('load',addAutoEditStuff,false)
//}
//else if(window.attachEvent) {
//window.attachEvent('onload',addAutoEditStuff)
//}
}
function aeMagic(n1) {
//n1 contains id of array
var o1 = document.getElementById('wpTextbox1')
var o2 = document.getElementById('wpSummary')
o1.value += aeArray[n1].edit
o2.value = aeArray[n1].summ
}