/* This is a custom fork of https://en.wikipedia.org/wiki/User:Enterprisey/diff-permalink */ // <nowiki> $.when( $.ready, mw.loader.using( [ "me
/* This is a custom fork
of https://en.wikipedia.org/wiki/User:Enterprisey/diff-permalink
*/
// <nowiki>
$.when( $.ready, mw.loader.using( [ "mediawiki.util" ] ) ).then( function () {
var suffix = mw.config.get( "wgDiffNewId" );
var page;
if( suffix ) {
if( document.getElementsByClassName( "diff-multi" ).length ||
mw.config.get("wgCanonicalSpecialPageName") === "ComparePages" ) {
suffix = mw.config.get( "wgDiffOldId" ) + "/" + suffix;
}
page = "Special:Diff/" + suffix;
} else {
var oldidMatch = mw.util.getParamValue( "oldid" );
if( oldidMatch ) {
page = "Special:Permalink/" + oldidMatch;
} else return; // nothing to do here
}
var permalinkEl = $( "<div>" ).append(
"Permalink to this " + ( suffix ? "diff" : "oldid" ) + ": ",
$( "<input>" )
.attr( { "id": "diff-permalink-link" } )
.val( '[[' + page + ']]' ),
$( "<button>" )
.text( "Copy" )
.css( { "padding": "0.5em", "cursor": "pointer", "margin-left": "0.5em" } )
.click( function () {
document.getElementById( "diff-permalink-link" ).select();
document.execCommand( "copy" );
} ) );
$( "#diff-permalink-link" ).attr( "size", page.length ); // resize to diff length
if( suffix ) {
$( "#bodyContent" ).prepend( permalinkEl );
} else {
$( "#contentSub" ).after( permalinkEl );
}
} );
// </nowiki>
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.