MediaWiki:Gadget-RailModule.js: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
Polskacafe (dyskusja • edycje) (nowa strona) |
Ostrzyciel (dyskusja • edycje) M (keksperyment) |
||
(Nie pokazano 11 wersji utworzonych przez 2 użytkowników) | |||
Linia 1: | Linia 1: | ||
/** |
|||
function doStuff() { |
|||
* Magia dodająca bajery do stopki w trybie mobilnym. |
|||
if ($('.last-modified-bar').length !== 0) { // nie wszędzie to jest -- patrz strony specjalne etc |
|||
* |
|||
⚫ | |||
* Autorzy: [[User:Ostrzyciel]], [[User:Polskacafe]] |
|||
**/ |
|||
⚫ | |||
var afterContent = $( '#mw-data-after-content' ); |
|||
var catlinks = $( '#catlinks' ); |
|||
⚫ | |||
// railmodule -- czywiesze i te sprawy |
|||
var ratingstars = $( '.footer-ratingstars' ); |
|||
if ( !ratingstars.length ) { |
|||
afterContent.prepend( railDiv ); |
|||
} else { |
} else { |
||
ratingstars.after( railDiv ); |
|||
$('.footer-content').before('<div class="post-content footer-railmodule-content" style="margin-top: 22px;"><div class="railmodule-container"><div class="ra-railmodule noprint"></div></div></div>'); |
|||
} |
} |
||
$('.footer-content').css('margin-top', '0px'); |
|||
// przycisk edycji -- tylko na Timelessie |
|||
$.ajax({ |
|||
if ( mw.config.get( 'skin' ) === 'timeless' && |
|||
url:'https://nonsa.pl/wiki/MediaWiki:RailModule?action=render', |
|||
mw.config.get( 'wgAction' ) === 'view' && |
|||
type:'GET', |
|||
mw.config.get( 'wgIsProbablyEditable' ) |
|||
success: function(data){ |
|||
) { |
|||
$('div.ra-railmodule').prepend(data); |
|||
var href = 'https://nonsa.pl/wiki/' + mw.Uri.encode( mw.config.get( 'wgPageName' ) ); |
|||
} |
|||
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 z preloada podanego przez serwer |
|||
// vide rozszerzenie ConfigHacks |
|||
var railContent = $('#railmodule-preload'); |
|||
if ( railContent.length ) { |
|||
railContent.children().appendTo( 'div.footer-railmodule-content' ); |
|||
⚫ | |||
}() ); |
Aktualna wersja na dzień 18:56, 13 maj 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' ) );
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 z preloada podanego przez serwer
// vide rozszerzenie ConfigHacks
var railContent = $('#railmodule-preload');
if ( railContent.length ) {
railContent.children().appendTo( 'div.footer-railmodule-content' );
}
}() );