MediaWiki-ни ырытыы:Common.js
Give search results even when page doesn't exist[биики-тиэкиһи уларытыы]
Hello, I propose to enable the tool created by Magnus Manske (creator of MediaWiki) to provide results from other languages and Commons (via Wikidata) when a page doesn't exist here: links are added to Special:Search and noarticletext. This helps to encourage translation and to make readers use your wiki more, because they can be sure to find something even if it's not local (rather than searching directly on the biggest wiki). The Italian and Polish Wikipedias, among others already enabled it by default.
Examples: [1] [2] [3]. More information: Magnus blog.
How to: just add the following line at the end of Common.js.
// Results from Wikidata // if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search' || ( mw.config.get( 'wgArticleId' ) === 0 && mw.config.get( 'wgCanonicalSpecialPageName' ) === false ) ) { importScriptURI("//en.wikipedia.org/w/index.php?title=MediaWiki:Wdsearch.js&action=raw&ctype=text/javascript"); } --Nemo 23:02, 17 Тохсунньу 2017 (UTC) (comments, translations and last instructions)
mw.util.$content[биики-тиэкиһи уларытыы]
Добрый день, Тут надо кое-что поправить. Функцию editZeroSection переписать так:
function editZeroSection() {
if ( !mw.config.get( 'wgArticleId' ) ) {
return;
}
mw.loader.using( [ 'mediawiki.util', 'mediawiki.page.startup' ], function () {
mw.util.$content.find( 'h2' )
.children( '.mw-editsection:first' )
.clone().prependTo( '#bodyContent' )
.css( 'float', 'right' )
.find( 'a' )
.each( function( index ) {
$( this ).attr( 'title', zeroSectionTip );
if ( $( this ).attr( 'class' ) === 'mw-editsection-visualeditor' ) {
$( this ).attr( 'href', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&veaction=edit&vesection=0' );
} else {
$( this ).attr( 'href', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&action=edit§ion=0' );
}
} );
} );
}
--Амир Э. Аһарони (ырытыы) 23:05, 17 Тохсунньу 2017 (UTC) :Ещё кое-что надо поправить в той же функции:
function editZeroSection() {
if ( !mw.config.get( 'wgArticleId' ) ) {
return;
}
mw.loader.using( [ 'mediawiki.util', 'mediawiki.page.startup' ], function () {
if ( mw.util.$content === null ) {
return;
}
mw.util.$content.find( 'h2' )
.children( '.mw-editsection:first' )
.clone().prependTo( '#bodyContent' )
.css( 'float', 'right' )
.find( 'a' )
.each( function( index ) {
$( this ).attr( 'title', zeroSectionTip );
if ( $( this ).attr( 'class' ) === 'mw-editsection-visualeditor' ) {
$( this ).attr( 'href', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&veaction=edit&vesection=0' );
} else {
$( this ).attr( 'href', mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) ) + '&action=edit§ion=0' );
}
} );
} );
}
:Спасибо. --Амир Э. Аһарони (ырытыы) 16:04, 18 Тохсунньу 2017 (UTC) ::Огромное спасибо, Амир! Все заработало! --HalanTul (ырытыы) 08:26, 19 Тохсунньу 2017 (UTC)