MediaWiki:Gadget-RailModule.js: Różnice pomiędzy wersjami
Z Nonsensopedii, polskiej encyklopedii humoru
Ostrzyciel (dyskusja • edycje) (przemeblowańsko, optymalizowańsko, dodawańsko ficzerów) |
Ostrzyciel (dyskusja • edycje) M |
||
Linia 1: | Linia 1: | ||
/** |
/** |
||
* Magia dodająca bajery do stopki |
* Magia dodająca bajery do stopki w trybie mobilnym. |
||
* |
* |
||
* Autorzy: [[User:Ostrzyciel]], [[User:Polskacafe]] |
* Autorzy: [[User:Ostrzyciel]], [[User:Polskacafe]] |
||
Linia 6: | Linia 6: | ||
jQuery( document ).ready( function () { |
jQuery( document ).ready( function () { |
||
⚫ | |||
⚫ | |||
var |
var catlinks = $( '#catlinks' ); |
||
⚫ | |||
const railDiv = '<div class="post-content footer-railmodule-content" style="margin-top: 22px;"><div class="railmodule-container"><div class="ra-railmodule noprint"></div></div></div>'; |
const railDiv = '<div class="post-content footer-railmodule-content" style="margin-top: 22px;"><div class="railmodule-container"><div class="ra-railmodule noprint"></div></div></div>'; |
||
⚫ | |||
// nie wszędzie to jest -- patrz strony specjalne etc |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
ratingstars.after( railDiv ); |
|||
} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
) { |
|||
⚫ | |||
toInsert = '<a href="' + href + '" id="bottom-edit-button"> \ |
|||
<div>Edytuj tę stronę</div> \ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} else { |
} else { |
||
afterContent.before( toInsert ); |
|||
} |
} |
||
⚫ | |||
⚫ | |||
⚫ | |||
toInsert = '<a href="' + href + '" style="display: block;background-color: #ffed90;text-align: center;border-bottom: solid 1px #c8ccd1;padding-top: 0.625em;padding-bottom: 0.625em;font-size: 1.1em;font-weight: bold;color: #54595d;"> \ |
|||
<div style="line-height: 1em;"> \ |
|||
<span class="mw-ui-icon mw-ui-icon-small mw-ui-icon-minerva-edit-enabled edit-page" style="margin-right: 0.25em;vertical-align: top;"></span>Edytuj tę stronę \ |
|||
</div> \ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
} |
||
// wypełnij railmodule |
// wypełnij railmodule |
||
footerContent.css( 'margin-top', '0px' ); |
|||
$.ajax( { |
$.ajax( { |
||
url: 'https://nonsa.pl/wiki/MediaWiki:RailModule?action=render', |
url: 'https://nonsa.pl/wiki/MediaWiki:RailModule?action=render', |
Wersja z 19:43, 20 cze 2020
/**
* 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 class="railmodule-container"><div class="ra-railmodule noprint"></div></div></div>';
// railmodule -- czywiesze i te sprawy
var ratingstars = $( '.footer-ratingstars' );
if ( !ratingstars.length ) {
afterContent.prepend( railDiv );
} else {
ratingstars.after( railDiv );
}
// przycisk edycji
if ( mw.config.get( 'wgAction' ) === 'view' &&
mw.config.get( 'wgIsProbablyEditable' )
) {
href = 'https://nonsa.pl/wiki/' + mw.Uri.encode( mw.config.get( 'wgPageName' ) ) + '?action=edit';
toInsert = '<a href="' + href + '" id="bottom-edit-button"> \
<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.ra-railmodule' ).prepend( data );
}
} );
}() );