MediaWiki:Common.js: Skillnad mellan sidversioner

Från Wiki The-West SE
Hoppa till navigering
(fr, test)
 
Ingen redigeringssammanfattning
 
(3 mellanliggande sidversioner av en annan användare visas inte)
Rad 1: Rad 1:
/* JavaScript som skrivs här körs varje gång en användare laddar en sida. */
/* Any JavaScript here will be loaded for all users on every page load. */
/* Test Popup */
$('.tbbox-logo').wrap('<a href="/wiki/Huvudsida"></a>');
$(document).mousemove(function(e){
if ($('.item_container').length!==0) {
if ($('.popup_window:visible').length!==0){
    $('.item_container').each(function() {
var width;
        $(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + '?1">');
var height;
    });
var parent_left = $('.item_container:hover').offset().left;
    $.getScript("/wiki/Popup.js?action=raw");
var parent_top = $('.item_container:hover').offset().top;
}
var w = e.pageX;
 
if (e.clientX < ($(window).width())/2){
$(window).scroll(function() {
width = w + 20 - parent_left;
    if ($(this).scrollTop() > 300) {
} else {
        $('#back-top').fadeIn();
width = w - 20 - $('.popup_window:visible').outerWidth() - parent_left;
    } else {
}
        $('#back-top').fadeOut();
var h = e.pageY;
    }
var h2 = $('.popup_window:visible').outerHeight();
var h3 =$(window).height();
if (e.clientY < (h3/2)){
height = h + 20 - parent_top;
if (e.clientY + h2 +10 > h3) height = h - e.clientY - parent_top + h3 - h2 + 10;
} else {
height = h - h2 - parent_top;
if (e.clientY - h2 < 10) height = h - e.clientY - parent_top + 10;
}
$('.popup_window:visible').css({top: height, left: width});
}
});
});
// Scroll body to top on click
$('#back-top a').click(function() {
    $('body,html').animate({
        scrollTop: 0
    }, 800);
    return false;
});
// Embed youtube videos
if ($('.youtube_video').length !== 0) {
    $('.youtube_video').each(function() {
        $(this).html('<iframe width="100%" height="100%" src="https://www.youtube.com/embed/' + $(this).attr('data-id') + '?cc_load_policy=1&cc_lang_pref=' + $(this).attr('data-subtitles') + '" frameborder="0" allowfullscreen></iframe>');
    });
}

Nuvarande version från 12 juli 2021 kl. 19.30

/* Any JavaScript here will be loaded for all users on every page load. */
$('.tbbox-logo').wrap('<a href="/wiki/Huvudsida"></a>');
if ($('.item_container').length!==0) {
    $('.item_container').each(function() {
        $(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + '?1">');
    });
    $.getScript("/wiki/Popup.js?action=raw");
}

$(window).scroll(function() {
    if ($(this).scrollTop() > 300) {
        $('#back-top').fadeIn();
    } else {
        $('#back-top').fadeOut();
    }
});
// Scroll body to top on click
$('#back-top a').click(function() {
    $('body,html').animate({
        scrollTop: 0
    }, 800);
    return false;
});
// Embed youtube videos
if ($('.youtube_video').length !== 0) {
    $('.youtube_video').each(function() {
        $(this).html('<iframe width="100%" height="100%" src="https://www.youtube.com/embed/' + $(this).attr('data-id') + '?cc_load_policy=1&cc_lang_pref=' + $(this).attr('data-subtitles') + '" frameborder="0" allowfullscreen></iframe>');
    });
}