mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
为剪贴板添加面包屑
This commit is contained in:
1 parent
9bb94f101d
commit
649f65b17d
11 files changed
+28
-9
No files matched your search
@@ -4,7 +4,6 @@ const ignoreFailure = require('./ignoreFailure');
|
||||
|
||||
async function build(type) {
|
||||
if (!['development', 'production'].includes(type)) throw new Error(`Unknown type: ${type}`);
|
||||
ignoreFailure(fs.mkdirSync, root('.cache'));
|
||||
ignoreFailure(fs.mkdirSync, root('.build'));
|
||||
await require('./locales')(type);
|
||||
await require('./buildModule')(type);
|
||||
|
||||
+1
-1
@@ -20,4 +20,4 @@ async function post(url, data, options) {
|
||||
return res;
|
||||
}
|
||||
|
||||
global.Hydro['lib.axios'] = module.exports = { get, post };
|
||||
global.Hydro.lib.axios = module.exports = { get, post };
|
||||
@@ -20,4 +20,4 @@ async function download(url, path, retry = 3) {
|
||||
return r;
|
||||
}
|
||||
|
||||
global.Hydro['lib.download'] = module.exports = download;
|
||||
global.Hydro.lib.download = module.exports = download;
|
||||
@@ -6,7 +6,12 @@ const { nav } = global.Hydro.lib;
|
||||
class PasteShowHandler extends Handler {
|
||||
async get({ docId }) {
|
||||
const doc = await pastebin.get(docId);
|
||||
this.response.body = { doc };
|
||||
const path = [
|
||||
['Hydro', '/'],
|
||||
['paste_show', null],
|
||||
[doc.title, null, true],
|
||||
];
|
||||
this.response.body = { path, doc };
|
||||
this.response.template = 'paste_show.html';
|
||||
}
|
||||
}
|
||||
@@ -17,6 +22,11 @@ class PasteCreateHandler extends Handler {
|
||||
}
|
||||
|
||||
async get() {
|
||||
const path = [
|
||||
['Hydro', '/'],
|
||||
['paste_create', null],
|
||||
];
|
||||
this.response.body = { path };
|
||||
this.response.template = 'paste_create.html';
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
paste_create: Create a paste
|
||||
paste_show: Read a paste
|
||||
@@ -1 +1,3 @@
|
||||
pastebin: 剪贴板
|
||||
pastebin: 剪贴板
|
||||
paste_create: 创建新内容
|
||||
paste_show: 查看内容
|
||||
@@ -1,7 +1,7 @@
|
||||
const assert = require('assert');
|
||||
|
||||
const download = global.Hydro['lib.download'];
|
||||
const axios = global.Hydro['lib.axios'];
|
||||
const { download } = global.Hydro.lib;
|
||||
const { axios } = global.Hydro.lib;
|
||||
const { ValidationError, RemoteOnlineJudgeError } = global.Hydro.error;
|
||||
|
||||
async function syzoj(url) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="media__body">
|
||||
<div class="location-path">
|
||||
{% for c in path %}
|
||||
/ {% if c[1] %}<a href="{{ c[1] }}">{{ c[0] if c[2] else _(c[0]) }}</a>{% endif %}
|
||||
/ {% if loop.index < path.length %}<a href="{{ c[1]|default('#') }}">{{ c[0] if c[2] else _(c[0]) }}</a>{% endif %}
|
||||
{%- endfor %}
|
||||
</div>
|
||||
<h1 class="location-current" data-emoji-enabled>{{ path[path.length - 1][0] if path[path.length - 1][2] else _(path[path.length - 1][0]) }}</h1>
|
||||
|
||||
@@ -36,6 +36,9 @@ const page = new NamedPage('home_messages', () => {
|
||||
reduxStore = store;
|
||||
|
||||
const sock = new SockJs('/home/messages-conn');
|
||||
sock.onopen = () => {
|
||||
sock.send(document.cookie);
|
||||
};
|
||||
sock.onmessage = (message) => {
|
||||
const msg = JSON.parse(message.data);
|
||||
store.dispatch({
|
||||
|
||||
@@ -6,8 +6,8 @@ const page = new NamedPage('judge_playground', async () => {
|
||||
const { default: SockJs } = await import('sockjs-client');
|
||||
|
||||
const sock = new SockJs('/judge/consume-conn');
|
||||
|
||||
sock.onopen = () => {
|
||||
sock.send(document.cookie);
|
||||
const div = $('<div class="section visible">').appendTo('#messages');
|
||||
$('<div class="section__header"><h1 class="section__title">Connection opened.</h1></div>')
|
||||
.appendTo(div);
|
||||
|
||||
@@ -168,6 +168,9 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
|
||||
} = await loadReactRedux(ScratchpadReducer);
|
||||
|
||||
const sock = new SockJs(Context.socketUrl);
|
||||
sock.onopen = () => {
|
||||
sock.send(document.cookie);
|
||||
};
|
||||
sock.onmessage = (message) => {
|
||||
const msg = JSON.parse(message.data);
|
||||
store.dispatch({
|
||||
|
||||
Reference in new issue
Block a user