mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-24 10:51:27 +00:00
Merge pull request #5 from nbtca/4-integrate-lint-check-to-commit-hook-and-action
Integrate lint check to commit hook and action
This commit is contained in:
commit
32d5204637
36 changed files with 21997 additions and 14919 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,7 +2,6 @@
|
|||
dist/
|
||||
# generated types
|
||||
.astro/
|
||||
.vscode/
|
||||
# dependencies
|
||||
node_modules/
|
||||
|
||||
|
|
|
|||
1
.husky/pre-commit
Normal file
1
.husky/pre-commit
Normal file
|
|
@ -0,0 +1 @@
|
|||
npx lint-staged
|
||||
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"astro", // Enable .astro
|
||||
"typescript", // Enable .ts
|
||||
"typescriptreact" // Enable .tsx
|
||||
],
|
||||
"eslint.experimental.useFlatConfig": true,
|
||||
}
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
import { defineConfig } from "astro/config"
|
||||
import { visit } from "unist-util-visit"
|
||||
import md5 from "md5"
|
||||
import { SITE_URL } from "./src/consts"
|
||||
import vue from "@astrojs/vue"
|
||||
import tailwind from "@astrojs/tailwind"
|
||||
|
|
@ -21,7 +19,7 @@ function pipeline() {
|
|||
// size = data[1]
|
||||
// }
|
||||
// let classes = [
|
||||
// "image component image-fullbleed body-copy-wide nr-scroll-animation nr-scroll-animation--on",
|
||||
// "image component image-full-bleed body-copy-wide nr-scroll-animation nr-scroll-animation--on",
|
||||
// ]
|
||||
// classes.push(`image-${size}`)
|
||||
// node.properties.className = classes
|
||||
|
|
@ -37,7 +35,7 @@ function pipeline() {
|
|||
// type: "element",
|
||||
// tagName: "div",
|
||||
// properties: {
|
||||
// className: ["image-sharesheet"],
|
||||
// className: ["image-share-sheet"],
|
||||
// },
|
||||
// children: [
|
||||
// {
|
||||
|
|
@ -103,26 +101,26 @@ function pipeline() {
|
|||
() => (tree) => {
|
||||
tree.children.forEach((node) => {
|
||||
if (node.type === "raw") {
|
||||
node.value = `<div class="pagebody code component"><div class="component-content code"> ${node.value} </div></div>`
|
||||
node.value = `<div class="page-body code component"><div class="component-content code"> ${node.value} </div></div>`
|
||||
// node.value = node.value.replace(/astro-code/g, 'astro-code')
|
||||
}
|
||||
})
|
||||
},
|
||||
() => (tree) => {
|
||||
for (let i = 0; i < tree.children.length; i++) {
|
||||
let node = tree.children[i]
|
||||
const node = tree.children[i]
|
||||
if (
|
||||
node.type === "element" &&
|
||||
["p", "h1", "h2", "h3", "h4", "h5", "h6", "table"].includes(
|
||||
node.tagName
|
||||
node.type === "element"
|
||||
&& ["p", "h1", "h2", "h3", "h4", "h5", "h6", "table"].includes(
|
||||
node.tagName,
|
||||
)
|
||||
) {
|
||||
let next = tree.children[i + 1]
|
||||
let nodes = [node]
|
||||
const nodes = [node]
|
||||
while (
|
||||
next &&
|
||||
!["figure"].includes(next.tagName) &&
|
||||
next.type != "raw"
|
||||
next
|
||||
&& !["figure"].includes(next.tagName)
|
||||
&& next.type != "raw"
|
||||
) {
|
||||
nodes.push(next)
|
||||
next = tree.children[tree.children.indexOf(next) + 1]
|
||||
|
|
@ -131,18 +129,18 @@ function pipeline() {
|
|||
// rename label
|
||||
nodes.forEach((node) => {
|
||||
if (node.tagName === "p") {
|
||||
node.properties.className = ["pagebody-copy"]
|
||||
node.properties.className = ["page-body-copy"]
|
||||
node.tagName = "div"
|
||||
}
|
||||
if (["h1", "h2", "h3", "h4", "h5", "h6"].includes(node.tagName)) {
|
||||
node.properties.className = ["pagebody-header"]
|
||||
node.properties.className = ["page-body-header"]
|
||||
}
|
||||
})
|
||||
tree.children.splice(i, nodes.length, {
|
||||
type: "element",
|
||||
tagName: "div",
|
||||
properties: {
|
||||
className: ["pagebody text component"],
|
||||
className: ["page-body text component"],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
|
@ -160,15 +158,15 @@ function pipeline() {
|
|||
}
|
||||
},
|
||||
() => (tree) => {
|
||||
let len = tree.children.length
|
||||
const len = tree.children.length
|
||||
for (let index = 0; index < len; index++) {
|
||||
let node = tree.children[index]
|
||||
const node = tree.children[index]
|
||||
if (node.type === "element" && node.tagName === "figure") {
|
||||
tree.children.splice(index, 0, {
|
||||
type: "element",
|
||||
tagName: "div",
|
||||
properties: {
|
||||
className: ["tertiarynav component"],
|
||||
className: ["tertiary-nav component"],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
|
|
|||
17
cspell.json
Normal file
17
cspell.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
|
||||
"version": "0.2",
|
||||
"ignorePaths": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
],
|
||||
"words": [
|
||||
"astro",
|
||||
"astrojs",
|
||||
"frontmatter",
|
||||
"NBTCA",
|
||||
"m_lfit",
|
||||
"N3ptune",
|
||||
"rehypePlugins"
|
||||
]
|
||||
}
|
||||
50
eslint.config.js
Normal file
50
eslint.config.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import globals from "globals"
|
||||
import eslint from "@eslint/js"
|
||||
import eslintPluginAstro from "eslint-plugin-astro"
|
||||
import stylistic from "@stylistic/eslint-plugin"
|
||||
import cspellESLintPluginRecommended from "@cspell/eslint-plugin/recommended"
|
||||
|
||||
export default [
|
||||
eslint.configs.recommended,
|
||||
cspellESLintPluginRecommended,
|
||||
...eslintPluginAstro.configs.recommended,
|
||||
stylistic.configs.customize({
|
||||
indent: 2,
|
||||
quotes: "double",
|
||||
semi: false,
|
||||
jsx: true,
|
||||
}),
|
||||
{
|
||||
files: ["*.{ts,tsx}"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
},
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
"@stylistic": stylistic,
|
||||
},
|
||||
rules: {
|
||||
"@stylistic/jsx-one-expression-per-line": ["off"],
|
||||
"@cspell/spellchecker": [
|
||||
"warn",
|
||||
{
|
||||
configFile: new URL("./cspell.json", import.meta.url).toString(),
|
||||
},
|
||||
],
|
||||
"prefer-const": [
|
||||
"error",
|
||||
{
|
||||
destructuring: "any",
|
||||
ignoreReadBeforeAssign: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ["dist/**/*", "public/**/*", "node_modules/**/*"],
|
||||
},
|
||||
]
|
||||
33025
package-lock.json
generated
33025
package-lock.json
generated
File diff suppressed because it is too large
Load diff
85
package.json
85
package.json
|
|
@ -1,34 +1,53 @@
|
|||
{
|
||||
"name": "blog",
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/react": "^3.3.1",
|
||||
"@astrojs/rss": "^4.0.5",
|
||||
"@astrojs/tailwind": "^5.1.0",
|
||||
"@astrojs/vue": "^4.0.9",
|
||||
"@fullcalendar/core": "^6.1.11",
|
||||
"@fullcalendar/daygrid": "^6.1.11",
|
||||
"@fullcalendar/icalendar": "^6.1.11",
|
||||
"@fullcalendar/react": "^6.1.11",
|
||||
"@types/react": "^18.2.79",
|
||||
"@types/react-dom": "^18.2.25",
|
||||
"astro": "^4.5.12",
|
||||
"ical.js": "^1.5.0",
|
||||
"md5": "^2.3.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"rehype": "^13.0.1",
|
||||
"sharp": "^0.33.3",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"vue": "^3.4.21"
|
||||
}
|
||||
}
|
||||
"name": "blog",
|
||||
"type": "module",
|
||||
"version": "0.0.1",
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"lint": "eslint",
|
||||
"astro": "astro",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/react": "^3.3.1",
|
||||
"@astrojs/rss": "^4.0.5",
|
||||
"@astrojs/tailwind": "^5.1.0",
|
||||
"@astrojs/vue": "^4.0.9",
|
||||
"@fullcalendar/core": "^6.1.11",
|
||||
"@fullcalendar/daygrid": "^6.1.11",
|
||||
"@fullcalendar/icalendar": "^6.1.11",
|
||||
"@fullcalendar/react": "^6.1.11",
|
||||
"@stylistic/eslint-plugin": "^2.1.0",
|
||||
"astro": "^4.5.12",
|
||||
"ical.js": "^1.5.0",
|
||||
"md5": "^2.3.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"rehype": "^13.0.1",
|
||||
"sharp": "^0.33.3",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"vue": "^3.4.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cspell/eslint-plugin": "^8.8.1",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"@types/react": "^18.2.79",
|
||||
"@types/react-dom": "^18.2.25",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-astro": "^1.2.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"globals": "^15.2.0",
|
||||
"husky": "^9.0.11",
|
||||
"lint-staged": "^15.2.2",
|
||||
"typescript": "^5.4.5",
|
||||
"typescript-eslint": "^7.9.0"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,mjs,ts,tsx,mts,astro}": "eslint --fix"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +1,76 @@
|
|||
var animationElements = [];
|
||||
var imageElements = [];
|
||||
var animationElementName = ".small-load";
|
||||
|
||||
var animationElements = []
|
||||
var imageElements = []
|
||||
var animationElementName = ".small-load"
|
||||
|
||||
// Hookable function
|
||||
var loadAnimation = function (item) {
|
||||
let img = new Image();
|
||||
img.src = item.children[0].children[0].dataset.src;
|
||||
const img = new Image()
|
||||
img.src = item.children[0].children[0].dataset.src
|
||||
img.onload = function () {
|
||||
item.classList.remove("small-load", "medium-load", "large-load");
|
||||
item.classList.add("small-loaded", "medium-loaded", "large-loaded");
|
||||
item.classList.remove("small-load", "medium-load", "large-load")
|
||||
item.classList.add("small-loaded", "medium-loaded", "large-loaded")
|
||||
}
|
||||
}
|
||||
|
||||
// Hookable function
|
||||
var loadImage = function (index) {
|
||||
if (index >= imageElements.length) return;
|
||||
let item = imageElements[index];
|
||||
let image = new Image();
|
||||
item.src = item.dataset.src;
|
||||
image.src = item.src;
|
||||
if (index >= imageElements.length) return
|
||||
const item = imageElements[index]
|
||||
const image = new Image()
|
||||
item.src = item.dataset.src
|
||||
image.src = item.src
|
||||
image.onload = function () {
|
||||
loadImage(index + 1);
|
||||
loadImage(index + 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initImage() {
|
||||
// get all the images with data-src attribute
|
||||
imageElements = document.querySelectorAll('img[data-src]')
|
||||
imageElements = document.querySelectorAll("img[data-src]")
|
||||
// load the images one by one
|
||||
loadImage(0);
|
||||
loadImage(0)
|
||||
|
||||
|
||||
animationElements = document.querySelectorAll(animationElementName);
|
||||
animationElements = document.querySelectorAll(animationElementName)
|
||||
// load the images which are in the viewport
|
||||
viewPortLoad(0);
|
||||
const debouncedHandleScroll = debounce(lazyAnimation, 10);
|
||||
viewPortLoad(0)
|
||||
const debouncedHandleScroll = debounce(lazyAnimation, 10)
|
||||
// add the event listener
|
||||
window.addEventListener('scroll', debouncedHandleScroll);
|
||||
window.addEventListener("scroll", debouncedHandleScroll)
|
||||
}
|
||||
|
||||
|
||||
function viewPortLoad(index) {
|
||||
if (index >= animationElements.length) return;
|
||||
let item = animationElements[index];
|
||||
if (index >= animationElements.length) return
|
||||
const item = animationElements[index]
|
||||
if (!isElementInView(item)) {
|
||||
viewPortLoad(index + 1)
|
||||
return;
|
||||
};
|
||||
return
|
||||
}
|
||||
|
||||
loadAnimation(item)
|
||||
viewPortLoad(index + 1);
|
||||
viewPortLoad(index + 1)
|
||||
}
|
||||
|
||||
|
||||
function lazyAnimation() {
|
||||
images = document.querySelectorAll(animationElementName);
|
||||
viewPortLoad(0);
|
||||
images = document.querySelectorAll(animationElementName)
|
||||
viewPortLoad(0)
|
||||
}
|
||||
|
||||
|
||||
// check if the element is in the viewport
|
||||
function isElementInView(element) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
const elementTop = rect.top;
|
||||
const elementBottom = rect.bottom;
|
||||
return (elementTop >= 0 && elementBottom - 200 <= window.innerHeight);
|
||||
const rect = element.getBoundingClientRect()
|
||||
const elementTop = rect.top
|
||||
const elementBottom = rect.bottom
|
||||
return (elementTop >= 0 && elementBottom - 200 <= window.innerHeight)
|
||||
}
|
||||
|
||||
function debounce(fn, delay) {
|
||||
let timer = null;
|
||||
let timer = null
|
||||
return function () {
|
||||
let context = this;
|
||||
let args = arguments;
|
||||
clearTimeout(timer);
|
||||
const context = this
|
||||
const args = arguments
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(function () {
|
||||
fn.apply(context, args);
|
||||
}, delay);
|
||||
};
|
||||
fn.apply(context, args)
|
||||
}, delay)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,65 +1,62 @@
|
|||
|
||||
console.log("postInit.js loaded");
|
||||
var scriptMd5 = document.createElement("script");
|
||||
scriptMd5.src = "/static/js/md5.js";
|
||||
document.head.appendChild(scriptMd5);
|
||||
console.log("postInit.js loaded")
|
||||
var scriptMd5 = document.createElement("script")
|
||||
scriptMd5.src = "/static/js/md5.js"
|
||||
document.head.appendChild(scriptMd5)
|
||||
|
||||
scriptMd5.onload = function () {
|
||||
console.log("md5.js loaded")
|
||||
// step1. sythx highlighting
|
||||
syntaxHighlight();
|
||||
syntaxHighlight()
|
||||
// step2. lazyload
|
||||
initLazyLoad();
|
||||
initLazyLoad()
|
||||
}
|
||||
|
||||
function initLazyLoad() {
|
||||
var script = document.createElement("script");
|
||||
script.src = "/static/js/animation.js";
|
||||
document.head.appendChild(script);
|
||||
var script = document.createElement("script")
|
||||
script.src = "/static/js/animation.js"
|
||||
document.head.appendChild(script)
|
||||
|
||||
script.onload = function () {
|
||||
console.log("lazyload.js loaded");
|
||||
console.log("lazyload.js loaded")
|
||||
|
||||
animationElementName = ".image-load";
|
||||
animationElementName = ".image-load"
|
||||
|
||||
// Hook the loadImage function
|
||||
loadImage = (index) => {
|
||||
if (index >= imageElements.length) return;
|
||||
|
||||
let image = imageElements[index];
|
||||
image.src = image.dataset.src;
|
||||
let img = new Image();
|
||||
img.src = image.src;
|
||||
if (index >= imageElements.length) return
|
||||
|
||||
const image = imageElements[index]
|
||||
image.src = image.dataset.src
|
||||
const img = new Image()
|
||||
img.src = image.src
|
||||
img.onload = function () {
|
||||
loadImage(index + 1);
|
||||
};
|
||||
loadImage(index + 1)
|
||||
}
|
||||
}
|
||||
|
||||
loadAnimation = (item) => {
|
||||
let grandSon = item.firstChild.firstChild;
|
||||
let img = new Image();
|
||||
img.src = grandSon.src;
|
||||
let sign = md5(grandSon.src);
|
||||
const grandSon = item.firstChild.firstChild
|
||||
const img = new Image()
|
||||
img.src = grandSon.src
|
||||
const sign = md5(grandSon.src)
|
||||
|
||||
img.onload = function () {
|
||||
let percent = ((img.height / img.width) * 100).toFixed(5);
|
||||
var style = document.createElement("style");
|
||||
style.innerHTML = renderStyle(sign, percent);
|
||||
let target = document.getElementById(`lht${sign}`)
|
||||
const percent = ((img.height / img.width) * 100).toFixed(5)
|
||||
var style = document.createElement("style")
|
||||
style.innerHTML = renderStyle(sign, percent)
|
||||
const target = document.getElementById(`lht${sign}`)
|
||||
|
||||
if (!target) return;
|
||||
target.parentNode.insertBefore(style, target);
|
||||
item.classList.remove("image-load");
|
||||
item.classList.add("image-loaded");
|
||||
if (!target) return
|
||||
target.parentNode.insertBefore(style, target)
|
||||
item.classList.remove("image-load")
|
||||
item.classList.add("image-loaded")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
initImage();
|
||||
};
|
||||
initImage()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function renderStyle(sign, percent) {
|
||||
return `
|
||||
.image-${sign} {
|
||||
|
|
@ -86,28 +83,29 @@ function renderStyle(sign, percent) {
|
|||
}
|
||||
|
||||
function syntaxHighlight() {
|
||||
var script = document.createElement("script");
|
||||
script.src = "/static/js/hljs.js";
|
||||
document.head.appendChild(script);
|
||||
var script = document.createElement("script")
|
||||
script.src = "/static/js/hljs.js"
|
||||
document.head.appendChild(script)
|
||||
|
||||
var styleLight = document.createElement("link");
|
||||
styleLight.rel = "stylesheet";
|
||||
styleLight.href = "/static/css/stackoverflow-light.min.css";
|
||||
var styleLight = document.createElement("link")
|
||||
styleLight.rel = "stylesheet"
|
||||
styleLight.href = "/static/css/stackoverflow-light.min.css"
|
||||
|
||||
var styleDark = document.createElement("link");
|
||||
styleDark.rel = "stylesheet";
|
||||
styleDark.href = "/static/css/stackoverflow-dark.min.css";
|
||||
var styleDark = document.createElement("link")
|
||||
styleDark.rel = "stylesheet"
|
||||
styleDark.href = "/static/css/stackoverflow-dark.min.css"
|
||||
|
||||
if (document.querySelector("body").classList.contains("theme-dark")) {
|
||||
document.head.appendChild(styleDark);
|
||||
} else {
|
||||
document.head.appendChild(styleLight);
|
||||
document.head.appendChild(styleDark)
|
||||
}
|
||||
else {
|
||||
document.head.appendChild(styleLight)
|
||||
}
|
||||
|
||||
script.onload = function () {
|
||||
console.log("hljs.js loaded");
|
||||
console.log("hljs.js loaded")
|
||||
document.querySelectorAll("pre code").forEach(function (block) {
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
};
|
||||
hljs.highlightBlock(block)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,121 +1,120 @@
|
|||
function md5cycle(x, k) {
|
||||
var a = x[0], b = x[1], c = x[2], d = x[3];
|
||||
var a = x[0], b = x[1], c = x[2], d = x[3]
|
||||
|
||||
a = ff(a, b, c, d, k[0], 7, -680876936);
|
||||
d = ff(d, a, b, c, k[1], 12, -389564586);
|
||||
c = ff(c, d, a, b, k[2], 17, 606105819);
|
||||
b = ff(b, c, d, a, k[3], 22, -1044525330);
|
||||
a = ff(a, b, c, d, k[4], 7, -176418897);
|
||||
d = ff(d, a, b, c, k[5], 12, 1200080426);
|
||||
c = ff(c, d, a, b, k[6], 17, -1473231341);
|
||||
b = ff(b, c, d, a, k[7], 22, -45705983);
|
||||
a = ff(a, b, c, d, k[8], 7, 1770035416);
|
||||
d = ff(d, a, b, c, k[9], 12, -1958414417);
|
||||
c = ff(c, d, a, b, k[10], 17, -42063);
|
||||
b = ff(b, c, d, a, k[11], 22, -1990404162);
|
||||
a = ff(a, b, c, d, k[12], 7, 1804603682);
|
||||
d = ff(d, a, b, c, k[13], 12, -40341101);
|
||||
c = ff(c, d, a, b, k[14], 17, -1502002290);
|
||||
b = ff(b, c, d, a, k[15], 22, 1236535329);
|
||||
a = ff(a, b, c, d, k[0], 7, -680876936)
|
||||
d = ff(d, a, b, c, k[1], 12, -389564586)
|
||||
c = ff(c, d, a, b, k[2], 17, 606105819)
|
||||
b = ff(b, c, d, a, k[3], 22, -1044525330)
|
||||
a = ff(a, b, c, d, k[4], 7, -176418897)
|
||||
d = ff(d, a, b, c, k[5], 12, 1200080426)
|
||||
c = ff(c, d, a, b, k[6], 17, -1473231341)
|
||||
b = ff(b, c, d, a, k[7], 22, -45705983)
|
||||
a = ff(a, b, c, d, k[8], 7, 1770035416)
|
||||
d = ff(d, a, b, c, k[9], 12, -1958414417)
|
||||
c = ff(c, d, a, b, k[10], 17, -42063)
|
||||
b = ff(b, c, d, a, k[11], 22, -1990404162)
|
||||
a = ff(a, b, c, d, k[12], 7, 1804603682)
|
||||
d = ff(d, a, b, c, k[13], 12, -40341101)
|
||||
c = ff(c, d, a, b, k[14], 17, -1502002290)
|
||||
b = ff(b, c, d, a, k[15], 22, 1236535329)
|
||||
|
||||
a = gg(a, b, c, d, k[1], 5, -165796510);
|
||||
d = gg(d, a, b, c, k[6], 9, -1069501632);
|
||||
c = gg(c, d, a, b, k[11], 14, 643717713);
|
||||
b = gg(b, c, d, a, k[0], 20, -373897302);
|
||||
a = gg(a, b, c, d, k[5], 5, -701558691);
|
||||
d = gg(d, a, b, c, k[10], 9, 38016083);
|
||||
c = gg(c, d, a, b, k[15], 14, -660478335);
|
||||
b = gg(b, c, d, a, k[4], 20, -405537848);
|
||||
a = gg(a, b, c, d, k[9], 5, 568446438);
|
||||
d = gg(d, a, b, c, k[14], 9, -1019803690);
|
||||
c = gg(c, d, a, b, k[3], 14, -187363961);
|
||||
b = gg(b, c, d, a, k[8], 20, 1163531501);
|
||||
a = gg(a, b, c, d, k[13], 5, -1444681467);
|
||||
d = gg(d, a, b, c, k[2], 9, -51403784);
|
||||
c = gg(c, d, a, b, k[7], 14, 1735328473);
|
||||
b = gg(b, c, d, a, k[12], 20, -1926607734);
|
||||
a = gg(a, b, c, d, k[1], 5, -165796510)
|
||||
d = gg(d, a, b, c, k[6], 9, -1069501632)
|
||||
c = gg(c, d, a, b, k[11], 14, 643717713)
|
||||
b = gg(b, c, d, a, k[0], 20, -373897302)
|
||||
a = gg(a, b, c, d, k[5], 5, -701558691)
|
||||
d = gg(d, a, b, c, k[10], 9, 38016083)
|
||||
c = gg(c, d, a, b, k[15], 14, -660478335)
|
||||
b = gg(b, c, d, a, k[4], 20, -405537848)
|
||||
a = gg(a, b, c, d, k[9], 5, 568446438)
|
||||
d = gg(d, a, b, c, k[14], 9, -1019803690)
|
||||
c = gg(c, d, a, b, k[3], 14, -187363961)
|
||||
b = gg(b, c, d, a, k[8], 20, 1163531501)
|
||||
a = gg(a, b, c, d, k[13], 5, -1444681467)
|
||||
d = gg(d, a, b, c, k[2], 9, -51403784)
|
||||
c = gg(c, d, a, b, k[7], 14, 1735328473)
|
||||
b = gg(b, c, d, a, k[12], 20, -1926607734)
|
||||
|
||||
a = hh(a, b, c, d, k[5], 4, -378558);
|
||||
d = hh(d, a, b, c, k[8], 11, -2022574463);
|
||||
c = hh(c, d, a, b, k[11], 16, 1839030562);
|
||||
b = hh(b, c, d, a, k[14], 23, -35309556);
|
||||
a = hh(a, b, c, d, k[1], 4, -1530992060);
|
||||
d = hh(d, a, b, c, k[4], 11, 1272893353);
|
||||
c = hh(c, d, a, b, k[7], 16, -155497632);
|
||||
b = hh(b, c, d, a, k[10], 23, -1094730640);
|
||||
a = hh(a, b, c, d, k[13], 4, 681279174);
|
||||
d = hh(d, a, b, c, k[0], 11, -358537222);
|
||||
c = hh(c, d, a, b, k[3], 16, -722521979);
|
||||
b = hh(b, c, d, a, k[6], 23, 76029189);
|
||||
a = hh(a, b, c, d, k[9], 4, -640364487);
|
||||
d = hh(d, a, b, c, k[12], 11, -421815835);
|
||||
c = hh(c, d, a, b, k[15], 16, 530742520);
|
||||
b = hh(b, c, d, a, k[2], 23, -995338651);
|
||||
a = hh(a, b, c, d, k[5], 4, -378558)
|
||||
d = hh(d, a, b, c, k[8], 11, -2022574463)
|
||||
c = hh(c, d, a, b, k[11], 16, 1839030562)
|
||||
b = hh(b, c, d, a, k[14], 23, -35309556)
|
||||
a = hh(a, b, c, d, k[1], 4, -1530992060)
|
||||
d = hh(d, a, b, c, k[4], 11, 1272893353)
|
||||
c = hh(c, d, a, b, k[7], 16, -155497632)
|
||||
b = hh(b, c, d, a, k[10], 23, -1094730640)
|
||||
a = hh(a, b, c, d, k[13], 4, 681279174)
|
||||
d = hh(d, a, b, c, k[0], 11, -358537222)
|
||||
c = hh(c, d, a, b, k[3], 16, -722521979)
|
||||
b = hh(b, c, d, a, k[6], 23, 76029189)
|
||||
a = hh(a, b, c, d, k[9], 4, -640364487)
|
||||
d = hh(d, a, b, c, k[12], 11, -421815835)
|
||||
c = hh(c, d, a, b, k[15], 16, 530742520)
|
||||
b = hh(b, c, d, a, k[2], 23, -995338651)
|
||||
|
||||
a = ii(a, b, c, d, k[0], 6, -198630844);
|
||||
d = ii(d, a, b, c, k[7], 10, 1126891415);
|
||||
c = ii(c, d, a, b, k[14], 15, -1416354905);
|
||||
b = ii(b, c, d, a, k[5], 21, -57434055);
|
||||
a = ii(a, b, c, d, k[12], 6, 1700485571);
|
||||
d = ii(d, a, b, c, k[3], 10, -1894986606);
|
||||
c = ii(c, d, a, b, k[10], 15, -1051523);
|
||||
b = ii(b, c, d, a, k[1], 21, -2054922799);
|
||||
a = ii(a, b, c, d, k[8], 6, 1873313359);
|
||||
d = ii(d, a, b, c, k[15], 10, -30611744);
|
||||
c = ii(c, d, a, b, k[6], 15, -1560198380);
|
||||
b = ii(b, c, d, a, k[13], 21, 1309151649);
|
||||
a = ii(a, b, c, d, k[4], 6, -145523070);
|
||||
d = ii(d, a, b, c, k[11], 10, -1120210379);
|
||||
c = ii(c, d, a, b, k[2], 15, 718787259);
|
||||
b = ii(b, c, d, a, k[9], 21, -343485551);
|
||||
|
||||
x[0] = add32(a, x[0]);
|
||||
x[1] = add32(b, x[1]);
|
||||
x[2] = add32(c, x[2]);
|
||||
x[3] = add32(d, x[3]);
|
||||
a = ii(a, b, c, d, k[0], 6, -198630844)
|
||||
d = ii(d, a, b, c, k[7], 10, 1126891415)
|
||||
c = ii(c, d, a, b, k[14], 15, -1416354905)
|
||||
b = ii(b, c, d, a, k[5], 21, -57434055)
|
||||
a = ii(a, b, c, d, k[12], 6, 1700485571)
|
||||
d = ii(d, a, b, c, k[3], 10, -1894986606)
|
||||
c = ii(c, d, a, b, k[10], 15, -1051523)
|
||||
b = ii(b, c, d, a, k[1], 21, -2054922799)
|
||||
a = ii(a, b, c, d, k[8], 6, 1873313359)
|
||||
d = ii(d, a, b, c, k[15], 10, -30611744)
|
||||
c = ii(c, d, a, b, k[6], 15, -1560198380)
|
||||
b = ii(b, c, d, a, k[13], 21, 1309151649)
|
||||
a = ii(a, b, c, d, k[4], 6, -145523070)
|
||||
d = ii(d, a, b, c, k[11], 10, -1120210379)
|
||||
c = ii(c, d, a, b, k[2], 15, 718787259)
|
||||
b = ii(b, c, d, a, k[9], 21, -343485551)
|
||||
|
||||
x[0] = add32(a, x[0])
|
||||
x[1] = add32(b, x[1])
|
||||
x[2] = add32(c, x[2])
|
||||
x[3] = add32(d, x[3])
|
||||
}
|
||||
|
||||
function cmn(q, a, b, x, s, t) {
|
||||
a = add32(add32(a, q), add32(x, t));
|
||||
return add32((a << s) | (a >>> (32 - s)), b);
|
||||
a = add32(add32(a, q), add32(x, t))
|
||||
return add32((a << s) | (a >>> (32 - s)), b)
|
||||
}
|
||||
|
||||
function ff(a, b, c, d, x, s, t) {
|
||||
return cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
||||
return cmn((b & c) | ((~b) & d), a, b, x, s, t)
|
||||
}
|
||||
|
||||
function gg(a, b, c, d, x, s, t) {
|
||||
return cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
||||
return cmn((b & d) | (c & (~d)), a, b, x, s, t)
|
||||
}
|
||||
|
||||
function hh(a, b, c, d, x, s, t) {
|
||||
return cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
return cmn(b ^ c ^ d, a, b, x, s, t)
|
||||
}
|
||||
|
||||
function ii(a, b, c, d, x, s, t) {
|
||||
return cmn(c ^ (b | (~d)), a, b, x, s, t);
|
||||
return cmn(c ^ (b | (~d)), a, b, x, s, t)
|
||||
}
|
||||
|
||||
function md51(s) {
|
||||
txt = '';
|
||||
var n = s.length,
|
||||
state = [1732584193, -271733879, -1732584194, 271733878], i;
|
||||
for (i=64; i<=s.length; i+=64) {
|
||||
md5cycle(state, md5blk(s.substring(i-64, i)));
|
||||
}
|
||||
s = s.substring(i-64);
|
||||
var tail = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
|
||||
for (i=0; i<s.length; i++)
|
||||
tail[i>>2] |= s.charCodeAt(i) << ((i%4) << 3);
|
||||
tail[i>>2] |= 0x80 << ((i%4) << 3);
|
||||
if (i > 55) {
|
||||
md5cycle(state, tail);
|
||||
for (i=0; i<16; i++) tail[i] = 0;
|
||||
}
|
||||
tail[14] = n*8;
|
||||
md5cycle(state, tail);
|
||||
return state;
|
||||
txt = ""
|
||||
var n = s.length,
|
||||
state = [1732584193, -271733879, -1732584194, 271733878], i
|
||||
for (i = 64; i <= s.length; i += 64) {
|
||||
md5cycle(state, md5blk(s.substring(i - 64, i)))
|
||||
}
|
||||
s = s.substring(i - 64)
|
||||
var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
for (i = 0; i < s.length; i++)
|
||||
tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3)
|
||||
tail[i >> 2] |= 0x80 << ((i % 4) << 3)
|
||||
if (i > 55) {
|
||||
md5cycle(state, tail)
|
||||
for (i = 0; i < 16; i++) tail[i] = 0
|
||||
}
|
||||
tail[14] = n * 8
|
||||
md5cycle(state, tail)
|
||||
return state
|
||||
}
|
||||
|
||||
/* there needs to be support for Unicode here,
|
||||
|
|
@ -134,35 +133,34 @@ return state;
|
|||
* 8-bit unsigned value arrays.
|
||||
*/
|
||||
function md5blk(s) { /* I figured global was faster. */
|
||||
var md5blks = [], i; /* Andy King said do it this way. */
|
||||
for (i=0; i<64; i+=4) {
|
||||
md5blks[i>>2] = s.charCodeAt(i)
|
||||
+ (s.charCodeAt(i+1) << 8)
|
||||
+ (s.charCodeAt(i+2) << 16)
|
||||
+ (s.charCodeAt(i+3) << 24);
|
||||
}
|
||||
return md5blks;
|
||||
var md5blks = [], i /* Andy King said do it this way. */
|
||||
for (i = 0; i < 64; i += 4) {
|
||||
md5blks[i >> 2] = s.charCodeAt(i)
|
||||
+ (s.charCodeAt(i + 1) << 8)
|
||||
+ (s.charCodeAt(i + 2) << 16)
|
||||
+ (s.charCodeAt(i + 3) << 24)
|
||||
}
|
||||
return md5blks
|
||||
}
|
||||
|
||||
var hex_chr = '0123456789abcdef'.split('');
|
||||
var hex_chr = "0123456789abcdef".split("")
|
||||
|
||||
function rhex(n)
|
||||
{
|
||||
var s='', j=0;
|
||||
for(; j<4; j++)
|
||||
s += hex_chr[(n >> (j * 8 + 4)) & 0x0F]
|
||||
+ hex_chr[(n >> (j * 8)) & 0x0F];
|
||||
return s;
|
||||
function rhex(n) {
|
||||
var s = "", j = 0
|
||||
for (; j < 4; j++)
|
||||
s += hex_chr[(n >> (j * 8 + 4)) & 0x0F]
|
||||
+ hex_chr[(n >> (j * 8)) & 0x0F]
|
||||
return s
|
||||
}
|
||||
|
||||
function hex(x) {
|
||||
for (var i=0; i<x.length; i++)
|
||||
x[i] = rhex(x[i]);
|
||||
return x.join('');
|
||||
for (var i = 0; i < x.length; i++)
|
||||
x[i] = rhex(x[i])
|
||||
return x.join("")
|
||||
}
|
||||
|
||||
function md5(s) {
|
||||
return hex(md51(s));
|
||||
return hex(md51(s))
|
||||
}
|
||||
|
||||
/* this function is much faster,
|
||||
|
|
@ -172,13 +170,13 @@ need the idiotic second function,
|
|||
generated by an if clause. */
|
||||
|
||||
function add32(a, b) {
|
||||
return (a + b) & 0xFFFFFFFF;
|
||||
return (a + b) & 0xFFFFFFFF
|
||||
}
|
||||
|
||||
if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') {
|
||||
function add32(x, y) {
|
||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
|
||||
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xFFFF);
|
||||
}
|
||||
if (md5("hello") != "5d41402abc4b2a76b9719d911017c592") {
|
||||
function add32(x, y) {
|
||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
|
||||
msw = (x >> 16) + (y >> 16) + (lsw >> 16)
|
||||
return (msw << 16) | (lsw & 0xFFFF)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
---
|
||||
// Import the global.css file here so that it is included on
|
||||
// all pages through the use of the <BaseHead /> component.
|
||||
import "../styles/global.css";
|
||||
const { title, description, image = "/preview.png" } = Astro.props;
|
||||
import { SITE_URL } from "../consts";
|
||||
import "../styles/global.css"
|
||||
const { title, description, image = "/preview.png" } = Astro.props
|
||||
import { SITE_URL } from "../consts"
|
||||
const { pathname } = Astro.url;
|
||||
---
|
||||
|
||||
<!-- Global Metadata -->
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
|
||||
<!-- Primary Meta Tags -->
|
||||
<title>{title}</title>
|
||||
<meta name="title" content={title} />
|
||||
<meta name="description" content={description} />
|
||||
<title>{title}</title>
|
||||
<meta name="title" content={title} />
|
||||
<meta name="description" content={description} />
|
||||
|
||||
<!-- Open Graph / Facebook -->
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content={`${SITE_URL}${pathname}`} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:image" content={new URL(image, `${SITE_URL}${pathname}`)} />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content={`${SITE_URL}${pathname}`} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:image" content={new URL(image, `${SITE_URL}${pathname}`)} />
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta property="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:url" content={`${SITE_URL}${pathname}`} />
|
||||
<meta property="twitter:title" content={title} />
|
||||
<meta property="twitter:description" content={description} />
|
||||
<meta property="twitter:image" content={new URL(image, `${SITE_URL}${pathname}`)} />
|
||||
<meta property="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:url" content={`${SITE_URL}${pathname}`} />
|
||||
<meta property="twitter:title" content={title} />
|
||||
<meta property="twitter:description" content={description} />
|
||||
<meta property="twitter:image" content={new URL(image, `${SITE_URL}${pathname}`)} />
|
||||
|
|
|
|||
|
|
@ -1,45 +1,45 @@
|
|||
---
|
||||
import { SITE_TITLE, SITE_EMAIL } from "../consts";
|
||||
const { theme } = Astro.props;
|
||||
import { SITE_NAME } from "../consts";
|
||||
const date = new Date();
|
||||
import { SITE_TITLE, SITE_EMAIL } from "../consts"
|
||||
const { theme } = Astro.props
|
||||
import { SITE_NAME } from "../consts"
|
||||
const date = new Date()
|
||||
const year = date.getFullYear();
|
||||
|
||||
---
|
||||
|
||||
<div class:list={["footer-main", { "footer-dark": theme === "dark" }]}>
|
||||
<div class="content-body footer-wraper">
|
||||
<div class="footer-box">
|
||||
<div class="foot-nav">
|
||||
<div class="foot-nav-items">
|
||||
<div class="item">
|
||||
<div class="logo">{SITE_TITLE}</div>
|
||||
<div class="email">Email: {SITE_EMAIL}</div>
|
||||
</div>
|
||||
<div class:list={["footer-main", { "footer-dark": theme === "dark" }]}>
|
||||
<div class="content-body footer-wrapper">
|
||||
<div class="footer-box">
|
||||
<div class="foot-nav">
|
||||
<div class="foot-nav-items">
|
||||
<div class="item">
|
||||
<div class="logo">{SITE_TITLE}</div>
|
||||
<div class="email">Email: {SITE_EMAIL}</div>
|
||||
</div>
|
||||
|
||||
<div class="item products">
|
||||
<div class="item-title">作品</div>
|
||||
<a href="/" target="_blank">本站</a>
|
||||
<a href="https://repair.nbtca.space" target="_blank">维修管理</a>
|
||||
</div>
|
||||
<div class="item products">
|
||||
<div class="item-title">作品</div>
|
||||
<a href="/" target="_blank">本站</a>
|
||||
<a href="https://repair.nbtca.space" target="_blank">维修管理</a>
|
||||
</div>
|
||||
|
||||
<div class="item community">
|
||||
<div class="item-title">社媒</div>
|
||||
<a href="https://github.com/nbtca" target="_blank">Github</a>
|
||||
</div>
|
||||
<div class="item community">
|
||||
<div class="item-title">社媒</div>
|
||||
<a href="https://github.com/nbtca" target="_blank">Github</a>
|
||||
</div>
|
||||
|
||||
<div class="item resources">
|
||||
<div class="item-title">友链</div>
|
||||
<a href="https://www.cnblogs.com/N3ptune">N3ptune</a>
|
||||
<div class="item resources">
|
||||
<div class="item-title">友链</div>
|
||||
<a href="https://www.cnblogs.com/N3ptune">N3ptune</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="copyright">
|
||||
© {`2018-${year} ${SITE_NAME}`}
|
||||
<a href="//github.com/austin2035/astro-air-blog">astro-air-blog</a>
|
||||
<div class="bottom">
|
||||
<div class="copyright">
|
||||
© {`2018-${year} ${SITE_NAME}`}
|
||||
<a href="//github.com/austin2035/astro-air-blog">astro-air-blog</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
import Navigation from "./Navigation.astro";
|
||||
---
|
||||
|
||||
<header>
|
||||
<Navigation />
|
||||
</header>
|
||||
<header>
|
||||
<Navigation />
|
||||
</header>
|
||||
|
|
|
|||
|
|
@ -5,20 +5,22 @@ import "../styles/global.css"
|
|||
const { member } = Astro.props
|
||||
---
|
||||
|
||||
<div class="flex flex-col gap-2 w-full">
|
||||
<div class="w-full rounded-lg overflow-hidden">
|
||||
<div class="w-full aspect-square overflow-hidden flex items-center justify-center bg-gradient-to-b from-gray-300/70">
|
||||
{
|
||||
member.avatar ? (
|
||||
<img class="object-cover h-full" src={member.avatar + "?x-oss-process=image/resize,h_512,m_lfit"} alt="" />
|
||||
) : (
|
||||
<img class="object-cover h-3/4" src="https://oss.nbtca.space/CA-logo.svg" alt="" />
|
||||
)
|
||||
<div class="flex flex-col gap-2 w-full">
|
||||
<div class="w-full rounded-lg overflow-hidden">
|
||||
<div class="w-full aspect-square overflow-hidden flex items-center justify-center bg-gradient-to-b from-gray-300/70">
|
||||
{
|
||||
member.avatar
|
||||
? (
|
||||
<img class="object-cover h-full" src={member.avatar + "?x-oss-process=image/resize,h_512,m_lfit"} alt="" />
|
||||
)
|
||||
: (
|
||||
<img class="object-cover h-3/4" src="https://oss.nbtca.space/CA-logo.svg" alt="" />
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-16">
|
||||
<div class="text-lg">{member.alias}</div>
|
||||
<div class="text-sm mt-0.5">{member.profile}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="h-16">
|
||||
<div class="text-lg">{member.alias}</div>
|
||||
<div class="text-sm mt-0.5">{member.profile}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,40 +2,40 @@
|
|||
import { SITE_TITLE } from "../consts"
|
||||
---
|
||||
|
||||
<nav class="nav">
|
||||
<div class="nav-wrapper">
|
||||
<div class="nav-content-wrapper">
|
||||
<div class="nav-content">
|
||||
<a href="/" class="nav-title flex items-center gap-3">
|
||||
<img
|
||||
src="https://oss.nbtca.space/CA-logo.svg"
|
||||
alt=""
|
||||
style="width: 28px; aspect-ratio: 1;"
|
||||
/>
|
||||
<span class="hidden md:block">
|
||||
{SITE_TITLE}
|
||||
</span>
|
||||
</a>
|
||||
<div class="nav-menu">
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/archive" class="nav-item-content">目录</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="https://repair.nbtca.space" class="nav-item-content">
|
||||
维修
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/calendar" class="nav-item-content">日历</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/about" class="nav-item-content">关于</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/join-us" class="nav-item-content">加入我们</a>
|
||||
<nav class="nav">
|
||||
<div class="nav-wrapper">
|
||||
<div class="nav-content-wrapper">
|
||||
<div class="nav-content">
|
||||
<a href="/" class="nav-title flex items-center gap-3">
|
||||
<img
|
||||
src="https://oss.nbtca.space/CA-logo.svg"
|
||||
alt=""
|
||||
style="width: 28px; aspect-ratio: 1;"
|
||||
/>
|
||||
<span class="hidden md:block">
|
||||
{SITE_TITLE}
|
||||
</span>
|
||||
</a>
|
||||
<div class="nav-menu">
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/archive" class="nav-item-content">目录</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="https://repair.nbtca.space" class="nav-item-content">
|
||||
维修
|
||||
</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/calendar" class="nav-item-content">日历</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/about" class="nav-item-content">关于</a>
|
||||
</div>
|
||||
<div class="nav-item-wrapper">
|
||||
<a href="/join-us" class="nav-item-content">加入我们</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -20,10 +20,8 @@ class CalendarComponment extends React.Component {
|
|||
url: "https://ical.nbtca.space/",
|
||||
format: "ics",
|
||||
success: function (data) {
|
||||
data.forEach((element) => {
|
||||
element.color = element.title.includes("生日")
|
||||
? "#fc7399"
|
||||
: "#5172dc"
|
||||
data.forEach(element => {
|
||||
element.color = element.title.includes("生日") ? "#fc7399" : "#5172dc"
|
||||
})
|
||||
},
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export const SITE_TITLE = `计算机协会`;
|
||||
export const SITE_EMAIL = 'contact@nbtca.space'
|
||||
export const SITE_NAME = 'Computer Association';
|
||||
export const SITE_DESCRIPTION = 'Computer Association';
|
||||
export const SITE_URL = "https://www.nbtca.space";
|
||||
export const SITE_TITLE = `计算机协会`
|
||||
export const SITE_EMAIL = "contact@nbtca.space"
|
||||
export const SITE_NAME = "Computer Association"
|
||||
export const SITE_DESCRIPTION = "Computer Association"
|
||||
export const SITE_URL = "https://www.nbtca.space"
|
||||
|
|
|
|||
2
src/env.d.ts
vendored
2
src/env.d.ts
vendored
|
|
@ -1,2 +1,2 @@
|
|||
/// <reference path="../.astro/types.d.ts" />
|
||||
/// <reference types="astro/client" />
|
||||
/// <reference types="astro/client" />
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
import { formatDateV2 } from "../utils";
|
||||
const { posts } = Astro.props;
|
||||
import { formatDateV2 } from "../utils"
|
||||
const { posts } = Astro.props
|
||||
posts.sort((a, b) => Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate));
|
||||
---
|
||||
|
||||
<ul>
|
||||
{
|
||||
<ul>
|
||||
{
|
||||
posts.map((post) => {
|
||||
return (
|
||||
<li>
|
||||
|
|
@ -14,7 +14,7 @@ posts.sort((a, b) => Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatte
|
|||
{post.frontmatter.title}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
)
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
---
|
||||
import BaseHead from "../components/BaseHead.astro";
|
||||
import Header from "../components/Header.astro";
|
||||
import Footer from "../components/Footer.astro";
|
||||
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
|
||||
const { primaryTitle } = Astro.props;
|
||||
const title = primaryTitle ? `${primaryTitle} - ${SITE_TITLE}` : SITE_TITLE;
|
||||
import BaseHead from "../components/BaseHead.astro"
|
||||
import Header from "../components/Header.astro"
|
||||
import Footer from "../components/Footer.astro"
|
||||
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts"
|
||||
const { primaryTitle } = Astro.props
|
||||
const title = primaryTitle ? `${primaryTitle} - ${SITE_TITLE}` : SITE_TITLE;
|
||||
---
|
||||
|
||||
<html class="js no-touch progressive-image no-reduced-motion progressive" lang="zh-CN" dir="ltr">
|
||||
<head>
|
||||
<BaseHead title={title} description={SITE_DESCRIPTION} />
|
||||
</head>
|
||||
<body class="page-landing">
|
||||
<Header />
|
||||
<slot />
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
<html class="js no-touch progressive-image no-reduced-motion progressive" lang="zh-CN" dir="ltr">
|
||||
<head>
|
||||
<BaseHead title={title} description={SITE_DESCRIPTION} />
|
||||
</head>
|
||||
<body class="page-landing">
|
||||
<Header />
|
||||
<slot />
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,63 +8,63 @@ import { SITE_TITLE } from "../consts"
|
|||
const { frontmatter } = Astro.props
|
||||
const type = frontmatter.tags?.[0] ?? "默认"
|
||||
const { pubDate, title, description, featured } = frontmatter
|
||||
const dateFormated = formatDate(pubDate)
|
||||
const dateFormatted = formatDate(pubDate)
|
||||
---
|
||||
|
||||
<html
|
||||
lang="zh-CN"
|
||||
dir="ltr"
|
||||
class="js no-touch progressive-image no-reduced-motion progressive"
|
||||
>
|
||||
<head>
|
||||
<BaseHead
|
||||
title={`${title} - ${SITE_TITLE}`}
|
||||
description={description}
|
||||
image={frontmatter.cover?.square}
|
||||
/>
|
||||
</head>
|
||||
<body
|
||||
class:list={[
|
||||
"page-article",
|
||||
{ "theme-dark": frontmatter.theme === "dark" },
|
||||
]}
|
||||
<html
|
||||
lang="zh-CN"
|
||||
dir="ltr"
|
||||
class="js no-touch progressive-image no-reduced-motion progressive"
|
||||
>
|
||||
<Header />
|
||||
<main id="main" class="main">
|
||||
<section>
|
||||
<article class="article">
|
||||
<div
|
||||
class:list={[
|
||||
{ "featured-header": featured, "article-header": !featured },
|
||||
]}
|
||||
>
|
||||
<div class="category component">
|
||||
<div class="component-content">
|
||||
<div class="category-eyebrow">
|
||||
<span class="category-eyebrow__category category_original"
|
||||
>{type}</span
|
||||
>
|
||||
<span class="category-eyebrow__date">{dateFormated}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagetitle component">
|
||||
<div class="component-content">
|
||||
<h1 class="hero-headline">{title}</h1>
|
||||
</div>
|
||||
</div>
|
||||
<head>
|
||||
<BaseHead
|
||||
title={`${title} - ${SITE_TITLE}`}
|
||||
description={description}
|
||||
image={frontmatter.cover?.square}
|
||||
/>
|
||||
</head>
|
||||
<body
|
||||
class:list={[
|
||||
"page-article",
|
||||
{ "theme-dark": frontmatter.theme === "dark" },
|
||||
]}
|
||||
>
|
||||
<Header />
|
||||
<main id="main" class="main">
|
||||
<section>
|
||||
<article class="article">
|
||||
<div
|
||||
class:list={[
|
||||
{ "featured-subhead": featured, "article-subhead": !featured },
|
||||
"component",
|
||||
{ "featured-header": featured, "article-header": !featured },
|
||||
]}
|
||||
>
|
||||
<div class="component-content">{description}</div>
|
||||
</div>
|
||||
<div class="category component">
|
||||
<div class="component-content">
|
||||
<div class="category-eyebrow">
|
||||
<span class="category-eyebrow__category category_original">{type}
|
||||
</span
|
||||
>
|
||||
<span class="category-eyebrow__date">{dateFormatted}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-title component">
|
||||
<div class="component-content">
|
||||
<h1 class="hero-headline">{title}</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class:list={[
|
||||
{ "featured-subhead": featured, "article-subhead": !featured },
|
||||
"component",
|
||||
]}
|
||||
>
|
||||
<div class="component-content">{description}</div>
|
||||
</div>
|
||||
|
||||
<div class:list={["tagssheet component"]}>
|
||||
<div class="component-content">
|
||||
{
|
||||
<div class:list={["tags-sheet component"]}>
|
||||
<div class="component-content">
|
||||
{
|
||||
frontmatter.tags?.map((tag) => {
|
||||
return (
|
||||
<a href={`/tags/${tag}`} class="tag">
|
||||
|
|
@ -73,33 +73,34 @@ const dateFormated = formatDate(pubDate)
|
|||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<slot />
|
||||
<div class="component">
|
||||
<div class="component-content">
|
||||
<div class="article-copyright">
|
||||
<a
|
||||
class="content"
|
||||
href="https://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh"
|
||||
target="_blank"
|
||||
>版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)</a
|
||||
<slot />
|
||||
<div class="component">
|
||||
<div class="component-content">
|
||||
<div class="article-copyright">
|
||||
<a
|
||||
class="content"
|
||||
href="https://creativecommons.org/licenses/by-nc-nd/3.0/deed.zh"
|
||||
target="_blank"
|
||||
>版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)
|
||||
</a
|
||||
>
|
||||
<p class="content">
|
||||
作者: {frontmatter.author} 发表日期:{dateFormated}
|
||||
</p>
|
||||
<p class="content">
|
||||
作者: {frontmatter.author} 发表日期:{dateFormatted}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
</main>
|
||||
<Footer />
|
||||
<script is:inline>
|
||||
</article>
|
||||
</section>
|
||||
</main>
|
||||
<Footer />
|
||||
<script is:inline>
|
||||
var script = document.createElement("script")
|
||||
script.src = "/static/js/initPost.js"
|
||||
document.head.appendChild(script)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -2,35 +2,35 @@
|
|||
import { formatDate } from "../utils"
|
||||
const { title, href, cover, tags, date } = Astro.props
|
||||
|
||||
const dateFormated = formatDate(date)
|
||||
const dateFormatted = formatDate(date)
|
||||
const type = tags?.[0] ?? "默认"
|
||||
|
||||
const image = cover ? cover : "https://oss.nbtca.space/CA-logo.svg"
|
||||
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormated}`
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormatted}`
|
||||
---
|
||||
|
||||
<li
|
||||
role="listitem"
|
||||
class="tile-item item-list nr-scroll-animation"
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
>
|
||||
<a
|
||||
href={href}
|
||||
class="tile tile-list medium-load small-load large-load"
|
||||
aria-label={label}
|
||||
<li
|
||||
role="list-item"
|
||||
class="tile-item item-list nr-scroll-animation"
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
>
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" data-src={image} alt="lt" />
|
||||
</div>
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
<a
|
||||
href={href}
|
||||
class="tile tile-list medium-load small-load large-load"
|
||||
aria-label={label}
|
||||
>
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" data-src={image} alt="lt" />
|
||||
</div>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">
|
||||
{dateFormated}
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
</div>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">
|
||||
{dateFormatted}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
---
|
||||
import { formatDate } from "../utils";
|
||||
const { title, href, cover, tags, date, level} = Astro.props;
|
||||
import { formatDate } from "../utils"
|
||||
const { title, href, cover, tags, date, level } = Astro.props
|
||||
|
||||
const dateFormated = formatDate(date);
|
||||
const type = tags[0];
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormated}`;
|
||||
// level 1: hreo
|
||||
const dateFormatted = formatDate(date)
|
||||
const type = tags[0]
|
||||
const label = `${title} - ${type} - 发表时间 ${dateFormatted}`;
|
||||
// level 1: hero
|
||||
// level 2: 2up
|
||||
// level 3: 3up
|
||||
---
|
||||
|
||||
<li
|
||||
role="listitem"
|
||||
class:list={["tile-item", "nr-scroll-animation", { "item-hero": level === "1", "item-2up": level === "2", "item-3up": level === "3" }]}
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
>
|
||||
<a
|
||||
href={href}
|
||||
class:list={["tile", "large-load", "medium-load", "small-load", { "tile-hero": level === "1", "tile-2up": level === "2", "tile-3up": level === "3" }]}
|
||||
aria-label={label}
|
||||
<li
|
||||
role="list-item"
|
||||
class:list={["tile-item", "nr-scroll-animation", { "item-hero": level === "1", "item-2up": level === "2", "item-3up": level === "3" }]}
|
||||
style="--nr-animation-transform-y:20%;"
|
||||
>
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" data-src={cover} alt="lt"/>
|
||||
</div>
|
||||
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
<a
|
||||
href={href}
|
||||
class:list={["tile", "large-load", "medium-load", "small-load", { "tile-hero": level === "1", "tile-2up": level === "2", "tile-3up": level === "3" }]}
|
||||
aria-label={label}
|
||||
>
|
||||
<div class="tile__media" aria-hidden="true">
|
||||
<img class="cover image" data-src={cover} alt="lt" />
|
||||
</div>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">{dateFormated}</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<div class="tile__description" aria-hidden="true">
|
||||
<div class="tile__head">
|
||||
<div class="tile__category">{type}</div>
|
||||
<div class="tile__headline">{title}</div>
|
||||
</div>
|
||||
<div class="tile__timestamp icon-hide icon icon-before icon-clock">{dateFormatted}</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
---
|
||||
import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
import ArchivePostList from "../layouts/ArchivePostList.astro";
|
||||
import BaseLayout from "../layouts/BaseLayout.astro"
|
||||
---
|
||||
|
||||
<BaseLayout primaryTitle="404 Not Found">
|
||||
<section class="archive">
|
||||
<div class="section-content section-tag">
|
||||
<div class="archive-tag">
|
||||
<h2 class="tag-header">404 Not Found</h2>
|
||||
<div class="tag-post-list">来到了一片荒原,这里什么都没有。</div>
|
||||
<BaseLayout primaryTitle="404 Not Found">
|
||||
<section class="archive">
|
||||
<div class="section-content section-tag">
|
||||
<div class="archive-tag">
|
||||
<h2 class="tag-header">404 Not Found</h2>
|
||||
<div class="tag-post-list">来到了一片荒原,这里什么都没有。</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { computed } from "vue"
|
|||
import MemberCard from "../components/MemberCard.astro"
|
||||
import { type Member, otherMembers } from "../store/member.ts"
|
||||
|
||||
const members: Member[] = await fetch("https://api.nbtca.space/v2/members").then(res => {
|
||||
const members: Member[] = await fetch("https://api.nbtca.space/v2/members").then((res) => {
|
||||
return res.json()
|
||||
})
|
||||
|
||||
|
|
@ -22,23 +22,23 @@ const memberGroupByYear = computed(() => {
|
|||
acc[year].push(cur)
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, Member[]>
|
||||
{} as Record<string, Member[]>,
|
||||
)
|
||||
group["往届"] = otherMembers
|
||||
return group
|
||||
})
|
||||
---
|
||||
|
||||
<BaseLayout primaryTitle="关于">
|
||||
<section class="pb-20 bg-[#f5f5f7]">
|
||||
<div class="section-content">
|
||||
<BaseLayout primaryTitle="关于">
|
||||
<section class="pb-20 bg-[#f5f5f7]">
|
||||
<div class="section-content">
|
||||
<!-- <div class="text-[32px] leading-[1.125] font-bold py-6">友情链接</div> -->
|
||||
<div class="text-[32px] leading-[1.125] font-bold py-6">协会成员</div>
|
||||
<div>
|
||||
{
|
||||
<div class="text-[32px] leading-[1.125] font-bold py-6">协会成员</div>
|
||||
<div>
|
||||
{
|
||||
Object.keys(memberGroupByYear.value)
|
||||
.sort((a, b) => parseInt(b) - parseInt(a))
|
||||
.map(year => {
|
||||
.map((year) => {
|
||||
return (
|
||||
<div class="py-4 first:pt-2">
|
||||
<div class="text-[24px] font-bold pb-2">{year}</div>
|
||||
|
|
@ -51,7 +51,7 @@ const memberGroupByYear = computed(() => {
|
|||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -7,35 +7,37 @@ const tags = ["寝室", "技术", "学习", "其他"]
|
|||
const posts = []
|
||||
|
||||
tags.forEach((tag) => {
|
||||
let filteredPosts = allPosts.filter((post) =>
|
||||
post.frontmatter.tags.includes(tag)
|
||||
const filteredPosts = allPosts.filter(post =>
|
||||
post.frontmatter.tags.includes(tag),
|
||||
)
|
||||
let filteredBlogs = Blogs.filter(
|
||||
(post) => post.frontmatter.tags?.includes(tag) ?? tag === "其他"
|
||||
const filteredBlogs = Blogs.filter(
|
||||
post => post.frontmatter.tags?.includes(tag) ?? tag === "其他",
|
||||
)
|
||||
posts.push([...filteredPosts, ...filteredBlogs])
|
||||
})
|
||||
---
|
||||
|
||||
<BaseLayout primaryTitle="归档">
|
||||
<section class="archive">
|
||||
<div class="section-content section-tag">
|
||||
{
|
||||
<BaseLayout primaryTitle="归档">
|
||||
<section class="archive">
|
||||
<div class="section-content section-tag">
|
||||
{
|
||||
tags.map((tag, index) => {
|
||||
return (
|
||||
<div class="archive-tag">
|
||||
<h2 class="tag-header">{tag}</h2>
|
||||
<div class="tag-post-list">
|
||||
{posts[index].length !== 0 ? (
|
||||
<ArchivePostList posts={posts[index]} />
|
||||
) : (
|
||||
<div class="no-posts">暂无文章</div>
|
||||
)}
|
||||
{posts[index].length !== 0
|
||||
? (
|
||||
<ArchivePostList posts={posts[index]} />
|
||||
)
|
||||
: (
|
||||
<div class="no-posts">暂无文章</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
</div>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ import FullCalendar from "../components/react/Calendar"
|
|||
import BaseLayout from "../layouts/BaseLayout.astro"
|
||||
---
|
||||
|
||||
<BaseLayout primaryTitle="日历">
|
||||
<FullCalendar client:load />
|
||||
</BaseLayout>
|
||||
<BaseLayout primaryTitle="日历">
|
||||
<FullCalendar client:load />
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -6,16 +6,16 @@ const allPosts = await Astro.glob("../pages/posts/*.md")
|
|||
const Blogs = await Astro.glob("../pages/posts/blogs/**/*.md")
|
||||
allPosts.sort(
|
||||
(a, b) =>
|
||||
Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate)
|
||||
Date.parse(b.frontmatter.pubDate) - Date.parse(a.frontmatter.pubDate),
|
||||
)
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
<section class="everydayfeed">
|
||||
<div class="section-content">
|
||||
<h2 class="section-head">最新文章</h2>
|
||||
<ul role="list" class="section-tiles">
|
||||
{
|
||||
<BaseLayout>
|
||||
<section class="every-day-feed">
|
||||
<div class="section-content">
|
||||
<h2 class="section-head">最新文章</h2>
|
||||
<ul role="list" class="section-tiles">
|
||||
{
|
||||
// tile-hero
|
||||
allPosts.slice(0, 1).map((post) => {
|
||||
return (
|
||||
|
|
@ -31,7 +31,7 @@ allPosts.sort(
|
|||
})
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
// tile-2up
|
||||
allPosts.slice(1, 5).map((post) => {
|
||||
return (
|
||||
|
|
@ -47,7 +47,7 @@ allPosts.sort(
|
|||
})
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
// tile-3up
|
||||
allPosts.slice(5, 11).map((post) => {
|
||||
return (
|
||||
|
|
@ -62,16 +62,16 @@ allPosts.sort(
|
|||
)
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="more-from-newsroom">
|
||||
<div class="section-content">
|
||||
<h2 class="section-head">更多文章</h2>
|
||||
<section class="more-from-newsroom">
|
||||
<div class="section-content">
|
||||
<h2 class="section-head">更多文章</h2>
|
||||
|
||||
<ul role="list" class="section-tiles">
|
||||
{
|
||||
<ul role="list" class="section-tiles">
|
||||
{
|
||||
// tile-2up
|
||||
allPosts.slice(0, 6).map((post) => {
|
||||
return (
|
||||
|
|
@ -85,7 +85,7 @@ allPosts.sort(
|
|||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
{
|
||||
Blogs.slice(1, 7).map((post) => {
|
||||
return (
|
||||
<MoreTile
|
||||
|
|
@ -97,29 +97,32 @@ allPosts.sort(
|
|||
)
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
<div class="view-archive-wrapper">
|
||||
<a
|
||||
href="/archive"
|
||||
class="cta-primary-light"
|
||||
data-analytics-region="router"
|
||||
data-analytics-title="view archive">阅读历史文章</a
|
||||
>
|
||||
</ul>
|
||||
<div class="view-archive-wrapper">
|
||||
<a
|
||||
href="/archive"
|
||||
class="cta-primary-light"
|
||||
data-analytics-region="router"
|
||||
data-analytics-title="view archive"
|
||||
>
|
||||
阅读历史文章
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<script is:inline>
|
||||
<script is:inline>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
var script = document.createElement("script")
|
||||
script.src = "/static/js/animation.js"
|
||||
document.head.appendChild(script)
|
||||
|
||||
script.onload = function () {
|
||||
console.log("lazyload.js loaded")
|
||||
console.log("LazyLoad.js loaded")
|
||||
// when layout is loaded, load the images
|
||||
// eslint-disable-next-line no-undef
|
||||
initImage()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</BaseLayout>
|
||||
</script>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
|
|
@ -2,34 +2,36 @@
|
|||
import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
---
|
||||
|
||||
<BaseLayout primaryTitle="加入我们">
|
||||
<div class="container">
|
||||
<h2 class="life-at-apple__eyebrow">在 NBTCA 生活</h2>
|
||||
<p class="t-hero-headline-oversized">
|
||||
<span
|
||||
class="t-hero-headline-oversized-span"
|
||||
aria-label="加入我们,共同创造我们的社区。"
|
||||
>
|
||||
<span class="gradient-warm">加入我们,共同创造我们的社区。</span>
|
||||
</span>
|
||||
</p>
|
||||
<div class="body-container">
|
||||
<p class="life-at-apple__body-text">
|
||||
探索我们的资源和文化:这里有丰富的资源和注重包容、成长和独创性的协作文化,助你缔造精彩人生。
|
||||
<BaseLayout primaryTitle="加入我们">
|
||||
<div class="container">
|
||||
<h2 class="life-at-apple__eyebrow">在 NBTCA 生活</h2>
|
||||
<p class="t-hero-headline-oversized">
|
||||
<span
|
||||
class="t-hero-headline-oversized-span"
|
||||
aria-label="加入我们,共同创造我们的社区。"
|
||||
>
|
||||
<span class="gradient-warm">加入我们,共同创造我们的社区。</span>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="learn-more-link-container">
|
||||
<a
|
||||
href="/careers/cn/life-at-apple.html"
|
||||
class="learn-more-link"
|
||||
aria-label="进一步了解 NBTCA 的社区和文化">了解在 NBTCA 生活</a
|
||||
<div class="body-container">
|
||||
<p class="life-at-apple__body-text">
|
||||
探索我们的资源和文化:这里有丰富的资源和注重包容、成长和独创性的协作文化,助你缔造精彩人生。
|
||||
</p>
|
||||
</div>
|
||||
<div class="learn-more-link-container">
|
||||
<a
|
||||
href="/careers/cn/life-at-apple.html"
|
||||
class="learn-more-link"
|
||||
aria-label="进一步了解 NBTCA 的社区和文化"
|
||||
>了解在 NBTCA 生活
|
||||
</a
|
||||
>
|
||||
<a class="learn-more-link-after">> </a>
|
||||
<a class="learn-more-link-after">> </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
</BaseLayout>
|
||||
|
||||
<style>
|
||||
<style>
|
||||
@media screen and (min-width: 680px) {
|
||||
/*PC*/
|
||||
.container {
|
||||
|
|
@ -251,4 +253,4 @@ import BaseLayout from "../layouts/BaseLayout.astro";
|
|||
justify-content: center;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import rss, { pagesGlobToRssItems } from '@astrojs/rss';
|
||||
import rss, { pagesGlobToRssItems } from "@astrojs/rss"
|
||||
|
||||
export async function get() {
|
||||
return rss({
|
||||
title: "Austin's Blog",
|
||||
description: "Site description",
|
||||
site: 'https://astro-blog.qum.cc',
|
||||
items: await pagesGlobToRssItems(import.meta.glob('./**/*.md')),
|
||||
site: "https://astro-blog.qum.cc",
|
||||
items: await pagesGlobToRssItems(import.meta.glob("./**/*.md")),
|
||||
customData: `<language>zh-cn</language>`,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +1,34 @@
|
|||
---
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
import ArchivePostList from "../../layouts/ArchivePostList.astro";
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro"
|
||||
import ArchivePostList from "../../layouts/ArchivePostList.astro"
|
||||
|
||||
const { tag } = Astro.params;
|
||||
const { posts } = Astro.props;
|
||||
const { tag } = Astro.params
|
||||
const { posts } = Astro.props
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const allPosts = await Astro.glob("../posts/*.md");
|
||||
const uniqueTags = [...new Set(allPosts.map((post) => post.frontmatter.tags).flat())];
|
||||
const allPosts = await Astro.glob("../posts/*.md")
|
||||
const uniqueTags = [...new Set(allPosts.map(post => post.frontmatter.tags).flat())]
|
||||
return uniqueTags.map((tag) => {
|
||||
const filteredPosts = allPosts.filter((post) => post.frontmatter.tags.includes(tag));
|
||||
const filteredPosts = allPosts.filter(post => post.frontmatter.tags.includes(tag))
|
||||
return {
|
||||
params: { tag },
|
||||
props: { posts: filteredPosts },
|
||||
};
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
<BaseLayout primaryTitle={tag}>
|
||||
<section class="archive">
|
||||
<div class="section-content section-tag">
|
||||
<div class="archive-tag">
|
||||
<h2 class="tag-header">{tag}</h2>
|
||||
<div class="tag-post-list">{
|
||||
posts.length !== 0 ? <ArchivePostList posts={posts} /> : <div class="no-posts">暂无文章</div>}</div>
|
||||
<BaseLayout primaryTitle={tag}>
|
||||
<section class="archive">
|
||||
<div class="section-content section-tag">
|
||||
<div class="archive-tag">
|
||||
<h2 class="tag-header">{tag}</h2>
|
||||
<div class="tag-post-list">{
|
||||
posts.length !== 0 ? <ArchivePostList posts={posts} /> : <div class="no-posts">暂无文章</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
35
src/utils.js
35
src/utils.js
|
|
@ -1,32 +1,31 @@
|
|||
export function formatDate(dateString) {
|
||||
const date = new Date(dateString);
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
return year + " 年 " + month + " 月 " + day + " 日";
|
||||
const date = new Date(dateString)
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
return year + " 年 " + month + " 月 " + day + " 日"
|
||||
}
|
||||
|
||||
// debounce function
|
||||
export function debounce(fn, delay) {
|
||||
let timer = null;
|
||||
let timer = null
|
||||
return function () {
|
||||
let context = this;
|
||||
let args = arguments;
|
||||
clearTimeout(timer);
|
||||
const context = this
|
||||
const args = arguments
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(function () {
|
||||
fn.apply(context, args);
|
||||
}, delay);
|
||||
};
|
||||
fn.apply(context, args)
|
||||
}, delay)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function formatDateV2(date) {
|
||||
// 创建一个Date对象
|
||||
let d = new Date(date);
|
||||
const d = new Date(date)
|
||||
// 使用toLocaleString方法返回本地时间字符串
|
||||
let localTime = d.toLocaleString("zh-CN", {year: "numeric", month: "2-digit", day: "2-digit"});
|
||||
const localTime = d.toLocaleString("zh-CN", { year: "numeric", month: "2-digit", day: "2-digit" })
|
||||
// 去掉字符串中的斜杠和空格
|
||||
let formattedDate = localTime.replace(/\//g, "-").replace(/\s/g, "");
|
||||
const formattedDate = localTime.replace(/\//g, "-").replace(/\s/g, "")
|
||||
// 返回格式化后的日期
|
||||
return formattedDate;
|
||||
}
|
||||
return formattedDate
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue