Files
wordpress-kratos-yang/inc/options-framework/css/optionsframework.css
T
laoyang 6f51d50a58 3.2.30: 文章目录进后台(新增「自动目录」标签页)—— 位置/插入点/默认展开可配,手写 [TOC] 永远优先
后台「主题设置」新增第 5 个标签页「自动目录」,7 个选项:
  目录位置   正文中间 / 页面左侧(浮动)/ 页面右侧(浮动)
  添加方式   手动(只认 [TOC])/ 自动
  自动插入位置  文章开头 / 第一个 H1、H2 之前 / 文章结尾
  默认状态   默认显示 / 默认隐藏
  另外:目录标题、收录层级(H1~H4)、是否显示序号

设计要点:
- 插入方式拆成 toc_mode(manual/auto) x toc_anchor(start/first/end) 两个正交
  字段,不合成一个四值下拉:侧栏模式下插入位置毫无意义,合并会产生歧义。
- 手写 [TOC] 绝对优先:yang_toc_plan() 里 $has_marker 最先返回,inline_at
  ='marker' 且 rail=false —— 否则同一篇会出现两份目录,老文章升级后突然多
  出一个目录。这条是刻意守住的。
- 纯函数 + 薄壳分层:normalize_settings / plan / inject / build_list 全部不查库,
  单进程可喂几十种组合;settings() 只负责读库 + 调纯函数 + static 缓存。
- <details open> 是唯一可靠的「默认收起」手段:展开态不接受 CSS 覆盖,只能
  由 open 属性决定,所以隐藏时必须不输出该属性。
- 侧栏收起态必须 translateX(±100%) 完全移出视口:只做 opacity 会让透明面板
  留在原位吃掉正文点击(探针 elementFromPoint 才抓得到)。
- yang_toc_rail_ready() 开关:侧栏在 wp_footer 输出,那时正文可能没走
  the_content(缓存插件/OEmbed),标题没 id ⇒ 侧栏链接全跳不动却看起来正常。
  宁可不出侧栏。
- 后台联动隐藏「插入位置」不用 jQuery show()/hide():会把 .section 的行内
  display 写成 block,悄悄回退 3.2.28 的 display:flow-root BFC 修复。改用
  class + display:none!important。

验证(全部在本轮重跑):
  _test_toc.php       53/0   旧 TOC 行为回归
  _toc330_logic.php   88/0   逻辑判据
  _toc330_falsify     13/13  注入全变红且红对地方
  _geo330_rail.js     73/0   侧栏真实几何(左/右 x 展开/收起 x 宽窄屏)
  _geo330_falsify     8/8
  _guard330.php       46/0   后台控件与运行时默认值双向一致
  _guard330_falsify   8/8
  _admin330_tab_check 36/0   新标签页几何 + 联动 + 载入态
  _admin330_falsify   8/8
  _admin328_check     13/0   3.2.28 布局回归

发布:只发 zip + readme + update.json 到 theme-update/,不动服务器主题目录,
用户在 WP 后台自行升级(沿用 3.2.24 起的策略)。
2026-10-25 12:18:52 +08:00

509 lines
12 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#optionsframework {
max-width: 855px;
background: #fff;
}
#optionsframework h3 {
margin: 0;
padding: 12px 10px;
border-bottom: 1px solid #ddd;
background-color: #f1f1f1;
cursor: default;
}
#optionsframework p {
margin-bottom: 0;
padding-bottom: 10px;
}
#optionsframework .section {
padding: 10px 10px 0;
}
#optionsframework .group {
padding-bottom: 40px;
}
#optionsframework .section .controls {
float: left;
padding-right: 2%;
width: 54%;
min-width: 350px;
}
#optionsframework .section .explain {
float: left;
max-width: 38%;
color: #777;
font-size: 12px;
line-height: 16px;
}
#optionsframework .section-checkbox .controls {
width: 98%;
}
#optionsframework .section-checkbox .explain {
max-width: 94%;
}
#optionsframework .controls input[type="text"],
#optionsframework .controls input[type="password"] {
width: 100%;
}
#optionsframework .controls input[type="text"].wp-color-picker {
width: 65px;
}
#optionsframework .controls select,
#optionsframework .controls textarea {
margin-bottom: 10px;
width: 100%;
}
#optionsframework .section-radio label,
#optionsframework .section-multicheck label {
float: left;
margin-bottom: 5px;
max-width: 90%;
line-height: 16px;
}
#optionsframework input.checkbox,
#optionsframework input.of-radio {
float: left;
clear: both;
margin: 0 10px 5px 0;
}
#optionsframework .section-typography .controls {
float: none;
width: auto;
}
#optionsframework .section-typography .explain {
float: none;
width: auto;
}
#optionsframework .controls .of-typography-size {
float: left;
width: 80px;
}
#optionsframework .controls .of-typography-unit {
float: left;
margin-left: 5px;
width: 50px;
}
#optionsframework .controls .of-typography-face {
float: left;
margin-left: 5px;
width: 100px;
}
#optionsframework .controls .of-typography-style {
float: left;
margin-right: 5px;
margin-left: 5px;
width: 80px;
}
#optionsframework .section-typography .wp-picker-container {
margin-top: 2px;
}
#optionsframework .of-background-properties {
clear: both;
margin-top: 18px;
}
#optionsframework .controls .of-background-repeat {
float: left;
margin-right: 5px;
width: 125px;
}
#optionsframework .controls .of-background-position {
float: left;
margin-right: 5px;
width: 125px;
}
#optionsframework .controls .of-background-attachment {
float: left;
margin-right: 5px;
width: 125px;
}
#optionsframework .section-background .wp-picker-container {
margin-bottom: 10px;
}
#optionsframework .controls .of-radio-img-img {
float: left;
display: none;
margin: 0 5px 10px 0;
border: 3px solid #f9f9f9;
cursor: pointer;
}
#optionsframework .controls .of-radio-img-selected {
border: 3px solid #ccc;
}
#optionsframework .controls .of-radio-img-img:hover {
opacity: 0.8;
}
#optionsframework .controls .of-border-width {
float: left;
width: 80px;
}
#optionsframework .controls .of-border-style {
float: left;
width: 120px;
}
#optionsframework .hide {
display: none;
}
#optionsframework .of-option-image {
margin: 3px 0 18px 0;
max-width: 340px;
}
#optionsframework .mini .controls select,
#optionsframework .section .mini .controls {
width: 140px;
}
#optionsframework .mini .controls input,
#optionsframework .mini .controls {
width: 140px;
min-width: 140px;
}
#optionsframework .mini .explain {
max-width: 74%;
}
#optionsframework .section-info {
padding-bottom: 7px;
}
#optionsframework .controls input.upload {
width: 80%;
}
#optionsframework .screenshot {
position: relative;
float: left;
margin-top: 3px;
margin-left: 1px;
width: 344px;
}
#optionsframework .screenshot img {
float: left;
margin-bottom: 10px;
padding: 4px;
max-width: 334px;
border-color: #ccc #eee #eee #ccc;
border-style: solid;
border-width: 1px;
background: #fafafa;
}
#optionsframework .screenshot .remove-image {
position: absolute;
bottom: 4px;
left: -4px;
float: left;
display: block;
padding: 0;
width: 16px;
height: 16px;
border: medium none;
background: url("../images/ico-delete.png") no-repeat;
text-indent: -9999px;
}
#optionsframework .screenshot .no_image .file_link {
margin-left: 20px;
}
#optionsframework .screenshot .no_image .remove-button {
bottom: 0px;
}
#optionsframework .reset-button {
float: left;
cursor: pointer;
}
#optionsframework-submit {
padding: 7px 10px;
border-top: 1px solid #ddd;
background-color: #f1f1f1;
}
#optionsframework .button-primary {
float: right;
}
#optionsframework .section:after {
display: table;
content: "";
}
#optionsframework .section:after {
clear: both;
}
#optionsframework .about-content {
padding: 10px 20px;
}
#optionsframework .about-content img {
width: 100%;
height: auto;
}
#optionsframework .about-content h4 {
margin-top: 20px;
margin-bottom: 16px;
padding-bottom: 0.3em;
border-bottom: 1px solid #eaecef;
font-weight: 600;
font-size: 18px;
line-height: 1.25;
}
#optionsframework .about-content ul {
padding-left: 0;
list-style: none;
font-size: 15px;
}
#optionsframework .about-content ul li {
line-height: 25px;
}
#optionsframework .about-content .notices {
color: #727777;
font-size: 14px;
}
#optionsframework .about-content .tips {
color: #333333;
text-align: center;
font-size: 16px;
}
#optionsframework .about-content .tips b {
margin-left: 3px;
}
/* ── 多选复选框组(multicheck)────────────────────────────────
框架原本没有这个类型的渲染分支,所以也没有配套样式。
不加样式的话,9 个纪念日会挤成一行流水文字,看不出是一个可勾选的清单。
这里做成两列表格状,并把说明文字压到第二行、颜色调淡,
让「名称」是视觉主体、「日期说明」是补充信息。 */
#optionsframework .of-multicheck {
margin: 0;
padding: 2px 0 0;
border: 0;
}
#optionsframework .of-multicheck-item {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 9px 12px;
margin: 0 0 2px;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.15s ease;
}
#optionsframework .of-multicheck-item:hover {
background-color: #f3f5f7;
}
#optionsframework .of-multicheck-item input[type="checkbox"] {
margin: 3px 0 0;
flex: 0 0 auto;
}
/* 名称与说明两行文字共用的竖排容器 */
#optionsframework .of-multicheck-text {
display: flex;
flex-direction: column;
flex: 1 1 auto;
}
#optionsframework .of-multicheck-label {
font-size: 14px;
color: #23282d;
line-height: 1.5;
}
#optionsframework .of-multicheck-note {
font-size: 12px;
color: #727777;
line-height: 1.5;
margin-top: 3px;
}
/* ══════════════════════════════════════════════════════════════
3.2.24 设置页布局重排
用户反馈:"主题设置的样式不好看,把标签页按钮放左侧、上下排列,
功能项放在右侧,重新设置好看一点。"
实现:≥960px 时把 nav-tab-wrapper 浮到左侧成一列竖排导航,
内容区(含保存提示条)整体右移;窄屏回退 WP 默认的横向标签,
不在手机后台做特殊布局。切标签的 JS(options-custom.js)不动,
它只认 .nav-tab / .nav-tab-active / .group 这几个类。
══════════════════════════════════════════════════════════════ */
@media screen and (min-width: 960px) {
#optionsframework-wrap {
max-width: 1180px;
}
/* 浮动布局的收尾:否则 wrap 高度塌到标签列或面板较短的那个 */
#optionsframework-wrap::after {
display: table;
clear: both;
content: "";
}
/* ── 左侧标签列 ── */
#optionsframework-wrap h2.nav-tab-wrapper {
float: left;
box-sizing: border-box;
width: 190px;
margin: 0 20px 20px 0;
padding: 8px;
border: 1px solid #dcdcde;
border-radius: 6px;
background: #fff;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
#optionsframework-wrap .nav-tab-wrapper .nav-tab {
float: none;
display: block;
width: 100%;
box-sizing: border-box;
margin: 0 0 2px;
padding: 9px 12px;
border: 0;
border-left: 3px solid transparent;
border-radius: 4px;
background: none;
color: #50575e;
line-height: 1.5;
cursor: pointer;
}
#optionsframework-wrap .nav-tab-wrapper .nav-tab:last-child {
margin-bottom: 0;
}
#optionsframework-wrap .nav-tab-wrapper .nav-tab:hover {
border-left-color: transparent;
background: #f0f0f1;
color: #1d2327;
}
#optionsframework-wrap .nav-tab-wrapper .nav-tab-active,
#optionsframework-wrap .nav-tab-wrapper .nav-tab-active:hover {
border-left-color: #00a2ff;
background: #e8f5ff;
color: #0089db;
font-weight: 600;
}
/* ── 右侧内容区:面板 + 保存提示条都要让开左侧一列 ── */
#optionsframework-wrap > #optionsframework-metabox,
#optionsframework-wrap > .notice,
#optionsframework-wrap > .updated,
#optionsframework-wrap > .error {
margin-left: 210px;
}
#optionsframework-metabox #optionsframework {
border-radius: 6px;
}
}
/* ── 区块内部(宽窄屏都生效)────────────────────────────────
1. 分组标题:原来 `#optionsframework h3` 是给面板顶部那条用的
灰底横条,选择器太宽把每个分组标题也罩了进去,整页一排灰条。
这里把分组标题单独重排:去灰底、加重字重、压淡下边线。 */
#optionsframework .group > h3 {
margin: 0;
padding: 15px 18px 13px;
border-bottom: 1px solid #f0f0f1;
background: none;
font-size: 15px;
font-weight: 600;
color: #1d2327;
}
/* 2. 区块间距与分隔:原来 10px 的内边距太挤,项与项之间没有分界。
* 3.2.26 调整:16/8 → 14/12,并清掉 h4 标题的 WP 默认 margin(见下)
*
* 3.2.28:这里补上了 `display: flow-root` —— 本次真正的根因修复。
*
* 3.2.24 把标签列改成 float:left(宽 190px;标签多了以后整列约 400px 高),
* 而框架原本给 .section 留了 ::after{clear:both} 来清除内部浮动的
* .controls / .explain。问题在于 clear 的作用范围以**最近的 BFC** 为界:
* .section 只是普通块盒、不建 BFC,于是它末尾那个清除元素被要求避开
* **左侧整个浮动标签列**,把第一个配置项的下边界一直撑到标签列底部
* (实测 section 高 405px,而内容只占 43px)。
*
* 这也解释了 3.2.26 只收编 h4 的 margin 为什么完全无效 —— 多出来的不是
* 间距,是 section 自身的高度;空白也只出现在第一个配置项之后,因为后面
* 的 section 起点已经越过标签列底部,clear 不再起作用。
*
* 修法:让 .section 建立自己的 BFC,内部的清除就只在自身范围内生效。
* 不能用 overflow:hidden —— 那会把颜色选择器的弹出层裁掉。
* 原有的 ::after{clear:both}(见上面 .section:after)保留,
* 作为极老浏览器不支持 flow-root 时的兜底。 */
#optionsframework .section {
display: flow-root;
padding: 14px 18px 12px;
border-bottom: 1px solid #f6f7f7;
}
/* 3.2.26:配置项标题(h4.heading)继承 WP 后台 common.css 的
* 上下 margin ≈17px,与 section 的 padding 叠加后,相邻两个配置项
* 之间多出约 34px 的空隙(上下各 17px)。标题的内距统一由本条控制:
* 上边距清零(section 的 padding-top 负责),下边距 10px 压住控件。 */
#optionsframework .section > .heading {
margin: 0 0 10px;
}
/* 条件字段(如「自动插入位置」只在目录位置=正文中间时才有意义)
*
* 用 !important 的 display:none 而不是 jQuery 的 show()/hide(),原因见
* js/options-custom.js 里 yq_toggle_toc_anchor():.section 的 display 是
* flow-root,jQuery 会把行内 display 写成 block,等于回退 3.2.28 的修复。
* 这里只隐藏,不改变其它布局属性。 */
#optionsframework .section.yq-cond-hide {
display: none !important;
}
/* 3. 提交栏:与分组标题同一套留白 */
#optionsframework-submit {
padding: 12px 18px;
}