跳转到内容

MediaWiki:Gadget-ReferenceTooltips.css

勤求古训,博采众方
鹿野耕云留言 | 贡献2025年11月2日 (日) 15:43的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/* ====================================================================
 * Reference Tooltips 参考提示工具 - 核心样式 v2.1
 * 功能说明:
 * 1. 支持明/暗模式自动切换
 * 2. 完美适配Codex设计系统
 * 3. 响应式布局优化
 * 4. 高清屏显示优化
 * 集成方式:复制整个代码块到MediaWiki:Gadget-ReferenceTooltips.css
 * ==================================================================== */

/* 基础覆盖层样式 */
.rt-overlay {
  position: absolute;
  width: 100%;
  font-size: calc(var(--font-size-medium, 1rem) * 0.928); /* 13px/14px */
  line-height: 1.5em;
  z-index: 800; /* 匹配Codex的z-index层级 */
  top: 0;
  pointer-events: none; /* 防止阻挡下方交互 */
}

/* 旧版皮肤兼容(可安全删除如果不再支持) */
.skin-vector-legacy .rt-overlay { font-size: 13px; }
.skin-monobook .rt-overlay { font-size: 12.7px; }

/* 主工具提示容器 */
.rt-tooltip {
  position: absolute;
  max-width: min(27em, 90vw); /* 响应式限制 */
  background: var(--background-color-base, #fff);
  color: var(--color-base, #202122);
  border: 1px solid var(--border-color-subtle, #c8ccd1);
  border-radius: var(--border-radius-small, 2px);
  box-shadow: var(--box-shadow-dialog-medium);
  transition: opacity 0.15s ease;
  pointer-events: auto; /* 恢复内部交互 */
}

/* 暗模式适配 */
html.skin-theme-clientpref-night .rt-tooltip {
  --background-color-base: var(--color-surface-1, #1e1e1e);
  --color-base: var(--color-base, #eee);
  --border-color-subtle: var(--border-color-subtle, #54595d);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8);
}

/* 悬停区域扩展(防抖) */
.rt-tooltip-above .rt-hoverArea {
  margin-bottom: -0.6em;
  padding-bottom: 0.6em;
}
.rt-tooltip-below .rt-hoverArea {
  margin-top: -0.7em;
  padding-top: 0.7em;
}

/* 内容区域 */
.rt-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
}
.rt-content {
  padding: 0.7em 0.9em;
  overflow-wrap: break-word;
  font-family: var(--font-family-base); /* 继承Wiki字体 */
}

/* 工具提示小三角(适配高清屏) */
.rt-tail {
  --tail-size: 13px;
  position: absolute;
  width: var(--tail-size);
  height: var(--tail-size);
  z-index: -1;
  background: linear-gradient(
    to top right,
    var(--border-color-subtle, #c8ccd1) 48%,
    transparent 48%
  );
}
.rt-tail:after {
  content: '';
  position: absolute;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  background: inherit;
  bottom: 1px;
  left: 1px;
}
/* 定位调整 */
.rt-tooltip-above .rt-tail {
  transform: rotate(-45deg);
  bottom: 0;
  left: 19px;
}
.rt-tooltip-below .rt-tail {
  transform: rotate(135deg);
  top: 0;
  left: calc(19px + var(--tail-size));
}

/* 设置按钮(Codex风格) */
.rt-settingsLink {
  --icon-size: 24px;
  float: right;
  margin: -0.5em -0.5em 0 0.5em;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: var(--border-radius-small);
  background: var(--icon-settings) center / var(--icon-size) no-repeat;
  opacity: 0.65;
  transition: all 0.2s ease;
  cursor: pointer;
}
/* SVG图标内联(明暗模式) */
:root {
  --icon-settings: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2354595d' d='M20 14.5v-2.9l-1.8-.3c-.1-.4-.3-.8-.6-1.4l1.1-1.5-2.1-2.1-1.5 1.1c-.5-.3-1-.5-1.4-.6L13.5 5h-2.9l-.3 1.8c-.5.1-.9.3-1.4.6L7.4 6.3 5.3 8.4l1 1.5c-.3.5-.4.9-.6 1.4l-1.7.2v2.9l1.8.3c.1.5.3.9.6 1.4l-1 1.5 2.1 2.1 1.5-1c.4.2.9.4 1.4.6l.3 1.8h3l.3-1.8c.5-.1.9-.3 1.4-.6l1.5 1.1 2.1-2.1-1.1-1.5c.3-.5.5-1 .6-1.4l1.5-.3zM12 16c-1.7 0-3-1.3-3-3s1.3-3 3-3 3 1.3 3 3-1.3 3-3 3z'/%3E%3C/svg%3E");
}
html.skin-theme-clientpref-night {
  --icon-settings: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23c8ccd1' d='M20 14.5v-2.9l-1.8-.3c-.1-.4-.3-.8-.6-1.4l1.1-1.5-2.1-2.1-1.5 1.1c-.5-.3-1-.5-1.4-.6L13.5 5h-2.9l-.3 1.8c-.5.1-.9.3-1.4.6L7.4 6.3 5.3 8.4l1 1.5c-.3.5-.4.9-.6 1.4l-1.7.2v2.9l1.8.3c.1.5.3.9.6 1.4l-1 1.5 2.1 2.1 1.5-1c.4.2.9.4 1.4.6l.3 1 conformalH8h3l.3-1.8c.5-.1.9-.3 1.4-.6l1.5 1.1 2.1-2.1-1.1-1.5c.3-.5.5-1 .6-1.4l1.5-.3zM12 16c-1.7 0-3-1.3-3-3s1.3-3 3-3 3 1.3 3 3-1.3 3-3 3z'/%3E%3C/svg%3E");
}
/* 交互状态 */
.rt-settingsLink:hover {
  opacity: 1;
  background-color: var(--background-color-interactive, #f8f9fa);
}
.rt-settingsLink:active {
  border-color: var(--border-color-interactive, #72777d);
}
.rt-settingsLink:focus-visible {
  outline: 2px solid var(--border-color-progressive--focus, #36c);
}

/* 目标高亮样式 */
.rt-target {
  background-color: var(--background-color-progressive-subtle, #eaf3ff);
  animation: rt-highlight 1.5s ease-in-out;
}

/* 动画效果 */
@keyframes rt-fade-in-up {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes rt-highlight {
  0%, 100% { background-color: transparent; }
  50% { background-color: var(--background-color-progressive-subtle); }
}
.rt-fade-in-up { animation: rt-fade-in-up 0.2s ease forwards; }

/* 移动端优化 */
@media (max-width: 768px) {
  .rt-tooltip {
    max-width: 85vw;
    font-size: calc(var(--font-size-medium, 1rem) * 0.857); /* 12px/14px */
  }
  .rt-content {
    padding: 0.6em 0.8em;
  }
}