MediaWiki:Common.js:修订间差异

来自赛尔号精灵图鉴
跳转到导航 跳转到搜索
无编辑摘要
标签已被回退
无编辑摘要
 
(未显示同一用户的14个中间版本)
第1行: 第1行:
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
$(function () {
$(function () {
   // 只在条目页面生效,不影响首页/编辑页等
   const btn = $('<a href="/index.php/首页" id="return-home-button">🏠 返回首页</a>').css({
  if (mw.config.get("wgNamespaceNumber") === 0) {
    position: 'fixed',
    $('<a href="/index.php/首页" id="return-home-button">返回首页</a>')
    bottom: '20px',
      .appendTo('body');
    right: '20px',
  }
    padding: '10px 14px',
});
    background: '#ffffffdd',
 
     color: '#333',
document.addEventListener("DOMContentLoaded", function () {
    fontSize: '14px',
     function calc2() {
    fontWeight: 'bold',
        const level = parseInt(document.getElementsByName("level2")[0].value || 100);
    border: '1px solid #ccc',
        const iv = parseInt(document.getElementsByName("geti")[0].value || 31);
    borderRadius: '8px',
        const evs = document.getElementsByName("nvli2");
    textDecoration: 'none',
        const bases = document.querySelectorAll("._race2");
    boxShadow: '0 2px 6px rgba(0,0,0,0.2)',
        const resultSpans = document.querySelectorAll("._result2");
    zIndex: 9999
        const c2s = document.getElementsByName("_c2");
  });
 
  $('body').append(btn);
        for (let i = 0; i < 6; i++) {
            const base = parseInt(bases[i].textContent || "0");
            const ev = parseInt(evs[i].value || 0);
            const nature = parseFloat(c2s[i]?.value || "1.0");
 
            let stat = 0;
            if (i === 0) {
                stat = Math.floor(((base * 2 + iv + Math.floor(ev / 4)) * level) / 100 + level + 10);
            } else {
                stat = Math.floor((((base * 2 + iv + Math.floor(ev / 4)) * level) / 100 + 5) * nature);
            }
 
            resultSpans[i].textContent = stat;
        }
    }
 
    const inputs = document.querySelectorAll("input, select");
    inputs.forEach(el => el.addEventListener("input", calc2));
    inputs.forEach(el => el.addEventListener("change", calc2));
    calc2();
});
});

2025年5月11日 (日) 13:14的最新版本

$(function () {
  const btn = $('<a href="/index.php/首页" id="return-home-button">🏠 返回首页</a>').css({
    position: 'fixed',
    bottom: '20px',
    right: '20px',
    padding: '10px 14px',
    background: '#ffffffdd',
    color: '#333',
    fontSize: '14px',
    fontWeight: 'bold',
    border: '1px solid #ccc',
    borderRadius: '8px',
    textDecoration: 'none',
    boxShadow: '0 2px 6px rgba(0,0,0,0.2)',
    zIndex: 9999
  });
  $('body').append(btn);
});
👥 当前在线人数:68