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

Content deleted Content added
-1.22
-1.23
Line 1:
/// User:PerfektesChaos/js/citoidWikitext/core.js
// Execute core functionality for citoid on wikitext source editing
/// 2015-06-0514 PerfektesChaos@de.wikipedia
// ResourceLoader: compatible;
// dependencies: --
Line 17:
( function ( mw, $ ) {
"use strict";
var VERSION = -1.2223,
MW_LIB = "citoidWikitext",
APIC = { },
Line 31:
TASK = { },
UTIL = { },
CITWT, SIG;
 
 
Line 47:
CITWT.type = MW_LIB;
CITWT.signature = "ext.gadget." + CITWT.type;
SIG = CITWT.signature + "/core";
mw.loader.state( SIG, "loading" );
CITWT.support = "user:PerfektesChaos/js/" + CITWT.type;
if ( typeof CITWT.core !== "object" || ! CITWT.core ) {
Line 59 ⟶ 61:
 
 
APIC.site = "https://citoid.wikimedia.org/urlapi";
 
 
Line 97 ⟶ 99:
// > APIC.site
// > APIC.queries
// >< APIC.data
// >< APIC.jq
// >< APIC.legacy
// (APIC.found)
// (APIC.fault)
// Remark: Used as event handler -- 'this' is not APIC
// 2015-06-0114 PerfektesChaos@de.wikipedia
var f, i, seek, service;
if ( typeof APIC.jq !== "object" ) {
f = function ( jqXHR ) {
Line 113 ⟶ 117:
service = APIC.site;
}
APIC.jqdata = { beforeSendformat: f,"zotero" };
APIC.jq = { beforeSend: f,
dataType: "json", // No "Intelligent Guess"
type url: "POST", service };
APIC.legacy = ( service.indexOf( "/url:" ) > 0 service });
if ( APIC.legacy ) {
APIC.jq.type = "POST";
} else {
APIC.jq.data = APIC.data;
}
}
for ( i = 0; i < APIC.queries.length; i++ ) {
Line 124 ⟶ 134:
nor a stable implementation in spring 2015.
*/
APIC.jq.dataseek = JSON.stringify( { url: APIC.queries[ i ],;
if ( APIC.legacy ) {
format: "zotero" } );
APIC.data.url = seek;
APIC.jq.data = JSON.stringify( APIC.data );
} else {
APIC.jq.data.search = seek;
}
$.ajax( APIC.jq ).done( APIC.found )
.fail( APIC.fault );
Line 2,379 ⟶ 2,394:
// >< .suite
// UTIL.feed()
// 2015-0506-2710 PerfektesChaos@de.wikipedia
var sub = "/" + access;
if ( typeof CITWT.suite !== "string" ) {
Line 2,386 ⟶ 2,401:
UTIL.feed( CITWT.signature + sub,
CITWT.type + sub + "/" + CITWT.suite,
( age ? age : 9003600 ) );
}; // UTIL.fetch()
 
Line 2,546 ⟶ 2,561:
// Start regular workflow in edit mode, if appropriate
// Uses:
// > SIG
// > .signature
// >< .core.loaded
Line 2,557 ⟶ 2,573:
// mw.loader.using()
// (TASK.fire)
// 2015-0506-3110 PerfektesChaos@de.wikipedia
var suitable = "|edit|submit|",
env;
mw.loader.state( CITWT.signature + "/core"SIG, "ready" );
if ( typeof CITWT.core.loaded !== "boolean" ) {
CITWT.core.loaded = true;