Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
84e3aa6e49 | 2 years ago |
|
ad3f10e32f | 2 years ago |
19 changed files with 215 additions and 151 deletions
Binary file not shown.
@ -1,67 +0,0 @@ |
|||||
document.addEventListener("DOMContentLoaded", () => { |
|
||||
// Get all "navbar-burger" elements
|
|
||||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll(".navbar-burger"), 0) |
|
||||
|
|
||||
// Add a click event on each of them
|
|
||||
$navbarBurgers.forEach(el => { |
|
||||
el.addEventListener("click", () => { |
|
||||
// Get the target from the "data-target" attribute
|
|
||||
const target = el.dataset.target |
|
||||
const $target = document.getElementById(target) |
|
||||
|
|
||||
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
|
|
||||
el.classList.toggle("is-active") |
|
||||
$target.classList.toggle("is-active") |
|
||||
}) |
|
||||
}) |
|
||||
}) |
|
||||
|
|
||||
document.addEventListener("DOMContentLoaded", () => { |
|
||||
// Functions to open and close a modal
|
|
||||
function openModal($el) { |
|
||||
$el.classList.add("is-active") |
|
||||
} |
|
||||
|
|
||||
function closeModal($el) { |
|
||||
$el.classList.remove("is-active") |
|
||||
} |
|
||||
|
|
||||
function closeAllModals() { |
|
||||
;(document.querySelectorAll(".modal") || []).forEach($modal => { |
|
||||
closeModal($modal) |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
// Add a click event on buttons to open a specific modal
|
|
||||
;(document.querySelectorAll(".js-modal-trigger") || []).forEach($trigger => { |
|
||||
const modal = $trigger.dataset.target |
|
||||
const $target = document.getElementById(modal) |
|
||||
|
|
||||
$trigger.addEventListener("click", () => { |
|
||||
openModal($target) |
|
||||
}) |
|
||||
}) |
|
||||
|
|
||||
// Add a click event on various child elements to close the parent modal
|
|
||||
;( |
|
||||
document.querySelectorAll( |
|
||||
".modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button", |
|
||||
) || [] |
|
||||
).forEach($close => { |
|
||||
const $target = $close.closest(".modal") |
|
||||
|
|
||||
$close.addEventListener("click", () => { |
|
||||
closeModal($target) |
|
||||
}) |
|
||||
}) |
|
||||
|
|
||||
// Add a keyboard event to close all modals
|
|
||||
document.addEventListener("keydown", event => { |
|
||||
const e = event || window.event |
|
||||
|
|
||||
if (e.keyCode === 27) { |
|
||||
// Escape key
|
|
||||
closeAllModals() |
|
||||
} |
|
||||
}) |
|
||||
}) |
|
@ -1 +1,46 @@ |
|||||
console.log(2222) |
// Functions to open and close a modal
|
||||
|
function openModal($el) { |
||||
|
$el.classList.add("is-active") |
||||
|
} |
||||
|
|
||||
|
function closeModal($el) { |
||||
|
$el.classList.remove("is-active") |
||||
|
} |
||||
|
|
||||
|
function closeAllModals() { |
||||
|
;(document.querySelectorAll(".modal") || []).forEach($modal => { |
||||
|
closeModal($modal) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// Add a click event on buttons to open a specific modal
|
||||
|
;(document.querySelectorAll(".js-modal-trigger") || []).forEach($trigger => { |
||||
|
const modal = $trigger.dataset.target |
||||
|
const $target = document.getElementById(modal) |
||||
|
|
||||
|
$trigger.addEventListener("click", () => { |
||||
|
openModal($target) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
// Add a click event on various child elements to close the parent modal
|
||||
|
;( |
||||
|
document.querySelectorAll(".modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button") || |
||||
|
[] |
||||
|
).forEach($close => { |
||||
|
const $target = $close.closest(".modal") |
||||
|
|
||||
|
$close.addEventListener("click", () => { |
||||
|
closeModal($target) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
// Add a keyboard event to close all modals
|
||||
|
document.addEventListener("keydown", event => { |
||||
|
const e = event || window.event |
||||
|
|
||||
|
if (e.keyCode === 27) { |
||||
|
// Escape key
|
||||
|
closeAllModals() |
||||
|
} |
||||
|
}) |
||||
|
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,19 @@ |
|||||
|
const etag = require("etag") |
||||
|
|
||||
|
const plugin = { |
||||
|
name: "etagPlugin", |
||||
|
version: "1.0.0", |
||||
|
register: (server, options) => { |
||||
|
server.ext("onPreResponse", (request, h) => { |
||||
|
const response = request.response |
||||
|
if (response.isBoom || !response.is("application/json")) { |
||||
|
return h.continue |
||||
|
} |
||||
|
const etagValue = etag(response.source) |
||||
|
response.etag(etagValue) |
||||
|
return h.continue |
||||
|
}) |
||||
|
}, |
||||
|
} |
||||
|
|
||||
|
module.exports = plugin |
@ -0,0 +1,46 @@ |
|||||
|
import { auth } from "@noderun/hapi-router" |
||||
|
import { Req, Res, ReturnValue } from "#/global" |
||||
|
import { exec } from "child_process" |
||||
|
|
||||
|
export default class Index { |
||||
|
@auth(false) |
||||
|
async index(request: Req, h: Res): ReturnValue { |
||||
|
exec("git pull", (error, stdout, stderr) => { |
||||
|
if (error) { |
||||
|
console.log(`error: ${error.message}`) |
||||
|
return |
||||
|
} |
||||
|
if (stderr) { |
||||
|
console.log(`stderr: ${stderr}`) |
||||
|
return |
||||
|
} |
||||
|
console.log(`stdout: ${stdout}`) |
||||
|
|
||||
|
exec('pkill -f "node"', (error, stdout, stderr) => { |
||||
|
if (error) { |
||||
|
console.log(`error: ${error.message}`) |
||||
|
return |
||||
|
} |
||||
|
if (stderr) { |
||||
|
console.log(`stderr: ${stderr}`) |
||||
|
return |
||||
|
} |
||||
|
console.log(`stdout: ${stdout}`) |
||||
|
|
||||
|
exec("pnpm start", (error, stdout, stderr) => { |
||||
|
if (error) { |
||||
|
console.log(`error: ${error.message}`) |
||||
|
return |
||||
|
} |
||||
|
if (stderr) { |
||||
|
console.log(`stderr: ${stderr}`) |
||||
|
return |
||||
|
} |
||||
|
console.log(`stdout: ${stdout}`) |
||||
|
}) |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
return h.response().code(200) |
||||
|
} |
||||
|
} |
@ -1,7 +1,11 @@ |
|||||
mixin css(href) |
mixin css(href) |
||||
link(rel="stylesheet", href="/public/"+href) |
link(rel="stylesheet", href="/public/"+href) |
||||
|
|
||||
mixin script(src) |
mixin script(src) |
||||
script(src="/public/"+src) |
script(src="/public/"+src) |
||||
|
|
||||
mixin security |
mixin security |
||||
include ./form_security.pug |
include ./form_security.pug |
||||
|
|
||||
|
mixin flush |
||||
|
include ./flush.pug |
@ -0,0 +1,48 @@ |
|||||
|
|
||||
|
style |
||||
|
:public style/views/color.css |
||||
|
|
||||
|
h1 颜色表 #{temp.a} |
||||
|
div(class="color_list") |
||||
|
//- - |
||||
|
//- var list=[ |
||||
|
//- { color:"#00ffff",title: "青色",describe:""}, |
||||
|
//- { color:"#222222",title: "辅助色",describe:""}, |
||||
|
//- { color:"#8f8f8f",title: "辅助色",describe:""}, |
||||
|
//- { color:"#00d1b2",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- { color:"#999999",title: "辅助色",describe:""}, |
||||
|
//- ] |
||||
|
if list.length === 0 |
||||
|
div 空 |
||||
|
each item in list |
||||
|
div(class="color_item") |
||||
|
div(class="color_item_bg" style=`background: ${item.value}`) |
||||
|
div(class="color_toggle_list") |
||||
|
div(class="color_toggle_item") hex |
||||
|
div(class="color_toggle_item") rgba |
||||
|
div(class="color_item_name") #{item.color} |
||||
|
div(class="color_item_content") |
||||
|
div(class="color_item_title") #{item.name} |
||||
|
div(class="color_item_desc" title=item.desctibe) #{item.desctibe || "暂无描述"} |
||||
|
if isLogin |
||||
|
form(action="/color/del" method="post") |
||||
|
+security |
||||
|
input(type="text" value=item.id name="id" hidden) |
||||
|
button(type="submit" style="background: transparent;border:0;color:red;cursor: pointer;float: right;") 删除 |
||||
|
//- div(class="color_item") |
||||
|
//- img(src="/public/image/add.png", alt="添加" title="添加" class="color_add") |
@ -1,6 +1,6 @@ |
|||||
extends @/layout/layout |
extends @/layout/layout |
||||
|
|
||||
block content |
block content |
||||
section.section |
main |
||||
.container(id="single-page") |
.container(id="single-page") |
||||
block page |
block page |
||||
|
@ -0,0 +1,26 @@ |
|||||
|
|
||||
|
.tree#tree |
||||
|
details(open="true" style="direction: ltr;") |
||||
|
summary |
||||
|
span.tree-item sad |
||||
|
a.op(href="") 新建 |
||||
|
details(open="true") |
||||
|
summary |
||||
|
span.tree-item sad |
||||
|
a.op(href="") 新建 |
||||
|
details |
||||
|
summary |
||||
|
span.tree-item.tree-md-file |
||||
|
div(style="flex: 1;width: 0;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;") asda |
||||
|
a.op(href="") 新建 |
||||
|
details |
||||
|
summary |
||||
|
span.tree-item.tree-md-file |
||||
|
div(style="flex: 1;width: 0;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;") asda |
||||
|
a.op(href="") 新建 |
||||
|
details |
||||
|
summary |
||||
|
span.tree-item.tree-md-file.active |
||||
|
div(style="flex: 1;width: 0;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;") asda |
||||
|
a.op(href="") 新建 |
||||
|
|
Loading…
Reference in new issue