Content deleted Content added
-3.6 |
-3.7 |
||
Line 17:
( function ( mw, $ ) {
"use strict";
var Version = -3.
Sub = "core",
GUIP = { btn:
I18N = {
PREGO = {
REPOS = {
XPORT = { core: { sites: Sites } },
CITWT;
if ( typeof mw.libs[ MW_LIB ] !== "object" ||▼
! mw.libs[ MW_LIB ] ) {▼
mw.libs[ MW_LIB ] = { };▼
}▼
CITWT = mw.libs[ MW_LIB ];▼
if ( typeof CITWT.vsn === "string" ) {▼
CITWT.vsn = CITWT.vsn + " ";▼
} else {▼
CITWT.vsn = "";▼
}▼
CITWT.vsn = CITWT.vsn + "c:" + Version;▼
CITWT.support = "[[" + HELP.site + ":" + HELP.support + "]]";▼
if ( typeof CITWT[ Sub ] !== "object" || ! CITWT[ Sub ] ) {▼
▲ CITWT[ Sub ] = { };
Line 69 ⟶ 53:
// Mark sub-module as ready
// Uses:
// > Sub
// >
// > XPORT
// < CITWT
// < .signature
// < .vsn
// < .type
// mw.loader.getState()
// mw.loader.state()
// mw.hook()
// 2016-01-02 PerfektesChaos@de.wikipedia
var
if ( mw.loader.getState( signature ) !== "ready" ) {
mw.loader.state( signature, "ready" );
! mw.libs[ Signature ] ) {
}
CITWT.signature = sign;
▲ if ( typeof CITWT.vsn === "string" ) {
▲ CITWT.vsn = CITWT.vsn + " ";
▲ } else {
▲ CITWT.vsn = "";
}
! CITWT[ Sub ] ) {
}
e = XPORT[ Sub ];
o = CITWT[ Sub ];
for ( s in e ) {
o[ s ] = e[ s ];
} // for s in e
for ( s in XPORT ) {
if ( typeof XPORT[ s ] === "function" ) {
CITWT[ s ] = XPORT[ s ];
}
} // for s in XPORT
mw.hook( CITWT.type + sub + ".ready" ).fire();
}
Line 1,265 ⟶ 1,281:
// > GUIP.btn.show
// < GUIP.submit
// <
// mw.user.options.get()
// GUIP.file()
//
var id = 746,
cnf;
if ( mw.user.options.get( "gadget-wikEd" )
|| ( typeof window.wikEd === "object"
&& window.wikEd ) ) {
if ( typeof window.wikEd !== "object" ) {
window.wikEd = { config: { } };
}
if ( typeof
EDIT.wikEd.config = { button: { },
buttonBar: { } };
}
cnf =
if ( typeof cnf.button !== "object" ) {
cnf.button = { };
Line 1,306 ⟶ 1,324:
}
cnf.buttonBar.custom1[ 6 ].push( id );
if ( typeof
typeof EDIT.wikEd.turnedOn === "boolean" &&
typeof EDIT.wikEd.useWikEd === "boolean"
&& EDIT.wikEd.useWikEd ) {
GUIP.submit = "wikEd";
}
▲ GUIP.wikEd = true;
}
return GUIP.submit;
Line 1,409 ⟶ 1,429:
// > GUIP.caret.max
// > GUIP.$textarea
// > EDIT.codeMirror
// > EDIT.wikEd
// Remark: Used as event handler -- 'this' is not GUIP.caret
//
var shift, start, story;
if ( GUIP.caret.max >= 0 ) {
Line 1,429 ⟶ 1,451:
story = start + shift + story;
GUIP.$textarea.val( story );
if (
} else if ( alien === "wikEd" ) {
EDIT.wikEd.UpdateFrame();
}
}
Line 1,438 ⟶ 1,462:
GUIP.caret.find = function () {
// Get selection in regular textarea, but perhaps CodeMirror
// Precondition:
// jquery.textSelection has been loaded
Line 1,444 ⟶ 1,468:
// selection assigned
// Uses:
// > CodeMirror
// > GUIP.$textarea
// > GUIP.caret.further
// >< EDIT.codeMirror
// < GUIP.caret.story
// < GUIP.caret.min
Line 1,452 ⟶ 1,478:
// < GUIP.caret.starter
// Remark: Used as event handler -- 'this' is not GUIP.caret
//
var rg, uo;
var rg = GUIP.$textarea.textSelection( "getCaretPosition",▼
if ( ! EDIT.codeMirror &&
{ "startAndEnd": true } );▼
typeof window.CodeMirror === "function" &&
typeof window.CodeMirror.doc === "object"
&& window.CodeMirror.doc ) {
EDIT.codeMirror = window.CodeMirror;
▲ }
if ( EDIT.codeMirror ) {
uo = mw.user.options.get( "usecodemirror" );
EDIT.codeMirror.liveCITWT = ( typeof uo === "number"
&& uo > 0 );
if ( EDIT.codeMirror.liveCITWT ) {
GUIP.$textarea.val( EDIT.codeMirror.doc.getValue() );
}
▲ }
GUIP.caret.story = GUIP.$textarea.val();
if ( rg[0] <= rg[1] ) {
Line 1,475 ⟶ 1,516:
// Uses:
// this
// >
▲ // > wikEd
// > GUIP.$textarea
// < GUIP.caret.start
Line 1,486 ⟶ 1,526:
// < GUIP.caret.starter
// (GUIP.caret.wikEdEnclose)
//
var r;
if (
! EDIT.wikEd.disabled &&
EDIT.wikEd.useWikEd &&
EDIT.wikEd.turnedOn &&
EDIT.wikEd.highlightSyntax ) {
this.start = "##\f#citoid_marker_begin##\f#";
this.stop = "##\f#citoid_marker_end##\f#";
r = GUIP.$textarea.val();
this.min = r.search( this.start );
Line 1,505 ⟶ 1,549:
this.selection = this.story.substr( this.min );
this.starter = this.story.substr( 0, this.min );
r = true;
}
Line 1,520 ⟶ 1,564:
// assign got further properties
// Uses:
// > EDIT.wikEd
// > GUIP.caret.start
// > GUIP.caret.stop
// Remark: Used as event handler -- 'this' is not GUIP.caret
//
if ( assign.selection.plain === "" ) {
assign.sel =
if ( assign.sel.anchorNode.previousSibling ) {
assign.changed = assign.cursor;
} else {
assign.changed = assign.whole;
}
Line 2,605 ⟶ 2,650:
// Derive simple template parameters; not nested
// Precondition:
Line 2,651 ⟶ 2,696:
} // for i
return r;
}; //
Line 2,659 ⟶ 2,704:
// Tool button has been clicked
// Precondition:
Line 2,669 ⟶ 2,714:
// GUIP.factory()
// TASK.fiat()
// Remark: Used as event handler -- 'this' is not
// 2015-05-23 PerfektesChaos@de.wikipedia
UTIL.fullstop( event );
Line 2,678 ⟶ 2,723:
}
TASK.fiat();
}; //
Line 2,689 ⟶ 2,734:
// Start regular workflow in edit mode, if appropriate
// Uses:
// > CITWT
// > HELP.site
// > HELP.support
// > Version
// > .signature
// >< .core.loaded
// >< .bibRecord
// < .support
// < .core.site
// facilitated()
Line 2,702 ⟶ 2,751:
// mw.loader.using()
// (TASK.fire)
// 2018-07-
var
▲ env, sub;
facilitated();
if ( CITWT && typeof CITWT.core.loaded !== "boolean" ) {
CITWT.core.loaded = true;
env = mw.config.get( [ "wgAction",
Line 2,712 ⟶ 2,760:
"wgIsProbablyEditable",
"wgPageContentModel" ] );
▲ CITWT.support = "[[" + HELP.site + ":" + HELP.support + "]]";
CITWT.core.site = env.wgDBname;
suitable = "|edit|submit|";
if ( suitable.indexOf( env.wgAction ) > 0 &&
env.wgIsProbablyEditable &&
|