MediaWiki:Gadget-RailModule.js: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
Ostrzyciel (dyskusja • edycje) M (dwa przyciski zależnie od szer. ekranu) |
Ostrzyciel (dyskusja • edycje) M Znacznik: zrewertowane |
||
Linia 22: | Linia 22: | ||
mw.config.get( 'wgAction' ) === 'view' && |
mw.config.get( 'wgAction' ) === 'view' && |
||
mw.config.get( 'wgIsProbablyEditable' ) |
mw.config.get( 'wgIsProbablyEditable' ) |
||
) { |
|||
var href = 'https://nonsa.pl/wiki/' + mw.Uri.encode( mw.config.get( 'wgPageName' ) ); |
var href = 'https://nonsa.pl/wiki/' + mw.Uri.encode( mw.config.get( 'wgPageName' ) ); |
||
⚫ | |||
// jeśli jest załadowany MobileFrontend... |
|||
⚫ | |||
if ( mw.config.get( 'wgMFMode' ) !== null || |
|||
⚫ | |||
// ...albo na tej stronie nie działa VE... |
|||
⚫ | |||
$(document.documentElement).hasClass('ve-not-available') |
|||
⚫ | |||
) { |
|||
// wygeneruj jeden przycisk |
|||
var toInsert = '<a href="' + href + '?action=edit' + '" class="bottom-edit-button"> \ |
|||
⚫ | |||
⚫ | |||
} else { |
|||
// w przeciwnym razie dwa przyciski |
|||
⚫ | |||
⚫ | |||
⚫ | |||
<div>Edytuj tę stronę</div> \ |
|||
</a>'; |
|||
} |
|||
if ( catlinks.length === 1 ) { |
if ( catlinks.length === 1 ) { |
Wersja z 18:56, 17 mar 2022
/**
* Magia dodająca bajery do stopki w trybie mobilnym.
*
* Autorzy: [[User:Ostrzyciel]], [[User:Polskacafe]]
**/
jQuery( document ).ready( function () {
var afterContent = $( '#mw-data-after-content' );
var catlinks = $( '#catlinks' );
const railDiv = '<div class="post-content footer-railmodule-content" style="margin-top: 22px;"></div>';
// railmodule -- czywiesze i te sprawy
var ratingstars = $( '.footer-ratingstars' );
if ( !ratingstars.length ) {
afterContent.prepend( railDiv );
} else {
ratingstars.after( railDiv );
}
// przycisk edycji -- tylko na Timelessie
if ( mw.config.get( 'skin' ) === 'timeless' &&
mw.config.get( 'wgAction' ) === 'view' &&
mw.config.get( 'wgIsProbablyEditable' )
) {
var href = 'https://nonsa.pl/wiki/' + mw.Uri.encode( mw.config.get( 'wgPageName' ) );
// jeśli jest załadowany MobileFrontend...
if ( mw.config.get( 'wgMFMode' ) !== null ||
// ...albo na tej stronie nie działa VE...
$(document.documentElement).hasClass('ve-not-available')
) {
// wygeneruj jeden przycisk
var toInsert = '<a href="' + href + '?action=edit' + '" class="bottom-edit-button"> \
<div>Edytuj tę stronę</div> \
</a>';
} else {
// w przeciwnym razie dwa przyciski
var toInsert = '<a href="' + href + '?action=edit' + '" class="bottom-edit-button bottom-edit-button-source"> \
<div>Edytuj tę stronę</div> \
</a><a href="' + href + '?veaction=edit' + '" class="bottom-edit-button bottom-edit-button-ve"> \
<div>Edytuj tę stronę</div> \
</a>';
}
if ( catlinks.length === 1 ) {
catlinks.after( toInsert );
} else {
afterContent.before( toInsert );
}
}
// wypełnij railmodule
$.ajax( {
url: 'https://nonsa.pl/wiki/MediaWiki:RailModule?action=render',
type: 'GET',
success: function ( data ) {
$( 'div.footer-railmodule-content' ).prepend( data );
}
} );
}() );