打开/关闭搜索
搜索
打开/关闭菜单
14
6636
42
1.1万
OGAS数据中枢
导航
首页
最近更改
随机页面
特殊页面
上传文件
少女前线
简介
战术人形
装备图鉴
BGM
任务
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
注册
登录
查看“︁Widget:GF立绘切换”︁的源代码
来自OGAS数据中枢
更多操作
←
Widget:GF立绘切换
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
管理员
您没有权限编辑
Widget
命名空间内的页面。
您可以查看和复制此页面的源代码。
<includeonly><script> (function() { function initSwitcher() { document.querySelectorAll('.gf-infobox-new').forEach(function(box) { if (box.dataset.switcherReady) return; box.dataset.switcherReady = 'true'; var container = box.querySelector('.gf-image-container'); var thumbItems = box.querySelectorAll('.gf-thumb-item'); if (!container || thumbItems.length < 2) return; thumbItems.forEach(function(item) { item.addEventListener('click', function(e) { e.preventDefault(); // 更新激活状态 thumbItems.forEach(function(t) { t.classList.remove('active'); }); this.classList.add('active'); // 获取新图片文件名 var newFile = this.dataset.img; if (!newFile) return; // 获取旧图片 var oldImg = container.querySelector('img'); // 创建新图片 var newImg = new Image(); newImg.style.maxWidth = '100%'; newImg.style.maxHeight = '420px'; newImg.style.objectFit = 'contain'; newImg.style.opacity = '0'; newImg.style.transition = 'opacity 0.35s ease'; newImg.onload = function() { // 淡出旧图 if (oldImg) { oldImg.style.opacity = '0'; oldImg.style.transition = 'opacity 0.2s ease'; } // 延迟替换 setTimeout(function() { container.innerHTML = ''; container.appendChild(newImg); requestAnimationFrame(function() { newImg.style.opacity = '1'; }); }, 200); }; newImg.onerror = function() { console.warn('Failed to load image: ' + newFile); // 恢复旧图 if (oldImg) { oldImg.style.opacity = '1'; } }; // 使用 MediaWiki 文件路径 // 如果文件名不含 File: 前缀,尝试构建路径 if (newFile.startsWith('File:') || newFile.startsWith('文件:')) { newImg.src = newFile; } else { // 假设是 wiki 上的文件名 newImg.src = '/images/' + newFile; // 备用:直接当作完整URL newImg.onerror = function() { newImg.src = newFile; }; } }); }); }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initSwitcher); } else { initSwitcher(); } // 兼容 MediaWiki 动态加载 if (window.mw && mw.hook) { mw.hook('wikipage.content').add(initSwitcher); } })(); </script></includeonly>
返回
Widget:GF立绘切换
。
查看“︁Widget:GF立绘切换”︁的源代码
来自OGAS数据中枢