User:PerfektesChaos/js/logidTooltip/d.js: Difference between revisions

Content deleted Content added
-1.0
 
-1.3
 
(2 intermediate revisions by the same user not shown)
Line 1:
/// Gadget/logidTooltip/d.js
// Pop up logid link on certain special pages
/// 20192020-1008-01 PerfektesChaos@de.wikipedia
// ResourceLoader: compatible;
// dependencies: oojs, oojs-ui-core, oojs-ui-widgets
Line 15:
( function ( mw, $ ) {
"use strict";
var Version = -1.03,
LIT = { signature: "logidTooltip",
source: "0f/Arrow Blue UpperRight 001.svg",
search: "&action=edit&redlink=1",
selector: "data-mw-logid",
npx: 16,
Line 58 ⟶ 59:
// > LIT.signature
// > Version
// > LIT.search
// < LIT.vsn
// < LIT.doc
// < LIT.signed
// < LIT.special
// mw.loader.getState()
// mw.config.get()
Line 66 ⟶ 69:
// (filepath)
// (LIT.furnish)
// 20192020-1008-01 PerfektesChaos@de.wikipedia
var signature = "ext.gadget." + LIT.signature,
env, launch, rls;
if ( mw.loader.getState( signature ) !== "ready" ) {
rls = { };
Line 76 ⟶ 79:
LIT.doc = "w:en:User:PerfektesChaos/js/" + LIT.signature;
LIT.doc = "[[" + LIT.doc + "]]";
switchenv (= mw.config.get( [ "wgCanonicalSpecialPageName" ) ) {,
width: "wgFormattedNamespaces" ] "16em",);
switch ( env.wgCanonicalSpecialPageName ) {
case "Log":
case "Recentchanges":
case "Watchlist":
LIT.signedlaunch = LIT.signature + "-handle"true;
mw.hook( LIT.signature + "-icon" ).add( filepath );
mw.hook( "wikipage.content" ).add( LIT.furnish );
break;
default:
launch = ( window.___location.search.indexOf( LIT.search )
>= 0 );
} // switch wgCanonicalSpecialPageName
if ( launch ) {
LIT.signed = LIT.signature + "-handle";
LIT.special = env.wgFormattedNamespaces[ "-1" ];
mw.hook( LIT.signature + "-icon" ).add( filepath );
mw.hook( "wikipage.content" ).add( LIT.furnish );
}
}
} // fire()
Line 93 ⟶ 105:
// Create popup
// Precondition:
// assigned -- string, with logid
// $anchor -- element to be attached to
// OOjs-ui ready
// Postcondition:
// Return popup
// Uses:
// > LIT.special
// > LIT.signature
// > OO
Line 105 ⟶ 119:
var illusive = 0.75,
// margin = 10,
optionsoffset = { align: "backwards"$anchor.offset(),
options = { anchor: true,
horizontalPosition: "end",
padded: true,
position: "below",
verticalPosition: "below",
width: "16em",
$floatableContainer: $anchor },
shift = LIT.special + "Special:Redirect/logid/" + assigned,
$a = $( "<a>" ),
r;
options.width = ( 12 + assigned.length * 0.7 ) + "em";
if ( offset.left < 0.5 * window.innerWidth ) {
options.align = "forwards";
options.horizontalPosition = "start";
} else {
options.align = "backwards";
options.horizontalPosition: = "end",;
}
$a.addClass( LIT.signature + "-text plainlinks" )
.attr( { "dir": "ltr",
Line 253 ⟶ 273:
// mw.hook()
// (LIT.fiat)
// 2020-01-01 (LITPerfektesChaos@de.furnish)wikipedia
// 2019-10-01 PerfektesChaos@de.wikipedia
var $entries = $area.find( "li[" + LIT.selector + "]" );
if ( $entries.length ) {