🌟現在、鉄壁 鉄壁ヘッドショットには対応済みです。
鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。

「MediaWiki:Common.js」の版間の差分

提供:Apex Data
ナビゲーションに移動 検索に移動
(スクロール位置によってポップアップの調整を調整する機能の実装)
(クラスrow-stickyが見つからない場合、監視処理を追加しない)
 
(同じ利用者による、間の9版が非表示)
13行目: 13行目:
.css('left', Math.min(
.css('left', Math.min(
$(window).width() - tooltip.outerWidth(),
$(window).width() - tooltip.outerWidth(),
Math.round(offset.left - 0.5 * (tooltip.outerWidth() - obj.outerWidth()))))
Math.max(
0,
Math.round(offset.left - 0.5 * (tooltip.outerWidth() - obj.outerWidth())))))
.css('top', y)
.css('top', y)
}
}
24行目: 26行目:


function showTooltip(e) {
function showTooltip(e) {
var escaped = $(this).data('tooltip')
var escaped = $(this).attr('data-tooltip')
var html = unescapeHtml(escaped)
var html = unescapeHtml(escaped)
tooltip
tooltip
38行目: 40行目:
}
}


function updateWidth(classname) {
var targetSelectors = [
'tr:first th:nth-child(1), tr:first td:nth-child(1)',
'tr:first th:nth-child(2), tr:first td:nth-child(2)',
]
// Reset the max width of each column in each table.
$("." + classname).each(function(index, elem) {
$.each(targetSelectors, function(_, target) {
$(elem).find(target).first().width('')
})
})
// Find the max width of each column across all tables.
var colWidths = new Array(targetSelectors.length).fill(0)
$("." + classname).each(function(index, elem) {
$.each(targetSelectors, function(idx, target) {
colWidths[idx] = Math.max(
colWidths[idx],
Math.ceil($(elem).find(target).first().width()))
})
})
// Set each column in each table to the max width of that column across all tables.
$("." + classname).each(function(index, elem) {
$.each(targetSelectors, function(idx, target) {
$(elem).find(target).first().width(colWidths[idx])
})
})
}
function observeRowStickyStuckState(classname) {
var target = document.querySelector('.' + classname)
if (target === null) return
if (typeof IntersectionObserver === 'function') {
var stuckClassname = classname + '--stuck'
new IntersectionObserver(function(entries) {
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i]
if (!entry.isIntersecting) {
entry.target.classList.add(stuckClassname)
} else {
entry.target.classList.remove(stuckClassname)
}
}
}, { threshold: 1 }).observe(target)
}
}
var targetClassname = 'damagetable'
$(window).resize(updateWidth.bind(null, targetClassname));
$(function(){
$(function(){
tooltip = $("<div>", { id: 'tooltip' }).appendTo('body');
tooltip = $("<div>", { id: 'tooltip' }).appendTo('body');
43行目: 98行目:
.mouseenter(showTooltip)
.mouseenter(showTooltip)
.mouseleave(hideTooltip);
.mouseleave(hideTooltip);
updateWidth(targetClassname);
observeRowStickyStuckState('row-sticky');
});
});

2022年6月5日 (日) 10:59時点における最新版

/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
var tooltip

function updatePosition(e) {
	var obj = $(e.currentTarget)
	var offset = obj.offset()
	var y = offset.top + obj.outerHeight()
	var maxY = $(window).scrollTop() + $(window).height() - $('#tooltip').outerHeight()
	if (y > maxY) {
		y = offset.top - obj.outerHeight()
	}
	tooltip
		.css('left', Math.min(
			$(window).width() - tooltip.outerWidth(),
			Math.max(
				0,
				Math.round(offset.left - 0.5 * (tooltip.outerWidth() - obj.outerWidth())))))
		.css('top', y)
}

function unescapeHtml(html) {
	return html
		.replace(/&quot;/g, '"')
		.replace(/&amp;/g, '&')
}

function showTooltip(e) {
	var escaped = $(this).attr('data-tooltip')
	var html = unescapeHtml(escaped)
	tooltip
		.css('display', 'block')
		.html(html)
	updatePosition(e)
	$(this).mousemove(updatePosition)
}

function hideTooltip(e) {
	tooltip.css('display', '')
	$(this).off('mousemove')
}

function updateWidth(classname) {
	var targetSelectors = [
		'tr:first th:nth-child(1), tr:first td:nth-child(1)',
		'tr:first th:nth-child(2), tr:first td:nth-child(2)',
	]
	
	// Reset the max width of each column in each table.
	$("." + classname).each(function(index, elem) {
		$.each(targetSelectors, function(_, target) {
			$(elem).find(target).first().width('')
		})
	})
	
	// Find the max width of each column across all tables.
	var colWidths = new Array(targetSelectors.length).fill(0)
	$("." + classname).each(function(index, elem) {
		$.each(targetSelectors, function(idx, target) {
			colWidths[idx] = Math.max(
				colWidths[idx],
				Math.ceil($(elem).find(target).first().width()))
		})
	})
	
	// Set each column in each table to the max width of that column across all tables.
	$("." + classname).each(function(index, elem) {
		$.each(targetSelectors, function(idx, target) {
			$(elem).find(target).first().width(colWidths[idx])
		})
	})
}

function observeRowStickyStuckState(classname) {
	var target = document.querySelector('.' + classname)
	if (target === null) return
	
	if (typeof IntersectionObserver === 'function') {
		var stuckClassname = classname + '--stuck'
		new IntersectionObserver(function(entries) {
			for (var i = 0; i < entries.length; ++i) {
				var entry = entries[i]
				if (!entry.isIntersecting) {
					entry.target.classList.add(stuckClassname)
				} else {
					entry.target.classList.remove(stuckClassname)
				}
			}
		}, { threshold: 1 }).observe(target)
	}
}


var targetClassname = 'damagetable'
$(window).resize(updateWidth.bind(null, targetClassname));
$(function(){
	tooltip = $("<div>", { id: 'tooltip' }).appendTo('body');
	$('[data-tooltip]')
		.mouseenter(showTooltip)
		.mouseleave(hideTooltip);
	updateWidth(targetClassname);
	observeRowStickyStuckState('row-sticky');
});