Megjegyzés: mentés után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.
- Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R billentyűkombinációt (Mac-en Command–R);
- Google Chrome: használd a Ctrl–Shift–R billentyűkombinációt (Mac-en Command–Shift–R);
- Internet Explorer: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt;
- Opera: ürítsd ki a gyorsítótárat a Beállítások / Haladó / Előzmények→Törlés most gombbal, majd frissítsd az oldalt.
// jshint jquery:true, esversion:5
/* globals require, module, mediaWiki, mw, OO */
'use strict';
mw.hook( 'wikipage.content' ).add( function( $content ) {
var i18n = {
playTitle: 'Click to play',
stopTitle: 'Click to stop',
};
$content.find('.sound' ).prop( 'title', i18n.playTitle ).on( 'click', function( e ) {
// Ignore links
if ( e.target.tagName === 'A' ) {
return;
}
var audio = $( this ).find( '.sound-audio' )[0];
if ( audio ) {
audio.paused ? audio.play() : audio.pause();
}
} ).find( '.sound-audio' ).on( 'play', function() {
// Stop any already playing sounds
var playing = $( '.sound-playing .sound-audio' )[0];
playing && playing.pause();
$( this ).closest( '.sound' )
.addClass( 'sound-playing' ).prop( 'title', i18n.stopTitle );
} ).on( 'pause', function() {
// Reset back to the start
this.currentTime = 0;
$( this ).closest( '.sound' )
.removeClass( 'sound-playing' ).prop( 'title', i18n.playTitle );
} );
} );