Jump to content

MediaWiki:Common.js/edit.js: Difference between revisions

developing BSL function wizard
(okay, I'm blaming this one on a browser glitch; changing right button this time)
(developing BSL function wizard)
Line 82: Line 82:
'AI':['c/cc/Button_adv_image.png','Advanced image',"[[Image:","|thumb|right|px|Caption]]",'FileName.jpg'],
'AI':['c/cc/Button_adv_image.png','Advanced image',"[[Image:","|thumb|right|px|Caption]]",'FileName.jpg'],
'GEO': ['b/b8/Button_Globe.png', 'Geo location', "", "", ""],
'GEO': ['b/b8/Button_Globe.png', 'Geo location', "", "", ""],
'TALK': ['4/49/Button_talk.png', 'Add talk template', "", "", ""]
'TALK': ['4/49/Button_talk.png', 'Add talk template', "", "", ""],
'Bf': ['4/49/Button_talk.png', 'Insert BSL function', "", "", ""]
};
};


Line 291: Line 292:
extendAButton(Isrc + 'b/b8/Button_Globe.png', XEBPopupGeoLink);
extendAButton(Isrc + 'b/b8/Button_Globe.png', XEBPopupGeoLink);
extendAButton(Isrc + '4/49/Button_talk.png', XEBPopupTalk);
extendAButton(Isrc + '4/49/Button_talk.png', XEBPopupTalk);
extendAButton(Isrc + 'c/cc/Button_adv_image.png',XEBPopupImage)
extendAButton(Isrc + 'c/cc/Button_adv_image.png',XEBPopupImage);
//extendAButton(Isrc+'d/d6/Button_superscript.png',XEBPopupFormattedText)
extendAButton(Isrc + '4/49/Button_talk.png',XEBPopupBSLfunc);
//extendAButton(Isrc+'d/d6/Button_superscript.png',XEBPopupFormattedText);


// redirect -##IE doesn't like this line. Object doesn't support this property or method
// redirect -##IE doesn't like this line. Object doesn't support this property or method
Line 527: Line 529:


function insertTableCode() {
function insertTableCode() {
var i;
var f = document.XEBPopupTableForm;
var caption = (f.inputCaption.checked) ? '|+ TABLE CAPTION \n' : '';
var exhead = (f.inputHead.checked) ? '|- style="background: #DDFFDD;"\n' : '';
var nbRow = parseInt(f.inputRow.value, 10);
var nbCol = parseInt(f.inputCol.value, 10);
var exfield = f.inputItems.checked;
var align = (f.inputAlign.checked) ? 'align="center"' : '';
//generateTable(caption, exhead, nbCol, nbRow, exfield, align);
var code = '\n';
code += '{| ' + align + ' ';
code += (f.inputSort.checked) ? 'class="wikitable sortable" \n' : '\n';
code += caption + exhead;
if (exfield) {
code += '!\n';
}
for (i = 1; i < nbCol + 1; i++) {
code += '! COLUMN ' + i + '\n';
}
var items = 0;
for (var j = 0; j < nbRow; j++) {
if (exfield) {
items++;
code += '|-\n! style="background: #FFDDDD;"|ITEM ' + items + '\n';
} else {
code += '|-\n';
}
for (i = 0; i < nbCol; i++) {
code += '| Element ' + i + '\n';
}
}
code += '|}\n';
hideXEBPopup();
insertTags('', '', code);
extendSummary('table');
return false;
}
function XEBPopupBSLfunc(e) {
var m = new GetPos(e || event);
curPopup = new XEBPopup('bslfunc', m.x, m.y);
var mt = '<p>Enter the BSL function information: <\/p>' +
'<form name="XEBPopupBSLfuncForm">' +
'Function type: <select name="inputType"><option value="void">void</option><option value="bool">bool</option><option value="int">int</option><option value="float">float</option><option value="string">string</option>
</select> <p\/>' +
'Default return value: <input type="text" name="inputDefaultReturn" value="" size="10"><p\/>' +
'Function name: <input type="text" name="inputName" value="3" size="2"><p\/>' +
'Number of columns: <input type="text" name="inputCol" value="3" size="2"><p\/>' +
// 'Alternating grey lines: <input type="checkbox" name="inputLine" checked="1" ><p\/>' +
'Item column: <input type="checkbox" name="inputItems" ><p\/>' +
'Sortable: <input type="checkbox" name="inputSort" ><p\/>' +
'<\/form>' +
'<i>The default table allows for fields and values only.<\/i><p\/>' +
'Check "Item column" to allow for the table to have fields, items, and values.<\/i><p\/>' +
'<p><button onClick="javascript:insertBSLfuncCode()">Insert</button>' +
'<button onClick="hideXEBPopup()">Cancel</button>';
curPopup.setInnerHTML(mt);
return true;
}
function insertBSLfuncCode() {
var i;
var i;
var f = document.XEBPopupTableForm;
var f = document.XEBPopupTableForm;