跳转到内容

MediaWiki:Gadget-ReferenceTooltips.css:修订间差异

勤求古训,博采众方
创建页面,内容为“参考:[[mw:Reference Tooltips]] - 参考提示工具样式:​ 覆盖层基础样式(绝对定位,全宽):​ .rt-overlay { position: absolute; width: 100%; font-size: calc(var(--font-size-medium, 1rem) * (13 / 14)); line-height: 1.5em; z-index: 800; 与Codex的z-index-tooltip对齐:​ top: 0; } 旧版Vector皮肤的字体大小覆盖:​ .skin-vector-legacy .rt-overlay { font-size: 13px; } Monobook皮肤的字体大小覆盖:​ .…”
 
无编辑摘要
 
第1行: 第1行:
/* 参考:[[mw:Reference Tooltips]] - 参考提示工具样式 */
/* ====================================================================
* Reference Tooltips 参考提示工具 - 核心样式 v2.1
* 功能说明:
* 1. 支持明/暗模式自动切换
* 2. 完美适配Codex设计系统
* 3. 响应式布局优化
* 4. 高清屏显示优化
* 集成方式:复制整个代码块到MediaWiki:Gadget-ReferenceTooltips.css
* ==================================================================== */


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


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


/* 工具提示容器样式 */
/* 主工具提示容器 */
.rt-tooltip {
.rt-tooltip {
position: absolute;
  position: absolute;
max-width: 27em;
  max-width: min(27em, 90vw); /* 响应式限制 */
background: var(--background-color-base, #fff); /* 使用皮肤背景色,默认白色 */
  background: var(--background-color-base, #fff);
color: var(--color-base, #202122); /* 使用皮肤文字色,默认深灰 */
  color: var(--color-base, #202122);
border: 1px solid var(--border-color-subtle, #c8ccd1);
  border: 1px solid var(--border-color-subtle, #c8ccd1);
border-radius: 2px;
  border-radius: var(--border-radius-small, 2px);
box-shadow: 0 20px 48px 0 rgba(0, 0, 0, 0.2);
  box-shadow: var(--box-shadow-dialog-medium);
  transition: opacity 0.15s ease;
  pointer-events: auto; /* 恢复内部交互 */
}
}


/* 暗模式下工具提示阴影加深 */
/* 暗模式适配 */
html.skin-theme-clientpref-night .rt-tooltip {
html.skin-theme-clientpref-night .rt-tooltip {
box-shadow: 0 20px 48px 0 rgba(0, 0, 0, 1);
  --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 {
.rt-tooltip-above .rt-hoverArea {
margin-bottom: -0.6em;
  margin-bottom: -0.6em;
padding-bottom: 0.6em;
  padding-bottom: 0.6em;
}
}
/* 工具提示下方悬停区域扩展 */
.rt-tooltip-below .rt-hoverArea {
.rt-tooltip-below .rt-hoverArea {
margin-top: -0.7em;
  margin-top: -0.7em;
padding-top: 0.7em;
  padding-top: 0.7em;
}
}


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


/* 工具提示小三角样式 */
/* 工具提示小三角(适配高清屏) */
.rt-tail {
.rt-tail {
/* 使用48%而非50%,修复Windows高分屏下的对齐问题 */
  --tail-size: 13px;
background: linear-gradient(to top right, var(--border-color-subtle, #c8ccd1) 48%, rgba(0, 0, 0, 0) 48%);
  position: absolute;
--tail-left: 19px;
  width: var(--tail-size);
--tail-side-width: 13px;
  height: var(--tail-size);
}
  z-index: -1;
 
  background: linear-gradient(
.rt-tail,
    to top right,
.rt-tail:after {
    var(--border-color-subtle, #c8ccd1) 48%,
position: absolute;
    transparent 48%
z-index: -1; /* 确保三角在滚动条下方 */
  );
width: var(--tail-side-width);
height: var(--tail-side-width);
}
}
/* 小三角内部填充色(与工具提示背景一致) */
.rt-tail:after {
.rt-tail:after {
content: '';
  content: '';
background: var(--background-color-base, #fff);
  position: absolute;
bottom: 1px;
  width: calc(100% - 2px);
left: 1px;
  height: calc(100% - 2px);
  background: inherit;
  bottom: 1px;
  left: 1px;
}
}
 
/* 定位调整 */
/* 上方工具提示的小三角定位 */
.rt-tooltip-above .rt-tail {
.rt-tooltip-above .rt-tail {
transform: rotate(-45deg);
  transform: rotate(-45deg);
transform-origin: 100% 100%;
  bottom: 0;
bottom: 0;
  left: 19px;
left: var(--tail-left);
}
}
/* 下方工具提示的小三角定位 */
.rt-tooltip-below .rt-tail {
.rt-tooltip-below .rt-tail {
transform: rotate(135deg);
  transform: rotate(135deg);
transform-origin: 0 0;
  top: 0;
top: 0;
  left: calc(19px + var(--tail-size));
left: calc(var(--tail-left) + var(--tail-side-width));
}
}


/* 暗模式下小三角颜色适配 */
/* 设置按钮(Codex风格) */
html.skin-theme-clientpref-night .rt-tail {
.rt-settingsLink {
background: linear-gradient(to top right, var(--border-color-subtle, #72777d) 48%, transparent 48%);
  --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 {
html.skin-theme-clientpref-night {
--background-color-base: #1e1e1e; /* 暗色背景 */
  --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");
--color-base: #eee; /* 亮色文字 */
--border-color-subtle: #54595d; /* 暗色边框 */
}
}
 
/* 交互状态 */
/* 设置按钮图标样式 */
.rt-settingsLink:hover {
.rt-settingsLink {
  opacity: 1;
background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%2354595d%22%20d%3D%22M20%2014.5v-2.9l-1.8-.3c-.1-.4-.3-.8-.6-1.4l1.1-1.5-2.1-2.1-1.5%201.1c-.5-.3-1-.5-1.4-.6L13Simplifying5%205h-2.9l-.3%201.8c-.5.1-.9.3-1.4.6L7.4%206.3%205.3%208.4l1%201.5c-.3.5-.4.9-.6%201.4l-1.7.2v2.9l1.8.3c.1.5.3.9.6%201.4l-1%201.5%202.1%202.1%201.5-1c.4.2.9.4%201.4.6l.3%201.8h3l.3-1.8c.5-.1.9-.3%201.4-.6l1.5%201.1%202.1-2.1-1.1-1.5c.3-.5.5-1%20.6-1.4l1.5-.3zM12%2016c-1.7%200-3-1.3-3-3s1.3-3%203-3%203%201.3%203%203-1.3%203-3%203z%22%2F%3E%3C%2Fsvg%3E);
  background-color: var(--background-color-interactive, #f8f9fa);
float: right;
margin: -0.5em -0.5em 0 0.5em;
height: 32px;
width: 32px;
border: 1px solid transparent;
border-radius: 2px;
background-position: center;
background-repeat: no-repeat;
background-size: 24px 24px;
}
 
/* 暗模式下设置图标颜色变为浅色 */
html.skin-theme-clientpref-night .rt-settingsLink {
background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20fill%3D%22%23c8ccd1%22%20d%3D%22...%22%2F%3E%3C%2Fsvg%3E);
}
}
/* 设置按钮悬停/激活状态 */
.rt-settingsLink:hover,
.rt-settingsLink:active {
.rt-settingsLink:active {
background-color: var(--background-color-interactive, #eaecf0);
  border-color: var(--border-color-interactive, #72777d);
}
}
 
.rt-settingsLink:focus-visible {
.rt-settingsLink:active {
  outline: 2px solid var(--border-color-progressive--focus, #36c);
border-color: var(--border-color-interactive, #72777d);
}
}


.rt-settingsLink:focus {
/* 目标高亮样式 */
outline: 1px solid transparent;
.rt-target {
  background-color: var(--background-color-progressive-subtle, #eaf3ff);
  animation: rt-highlight 1.5s ease-in-out;
}
}
.rt-settingsLink:focus:not(:active) {
border-color: var(--border-color-progressive--focus, #36c);
box-shadow: inset 0 0 0 1px var(--box-shadow-color-progressive--focus, #36c);
}
/* 其他组件样式(略) */
.rt-target { background-color: var(--background-color-progressive-subtle, #eaf3ff); }
.rt-enableField { font-weight: bold; margin-bottom: 1.25em; }
.rt-numberInput.rt-numberInput { width: 10em; }
.rt-tooltipsForCommentsField { margin-top: 1.25em; }


/* 动画效果 */
/* 动画效果 */
@keyframes rt-fade-in-up {
@keyframes rt-fade-in-up {
0% { opacity: 0; transform: translate(0, 20px); }
  0% { opacity: 0; transform: translateY(10px); }
100% { opacity: 1; transform: translate(0, 0); }
  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; }
.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;
  }
}

2025年11月2日 (日) 15:43的最新版本

/* ====================================================================
 * 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;
  }
}