Участник:AttemptToCallNil/common.js

mw.loader.load("https://minecraft-ru.gamepedia.com/index.php?title=Участник:AttemptToCallNil/license.js&action=raw&ctype=text/javascript"); // mw.loader.load("https://minecraft-ru.gamepedia.com/index.php?title=Участник:AttemptToCallNil/icons.js&action=raw&ctype=text/javascript"); mw.hook( 'wikipage.content' ).add( function( $wikipageContent ) { /**  * Set minimum height for animations to prevent moving the page if the frames  * differ in height  */ ( function() { // Set frames to be visible for measuring height var $animated = $wikipageContent.find( '.animated2' ).addClass( 'animated2-visible' ); // Group frames per animation var animateds = []; $animated.each( function() { animateds.push( { $: $( this ).find( '> .animated2-subframe' ).addBack() .find( '> *:not(.animated2-subframe)' ), } ); } ); // Get highest frame for each animation (if heights differ) $.each( animateds, function() { var minHeight = 0, differentHeights; this.$.each( function() { var height = this.offsetHeight; differentHeights = differentHeights || minHeight && height !== minHeight; minHeight = Math.max( height, minHeight ); } ); if ( differentHeights ) { this.height = minHeight; } } ); // Set animation to be at least as tall as the tallest frame, // and set the non-active frames to be hidden again $animated.each( function( i ) { $( this ).css( 'min-height', animateds[i].height ); } ).removeClass( 'animated2-visible' ); }() ); } ); $( function() { /**  * Element animator  *  * Cycles through a set of elements (or "frames") on a 2 second timer per frame  * Add the "animated" class to the frame containing the elements to animate.  * Optionally, add the "animated-active" class to the frame to display first.  * Optionally, add the "animated-subframe" class to a frame, and the  * "animated-active" class to a subframe within, in order to designate a set of  * subframes which will only be cycled every time the parent frame is displayed.  * Animations with the "animated-paused" class will be skipped each interval.  *  * Requires some styling from [[MediaWiki:Gadget-site-styles.css]].  */ ( function() { var $content = $( '#mw-content-text' ); var advanceFrame = function( parentElem, parentSelector ) { var curFrame = parentElem.querySelector( parentSelector + ' > .animated2-active' ); $( curFrame ).removeClass( 'animated2-active' ); var $nextFrame = $( curFrame && curFrame.nextElementSibling || parentElem.firstElementChild ); return $nextFrame.addClass( 'animated2-active' ); }; // Set the name of the hidden property var hidden; if ( typeof document.hidden !== 'undefined' ) { hidden = 'hidden'; } else if ( typeof document.msHidden !== 'undefined' ) { hidden = 'msHidden'; } else if ( typeof document.webkitHidden !== 'undefined' ) { hidden = 'webkitHidden'; } setInterval( function() { if ( hidden && document[hidden] ) { return; } $content.find( '.animated2' ).each( function() { if ( $( this ).hasClass( 'animated2-paused' ) ) { return; } var $nextFrame = advanceFrame( this, '.animated2' ); if ( $nextFrame.hasClass( 'animated2-subframe' ) ) { advanceFrame( $nextFrame[0], '.animated2-subframe' ); } } ); }, 2000 ); }() ); } ); $(function() { if (mw.config.get("wgCanonicalNamespace") !== "File") return; var fileLink = $(".fullMedia a:first-child"); var fileHref = fileLink.attr("href"); if (fileHref.includes("?")) { fileHref += "&format=original"; } else { fileHref += "?format=original"; } fileLink.after( " (", $("<a>in the original format</a>") .attr("href", fileHref) .css({ "font-weight": "bold", }), ") " ); }); 
В данной статье используются материалы из статьи «Участник:AttemptToCallNil/common.js» с вики-сайта Minecraft Wiki, расположенного на Фэндоме, и они распространяются согласно лицензии Creative Commons Attribution-NonCommercial-ShareAlike 3.0. Авторы статьи.