|
|
| (未显示同一用户的33个中间版本) |
| 第1行: |
第1行: |
| <!--
| |
| ====================================================================
| |
| 模板名称: 人物信息
| |
| 说明: 用于在MediaWiki页面中展示人物角色信息,支持多图切换、自适应表格
| |
| 使用方法: {{人物信息|参数1=值1|参数2=值2|...}}
| |
| 参数列表:
| |
| - 姓名, 性别, 配音, 能力, 所属势力: 人物基本信息
| |
| - 图片1~图片6: 图片URL (至少填写图片1,最多6张)
| |
| - 标签1~标签6: 对应图片的选项卡标签 (可选,默认显示"图1"~"图6")
| |
| 注意: 需要ParserFunctions扩展支持 (MediaWiki默认安装)
| |
| ====================================================================
| |
| -->
| |
| <includeonly> | | <includeonly> |
| <div class="character-info-wrapper" style="max-width:720px;margin:0 auto;font-family:'Microsoft YaHei','PingFang SC',sans-serif;"> | | <div class="ci-wrapper"> |
| <!-- ========== 样式定义 ========== -->
| | <div class="ci-container"> |
| <style>
| | <!-- 图片切换区域 --> |
| .character-info-wrapper * {
| |
| box-sizing: border-box;
| |
| }
| |
| .character-info-wrapper .ci-container {
| |
| border: 1px solid #e0e0e0;
| |
| border-radius: 12px;
| |
| padding: 20px 24px 24px 24px;
| |
| background: #fafafa;
| |
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
| |
| transition: all 0.2s;
| |
| }
| |
| /* ---- 图片区域 ---- */
| |
| .character-info-wrapper .ci-image-section {
| |
| margin-bottom: 18px;
| |
| }
| |
| .character-info-wrapper .ci-image-tabs {
| |
| display: flex;
| |
| flex-wrap: wrap;
| |
| gap: 8px;
| |
| margin-bottom: 10px;
| |
| }
| |
| .character-info-wrapper .ci-tab-btn {
| |
| padding: 6px 18px;
| |
| border: 1px solid #d0d0d0;
| |
| border-radius: 20px;
| |
| background: #f5f5f5;
| |
| color: #555;
| |
| font-size: 14px;
| |
| cursor: pointer;
| |
| transition: all 0.25s;
| |
| user-select: none;
| |
| font-weight: 500;
| |
| letter-spacing: 0.3px;
| |
| }
| |
| .character-info-wrapper .ci-tab-btn:hover {
| |
| background: #e8e8e8;
| |
| border-color: #b0b0b0;
| |
| }
| |
| .character-info-wrapper .ci-tab-btn.active {
| |
| background: #2c3e50;
| |
| border-color: #2c3e50;
| |
| color: #fff;
| |
| box-shadow: 0 2px 6px rgba(44, 62, 80, 0.25);
| |
| }
| |
| .character-info-wrapper .ci-image-display {
| |
| border: 1px solid #e0e0e0;
| |
| border-radius: 8px;
| |
| overflow: hidden;
| |
| background: #fff;
| |
| min-height: 160px;
| |
| display: flex;
| |
| align-items: center;
| |
| justify-content: center;
| |
| position: relative;
| |
| }
| |
| .character-info-wrapper .ci-image-display .ci-img-item {
| |
| display: none;
| |
| width: 100%;
| |
| text-align: center;
| |
| padding: 8px;
| |
| }
| |
| .character-info-wrapper .ci-image-display .ci-img-item.active {
| |
| display: block;
| |
| }
| |
| .character-info-wrapper .ci-image-display .ci-img-item img {
| |
| max-width: 100%;
| |
| max-height: 420px;
| |
| height: auto;
| |
| border-radius: 4px;
| |
| display: block;
| |
| margin: 0 auto;
| |
| object-fit: contain;
| |
| }
| |
| .character-info-wrapper .ci-image-display .ci-no-image {
| |
| color: #aaa;
| |
| font-size: 15px;
| |
| padding: 30px 0;
| |
| text-align: center;
| |
| letter-spacing: 1px;
| |
| }
| |
| /* ---- 信息表格 ---- */
| |
| .character-info-wrapper .ci-info-table {
| |
| width: 100%;
| |
| border-collapse: collapse;
| |
| border: 1px solid #e0e0e0;
| |
| border-radius: 8px;
| |
| overflow: hidden;
| |
| background: #fff;
| |
| }
| |
| .character-info-wrapper .ci-info-table tr {
| |
| border-bottom: 1px solid #f0f0f0;
| |
| }
| |
| .character-info-wrapper .ci-info-table tr:last-child {
| |
| border-bottom: none;
| |
| }
| |
| .character-info-wrapper .ci-info-table td {
| |
| padding: 12px 16px;
| |
| vertical-align: top;
| |
| line-height: 1.6;
| |
| font-size: 15px;
| |
| word-break: break-word;
| |
| }
| |
| /* 左侧标签列: 占 20% */
| |
| .character-info-wrapper .ci-info-table .ci-label {
| |
| width: 20%;
| |
| min-width: 80px;
| |
| background: #f7f7f7;
| |
| font-weight: 600;
| |
| color: #333;
| |
| letter-spacing: 0.5px;
| |
| border-right: 1px solid #eee;
| |
| text-align: center;
| |
| vertical-align: middle;
| |
| }
| |
| /* 右侧内容列: 占 80% */
| |
| .character-info-wrapper .ci-info-table .ci-value {
| |
| width: 80%;
| |
| color: #222;
| |
| background: #fff;
| |
| }
| |
| /* 空值占位 */
| |
| .character-info-wrapper .ci-info-table .ci-empty {
| |
| color: #bbb;
| |
| font-style: italic;
| |
| }
| |
| /* ---- 响应式 ---- */
| |
| @media (max-width: 600px) {
| |
| .character-info-wrapper .ci-container {
| |
| padding: 14px 12px 18px 12px;
| |
| }
| |
| .character-info-wrapper .ci-info-table td {
| |
| padding: 10px 12px;
| |
| font-size: 14px;
| |
| }
| |
| .character-info-wrapper .ci-info-table .ci-label {
| |
| min-width: 60px;
| |
| font-size: 13px;
| |
| }
| |
| .character-info-wrapper .ci-tab-btn {
| |
| padding: 5px 14px;
| |
| font-size: 13px;
| |
| }
| |
| .character-info-wrapper .ci-image-display .ci-img-item img {
| |
| max-height: 280px;
| |
| }
| |
| }
| |
| @media (max-width: 400px) {
| |
| .character-info-wrapper .ci-info-table td {
| |
| padding: 8px 8px;
| |
| font-size: 13px;
| |
| }
| |
| .character-info-wrapper .ci-info-table .ci-label {
| |
| min-width: 48px;
| |
| font-size: 12px;
| |
| }
| |
| .character-info-wrapper .ci-tab-btn {
| |
| padding: 4px 10px;
| |
| font-size: 12px;
| |
| }
| |
| }
| |
| </style>
| |
| | |
| <!-- ========== HTML 结构 ========== -->
| |
| <div class="ci-container" data-ci-instance="{{#vardefineecho:ci_uid|{{#time:U}}{{#rand:1000|9999}}}}"> | |
| | |
| <!-- ====== 图片区域 ====== --> | |
| <div class="ci-image-section"> | | <div class="ci-image-section"> |
| {{#if:{{{图片1|}}}|
| | <!-- --><div class="ci-image-tabs"><span class="ci-tab-btn" data-ci-index="0">{{{标签1|图1}}}</span><span class="ci-tab-btn" data-ci-index="1">{{{标签2|图2}}}</span><span class="ci-tab-btn" data-ci-index="2">{{{标签3|图3}}}</span></div> |
| <!-- 有图片 → 显示选项卡 + 图片 -->
| | <div class="ci-image-display"> |
| <div class="ci-image-tabs" role="tablist">
| | <div class="ci-img-item" data-ci-index="0">{{{图片1|}}}</div> |
| {{#if:{{{图片1|}}}|<button class="ci-tab-btn active" data-ci-index="0" role="tab">{{{标签1|图1}}}</button>}}
| | <div class="ci-img-item" data-ci-index="1">{{{图片2|}}}</div> |
| {{#if:{{{图片2|}}}|<button class="ci-tab-btn" data-ci-index="1" role="tab">{{{标签2|图2}}}</button>}}
| | <div class="ci-img-item" data-ci-index="2">{{{图片3|}}}</div> |
| {{#if:{{{图片3|}}}|<button class="ci-tab-btn" data-ci-index="2" role="tab">{{{标签3|图3}}}</button>}}
| | <div class="ci-no-image">暂未上传</div> |
| {{#if:{{{图片4|}}}|<button class="ci-tab-btn" data-ci-index="3" role="tab">{{{标签4|图4}}}</button>}}
| | </div> |
| {{#if:{{{图片5|}}}|<button class="ci-tab-btn" data-ci-index="4" role="tab">{{{标签5|图5}}}</button>}}
| | </div><table class="ci-infotemp-table"> |
| {{#if:{{{图片6|}}}|<button class="ci-tab-btn" data-ci-index="5" role="tab">{{{标签6|图6}}}</button>}}
| | {{#if:{{{姓名|}}}|<tr class="ci-row"><td class="ci-label">姓名</td><td class="ci-value">{{{姓名}}}</td></tr>}} |
| </div> | | {{#if:{{{性别|}}}|<tr class="ci-row"><td class="ci-label">性别</td><td class="ci-value">{{{性别}}}</td></tr>}} |
| <div class="ci-image-display">
| | {{#if:{{{中文配音|}}}|<tr class="ci-row"><td class="ci-label">中文配音</td><td class="ci-value">{{{中文配音}}}</td></tr>}} |
| {{#if:{{{图片1|}}}|<div class="ci-img-item active" data-ci-index="0"><img src="{{{图片1}}}" alt="人物图片" loading="lazy" /></div>}}
| | {{#if:{{{日文配音|}}}|<tr class="ci-row"><td class="ci-label">日文配音</td><td class="ci-value">{{{日文配音}}}</td></tr>}} |
| {{#if:{{{图片2|}}}|<div class="ci-img-item" data-ci-index="1"><img src="{{{图片2}}}" alt="人物图片" loading="lazy" /></div>}}
| | {{#if:{{{韩文配音|}}}|<tr class="ci-row"><td class="ci-label">韩文配音</td><td class="ci-value">{{{韩文配音}}}</td></tr>}} |
| {{#if:{{{图片3|}}}|<div class="ci-img-item" data-ci-index="2"><img src="{{{图片3}}}" alt="人物图片" loading="lazy" /></div>}}
| | {{#if:{{{英文配音|}}}|<tr class="ci-row"><td class="ci-label">英文配音</td><td class="ci-value">{{{英文配音}}}</td></tr>}} |
| {{#if:{{{图片4|}}}|<div class="ci-img-item" data-ci-index="3"><img src="{{{图片4}}}" alt="人物图片" loading="lazy" /></div>}}
| | {{#if:{{{属性|}}}|<tr class="ci-row"><td class="ci-label">属性</td><td class="ci-value">{{{属性}}}</td></tr>}} |
| {{#if:{{{图片5|}}}|<div class="ci-img-item" data-ci-index="4"><img src="{{{图片5}}}" alt="人物图片" loading="lazy" /></div>}}
| | {{#if:{{{弧盘|}}}|<tr class="ci-row"><td class="ci-label">弧盘适配</td><td class="ci-value">{{{弧盘}}}</td></tr>}} |
| {{#if:{{{图片6|}}}|<div class="ci-img-item" data-ci-index="5"><img src="{{{图片6}}}" alt="人物图片" loading="lazy" /></div>}}
| | {{#if:{{{定位|}}}|<tr class="ci-row"><td class="ci-label">战斗定位</td><td class="ci-value">{{{定位}}}</td></tr>}} |
| </div>
| | {{#if:{{{版本|}}}|<tr class="ci-row"><td class="ci-label">实装版本</td><td class="ci-value">{{{版本}}}</td></tr>}} |
| | | | {{#if:{{{能力|}}}|<tr class="ci-row"><td class="ci-label">异能</td><td class="ci-value">{{{能力}}}</td></tr>}} |
| <!-- 无图片 → 显示占位 -->
| | {{#if:{{{契约|}}}|<tr class="ci-row"><td class="ci-label">契约</td><td class="ci-value">{{{契约}}}</td></tr>}} |
| <div class="ci-image-display">
| | {{#if:{{{生日|}}}|<tr class="ci-row"><td class="ci-label">生日</td><td class="ci-value">{{{生日}}}</td></tr>}} |
| <div class="ci-no-image">📷 暂无图片</div>
| | {{#if:{{{所属|}}}|<tr class="ci-row"><td class="ci-label">所属</td><td class="ci-value">{{{所属}}}</td></tr>}} |
| </div>
| | {{#ifeq:{{#if:{{{姓名|}}}|1|0}}{{#if:{{{性别|}}}|1|0}}{{#if:{{{中文配音|}}}|1|0}}{{#if:{{{日文配音|}}}|1|0}}{{#if:{{{韩文配音|}}}|1|0}}{{#if:{{{英文配音|}}}|1|0}}{{#if:{{{属性|}}}|1|0}}{{#if:{{{弧盘|}}}|1|0}}{{#if:{{{定位|}}}|1|0}}{{#if:{{{版本|}}}|1|0}}{{#if:{{{能力|}}}|1|0}}{{#if:{{{契约|}}}|1|0}}{{#if:{{{生日|}}}|1|0}}{{#if:{{{所属|}}}|1|0}}|00000000000000 |
| }} | | |<tr class="ci-empty-row"><td colspan="2">暂无信息</td></tr> |
| </div>
| |
| | |
| <!-- ====== 信息表格 ====== -->
| |
| <table class="ci-info-table">
| |
| {{#if:{{{姓名|}}}| | |
| <tr>
| |
| <td class="ci-label">姓名</td>
| |
| <td class="ci-value">{{{姓名}}}</td>
| |
| </tr>
| |
| }}
| |
| {{#if:{{{性别|}}}| | |
| <tr>
| |
| <td class="ci-label">性别</td>
| |
| <td class="ci-value">{{{性别}}}</td>
| |
| </tr>
| |
| }}
| |
| {{#if:{{{配音|}}}| | |
| <tr>
| |
| <td class="ci-label">配音</td>
| |
| <td class="ci-value">{{{配音}}}</td>
| |
| </tr>
| |
| }}
| |
| {{#if:{{{能力|}}}| | |
| <tr>
| |
| <td class="ci-label">能力</td>
| |
| <td class="ci-value">{{{能力}}}</td>
| |
| </tr>
| |
| }}
| |
| {{#if:{{{所属势力|}}}| | |
| <tr>
| |
| <td class="ci-label">所属势力</td>
| |
| <td class="ci-value">{{{所属势力}}}</td>
| |
| </tr>
| |
| }}
| |
| <!-- 如果所有信息都为空,显示提示行 -->
| |
| {{#ifeq:{{#if:{{{姓名|}}}|1|0}}{{#if:{{{性别|}}}|1|0}}{{#if:{{{配音|}}}|1|0}}{{#if:{{{能力|}}}|1|0}}{{#if:{{{所属势力|}}}|1|0}}|00000| | |
| <tr> | |
| <td class="ci-label" style="text-align:center;color:#999;" colspan="2">暂无信息</td>
| |
| </tr>
| |
| }} | | }} |
| </table> | | </table> |
| </div> | | </div> |
|
| |
| <!-- ========== JavaScript ========== -->
| |
| <script>
| |
| (function() {
| |
| // 使用 IIFE 避免全局污染
| |
| var containers = document.querySelectorAll('.character-info-wrapper .ci-container');
| |
| containers.forEach(function(container) {
| |
| var tabs = container.querySelectorAll('.ci-tab-btn');
| |
| var items = container.querySelectorAll('.ci-img-item');
| |
|
| |
| // 如果没有选项卡或图片项,直接返回
| |
| if (tabs.length === 0 || items.length === 0) return;
| |
|
| |
| // 初始化: 确保第一个选项卡和图片是激活状态
| |
| var foundActive = false;
| |
| tabs.forEach(function(tab, idx) {
| |
| if (idx === 0 && !foundActive) {
| |
| tab.classList.add('active');
| |
| foundActive = true;
| |
| } else {
| |
| tab.classList.remove('active');
| |
| }
| |
| });
| |
| items.forEach(function(item, idx) {
| |
| if (idx === 0) {
| |
| item.classList.add('active');
| |
| } else {
| |
| item.classList.remove('active');
| |
| }
| |
| });
| |
|
| |
| // 点击切换
| |
| tabs.forEach(function(tab) {
| |
| tab.addEventListener('click', function(e) {
| |
| var index = parseInt(this.getAttribute('data-ci-index'), 10);
| |
| if (isNaN(index)) return;
| |
|
| |
| // 切换选项卡样式
| |
| tabs.forEach(function(t) {
| |
| t.classList.remove('active');
| |
| });
| |
| this.classList.add('active');
| |
|
| |
| // 切换图片
| |
| items.forEach(function(item) {
| |
| var itemIndex = parseInt(item.getAttribute('data-ci-index'), 10);
| |
| if (itemIndex === index) {
| |
| item.classList.add('active');
| |
| } else {
| |
| item.classList.remove('active');
| |
| }
| |
| });
| |
| });
| |
| });
| |
|
| |
| // 如果只有一张图片,隐藏选项卡(但保留,视觉上不显示)
| |
| if (tabs.length <= 1) {
| |
| var tabContainer = container.querySelector('.ci-image-tabs');
| |
| if (tabContainer) {
| |
| tabContainer.style.display = 'none';
| |
| }
| |
| // 但确保图片显示
| |
| if (items.length === 1) {
| |
| items[0].classList.add('active');
| |
| }
| |
| }
| |
| });
| |
| })();
| |
| </script>
| |
| </div> | | </div> |
| </includeonly> | | </includeonly> |
| <noinclude> | | <noinclude> |
| | <!-- 模板文档 --> |
| | ... |
| | </noinclude> |