MediaWiki:Common.js: Forskelle mellem versioner

Fra Wiki The-West DK
Hop til navigation
(Oprettede siden med "→‎Any JavaScript here will be loaded for all users on every page load.: // Old Global.js. // Rewrite of announcement display. $ (function () { // Changes the announce...")
 
No edit summary
Linje 1: Linje 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
// Old Global.js.
$('.tbbox-logo').wrap('<a href="/wiki/Main_Page"></a>');
// Rewrite of announcement display.
if ($('.item_container').length!==0) {
$ (function () {
    $('.item_container').each(function() {
    // Changes the announcement to the next announcement in the list.
        $(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + '?1">');
     function changeAnnouncement () {
    });
        $ (announcementList [currentAnnouncement]).fadeOut ("normal", function () {
     $.getScript("https://wiki.the-west.net/wiki/Popup.js?action=raw");
            ++currentAnnouncement;
}
            if (currentAnnouncement >= announcementList.length)
 
                currentAnnouncement = 0;
$(window).scroll(function() {
            $ (announcementList [currentAnnouncement]).fadeIn ();
    if ($(this).scrollTop() > 300) {
         });
        $('#back-top').fadeIn();
    } else {
         $('#back-top').fadeOut();
     }
     }
    var announcementList = $ (".announcement");
    var currentAnnouncement = 0;
    var announcementVisibilityTime = 10000; // ms
    announcementList.hide ();
    if (announcementList.length > 1) {
        $ (announcementList [0]).fadeIn ();
        setInterval (changeAnnouncement, announcementVisibilityTime);
    } else if (announcementList.length > 0)
        announcementList.fadeIn ();
    // Piwik is undefined -> comment it out.
    /*
    try {
        var piwikTracker = Piwik.getTracker (pkBaseURL + "piwik.php", 2);
        piwikTracker.trackPageView ();
        piwikTracker.enableLinkTracking ();
    } catch (err) {}
    */
});
});
// 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>');
    });
}

Versionen fra 15. mar. 2021, 19:14

/* Any JavaScript here will be loaded for all users on every page load. */
$('.tbbox-logo').wrap('<a href="/wiki/Main_Page"></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("https://wiki.the-west.net/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>');
    });
}