/// User:PerfektesChaos/js/idResolver/prego/d.js
/// 2018-08-24 PerfektesChaos@de.wikipedia
// Sub-module: Equip Special:Gadgets
// ResourceLoader: compatible;
// dependencies: No MW
/// Fingerprint: #0#0#
/// @license GPL [//www.mediawiki.org/w/COPYING] (+GFDL, LGPL, CC-BY-SA)
/// <nowiki>
/* global window:false */
/* jshint bitwise:true, curly:true, eqeqeq:true, latedef:true,
laxbreak:true,
nocomma:true, strict:true, undef:true, unused:true */
( function ( mw ) {
"use strict";
var Version = -1.2,
IDA = "idResolver",
Sub = "prego";
if ( typeof mw.libs[ IDA ] !== "object" || ! mw.libs[ IDA ] ) {
mw.libs[ IDA ] = { };
}
mw.libs[ IDA ].type = IDA;
IDA = mw.libs[ IDA ];
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program;
* if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*/
if ( typeof IDA[ Sub ] !== "object" ) {
IDA[ Sub ] = { };
}
IDA[ Sub ].vsn = Version;
if ( typeof IDA.lang !== "object" ) {
IDA.lang = { slang: "en" };
}
if ( typeof IDA[ Sub ].texts !== "object" ) {
IDA[ Sub ].texts = {
// 2017-02-06 PerfektesChaos@de.wikipedia
"^show": {"en": "ID Resolver",
"de": "ID Resolver"},
"^suffix": {"en": "– Offer multiple link targets",
"de": "– Mehrfache Linkziele anbieten"},
"^^layer": {"en": "Popup opac",
"de": "Popup undurchsichtig"},
"^^lazy": {"en": "Toolbox link only at start",
"de": "Nur Werkzeuglink beim Start"},
"^^light": {"en": "Visited links keep colour",
"en-us": "Visited links keep color",
"de": "Keine Farbmarkierung besuchter Links"},
"^^linking":{"en": "All external links with choice",
"de": "Alle Weblinks mit Auswahl"},
"^^make": {"en": "New tab/window for linked pages",
"de": "Neuer Browser-Tab"},
"^^make0": {"en": "Always the same",
"de": "Immer derselbe"},
"^^make1": {"en": "Per ID type",
"de": "Pro Bezeichner-Typ"},
"^^make2": {"en": "Per domain",
"de": "Pro Domain"},
"^^make3": {"en": "Always entirely new",
"de": "Immer ganz neu"},
"^^spaces": {"en": "Space separated list of namespace numbers",
"de": "Namensraum-Nummern,"
+ " durch Leerzeichen getrennt"}
}; // .prego.texts
}
function facilitated( at ) {
// Mark sub-module as ready
// Precondition:
// at -- function to be applied when ready
// Uses:
// > .signature
// > Sub
// > .type
// mw.loader.getState()
// mw.loader.state()
// mw.hook()
// 2018-08-24 PerfektesChaos@de.wikipedia
var rls, signature, sub;
if ( typeof IDA.signature === "string" ) {
sub = "/" + Sub;
signature = IDA.signature + sub;
if ( mw.loader.getState( signature ) !== "ready" ) {
rls = { };
rls[ signature ] = "ready";
mw.loader.state( rls );
mw.hook( IDA.type + sub + ".ready" ).fire( at );
}
}
} // facilitated()
function favourite() {
// Detect support page in user language
// Uses:
// this
// > .lang.slang
// > .support
// 2016-05-01 PerfektesChaos@de.wikipedia
var r;
switch ( IDA.lang.slang ) {
case "de" :
r = "de.wikipedia.org";
break;
default:
r = "en.wikipedia.org";
} // switch .slang
return "//" + r + "/wiki/" + IDA.support;
} // favourite()
function form( auxilary, apply ) {
// Equip Special:Gadgets page with entry and form
// Precondition:
// auxilary -- preferencesGadgetOptions library object
// apply -- current option preset
// > .lazy
// > .linking
// > .make
// > .spaces
// Uses:
// > Sub
// > .prego.texts
// > .type
// favourite()
// mw.libs.preferencesGadgetOptions.form()
// 2017-02-21 PerfektesChaos@de.wikipedia
var texts = IDA[ Sub ].texts,
dialog, opts = [ ];
opts.push( { signature: "lazy",
type: "checkbox",
show: texts[ "^^lazy" ],
val: ( apply.lazy ? true
: false ) },
{ signature: "linking",
type: "checkbox",
show: texts[ "^^linking" ],
val: ( apply.linking ? true
: false ) },
{ signature: "layer",
type: "checkbox",
show: texts[ "^^layer" ],
val: ( apply.layer ? true
: false ) },
{ signature: "light",
type: "checkbox",
show: texts[ "^^light" ],
val: ( apply.light ? true
: false ) },
{ signature: "make",
type: "radio",
show: texts[ "^^make" ],
val: ( apply.make ? apply.make
: 0 ),
poly: [ { val: 0,
show: texts[ "^^make0" ] },
{ val: 1,
show: texts[ "^^make1" ] },
{ val: 2,
show: texts[ "^^make2" ] },
{ val: 3,
show: texts[ "^^make3" ] }
] },
{ signature: "spaces",
type: "text",
show: texts[ "^^spaces" ],
val: ( apply.spaces ? apply.spaces
: "" ) } );
dialog = { script: IDA.type,
show: texts[ "^show" ],
support: favourite(),
suffix: texts[ "^suffix" ],
opts: opts };
if ( typeof auxilary.form === "function" ) {
auxilary.form( dialog );
}
} // form()
function fire() {
// Initialize sub-module
// Uses:
// facilitated()
// (form)
// 2016-05-01 PerfektesChaos@de.wikipedia
facilitated( form );
} // fire()
fire(); // autorun
}( window.mediaWiki, window.jQuery ) );
// Emacs
// Local Variables:
// coding: utf-8-dos
// fill-column: 80
// End:
/// EOF </nowiki> externalLinkProblem/prego/d.js