/* MultiWiki: On this page there is functionality for specific pages. See detailed documentation in Dev/mediawiki deferrable:YES -- It comes later in the rendering process anyways */ (function() { // ============== // Page: Homepage if( $('body').hasClass('page-Homepage') ) { let scrollMargin = 70; // Section Banner // Event : Click on the hero image starts video $( '#hide-overview-image' ).on( 'change', () => $( '.overview-image-and-video-player video' )[0].play() ); // Event : Click on video. Improve player with pause / play on video $( '.overview-image-and-video-player video' ).on( 'click', function() { if( this.paused ) this.play(); else this.pause(); }); // Section Competition $('.section-competition .show-more').on( 'click', function() { $(this).remove(); $('.section-competition .show-for-nojs-only').removeClass('show-for-nojs-only'); }); $('.section-features, .section-values').find('.col-container .card-wrapper').each( function() { // Setup let id = $(this).attr('id'); // Replace a-anchor with div (to make text selectable) let linkReplacement = $('
'); linkReplacement.append( $(this).find( 'a > *' ) ); $(this).children().replaceWith( linkReplacement ); // Add share link to modal let shareButtonForModal = $( `${ window.mwDev.data.app.baseUrl }#${id}` ); $( '#modal-' + id ).append( shareButtonForModal ); shareButtonForModal.codeSelect('init'); // Add attribute to modal to make it react to url hash $( '#modal-' + id ).attr( 'data-url-hash', id ); // When there is a hash corresponding to a card, highlight that card if( $( urlObj.hash ).length ) $( urlObj.hash ).addClass( 'hash-target' ); // Events // If there's no text selection, open modal and change url linkReplacement.on( 'click', function() { let sel = window.getSelection(); if( sel && sel.type != 'None' && ! sel.isCollapsed ) return; $( '#modal-' + id ).miniModal('show'); }); }); // Section Features and Section Values let urlHash = mwDev.tools.hashControl.get(); if( urlHash && urlHash.match( /^explain-/ ) ) { // Open extendable box containing card let collapseContainer = $( urlHash ).parents('.mw-collapsed'); if( collapseContainer.length ) collapseContainer.find('.mw-collapsible-toggle')[0].click(); $('html, body').stop().animate( { 'scrollTop': $( '#' + urlHash ).offset().top - scrollMargin }, 800, 'swing', () => $(window).miniModal('checkForModalsCalledByHash') ); } } // ================== // Page: Dev/wikitest if( $('body').hasClass('page-Dev_wikitest') ) { $(window).miniModal('checkForModalsCalledByHash'); $('#open-mini-modal-test').on( 'click', () => $('#mini-modal-test').miniModal('show') ); } })(); /* [[Category:MultiWiki]] */