| 🌟 | 現在、 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「MediaWiki:Common.js」の版間の差分
ナビゲーションに移動
検索に移動
(showTooltipのmousemoveでエラーが吐いていた不具合の修正) |
(tooltipのコンテンツをHTMLとして表示できるように実装) |
||
| 10行目: | 10行目: | ||
Math.round(offset.left - 0.5 * (tooltip.outerWidth() - obj.outerWidth())))) | Math.round(offset.left - 0.5 * (tooltip.outerWidth() - obj.outerWidth())))) | ||
.css('top', offset.top + obj.outerHeight()) | .css('top', offset.top + obj.outerHeight()) | ||
} | |||
function unescapeHtml(html) { | |||
return html | |||
.replace(///g, '/') | |||
.replace(/'/g, '\'') | |||
.replace(/"/g, '"') | |||
.replace(/>/g, '>') | |||
.replace(/</g, '<') | |||
.replace(/&/g, '&') | |||
} | } | ||
function showTooltip(e) { | function showTooltip(e) { | ||
var escaped = $(this).data('tooltip') | |||
var html = unescapeHtml(escaped) | |||
tooltip | tooltip | ||
.css('display', 'block') | .css('display', 'block') | ||
. | .html(html) | ||
updatePosition(e) | updatePosition(e) | ||
$(this).mousemove(updatePosition) | $(this).mousemove(updatePosition) | ||
2021年2月5日 (金) 11:02時点における版
/* ここにあるすべてのJavaScriptは、すべてのページ読み込みですべての利用者に対して読み込まれます */
var tooltip
function updatePosition(e) {
var obj = $(e.target)
var offset = obj.offset()
tooltip
.css('left', Math.min(
$(window).width() - tooltip.outerWidth(),
Math.round(offset.left - 0.5 * (tooltip.outerWidth() - obj.outerWidth()))))
.css('top', offset.top + obj.outerHeight())
}
function unescapeHtml(html) {
return html
.replace(///g, '/')
.replace(/'/g, '\'')
.replace(/"/g, '"')
.replace(/>/g, '>')
.replace(/</g, '<')
.replace(/&/g, '&')
}
function showTooltip(e) {
var escaped = $(this).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(){
tooltip = $("<div>", { id: 'tooltip' }).appendTo('body');
$('[data-tooltip]')
.mouseenter(showTooltip)
.mouseleave(hideTooltip);
});