User:Cacycle/wikEd dev.js: Difference between revisions

Content deleted Content added
0.9.14b
No edit summary
Line 440:
 
// image URLs, preset as wikEdImage[''] = '';
WikEdInitObjectWikEdInitImage(wikEdImage, {
'blank': '5/51/WikEd_blank.png',
'bold': '5/59/WikEd_bold.png',
Line 784:
if (array[key] == null) {
array[key] = preset[key];
}
}
return;
}
 
 
//
// WikEdInitImage: initialize images, keep pre-defined values
//
 
function WikEdInitImage(array, preset) {
 
for (var key in preset) {
if (array[key] == null) {
 
// remove MediaWiki path prefixes and add local path
if (wikEdUseLocalImages == true) {
array[key] = wikEdImagePathLocal + preset[key].replace(/^[0-9a-f]+\/[0-9a-f]+\//, '');
}
 
// add path
else {
array[key] = wikEdImagePath + preset[key];
}
}
}
Line 862 ⟶ 886:
// add image path to image filename
if (wikEdLogo.id == null) {
if (wikEdUseLocalImages == true) {
 
// remove MediaWiki path prefixes
for (i in wikEdImage) {
wikEdImage[i] = wikEdImagePathLocal + wikEdImage[i].replace(/^[0-9a-f]+\/[0-9a-f]+\//, '');
}
}
else {
for (i in wikEdImage) {
wikEdImage[i] = wikEdImagePath + wikEdImage[i];
}
}
/*
////////////////// remove Instaview buttons and preview field
Line 1,164 ⟶ 1,177:
wikEdFrameBody = wikEdFrameDocument.body;
 
// generate button bars
// add wikEd buttons to buttons wrapper
wikEdButtonsFormat = MakeButtonBar(wikEdButtonBar['format']);
var html = '';
wikEdButtonsControl = MakeButtonBar(wikEdButtonBar['control']);
 
wikEdButtonsFind = MakeButtonBar(wikEdButtonBar['find']);
// format buttons
htmlwikEdButtonsFix += MakeButtonBar(wikEdButtonBar['formatfix']);
 
// wikEd control buttons
html += MakeButtonBar(wikEdButtonBar['control']);
 
// find / replace buttons
html += MakeButtonBar(wikEdButtonBar['find']);
 
// fixingadd button bars to buttons wrapper
wikEdButtonsWrapper.appendChild(wikEdButtonsFormat);
html += MakeButtonBar(wikEdButtonBar['fix']);
wikEdButtonsWrapper.appendChild(wikEdButtonsControl);
wikEdButtonsWrapper.appendChild(wikEdButtonsFind);
wikEdButtonsWrapper.appendChild(wikEdButtonsFix);
 
var br = document.createElement('br');
html += '<br style="clear: both;">';
br.style.clear = 'both';
wikEdButtonsWrapper.appendChild(br);
 
// add html to buttons wrapper
wikEdButtonsWrapper.innerHTML = html;
wikEdButtonsFormat = document.getElementById('wikEdButtonsFormat');
wikEdButtonsFind = document.getElementById('wikEdButtonsFind');
wikEdButtonsFix = document.getElementById('wikEdButtonsFix');
wikEdButtonsControl = document.getElementById('wikEdButtonsControl');
wikEdCaseSensitive = document.getElementById('wikEdCaseSensitive');
wikEdRegExp = document.getElementById('wikEdRegExp');
Line 1,198 ⟶ 1,204:
 
// add preview box top bar to submit wrapper
wikEdButtonsPreview = MakeButtonBar(wikEdButtonBar['preview']);
wikEdSubmitWrapper.insertBefore(wikEdButtonsPreview, wikEdSubmitWrapper.firstChild);
 
// add preview box and its bottom bar to preview wrapper
var div = document.createElement('div');
div.id = 'wikEdPreviewBoxOuter';
div.className = 'wikEdPreviewBoxOuter';
wikEdLocalPrevWrapper.appendChild(div);
 
wikEdPreviewBox = document.createElement('div');
wikEdPreviewBox.id = 'wikEdPreviewBox';
wikEdPreviewBox.className = 'wikEdPreviewBox';
div.appendChild(wikEdPreviewBox);
 
wikEdButtonsPreview2 = MakeButtonBar(wikEdButtonBar['preview2']);
var buttonsPreview = document.createElement('div');
wikEdLocalPrevWrapper.appendChild(wikEdButtonsPreview2);
buttonsPreview.id = 'wikEdButtonsPreview';
buttonsPreview.className = 'wikEdButtonsPreview';
 
html = MakeButtonBar(wikEdButtonBar['preview']);
 
buttonsPreview.innerHTML = html;
wikEdSubmitWrapper.insertBefore(buttonsPreview, wikEdSubmitWrapper.firstChild);
wikEdButtonsPreview = document.getElementById('wikEdButtonsPreview');
 
// add preview box and its bottom bar to preview wrapper
html = '';
html += '<div id="wikEdPreviewBoxOuter" class="wikEdPreviewBoxOuter">';
html += '<div id="wikEdPreviewBox" class="wikEdPreviewBox">';
html += '</div>';
html += '</div>';
html += MakeButtonBar(wikEdButtonBar['preview2']);
 
wikEdLocalPrevWrapper.innerHTML = html;
wikEdPreviewBox = document.getElementById('wikEdPreviewBox');
wikEdButtonsPreview2 = document.getElementById('wikEdButtonsPreview2');
 
// add jump box to standard preview
Line 1,227 ⟶ 1,225:
if (wikiPreview != null) {
if (wikiPreview.firstChild != null) {
wikEdButtonsJump = MakeButtonBar(wikEdButtonBar['jump']);
 
wikiPreview.insertBefore(wikEdButtonsJump, wikiPreview.firstChild);
var buttonsJump = document.createElement('div');
buttonsJump.id = 'wikEdButtonsJump';
buttonsJump.className = 'wikEdButtonsJump';
 
html = MakeButtonBar(wikEdButtonBar['jump']);
 
buttonsJump.innerHTML = html;
wikiPreview.insertBefore(buttonsJump, wikiPreview.firstChild);
wikEdButtonsJump = document.getElementById('wikEdButtonsJump');
}
}
Line 1,576 ⟶ 1,566:
function MakeButtonBar(bar) {
 
var div = document.createElement('div');
var html = '<div id="' + bar[0] + '" class="' + bar[1] + '">';
div.id = bar[0];
div.className = bar[1];
 
var html = '';
for each (buttonNo in bar[2]) {
switch (buttonNo) {
case 'br':
html += '<br />';
break;
case 'find':
html += '<span class="wikEdFindComboInput" id="wikEdFindComboInput">';
html += '<input class="wikEdCombo" id="wikEdFindText" type="text" value="" onfocus="javascript:this.setSelectionRange(0, this.textLength);">';
Line 1,589 ⟶ 1,583:
html += '</span>';
break;
case 'replace':
html += '<span class="wikEdReplaceComboInput" id="wikEdReplaceComboInput">';
html += '<input class="wikEdCombo" id="wikEdReplaceText" type="text" value="" onfocus="this.setSelectionRange(0, this.textLength);">';
Line 1,595 ⟶ 1,589:
html += '</select>';
html += '</span>';
break;
default:
default:
if ( (wikEdButton[0] != 'wikEdSource') || (wikEdShowSourceButton == true) ) {
var currButton = wikEdButton[buttonNo];
html += '<img id="' + wikEdButton[0] + '" class="' + wikEdButton[1] + '" title="' + wikEdButton[2] + '" src="' + wikEdButton[3] + '" width="' + wikEdButton[4] + '" height="' + wikEdButton[5] + '" alt="' + wikEdButton[6] + '" onClick="' + wikEdButton[7] + '">';
if ( (currButton[0] != 'wikEdSource') || (wikEdShowSourceButton == true) ) {
html += '<img id="' + currButton[0] + '" class="' + currButton[1] + '" title="' + currButton[2] + '" src="' + currButton[3] + '" width="' + currButton[4] + '" height="' + currButton[5] + '" alt="' + currButton[6] + '" onClick="' + currButton[7] + '">';
}
break;
}
}
div.innerHTML = html;
html += '</div>';
return(htmldiv);
}