为剪贴板添加面包屑

This commit is contained in:
undefined committed 2020-05-04 10:59:15 +08:00
1 parent 9bb94f101d
commit 649f65b17d
11 files changed
+28 -9

No files matched your search

-1
View File
@@ -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
View File
@@ -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 };
+1 -1
View File
@@ -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;
+11 -1
View File
@@ -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';
}
+2
View File
@@ -0,0 +1,2 @@
paste_create: Create a paste
paste_show: Read a paste
+3 -1
View File
@@ -1 +1,3 @@
pastebin: 剪贴板
pastebin: 剪贴板
paste_create: 创建新内容
paste_show: 查看内容
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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>
+3
View File
@@ -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({
+1 -1
View File
@@ -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);
+3
View File
@@ -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({