|
|
| Строка 112: |
Строка 112: |
| } | | } |
| } ); | | } ); |
|
| |
| // 4. Фикс «Свежих правок»: дата и время не раздуваются
| |
| function shrinkDates( root ) {
| |
| var dates = ( root || document ).querySelectorAll(
| |
| '.mw-changeslist-date, .mw-changeslist-time'
| |
| );
| |
| dates.forEach( function ( el ) {
| |
| el.style.setProperty( 'font-size', '0.8em', 'important' );
| |
| el.style.setProperty( 'white-space', 'nowrap', 'important' );
| |
| el.style.setProperty( 'display', 'inline-block', 'important' );
| |
| } );
| |
| }
| |
|
| |
| if ( body.classList.contains( 'font-large' ) ) {
| |
| // Применяем сразу к тому, что уже есть
| |
| shrinkDates();
| |
|
| |
| // Следим за появлением новых элементов (AJAX-подгрузка)
| |
| var observer = new MutationObserver( function ( mutations ) {
| |
| mutations.forEach( function ( mutation ) {
| |
| mutation.addedNodes.forEach( function ( node ) {
| |
| if ( node.nodeType === 1 ) { // ELEMENT_NODE
| |
| shrinkDates( node );
| |
| }
| |
| } );
| |
| } );
| |
| } );
| |
|
| |
| observer.observe( document.body, {
| |
| childList: true,
| |
| subtree: true
| |
| } );
| |
| }
| |
| }() ); | | }() ); |