MediaWiki:Common.js

Wiki The-West TR sitesinden
Gezintiye git

Not: Yayımladıktan sonra değişiklikleri görmek için tarayıcınızın önbelleğini temizlemeniz gerekebilir.

  • Firefox / Safari: Shift tuşuna basılıyken Yeniden Yükle'ye tıklayın ya da Ctrl-F5 ya da Ctrl-R tıklayın (Mac için ⌘-R).
  • Google Chrome: Ctrl-Shift-R'ye basın. (Mac için ⌘-Shift-R)
  • Internet Explorer / Edge: Ctrl basılıyken Yenile'ye tıklayın ya da Ctrl-F5 yapın.
  • Opera: Ctrl-F5 tıklayın.
/* Buraya konulacak JavaScript kodu sitedeki her kullanıcı için her sayfa yüklendiğinde çalışacaktır */
$(document).ready(function() {
	
    if ($('.item_container').length !== 0) {
        $('.item_container').each(function() {
            $(this).append('<img src="https://westtr.innogamescdn.com/images/items/' + $(this).attr('data-url') + '?1">');
        });
        $.getScript("/wiki/Popup.js?action=raw");
    }
});

$('.tbbox-logo').wrap('<a href="/wiki/Ana_sayfa"></a>');

$(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>');
    });
}
mw.config.set('tableSorterCollation',{'ı':'ç','ö':'ü','ş':'ğ','Ç':'Ş','Ğ':'Ö','Ü':'İ'});

//crafting
if($('.target_input').length){$('.target_input p').each(function(){var id=$(this).attr('id');var phrase=$(this).text();var newInput="<input type='number' name='input_new' value='"+
phrase+"' class='target' max='50000' min='' />";$(this).replaceWith(newInput);});var multiplierValue=1;var currentAmountsArray=[];$('.amount').each(function(index){currentAmountsArray[index]=parseInt($(this).text());});$("input[name='input_new']").on('input paste keyup',function(){this.value>50000?(this.value=50000):this.value<0&&(this.value=0);multiplierValue=this.value;$('.amount').each(function(index){$(this).text(currentAmountsArray[index]*multiplierValue);});$('.craft_extra').show();$('.craft_extra .item_container').each(function(){$(this).children().addClass('OverlayItem');});});}

(function($) {
    $(document).ready(function() {
        var elementToMove = $("#module-site-navigation").detach();
        elementToMove.insertAfter("#mirage-fixed-header");
    });
})(jQuery);

(function($) {
	$(document).ready(function() {
		$('.quickSearchQuest').append('<span class="textfield_wrapper textfield_flex"><span class="textfield_label"></span><span class="textfield"><span><input type="text" id="QsearchBox" placeholder="Quick Search Quest"></span></span></span>');
	});
})(jQuery);



(function($) {
    $(document).ready(function() {
        $('body').append($('<div></div>').load('https://wiki.the-west.org/wiki/Dock.html?action=raw'));
    });
})(jQuery);

(function($) {
    $(document).on('click', '.dock-toggler', function() {
        const dockItems = $('.dock-items-container');
        const toggler = $('.dock-toggler');
        const toggleDockIcon = $('.toggle-dock');

dockItems.toggleClass('toggled');
toggler.toggleClass('toggled');
toggleDockIcon.toggleClass('toggled');
});
})(jQuery);

$(document).ready(function() {
	
	//var currentUrl = window.location.pathname.split('/').pop();
	//
	//if (currentUrl == 'Main_Page') {
	//	$.getScript("/wiki/QuestsCalendar.js?action=raw", function() {
	//		// Script loaded
	//	});	
	//}
	//
	//if (currentUrl == 'Category:Questlines') {
	//	$.getScript("/wiki/Quests.js?action=raw", function() {
	//		// Script loaded
	//	});
	//}

    $('body').append($('<div></div>').load('https://wiki.the-west.org/wiki/Dock.html?action=raw'));

    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");
    }

});


//calculate box - n3mesis
if ($('.calculate_box').length) {
    $.getScript('/wiki/Calculate.js?action=raw');
};