几周前,我发布了我的“2020年最棒的小玩意”,但有人多次要求我列出我今年最常用的小玩意。
好吧,但我警告你,上面有一些苹果产品。
我将把这个列表分成几个有用的类别
必须阅读:iPhone iOS 14:三种保证提高电池续航能力的方法href=“https://www.amazon.com/Gear4-Advanced-Protection-Protected-Ultra-Durable/dp/b07hkr4z9?tag=zdnet-deals-20“rel=”noopener noreferrer nofollow“target=”unu blank“data component=”externalLink“>GEAR4 D3O排案例。屏幕上有一个小划痕,但除此之外,它是一个坚固可靠的单元。
它们看起来有点粗糙(因为它们多次掉在地板上),但它们很漂亮很舒服,别在上面装一个愚蠢的发光二极管。
我把AirPods Pro的盒子放在aSpigen坚固的保护套。我的钥匙上有一个这样的生命。我有几个其他人在不同的小工具上。
我已经用我的Yubikey保证了每个账户的安全。我的钥匙上有一个,我还有几个关于这个地方的信息。
我的日常司机。已经使用了很多小时,而且非常可靠。我再也看不到自己回到Windows笔记本电脑上了。
这已经成为我的台式机充电器的首选,使我的办公桌比插上四个充电器时少了一点整洁。
住在我的办公桌上,但也伴随着我去冒险。集线器配有一个4K USB-C到HDMI、一个100W电源传输USB-C端口、一个USB-C数据端口、microSD/SD卡读卡器插槽和两个USB 3.0端口。
我一直在这上面使用热敏摄像头。这是一款很棒的工具,也是一款不错的安卓10智能手机。
如果我不是iPhone用户,这将是我的日常驱动程序。
一个笨重的电源库。口袋里有点大,但我通常把它放在我的装备背包里。
当我需要带空调出去走走的时候,这是我在2020年大部分时间里一直在使用的动力站。大到可以给我一个很好的功率,但小到不会成为负担。
最佳怪异礼物:古怪但有用的小工具和装备
a, .nav-item > a, .dropdown-menu a');
allLinks.forEach(link => {
let href = link.getAttribute('href');
if (!href || href === '#' || href === 'javascript:;') return;
// 4. 提取菜单中的核心路径
// 例如 /articles.html -> articles
let cleanHref = href.replace(/^\/|\/$/g, '').replace(/\.(html|php)$/, '').toLowerCase();
let isMatch = false;
// 5. 精确匹配逻辑
if (cleanHref === 'index') {
// 只有当前是首页时,才高亮首页
if (cleanPath === 'index') isMatch = true;
} else {
// 如果当前路径完全等于菜单路径 (如 /articles 匹配 /articles)
// 或者当前路径以 "菜单路径/" 开头 (如 /articles/154 匹配 /articles)
// 或者当前路径包含 "菜单路径." (防某些带点号的特殊情况)
if (cleanPath === cleanHref || cleanPath.startsWith(cleanHref + '/')) {
isMatch = true;
}
}
// 6. 如果匹配成功,加上高亮
if (isMatch) {
link.classList.add('active');
// 如果匹配的是下拉菜单里的子项,顺便把它的父级分类也高亮
const parentNavItem = link.closest('.nav-item');
if (parentNavItem && !parentNavItem.classList.contains('active')) {
const parentLink = parentNavItem.querySelector('a');
if (parentLink) parentLink.classList.add('active');
}
}
});
})();
// ================= 移动端菜单逻辑 =================
const toggle = document.getElementById("menuToggle");
const nav = document.getElementById("navLinks");
// 1. 汉堡按钮:切换主菜单显示/隐藏
if (toggle && nav) {
toggle.addEventListener("click", function (e) {
e.stopPropagation();
const expanded = this.getAttribute("aria-expanded") === "true";
this.setAttribute("aria-expanded", String(!expanded));
nav.classList.toggle("active");
});
}
// 2. 处理下拉子菜单的展开/折叠
if (window.innerWidth <= 768) {
const navItems = document.querySelectorAll(".nav-item");
navItems.forEach((item) => {
const titleLink = item.querySelector("a");
const dropdownMenu = item.querySelector(".dropdown-menu");
const arrowIcon = item.querySelector(".arrow-icon");
if (titleLink && dropdownMenu) {
titleLink.addEventListener("click", function (e) {
e.preventDefault(); // 阻止链接跳转
e.stopPropagation();
// 手风琴效果:收起其他已展开的菜单
navItems.forEach((otherItem) => {
if (otherItem !== item) {
const otherMenu = otherItem.querySelector(".dropdown-menu");
const otherArrow = otherItem.querySelector(".arrow-icon");
if (otherMenu) otherMenu.classList.remove("active");
if (otherArrow) otherArrow.style.transform = "rotate(0)";
}
});
// 切换当前菜单
dropdownMenu.classList.toggle("active");
if (arrowIcon) {
arrowIcon.style.transform = dropdownMenu.classList.contains(
"active",
)
? "rotate(180deg)"
: "rotate(0)";
}
});
}
});
}
// 3. 点击普通菜单项后,自动关闭整个主菜单
if (nav) {
nav.querySelectorAll("a").forEach(function (link) {
if (!link.querySelector(".arrow-icon")) {
link.addEventListener("click", function () {
nav.classList.remove("active");
if (toggle) toggle.setAttribute("aria-expanded", "false");
});
}
});
}
// ================= 返回顶部逻辑 =================
(function () {
const backToTop = document.getElementById("backToTop");
window.addEventListener("scroll", function () {
if (window.scrollY > 300) {
backToTop.classList.add("show");
} else {
backToTop.classList.remove("show");
}
});
backToTop.addEventListener("click", function () {
window.scrollTo({ top: 0, behavior: "smooth" });
});
})();
// 多语言
document.addEventListener("DOMContentLoaded", function() {
let path = window.location.pathname;
let isEn = path.startsWith('/en/');
if (isEn) {
document.cookie = "my_lang=en; path=/; max-age=" + (30 * 24 * 3600);
} else {
document.cookie = "my_lang=zh; path=/; max-age=" + (30 * 24 * 3600);
}
// 【2. 首页记忆】如果访问的是首页(没带 en),但记忆是英文,前端自动跳去英文首页
if (!isEn && (path === '/' || path === '/index.html')) {
if (document.cookie.includes('my_lang=en')) {
window.location.replace('/en' + path);
return;
}
}
// 【3. 菜单不掉线】如果是英文页面,自动给菜单链接加上 /en/
if (isEn) {
document.querySelectorAll('a').forEach(function(link) {
let href = link.getAttribute('href');
// 站内链接,且没带 /en/
if (href && href.startsWith('/') && !href.startsWith('/en/') && !href.startsWith('http')) {
link.setAttribute('href', '/en' + href);
}
});
}
});