« MediaWiki:Common.js » : différence entre les versions

De Wiki The-West FR
Aller à la navigation
Aucun résumé des modifications
mAucun résumé des modifications
 
(81 versions intermédiaires par 4 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
if ($('.item_container')[0].hasAttribute("data-popup")) {
// Reset to version 2 mai 2021 à 09:32‎ Hudra - .net changes removed
 
$('.tbbox-logo').wrap('<a href="/wiki/Accueil"></a>');
if ($('.item_container').length!==0) {
    $.getScript("https://wiki.the-west.fr/wiki/Popup.js?action=raw");
     $('.item_container').each(function() {
     $('.item_container').each(function() {
         $(this).append('<img src="' + $(this).attr('data-url') + '">');
         $(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + ($(this).attr('data-cache')?"?"+$(this).attr('data-cache'):"")+'">');
     });
     });
     $('.item_container[data-link]').each(function() {
}
         $(this).find('img').wrap('<a href="' + $(this).attr('data-link') + '"></a>');
$('#navbar a, .set_icon a').removeAttr("title");
$(window).scroll(function() {
    if ($(this).scrollTop() > $("#right_menu").offset().top + $('#right_menu').height() - $( window ).height() + 120) {
        $('#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>');
     });
     });
    $(function() {
}
        $.getScript("https://wiki.the-west.net/wiki/Popup.js?action=raw");
//Configuration du tri des diacritique dans les tables de class "sortable"
    });
mw.config.set( 'tableSorterCollation', {'à':'a', 'â':'a', 'æ':'ae', 'é':'e', 'è':'e', 'ê':'e', 'î':'i', 'ï':'i', 'ô':'o', 'œ':'oe', 'û':'u', 'ç':'c',  } );
 
if ($('#calcLvlLoss').length !== 0) {
} else {
  var context = $('#calcLvlLoss');
 
  var input_character_level = $('<input type="number" style="width:150px;" class="west" placeholder="Niveau" min="0" max="150">').bind("propertychange keyup input paste", function() {
    $(document).mousemove(function(e) {
    if (this.value > 150) {
        if ($('.popup_window:visible').length !== 0) {
      this.value = 150;
            var width;
    } else if (this.value < 0) {
            var height;
      this.value = 0;
            var parent_left = $('.item_container:hover').offset().left;
    }
            var parent_top = $('.item_container:hover').offset().top;
    calcLvlLoss();
            var w = e.pageX;
  }).appendTo(context.find(".character_level"));
            if (e.clientX < ($(window).width()) / 2) {
  var input_duel_level = $('<input type="number" style="width:150px;" class="west" placeholder="Niveau de duel" min="0" max="450">').bind("propertychange keyup input paste", function() {
                width = w + 20 - parent_left;
    if (this.value > 450) {
            } else {
      this.value = 450;
                width = w - 20 - $('.popup_window:visible').outerWidth() - parent_left;
    } else if (this.value < 0) {
            }
      this.value = 0;
            var h = e.pageY;
    }
            var h2 = $('.popup_window:visible').outerHeight();
    calcLvlLoss();
            var h3 = $(window).height();
  }).appendTo(context.find(".duel_level"));
            if (e.clientY < (h3 / 2)) {
  function calcLvlLoss() {
                height = h + 20 - parent_top;
    var duel_lvl = parseInt(input_duel_level.val()),
                if (e.clientY + h2 + 10 > h3) height = h - e.clientY - parent_top + h3 - h2 + 10;
      char_lvl = parseInt(input_character_level.val());
            } else {
    if (isNaN(duel_lvl) || isNaN(char_lvl) || duel_lvl < char_lvl) {
                height = h - h2 - parent_top;
      context.find('.result').html('');
                if (e.clientY - h2 < 10) height = h - e.clientY - parent_top + 10;
    } else {
            }
      var getXp = function(lvl) {
            $('.popup_window:visible').css({
          return Math.ceil(Math.pow((lvl) / 0.1, 1 / 0.6));
                top: height,
        },
                left: width
        getLvl = function(xp, perc) {
            });
          return char_lvl + Math.floor(Math.pow(xp * (perc || 1), 0.6) * 0.1);
        }
        };
    });
      var minXp = getXp(duel_lvl - char_lvl),
    if ($("#input_level").length == 1) {
        maxXp = duel_lvl === 450 ? '' : getXp(duel_lvl + 1 - char_lvl),
        $("#input_level").append('Niveau : ');
        minLvl = getLvl(minXp, 0.9),
        var input_level = $('<input type="number" value="0" min="0" max="150">').bind("propertychange keyup input paste", function() {
        maxLvl = duel_lvl === 450 ? 450 : getLvl(maxXp, 0.9);
            if (this.value > 150) {
      context.find('.result').html('Expérience de duel actuelle : ' + minXp + ' - ' + maxXp + '<br/>Niveau de duel après avoir pris la potion : ' + minLvl + (maxLvl > minLvl ? ' - ' + maxLvl : ''));
                this.value = 150;
            } else if (this.value < 0) {
                this.value = 0;
            }
            $(".calc").each(function() {
                if (input_level.val() == 0) {
                    $(this).html('+' + this.id);
                    $('.per_level_off').addClass('per_level').removeClass('per_level_off');
                } else {
                    $(this).html('+' + Math.ceil(Number(this.id) * input_level.val()));
                    $('.per_level').addClass('per_level_off').removeClass('per_level');
                }
            });
        }).appendTo($("#input_level"));
     }
     }
 
  }
}
}


if ($('#navbar').length !== 0) {
//Navigation bar change
    $('#navbar a').removeAttr("title");
(function($) {
}
    $(document).ready(function() {
        var $navigationDummy = $("<div>", {
            id: "navigationDummy",
            html: ""
        });
        $navigationDummy.insertBefore("#mw-navigation");
        var elementToMove = $("#module-site-navigation").detach();
        elementToMove.appendTo($navigationDummy);
    });
})(jQuery);

Dernière version du 14 août 2023 à 22:53

// Reset to version 2 mai 2021 à 09:32‎ Hudra - .net changes removed

$('.tbbox-logo').wrap('<a href="/wiki/Accueil"></a>');
if ($('.item_container').length!==0) {
    $.getScript("https://wiki.the-west.fr/wiki/Popup.js?action=raw");
    $('.item_container').each(function() {
        $(this).append('<img src="https://westzz.innogamescdn.com/images/items/' + $(this).attr('data-url') + ($(this).attr('data-cache')?"?"+$(this).attr('data-cache'):"")+'">');
    });
} 
$('#navbar a, .set_icon a').removeAttr("title");
$(window).scroll(function() {
    if ($(this).scrollTop() > $("#right_menu").offset().top + $('#right_menu').height() - $( window ).height() + 120) {
        $('#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>');
    });
}
//Configuration du tri des diacritique dans les tables de class "sortable"
mw.config.set( 'tableSorterCollation', {'à':'a', 'â':'a', 'æ':'ae', 'é':'e', 'è':'e', 'ê':'e', 'î':'i', 'ï':'i', 'ô':'o', 'œ':'oe', 'û':'u', 'ç':'c',  } );
if ($('#calcLvlLoss').length !== 0) {
  var context = $('#calcLvlLoss');
  var input_character_level = $('<input type="number" style="width:150px;" class="west" placeholder="Niveau" min="0" max="150">').bind("propertychange keyup input paste", function() {
    if (this.value > 150) {
      this.value = 150;
    } else if (this.value < 0) {
      this.value = 0;
    }
    calcLvlLoss();
  }).appendTo(context.find(".character_level"));
  var input_duel_level = $('<input type="number" style="width:150px;" class="west" placeholder="Niveau de duel" min="0" max="450">').bind("propertychange keyup input paste", function() {
    if (this.value > 450) {
      this.value = 450;
    } else if (this.value < 0) {
      this.value = 0;
    }
    calcLvlLoss();
  }).appendTo(context.find(".duel_level"));
  function calcLvlLoss() {
    var duel_lvl = parseInt(input_duel_level.val()),
      char_lvl = parseInt(input_character_level.val());
    if (isNaN(duel_lvl) || isNaN(char_lvl) || duel_lvl < char_lvl) {
      context.find('.result').html('');
    } else {
      var getXp = function(lvl) {
          return Math.ceil(Math.pow((lvl) / 0.1, 1 / 0.6));
        },
        getLvl = function(xp, perc) {
          return char_lvl + Math.floor(Math.pow(xp * (perc || 1), 0.6) * 0.1);
        };
      var minXp = getXp(duel_lvl - char_lvl),
        maxXp = duel_lvl === 450 ? '∞' : getXp(duel_lvl + 1 - char_lvl),
        minLvl = getLvl(minXp, 0.9),
        maxLvl = duel_lvl === 450 ? 450 : getLvl(maxXp, 0.9);
      context.find('.result').html('Expérience de duel actuelle : ' + minXp + ' - ' + maxXp + '<br/>Niveau de duel après avoir pris la potion : ' + minLvl + (maxLvl > minLvl ? ' - ' + maxLvl : ''));
    }
  }
}

//Navigation bar change
(function($) {
    $(document).ready(function() {
        var $navigationDummy = $("<div>", {
            id: "navigationDummy",
            html: ""
        });
        $navigationDummy.insertBefore("#mw-navigation");
        var elementToMove = $("#module-site-navigation").detach();
        elementToMove.appendTo($navigationDummy);
    });
})(jQuery);