User:PerfektesChaos/js/citoidWikitext/core/d.js: Difference between revisions

Content deleted Content added
-3.6
-3.7
Line 17:
( function ( mw, $ ) {
"use strict";
var Version = -3.67,
MW_LIB Signature = "citoidWikitext",
Sub = "core",
APICSites = {= }"|dewiki|",
BOOKAPIC = { },
DESCBOOK = { },
// EDIT DESC = { },
GUIPEDIT = { btncodeMirror: { }false,
caret wikEd: { false },
GUIP = { btn: gadget: { },
input caret: { },
push: gadget: { } },
HELP = { site: "w input:en" { },
support: "user push:PerfektesChaos/js/" + MW_LIB { } },
I18NHELP = { }site: "w:en",
PREGO = { maxage support: "user:PerfektesChaos/js/" + Signature 604812},
I18N = { signature: "preferencesGadgetOptions"},
PREGO = { sitemaxage: "w:en"604812,
store: signature: "User:PerfektesChaos/js/preferencesGadgetOptions",
sub: site: "/r.jsw:en" },
REPOS = { maxage store: 86400 "User:PerfektesChaos/js/",
site sub: "w:en/r.js" },
REPOS = { storemaxage: "User:PerfektesChaos/js/" }86400,
PROJ = false site: "w:en",
TASK = { store: "User:PerfektesChaos/js/" },
UTILPROJ = { }= false,
CITWT[ SubTASK ] = = { };,
// UTIL > wikEd = { },
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.type = MW_LIB;
CITWT.support = "[[" + HELP.site + ":" + HELP.support + "]]";
if ( typeof CITWT[ Sub ] !== "object" || ! CITWT[ Sub ] ) {
CITWT[ Sub ] = { };
}
CITWT.core.sites = "|dewiki|";
 
 
Line 69 ⟶ 53:
// Mark sub-module as ready
// Uses:
// env,> sub; Signature
// > Sub
// > .typeVersion
// > XPORT
// < CITWT
// < .signature
// < .vsn
// < .type
// mw.loader.getState()
// mw.loader.state()
// mw.hook()
// 2016-01-02 PerfektesChaos@de.wikipedia
var subsign = "/ext.gadget." + SubSignature,
signature;sub = "/" + Sub,
CITWT. signature = "ext.gadget."sign + CITWT.type;sub,
signature = CITWT.signaturee, +s, subo;
if ( mw.loader.getState( signature ) !== "ready" ) {
mw.loader.state( signature, "ready" );
if ( typeof mw.libs[ MW_LIBSignature ] !== "object" ||
! mw.libs[ Signature ] ) {
! mw.libs[ MW_LIBSignature ] )= { };
}
CITWT = mw.libs[ MW_LIBSignature ];
CITWT.signature = sign;
if ( typeof CITWT.vsn === "string" ) {
CITWT.vsn = CITWT.vsn + " ";
} else {
CITWT.vsn = "";
}
CITWT.vsn CITWT.vsn = CITWT.vsn + Sub.substr( 0, 1 ) + "c:" + Version;
GUIPCITWT.wikEdtype = trueSignature;
if ( typeof CITWT[ Sub ] !== "object" || ! CITWT[ Sub ] ) {
! CITWT[ Sub ] ) {
mw.libs CITWT[ MW_LIBSub ] = { };
}
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
// < GUIPEDIT.wikEd
// mw.user.options.get()
// GUIP.file()
// 20152018-0507-1221 PerfektesChaos@de.wikipedia
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: { } };
}
ifEDIT.wikEd ( typeof= window.wikEd.config !== "object" ) {;
if ( typeof windowEDIT.wikEd.config !== { button: "object" ) { },
EDIT.wikEd.config = { button: { },
buttonBar: { } };
}
cnf = windowEDIT.wikEd.config;
if ( typeof cnf.button !== "object" ) {
cnf.button = { };
Line 1,306 ⟶ 1,324:
}
cnf.buttonBar.custom1[ 6 ].push( id );
if ( typeof windowEDIT.wikEd.useWikEddisabled === "boolean" &&
&&typeof windowEDIT.wikEd.useWikEdhighlightSyntax ) {=== "boolean" &&
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
// 20152018-0507-0121 PerfektesChaos@de.wikipedia
var shift, start, story;
if ( GUIP.caret.max >= 0 ) {
Line 1,429 ⟶ 1,451:
story = start + shift + story;
GUIP.$textarea.val( story );
if ( alienEDIT.codeMirror ===&& "wikEd"EDIT.codeMirror.liveCITWT ) {
windowEDIT.wikEdcodeMirror.UpdateFramedoc.setValue( story );
} 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
// 20152018-0507-1921 PerfektesChaos@de.wikipedia
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() );
}
}
var rg = GUIP.$textarea.textSelection( "getCaretPosition",
{ "startAndEnd": true } );
GUIP.caret.story = GUIP.$textarea.val();
if ( rg[0] <= rg[1] ) {
Line 1,475 ⟶ 1,516:
// Uses:
// this
// > GUIPEDIT.wikEd
// > wikEd
// > GUIP.$textarea
// < GUIP.caret.start
Line 1,486 ⟶ 1,526:
// < GUIP.caret.starter
// (GUIP.caret.wikEdEnclose)
// 20172018-0201-0621 PerfektesChaos@de.wikipedia
var r;
if ( GUIPEDIT.wikEd && window.wikEd.useWikEd ) {
! 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#";
windowEDIT.wikEd.EditButton( null,
null,
null,
this.wikEdEnclose );
windowEDIT.wikEd.UpdateTextarea();
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 );
windowEDIT.wikEd.UpdateFrame();
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
// 20152018-0507-0121 PerfektesChaos@de.wikipedia
windowEDIT.wikEd.GetText( assign, "selection, cursor" );
if ( assign.selection.plain === "" ) {
assign.sel = windowEDIT.wikEd.GetSelection();
if ( assign.sel.anchorNode.previousSibling ) {
assign.changed = assign.cursor;
} else {
windowEDIT.wikEd.GetText( assign, "whole" );
assign.changed = assign.whole;
}
Line 2,605 ⟶ 2,650:
 
 
CITWTXPORT.core.fold = function ( analyse ) {
// Derive simple template parameters; not nested
// Precondition:
Line 2,651 ⟶ 2,696:
} // for i
return r;
}; // CITWTXPORT.core.fold()
 
 
Line 2,659 ⟶ 2,704:
 
 
CITWTXPORT.fire = function ( event ) {
// Tool button has been clicked
// Precondition:
Line 2,669 ⟶ 2,714:
// GUIP.factory()
// TASK.fiat()
// Remark: Used as event handler -- 'this' is not CITWTXPORT
// 2015-05-23 PerfektesChaos@de.wikipedia
UTIL.fullstop( event );
Line 2,678 ⟶ 2,723:
}
TASK.fiat();
}; // CITWTXPORT.fire()
 
 
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-1422 PerfektesChaos@de.wikipedia
var suitableenv, = "|edit|submit|"sub, suitable;
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 &&