-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
const cards = document.querySelectorAll('.grid [data-config]'); | ||
|
||
cards.forEach(card => { | ||
card.addEventListener('click', () => { | ||
const configValue = card.getAttribute('data-config'); | ||
|
||
if (navigator.clipboard && navigator.clipboard.writeText) { | ||
navigator.clipboard.writeText(configValue) | ||
.then(() => { | ||
Swal.fire({ | ||
icon: 'success', | ||
title: '复制成功', | ||
showConfirmButton: false, | ||
timer: 1000 | ||
}); | ||
}) | ||
.catch(err => { | ||
fallbackCopyTextToClipboard(configValue); | ||
}); | ||
} else { | ||
fallbackCopyTextToClipboard(configValue); | ||
} | ||
}); | ||
}); | ||
|
||
function fallbackCopyTextToClipboard(text) { | ||
const textarea = document.createElement('textarea'); | ||
textarea.value = text; | ||
textarea.style.position = 'fixed'; | ||
document.body.appendChild(textarea); | ||
|
||
textarea.focus(); | ||
textarea.select(); | ||
|
||
try { | ||
const successful = document.execCommand('copy'); | ||
const msg = successful ? 'successful' : 'unsuccessful'; | ||
console.log('Fallback: Copying text command was ' + msg); | ||
if (successful) { | ||
Swal.fire({ | ||
icon: 'success', | ||
title: '复制成功', | ||
showConfirmButton: false, | ||
timer: 1000 | ||
}); | ||
} else { | ||
Swal.fire({ | ||
icon: 'error', | ||
title: '复制失败', | ||
showConfirmButton: false, | ||
timer: 1000 | ||
}); | ||
} | ||
} catch (err) { | ||
console.error('Fallback: Oops, unable to copy', err); | ||
Swal.fire({ | ||
icon: 'error', | ||
title: '复制失败', | ||
showConfirmButton: false, | ||
timer: 1000 | ||
}); | ||
} | ||
|
||
document.body.removeChild(textarea); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* 样式用于折叠超过3个导航项 */ | ||
.hidden-nav-items { | ||
display: none; | ||
} | ||
|
||
/* 样式用于显示超级导航列表窗口 */ | ||
#navListContainer { | ||
position: absolute; | ||
top: 100%; | ||
left: 0; | ||
right: 0; | ||
background-color: white; | ||
border: 1px solid #ccc; | ||
z-index: 9999; | ||
} | ||
|
||
/* 样式用于导航列表容器 */ | ||
#navListContainer .container { | ||
max-width: 800px; | ||
} | ||
|
||
/* 样式用于超级导航列表项 */ | ||
#navList a { | ||
display: block; | ||
width: calc(33.33% - 8px); | ||
margin: 4px; | ||
padding: 8px; | ||
text-align: center; | ||
background-color: #f9f9f9; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// JavaScript 代码用于折叠和展开导航项 | ||
document.addEventListener("DOMContentLoaded", function() { | ||
var navbar = document.getElementById("navbar"); | ||
var navItems = navbar.children; | ||
var moreBtn = document.getElementById("moreBtn"); | ||
var navListContainer = document.getElementById("navListContainer"); | ||
var navList = document.getElementById("navList"); | ||
|
||
if (navItems.length > 3) { | ||
// 超过3个导航项时进行折叠 | ||
for (var i = 3; i < navItems.length; i++) { | ||
navItems[i].classList.add("hidden-nav-items"); | ||
} | ||
|
||
// 显示更多按钮 | ||
moreBtn.style.display = "inline-block"; | ||
|
||
// 更多按钮点击事件 | ||
moreBtn.addEventListener("click", function() { | ||
// 显示超级导航列表窗口 | ||
navListContainer.classList.toggle("hidden"); | ||
|
||
// 构建导航项列表 | ||
navList.innerHTML = ""; | ||
for (var i = 3; i < navItems.length; i++) { | ||
var clonedNavItem = navItems[i].cloneNode(true); | ||
navList.appendChild(clonedNavItem); | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var swiper = new Swiper('.swiper-container', { | ||
slidesPerView: 1, | ||
spaceBetween: 10, | ||
loop: true, | ||
pagination: { | ||
el: '.swiper-pagination', | ||
clickable: true, | ||
}, autoplay: { | ||
delay: 3000, // 设置轮播切换时间为3秒 | ||
}, | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.