Content deleted Content added
m Maintenance: Page contains unsafe nowiki - phab:T236828 |
p- |
||
(14 intermediate revisions by 3 users not shown) | |||
Line 7:
// turn on ECMAScript 5 strict mode
'use strict';
// We will not log errors for users using this script due to volume of bugs.
mw.loader.using('mediawiki.storage').then(function () {
mw.storage.session.set( 'client-error-opt-out', '1' );
// define global object
var wikEd; if (wikEd === undefined) { wikEd = {}; }
// default to null (all checks are against null so make sure it starts as null)
if (wikEd.paste === undefined) {
wikEd.paste = null;
wikEd.Meta = function () {/*
Line 1,259 ⟶ 1,270:
// use French rules for fix punctuation
if (wikEd.config.fixPunctFrench === undefined) { wikEd.config.fixPunctFrench = false; }
// convert \xa (nbsp) to character entities so they do not get converted to blanks
if (wikEd.config.convertNbspToEntities === undefined) { wikEd.config.convertNbspToEntities = true; }
// wikEd.config.setupHook, executed after wikEd has been set up, usage: wikEd.config.setupHook.push(YourFunction);
Line 1,439 ⟶ 1,453:
// vector (see https://bugzilla.wikimedia.org/show_bug.cgi?id=19527)
vector_old: [ 'p-personal', true, true, ['content', 'bodyContent', 'contentSub', 'left-navigation', 'p-namespaces', 'p-cactions'] ],
vector_new: [ 'p-personal', true, true, ['content', 'bodyContent', 'contentSub', 'left-navigation', 'p-
// citizendium.org
Line 2,045 ⟶ 2,059:
// parse global-context (MediaWiki) variables into hash (for Greasemonkey)
var globalNames = ['skin', 'wgServer', 'wgTitle', 'wgCanonicalNamespace', 'wgArticlePath', 'wgScript', 'wgScriptPath', 'wgUserName', 'wgCurRevisionId', 'wgContentLanguage', 'wgUserLanguage
if (wikEd.greasemonkey === true) {
globalNames.push('wikEdConfig', 'wikEdText');
Line 3,511 ⟶ 3,525:
if (wikEd.fixRegExTypo !== null) {
wikEd.fixRegExTypo.style.display = 'none';
▲ }
}▼
}
Line 3,840 ⟶ 3,846:
// allow other code to cause us to update the textarea via textSelection( 'getContents' )
$( '#wpTextbox1' ).textSelection(
'register',
▲ {
{
getContents: function () { if ( wikEd && wikEd.useWikEd ) {
wikEd.UpdateTextarea();
}
return $( this ).val();▼
}
▲ return $( this ).val();
}
} catch ( e ) {
▲ );
// catch `Error: Another textSelection API was already registered`
// When something else is registered should it unregister the existing one?
// Or should it detect this earlier and not run at all?
▲ }
}
Line 3,965 ⟶ 3,977:
wikEd.frameHtml = wikEd.frameDocument.documentElement;
wikEd.frameBody = wikEd.frameDocument.body;
if (!wikEd.frameBody) {
return;
}
// set frame body properties
Line 5,074 ⟶ 5,089:
wikEd.PastePoll = function () {
if (!wikEd.paste
return;
}
Line 5,219 ⟶ 5,234:
// vertical pos
if (rect && rect.bottom + barHeight <= parseInt(wikEd.frameHeight)) {
wikEd.buttonBarPasted.style.top = rect.bottom + 'px';
}
Line 8,608 ⟶ 8,623:
// check for named references defined outside edited section
if (
true
) {
Line 10,758 ⟶ 10,772:
// check if api is enabled
if
return;
}
Line 12,197 ⟶ 12,211:
else if ( (hrefParamTitle !== null) && (hrefParamSpecial !== true) ) {
linkArticle = hrefParamTitle;
linkArticle = linkArticle && linkArticle.replace(/_/g, ' ');
linkArticle = decodeURIComponent(linkArticle);
}
Line 12,204 ⟶ 12,218:
else if (hrefUrlArticle !== null) {
linkArticle = hrefUrlArticle;
linkArticle = linkArticle && linkArticle.replace(/_/g, ' ');
linkArticle = decodeURIComponent(linkArticle);
}
Line 12,219 ⟶ 12,233:
// format wiki link
if (linkArticle && linkArticle !== '') {
// check for wiki image
Line 16,408 ⟶ 16,422:
else {
wikEd.CleanNodes(wikEd.frameDocument);
obj.html = wikEd.frameBody.innerHTML;
} else {
return;
}
}
Line 16,455 ⟶ 16,474:
// convert \xa (nbsp) to character entities so they do not get converted to blanks
if (wikEd.config.convertNbspToEntities === true) {
obj.html = obj.html.replace(/\xa0/g, '&nbsp;');
}
}
Line 18,160 ⟶ 18,181:
// API request
if (
var postFields = {
'format': 'xml',
|