Content deleted Content added
-1.9 |
-1.91 |
||
Line 2:
// Some minor link helpers
// ResourceLoader: compatible; dependencies: user, mediawiki.util
/// 2014-12-
/// Fingerprint: #0#0#
/// [[w:en:User:PerfektesChaos/js/pageLinkHelper]]
Line 12:
( function ( mw, $ ) {
"use strict";
var Version = -1.
Sign = "pageLinkHelper",
Signature = "ext.gadget." + Sign,
Line 23:
Redirect: { de: "Weiterleitung" },
permTitle: { "*": "PermaLink" },
purgeLUtip: { en: "PURGE this page"
+ " and force link update",
de: "PURGE mit rekursivem Linkupdate" },
purgeLUtitle: { en: "PURGE/linkupdate",
de: "PURGE/linkupdate" },
purgeLURtip: { en: "PURGE this page"
+ " and force recursive link update",
de: "PURGE mit rekursivem Linkupdate" },
purgeLURtitle: { en: "
de: "
purgeTip: { en: "PURGE this page from server cache",
de: "PURGE:"
Line 177 ⟶ 182:
// Uses:
// > PLH
// 2014-12-19 PerfektesChaos@de.wikipedia
var r; // = undefined
Line 296 ⟶ 302:
function favorite( apply ) {
// Insert portlet link, if appropriate
// Precondition:
Line 509 ⟶ 515:
// > Sign
// > ___location
// >< Env
// mw.config.get()
Line 514 ⟶ 522:
// $factory()
// fiat()
// history.___replaceState()
// mw.util.wikiUrlencode()
// freezer()
// 2014-12-
var sign = Sign + "Difflink",
$div = $( "#" + sign ),
caused, got, i, id1, id2, j, re, show, story, state, $span;
if ( ! $div.length && $float() ) {
if ( Env.wgCanonicalSpecialPageName ) {
Line 561 ⟶ 571:
if ( id1 ) {
Env.spcNS = mw.config.get( "wgFormattedNamespaces" )[ "-1" ];
+ ( id2 ? "/" + id2 : "" );
show = "[[" + Env.spcNS + story + "]]";
$span = $( "<span>" );
$span.text( show );
Line 575 ⟶ 585:
fiat( false, "o" );
fiat( false, "n" );
if ( typeof window.history.___replaceState === "function" ) {
if ( ! Env.wgPageName ) {
Env.wgPageName = mw.config.get( "wgPageName" );
}
state = "/wiki/"
+ mw.util.wikiUrlencode( Env.spcNS ) + story
+ "?title="
+ mw.util.wikiUrlencode( Env.wgPageName );
caused = { caused: Sign };
window.history.___replaceState( caused,
window.document.title,
state );
}
}
Line 598 ⟶ 621:
// fair()
// freezer()
// 2014-12-
var sign = Sign + "Permalink",
$div = $( "#" + sign ),
show, special, swift, $a, $br, $spanBeg, $spanEnd;
if ( ! $div.length && $float() ) {
Env.wgPageName = mw.config.get( "wgPageName" );
}
if ( Env.curid ) {
Env.curid = parseInt( Env.curid, 10 );
Line 705 ⟶ 730:
// mw.config.get()
// mw.util.getUrl()
// (fresh)
// 2014-12- var r;
if ( ahead ) {
Line 716 ⟶ 742:
} );
} else {
Env.wgPageName = mw.config.get( "wgPageName" );
}
r = mw.util.getUrl( Env.wgPageName,
{ action: "purge" } );
Line 726 ⟶ 754:
function fresher( ahead ) {
// Provide forcelinkupdate purge link
// Precondition:
// ahead -- true if initializing, false to link
// DOM.ready
// mediawiki.util loaded
// user resources loaded
// Postcondition:
// Returns link, or undefined
// Uses:
// >< Env
// favorite()
// mw.config.get()
// mw.util.wikiScript()
// (fresher)
// 2014-12-28 PerfektesChaos@de.wikipedia
var r;
if ( ahead ) {
if ( typeof Env.curid !== "number" ) {
Env.curid = mw.config.get( "wgArticleId" );
}
if ( Env.curid ) {
favorite( { signature: "forcelinkupdate",
skins: false,
fun: fresher,
show: "purgeLUtitle",
support: "purgeLUtip",
suffix: "purgeLinkUpd"
} );
}
} else {
r = mw.util.wikiScript( "api" )
+ "?action=purge&pageids=" + Env.curid
+ "&forcelinkupdate";
}
return r;
} // fresher()
function freshest( ahead ) {
// Provide forcerecursivelinkupdate purge link
// Precondition:
Line 739 ⟶ 807:
// mw.config.get()
// mw.util.wikiScript()
// (freshest)
// 2014-12- var r;
if ( ahead ) {
Line 748 ⟶ 817:
favorite( { signature: "forcerecursivelinkupdate",
skins: false,
fun:
show: "purgeLURtitle",
support: "purgeLURtip",
Line 760 ⟶ 829:
}
return r;
} //
Line 863 ⟶ 932:
// mw.config.get()
// mw.util.getParamValue()
▲ // flip()
// further()
// flip()
// freeze()
// freezer()
Line 871 ⟶ 940:
// facet()
// fresher()
// freshest()
// flat()
// 2014-12-
var linkUpdate;
Env = { skin: false,
wgCanonicalSpecialPageName:
mw.config.get( "wgCanonicalSpecialPageName" )
wgPageName: false
};
if ( Env.wgCanonicalSpecialPageName ) {
switch ( Env.wgCanonicalSpecialPageName ) {
▲ case "Diff" :
▲ flip();
▲ break;
case "Contributions" :
further( 2 );
break;
case "Diff" :
flip();
break;
case "Recentchanges" :
case "Watchlist" :
further( 1 );
Line 928 ⟶ 1,001:
freezer( true );
} // switch wgAction
if ( linkUpdate
fresher( true );
}
if ( facet( "forcerecursivelinkupdate" ) ) {
freshest( true );
}
}
}
|