Content deleted Content added
0.9.91o (functional) |
0.9.92 testing |
||
Line 2:
// version info
window.wikEdProgramVersion = window.wikEdProgramVersion || '0.9.
window.wikEdProgramDate = window.wikEdProgramDate || '
/*
Line 59:
// user readable texts, copy changes to http://en.wikipedia.org/wiki/User:Cacycle/wikEd_international_en.js, also defined in wikEdDiff.js
if (typeof(
// WikEdInitText: define built-in user interface texts
window.WikEdInitText = function() {
WikEdInitObject(
// logo
Line 76 ⟶ 73:
'wikEdLogo browser title': 'Browser not supported - wikEd {wikEdProgramVersion} ({wikEdProgramDate})',
'wikEdLogo incompatible alt': '(wikEd)',
'wikEdLogo incompatible title': 'Incompatible script or gadget:
'wikEdLogo disabled alt': '(wikEd)',
'wikEdLogo disabled title': 'Disabled - wikEd {wikEdProgramVersion} ({wikEdProgramDate}) Click to enable',
Line 367 ⟶ 364:
'iconPage': 'All icons and images used by wikEd. Save page as <i>web page, complete</i> to download all files into one folder.<br><br>'
}, wikEdConfig['showMissingTranslations']);
};
Line 374 ⟶ 371:
// use local copies of images for testing (set to true in local copy of edit page), also defined in wikEdDiff.js
if (typeof(
// path to local images for testing, also defined in wikEdDiff.js
if (typeof(
// path to images, also defined in wikEdDiff.js
if (typeof(
// image filenames, also defined in wikEdDiff.js
if (typeof(
// WikedInitImages: define built-in image URLs
window.WikedInitImages = function() {
WikEdInitImage(
'barDash': '5/52/WikEd_bar_dash.png',
'bold': '5/59/WikEd_bold.png',
Line 485 ⟶ 482:
// edit-frame css rules
if (typeof(
// WikedInitFrameCSS: define built-in edit frame css
window.WikedInitFrameCSS = function() {
WikEdInitObject(
// frame
Line 721 ⟶ 718:
// main window css rules
if (typeof(
// WikedInitMainCSS: define built-in main window css
window.WikedInitMainCSS = function() {
WikEdInitObject(
// logo
Line 735 ⟶ 732:
// main window css rules for edit pages only
if (typeof(
// WikedInitMainEditCSS: define built-in main window css for edit pages only
window.WikedInitMainEditCSS = function() {
WikEdInitObject(
// combo input box
Line 872 ⟶ 869:
// buttons (id, class, popup title, image src, width, height, alt text, click code)
if (typeof(
// WikedInitButton: define built-in buttons (id, class, popup title, image src, width, height, alt text, click handler code were obj is the button element)
window.WikedInitButton = function() {
WikEdInitObject(
// workaround for mozilla 3.0 bug 441087: objId = obj.id; eventShiftKey = event.shiftKey;
// format top
1: ['wikEdUndo', 'wikEdButtonInactive',
2: ['wikEdRedo', 'wikEdButtonInactive',
3: ['wikEdBold', 'wikEdButton',
4: ['wikEdItalic', 'wikEdButton',
5: ['wikEdUnderline', 'wikEdButton',
6: ['wikEdStrikethrough', 'wikEdButton',
7: ['wikEdNowiki', 'wikEdButton',
8: ['wikEdSuperscript', 'wikEdButton',
9: ['wikEdSubscript', 'wikEdButton',
10: ['wikEdRef', 'wikEdButton',
12: ['wikEdCase', 'wikEdButton',
80: ['wikEdSort', 'wikEdButton',
25: ['wikEdRedirect', 'wikEdButton',
13: ['wikEdUndoAll', 'wikEdButton',
14: ['wikEdRedoAll', 'wikEdButtonInactive',
// format bottom
15: ['wikEdWikiLink', 'wikEdButton',
16: ['wikEdWebLink', 'wikEdButton',
17: ['wikEdHeading', 'wikEdButton',
19: ['wikEdBulletList', 'wikEdButton',
20: ['wikEdNumberList', 'wikEdButton',
21: ['wikEdIndentList', 'wikEdButton',
22: ['wikEdDefinitionList', 'wikEdButton',
23: ['wikEdImage', 'wikEdButton',
24: ['wikEdTable', 'wikEdButton',
11: ['wikEdReferences', 'wikEdButton',
// wikify, textify
26: ['wikEdWikify', 'wikEdButton',
27: ['wikEdTextify', 'wikEdButton',
// control top
77: ['wikEdRefHide', 'wikEdButtonUnchecked',
29: ['wikEdTextZoom', 'wikEdButton',
30: ['wikEdClearHistory', 'wikEdButton',
31: ['wikEdScrollToPreview', 'wikEdButton',
32: ['wikEdScrollToEdit', 'wikEdButton',
// control bottom
33: ['wikEdUseWikEd', 'wikEdButtonChecked',
34: ['wikEdHighlightSyntax', 'wikEdButtonUnchecked',
35: ['wikEdSource', 'wikEdButton',
75: ['wikEdCloseToolbar', 'wikEdButtonUnchecked',
36: ['wikEdUsing', 'wikEdButtonUnchecked',
37: ['wikEdFullScreen', 'wikEdButtonUnchecked',
79: ['wikEdTableMode', 'wikEdButtonUnchecked',
// find top
39: ['wikEdFindAll', 'wikEdButton',
40: ['wikEdFindPrev', 'wikEdButton',
41: ['wikEdFindNext', 'wikEdButton',
43: ['wikEdJumpPrev', 'wikEdButton',
44: ['wikEdJumpNext', 'wikEdButton',
// find bottom
46: ['wikEdReplaceAll', 'wikEdButton',
47: ['wikEdReplacePrev', 'wikEdButton',
48: ['wikEdReplaceNext', 'wikEdButton',
49: ['wikEdCaseSensitive', 'wikEdButtonUnchecked',
50: ['wikEdRegExp', 'wikEdButtonUnchecked',
51: ['wikEdFindAhead', 'wikEdButtonUnchecked',
// fix top
52: ['wikEdFixBasic', 'wikEdButton',
53: ['wikEdFixHtml', 'wikEdButton',
54: ['wikEdFixCaps', 'wikEdButton',
55: ['wikEdFixUnicode', 'wikEdButton',
81: ['wikEdFixRedirect', 'wikEdButton',
56: ['wikEdFixAll', 'wikEdButton',
57: ['wikEdFixRegExTypo', 'wikEdButton',
// fix bottom
58: ['wikEdFixDashes', 'wikEdButton',
59: ['wikEdFixPunct', 'wikEdButton',
60: ['wikEdFixMath', 'wikEdButton',
61: ['wikEdFixChem', 'wikEdButton',
62: ['wikEdFixUnits', 'wikEdButton',
// preview top
65: ['wikEdClose', 'wikEdButton',
66: ['wikEdScrollToPreview2', 'wikEdButton',
67: ['wikEdScrollToEdit2', 'wikEdButton',
// preview bottom
70: ['wikEdClose2', 'wikEdButton',
71: ['wikEdScrollToPreview3', 'wikEdButton',
72: ['wikEdScrollToEdit3', 'wikEdButton',
// jump
78: ['wikEdDiff', 'wikEdButtonUnchecked',
74: ['wikEdScrollToEdit4', 'wikEdButtonSolo',
// dummy
76: ['wikEdDummy', 'wikEdButtonDummy', '',
});
};
// button access keys
if (typeof(
// WikedInitButtonKey: define accesskeys for edit buttons (wikEd button number: [key string, JS key code])
window.WikedInitButtonKey = function() {
WikEdInitObject(
26: ['b', 66], // wikify
27: ['o', 79], // textify
Line 995 ⟶ 992:
// button bars (id, class, button numbers)
if (typeof(
// WikedInitButtonBar: define built-in button bars (id outer, class outer, id inner, class inner, height, grip title, button numbers)
window.WikedInitButtonBar = function() {
WikEdInitObject(
'format': ['wikEdButtonBarFormat', 'wikEdButtonBarFormat', 'wikEdButtonsFormat', 'wikEdButtonsFormat', 44,
'textify': ['wikEdButtonBarTextify', 'wikEdButtonBarTextify', 'wikEdButtonsTextify', 'wikEdButtonsTextify', 44,
'custom1': ['wikEdButtonBarCustom1', 'wikEdButtonBarCustom1', 'wikEdButtonsCustom1', 'wikEdButtonsCustom1', 44,
'find': ['wikEdButtonBarFind', 'wikEdButtonBarFind', 'wikEdButtonsFind', 'wikEdButtonsFind', 44,
'fix': ['wikEdButtonBarFix', 'wikEdButtonBarFix', 'wikEdButtonsFix', 'wikEdButtonsFix', 44,
'custom2': ['wikEdButtonBarCustom2', 'wikEdButtonBarCustom2', 'wikEdButtonsCustom2', 'wikEdButtonsCustom2', 44,
'control': ['wikEdButtonBarControl', 'wikEdButtonBarControl', 'wikEdButtonsControl', 'wikEdButtonsControl', 44,
'preview': ['wikEdButtonBarPreview', 'wikEdButtonBarPreview', 'wikEdButtonsPreview', 'wikEdButtonsPreview', 0, null, [66,67,65] ],
'preview2': ['wikEdButtonBarPreview2', 'wikEdButtonBarPreview2', 'wikEdButtonsPreview2', 'wikEdButtonsPreview2', 0, null, [71,72,70] ],
Line 1,014 ⟶ 1,011:
// history length for find, replace, and summary fields
if (typeof(
window.WikedInitHistoryLength = function() {
WikEdInitObject(wikEdConfig['historyLength'], {
'find': 10,
'replace': 10,
'summary': 10
});
};
// presets for combo input fields dropdown options, {wikEdUsing} appends a link to this script
if (typeof(
if (typeof(
// text for summary link to this script
if (typeof(
// expiration time span for permanent cookies in seconds
if (typeof(
// disable wikEd preset
if (typeof(
// find ahead as you type checkbox preset
if (typeof(
// highlight syntax preset
if (typeof(
// enable wikEd preset
if (typeof(
// add '...using wikEd' to summary preset
if (typeof(
// scroll to edit field on non-preview pages
if (typeof(
// focus the edit field on non-preview pages
if (typeof(
// wikEdDiff preset
if (typeof(
// fullscreen mode preset
if (typeof(
// show MediaWiki toolbar preset
if (typeof(
// hide ref tags preset
if (typeof(
// text size adjustment for edit window (percentage)
if (typeof(
// remove invisible syntax highlighting comments after closing tag
if (typeof(
// show the text-to-source button for testing purposes
if (typeof(
// show the using-wikEd button
if (typeof(
// the wikEd help page link to be displayed after the editing help link, an empty string disables the link
if (typeof(
// enable external diff script
if (typeof(
// enable external wikEdDiff script
if (typeof(
// enable external InstaView script
if (typeof(
// enable external IERange script
if (typeof(
// RegExTypoFix rules page, the address must have the exact same ___domain name as the used wiki
if (typeof(
// enable RegExTypoFix button (http://en.wikipedia.org/wiki/User:Mboverload/RegExTypoFix)
if (typeof(
// enable highlighting as links
if (typeof(
// skip the browser detection to run wikEd under IE and Opera
if (typeof(
// skip the script test that disables wikEd if certain scripts are present
if (typeof(wikEdConfig['skipScriptTest']) == 'undefined') { wikEdConfig['skipScriptTest'] = false; }
// skip the read-only detection
if (typeof(wikEdConfig['skipReadOnlyTest']) == 'undefined') { wikEdConfig['skipReadOnlyTest'] = false; }
// button access keys
if (typeof(wikEdConfig['incompatibleScripts']) == 'undefined') { wikEdConfig['incompatibleScripts'] = {}; }
// WikedInitButtonKey: define accesskeys for edit buttons (wikEd button number: [key string, JS key code])
window.WikedInitIncompatibleScripts = function() {
WikEdInitObject(wikEdConfig['incompatibleScripts'], {
'CKEditor': 'ckeditor.js',
'FCKEditor': 'fckeditor.js'
});
};
// set the button bar grip width in px
if (typeof(
// enable local preview (Pilaf's InstaView)
if (typeof(
// allow ajax requests from local copy for testing, also defined in wikEdDiff.js
if (typeof(
// enable server preview (Ajax)
if (typeof(
// enable appending '<references/> for Ajax section previews
if (typeof(
// enable auto update (Ajax)
if (typeof(
// hours between update check (monobook.js)
if (typeof(
// hours between update check (Greasemonkey)
if (typeof(
// auto update: version url (Ajax)
if (typeof(
// auto update: script url for Greasemonkey update
if (typeof(
// show complete unshortened article text for local diff, also defined in wikEdDiff.js
if (typeof(
// make links ctrl-clickable
if (typeof(
// hide refs and templates in newbie mode
if (typeof(
// wikify table parameters, replaces original table parameters with this string
if (typeof(
// do not rearrange page elements
if (typeof(
// use French rules for fix punctuation
if (typeof(
//
if (typeof(
//
if (typeof(
//
if (typeof(
//
if (typeof(
//
if (typeof(
// custom edit form id instead of 'editform'
if (typeof(
// custom textarea id instead of 'wpTextbox1'
if (typeof(
// custom save button id instead of 'wpSave'
if (typeof(
// show table mode togle button
if (typeof(
// maximal time for syntax highlighting in ms
if (typeof(
// first char of article names is case sensitive (e.g. Wiktionary)
if (typeof(
// force immediate update if this version string is newer
if (typeof(
// display highlighting error messages in text
if (typeof(
// display preview of files in text
if (typeof(
// file preview image size in pixels
if (typeof(
// file preview image size in pixels
if (typeof(
// do not hide templates shorter than this number of chars
if (typeof(
// debug window maximal length in chars
if (typeof(
// debug display of DOM nodes: maximal length of innerHTML in chars
if (typeof(
return;
};
// user configurable variables needed during start up
// init config
if (typeof(wikEdConfig) == 'undefined') { window.wikEdConfig = {}; }
// wikEd code home base URL for https compatibility
if (typeof(
if (typeof(
// set wikEd home base url depending on current page address: standard (http:) or secure (https:)
if (window.___location.protocol == 'https:') {
wikEdConfig['homeBaseUrl'] = wikEdConfig['homeBaseUrlSecure'];
}
else {
wikEdConfig['homeBaseUrl'] = wikEdConfig['homeBaseUrlStandard'];
}
// diff script URL
if (typeof(
// wikEdDiff script URL, also defined in wikEdDiff.js
if (typeof(
// InstaView script URL
if (typeof(
// IERange script URL (MS IE compatibility library)
if (typeof(
// wikEd-as-gadget detection, set to true if gadget script name is not MediaWiki:Gadget-wikEd.js
if (typeof(
// duplicate edit warnings from the top of the page to above the edit window
if (typeof(
// startup debugging
if (typeof(wikEdConfig['debugStartUp']) == 'undefined') { wikEdConfig['debugStartUp'] = ''; }
// show missing translations
if (typeof(wikEdConfig['showMissingTranslations']) == 'undefined') { wikEdConfig['showMissingTranslations'] = false; }
// content language default, also used for wikEd UI localization
if (typeof(wikEdConfig['languageDefault']) == 'undefined') { window.wikEdConfig['languageDefault'] = ''; }
// load external translation
if (typeof(wikEdConfig['loadTranslation']) == 'undefined') { window.wikEdConfig['loadTranslation'] = true; }
// translation javascript URLs
if (typeof(wikEdConfig['translations']) == 'undefined') { wikEdConfig['translations'] = {}; }
// WikedInitTranslations: define translation javascript URLs ('': internal default)
window.WikedInitTranslations = function() {
WikEdInitObject(wikEdConfig['translations'], {
'en': '',
'ar': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:ترجمان05/wikEd_international_ar.js',
'zh-hans': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Shibo77/wikEd_international_zh.js',
'zh-hant': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Quest_for_Truth/wikEd_international_zh-hant.js',
'cs': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Sevela.p/wikEd_international_cs.js',
'nl': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Jeronevw/wikEd_international_nl.js',
'eo': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:ArnoLagrange/wikEd-eo.js',
'fi': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Ejs-80/wikEd international fi.js',
'fr': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Leag/wikEd-fr.js',
'de': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Matthias_M./wikEd_international_de.js',
'he': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:שמוליק/wikEd_international_he.js',
'hu': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Csörföly D/wikEd-hu.js',
'it': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Jalo/wikEd_international_it.js',
'ja': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Hatukanezumi/wikEd_international_ja.js',
'ko': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Ilovesabbath/wikEd_international_ko.js',
'dsb': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Michalwiki/wikEd_international_dsb.js',
'ms': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Aviator/wikEd_international_ms.js',
'no': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Dvyjones/wikEd_international_no.js',
'nn': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Frokor/wikEd_international_nn.js',
'pl': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Konradek/wikEd_international_pl.js',
'pt': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Mosca/wikEd_international_pt.js',
'ro': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Roamataa/wikEd_international_ro.js',
'scn': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Meloscn/wikEd_international_scn.js',
'sk': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Helix84/wikEd_international_sk.js',
'sl': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Eleassar/wikEd_international_sl.js',
'es': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Axelei/wikEd_international_es.js',
'sv': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Where_next_Columbus?/wikEd_international_sv.js',
'hsb': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Michalwiki/wikEd_international_hsb.js',
'tr': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Vito_Genovese/wikEd_international_tr.js',
'vi': wikEdConfig['homeBaseUrl'] + 'w/index.php?action=raw&ctype=text/javascript&title=User:Vinhtantran/wikEd_international_vi.js'
});
};
// Mediawiki page and skin detection, logo placement
if (typeof(wikEdConfig['MediaWikiSkinIds']) == 'undefined') { wikEdConfig['MediaWikiSkinIds'] = {}; }
// WikedInitMediaWikiSkinIds: define Mediawiki page and skin detection, logo placement
// format: skin name: [ dom element to add logo to ('': top right), logo to this list or list contained in this parent element, rearrange page elements, [skin detection element id list] ],
window.WikedInitMediaWikiSkinIds = function() {
WikEdInitObject(wikEdConfig['MediaWikiSkinIds'], {
// monobook, also detects simple and myskin
monobook: [ 'p-personal', true, true, ['column-content', 'content', 'bodyContent', 'siteSub', 'contentSub', 'column-one', 'p-cactions'] ],
// vector (see https://bugzilla.wikimedia.org/show_bug.cgi?id=19527)
vector_old: [ 'personal', true, true, ['content', 'bodyContent', 'siteSub', 'contentSub', 'left-navigation', 'namespaces'] ],
vector_new: [ 'p-personal', true, true, ['content', 'bodyContent', 'siteSub', 'contentSub', 'left-navigation', 'p-namespaces', 'p-cactions'] ],
// citizendium.org
pinkwich5: [ 'p-personal', true, true, ['column-content', 'content', 'bodycontent', 'sitesub', 'contentSub', 'column-one', 'p-cactions'] ],
// other MediaWiki skins
standard: [ 'quickbar', false, true, ['content', 'topbar', 'article', 'footer', 'pagestats'] ],
nostalgia: [ 'topbar', false, true, ['content', 'specialpages', 'article', 'footer'] ],
cologneblue: [ 'quickbar', false, true, ['content', 'topbar', 'sitetitle', 'sitesub', 'article', 'footer'] ],
modern: [ 'p-personal', true, true, ['mw_header', 'mw_main', 'mw_contentwrapper'] ],
// wikia.com
monaco: [ 'userData', false, false, ['background_strip', 'siteSub', 'contentSub', 'monaco_footer'] ],
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 developed on wiki.mozilla.org and developer.mozilla.org
cavendish: [ '', false, true, ['internal', 'container', 'header', 'contentTop', 'mBody', 'side', 'nav', 'siteSub', 'contentSub'] ],
devmo: [ 'personal', false, true, ['developer-mozilla-org', 'container', 'header', 'navigation', 'bar', 'page', 'sidebar', 'sidebarslideup', 'contentTop', 'siteSub', 'contentSub'] ],
// custom skins
gumax: [ 'gumax-p-login', true, true, ['gumax-header', 'gumax-content-body'] ],
// custom MediaWiki identifier
mediawiki: [ '', false, false, ['mediawiki'] ]
});
};
//
Line 1,255 ⟶ 1,369:
window.wikEdDisabled = true;
window.wikEdUploadEdit = false;
window.wikEdViewDeleted = false;
window.wikEdLanguage = '';
window.wikEdWatchlistEdit = false;
Line 1,288 ⟶ 1,403:
window.wikEdTextareaContainer = null;
window.wikEdToolbar = null;
window.wikEdFrameInner = null;
window.wikEdFrameOuter = null;
Line 1,315 ⟶ 1,428:
window.wikEdInsertWrapper = null;
// edit form fields
window.wikEdEditForm = null;
window.wikEdEdittime = null;
window.wikEdEditToken = null;
window.wikEdTextarea = null;
window.wikEdButtonsWrapperWidth = {};
window.wikEdButtonBarFormat = null;
window.wikEdButtonBarTextify = null;
Line 1,349 ⟶ 1,469:
window.wikEdDiffPreviewButton = null;
window.wikEdSummaryLabel = null;
window.WikEdHighlightNamedHideButtonsStylesheet = null;
Line 1,383 ⟶ 1,501:
window.wikEdPreviewIsAjax = null;
window.wikEdButtonKeyCode = [];
window.wikEdDirection = null;
window.wikEdTextSize = 0;
Line 1,405 ⟶ 1,522:
window.wikEdTableMode = false;
window.wikEdCleanNodes = false;
window.wikEdReadOnly = false;
// unicode fixing and char highlighting
Line 1,487 ⟶ 1,605:
};
// variables needed during startup, might be called multiple times
// hash of loaded scripts, also defined in wikEdDiff.js
Line 1,500 ⟶ 1,612:
if (typeof(wikEdPageLoaded) == 'undefined') { window.wikEdPageLoaded = false; }
// browser and os
if (typeof(wikEdBrowserName) == 'undefined') { window.wikEdBrowserName = ''; }
if (typeof(wikEdBrowserFlavor) == 'undefined') { window.wikEdBrowserFlavor = ''; }
Line 1,510 ⟶ 1,622:
if (typeof(wikEdWebKit) == 'undefined') { window.wikEdWebKit = false; }
if (typeof(wikEdChrome) == 'undefined') { window.wikEdChrome = false; }
if (typeof(wikEdGreasemonkey) == 'undefined') { window.wikEdGreasemonkey =
if (typeof(wikEdPlatform) == 'undefined') { window.wikEdPlatform = null; }
// global variables via Greasemonkey ___location hack
if (typeof(
if (typeof(wikEdText) == 'undefined') { wikEdText = {}; }
// define global variables
if (typeof(
if (typeof(wgTitle) == 'undefined') { window.wgTitle = null; }
if (typeof(wgCanonicalNamespace) == 'undefined') { window.wgCanonicalNamespace = null; }
if (typeof(
if (typeof(wgScript) == 'undefined') { window.wgScript = null; }
if (typeof(wgScriptPath) == 'undefined') { window.wgScriptPath = null; }
if (typeof(wgUserName) == 'undefined') { window.wgUserName = null; }
if (typeof(wgCurRevisionId) == 'undefined') { window.wgCurRevisionId = null; }
if (typeof(wgScript) == 'undefined') { window.wgScript = null; }
if (typeof(wgContentLanguage) == 'undefined') { window.wgContentLanguage = null; }
if (typeof(wgUserLanguage) == 'undefined') { window.wgUserLanguage = null; }
if (typeof(wgEnableAPI) == 'undefined') { window.wgEnableAPI = null; }
if (typeof(wgPageName) == 'undefined') { window.wgPageName = null; }
if (typeof(wgNamespaceIds) == 'undefined') { window.wgNamespaceIds = null; }
if (typeof(wgFormattedNamespaces) != 'undefined') { window.wgFormattedNamespaces = null; }
// skins
if (typeof(wikEdLogoContainerId) == 'undefined') { window.wikEdLogoContainerId = ''; }
if (typeof(wikEdRearrange) == 'undefined') { window.wikEdRearrange = false; }
Line 1,606 ⟶ 1,652:
if (typeof(wikEdSkin) == 'undefined') { window.wikEdSkin = ''; }
// various
if (typeof(wikEdGreasemonkeyToHead) == 'undefined') { window.wikEdGreasemonkeyToHead = false; }
if (typeof(wikEdGotGlobalsHook) == 'undefined') { window.wikEdGotGlobalsHook = []; }
if (typeof(wikEdLoadingTranslation) == 'undefined') { window.wikEdLoadingTranslation = false; }
if (typeof(wikEdWebStorage) == 'undefined') { window.wikEdWebStorage = false; }
Line 1,615 ⟶ 1,663:
//
window.WikEdInitObject = function(
for (var key in
if (
// show missing array entries
if (showMissing == true) {
if (typeof(
}
}
}
}
return;
};
//
// WikEdAddToObject: add or replace properties, replace existing values
//
window.WikEdAddToObject = function(target, source) {
for (var key in source) {
target[key] = source[key];
}
return;
};
Line 1,641 ⟶ 1,700:
for (var key in preset) {
if (typeof(array[key]) ==
// remove MediaWiki path prefixes and add local path
if (
array[key] =
}
// add path
else {
array[key] =
}
}
Line 1,744 ⟶ 1,803:
}
// detect if run as a
if (document.getElementById('WikEdHeadScript') != null) {
wikEdGreasemonkeyToHead = true;
}
// check if this runs under Greasemonkey
if (typeof(GM_getValue) == 'function') {
wikEdGreasemonkey = true;
}
// parse global-context (MediaWiki) variables into hash (for Greasemonkey)
window.addEventListener('message', WikEdGetGlobalsReceiver, false);
var globalNames = [, 'skin', 'wgServer', 'wgTitle', 'wgCanonicalNamespace', 'wgArticlePath', 'wgScript', 'wgScriptPath', 'wgUserName', 'wgCurRevisionId', 'wgScript', 'wgContentLanguage', 'wgUserLanguage', 'wgEnableAPI', 'wgPageName', 'wgNamespaceIds', 'wgFormattedNamespaces'];
if (wikEdGreasemonkey == true) {
globalNames.push('wikEdConfig', 'wikEdText');
}
// copy custom config settings and text after values have arrived
var gotGlobalsHook = [
function() {
if (wikEdGreasemonkey == true) {
WikEdAddToObject(wikEdConfig, wikEdWikiGlobals['wikEdConfig']);
WikEdAddToObject(wikEdText, wikEdWikiGlobals['wikEdText']);
}
return;
}
];
// and load translations when done
if ( (wikEdConfig['loadTranslation'] == true) && (wikEdLoadingTranslation == false) ) {
gotGlobalsHook.push(WikEdLoadTranslations);
}
// parse globals (asynchronous)
WikEdGetGlobals(globalNames, gotGlobalsHook);
// check for web storage
if (typeof(window.localStorage) == 'object') {
wikEdWebStorage = true;
}
// schedule the setup routine
WikEdAddEventListener(window, 'load', WikEdSetup, false);
return;
};
//
// WikEdLoadTranslations: load external wikEd translation and language settings
//
window.WikEdLoadTranslations = function() {
if ( (wikEdConfig['loadTranslation'] == true) && (wikEdLoadingTranslation == false) ) {
var contentLang = wikEdWikiGlobals['wgContentLanguage'] || '';
var userLang = wikEdWikiGlobals['wgUserLanguage'] || '';
if ( (wikEdConfig['languageDefault'] != '') || (userLang != '') || (contentLang != '') ) {
// simplified Chinese
Line 1,769 ⟶ 1,876:
WikedInitTranslations();
var scriptUrl =
if (scriptUrl == '') {
scriptUrl =
if (scriptUrl == '') {
scriptUrl =
}
}
if (scriptUrl != '') {
WikEdAppendScript(scriptUrl, function()
// copy custom text after values have arrived
var gotGlobalsHook = function() {
WikEdAddToObject(wikEdText, wikEdWikiGlobals['wikEdText']);
return;
};
// parse globals (asynchronous)
WikEdGetGlobals(['wikEdText'], [gotGlobalsHook]);
wikEdLoadingTranslation = true;
});
}
}
}
return;
};
Line 1,795 ⟶ 1,908:
window.WikEdSetup = function() {
WikEdRemoveEventListener(window, 'load', WikEdSetup, false);
Line 1,817 ⟶ 1,931:
// ignore other diff.js scripts
if ( (scriptName == 'diff.js') && (scriptSrc !=
continue;
}
Line 1,843 ⟶ 1,957:
// detect wikEd running as a gadget
if (
if (wikEdExternalScripts['MediaWiki:Gadget-wikEd.js'] == true) {
}
}
Line 1,859 ⟶ 1,973:
// detect MediaWiki page and its skin
WikedInitMediaWikiSkinIds();
for (var skin in
if (
var logoContainerId =
var logoToList =
var rearrange =
var skinIds =
for (var i = 0; i < skinIds.length; i ++) {
if (document.getElementById(skinIds[i]) == null) {
Line 1,887 ⟶ 2,001:
// initialize user configurable variables
WikEdInitGlobalConfigs();
// import custom text and translations
WikEdAddToObject(wikEdConfig['text'], wikEdText);
// do not rearrange page elements
if (
wikEdRearrange = false;
}
Line 1,895 ⟶ 2,012:
// initialize non-configurable variables
WikEdInitGlobals();
// check for updates
Line 1,912 ⟶ 2,023:
// add stylesheet definitions
WikEdApplyCSS(document,
// add image path to image filename
Line 1,969 ⟶ 2,080:
// load the external diff script if not already done
if ( (
if (typeof(WDiffString) == 'undefined') {
WikEdAppendScript(
}
wikEdExternalScripts['diff.js'] = true;
Line 1,977 ⟶ 2,088:
// load the external wikEdDiff script if not already done
if ( (
if (typeof(WikEdDiff) == 'undefined') {
WikEdAppendScript(
}
wikEdExternalScripts['wikEdDiff.js'] = true;
Line 1,986 ⟶ 2,097:
// load the MS IE selection/range compatibility library IERange
if (wikEdMSIE == true) {
if ( (
if (typeof(DOMUtils) == 'undefined') {
WikEdAppendScript(
}
wikEdExternalScripts['ierange.js'] = true;
Line 1,995 ⟶ 2,106:
// check if disabled
wikEdDisabled = WikEdGetSavedSetting('wikEdDisabled',
if (wikEdDisabled == true) {
wikEdUseWikEd = false;
Line 2,018 ⟶ 2,129:
// ___location search string function: put all used images and icons on an empty page
if (window.___location.search.match(/(\?|&)wikEd=iconPage\b/i) != null) {
var str =
for (var imageKey in
if (
var imageAddress =
if (typeof(imageAddress) == 'string') {
str += '<img src="' + imageAddress + '"> ';
Line 2,106 ⟶ 2,217:
// browser or version not supported, set error message and exit
if ( (wikEdBrowserNotSupported == true) && (
WikEdSetLogo('browser');
return;
}
// get
var array = document.getElementsByName('wpEdittime');
if (array[0] != null) {
wikEdEdittime = array[0].value
}
var array = document.getElementsByName('wpEditToken');
if (array[0] != null) {
wikEdEditToken = array[0].value
}
// page type detection
// detect custom
if (
wikEdEditForm = document.getElementById(
}
if (
wikEdTextarea = document.getElementById(
}
if (
wikEdSaveButton = document.getElementById(wikEdCustomwikEdSaveButtonId);
}
// detect standard
if (wikEdTextarea == null) {
wikEdTextarea = document.getElementsByName('wpTextbox1')[0];
Line 2,134 ⟶ 2,255:
wikEdSaveButton = document.getElementById('wpSave');
}
wikEdDiffPreviewButton = document.getElementById('wpDiff');
wikEdPreviewButton = document.getElementById('wpPreview');
// detect MediaWiki Semantic Forms extension
if (wikEdTextarea == null) {
wikEdEditForm = document.getElementsByName('createbox')[0];
Line 2,141 ⟶ 2,264:
}
// detect edit raw watchlist page
if ( (wikEdEditForm == null) || (wikEdTextarea == null) ) {
wikEdTextarea = document.getElementById('titles');
if (wikEdTextarea != null) {
Line 2,171 ⟶ 2,294:
}
//
if ( (wikEdTextarea == null) || (wikEdEditForm == null) || (wikEdSaveButton == null) ) {
wikEdTextarea = document.getElementsByName('wpUploadDescription')[0];
wikEdEditForm = document.getElementById('mw-upload-form');
wikEdSaveButton = document.getElementsByName('wpUpload')[0];
if ( (wikEdTextarea
wikEdUploadEdit = true;
wikEdRearrange = false;
}
}
// detect view and restore deleted pages
if ( (wikEdTextarea == null) || (wikEdEditForm == null) || (wikEdSaveButton == null) ) {
wikEdTextarea = document.getElementsByTagName('textarea')[0];
if (wikEdTextarea != null) {
// get form
var node = document.getElementsByName('preview')[0];
while (node != null) {
node = node.parentNode;
if (node.tagName == 'FORM') {
break;
}
}
wikEdEditForm = node;
if (wikEdEditForm != null) {
wikEdPreviewButton = document.getElementsByName('preview')[0];
wikEdViewDeleted = true;
wikEdRearrange = false;
}
}
}
// set page detection error indicator
if ( (wikEdTextarea == null) || (wikEdEditForm == null) ) {
WikEdSetLogo();
return;
}
// check if the textarea is read-only
if (wikEdConfig['skipReadOnlyTest'] == false) {
if ( (WikEdGetAttribute(wikEdTextarea, 'readonly') != null) || (wikEdSaveButton == null) ) {
wikEdReadOnly = true;
}
}
Line 2,194 ⟶ 2,347:
WikedInitButtonKey();
WikedInitButtonBar();
WikedInitHistoryLength();
WikedInitIncompatibleScripts();
// check for incompatible scripts
if (wikEdConfig['skipScriptTest'] == false) {
var scriptNames = '';
for (var key in wikEdConfig['incompatibleScripts']) {
if (wikEdConfig['incompatibleScripts'].hasOwnProperty(key) == true) {
var generalName = key;
var scriptName = wikEdConfig['incompatibleScripts'][key];
if (wikEdExternalScripts[scriptName] == true) {
if (scriptNames != '') {
scriptNames += ', ';
}
scriptNames += generalName;
}
}
}
if (scriptNames != '') {
WikEdSetLogo('incompatible', scriptNames);
return;
}
}
// define Unicode characters for fixing function
Line 2,214 ⟶ 2,390:
// load the external InstaView script
if ( (wikEdGreasemonkey == false) && (
if (typeof(InstaView) == 'undefined') {
WikEdAppendScript(
}
wikEdExternalScripts['instaview.js'] = true;
}
else if ( (wikEdGreasemonkey == false) || (
}
Line 2,250 ⟶ 2,426:
// add stylesheet definitions
WikEdApplyCSS(document,
// get button settings from saved settings
wikEdUsing = WikEdGetSavedSetting('wikEdSummaryUsing',
wikEdUseWikEd = ! WikEdGetSavedSetting('wikEdUseClassic', !
wikEdHighlightSyntax = ! WikEdGetSavedSetting('wikEdSyntaxOff', !
wikEdFullScreenMode = WikEdGetSavedSetting('wikEdFullscreen',
wikEdCloseToolbar = WikEdGetSavedSetting('wikEdCloseToolbar',
wikEdRefHide = WikEdGetSavedSetting('wikEdRefHide',
wikEdDiff = WikEdGetSavedSetting('wikEdDiff',
wikEdTableMode = false;
Line 2,328 ⟶ 2,504:
inputWrapperClass = 'wikEdInputWrapper';
}
// check if we use the wikEdEditor user interface of the vector skin
Line 2,489 ⟶ 2,664:
wikEdInputWrapper.appendChild(wikEdLocalPrevWrapper);
}
else if (wikEdSaveButton != null) {
wikEdSaveButton.parentNode.appendChild(wikEdLocalPrevWrapper);
}
else if (wikEdPreviewButton != null) {
wikEdPreviewButton.parentNode.appendChild(wikEdLocalPrevWrapper);
}
else if (wikEdDiffPreviewButton != null) {
wikEdDiffPreviewButton.parentNode.appendChild(wikEdLocalPrevWrapper);
}
Line 2,516 ⟶ 2,697:
// display startup error messages
if (
WikEdDebug(
}
Line 2,588 ⟶ 2,769:
// move edit options after submit buttons; crashes Mozilla when appended after filling the iframe
if (wikEdRearrange == true) {
if (wikEdDiffPreviewButton != null) {
Line 2,664 ⟶ 2,843:
html += ' spellcheck="false"';
}
if (wikEdReadOnly == false) {
}
html += 'try { doc.execCommand(\'styleWithCSS\', 0, false); } catch (e) { ';
html += 'try { doc.execCommand(\'useCSS\', 0, true); } catch (e) { ';
Line 2,693 ⟶ 2,873:
// turn on designmode before adding content
if ( (onloadWorkaround == false) && (wikEdReadOnly == false) ) {
wikEdFrameDocument.designMode = 'on';
try { wikEdFrameDocument.execCommand('styleWithCSS', 0, false); } catch (e) {
Line 2,716 ⟶ 2,896:
// generate button bars and add them to the buttons wrapper
// form wrapper has been added against summary input submit defaulting to this button
if (wikEdReadOnly == false) {
wikEdButtonsWrapper.appendChild(wikEdButtonBarFormat);
}
wikEdButtonBarControl = MakeButtonBar(
wikEdButtonsWrapper.appendChild(wikEdButtonBarControl);
if (
wikEdButtonBarCustom1 = MakeButtonBar(
wikEdButtonsWrapper.appendChild(wikEdButtonBarCustom1);
}
wikEdButtonBarFind = MakeButtonBar(
wikEdButtonsWrapper.appendChild(wikEdButtonBarFind);
if (wikEdReadOnly == false) {
wikEdButtonBarFix = MakeButtonBar(wikEdConfig['buttonBar']['fix']);
wikEdButtonsWrapper.appendChild(wikEdButtonBarFix);
}
if (
wikEdButtonBarCustom2 = MakeButtonBar(
wikEdButtonsWrapper.appendChild(wikEdButtonBarCustom2);
}
Line 2,752 ⟶ 2,936:
// add preview box top bar to submit wrapper
wikEdButtonBarPreview = MakeButtonBar(
if (wikEdRearrange == true) {
wikEdSubmitWrapper.insertBefore(wikEdButtonBarPreview, wikEdSubmitWrapper.firstChild);
Line 2,768 ⟶ 2,952:
wikEdPreviewBox.className = 'wikEdPreviewBox';
div.appendChild(wikEdPreviewBox);
wikEdButtonBarPreview2 = MakeButtonBar(wikEdConfig['buttonBar']['preview2']);
wikEdLocalPrevWrapper.appendChild(wikEdButtonBarPreview2);
}
Line 2,777 ⟶ 2,960:
if (wikiPreview != null) {
if (wikiPreview.firstChild != null) {
wikEdButtonBarJump = MakeButtonBar(
wikiPreview.insertBefore(wikEdButtonBarJump, wikiPreview.firstChild);
}
Line 2,795 ⟶ 2,978:
wikEdLocalPreview = document.createElement('button');
wikEdLocalPreview.id = 'wikEdLocalPreview';
wikEdLocalPreview.title =
wikEdLocalPreview.className = 'wikEdLocalPreview';
var localPreviewImg = document.createElement('img');
localPreviewImg.id = 'wikEdLocalPreviewImg';
localPreviewImg.src =
localPreviewImg.alt =
localPreviewImg.title =
wikEdLocalPreview.appendChild(localPreviewImg);
Line 2,808 ⟶ 2,991:
wikEdPreviewButton.parentNode.insertBefore(wikEdLocalPreview, wikEdPreviewButton.nextSibling);
}
else if (wikEdSaveButton != null) {
wikEdSaveButton.parentNode.insertBefore(wikEdLocalPreview, wikEdSaveButton.nextSibling);
}
Line 2,816 ⟶ 2,999:
wikEdLocalDiff = document.createElement('button');
wikEdLocalDiff.id = 'wikEdLocalDiff';
wikEdLocalDiff.title =
wikEdLocalDiff.className = 'wikEdLocalDiff';
var localDiffImg = document.createElement('img');
localDiffImg.id = 'wikEdLocalDiffImg';
localDiffImg.src =
localDiffImg.alt =
localDiffImg.title =
wikEdLocalDiff.appendChild(localDiffImg);
Line 2,842 ⟶ 3,025:
WikEdButton(document.getElementById('wikEdCaseSensitive'), 'wikEdCaseSensitive', null, false);
WikEdButton(document.getElementById('wikEdRegExp'), 'wikEdRegExp', null, false);
WikEdButton(document.getElementById('wikEdFindAhead'), 'wikEdFindAhead', null,
WikEdButton(document.getElementById('wikEdClose'), 'wikEdClose', null, false, 'wikEdButton');
WikEdButton(document.getElementById('wikEdClose2'), 'wikEdClose2', null, false, 'wikEdButton');
Line 2,848 ⟶ 3,031:
// hide typo fix button until typo fix rules are loaded and parsed
var fixRegExTypo = document.getElementById('wikEdFixRegExTypo')
if (fixRegExTypo != null) {
fixRegExTypo.style.display = 'none';
}
// hide buttons if API is not available
if ( (wikEdWikiGlobals['wgEnableAPI'] != true) && (wikEdWikiGlobals['wgEnableAPI'] != 'true') ) {
var fixRedirect = document.getElementById('wikEdFixRedirect')
if (fixRedirect != null) {
fixRedirect.style.display = 'none';
}
}
Line 2,865 ⟶ 3,054:
wikEdClearSummary.id = 'wikEdClearSummary';
wikEdClearSummary.className = 'wikEdClearSummary';
wikEdClearSummary.alt =
wikEdClearSummary.title =
wikEdClearSummary.style.height = (wikEdSummaryText.clientHeight + 1) +'px';
clearSummaryForm.appendChild(wikEdClearSummary);
Line 2,872 ⟶ 3,061:
wikEdClearSummaryImg = document.createElement('img');
wikEdClearSummaryImg.id = 'wikEdClearSummaryImg';
wikEdClearSummaryImg.src =
wikEdClearSummaryImg.alt = 'Clear summary';
wikEdClearSummary.appendChild(wikEdClearSummaryImg);
Line 2,903 ⟶ 3,092:
// shorten submit button texts
if (wikEdPreviewButton != null) {
wikEdPreviewButton.value =
}
if (wikEdDiffPreviewButton != null) {
wikEdDiffPreviewButton.value =
}
Line 2,914 ⟶ 3,103:
wikEdInputElement['find'] = new Object(wikEdFindText);
wikEdSelectElement['find'] = new Object(document.getElementById('wikEdFindSelect'));
wikEdSelectElement['find'].title =
wikEdFieldHist ['replace'] = [];
Line 2,920 ⟶ 3,109:
wikEdInputElement['replace'] = new Object(wikEdReplaceText);
wikEdSelectElement['replace'] = new Object(document.getElementById('wikEdReplaceSelect'));
wikEdSelectElement['replace'].title =
if (wikEdSummaryInputWrapper != null) {
Line 2,927 ⟶ 3,116:
wikEdInputElement['summary'] = new Object(wikEdSummaryText);
wikEdSelectElement['summary'] = new Object(document.getElementById('wikEdSummarySelect'));
wikEdSelectElement['summary'].title =
}
Line 2,936 ⟶ 3,125:
// hide the button bars per saved setting
}
if (wikEdButtonBarTextify != null) {
WikEdButtonBarInit(wikEdButtonBarTextify);
}
if (wikEdButtonBarControl != null) {
WikEdButtonBarInit(wikEdButtonBarControl);
}
if (wikEdButtonBarCustom1 != null) {
WikEdButtonBarInit(wikEdButtonBarCustom1);
}
}
if (wikEdButtonBarFix != null) {
WikEdButtonBarInit(wikEdButtonBarFix);
}
if (wikEdButtonBarCustom2 != null) {
WikEdButtonBarInit(wikEdButtonBarCustom2);
Line 2,953 ⟶ 3,152:
// add a link to the wikEd help page
if (wikEdRearrange == true) {
if ( (
var editHelpParent = wikEdDiffPreviewButton;
while (editHelpParent != null) {
Line 2,975 ⟶ 3,174:
wikEdHelpSpan.id = 'wikEdHelpSpan';
wikEdHelpSpan.className = 'wikEdHelpSpan';
wikEdHelpSpan.innerHTML =
editHelpParent.insertBefore(wikEdHelpSpan, editHelp.nextSibling);
Line 2,987 ⟶ 3,186:
// copy page warnings above edit window
if (
if ( (wikEdClonedWarnings == false) && (wikEdPreviewPage == false) && (/(.*\n){2}/.test(wikEdOrigVersion) ) == true) {
var divs = document.getElementsByTagName('div');
Line 3,015 ⟶ 3,214:
wikEdDirection = WikEdGetStyle(document.body, 'direction');
wikEdFrameBody.style.direction = wikEdDirection;
WikEdApplyCSS(wikEdFrameDocument,
WikEdHighlightNamedHideButtonsStylesheet = new WikEdStyleSheet(wikEdFrameDocument);
Line 3,024 ⟶ 3,223:
// adjust font size (px)
wikEdTextSizeInit = parseFloat(WikEdGetStyle(wikEdTextarea, 'fontSize')) *
wikEdTextSize = wikEdTextSizeInit;
wikEdFrameBody.style.fontSize = wikEdTextSize + 'px';
Line 3,042 ⟶ 3,241:
// focus the input field
if (
if (wikEdUseWikEd == true) {
wikEdFrameWindow.focus();
Line 3,058 ⟶ 3,257:
// scroll
if ( (wikEdFullScreenMode == false) && (
window.scroll(0, WikEdGetOffsetTop(wikEdEditForm) - 2);
}
Line 3,109 ⟶ 3,308:
// set button bar grip area events
if (wikEdButtonBarFormat != null) {
WikEdAddEventListener(wikEdButtonBarFormat.firstChild.firstChild, 'click', WikEdButtonBarGripHandler, false); }
if (wikEdButtonBarTextify != null) {
WikEdAddEventListener(wikEdButtonBarTextify.firstChild.firstChild, 'click', WikEdButtonBarGripHandler, false);
}
if (wikEdButtonBarControl != null) {
WikEdAddEventListener(wikEdButtonBarControl.firstChild.firstChild, 'click', WikEdButtonBarGripHandler, false);
}
if (wikEdButtonBarCustom1 != null) {
if (wikEdButtonBarCustom1.firstChild.firstChild != null) {
Line 3,117 ⟶ 3,322:
}
}
if (wikEdButtonBarFind != null) {
WikEdAddEventListener(wikEdButtonBarFind.firstChild.firstChild, 'click', WikEdButtonBarGripHandler, false); }
if (wikEdButtonBarFix != null) {
WikEdAddEventListener(wikEdButtonBarFix.firstChild.firstChild, 'click', WikEdButtonBarGripHandler, false);
}
if (wikEdButtonBarCustom2 != null) {
if (wikEdButtonBarCustom2.firstChild.firstChild != null) {
Line 3,220 ⟶ 3,429:
resizeGripImage.id = 'wikEdResizeGrip';
WikEdAddEventListener(resizeGripImage, 'load', WikEdResizeGripLoadHandler, true);
resizeGripImage.src =
// run scheduled custom functions
WikEdExecuteHook(
// load and parse RegExTypoFix rules if the button is enabled
Line 3,245 ⟶ 3,454:
// check if autoupdate is enabled
if (
return;
}
Line 3,251 ⟶ 3,460:
// check for forced update check
var forcedUpdate = false;
if (
// get version numbers from strings
var currentVersion = WikEdVersionToNumber(wikEdProgramVersion);
var forcedVersion = WikEdVersionToNumber(
// schedule forced update check
Line 3,283 ⟶ 3,492:
var diffHours = (currentDate - lastCheckDate) / 1000 / 60 / 60;
if (wikEdGreasemonkey == true) {
if (diffHours >
regularUpdate = true;
}
}
else if (diffHours >
regularUpdate = true;
}
Line 3,297 ⟶ 3,506:
// save current update check date
WikEdSetPersistent('wikEdAutoUpdate', currentDate.toUTCString(), 0, '/');
// make the ajax request
var requestMethod = 'GET';
var requestUrl = wikEdConfig['autoUpdateUrl'];
var postFields = null;
var overrideMimeType = null;
WikEdAjaxRequest(requestMethod, requestUrl, postFields, overrideMimeType, function(ajax, obj) {
// get response
Line 3,343 ⟶ 3,557:
// update Greasemonkey script by navigating to the script code page
if (wikEdGreasemonkey == true) {
var updatePopup =
updatePopup = updatePopup.replace(/\{updateURL\}/g,
alert(updatePopup);
window.___location.href =
}
Line 3,364 ⟶ 3,578:
// load RegExTypoFix rules per Ajax if enabled
if ( (
return;
}
// make the ajax request
var requestMethod = 'GET';
var requestUrl = wikEdConfig['regExTypoFixURL'];
var postFields = null;
var overrideMimeType = null;
WikEdAjaxRequest(requestMethod, requestUrl, postFields, overrideMimeType, function(ajax) {
// get response
// parse regexp rules
// check if this is a valid regexp
// save regexp and replace
// display typo fix button
return;
};
Line 3,524 ⟶ 3,743:
if ( (wikEdUsing == true) && (text != '') ) {
if (text.lastIndexOf(
if (wikEdAddNewSection != true) {
text += ' ' +
}
}
Line 3,659 ⟶ 3,878:
event.stopPropagation();
var grip = event.target;
var gripWrapper = grip.parentNode;
Line 3,664 ⟶ 3,884:
var barInnerWrapper = gripWrapper.parentNode;
var bar = barInnerWrapper.parentNode;
if (event.type == 'click') {
buttonsWrapper.style.position = 'static';
// hide the buttons bar
if (buttonsWrapper.
buttonsWrapper.className = 'wikEdButtonBarButtonsWrapperHidden';
barInnerWrapper.className = 'wikEdButtonBarInnerWrapperHidden';
gripWrapper.className = 'wikEdButtonBarGripWrapperHidden';
wikEdButtonsWrapperWidth[bar.id] = buttonsWrapper.offsetWidth;
buttonsWrapper.style.display = 'none';
WikEdAddEventListener(grip, 'mouseover', WikEdButtonBarGripHandler, false);
WikEdSetPersistent(bar.id + 'Hidden', '1', 0, '/');
Line 3,682 ⟶ 3,900:
// unhide the buttons bar
else {
buttonsWrapper.className = 'wikEdButtonBarButtonsWrapperVisible';
barInnerWrapper.className = 'wikEdButtonBarInnerWrapperVisible';
gripWrapper.className = 'wikEdButtonBarGripWrapperVisible';
buttonsWrapper.style.display = 'block';
WikEdRemoveEventListener(grip, 'mouseover', WikEdButtonBarGripHandler, false);
WikEdSetPersistent(bar.id + 'Hidden', '0', 0, '/');
Line 3,694 ⟶ 3,911:
// show the buttons bar on mouseover
else if (event.type == 'mouseover') {
if (buttonsWrapper.
WikEdAddEventListener(bar, 'mouseout', WikEdButtonBarHandler, false);
// show buttons to the right
if (bar.offsetParent.clientWidth > grip.offsetLeft + grip.offsetWidth +
buttonsWrapper.style.left = (grip.offsetLeft + grip.offsetWidth) + 'px';
}
Line 3,704 ⟶ 3,921:
// show buttons to the left
else {
buttonsWrapper.style.left = (gripWrapper.offsetLeft -
}
Line 3,732 ⟶ 3,949:
var bar = event.currentTarget;
var barInnerWrapper = bar.firstChild;
var gripWrapper = barInnerWrapper.firstChild;
Line 3,740 ⟶ 3,958:
// hide the buttons
if (event.type == 'mouseout') {
if (buttonsWrapper.
// filter the events for mouseouts actually leaving the bar
Line 3,919 ⟶ 4,137:
// check if disabled
if (
return;
}
Line 4,383 ⟶ 4,601:
if (state == 'error') {
wikEdLogo.src =
wikEdLogo.alt =
wikEdLogo.title =
}
else if (state == 'browser') {
wikEdLogo.src =
wikEdLogo.alt =
wikEdLogo.title =
}
else if (state == 'incompatible') {
wikEdLogo.src =
wikEdLogo.alt =
wikEdLogo.title =
}
else {
if (wikEdDisabled == true) {
wikEdLogo.src =
wikEdLogo.alt =
wikEdLogo.title =
}
else {
wikEdLogo.src =
wikEdLogo.alt =
wikEdLogo.title =
}
}
var version = wikEdProgramVersion;
if (
version += ' G';
}
Line 4,417 ⟶ 4,635:
}
else if (wikEdGreasemonkeyToHead == true) {
version += '
}
wikEdLogo.title = wikEdLogo.title.replace(/\{wikEdParameter\}/g, parameter);
Line 4,465 ⟶ 4,683:
break;
default:
var currButton =
if (typeof(currButton) != 'object') {
alert('Loading error: The button "' + buttonNumbers[i] + '" is not defined.');
}
if ( (currButton[0] == 'wikEdSource') && (
break;
}
else if ( (currButton[0] == 'wikEdUsing') && (
break;
}
else if ( (currButton[0] == 'wikEdTableMode') && (
break;
}
Line 4,481 ⟶ 4,699:
// add accesskey information to button title and
var accessKey = '';
if (
accessKey = ' [' +
// initialize wikEdButtonKeyCode[keyCode] = id
wikEdButtonKeyCode[ (
}
Line 4,509 ⟶ 4,727:
var html = '';
if (gripTitle != null) {
var gripStyle = 'width: ' +
if (barHeight > 0) {
gripStyle += 'height: ' + barHeight + 'px; ';
Line 4,561 ⟶ 4,779:
gripWrapper.className = 'wikEdButtonBarGripWrapperHidden';
buttonsWrapper.className = 'wikEdButtonBarButtonsWrapperHidden';
buttonsWrapper.style.display = 'none';
WikEdAddEventListener(grip, 'mouseover', WikEdButtonBarGripHandler, true);
Line 4,603 ⟶ 4,821:
}
}
if (wikEdButtonBarFormat
}
if (wikEdButtonBarTextify != null) {
wikEdButtonBarTextify.style.display = 'block';
}
if (wikEdButtonBarCustom1 != null) {
wikEdButtonBarCustom1.style.display = 'block';
}
if (wikEdButtonBarFind
}
if (wikEdButtonBarFix != null) {
wikEdButtonBarFix.style.display = 'block';
}
if (wikEdButtonBarCustom2 != null) {
wikEdButtonBarCustom2.style.display = 'block';
}
if (wikEdButtonBarControl
wikEdButtonBarControl.style.display = 'block';
}
wikEdFrameBody.scrollTop = scrollRatio * wikEdFrameBody.scrollHeight;
}
Line 4,639 ⟶ 4,867:
wikEdTextarea.style.display = 'block';
if (
wikEdToolbarWrapper.style.display = 'block';
}
if (wikEdButtonBarFormat
}
if (wikEdButtonBarTextify != null) {
wikEdButtonBarTextify.style.display = 'none';
}
if (wikEdButtonBarCustom1 != null) {
wikEdButtonBarCustom1.style.display = 'none';
}
if (wikEdButtonBarFind
}
if (wikEdButtonBarFix != null) {
wikEdButtonBarFix.style.display = 'none';
}
if (wikEdButtonBarCustom2 != null) {
wikEdButtonBarCustom2.style.display = 'none';
}
if (wikEdButtonBarControl
wikEdButtonBarControl.style.display = 'block';
}
wikEdTextarea.scrollTop = scrollRatio * wikEdTextarea.scrollHeight;
}
Line 4,805 ⟶ 5,043:
wikEdPreviewBox.style.height = previewHeight + 'px';
}
wikEdPreviewBox.innerHTML =
wikEdLocalPrevWrapper.style.display = 'inline';
// prepare ajax preview
wikEdPreviewIsAjax = false;
var
// Opera 0.9.51
if (
var livePreview = true;
// articles on watchlist preview page
if (wikEdWatchlistEdit == true) {
function (p, p1) {
if (/[\#<>\[\]\|\{\}]/.test(p1) == true) {
Line 4,832 ⟶ 5,070:
// postfix (User_talk) or prefix (Discussion_Utilisateur), test for xxx_ vs. _xxx (all ASCII non-letters as separator)
// Firefox 3.6.7 + Greasemonkey 0.8.20100408.06: invalid range with \{-‰ and \x8f-™
if (/[ -\/\:-\@\[-\`\{-\x88‰‹\x8d\x8f-\x98™›\x9d\xa0-»¿×÷]/.test(
talk = article.replace(/([^:]*)/,
}
else {
talk = article.replace(/([^:]*)/, '$1' +
}
}
else {
talk =
}
var uriArticle = article.replace(/ /g, '_');
Line 4,847 ⟶ 5,085:
uriArticle = uriArticle.replace(/\'/g, '%27');
var hist = wikEdWikiGlobals['wgServer'] + wikEdWikiGlobals['wgScript'] + '?title=' + uriArticle + '&action=history';
return('[[:' + p1 + ']] ([[:' + talk + '|' +
}
);
Line 4,860 ⟶ 5,098:
if (section.length > 0) {
if (/\d+/.test(section[0].value) == true) {
if (/<ref[^>\/]*>.*?<\/ref[^>]*>/i.test(
if (/<references\b[^>]*>/i.test(
}
}
Line 4,871 ⟶ 5,109:
// GesHI syntax highlighting support, GeSHi css is only provided dynamically and not for &live
// so request a full preview and attach css to page, remember already loaded GeSHi languages
while ( (regExpMatch = /<(source|syntaxhighlight)\b[^>]*?lang\s*=\s*(\"|\')(\w+)\2/gi.exec(
var lang = regExpMatch[3];
if (wikEdGeSHiCSS['wikEd' + lang] == null) {
Line 4,882 ⟶ 5,120:
// make the ajax request
WikEdAjaxPreview(
}
WED(2);
// prepare a local preview (Pilaf's InstaView), will be overwritten by Ajax version
if ( (
InstaView.conf.user.name = wikEdWikiGlobals['wgUserName'];
var text = wikEdTextarea.value;
Line 4,938 ⟶ 5,176:
// call external diff program
var diffText = WDiffString(wikEdOrigVersion, currentVersion);
if (
diffText = WDiffShortenOutput(diffText);
}
Line 5,008 ⟶ 5,246:
// run scheduled custom functions
WikEdExecuteHook(
}
Line 5,019 ⟶ 5,257:
// run scheduled custom functions
WikEdExecuteHook(
}
break;
Line 5,648 ⟶ 5,886:
case 'wikEdReferences':
case 'wikEdReferencesSection':
var ref =
ref = ref.replace(/</g, '<');
ref = ref.replace(/>/g, '>');
Line 6,011 ⟶ 6,249:
case 'wikEdImage':
if (obj.changed.plain != '') {
obj.changed.plain = '[[Image:<span class="wikEdInsertHere">' +
}
else {
obj.changed.plain = '[[Image:<span class="wikEdInsertHere">' +
if (obj.focusWord != null) {
if (obj.focusWord.plain != '') {
Line 6,031 ⟶ 6,269:
}
else if (wikEdTableMode == true) {
obj.changed.plain = '\n<table class="wikitable" border="1"><caption><span class="wikEdInsertHere">' +
if (obj.focusLine.plain != '') {
obj.changed.plain = '\n' + obj.changed.plain + '\n';
Line 6,037 ⟶ 6,275:
}
else {
obj.changed.plain = '\n{| class="wikitable" border="1"\n|+ <span class="wikEdInsertHere">' +
if (obj.focusLine.plain != '') {
obj.changed.plain = '\n' + obj.changed.plain + '\n';
Line 6,066 ⟶ 6,304:
}
else {
linkTarget = '<span class="wikEdInsertHere">' +
}
Line 6,378 ⟶ 6,616:
break;
case 'wikEdFixRegExTypo':
if ( (
WikEdFixTypos(obj.changed);
}
Line 6,723 ⟶ 6,961:
// parse response into file url cache
var regExpFile = new RegExp('\\n((Image|File|' +
var regExpMatch;
while ( (regExpMatch = regExpFile.exec(html)) != null) {
Line 6,741 ⟶ 6,979:
}
else {
fileObj.url =
fileObj.width = 16;
fileObj.height = 16;
Line 6,849 ⟶ 7,087:
var inputOffset = WikEdGetOffsetTop(wikEdInputWrapper);
var editOffset = WikEdGetOffsetTop(wikEdEditWrapper);
var submitOffset =
if (wikEdSaveButton != null) {
submitOffset = WikEdGetOffsetTop(wikEdSaveButton);
}
else if (wikEdPreviewButton != null) {
submitOffset = WikEdGetOffsetTop(wikEdPreviewButton);
}
else if (wikEdDiffPreviewButton != null) {
submitOffset = WikEdGetOffsetTop(wikEdDiffPreviewButton);
}
var editHeight = wikEdEditWrapper.clientHeight;
Line 6,877 ⟶ 7,124:
// window.clearTimeout(wikEdLinkifyTimeoutId);
// wikEdLinkifyTimeoutId = null;
if (
return;
}
Line 6,916 ⟶ 7,163:
rules += '.wikEdRefButtonShow' + i + ' { border: 1px solid; border-color: #000 #e8e8e8 #e8e8e8 #000; background: #c8c4c0; }\n';
rules += '.wikEdRefButton' + i + ':before, .wikEdRefButtonShow' + i + ':before { content: "' +
wikEdReferenceArray[i].added = true;
Line 6,930 ⟶ 7,177:
rules += '.wikEdTemplButtonShow' + i + ' { border: 1px solid; border-color: #000 #e8e8e8 #e8e8e8 #000; background: #c8c4c0; }\n';
rules += '.wikEdTemplButton' + i + ':before, .wikEdTemplButtonShow' + i + ':before { content: "' +
wikEdTemplateArray[i].added = true;
Line 6,967 ⟶ 7,214:
window.WikEdHideAddHandlers = function() {
if ( (
return;
}
Line 7,119 ⟶ 7,366:
hideButton.className = hideButtonClass;
hideButton.title =
WikEdAddEventListener(hideButton, 'mouseover', WikEdHideShowHandler, true);
Line 7,140 ⟶ 7,387:
hideButton.className = hideButtonClass;
hideButton.title =
WikEdRemoveEventListener(hideButton, 'mouseover', WikEdHideShowHandler, true);
Line 7,988 ⟶ 8,235:
// uppercase well known headings
var regExp = new RegExp('\\n=+ ' +
obj.plain = obj.plain.replace(regExp, '\n== ' +
regExp = new RegExp('\\n=+ ' +
obj.plain = obj.plain.replace(regExp, '\n== ' +
regExp = new RegExp('\\n=+ ' +
obj.plain = obj.plain.replace(regExp, '\n== ' +
// add space after * # : ; (list) and after {| |- |+ | (table), spare #REDIRECT
Line 8,013 ⟶ 8,260:
var tableflag = false;
for (var i = 0; i < lines.length; i ++) {
var line = lines[i];
Line 8,038 ⟶ 8,285:
// empty line before and after images
var regExp = new RegExp('^(\\[\\[(Image|File|' +
line = line.replace(regExp, '\n$1');
regExp = new RegExp('(\\[\\[(Image|File|' +
line = line.replace(regExp, '$1\n');
Line 8,084 ⟶ 8,331:
// empty line before and after categories
var regExp = new RegExp('( |\\n)*(\\[\\[(Category|' +
obj.plain = obj.plain.replace(regExp, '\n\n$2\n\n');
// categories not separated by empty lines (lookahead)
regExp = new RegExp('(\\[\\[(Category|' +
obj.plain = obj.plain.replace(regExp, '$1\n');
Line 8,132 ⟶ 8,379:
);
if (
obj.plain = obj.plain.replace(/(«) *()/g, '$1 ');
obj.plain = obj.plain.replace(/ *(»)/g, ' $1');
Line 8,237 ⟶ 8,484:
// check if api is enabled
if ( ( (wikEdWikiGlobals['wgEnableAPI'] != true) && (wikEdWikiGlobals['wgEnableAPI'] != 'true') ) || (wikEdScriptURL == '') ) {
return;
}
Line 8,245 ⟶ 8,492:
// get wiki links
var
// 1 [[ 2 2 3 34# 4 5 6 6 5 ]] 1
var regExpLink = /(\[\[\s*(:?)\s*([^\n#<>\[\]\{\}\|]+)(\s*#[^\n\[\]\|]*?)?(\s*\|(.|\s)*?)?\]\]\s*)/g;
while ( (regExpMatch = regExpLink.exec(obj.plain)) != null) {
}
if (links == '') {
return;
}
// prepare the request
var postFields = {};
postFields['titles'] = links;
postFields['redirects'] = 'true';
postFields['format'] = 'xml';
postFields['action'] = 'query';
if (wikEdEdittime != null) {
postFields['wikEdEdittime'] = wikEdEdittime;
}
if (wikEdEditToken != null) {
postFields['wpEditToken'] = wikEdEditToken;
}
var requestUrl = wikEdScriptURL + 'api.php';
var requestMethod = 'POST';
var overrideMimeType = undefined;//'text/html';
// make the ajax request
WikEdAjaxRequest(requestMethod, requestUrl, postFields, overrideMimeType, function(ajax, obj) {
// get response
var txt = ajax.responseText;
if ( (regExpMatch = txt.match(/<redirects>((.|\s)*?)<\/redirects>/)) != null) {
var redirects = regExpMatch[1];
Line 8,347 ⟶ 8,606:
// lowercase link target if link text starts with lowercase (main space only)
if (
if (/:/.test(linkTarget) != true) {
if (article.charAt(0).toLowerCase() == article.charAt(0)) {
Line 8,772 ⟶ 9,031:
// uppercase images
var regExp = new RegExp('(\\[\\[)(Image|File|' +
obj.plain = obj.plain.replace(regExp,
function (p, p1, p2, p3, p4) {
Line 9,321 ⟶ 9,580:
function (p, p1, p2) {
var table = '\x00\x00{|';
if (
table += ' ' +
}
else {
Line 9,493 ⟶ 9,752:
// category link
var regExp = new RegExp('^(Category|' +
regExpMatch = regExp.exec(linkArticle);
if (regExpMatch != null) {
return('[[' +
}
Line 9,557 ⟶ 9,816:
// clean up MediaWiki category list
var regExp = new RegExp('<span\\b[^>]*>(\\[\\[(Category|' +
obj.html = obj.html.replace(regExp, '$1\x00');
Line 9,597 ⟶ 9,856:
imgLink = regExpMatch[1];
if (imgLink != '') {
return('[[' +
}
}
Line 10,041 ⟶ 10,300:
// remove highlighting error messages
if (
obj.html = obj.html.replace(/<span\b[^>]*?\bclass=\"
}
Line 10,218 ⟶ 10,477:
['(^\\s*)#REDIRECT(?=\\s*\\[\\[)', 'redirect', 'block'], // redirect
['\\[\\[(?=(Image|File|' +
['\\[\\[', 'link', 'open'], // wikilink, category start with interlink detection
['\\]\\]', 'doubleCloseBracket', 'close'], // wikilink, category, file link, redirect end
Line 10,298 ⟶ 10,557:
window.WikEdHighlightSyntax = function(obj, noTimeOut) {
// start timer to cancel after
var highlightStartDate = new Date();
Line 10,383 ⟶ 10,642:
while ( (parseObj.regExpMatch = wikEdParseObj.regExpTags.exec(obj.html)) != null) {
// cancel highlighting after
if (noTimeOut != true) {
var currentDate = new Date();
if ( (currentDate - highlightStartDate) >
break;
}
Line 10,456 ⟶ 10,715:
var errorText;
if (parseObj.lastOpenTag == 'link') {
errorText =
}
else if (parseObj.lastOpenTag == 'template') {
errorText =
}
else if (parseObj.lastOpenTag == 'parameter') {
errorText =
}
WikEdHighlightMarkLastOpenNode(errorText, parseObj);
Line 10,557 ⟶ 10,816:
break;
default:
parseObj.tree.push( { 'start': tagFrom, 'tagLength': tagLength, 'type': 'error', 'left':
break;
}
Line 10,645 ⟶ 10,904:
'tagLength': node.tagLength,
'type': 'error',
'left':
} );
redefinedTag = 'spare';
Line 10,698 ⟶ 10,957:
'tagLength': openNode.tagLength,
'type': 'error',
'left':
} );
parseObj.tree.push( {
Line 10,704 ⟶ 10,963:
'tagLength': tagLength,
'type': 'error',
'left':
} );
}
Line 10,714 ⟶ 10,973:
'tagLength': openNode.tagLength,
'type': 'error',
'left':
} );
parseObj.tree.push( {
Line 10,720 ⟶ 10,979:
'tagLength': tagLength,
'type': 'error',
'left':
} );
}
Line 10,962 ⟶ 11,221:
// unrecognized tag
default:
parseObj.tree.push( { 'start': tagFrom, 'tagLength': tagLength, 'type': 'error', 'left':
}
Line 10,976 ⟶ 11,235:
// mark remaining unmatched opening tags
while ( (parseObj.lastOpenNode != 0) && (parseObj.lastOpenNode != null) ) {
WikEdHighlightMarkLastOpenNode(
}
}
Line 11,044 ⟶ 11,303:
// get file previews
if ( (
WikEdAjaxPreview(wikEdFilePreviewRequest, WikEdFilePreviewAjaxHandler);
wikEdFilePreviewRequest = '';
Line 11,061 ⟶ 11,320:
// remove comments
if (
obj.html = obj.html.replace(/<!--wikEd[\w\/]+-->/g, '');
}
Line 11,204 ⟶ 11,463:
'tagLength': tagLength,
'type': 'error',
'left':
} );
}
Line 11,237 ⟶ 11,496:
(node.tag == 'boldItalic')
) {
WikEdHighlightMarkLastOpenNode(
WikEdHighlightGetLevel(parseObj);
}
Line 11,292 ⟶ 11,551:
nodeNo = node.parent;
node.type = 'error';
node.left =
node.parent = null;
}
Line 11,306 ⟶ 11,565:
'tagLength': tagLength,
'type': 'error',
'left':
} );
break;
Line 11,338 ⟶ 11,597:
// convert opening tag to error
WikEdHighlightMarkLastOpenNode(
parseObj.tree.push( {
Line 11,344 ⟶ 11,603:
'tagLength': tagLength,
'type': 'error',
'left':
} );
break;
Line 11,578 ⟶ 11,837:
// linkify
var regExpCasing = new RegExp('(^|\\:)' +
nsClean = nsClean.replace(regExpCasing, '$1' +
if (nsClean == ':') {
nsClean = '';
Line 11,586 ⟶ 11,845:
}
}
if (nsClean.toLowerCase() ==
insertLeft = '<span class="wikEdCat"' + follow + '><span class="wikEdLinkTag">';
insertRight = '</span><!--wikEdLinkTag--><span class="wikEdCatName">';
Line 11,601 ⟶ 11,860:
case 'file':
var previewCode = '';
var regExpFile = new RegExp('^\\s*(Image|File|' +
var regExpMatch = regExpFile.exec(innerPlain);
if (regExpMatch == null) {
Line 11,613 ⟶ 11,872:
// add file preview box
if (
// get image size
var filePreviewSize =
var regExpMatch;
if ( (regExpMatch = /\|(\d+)px(\||$)/.exec(innerPlain)) != null) {
var size = parseInt(regExpMatch[1]);
if ( (size > 0) && (size <
filePreviewSize = size;
}
Line 11,646 ⟶ 11,905:
wikEdFilePreviewIds[wikEdFilePreviewNo] = file + filePreviewSize;
}
previewCode = '<span class="wikEdFilePreview" id="wikEdFilePreview' + wikEdFilePreviewNo + '" style="' + style + '" title="' +
wikEdFilePreviewNo ++;
}
Line 11,667 ⟶ 11,926:
case 'template':
// do not hide templates if it has no parameters or if it shorter than
if ( (innerPlain.indexOf('|') == -1) || (innerPlain.length <
node.noHide = true;
}
Line 11,680 ⟶ 11,939:
var follow = '';
// 12 mod
var regExpTempl = new RegExp('^\\s*((' + wikEdTemplModifier + ')\\:\\s*)?((\\:\\s*)?([^\\:\\|\\[\\]\\{\\}\\s\\x00\\x01]*\\s*\\:))?\\s*([^\\:\\n\\x00\\x01\\{\\}]+?)\\s*(\\|((.|\\n)*?))?\\s*$', 'gi');
Line 11,691 ⟶ 11,950:
if (regExpMatch[1] != null) {
mod = regExpMatch[1];
interClean =
interClean = inter.replace(/:$/g, '');
}
Line 11,782 ⟶ 12,041:
}
else if (ns == '') {
// no Template: addition for subpage linking
if (template.indexOf('/') != 0) {
ns = wikEdConfig['text']['wikicode Template'] + ':';
}
}
follow = ' ' + WikEdHighlightLinkify(ns, template);
Line 11,807 ⟶ 12,070:
}
}
insertLeft = '<span class="wikEdTemplContainer"><button class="' + hideButtonClass + wikEdTemplateArray.length + '" title="' +
wikEdTemplateArray.push( {'text': template, 'added': false} );
}
Line 11,879 ⟶ 12,142:
break;
case 'p':
insertLeft = '<span class="wikEdHtmlUnknown" title="' +
pushRight = '</span><!--wikEdHtmlUnknown-->';
break;
Line 11,905 ⟶ 12,168:
if (wikEdRefHide == true) {
if (refName != '') {
insertLeft = '<span class="wikEdRefContainer"><button class="wikEdRefButton' + wikEdReferenceArray.length + '" title="' +
wikEdReferenceArray.push( {'text': refName, 'added': false} );
}
else {
insertLeft = '<span class="wikEdRefContainer"><button class="wikEdRefButton" title="' +
}
}
Line 11,922 ⟶ 12,185:
case 'heading':
var heading = innerPlain.replace(/^\s+|\s+$/g, '');
if ( (heading ==
insertLeft = '<span class="wikEdHeadingWP">';
}
Line 12,067 ⟶ 12,330:
break;
case 'p':
insertLeft = '<span class="wikEdHtmlUnknown" title="' +
pushRight = '</span><!--wikEdHtmlUnknown-->';
break;
Line 12,162 ⟶ 12,425:
break;
case 'signature':
var title =
insertLeft = '<span class="wikEdSignature" title="' + title + '">';
insertRight = '</span><!--wikEdSignature-->';
Line 12,209 ⟶ 12,472:
break;
case 'htmlUnknown':
insertLeft = '<span class="wikEdHtmlUnknown" title="' +
pushRight = '</span><!--wikEdHtmlUnknown-->';
break;
Line 12,225 ⟶ 12,488:
if (wikEdRefHide == true) {
if (refName != '') {
insertLeft = '<span class="wikEdRefContainer"><button class="wikEdRefButton' + wikEdReferenceArray.length + '" title="' +
wikEdReferenceArray.push( {'text': refName + ' ↑', 'added': false} );
}
else {
insertLeft = '<span class="wikEdRefContainer"><button class="wikEdRefButton" title="' +
}
}
Line 12,378 ⟶ 12,641:
if (character != null) {
if (wikEdRefHide == true) {
insertLeft = '<span class="wikEdCharEntityContainer"><button class="wikEdCharEntityButton' + wikEdCharEntityArray.length + '" title="' +
wikEdCharEntityArray.push( {'text': character, 'added': false} );
}
Line 12,392 ⟶ 12,655:
case 'error':
insertLeft = '<span class="wikEdError" title="' + node.left + '">';
if (
insertLeft += '<span class="wikEdHighlightError">' + node.left + '</span><!--wikEdHighlightError-->';
}
Line 12,526 ⟶ 12,789:
window.WikEdHighlightLinkify = function(linkPrefix, linkTitle, linkUrl) {
if (
return('');
}
Line 12,581 ⟶ 12,844:
}
// [[/subpage]] refers to a subpage of the current page, [[#section]] to a section of the current page
if ( (linkPrefix == '') && ( (linkTitle.indexOf('/') == 0) || (linkTitle.indexOf('#') == 0) ) ) {
subpage = true;
}
Line 12,630 ⟶ 12,893:
var titleClick;
if (wikEdPlatform == 'mac') {
titleClick =
}
else {
titleClick =
}
linkParam += 'id="wikEdLinkify' + wikEdLinkifyArray.length + '" title="' + linkPopup + ' ' + titleClick + '"';
Line 12,970 ⟶ 13,233:
// run scheduled custom functions
WikEdExecuteHook(
}
}
Line 13,015 ⟶ 13,278:
// run scheduled custom functions
WikEdExecuteHook(
}
}
Line 13,397 ⟶ 13,660:
// remove new value if it is a preset value
if (
var i = 0;
while (i <
if (
wikEdFieldHist[field].shift();
break;
Line 13,411 ⟶ 13,674:
// cut history number to maximal history length
wikEdFieldHist[field] = wikEdFieldHist[field].slice(0,
// save history to settings
Line 13,471 ⟶ 13,734:
// add preset entries
var startPreset = 0;
if (
startPreset = j;
for (var i = 0; i <
if (
// replace spaces with nbsp to allow for multiple, leading, and trailing spaces
// select a dropdown value
if (
selectedOption = j;
}
option = document.createElement('option');
option.text =
if (field == 'summary') {
option.text = option.text.replace(/\{wikEdUsing\}/g,
}
wikEdSelectElement[field].options[j++] = option;
Line 13,715 ⟶ 13,978:
var getStr = '';
// get a value from web storage
if (wikEdWebStorage == true) {
getStr = localStorage.getItem(name);
}
// get a Greasemonkey persistent value
else if (wikEdGreasemonkey == true) {
getStr = GM_getValue(name, '');
}
Line 13,734 ⟶ 14,002:
window.WikEdSetPersistent = function(name, value, expires, path, ___domain, secure) {
// set a value in web storage
if (wikEdWebStorage == true) {
if (expires == -1) {
localStorage.removeItem(name, '');
}
else {
localStorage.setItem(name, value);
}
}
// set a Greasemonkey persistent value
else if (wikEdGreasemonkey == true) {
if (expires == -1) {
GM_setValue(name, '');
Line 13,799 ⟶ 14,078:
else if (expires == 0) {
var cookieExpire = new Date();
expires = cookieExpire.setTime(cookieExpire.getTime() +
expires = cookieExpire.toUTCString();
}
Line 13,848 ⟶ 14,127:
//
window.WikEdAppendScript = function(scriptUrl, onLoadFunction) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.setAttribute('type
script.setAttribute('src
head.appendChild(script);
if (onLoadFunction != null) {
WikEdAddEventListener(script, 'load', onLoadFunction, false);
}
return;
};
Line 14,189 ⟶ 14,471:
ruleStyle = ruleStyle.replace(/\{wikEdImage:(\w+)\}/g,
function (p, p1) {
return(
}
);
Line 14,196 ⟶ 14,478:
ruleStyle = ruleStyle.replace(/\{wikEdText:(\w+)\}/g,
function (p, p1) {
return(
}
);
Line 14,322 ⟶ 14,604:
//
window.WikEdAjaxPreview = function(
// prepare the
var requestUrl;
if ( (wikEdUploadEdit == true) || (wikEdWatchlistEdit == true) || (wikEdViewDeleted == true) ) {
requestUrl = wikEdWikiGlobals['wgServer'] + wikEdWikiGlobals['wgScript'] + '?title=wikEdPreview&action=submit';
}
else {
}
// prepare the form fields
var postFields = {};
postFields['wpTextbox1'] = textValue;
if (wikEdEdittime != null) {
postFields['wikEdEdittime'] = wikEdEdittime;
}
if (
}
if (livePreview != false) {
}
// make the ajax request
var requestMethod = 'POST';
var overrideMimeType = 'text/html';
WikEdAjaxRequest(requestMethod, requestUrl, postFields, overrideMimeType, ResponseHandler);
return;
Line 14,358 ⟶ 14,643:
//
window.WikEdAjaxRequest = function(requestMethod, requestUrl,
var request;
// generate body data from form field object
var headerName = null;
var headerValue = null;
var bodyData = '';
if (requestMethod == 'POST') {
//create boundary
var boundary = WikEdCreateRandomString(12);
// POST header
headerName = 'Content-Type';
headerValue = 'multipart/form-data; boundary=' + boundary;
// assemble body data
for (var fieldName in postFields) {
if (postFields.hasOwnProperty(fieldName) == true) {
var fieldValue = postFields[fieldName];
bodyData += '--' + boundary + '\r\n';
bodyData += 'Content-Disposition: form-data; name="' + fieldName + '"\r\n\r\n' + fieldValue + '\r\n';
}
}
bodyData += '--' + boundary + '--\r\n';
}
// use Greasemonkey GM_xmlhttpRequest
if (wikEdGreasemonkey == true) {
var headerObj = { 'User-Agent': navigator.userAgent };
if (headerName != null) {
}
// workaround for Error: Greasemonkey access violation: unsafeWindow cannot call GM_xmlhttpRequest.
// see http://wiki.greasespot.net/Greasemonkey_access_violation
setTimeout(function() {
new GM_xmlhttpRequest({
'method': requestMethod,
'url': requestUrl,
'overrideMimeType': overrideMimeType,
'headers': headerObj,
'data': bodyData,
'onreadystatechange':
function(ajax) {
if (ajax.readyState != 4) {
return;
}
ResponseHandler(ajax);
return;
}
});
}
Line 14,389 ⟶ 14,703:
// allow ajax request from local copy for testing
if (
if (typeof(netscape) == 'object') {
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
Line 14,396 ⟶ 14,710:
// new ajax request object
if (typeof(XMLHttpRequest) == 'object') {
request = new XMLHttpRequest();
}
// IE
else if (typeof(ActiveXObject) == 'object') {
// IE 6
try {
request = new ActiveXObject('Microsoft.XMLHTTP');
Line 14,415 ⟶ 14,731:
}
}
}
if (request == null) {
return;
}
request.open(requestMethod, requestUrl, true);
Line 14,436 ⟶ 14,755:
return;
}
return;
};
Line 14,445 ⟶ 14,764:
//
//
// uses Greasemonkey postMessage ___location hack and JSON encoding
window.
if ( (typeof(window.postMessage) != 'function') || (typeof(JSON) != 'object') ) {
return;
}
// set ___location href to execute code in global context
var locationHackCode = 'var globalObj = {};';
if (gotGlobalsHook != null) {
wikEdGotGlobalsHook.push(gotGlobalsHook);
locationHackCode += 'globalObj.hookNumber = ' + (wikEdGotGlobalsHook.length - 1) + ';';
}
locationHackCode += 'globalObj.wikEdGetGlobals = {};';
for (var i = 0; i < names.length; i ++) {
locationHackCode += ''
+ 'if (typeof(' + names[i] + ') != \'undefined\') {'
+ ' globalObj.wikEdGetGlobals[\'' + names[i] + '\'] = ' + names[i] + ';'
+ '}';
}
locationHackCode += ''
+ 'var globalObjStr = JSON.stringify(globalObj);'
+ 'window.postMessage(globalObjStr, \'' + window.___location.protocol + '//' + window.___location.host + '\');'
+ 'void(0);';
___location.href = 'javascript:' + locationHackCode;
return;
};
//
// WikEdGetGlobalsReceiver: event handler for WikEdGetGlobals postMessage
//
window.WikEdGetGlobalsReceiver = function(event) {
if (event.source != window) {
return;
}
if (event.origin != window.___location.protocol + '//' + window.___location.host) {
return;
}
if (event.data != '') {
var globalObj = JSON.parse(event.data);
var globals = globalObj.wikEdGetGlobals;
if (globals != null) {
for (var key in globals) {
if (globals.hasOwnProperty(key) == true) {
wikEdWikiGlobals[key] = globals[key];
}
}
// run scheduled functions only once
if (globalObj.hookNumber != null) {
WikEdExecuteHook(wikEdGotGlobalsHook[globalObj.hookNumber], true);
}
}
}
return;
}
Line 14,541 ⟶ 14,894:
window.WikEdAddEventListener = function(domElement, eventType, eventHandler, useCapture) {
if (domElement
return;
}
if (typeof(domElement.addEventListener) == 'function') {
domElement.addEventListener(eventType, eventHandler, useCapture);
}
else {
domElement['wikEd' + eventType + eventHandler] = eventHandler;
domElement[eventType + eventHandler] = function() {
if (document.addEventListener == null) {
eventRootElement = window;
}
domElement
};
domElement.attachEvent('on' + eventType, domElement[eventType + eventHandler] );
}
return;
Line 14,567 ⟶ 14,921:
window.WikEdRemoveEventListener = function(domElement, eventType, eventHandler, useCapture) {
if (domElement == null) {
return;
}
if (typeof(domElement.removeEventListener) == 'function') {
domElement.removeEventListener(eventType, eventHandler, useCapture);
Line 14,731 ⟶ 15,088:
}
};
//
// WikEdCreateRandomString: create random string of specified length and character set
//
window.WikEdCreateRandomString = function(strLength, charSet) {
if (charSet == null) {
charSet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_';
}
var str = '';
for (var i = 0; i < strLength; i ++) {
str += charSet.charAt(Math.floor(Math.random() * charSet.length));
}
return(str);
}
Line 14,782 ⟶ 15,156:
// whole parse tree up
else if ( (typeof(object.tree) == 'object') && (typeof(object.lastOpenNode) == 'number') ) {
xxxx;
value = ': Parse tree upwards:\n';
var parseTreeIndex = object.lastOpenNode;
Line 14,835 ⟶ 15,210:
if ( (object.innerHTML != null) && (object.innerHTML != '') ) {
var html = object.innerHTML;
if (html.length >
html = html.substr(0,
}
value += ', innerHTML: "' + html + '"';
Line 14,880 ⟶ 15,255:
// cut text if having reached maximum length
value = objectName + value + '\n';
if (wikEdDebug.value.length >
wikEdDebug.value = value + wikEdDebug.value.substr(0,
}
else {
Line 14,972 ⟶ 15,347:
//
window.WikEdExecuteHook = function(functionsHook, onlyOnce) {
for (var i = 0; i < functionsHook.length; i ++) {
functionsHook[i]();
}
if (onlyOnce == true) {
functionsHook = [];
}
return;
Line 15,336 ⟶ 15,714:
};
// call wikEd on startup, but not for the iframe under Greasemonkey
if (window == top) {
WikEdStartup();
}
// </nowiki></pre>
|