MediaWiki:Common.js: Difference between revisions

1,198 bytes added ,  15:07, 26 October 2023
no edit summary
No edit summary
No edit summary
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
$( function(){
$( function(){
if (window.matchMedia("(max-width: 768px)").matches) {
if( mw.config.get("skin") !== "minerva" ){
const currWikiUrl = new URL(window.location.href);
currWikiUrl.searchParams.set('mobileaction', 'toggle_view_mobile');
window.location.replace(currWikiUrl);
}
} else {
if(  mw.config.get("skin") !== "vector" ){
const currWikiUrl = new URL(window.location.href);
currWikiUrl.searchParams.set('mobileaction', 'toggle_view_desktop');
window.location.replace(currWikiUrl);
}
}
if( mw.config.get('wgIsMainPage') ){
if( mw.config.get('wgIsMainPage') ){
$('#firstHeading').remove();
$('#firstHeading').remove();
Line 40: Line 56:
mw.loader.load( '/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript');
mw.loader.load( '/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript');
mw.loader.load( '/index.php?title=MediaWiki:PoemButtons.js&action=raw&ctype=text/javascript');
}
if( $(".wikiaudioplayer").length ){
mw.loader.load( '/index.php?title=MediaWiki:Green-audio-player.min.css&action=raw&ctype=text/css', 'text/css');
$.when(
    mw.loader.getScript( 'https://wiki.ekatrafoundation.org/index.php?title=MediaWiki:Green-audio-player.min.js&action=raw&ctype=text/javascript' )
)
.then(
    function () {
GreenAudioPlayer.init({
    selector: '.wikiaudioplayer',
    stopOthersOnPlay: true
});
$( ".wikiaudioplayer > audio").css("display", "none");
    },
    function ( e ) {
        mw.log.error( e.message );
    }
);
}
}