Մասնակից:ԱշոտՏՆՂ/sidebarRelated.js
Ծանուցում. Հիշելուց հետո կատարված փոփոխությունները տեսնելու համար մաքրեք ձեր զննարկիչի հիշապահեստը. Mozilla / Firefox / Safari՝ Ctrl+Shift+R (Cmd+Shift+R Mac OS X-ում) Konqueror՝ F5 Opera՝ Tools→Preferences ընտրացանկից։ Internet Explorer՝ Ctrl+F5
//from https://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-sidebarRelated.js&oldid=88213798
const addOtherProjects = function() {
const $pLang = $( '#p-lang' );
if ( !$pLang.length ||
mw.config.get( 'wgAction' ) !== 'view' ||
mw.config.get( 'wgNamespaceNumber' ) % 2 ||
mw.config.get( 'wgWikibaseItemId' ) === null
) {
return;
}
const initMove = function( $el, $list ) {
const $pOtherLink = $( '#t-wikibase' ).clone()
.addClass( 'wb-otherproject-link' )
.css( 'display', 'list-item' )
.removeAttr( 'id' )
.appendTo( $list );
$( '#t-wikibase' ).remove();
$pOtherLink.attr( 'id', 't-wikibase' );
if ( $list.children().length ) {
$el.insertBefore( $pLang );
}
}
const moveWikidataElementLink = function() {
var $pPrintExport = $( '#p-coll-print_export' );
$pOther = $pPrintExport.clone().attr( 'id', 'p-wikibase-otherprojects' );
var $pOtherLabel = $pOther.find( 'h3' );
$pOtherList = $pOther.find( 'ul' ).empty();
$pOtherLabel.text( mw.msg( 'wikibase-otherprojects' ) );
if ( cfSkin === 'vector' ) {
$pOther.attr( 'aria-labelledby', 'p-wikibase-otherprojects-label' );
$pOtherLabel.attr( 'id', 'p-wikibase-otherprojects-label' );
}
initMove( $pOther, $pOtherList );
}
const $pOther = $( '#p-wikibase-otherprojects' );
const $pOtherList = $pOther.find( 'ul' );
const cfSkin = mw.config.get( 'skin' );
if ( $pOther.length ) {
initMove( $pOther, $pOtherList );
} else {
if ( mw.config.get( 'wgUserLanguage' ) === 'hy' ) {
mw.messages.set( 'wikibase-otherprojects', 'Այլ նախագծերում' );
moveWikidataElementLink();
} else {
$.when( mw.loader.using( [ 'mediawiki.api.messages' ] ) )
.then( function () {
return new mw.Api().loadMessagesIfMissing( [
'wikibase-otherprojects'
] );
} )
.then( moveWikidataElementLink );
}
}
}
addOtherProjects();