Content deleted Content added
No edit summary |
No edit summary |
||
Line 3:
/*
Name: wikEd (wikEd.js)
Version: wikEd 0.9.x (beta) (
What: Comfortable JavaScript
Update: press SHIFT-Reload to update to the newest version
Homepage: http://en.wikipedia.org/wiki/User:Cacycle/wikEd
Line 10:
Code: http://en.wikipedia.org/wiki/User:Cacycle/wikEd.js
Author: Cacycle (http://en.wikipedia.org/wiki/User:Cacycle)
Browsers: The program works
License: This code has been released into the public ___domain
Important: This file might have to be saved as UTF-16 in your editor to preserve certain Unicode characters, e.g. ·±× (. +/- x)
Line 16:
// version information
var wikEdProgramVersion = '0.9.
var wikEdProgramDate = '
Line 440:
// image URLs, preset as wikEdImage[''] = '';
'blank': '5/51/WikEd_blank.png',
'bold': '5/59/WikEd_bold.png',
Line 512:
'wikify': '9/9f/WikEd_wikify.png',
'wikiLink': '2/21/WikEd_wikilink.png'
});
Line 758 ⟶ 647:
var wgArticlePath = wgArticlePath || '';
var wgScriptPath = wgScriptPath || '';
var wikEdServer = wgServer.replace(/(\W)/g, '\\$1');
var wikEdArticlePath = wgArticlePath.replace(wgServer, '');
var wikEdScriptPath = wgScriptPath.replace(wgServer, '');
wikEdArticlePath = wikEdArticlePath.replace(/\$1$/, '');
wikEdScriptPath = wikEdScriptPath.replace(/\/?$/, '/');;
wikEdArticlePath = wikEdArticlePath.replace(/(\W)/g, '\\$1');
wikEdScriptPath = wikEdScriptPath.replace(/(\W)/g, '\\$1');
Line 784 ⟶ 670:
if (array[key] == null) {
array[key] = preset[key];
}
}
Line 886 ⟶ 748:
// 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,177 ⟶ 1,050:
wikEdFrameBody = wikEdFrameDocument.body;
// add wikEd buttons to buttons wrapper
// format buttons
html = '';
html += '<div class="wikEdButtonsFormat" id="wikEdButtonsFormat">';
html += '<img class="wikEdButtonInactive" src="' + wikEdImage['undo'] + '" width="16" height="16" id="wikEdUndo" alt="' + wikEdText['wikEdUndo alt'] + '" title="' + wikEdText['wikEdUndo title'] + '" onClick="javascript:WikEdEditButton(\'wikEdUndo\');">';
html += '<img class="wikEdButtonInactive" src="' + wikEdImage['redo'] + '" width="16" height="16" id="wikEdRedo" alt="' + wikEdText['wikEdRedo alt'] + '" title="' + wikEdText['wikEdRedo title'] + '" onClick="javascript:WikEdEditButton(\'wikEdRedo\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['bold'] + '" width="16" height="16" id="wikEdBold" alt="' + wikEdText['wikEdBold alt'] + '" title="' + wikEdText['wikEdBold title'] + '" onClick="javascript:WikEdEditButton(\'wikEdBold\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['italic'] + '" width="16" height="16" id="wikEdItalic" alt="' + wikEdText['wikEdItalic alt'] + '" title="' + wikEdText['wikEdItalic title'] + '" onClick="javascript:WikEdEditButton(\'wikEdItalic\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['underline'] + '" width="16" height="16" id="wikEdUnderline" alt="' + wikEdText['wikEdUnderline alt'] + '" title="' + wikEdText['wikEdUnderline title'] + '" onClick="javascript:WikEdEditButton(\'wikEdUnderline\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['strikethrough'] + '" width="16" height="16" id="wikEdStrikethrough" alt="' + wikEdText['wikEdStrikethrough alt'] + '" title="' + wikEdText['wikEdStrikethrough title'] + '" onClick="javascript:WikEdEditButton(\'wikEdStrikethrough\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['nowiki'] + '" width="16" height="16" id="wikEdNowiki" alt="' + wikEdText['wikEdNowiki alt'] + '" title="' + wikEdText['wikEdNowiki title'] + '" onClick="javascript:WikEdEditButton(\'wikEdNowiki\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['superscript'] + '" width="16" height="16" id="wikEdSuperscript" alt="' + wikEdText['wikEdSuperscript alt'] + '" title="' + wikEdText['wikEdSuperscript title'] + '" onClick="javascript:WikEdEditButton(\'wikEdSuperscript\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['subscript'] + '" width="16" height="16" id="wikEdSubscript" alt="' + wikEdText['wikEdSubscript alt'] + '" title="' + wikEdText['wikEdSubscript title'] + '" onClick="javascript:WikEdEditButton(\'wikEdSubscript\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['case'] + '" width="16" height="16" id="wikEdCase" alt="' + wikEdText['wikEdCase alt'] + '" title="' + wikEdText['wikEdCase title'] + '" onClick="javascript:WikEdEditButton(\'wikEdCase\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['undoAll'] + '" width="16" height="16" id="wikEdUndoAll" alt="' + wikEdText['wikEdUndoAll alt'] + '" title="' + wikEdText['wikEdUndoAll title'] + '" onClick="javascript:WikEdEditButton(\'wikEdUndoAll\');">';
html += '<img class="wikEdButtonInactive" src="' + wikEdImage['redoAll'] + '" width="16" height="16" id="wikEdRedoAll" alt="' + wikEdText['wikEdRedoAll alt'] + '" title="' + wikEdText['wikEdRedoAll title'] + '" onClick="javascript:WikEdEditButton(\'wikEdRedoAll\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['updateSyntax'] + '" width="16" height="16" id="wikEdUpdateSyntax" alt="' + wikEdText['wikEdUpdateSyntax alt'] + '" title="' + wikEdText['wikEdUpdateSyntax title'] + '" onClick="javascript:WikEdEditButton(\'wikEdUpdateSyntax\');">';
html += '<br />';
html += '<img class="wikEdButton" src="' + wikEdImage['wikiLink'] + '" width="16" height="16" id="wikEdWikiLink" alt="' + wikEdText['wikEdWikiLink alt'] + '" title="' + wikEdText['wikEdWikiLink title'] + '" onClick="javascript:WikEdEditButton(\'wikEdWikiLink\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['webLink'] + '" width="16" height="16" id="wikEdWebLink" alt="' + wikEdText['wikEdWebLink alt'] + '" title="' + wikEdText['wikEdWebLink title'] + '" onClick="javascript:WikEdEditButton(\'wikEdWebLink\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['decreaseHeading'] + '" width="16" height="16" id="wikEdDecreaseHeading" alt="' + wikEdText['wikEdDecreaseHeading alt'] + '" title="' + wikEdText['wikEdDecreaseHeading title'] + '" onClick="javascript:WikEdEditButton(\'wikEdDecreaseHeading\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['increaseHeading'] + '" width="16" height="16" id="wikEdIncreaseHeading" alt="' + wikEdText['wikEdIncreaseHeading alt'] + '" title="' + wikEdText['wikEdIncreaseHeading title'] + '" onClick="javascript:WikEdEditButton(\'wikEdIncreaseHeading\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['bulletList'] + '" width="16" height="16" id="wikEdBulletList" alt="' + wikEdText['wikEdBulletList alt'] + '" title="' + wikEdText['wikEdBulletList title'] + '" onClick="javascript:WikEdEditButton(\'wikEdBulletList\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['numberList'] + '" width="16" height="16" id="wikEdNumberList" alt="' + wikEdText['wikEdNumberList alt'] + '" title="' + wikEdText['wikEdNumberList title'] + '" onClick="javascript:WikEdEditButton(\'wikEdNumberList\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['indentList'] + '" width="16" height="16" id="wikEdIndentList" alt="' + wikEdText['wikEdIndentList alt'] + '" title="' + wikEdText['wikEdIndentList title'] + '" onClick="javascript:WikEdEditButton(\'wikEdIndentList\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['definitionList'] + '" width="16" height="16" id="wikEdDefinitionList" alt="' + wikEdText['wikEdDefinitionList alt'] + '" title="' + wikEdText['wikEdDefinitionList title'] + '" onClick="javascript:WikEdEditButton(\'wikEdDefinitionList\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['image'] + '" width="16" height="16" id="wikEdImage" alt="' + wikEdText['wikEdImage alt'] + '" title="' + wikEdText['wikEdImage title'] + '" onClick="javascript:WikEdEditButton(\'wikEdImage\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['table'] + '" width="16" height="16" id="wikEdTable" alt="' + wikEdText['wikEdTable alt'] + '" title="' + wikEdText['wikEdTable title'] + '" onClick="javascript:WikEdEditButton(\'wikEdTable\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['redirect'] + '" width="16" height="16" id="wikEdRedirect" alt="' + wikEdText['wikEdRedirect alt'] + '" title="' + wikEdText['wikEdRedirect title'] + '" onClick="javascript:WikEdEditButton(\'wikEdRedirect\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['wikify'] + '" width="16" height="16" id="wikEdWikify" alt="' + wikEdText['wikEdWikify alt'] + '" title="' + wikEdText['wikEdWikify title'] + '" onClick="javascript:WikEdEditButton(\'wikEdWikify\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['textify'] + '" width="16" height="16" id="wikEdTextify" alt="' + wikEdText['wikEdTextify alt'] + '" title="' + wikEdText['wikEdTextify title'] + '" onClick="javascript:WikEdEditButton(\'wikEdTextify\');">';
html += '</div>';
// wikEd control buttons
html += '<div class="wikEdButtonsControl" id="wikEdButtonsControl">';
html += '<img class="wikEdButton" src="' + wikEdImage['textZoom'] + '" width="16" height="16" id="wikEdTextZoom" alt="' + wikEdText['wikEdTextZoom alt'] + '" title="' + wikEdText['wikEdTextZoom title'] + '" onClick="javascript:WikEdButton(\'wikEdTextZoom\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['clearHistory'] + '" width="16" height="16" id="wikEdClearHistory" alt="' + wikEdText['wikEdClearHistory alt'] + '" title="' + wikEdText['wikEdClearHistory title'] + '" onClick="javascript:WikEdButton(\'wikEdClearHistory\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['scrollToButtons'] + '" width="16" height="16" id="wikEdScrollToButtons" alt="' + wikEdText['wikEdScrollToButtons alt'] + '" title="' + wikEdText['wikEdScrollToButtons title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToButtons\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['scrollToText'] + '" width="16" height="16" id="wikEdScrollToInput" alt="' + wikEdText['wikEdScrollToInput alt'] + '" title="' + wikEdText['wikEdScrollToInput title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToInput\');">';
html += '<br />';
html += '<img class="wikEdButtonChecked" src="' + wikEdImage['useWikEd'] + '" width="16" height="16" id="wikEdUseWikEd" alt="' + wikEdText['wikEdUseWikEd alt'] + '" title="' + wikEdText['wikEdUseWikEd title'] + '" onClick="javascript:WikEdButton(\'wikEdUseWikEd\', true);">';
html += '<img class="wikEdButtonUnchecked" src="' + wikEdImage['highlightSyntax'] + '" width="16" height="16" id="wikEdHighlightSyntax" alt="' + wikEdText['wikEdHighlightSyntax alt'] + '" title="' + wikEdText['wikEdHighlightSyntax title'] + '" onClick="javascript:WikEdButton(\'wikEdHighlightSyntax\', true);">';
if (wikEdShowSourceButton == true) {
html += '<img class="wikEdButton" src="' + wikEdImage['source'] + '" width="16" height="16" id="wikEdSource" alt="' + wikEdText['wikEdSource alt'] + '" title="' + wikEdText['wikEdSource title'] + '" onClick="javascript:WikEdEditButton(\'wikEdSource\');">';
}
html += '<img class="wikEdButtonUnchecked" src="' + wikEdImage['using'] + '" width="16" height="16" id="wikEdUsing" alt="' + wikEdText['wikEdUsing alt'] + '" title="' + wikEdText['wikEdUsing title'] + '" onClick="javascript:WikEdButton(\'wikEdUsing\', true);">';
html += '<img class="wikEdButton" src="' + wikEdImage['fullScreen'] + '" width="16" height="16" id="wikEdFullScreen" alt="' + wikEdText['wikEdFullScreen alt'] + '" title="' + wikEdText['wikEdFullScreen title'] + '" onClick="javascript:WikEdButton(\'wikEdFullScreen\', true);">';
html += '</div>';
// find / replace buttons
html += '<div class="wikEdButtonsFind" id="wikEdButtonsFind">';
html += '<img class="wikEdButton" src="' + wikEdImage['getFind'] + '" width="16" height="16" id="wikEdGetFind" alt="' + wikEdText['wikEdGetFind alt'] + '" title="' + wikEdText['wikEdGetFind title'] + '" onClick="javascript:WikEdEditButton(\'wikEdGetFind\');" ondblclick="javascript:WikEdEditButton(\'wikEdGetFindReplace\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['findAll'] + '" width="16" height="16" id="wikEdFindAll" alt="' + wikEdText['wikEdFindAll alt'] + '" title="' + wikEdText['wikEdFindAll title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFindAll\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['findPrev'] + '" width="16" height="16" id="wikEdFindPrev" alt="' + wikEdText['wikEdFindPrev alt'] + '" title="' + wikEdText['wikEdFindPrev title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFindPrev\');">';
html += '<span class="wikEdFindComboInput" id="wikEdFindComboInput">';
html += '<input class="wikEdCombo" id="wikEdFindText" type="text" value="" onfocus="javascript:this.setSelectionRange(0, this.textLength);">';
html += '<select class="wikEdCombo" id="wikEdFindSelect" onfocus="javascript:WikEdSetComboOptions(\'find\')" onChange="javascript:WikEdChangeComboInput(\'find\');">';
html += '</select>';
html += '</span>';
html += '<img class="wikEdButton" src="' + wikEdImage['findNext'] + '" width="16" height="16" id="wikEdFindNext" alt="' + wikEdText['wikEdFindNext alt'] + '" title="' + wikEdText['wikEdFindNext title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFindNext\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['jumpTopBottom'] + '" width="16" height="16" id="wikEdUpdown" alt="' + wikEdText['wikEdUpdown alt'] + '" title="' + wikEdText['wikEdUpdown title'] + '" onClick="javascript:WikEdEditButton(\'wikEdUpdown\');">';
html += '<img class="wikEdButtonInactive" src="' + wikEdImage['prevPos'] + '" width="16" height="16" id="wikEdPrevPos" alt="' + wikEdText['wikEdPrevPos alt'] + '" title="' + wikEdText['wikEdPrevPos title'] + '" onClick="javascript:WikEdEditButton(\'wikEdPrevPos\');">';
html += '<img class="wikEdButtonInactive" src="' + wikEdImage['lastPos'] + '" width="16" height="16" id="wikEdLastPos" alt="' + wikEdText['wikEdLastPos alt'] + '" title="' + wikEdText['wikEdLastPos title'] + '" onClick="javascript:WikEdEditButton(\'wikEdLastPos\');">';
html += '<br />';
html += '<img class="wikEdButton" src="' + wikEdImage['clearFind'] + '" width="16" height="16" id="wikEdClearFind" alt="' + wikEdText['wikEdClearFind alt'] + '" title="' + wikEdText['wikEdClearFind title'] + '" onClick="javascript:WikEdButton(\'wikEdClearFind\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['replaceAll'] + '" width="16" height="16" id="wikEdReplaceAll" alt="' + wikEdText['wikEdReplaceAll alt'] + '" title="' + wikEdText['wikEdReplaceAll title'] + '" onClick="javascript:WikEdEditButton(\'wikEdReplaceAll\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['replacePrev'] + '" width="16" height="16" id="wikEdReplacePrev" alt="' + wikEdText['wikEdReplacePrev alt'] + '" title="' + wikEdText['wikEdReplacePrev title'] + '" onClick="javascript:WikEdEditButton(\'wikEdReplacePrev\');">';
html += '<span class="wikEdReplaceComboInput" id="wikEdReplaceComboInput">';
html += '<input class="wikEdCombo" id="wikEdReplaceText" type="text" value="" onfocus="this.setSelectionRange(0, this.textLength);">';
html += '<select class="wikEdCombo" id="wikEdReplaceSelect" onfocus="WikEdSetComboOptions(\'replace\')" onChange="javascript:WikEdChangeComboInput(\'replace\');">';
html += '</select>';
html += '</span>';
html += '<img class="wikEdButton" src="' + wikEdImage['replaceNext'] + '" width="16" height="16" id="wikEdReplaceNext" alt="' + wikEdText['wikEdReplaceNext alt'] + '" title="' + wikEdText['wikEdReplaceNext title'] + '" onClick="javascript:WikEdEditButton(\'wikEdReplaceNext\');">';
html += '<img class="wikEdButtonUnchecked" src="' + wikEdImage['caseSensitive'] + '" width="16" height="16" id="wikEdCaseSensitive" alt="' + wikEdText['wikEdCaseSensitive alt'] + '" title="' + wikEdText['wikEdCaseSensitive title'] + '" onClick="javascript:WikEdButton(\'wikEdCaseSensitive\', true);">';
html += '<img class="wikEdButtonUnchecked" src="' + wikEdImage['regExp'] + '" width="16" height="16" id="wikEdRegExp" alt="' + wikEdText['wikEdRegExp alt'] + '" title="' + wikEdText['wikEdRegExp title'] + '" onClick="javascript:WikEdButton(\'wikEdRegExp\', true);">';
html += '<img class="wikEdButtonUnchecked" src="' + wikEdImage['findAhead'] + '" width="16" height="16" id="wikEdFindAhead" alt="' + wikEdText['wikEdFindAhead alt'] + '" title="' + wikEdText['wikEdFindAhead title'] + '" onClick="javascript:WikEdButton(\'wikEdFindAhead\', true);">';
html += '</div>';
// fixing buttons
html += '<div class="wikEdButtonsFix" id="wikEdButtonsFix">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixBasic'] + '" width="16" height="16" id="wikEdFixBasic" alt="' + wikEdText['wikEdFixBasic alt'] + '" title="' + wikEdText['wikEdFixBasic title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixBasic\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixHtml'] + '" width="16" height="16" id="wikEdFixHtml" alt="' + wikEdText['wikEdFixHtml alt'] + '" title="' + wikEdText['wikEdFixHtml title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixHtml\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixCaps'] + '" width="16" height="16" id="wikEdFixCaps" alt="' + wikEdText['wikEdFixCaps alt'] + '" title="' + wikEdText['wikEdFixCaps title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixCaps\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixUnicode'] + '" width="16" height="16" id="wikEdfixUnicode" alt="' + wikEdText['wikEdfixUnicode alt'] + '" title="' + wikEdText['wikEdfixUnicode title'] + '" onClick="javascript:WikEdEditButton(\'wikEdfixUnicode\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixAll'] + '" width="16" height="16" id="wikEdFixAll" alt="' + wikEdText['wikEdFixAll alt'] + '" title="' + wikEdText['wikEdFixAll title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixAll\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixRegExTypo'] + '" width="16" height="16" id="wikEdFixRegExTypo" alt="' + wikEdText['wikEdFixRegExTypo alt'] + '" title="' + wikEdText['wikEdFixRegExTypo title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixRegExTypo\');">';
html += '<br />';
html += '<img class="wikEdButton" src="' + wikEdImage['fixDash'] + '" width="16" height="16" id="wikEdFixDashes" alt="' + wikEdText['wikEdFixDashes alt'] + '" title="' + wikEdText['wikEdFixDashes title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixDashes\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixPunct'] + '" width="16" height="16" id="wikEdFixPunct" alt="' + wikEdText['wikEdFixPunct alt'] + '" title="' + wikEdText['wikEdFixPunct title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixPunct\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixMath'] + '" width="16" height="16" id="wikEdFixMath" alt="' + wikEdText['wikEdFixMath alt'] + '" title="' + wikEdText['wikEdFixMath title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixMath\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixChem'] + '" width="16" height="16" id="wikEdFixChem" alt="' + wikEdText['wikEdFixChem alt'] + '" title="' + wikEdText['wikEdFixChem title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixChem\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['fixUnits'] + '" width="16" height="16" id="wikEdFixUnits" alt="' + wikEdText['wikEdFixUnits alt'] + '" title="' + wikEdText['wikEdFixUnits title'] + '" onClick="javascript:WikEdEditButton(\'wikEdFixUnits\');">';
html += '</div>';
html += '<br style="clear: both;">';
// 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,204 ⟶ 1,174:
// add preview box top bar to submit wrapper
var buttonsPreview = document.createElement('div');
buttonsPreview.id = 'wikEdButtonsPreview';
buttonsPreview.className = 'wikEdButtonsPreview';
html = '';
html += '<img class="wikEdButton" src="' + wikEdImage['preview'] + '" width="16" height="16" id="wikEdPreview" alt="' + wikEdText['wikEdPreview alt'] + '" title="' + wikEdText['wikEdPreview title'] + '" onClick="javascript:WikEdButton(\'wikEdPreview\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['diff'] + '" width="16" height="16" id="wikEdDiff" alt="' + wikEdText['wikEdDiff alt'] + '" title="' + wikEdText['wikEdDiff title'] + '" onClick="javascript:WikEdButton(\'wikEdDiff\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['close'] + '" width="16" height="16" id="wikEdClose" alt="' + wikEdText['wikEdClose alt'] + '" title="' + wikEdText['wikEdClose title'] + '" onClick="javascript:WikEdButton(\'wikEdClose\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['scrollToButtons'] + '" width="16" height="16" id="wikEdScrollToButtons2" alt="' + wikEdText['wikEdScrollToButtons2 alt'] + '" title="' + wikEdText['wikEdScrollToButtons2 title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToButtons2\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['scrollToText'] + '" width="16" height="16" id="wikEdScrollToInput2" alt="' + wikEdText['wikEdScrollToInput2 alt'] + '" title="' + wikEdText['wikEdScrollToInput2 title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToInput2\');">';
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="wikEdPreviewBox" class="wikEdPreviewBox">';
html += '</div>';
html += '</div>';
html += '<div id="wikEdButtonsPreview2" class="wikEdButtonsPreview2">';
html += '<img class="wikEdButton" src="' + wikEdImage['preview'] + '" width="16" height="16" id="wikEdPreview2" alt="' + wikEdText['wikEdPreview2 alt'] + '" title="' + wikEdText['wikEdPreview2 title'] + '" onClick="javascript:WikEdButton(\'wikEdPreview2\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['diff'] + '" width="16" height="16" id="wikEdDiff2" alt="' + wikEdText['wikEdDiff2 alt'] + '" title="' + wikEdText['wikEdDiff2 title'] + '" onClick="javascript:WikEdButton(\'wikEdDiff2\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['close'] + '" width="16" height="16" id="wikEdClose2" alt="' + wikEdText['wikEdClose2 alt'] + '" title="' + wikEdText['wikEdClose2 title'] + '" onClick="javascript:WikEdButton(\'wikEdClose2\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['scrollToButtons'] + '" width="16" height="16" id="wikEdScrollToButtons3" alt="' + wikEdText['wikEdScrollToButtons3 alt'] + '" title="' + wikEdText['wikEdScrollToButtons3 title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToButtons3\');">';
html += '<img class="wikEdButton" src="' + wikEdImage['scrollToText'] + '" width="16" height="16" id="wikEdScrollToInput3" alt="' + wikEdText['wikEdScrollToInput3 alt'] + '" title="' + wikEdText['wikEdScrollToInput3 title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToInput3\');">';
html += '</div>';
wikEdLocalPrevWrapper.innerHTML = html;
wikEdPreviewBox = document.getElementById('wikEdPreviewBox');
wikEdButtonsPreview2 = document.getElementById('wikEdButtonsPreview2');
// add jump box to standard preview
Line 1,225 ⟶ 1,212:
if (wikiPreview != null) {
if (wikiPreview.firstChild != null) {
var buttonsJump = document.createElement('div');
buttonsJump.id = 'wikEdButtonsJump';
buttonsJump.className = 'wikEdButtonsJump';
html = '';
html += '<img class="wikEdButtonSolo" src="' + wikEdImage['scrollToButtons'] + '" width="16" height="16" id="wikEdScrollToButtons4" alt="' + wikEdText['wikEdScrollToButtons4 alt'] + '" title="' + wikEdText['wikEdScrollToButtons4 title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToButtons4\');">';
html += '<img class="wikEdButtonSolo" src="' + wikEdImage['scrollToText'] + '" width="16" height="16" id="wikEdScrollToInput4" alt="' + wikEdText['wikEdScrollToInput4 alt'] + '" title="' + wikEdText['wikEdScrollToInput4 title'] + '" onClick="javascript:WikEdButton(\'wikEdScrollToInput4\');">';
buttonsJump.innerHTML = html;
wikiPreview.insertBefore(buttonsJump, wikiPreview.firstChild);
wikEdButtonsJump = document.getElementById('wikEdButtonsJump');
}
}
Line 1,557 ⟶ 1,554:
return;
}
Line 2,042 ⟶ 1,996:
break;
// wikify, textify: selection / whole
case 'wikEdWikify':
case 'wikEdTextify':
WikEdGetText(obj, 'selection');
if (obj.selection.plain != '') {
Line 2,050 ⟶ 2,005:
else {
WikEdGetText(obj, 'whole');
obj.changed = obj.whole;
}
Line 2,505 ⟶ 2,448:
// textify: strip html from pasted content
case 'wikEdTextify':
var objTextify = {};
// get inner html without wikifying
if (obj.
WikEdGetInnerHTML(objTextify, wikEdFrameBody);
}
else {
obj.selection.range = obj.sel.getRangeAt(obj.sel.rangeCount - 1);
var documentFragment = obj.selection.range.cloneContents();
WikEdGetInnerHTML(objTextify, documentFragment);
}
WikEdTextify(objTextify);
break;
Line 2,974 ⟶ 2,914:
//
function WikEdGetText(obj, whichFragment
// get selection object
Line 3,008 ⟶ 2,948:
WikEdGetInnerHTML(obj.whole, wikEdFrameBody);
obj.whole.code = obj.whole.html;
WikEdRemoveHighlightingWikify(obj.whole
obj.whole.plain = obj.whole.html;
obj.whole.plain = obj.whole.plain.replace(/<br\b[^>]*>/g, '\n');
obj.whole.plain = obj.whole.plain.replace(/\u00a0/g, ' ');
obj.whole.range.setStartBefore(wikEdFrameBody.firstChild);
obj.whole.range.setEndAfter(wikEdFrameBody.lastChild);
}
}
Line 3,028 ⟶ 2,970:
WikEdGetInnerHTML(obj.selection, documentFragment);
obj.selection.code = obj.selection.html;
WikEdRemoveHighlightingWikify(obj.selection
obj.selection.plain = obj.selection.html;
obj.selection.plain = obj.selection.plain.replace(/<br\b[^>]*>/g, '\n');
Line 3,054 ⟶ 2,996:
WikEdGetInnerHTML(obj.focusWord, documentFragment);
obj.focusWord.code = obj.focusWord.html;
WikEdRemoveHighlightingWikify(obj.focusWord
obj.focusWord.plain = obj.focusWord.html;
obj.focusWord.plain = obj.focusWord.plain.replace(/<br\b[^>]*>/g, '\n');
Line 3,063 ⟶ 3,005:
WikEdGetInnerHTML(obj.focusLine, documentFragment);
obj.focusLine.code = obj.focusLine.html;
WikEdRemoveHighlightingWikify(obj.focusLine
obj.focusLine.plain = obj.focusLine.html;
obj.focusLine.plain = obj.focusLine.plain.replace(/<br\b[^>]*>/g, '\n');
Line 3,091 ⟶ 3,033:
WikEdGetInnerHTML(obj.selectionWord, documentFragment);
obj.selectionWord.code = obj.selectionWord.html;
WikEdRemoveHighlightingWikify(obj.selectionWord
obj.selectionWord.plain = obj.selectionWord.html;
obj.selectionWord.plain = obj.selectionWord.plain.replace(/<br\b[^>]*>/g, '\n');
Line 3,100 ⟶ 3,042:
WikEdGetInnerHTML(obj.selectionLine, documentFragment);
obj.selectionLine.code = obj.selectionLine.html;
WikEdRemoveHighlightingWikify(obj.selectionLine
obj.selectionLine.plain = obj.selectionLine.html;
obj.selectionLine.plain = obj.selectionLine.plain.replace(/<br\b[^>]*>/g, '\n');
Line 3,204 ⟶ 3,146:
}
// foundRanges.push(obj.changed.range.cloneRange());
/// return(foundRanges);
//
Line 4,039 ⟶ 3,983:
//
function WikEdRemoveHighlightingWikify(obj
if (obj.html != '') {
Line 4,047 ⟶ 3,991:
// wikify, don't allow many attributes
if
WikEdWikifyHTML(obj, false);
}
Line 4,254 ⟶ 4,198:
// <table>
obj.html = obj.html.replace(/[\s\u0000]*<table>[\s\u0000]*(\|-(?=[\n\u0000]))?/g, '\u0000\u0000{|\u0000');
obj.html = obj.html.replace(/[\s\u0000]*<(table) +([^>]*)>[\s\u0000]*(\|-(?=[\n\u0000]))?/g,
Line 4,277 ⟶ 4,222:
// get the title="" parameter
regExpStr = ' href=\\"(' + wikEdServer + '|
regExp = new RegExp(regExpStr);
regExpMatch = regExp.exec(linkPar);
Line 4,290 ⟶ 4,235:
// get wiki article name from url parameter list
regExpStr = ' href=\\"
regExp = new RegExp(regExpStr);
regExpMatch = regExp.exec(linkPar);
if (regExpMatch != null) {
linkArticle = regExpMatch[
if (linkArticle != '') {
linkArticle = linkArticle.replace(/_/g, ' ');
Line 4,300 ⟶ 4,245:
// ISBN links
regExpStr = ' href=\\"
regExp = new RegExp(regExpStr);
regExpMatch = regExp.exec(linkPar);
if (regExpMatch != null) {
}
}
Line 4,316 ⟶ 4,256:
// get wiki article name from url
if (linkArticle == '') {
regExpStr = ' href=\\"
regExp = new RegExp(regExpStr);
regExpMatch = regExp.exec(linkPar);
if (regExpMatch != null) {
linkArticle = regExpMatch[
if (linkArticle != '') {
linkArticle = linkArticle.replace(/_/g, ' ');
Line 4,332 ⟶ 4,272:
// check for wiki image
////////////// detect commons uploads
regExpStr = '^<img\\b[^>]*?\\bwidth=\\"(\\d+)\\"[^>]*?>$';
regExp = new RegExp(regExpStr);
Line 4,345 ⟶ 4,286:
return('[[' + linkArticle + imgWidth + ']]');
}
}
// ISBN link
regExpStr = '^' + wikEdServer + wikEdScriptPath + 'index\\.php\\?.*?\\btitle=.*?&isbn=(\d+)';
regExp = new RegExp(regExpStr);
regExpMatch = regExp.exec(linkAddr);
if (regExpMatch != null) {
return('ISBN ' + regExpMatch[1]);
}
Line 4,930 ⟶ 4,879:
// <nowiki> <math> <noinclude> <includeonly> <ref> <references> wiki markup
obj.html = obj.html.replace(/((<)(nowiki|math|gallery|noinclude|includeonly|ref|references)\b.*?(>)(.*?)(<)\/
// URLs, allowed chars: \w / . & ? = - @ # % ~ + (; allowed because of & and common misuse)
Line 4,939 ⟶ 4,888:
}
);
// URLs with text
obj.html = obj.html.replace(/(\[)( *<span class=\"wikEdURLLink\">.*?<\!--wikEdURLLink--> *)([^\]\n]*?)( *\])/gi,
Line 4,953 ⟶ 4,903:
}
);
// [[Image: ]] images
var regExpImg = new RegExp('(\\[\\[)(' + wikEdText['wikicode Image'] + ' *: *)([^\\]\\[\\|]*? *)(\\|(\\[[^\\]]*\\]|\\[\\[[^\\]]*\\]\\]|[^\\[\\]\\|]+|\\|)*)(\\]\\])', 'gi');
Line 5,074 ⟶ 5,025:
// #redirect
obj.html = obj.html.replace(/(^|\n)(#)(redirect\b)/g, '$1<span class="wikEdWikiRedir">$3</span><!--wikEdWikiRedir-->');
/////////// blocks original place
// <b> <i>
|