MediaWiki:Gadget-wikEd.js: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
Nowa strona: →<pre><nowiki>: // http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript // version info window.wikEdProgramVersion = '0.9.56'; window.wik... |
update |
||
Linia 1:
/
// version info
window.wikEdProgramVersion = window.wikEdProgramVersion || '0.9.
window.wikEdProgramDate = window.wikEdProgramDate || '
/*
Linia 114:
'wikEdSubscript title': 'Subscript text',
'wikEdRef alt': 'Ref',
'wikEdRef title': 'In-text reference (shift-click: named tag)',
'wikEdCase alt': 'Case',
'wikEdCase title': 'Toggle between lowercase, uppercase first, and uppercase',
Linia 144:
'wikEdTable title': 'Table',
'wikEdReferences alt': 'References',
'wikEdReferences title': 'References location (shift-click:
'wikEdWikify alt': 'Wikify',
'wikEdWikify title': 'Convert pasted content to wiki code, update highlighting',
Linia 289:
'wikicode Category': 'Category',
'wikicode Template': 'Template',
'wikEdReferencesSection': '\n== References ==\n\n<
// shortened button texts
Linia 296:
// follow link popup
'followLink': '(
});
}
Linia 511:
// logo
'.wikEdLogo': 'margin-left: 0.5em;',
'.wikEdLogoFallBack': 'float: right;',
Linia 578:
// find field
'.wikEdFindComboInput': 'position: relative; padding: 0; margin: 0 0.2em; white-space: nowrap; top: 0; vertical-align: bottom;',
'#wikEdFindText': 'vertical-align: 0%; font-family: monospace
'#wikEdFindSelect': 'vertical-align: 0%; font-family: monospace
// replace field
'.wikEdReplaceComboInput': 'position: relative; padding: 0; margin: 0 0.2em; white-space: nowrap; top: 0; vertical-align: bottom;',
'#wikEdReplaceText': 'vertical-align: 0%; font-family: monospace
'#wikEdReplaceSelect': 'vertical-align: 0%; font-family: monospace
// summary field
'.wikEdSummaryComboInput': 'position: relative; padding: 0; margin: 0 0 0 0.1em; white-space: nowrap; top: 0; vertical-align: text-bottom;',
'.wikEdSummaryText': 'vertical-align: 0%
'.wikEdSummarySelect': 'vertical-align: 0%
// space around submit buttons
Linia 622:
'.wikEdSummaryInputWrapper': 'display: inline; white-space: nowrap;',
'.wikEdSummaryOptions': 'display: inline;',
'.wikEdSubmitWrapper': '
'.wikEdSubmitButtonsWrapper': '',
'.wikEdLocalPrevWrapper': 'margin: 0.5em 0 0 0;',
'.wikEdInsertWrapper': '',
Linia 651:
8: ['wikEdSuperscript', 'wikEdButton', wikEdText['wikEdSuperscript title'], wikEdImage['superscript'], '16', '16', wikEdText['wikEdSuperscript alt'], 'javascript:WikEdEditButton(obj, obj.id);' ],
9: ['wikEdSubscript', 'wikEdButton', wikEdText['wikEdSubscript title'], wikEdImage['subscript'], '16', '16', wikEdText['wikEdSubscript alt'], 'javascript:WikEdEditButton(obj, obj.id);' ],
10: ['wikEdRef', 'wikEdButton', wikEdText['wikEdRef title'], wikEdImage['ref'], '16', '16', wikEdText['wikEdRef alt'], 'if (!event.shiftKey) { javascript:WikEdEditButton(obj, \'wikEdRef\'); } else { javascript:WikEdEditButton(obj
12: ['wikEdCase', 'wikEdButton', wikEdText['wikEdCase title'], wikEdImage['case'], '16', '16', wikEdText['wikEdCase alt'], 'javascript:WikEdEditButton(obj, obj.id);' ],
25: ['wikEdRedirect', 'wikEdButton', wikEdText['wikEdRedirect title'], wikEdImage['redirect'], '16', '16', wikEdText['wikEdRedirect alt'], 'javascript:WikEdEditButton(obj, obj.id);' ],
Linia 840:
// enable RegExTypoFix button (http://en.wikipedia.org/wiki/User:Mboverload/RegExTypoFix)
if (typeof(wikEdRegExTypoFix) == 'undefined') { window.wikEdRegExTypoFix = false; }
// enable highlighting as links
Linia 889 ⟶ 888:
// fix punctuation, string added before fixed punctuation
window.wikEdFixPunctSpace = window.wikEdFixPunctSpace || '';
// do not rearrange page elements
if (typeof(wikEdNoRearrange) == 'undefined') { window.wikEdNoRearrange = false; }
// wikEdSetupHook, executed after wikEd has been set up, usage: wikEdSetupHook.push(YourFunction);
window.wikEdSetupHook = window.wikEdSetupHook || [];
// wikEdOnHook, executed after wikEd has been re-enabled by logo click, usage: wikEdOnHook.push(YourFunction);
window.wikEdOnHook = window.wikEdOnHook || [];
// wikEdOffHook, executed after wikEd has been disabled by logo click, usage: wikEdOffHook.push(YourFunction);
window.wikEdOffHook = window.wikEdOffHook || [];
// wikEdTextareaHook, executed after classic textarea has been enabled by user, usage: wikEdTextareaHook.push(YourFunction);
window.wikEdTextareaHook = window.wikEdTextareaHook || [];
// wikEdFrameHook, executed after wikEd edit frame has been enabled by user, usage: wikEdFrameHook.push(YourFunction);
window.wikEdFrameHook = window.wikEdFrameHook || [];
return;
Linia 894 ⟶ 911:
// diff script URL
// wikEdDiff script URL, also defined in wikEdDiff.js
// InstaView script URL
// wikEd-as-gadget detection, set to true if gadget script name is not MediaWiki:Gadget-wikEd.js
window.wikEdGadget = window.wikEdGadget || null;
Linia 918 ⟶ 938:
window.wikEdTurnedOn = null;
window.wikEdDisabled = null;
window.wikEdUpload = null;
// history
Linia 942 ⟶ 963:
window.wikEdDebug = null;
window.wikEdTextarea = null;
window.wikEdEditForm = null;
window.wikEdFrame = null;;
window.wikEdFrameBody = null;
Linia 1014 ⟶ 1036:
window.wikEdWikiGlobals = window.wikEdWikiGlobals || [];
window.wikEdDirection = null;
// overide site javascript functions
window.WikEdInsertTagsOriginal = null;
Linia 1056 ⟶ 1078:
window.wikEdExternalScripts = window.wikEdExternalScripts || null;
window.wikEdStartup = window.wikEdStartup || false;
window.wikEdPageLoaded = window.wikEdPageLoaded || false;
// browser identification
window.wikEdBrowserName = window.wikEdBrowserName || '';
window.wikEdBrowserFlavor = window.wikEdBrowserFlavor || '';
window.wikEdBrowserVersion = window.wikEdBrowserVersion || 0;
window.wikEdMSIE = window.wikEdMSIE || false;
window.wikEdMozilla = window.wikEdMozilla || false;
window.wikEdOpera = window.wikEdOpera || false;
window.wikEdGreasemonkey = window.wikEdGreasemonkey || null;
// general MediaWiki page detection
// skin name window.wikEdMediaWikiSkinIds = window.wikEdMediaWikiSkinIds || {
// monobook, also detects simple and myskin
monobook: [ 'p-personal', true, true, ['column-content', 'content', 'bodyContent', 'siteSub', 'contentSub', 'column-one', 'p-cactions', 'p-personal'] ],
// other MediaWiki skins
standard: [ 'quickbar', false,
nostalgia: [ 'topbar', false,
cologneblue: [ 'quickbar', false,
modern: [ 'p-personal', true, true, ['mw_header', 'mw_main', 'mw_contentwrapper'] ],
//
quartz: [ 'welcome', false, true, ['articleWrapper', 'bodyContent', 'siteSub', 'contentSub', 'sidebar'] ],
searchwikia: [ 'header-li-buttons', false, true, ['header', 'header-container', 'header-go-button', 'article-container', 'article', 'article-text'] ],
// custom skins used on mozilla.org and mozdev org
cavendish: [ 'mozilla-org', false, true, ['internal', 'mozilla-org', 'header', 'contentTop', 'mBody', 'side', 'nav', 'mainContent', 'siteSub', 'contentSub'] ],
devmo: [ 'mozilla-org', false, true, ['container', 'mozilla-org', 'header', 'navigation', 'bar', 'personal', 'page', 'sidebar', 'sidebarslideup', 'contentTop', 'siteSub', 'contentSub'] ],
// custom skins
gumax: [ 'gumax-p-navigation', false, true, ['gumax-header', 'gumax-content-body'] ],
// custom MediaWiki identifier
mediawiki: [ '', false, false, ['mediawiki'] ]
};
window.
window.wikEdRearrange = window.wikEdRearrange || false;
window.wikEdLogoToList = window.wikEdLogoToList || false;
window.wikEdSkin = window.wikEdSkin || '';
Linia 1148 ⟶ 1175:
// check if this has already been run
if (
return;
}
// redirect WED shortcut to WikEdDebug(objectName, object, popup)
Linia 1157 ⟶ 1184:
// check browser and version
var agent = navigator.userAgent.match(/(Firefox|Netscape|SeaMonkey|IceWeasel|IceCat|Minefield|BonEcho)\W+(\d+\.\d+)/i);
if (agent != null) {
}
Linia 1203 ⟶ 1230:
return;
}
// detect already loaded external scripts
if (wikEdExternalScripts == null) {
Linia 1210 ⟶ 1237:
for (var i = 0; i < pageScripts.length; i ++) {
var scriptSrc = pageScripts[i].src;
var nameMatch = scriptSrc.match(/\
if (nameMatch == null) {
nameMatch = scriptSrc.match(/\/([^\/]*?)($|\?)/);
}
if (nameMatch != null) {
var scriptName = nameMatch[1];
Linia 1239 ⟶ 1269:
else {
window.GM_log = window.WikEdDebug;
}
// detect wiked running as a gadget
if (wikEdGadget == null) {
if (wikEdExternalScripts['MediaWiki:Gadget-wikEd.js'] == true) {
wikEdGadget = true;
}
}
Linia 1251 ⟶ 1288:
for (var skin in wikEdMediaWikiSkinIds) {
var logoElement = wikEdMediaWikiSkinIds[skin][0];
var
var rearrange = wikEdMediaWikiSkinIds[skin][2];
var skinIds = wikEdMediaWikiSkinIds[skin][3];
if (typeof(logoElement) != 'string') {
continue;
Linia 1261 ⟶ 1300:
}
if (i == skinIds.length) {
wikEdSkinLogo = logoElement;
wikEdSkin = skin;
wikEdRearrange = rearrange;
wikEdLogoToList = logoToList;
break;
}
Linia 1274 ⟶ 1315:
// initialize user configurable variables
WikEdInitGlobalConfigs();
// do not rearrange page elements
if (wikEdNoRearrange != false) {
wikEdRearrange = false;
}
// initialize non-configurable variables
Linia 1279 ⟶ 1325:
// parse global MediaWiki globals into hash
var variable = ['wgServer', 'wgTitle', 'wgCanonicalNamespace', 'wgArticlePath', 'wgScriptPath', 'wgUserName', 'wgCurRevisionId', 'wgScript'];
for (var i = 0; i < variable.length; i ++) {
wikEdWikiGlobals[ variable[i] ] = WikEdGetGlobal(variable[i]);
Linia 1299 ⟶ 1345:
// monobook, simple, myskin
if (
wikEdLogoList = document.createElement('li');
wikEdLogoList.id = 'wikEdLogoList';
wikEdLogoList.appendChild(wikEdLogo);
var personalTools = document.getElementById(
if (personalTools != null) {
personalTools.getElementsByTagName('ul')[0].appendChild(wikEdLogoList);
wikEdLogo.className = 'wikEdLogo';
}
}
// other skins
if (wikEdSkinLogo != '') {
document.getElementById(wikEdSkinLogo).appendChild(wikEdLogo); wikEdLogo.className = 'wikEdLogo';
}
// fallback for undetected skin
else {
document.body.insertBefore(wikEdLogo, document.body.firstChild);
wikEdLogo.className = 'wikEdLogoFallBack';
}
}
Linia 1439 ⟶ 1487:
// browser or version not supported, set error message and exit
if ( (wikEdBrowserNotSupported == true) && (wikEdSkipBrowserTest == false) ) {
WikEdSetLogo('browser');
return;
}
Linia 1445 ⟶ 1493:
// check if this is an edit page
wikEdTextarea = document.getElementsByName('wpTextbox1')[0];
wikEdSaveButton = document.getElementById('wpSave');
if ( (wikEdTextarea == null) || (
// check if this is an upload page
wikEdTextarea = document.getElementsByName('wpUploadDescription')[0];
wikEdEditForm = document.getElementById('upload');
wikEdSaveButton = document.getElementsByName('wpUpload')[0];
if ( (wikEdTextarea == null) || (wikEdEditForm == null) || (wikEdSaveButton == null) ) {
// set error indicator
WikEdSetLogo();
return;
}
wikEdUpload = true;
wikEdRearrange = false;
}
Linia 1512 ⟶ 1569:
wikEdDiff = WikEdGetSavedSetting('wikEdDiff', wikEdDiffPreset);
// no fullscreen for preview and upload pages
if ( (wikEdUpload == true) || (window.location.search.match(/(\?|&)action=submit\b/) != null) ) {
wikEdFullScreenMode = false;
}
Linia 1574 ⟶ 1631:
// create captcha wrapper
if (wikEdRearrange == true) {
wikEdInputWrapper.appendChild(wikEdCaptchaWrapper);
}
// create debug textarea wrapper
Linia 1602 ⟶ 1661:
wikEdFrameWrapper.style.visibility = styleFrameWrapperVisibility;
wikEdInputWrapper.appendChild(wikEdFrameWrapper);
// create console wrapper for buttons, summary, and submit
if (wikEdRearrange == true) {
wikEdInputWrapper.appendChild(wikEdConsoleWrapper);
}
// create buttons wrapper for wikEd buttons
Linia 1616 ⟶ 1677:
// create summary wrapper for summary, minor edit, and watch this page
if (wikEdRearrange == true) {
wikEdSummaryWrapper.id = 'wikEdSummaryWrapper';
// add summary above the edit field if we add a new section (+ tab)
wikEdSummaryWrapper.className = 'wikEdSummaryWrapperTop';
wikEdInputWrapper.insertBefore(wikEdSummaryWrapper, wikEdFrameWrapper);
wikEdConsoleWrapper.appendChild(wikEdSummaryWrapper);
// create summary input wrapper
// create minor edit and watch page wrapper
// create submit wrapper for submit elements
// create submit buttons wrapper for submit buttons and help links
}
// create preview wrapper for preview and diff box
Linia 1658 ⟶ 1721:
wikEdLocalPrevWrapper.className = 'wikEdLocalPrevWrapper';
wikEdLocalPrevWrapper.style.display = 'none';
if (wikEdRearrange == true) {
wikEdInputWrapper.appendChild(wikEdLocalPrevWrapper);
}
else {
wikEdSaveButton.parentNode.appendChild(wikEdLocalPrevWrapper);
}
// create insert wrapper for insert special chars links
if (wikEdRearrange == true) {
wikEdInputWrapper.appendChild(wikEdInsertWrapper);
}
// append input wrapper to document
if (wikEdRearrange == true) {
wikEdEditForm.insertBefore(wikEdInputWrapper, wikEdEditForm.firstChild);
}
// fill the wrappers
Linia 1693 ⟶ 1765:
// add elements between form and textarea to captcha wrapper
if (wikEdUpload != true) {
var node = wikEdInputWrapper.nextSibling;
if (node == wikEdTextarea) {
break;
}
var nextNode = node.nextSibling;
wikEdCaptchaWrapper.appendChild(node);
node = nextNode;
}
}
Linia 1713 ⟶ 1787:
}
if (wpSummary.length > 0) {
wikEdEditOptions = wpSummary[0].parentNode;
wikEdEditOptions.className = 'wikEdEditOptions';
}
// add summary elements to summary input wrapper
if (wikEdRearrange == true) {
if (wikEdSummaryLabel != null) {
wikEdSummaryInputWrapper.appendChild(wikEdSummaryLabel); }
wikEdSummaryText = document.getElementsByName('wpSummary')[0];
wikEdSummaryInputWrapper.appendChild(wikEdSummaryText);
}
// move editpage-copywarn out of summary wrapper
// needs to be done before appending editOptions to summary wrapper otherwise a linebreak stays (Mozilla bug)
if (wikEdRearrange == true) {
var copywarn = document.getElementById('editpage-copywarn');
if (copywarn != null) {
wikEdInputWrapper.parentNode.insertBefore(copywarn, wikEdInputWrapper.nextSibling); }
}
// add submit buttons to submit wrapper
if (wikEdRearrange == true) {
var wpEditButtons = wikEdSaveButton.parentNode;
wikEdSubmitWrapper.insertBefore(wpEditButtons, wikEdSubmitButtonsWrapper);
}
// move edit options after submit buttons; crashes Mozilla when appended after filling the iframe
wikEdPreviewButton = document.getElementById('wpPreview');
if (wikEdRearrange == true) {
if (wikEdDiffPreviewButton != null) {
wikEdDiffPreviewButton.parentNode.insertBefore(wikEdEditOptions, wikEdDiffPreviewButton.nextSibling);
// remove linebreak before minor edit checkbox
if (node.tagName != null) {
if (node.tagName == 'BR') {
node.parentNode.removeChild(node);
break;
}
}
node = node.nextSibling;
}
// correct tab order between check boxes and submits
if (wikEdSubmitTabOrder == true) {
var wpWatchthis = document.getElementById('wpWatchthis');
var tabIndex = [];
tabIndex.push(wpMinoredit.tabIndex, wpWatchthis.tabIndex, wikEdSaveButton.tabIndex, wikEdPreviewButton.tabIndex, wikEdDiffPreviewButton.tabIndex);
wikEdPreviewButton.tabIndex = tabIndex.shift();
}
}
}
}
Linia 1854 ⟶ 1940:
// add preview box top bar to submit wrapper
wikEdButtonBarPreview = MakeButtonBar(wikEdButtonBar['preview']);
if (wikEdRearrange == true) {
wikEdSubmitWrapper.insertBefore(wikEdButtonBarPreview, wikEdSubmitWrapper.firstChild);
}
// add preview box and its bottom bar to preview wrapper
if (wikEdLocalPrevWrapper != null) {
var div = document.createElement('div');
div.className = 'wikEdPreviewBoxOuter';
wikEdLocalPrevWrapper.appendChild(div);
div.appendChild(wikEdPreviewBox);
wikEdLocalPrevWrapper.appendChild(wikEdButtonBarPreview2);
}
// add jump box to standard preview
Linia 1880 ⟶ 1970:
// add insert special chars to insert wrapper
if (wikEdInsertWrapper != null) {
wikEdInsertWrapper.appendChild(wpSpecialchars);
}
}
Linia 1898 ⟶ 1990:
localPreviewImg.alt = wikEdText['wikEdLocalPreviewImg alt'];
localPreviewImg.title = wikEdText['wikEdLocalPreviewImg title'];
wikEdLocalPreview.appendChild(localPreviewImg);
if (wikEdPreviewButton != null) {
wikEdPreviewButton.parentNode.insertBefore(wikEdLocalPreview, wikEdPreviewButton.nextSibling);
}
else {
wikEdSaveButton.parentNode.insertBefore(wikEdLocalPreview, wikEdSaveButton.nextSibling);
}
// add local diff button next to submit button
if (wikEdDiffPreviewButton != null) {
wikEdLocalDiff.className = 'wikEdLocalDiff';
localDiffImg.title = wikEdText['wikEdLocalDiffImg title'];
wikEdLocalDiff.appendChild(localDiffImg);
wikEdDiffPreviewButton.parentNode.insertBefore(wikEdLocalDiff, wikEdDiffPreviewButton.nextSibling);
}
// initialize image buttons
WikEdButton(document.getElementById('wikEdDiff'), 'wikEdDiff', null, wikEdDiff);
Linia 1935 ⟶ 2034:
// add a clear summary button left to the summary input field
if (wikEdSummaryText != null) {
var clearSummaryForm = document.createElement('form'); // remember button width, might be without image
// make the summary a combo box
wikEdSummaryTextWidth = 150;
}
wikEdSummaryText.style.width = wikEdSummaryTextWidth + 'px';
wikEdSummarySelect = document.createElement('select');
wikEdSummarySelect.id = 'wikEdSummarySelect';
wikEdSummarySelect.className = 'wikEdSummarySelect';
summaryComboInput.appendChild(wikEdSummaryText);
summaryComboInput.appendChild(wikEdSummarySelect);
}
// shorten submit button texts
if (wikEdPreviewButton != null) {
wikEdPreviewButton.value = wikEdText['shortenedPreview']; }
if (wikEdDiffPreviewButton != null) {
wikEdDiffPreviewButton.value = wikEdText['shortenedChanges'];
}
// set up combo input boxes with history
Linia 1995 ⟶ 2100:
wikEdSelectElement['replace'].title = wikEdText['wikEdReplaceSelect title'];
if (wikEdSummaryInputWrapper != null) {
wikEdSelectElement['summary'].title = wikEdText['wikEdSummarySelect title'];
}
// adjust the select field widths to that of the text input fields
WikEdResizeComboInput('find');
Linia 2027 ⟶ 2134:
// add a link to the wikEd help page
if (wikEdRearrange == true) {
if ( (wikEdHelpPageLink != '') && (wikEdHelpPageLink != null) ) { var editHelpParent =
do {
if (editHelpParent ==
break;
}
} while (
var editHelp = editHelpParent.lastChild;
while (editHelp.tagName != 'A') {
editHelp = editHelp.previousSibling;
}
wikEdHelpSpan = document.createElement('span');
wikEdHelpSpan.id = 'wikEdHelpSpan';
wikEdHelpSpan.className = 'wikEdHelpSpan';
wikEdHelpSpan.innerHTML = wikEdHelpPageLink;
editHelpParent.insertBefore(wikEdHelpSpan, editHelp.nextSibling);
wikEdEditHelp = wikEdHelpSpan.parentNode;
wikEdEditHelp.id = 'wikEdEditHelp';
wikEdEditHelp.className = 'wikEdEditHelp';
}
}
Linia 2215 ⟶ 2327:
// load and parse RegExTypoFix rules if the button is enabled
WikEdLoadTypoFixRules();
// run scheduled custom functions
WikEdExecuteHook(wikEdSetupHook);
// setup and turn on finished
Linia 2475 ⟶ 2590:
window.wikEdDiffPreviewButtonHandler = function(event) {
if (wikEdFullScreenMode == true) {
WikEdFullScreen(false);
Linia 2776 ⟶ 2892:
}
var version = wikEdProgramVersion;
if (wikEdGadget == true) {
version += ' G';
}
if (wikEdGreasemonkey == true) {
version += ' GM';
Linia 3085 ⟶ 3204:
case 'wikEdScrollToPreview2':
case 'wikEdScrollToPreview3':
window.scroll(0, WikEdGetOffsetTop(
break;
Linia 3136 ⟶ 3255:
// prepare the data
var boundary = '--(fR*3briuStOum6#v)--';
var postData =
postData = '--' + boundary + '\nContent-Disposition: form-data; name="wpTextbox1"\n\n' + postData + '\n--' + boundary;
// make the ajax request
var formAction;
if (wikEdUpload == true) {
formAction = wikEdWikiGlobals['wgServer'] + wikEdWikiGlobals['wgScript'] + '?title=wikEdUploadPreview&action=submit';
}
else {
formAction = wikEdEditForm.action;
}
WikEdAjaxRequest('POST', formAction + '&live', 'Content-Type', 'multipart/form-data; boundary=' + boundary, postData, 'text/html', function(ajax) {
wikEdPreviewIsAjax = true;
Linia 3243 ⟶ 3367:
wikEdUseWikEd = true;
WikEdSetPersistent('wikEdUseClassic', '0', 0, '/');
// run scheduled custom functions
WikEdExecuteHook(wikEdFrameHook);
}
Linia 3251 ⟶ 3378:
wikEdUseWikEd = false;
WikEdSetPersistent('wikEdUseClassic', '1', 0, '/');
// run scheduled custom functions
WikEdExecuteHook(wikEdTextareaHook);
}
break;
Linia 3316 ⟶ 3446:
// switch to fullscreen edit area
case 'wikEdFullScreen':
if (wikEdRearrange == true) {
if (WikEdGetAttribute(buttonObj, 'checked') == 'true') { WikEdFullScreen(true);
WikEdSetPersistent('wikEdFullscreen', '1', 0, '/');
}
else {
WikEdFullScreen(false);
WikEdSetPersistent('wikEdFullscreen', '0', 0, '/');
}
}
break;
Linia 3410 ⟶ 3542:
// reference: selection / cursor
case 'wikEdRef':
case 'wikEdRefNamed':
WikEdGetText(obj, 'selection, cursor');
if (obj.selection.plain != '') {
Linia 3795 ⟶ 3928:
// in-text reference
case 'wikEdRef':
case 'wikEdRefNamed':
if (obj.changed.plain == '') {
if (buttonId == 'wikEdRef') {
obj.changed.plain = '<ref />';
}
else {
obj.changed.plain = '<ref name=\"\"/>';
}
}
else if ( /<ref( name=\"\")? ?\/>/i.test(obj.changed.plain) ) {
obj.changed.plain = '';
}
Linia 3805 ⟶ 3944:
}
else {
if (buttonId == 'wikEdRef') {
obj.changed.plain = '<ref }
else {
obj.changed.plain = '<ref name=\"\">' + obj.changed.plain + '</ref>';
}
obj.changed.plain = obj.changed.plain.replace(/(<ref( name=\"\")?>)( *)(.*?)( *)(<\/ref>)/, '$3$1$4$6$5');
}
obj.changed.keepSel = true;
Linia 4093 ⟶ 4237:
// remove formatting and spaces
linkTarget = linkTarget.replace(/^(=+|\'+|<[^>]*>|\s+|\[)+(.*?)(=+|\'+|<[^>]*>|\s+|\])+$/g, '$2');
linkTarget = linkTarget.replace(/\s+/g, ' ');
linkTarget = linkTarget.replace(/^\s+|\s+$/g, '');
obj.changed.plain = '#redirect [[' + linkTarget + ']]';
// append to summary
if (wikEdInputElement['summary'] != null) {
if ( (obj.selection.plain != '') || (obj.selectionWord.plain != '') ) { wikEdInputElement['summary'].value = wikEdInputElement['summary'].value.replace(/#redirect( \[\[[^\]]*\]\])?(, *)?/g, '');
wikEdInputElement['summary'].value = WikEdAppendToSummary(wikEdInputElement['summary'].value, '#redirect [[' + linkTarget + ']]');
}
else {
wikEdInputElement['summary'].value = WikEdAppendToSummary(wikEdInputElement['summary'].value, '#redirect');
}
}
selectChange = false;
Linia 4160 ⟶ 4308:
}
}
// get button status
var regExpChecked = WikEdGetAttribute(wikEdRegExp, 'checked');
var caseSensitiveChecked = WikEdGetAttribute(wikEdCaseSensitive, 'checked');
// handle newlines and special blanks for built-in search
if (
findText = findText.replace(/\n/g, '');
findText = findText.replace(/\s/g, ' ');
Linia 4173 ⟶ 4325:
// set regexp flags
var regExpFlags = 'g';
if (
regExpFlags += 'i';
}
// format the find and replace texts for a plain text search
if ( (
regExpFind = new RegExp(findText.replace(/([\\^\$\*\+\?\.\(\)\[\]\{\}\:\=\!\|\,\-])/g, '\\$1'), regExpFlags);
}
Linia 4184 ⟶ 4336:
// format the find and replace texts for a regular expression search
else {
try {
regExpFind = new RegExp(findText, regExpFlags);
}
catch (err) {
return;
}
replaceText = replaceText.replace(/((^|[^\\])(\\\\)*)\\n/g, '$1\n');
}
Linia 4239 ⟶ 4396:
// get case sensitive
var caseSensitive = false;
if (
caseSensitive = true;
}
Linia 4260 ⟶ 4417:
// use regexp seach
if (
found = WikEdFind(obj, findText, caseSensitive, false, false, regExpFind);
}
Linia 4274 ⟶ 4431:
// scroll back
if (
wikEdFrameBody.scrollTop = scrollTop;
}
Linia 4288 ⟶ 4445:
// normal find
else {
if (
WikEdFind(obj, findText, caseSensitive, backwards, true, regExpFind);
}
Linia 4568 ⟶ 4725:
window.WikEdScrollToPreview = function() {
var scrollOffset = window.pageYOffset;
var inputOffset = WikEdGetOffsetTop(wikEdInputWrapper);
var textareaOffset = WikEdGetOffsetTop(wikEdTextareaWrapper);
var submitOffset = WikEdGetOffsetTop(
if (scrollOffset > submitOffset) {
Linia 4766 ⟶ 4923:
// empty the range to avoid error messages for reverse direction ranges
// use the fast built-in find function for non-regexp searches
Linia 4963 ⟶ 5120:
window.WikEdFixBasic = function(obj) {
// non-breaking space character to normal space
Linia 4977 ⟶ 5133:
obj.plain = obj.plain.replace(/\n( | |\t)+\n/g, '\n\n');
// empty line before and after headings, spaces around word (lookahead), remove bold, italics, and extra =
obj.plain = obj.plain.replace(/(^|\n)+(=+) *([^\n]*?) *(=+)(?=(\n|$))/g,
function(p, p1, p2, p3, p4) {
p3 = p3.replace(/\'{2,}/g, '');
return('\n\n' + p2 + ' ' + p3 + ' ' + p2 + '\n\n');
}
);
// uppercase well known headings
Linia 5448 ⟶ 5609:
// uppercase lists
// start (listcode (char-ent|tag|category..|digit|non-word,non-ret))(word,non-digit..) end
obj.plain = obj.plain.replace(/^([\*\#\:\;]+[ \'\"]*('+|\&\w+\;|<[^\n]*?>|\{\{.*?\}\}[^\n]*|\d|[^\wÀ-ÖØ-öø-\u0220\u0222-\u0233ΆΈΉΊΌΎΏΑ-ΡΣ-ώ\u0400-\u0481\u048a-\u04ce\u04d0-\u04f5\u04f8\u04f9\n])*)([^\wÀ-ÖØ-öø-\u0220\u0222-\u0233ΆΈΉΊΌΎΏΑ-ΡΣ-ώ\u0400-\u0481\u048a-\u04ce\u04d0-\u04f5\u04f8\u04f9\d].*?)?$/gm,
function (p, p1, p2, p3) {
if ( ! p3.match(/^(http|ftp|alpha|beta|gamma|delta|epsilon|kappa|lambda|$)/) ) {
Linia 5458 ⟶ 5619:
// uppercase link lists (link)
obj.plain = obj.plain.replace(/^([\*\#\:\;]+[ \'\"]*\[\[)([^\n]*?)(\]\])/gm,
function (p, p1, p2, p3) {
Linia 5613 ⟶ 5774:
var foundWord = false;
var foundLine = false;
var regExp = new RegExp('.*[^\\
var plain = '';
Linia 5672 ⟶ 5833:
// find next word and line boundary
regExp = new RegExp('[^\\
foundWord = false;
foundLine = false;
Linia 6659 ⟶ 6820:
// various blocks
if (singleLine != true) {
obj.html = obj.html.replace(/(\u0000(blockquote|center|div|pre|timeline|imagemap|source)\b[^\u0001]*\u0001.*?\u0000\/\2\u0001)/gi, '<span class="wikEdBlock">$1</span><!--wikEdBlock-->');
}
Linia 6707 ⟶ 6868:
// various block tags
obj.html = obj.html.replace(/(\u0000\/?(blockquote|center|div|pre|timeline|imagemap|source)\b[^\u0001]*\u0001)/gi, '<span class="wikEdBlockTag">$1</span><!--wikEdBlockTag-->');
// <p> ... </p> pairs with (wikEdBlockTag) and withhout attributes (wikEdUnknown)
Linia 6760 ⟶ 6921:
obj.html = obj.html.replace(/(\u0000\/?)(\w+)(.*?\/?\u0001)/g,
function (p, p1, p2, p3) {
if ( ! /^(col|thead|tfoot|tbody|big|br|blockquote|colgroup|center|code|del|div|font|ins|p|pre|s|small|span|strike|sub|sup|tt|u|rb|rp|rt|ruby|nowiki|math|gallery|noinclude|includeonly|ref|references|timeline|imagemap|source)$/i.test(p2) ) {
p1 = '<span class="wikEdUnknown">' + p1;
p3 = p3 + '</span><!--wikEdUnknown-->';
Linia 6903 ⟶ 7064:
var regExpCat = new RegExp('^\\s*' + wikEdText['wikicode Category'] + '\\s*:', 'i');
if (regExpCat.test(p2)) {
var regExp = new RegExp('\\s*[\\w\\- À-ÖØ-öø-\\u0220\\u0222-\\u0233ΆΈΉΊΌΎΏΑ-ΡΣ-ώ\\u0400-\\u0481\\u048a-\\u04ce\\u04d0-\\u04f5\\u04f8\\u04f9
if (p2.match(regExp)) {
p1 = '<span class="wikEdCatInter"' + linkParam + '>' + p1;
Linia 7113 ⟶ 7274:
linkPrefix = linkPrefix.replace(/^:+/g, '');
linkTitle = linkTitle.replace(/ /g, '_');
// Wiktionary differentiates between lower and uppercased titles
linkUrl = linkPrefix + linkTitle;
linkUrl = encodeURI(linkUrl);
Linia 7418 ⟶ 7580:
wikEdButtonBarJump.style.display = 'block';
}
// run scheduled custom functions
WikEdExecuteHook(wikEdOnHook);
}
Linia 7447 ⟶ 7612:
wikEdButtonBarJump.style.display = 'none';
}
// run scheduled custom functions
WikEdExecuteHook(wikEdOffHook);
}
}
Linia 7563 ⟶ 7731:
window.WikEdResizeSummary = function() {
// check if combo field exists
if (wikEdSummarySelect == null) {
return;
}
wikEdSummaryText.style.width = '';
Linia 7585 ⟶ 7758:
window.WikEdResizeComboInput = function(field) {
// check if combo field exists
if (wikEdSelectElement[field] == null) {
return;
}
// detect browser for MS IE fixes
var standardBrowser = true;
Linia 7592 ⟶ 7770:
// set select height and top
if (standardBrowser ==
wikEdSelectElement[field].style.height = (wikEdInputElement[field].clientHeight +
wikEdSelectElement[field].style.top = '
wikEdInputElement[field].style.top = '3px';
}
Linia 7683 ⟶ 7858:
// jump to heading
if ( (field == 'find') && (/^=.*?=$/.test(option.value) == true) ) {
// parameters: window.find(string, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog)
Linia 8197 ⟶ 8372:
obj.plain = obj.plainArray.join('');
wikEdFrameDOMCache = obj;
return;
}
Linia 8210 ⟶ 8386:
for (var property in currentNode.childNodes) {
var childNode = currentNode.childNodes[property];
if (typeof(childNode)
continue;
}
Linia 8367 ⟶ 8543:
var insert = contextObj.getElementsByTagName('head')[0];
if (insert != null) {
this.styleElement.appendChild(
insert.appendChild(this.styleElement);
}
Linia 8623 ⟶ 8799:
window.WikEdAddEventListener = function(domElement, eventType, eventHandler, useCapture) {
if (domElement != null) {
if (domElement
domElement['wikEd' + eventType + eventHandler]
domElement[eventType + eventHandler] = function() {
domElement['wikEd' + eventType + eventHandler](window.event);
}
domElement.attachEvent('on' + eventType, domElement[eventType + eventHandler] );
}
else {
domElement.addEventListener(eventType, eventHandler, useCapture);
}
}
return;
Linia 8750 ⟶ 8929:
WikEdEditButton(document.getElementById('wikEdInsertTags'), 'wikEdInsertTags', [tagOpen, tagClose, sampleText]);
}
else if (
}
return;
Linia 8770 ⟶ 8949:
else if (WikEdInsertAtCursorOriginal != null) {
WikEdInsertAtCursorOriginal(myField, myValue);
}
return;
}
//
// WikEdExecuteHook: executes scheduled custom functions from functionsHook array
//
window.WikEdExecuteHook = function(functionsHook) {
for (var i = 0; i < functionsHook.length; i++) {
functionsHook[i]();
}
return;
Linia 9077 ⟶ 9269:
'24': 'cancel',
'25': 'end of medium',
'
'
'
'
'
'
'173' : 'soft hyphen', // \u00ad
'8204': 'zero width non-joiner', // \u200c
Linia 9100 ⟶ 9292:
// strange spaces, used for syntax highlighting
wikEdStrangeSpaces = {
'
'8194': 'en space', // \u2002
'8195': 'em space', // \u2003
'8201': 'thin space' // \u2009
};
return;
Linia 9117 ⟶ 9309:
/
/* =====================================================================================
http://en.wikipedia.org/w/index.php?title=User:Konradek/wikEd_international_pl.js&action=raw&ctype=text/javascript&dontcountme=s
|