惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

爱吃肉的猫

那就,再相逢 Butterfly的魔改教程:最新评论页 离歌不夜天 前端分享 - 滑动阻尼效果 Butterfly的魔改教程:右键菜单 音乐分享 - doi微醺氛围 Butterfly的魔改教程:动态相册页 近况记事 - 11 微信公众号:Ai大模型让回复更具智能化 近况记事 - 10 PWA:让你的网站变成桌面应用APP Healthy Love Butterfly的魔改教程:关于本站 近况记事 - 9 Butterfly的魔改教程:待办清单 TrollStore - 不掉签助手 近况记事 - 8 Twikoo评论回复邮件模版 过一个很特别的七夕 The Young Boy and the Sea Butterfly的魔改教程:文章订阅页 思考题目:混乱是阶梯 近况记事 - 7 Butterfly的魔改教程:即刻短文页 Butterfly的魔改教程:loading加载动画 差旅游记 再见,不惑之年:二十又一 近况记事 - 6 Butterfly的魔改教程:自定页数跳转 堆友AI作图:3D资源设计平台,堆出你的未来 【QD-Today】自建私有自动签到服务 Long time no see Butterfly的魔改教程:聊天记录页 Butterfly的魔改教程:个性定位信息 近况记事 - 5 CDN加速 二刷《想见你》 网络言论不是法外之地 近况记事 - 4 深夜训斥 近况记事 - 3 近况记事 - 2 日常打理的那些事 Butterfly的魔改教程:随机阅读一篇文章 随笔 · 封 布柒糖FM项目进展报告 清明路雨纷纷 TA - 仲夏夜的荒原 重构记录 - 4 近况记事 Butterfly的魔改教程:评论弹窗 2021款 Model Y 近两年用车总结 重构记录 - 3 百日祭 避风的港湾 Emoji表情大全 iCat-APP 开源记录 Butterfly的调整教程:文章外挂标签美化 iOS修改 - 万铲铲的致富之路 Markdown 基础教程 从你的全世界路过 小米摄像头!避!雷! VuePress 搭建教程 Hexo跳过指定文件渲染 百度贴吧每日自动签到 重构记录 - 1 GitHub Desktop提交报错 快速批量处理重命名 Git连接仓库常用命令 Ubuntu处理deb命令 掘金自动签到并挖矿 一个简洁的橙色调个人简介 我的猫以前也是流浪猫 布柒糖FM 最新指北 初学写个了油猴脚本 幽灵404页面 PC游戏 · 植物大战僵尸 语言包 · 越狱篇 砸壳多开 · 越狱篇 HuiRan Cursors 手动关闭Win10自动更新 iPhone XR 完美越狱 成功实例 三年的跌撞 关于《小橘妈妈》 魔改前置教程:添加自定义css和js文件 Hexo 博客添加RSS插件 Butterfly的魔改教程:导航栏魔改美化
Butterfly的魔改教程:好物推荐页
亦小封 · 2023-06-14 · via 爱吃肉的猫

效果预览

引用站外地址,注意辨别

创建数据

小节开始前,提醒事项。
对于初次魔改新手,建议先过一遍:魔改前置教程:添加自定义css和js文件

  • 创建[blogRoot]/source/equipment/index.md页面。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
title: 我的装备
date: 2023-06-06 17:09:42
type: equipment
top_img: false
aside: false
top_page: true
top_bg: https://s11.ax1x.com/2023/06/07/pCiOBKU.jpg
top_item: 我的装备
top_title: 封の生活好物
top_tips: 靠谱的日常伙伴 让工作与生活充满期待
top_link: /blog/42#好物推荐页
top_text: 关于本页
---


<!-- 页面内容 -->
  • 修改[blogRoot]/themes/butterfly/layout/page.pug来使页面匹配。
1
2
3
4
5
6
      when 'categories'
include includes/page/categories.pug
+ when 'equipment'
+ include includes/page/equipment.pug
default
include includes/page/default-page.pug
  • 创建[blogRoot]/themes/butterfly/layout/includes/page/equipment.pug页面,并新增以下内容。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#icat-equipment
- var result = ''
each i in site.data.equipment
- let className = i.class_name ? markdown(`## ${i.class_name}`) : ""
- let classDesc = i.class_desc ? `<div class="equipment-desc">${i.class_desc}</div>` : ""

- let listResult = `${className}${classDesc} `
- let listContent = ''
each j in i.equipment_list
- let details = ''
-
if (j.details_link) {
details = `<a href="${j.details_link}" title="本站关于 ${j.name} 的产品体验报告" target="_blank" rel="external nofollow">查看文章</a>`
} else if (j.details_flink) {
details = `<a href="${j.details_flink}" title="跳转到 ${j.name} 的产品详情" target="_blank" rel="external nofollow">详情</a>`
}
listContent += `
<div class="icat-equipment-box">
<img src="${j.image}">
<div class="icat-equipment-content">
<div class="icat-equipment-name">${j.name}</div>
<div class="icat-equipment-custom">${j.custom}</div>
<div class="icat-equipment-opinion">${j.opinion}</div>
<div class="icat-equipment-box-more">
${details}
<div class="icat-bber-reply" onclick="icatequipment.commentText('${j.name} (${j.custom})')">
<i class="iconfont icat-message"></i>
</div>
</div>
</div>
</div>`
-
- listResult += `<div class="equipment">${listContent}</div>`
- result += listResult
!= result + page.content
  • 如若没有添加过即刻短文页的js,那么就需要在equipment.pug页面第一行增加以下内容。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
+script.
+ var icatequipment = {
+ replaceAll: function (e, n, t) {
+ return e.split(n).join(t);
+ },
+ commentText: function(e) {
+ if (e == "undefined" || e == "null") e = "好棒!";
+ var n = document.getElementsByClassName("el-textarea__inner")[0],
+ t = document.createEvent("HTMLEvents");
+ if (!n) return;
+ t.initEvent("input", !0, !0);
+ var o = icatequipment.replaceAll(e, "\n", "\n> ");
+ (n.value = "> " + o + "\n\n"), n.dispatchEvent(t);
+ var i = document.querySelector("#post-comment")
+ .offsetTop;
+ window.scrollTo(0, i - 80),
+ n.focus(),
+ n.setSelectionRange(-1, -1),
+ document.getElementById("comment-tips") && document.getElementById("comment-tips")
+ .classList.add("show");
+ }
+ }

#icat-equipment
- var result = ''
each i in site.data.equipment

···
  • 新建[blogRoot]/source/css/equipment.css样式文件,并新增以下内容。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#icat-equipment > h2 {
margin: 20px 7px 0;
}
#icat-equipment .equipment-desc {
margin: 0 7px;
color: var(--icat-secondtext);
}
#icat-equipment {
padding-bottom: 12px;
}
#icat-equipment .equipment {
display: flex;
flex-wrap: wrap;
padding: 10px 0 0;
gap: 16px;
}


#icat-equipment .equipment > .icat-equipment-box {
border: 1px solid var(--icat-secondbg);
background: var(--icat-card-bg);
width: calc(100% / 4 - 12px);
border-radius: 12px;
overflow: hidden;
}
#icat-equipment .equipment .icat-equipment-box img {
min-width: 100%;
max-width: 100%;
height: 200px;
object-fit: cover;
animation:fadeIn 1s;
cursor:pointer;
transition:all .4s ease-in-out;
}
#icat-equipment .equipment .icat-equipment-box img:hover {
transform:scale(1.03);
}
#icat-equipment .equipment .icat-equipment-box .icat-equipment-content {
padding: 16px;
}
#icat-equipment .equipment .icat-equipment-box .icat-equipment-content .icat-equipment-name {
color: var(--icat-fontcolor);
font-size: 18px;
font-weight: bold;
line-height: 1;
margin-bottom: 8px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#icat-equipment .equipment .icat-equipment-box .icat-equipment-content .icat-equipment-custom {
font-size: 12px;
color: var(--icat-secondtext);
line-height: 1;
margin-bottom: 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#icat-equipment .equipment .icat-equipment-box .icat-equipment-content .icat-equipment-opinion {
line-height: 20px;
color: var(--icat-secondtext);
height: 60px;
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
margin-bottom: 16px;
}
#icat-equipment .equipment .icat-equipment-box .icat-equipment-content .icat-equipment-box-more {
display: flex;
justify-content: space-between;
}

#icat-equipment .equipment .icat-equipment-box .icat-equipment-content .icat-equipment-box-more a {
font-size: 12px;
background: var(--icat-gray-op);
color: var(--icat-fontcolor);
padding: 4px 12px;
border-radius: 6px;
letter-spacing: 1px;
}
#icat-equipment .equipment .icat-equipment-box .icat-equipment-content .icat-equipment-box-more a:hover {
color: var(--icat-white);
background: var(--icat-blue);
box-shadow: 0 8px 16px -4px var(--icat-black-op);
}


@media screen and (max-width: 900px) {
#icat-equipment .equipment {
gap: 10px;
}
#icat-equipment .equipment > .icat-equipment-box {
width: calc(100% / 3 - 7px);
}
}
@media screen and (max-width: 768px) {
#icat-equipment .equipment {
gap: 8px;
}
#icat-equipment .equipment > .icat-equipment-box {
width: 100%;
}
#icat-equipment .equipment .icat-equipment-box img {
height: 220px;
}
}



  • _config.butterfly.yml主题配置文件中inject下的head引入equipment.css
1
2
3
4
5
6
7
8
9
  ···

inject:
head:
- <link rel="stylesheet" href="/css/equipment.css">
bottom:
- ···

···
  • 创建[blogRoot]/source/_data/equipment.yml文件,并新增以下内容。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
- class_name: 日常生产力
class_desc: 平常生活、工作增添效率的产品
equipment_list:
- name: iPhone XR
custom: 主力 | 128G
opinion: 吸引我的第一点就是珊瑚橙,其次就是当初的性价比,算是跨越性机型吧;特别喜欢裸机的手感,尺寸厚薄等方面也刚刚好,习惯性选手。
details_flink: https://www.apple.com.cn/
image: https://s11.ax1x.com/2023/06/07/pCiB3vD.jpg

- name: iPhone 7
custom: 备用 | 128G
opinion: 学生时代的独宠,在当时性能方面也是能轻易吊打新生代们的;修修换换许多次,现在依然顽强的战斗着。
details_link: https://www.apple.com.cn/
image: https://s11.ax1x.com/2023/06/07/pCiBYbd.jpg

使用参数

参数 描述 优先级 默认值
name 产品名称 必填 /
custom 产品注释 可自定义内容 必填 /
opinion 产品评价 必填 /
details_flink 产品详情链接 站外 选填 details_link 二选一,必须填其中一个
details_link 产品详情链接 站内 选填 暂未适配pjax
image 产品图片 必填 /

更新历史

  • 231107更新:@林子书 提醒,补充一个缺失的replaceAll函数

  • 230607更新:现采用yml数据结构,预计适配json以及memos

Butterfly的魔改教程:好物推荐页

此文章版权归 MeuiCat 所有,完整转载,请注明来源!