mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
优化丑陋的代码
This commit is contained in:
1 parent
62ac2f52c9
commit
dd1b7c363a
18 files changed
+43
-448
No files matched your search
@@ -22,7 +22,6 @@ module.exports = {
|
|||||||
'no-underscore-dangle': 'off',
|
'no-underscore-dangle': 'off',
|
||||||
'no-restricted-syntax': 'off',
|
'no-restricted-syntax': 'off',
|
||||||
'max-classes-per-file': 'off',
|
'max-classes-per-file': 'off',
|
||||||
radix: 'off',
|
|
||||||
'guard-for-in': 'off',
|
'guard-for-in': 'off',
|
||||||
'no-param-reassign': 'off',
|
'no-param-reassign': 'off',
|
||||||
'global-require': 'off',
|
'global-require': 'off',
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
FROM mhart/alpine-node:slim-10
|
FROM mhart/alpine-node:slim-10
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ADD .build /app
|
COPY .build /app
|
||||||
EXPOSE 8888
|
EXPOSE 8888
|
||||||
CMD ["node", ".build/development.js"]
|
CMD ["node", ".build/development.js"]
|
||||||
@@ -23,7 +23,7 @@ class RecordListHandler extends RecordHandler {
|
|||||||
if (uidOrName) {
|
if (uidOrName) {
|
||||||
q.$or = [
|
q.$or = [
|
||||||
{ unameLower: uidOrName.toLowerCase() },
|
{ unameLower: uidOrName.toLowerCase() },
|
||||||
{ _id: parseInt(uidOrName) },
|
{ _id: parseInt(uidOrName, 10) },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (pid) q.pid = pid;
|
if (pid) q.pid = pid;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class SystemSettingHandler extends SystemHandler {
|
|||||||
const current = {};
|
const current = {};
|
||||||
const settings = setting.SYSTEM_SETTINGS;
|
const settings = setting.SYSTEM_SETTINGS;
|
||||||
for (const s of settings) {
|
for (const s of settings) {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
current[s.key] = await system.get(s.key);
|
current[s.key] = await system.get(s.key);
|
||||||
}
|
}
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ async function _parseDagJson(domainId, dag) {
|
|||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
await Promise.all(tasks);
|
await Promise.all(tasks);
|
||||||
const newNode = {
|
const newNode = {
|
||||||
_id: parseInt(node._id),
|
_id: parseInt(node._id, 10),
|
||||||
title: node.title,
|
title: node.title,
|
||||||
requireNids: Array.from(new Set(node.requireNids)),
|
requireNids: Array.from(new Set(node.requireNids)),
|
||||||
pids: Array.from(new Set(node.pids)),
|
pids: Array.from(new Set(node.pids)),
|
||||||
@@ -112,8 +112,9 @@ class TrainingDetailHandler extends TrainingHandler {
|
|||||||
for (const pid in psdict) {
|
for (const pid in psdict) {
|
||||||
const psdoc = psdict[pid];
|
const psdoc = psdict[pid];
|
||||||
if (psdoc.status) {
|
if (psdoc.status) {
|
||||||
if (psdoc.status === builtin.STATUS.STATUS_ACCEPTED) donePids.add(parseInt(pid));
|
if (psdoc.status === builtin.STATUS.STATUS_ACCEPTED) {
|
||||||
else progPids.add(parseInt(pid));
|
donePids.add(parseInt(pid, 10));
|
||||||
|
} else progPids.add(parseInt(pid, 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const nsdict = {};
|
const nsdict = {};
|
||||||
@@ -124,7 +125,7 @@ class TrainingDetailHandler extends TrainingHandler {
|
|||||||
const totalCount = node.pids.length;
|
const totalCount = node.pids.length;
|
||||||
const doneCount = Set.union(new Set(node.pids), donePids).size;
|
const doneCount = Set.union(new Set(node.pids), donePids).size;
|
||||||
const nsdoc = {
|
const nsdoc = {
|
||||||
progress: totalCount ? parseInt(100 * (doneCount / totalCount)) : 100,
|
progress: totalCount ? parseInt(100 * (doneCount / totalCount), 10) : 100,
|
||||||
isDone: training.isDone(node, doneNids, donePids),
|
isDone: training.isDone(node, doneNids, donePids),
|
||||||
isProgress: training.isProgress(node, doneNids, donePids, progPids),
|
isProgress: training.isProgress(node, doneNids, donePids, progPids),
|
||||||
isOpen: training.isOpen(node, doneNids, donePids, progPids),
|
isOpen: training.isOpen(node, doneNids, donePids, progPids),
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ class UserSearchHandler extends Handler {
|
|||||||
let udocs;
|
let udocs;
|
||||||
if (exactMatch) udocs = [];
|
if (exactMatch) udocs = [];
|
||||||
else udocs = await user.getPrefixList(q, 20);
|
else udocs = await user.getPrefixList(q, 20);
|
||||||
const udoc = await user.getById(domainId, parseInt(q));
|
const udoc = await user.getById(domainId, parseInt(q, 10));
|
||||||
if (udoc) udocs.push(udoc);
|
if (udoc) udocs.push(udoc);
|
||||||
for (const i in udocs) {
|
for (const i in udocs) {
|
||||||
if (udocs[i].gravatar) {
|
if (udocs[i].gravatar) {
|
||||||
|
|||||||
+2
-2
@@ -3,8 +3,8 @@ function decodeBase64WithUriEncoding(encodedText) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function unescapedString(escapedString) {
|
function unescapedString(escapedString) {
|
||||||
escapedString += new Array(5 - escapedString.length % 4).join('=');
|
escapedString += new Array(5 - (escapedString.length % 4)).join('=');
|
||||||
return escapedString.replace(/\-/g, '+').replace(/_/g, '/');
|
return escapedString.replace(/-/g, '+').replace(/_/g, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
function decodeJWT(idToken) {
|
function decodeJWT(idToken) {
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ function _digit2(number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatSeconds(seconds = 0) {
|
function formatSeconds(seconds = 0) {
|
||||||
seconds = parseInt(seconds);
|
seconds = parseInt(seconds, 10);
|
||||||
return '{0}:{1}:{2}'.format(
|
return '{0}:{1}:{2}'.format(
|
||||||
_digit2(Math.floor(seconds / 3600)),
|
_digit2(Math.floor(seconds / 3600)),
|
||||||
_digit2(Math.floor((seconds % 3600) / 60)),
|
_digit2(Math.floor((seconds % 3600) / 60)),
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ function convert(ini) {
|
|||||||
const res = { cases: [] };
|
const res = { cases: [] };
|
||||||
for (let i = 1; i <= count; i++) {
|
for (let i = 1; i <= count; i++) {
|
||||||
const [input, output, time, score, memory] = f[i].split('|');
|
const [input, output, time, score, memory] = f[i].split('|');
|
||||||
const cur = { input, output, score: parseInt(score) };
|
const cur = { input, output, score: parseInt(score, 10) };
|
||||||
cur.time = `${time}s`;
|
cur.time = `${time}s`;
|
||||||
if (!Number.isNaN(parseInt(memory))) cur.memory = `${Math.floor(parseInt(memory) / 1024)}m`;
|
if (!Number.isNaN(parseInt(memory, 10))) cur.memory = `${Math.floor(parseInt(memory, 10) / 1024)}m`;
|
||||||
else cur.memory = '128m';
|
else cur.memory = '128m';
|
||||||
res.cases.push(cur);
|
res.cases.push(cur);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ global.Hydro.model.training = module.exports = {
|
|||||||
if (!tdoc) throw new TrainingNotFoundError(tid);
|
if (!tdoc) throw new TrainingNotFoundError(tid);
|
||||||
for (const i in tdoc.dag) {
|
for (const i in tdoc.dag) {
|
||||||
for (const j in tdoc.dag[i].pids) {
|
for (const j in tdoc.dag[i].pids) {
|
||||||
if (Number.isSafeInteger(parseInt(tdoc.dag[i].pids[j]))) {
|
if (Number.isSafeInteger(parseInt(tdoc.dag[i].pids[j], 10))) {
|
||||||
tdoc.dag[i].pids[j] = parseInt(tdoc.dag[i].pids[j]);
|
tdoc.dag[i].pids[j] = parseInt(tdoc.dag[i].pids[j], 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ async function run({ domainId, isSub = false }, report) {
|
|||||||
memory_kb: 0,
|
memory_kb: 0,
|
||||||
score: 0,
|
score: 0,
|
||||||
},
|
},
|
||||||
progress: Math.floor(((parseInt(i) + 1) / domains.length) * 100),
|
progress: Math.floor(((parseInt(i, 10) + 1) / domains.length) * 100),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -44,7 +44,7 @@ async function run({ domainId, isSub = false }, report) {
|
|||||||
udict[udoc.uid] = udoc.new;
|
udict[udoc.uid] = udoc.new;
|
||||||
}
|
}
|
||||||
if (!isSub) {
|
if (!isSub) {
|
||||||
await report({ progress: Math.floor(((parseInt(i) + 1) / contests.length) * 100) });
|
await report({ progress: Math.floor(((parseInt(i, 10) + 1) / contests.length) * 100) });
|
||||||
}
|
}
|
||||||
await report({
|
await report({
|
||||||
case: {
|
case: {
|
||||||
@@ -58,7 +58,7 @@ async function run({ domainId, isSub = false }, report) {
|
|||||||
}
|
}
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
for (const uid in udict) {
|
for (const uid in udict) {
|
||||||
tasks.push(user.setInDomain(domainId, parseInt(uid), { rating: udict[uid] }));
|
tasks.push(user.setInDomain(domainId, parseInt(uid, 10), { rating: udict[uid] }));
|
||||||
}
|
}
|
||||||
await Promise.all(tasks);
|
await Promise.all(tasks);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ async function run({
|
|||||||
uname, password, mail, uid,
|
uname, password, mail, uid,
|
||||||
}) {
|
}) {
|
||||||
if (!uid) uid = await system.inc('user');
|
if (!uid) uid = await system.inc('user');
|
||||||
else uid = parseInt(uid);
|
else uid = parseInt(uid, 10);
|
||||||
if (Number.isNaN(uid)) throw new Error('uid');
|
if (Number.isNaN(uid)) throw new Error('uid');
|
||||||
await user.create({
|
await user.create({
|
||||||
uid, uname, password, mail, regip: '127.0.0.1',
|
uid, uname, password, mail, regip: '127.0.0.1',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const user = require('../model/user');
|
|||||||
async function run({
|
async function run({
|
||||||
uid,
|
uid,
|
||||||
}) {
|
}) {
|
||||||
uid = parseInt(uid);
|
uid = parseInt(uid, 10);
|
||||||
if (Number.isNaN(uid)) throw new Error('uid');
|
if (Number.isNaN(uid)) throw new Error('uid');
|
||||||
await user.setSuperAdmin(uid);
|
await user.setSuperAdmin(uid);
|
||||||
return uid;
|
return uid;
|
||||||
|
|||||||
@@ -63,15 +63,15 @@ const validate = {
|
|||||||
tag: _splitAndTrim,
|
tag: _splitAndTrim,
|
||||||
beginAtDate: _date,
|
beginAtDate: _date,
|
||||||
beginAtTime: _time,
|
beginAtTime: _time,
|
||||||
pid: (pid) => (Number.isSafeInteger(parseInt(pid)) ? parseInt(pid) : pid),
|
pid: (pid) => (Number.isSafeInteger(parseInt(pid, 10)) ? parseInt(pid, 10) : pid),
|
||||||
content: validator.checkContent,
|
content: validator.checkContent,
|
||||||
title: validator.checkTitle,
|
title: validator.checkTitle,
|
||||||
uid: (uid) => parseInt(validator.checkUid(uid)),
|
uid: (uid) => parseInt(validator.checkUid(uid), 10),
|
||||||
password: validator.checkPassword,
|
password: validator.checkPassword,
|
||||||
mail: validator.checkEmail,
|
mail: validator.checkEmail,
|
||||||
uname: validator.checkUname,
|
uname: validator.checkUname,
|
||||||
page: (page) => {
|
page: (page) => {
|
||||||
if (Number.isSafeInteger(parseInt(page))) page = parseInt(page);
|
if (Number.isSafeInteger(parseInt(page, 10))) page = parseInt(page, 10);
|
||||||
if (page <= 0) throw new ValidationError('page');
|
if (page <= 0) throw new ValidationError('page');
|
||||||
return page;
|
return page;
|
||||||
},
|
},
|
||||||
@@ -83,7 +83,7 @@ const validate = {
|
|||||||
pids: (pids) => {
|
pids: (pids) => {
|
||||||
const res = pids.split(',').map((i) => i.trim());
|
const res = pids.split(',').map((i) => i.trim());
|
||||||
for (const i in res) {
|
for (const i in res) {
|
||||||
if (Number.isSafeInteger(parseInt(res[i]))) res[i] = parseInt(res[i]);
|
if (Number.isSafeInteger(parseInt(res[i], 10))) res[i] = parseInt(res[i], 10);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-413
@@ -1,415 +1,3 @@
|
|||||||
# Vijos UI Framework
|
# Vijos UI Framework
|
||||||
|
|
||||||
## Responsive Cutoffs
|
See [vijos/vj4/vj4/ui/README.md](https://github.com/vijos/vj4/blob/master/vj4/ui/README.md)
|
||||||
|
|
||||||
Vijos use the following cutoffs to determine the size of a device.
|
|
||||||
|
|
||||||
Small: `[0 - 450px)` (mobile)
|
|
||||||
|
|
||||||
Medium: `[450px, 1000px)` (tablet)
|
|
||||||
|
|
||||||
Large: `[1000px, -)` (desktop)
|
|
||||||
|
|
||||||
## Layout
|
|
||||||
|
|
||||||
### Grid
|
|
||||||
|
|
||||||
See [Foundation Grid](http://foundation.zurb.com/sites/docs/grid.html)
|
|
||||||
|
|
||||||
### Float
|
|
||||||
|
|
||||||
See [Foundation Float](http://foundation.zurb.com/sites/docs/float-classes.html)
|
|
||||||
|
|
||||||
> NOTE: `.float-center` is not implemented.
|
|
||||||
|
|
||||||
## Typography
|
|
||||||
|
|
||||||
HTML elements such as headings (`h1`, `h2`, ...), lists (`ol`, `ul`, `li`, ...) and tables does not have margins and paddings by default in order to easy the styling of semantic structures. However you may want suitable space between those elements when they are used to present content to users (for example, problem content). In this case, you need to enable the typography styling by wrapping them with `<div class="typo"></div>`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="typo">
|
|
||||||
<h1>Notice</h1>
|
|
||||||
<p>The content will be well formatted.</p>
|
|
||||||
<ul>
|
|
||||||
<li>Item</li>
|
|
||||||
<li>Item</li>
|
|
||||||
<li>Item</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Text Alignment
|
|
||||||
|
|
||||||
```html
|
|
||||||
<ANY class="text-left"></ANY>
|
|
||||||
<ANY class="text-center"></ANY>
|
|
||||||
<ANY class="text-right"></ANY>
|
|
||||||
<ANY class="text-justify"></ANY>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Prototype Components
|
|
||||||
|
|
||||||
### Media Object
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Number Box Object
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Balancer Object
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
## Basic Components
|
|
||||||
|
|
||||||
### Section
|
|
||||||
|
|
||||||
Section is served as an entry to more detailed contents. By default, each section has a white background and drop-shadow.
|
|
||||||
|
|
||||||
A section should contain a section-header and one or more section bodies.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section">
|
|
||||||
<div class="section__header">
|
|
||||||
<!-- header -->
|
|
||||||
</div>
|
|
||||||
<div class="section__body">
|
|
||||||
<!-- body -->
|
|
||||||
</div>
|
|
||||||
<div class="section__body">
|
|
||||||
<!-- optionally more bodies -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
There will be vertical margins between section bodies.
|
|
||||||
|
|
||||||
#### Side Section
|
|
||||||
|
|
||||||
If the section is acted as a sidebar section, it should contain `side` class so that its default font size becomes smaller:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section side"></div>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Title
|
|
||||||
|
|
||||||
You can use `<X class="section__title"></X>` to specify the title for a section (`X` is from `h1` to `h3`). The font size and the color of the section title is different from normal headings.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section">
|
|
||||||
<div class="section__header">
|
|
||||||
<h1 class="section__title">Section title</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Table
|
|
||||||
|
|
||||||
If the main content of the section is a data table (or additionally with a title and a paginator), it is suggested to apply `data-table` to the table. Table should be put inside a section-body with `no-padding` decoration.
|
|
||||||
|
|
||||||
3 * 2 table sample:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section">
|
|
||||||
<!-- ... -->
|
|
||||||
<div class="section__body no-padding">
|
|
||||||
<table class="data-table">
|
|
||||||
<colgroup>
|
|
||||||
<col class="col--1">
|
|
||||||
<col class="col--2">
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="col--1"></th>
|
|
||||||
<th class="col--2"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr><td class="col--1">1,1</td><td class="col--2">1,2</td></tr>
|
|
||||||
<tr><td class="col--1">2,1</td><td class="col--2">2,2</td></tr>
|
|
||||||
<tr><td class="col--1">3,1</td><td class="col--2">3,2</td></tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
> If you want to specify the width of a column, you should add `col--xxx` to the class name list (as shown above) and specify its width in a CSS rule like:
|
|
||||||
>
|
|
||||||
> ```css
|
|
||||||
> .col--1 { width: 120px; }
|
|
||||||
> ```
|
|
||||||
|
|
||||||
#### Samples
|
|
||||||
|
|
||||||
Section with content:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section">
|
|
||||||
<div class="section__body">
|
|
||||||
Section content
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
Section with title and content:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section">
|
|
||||||
<div class="section__header">
|
|
||||||
<h1 class="section__title">Section title</h1>
|
|
||||||
</div>
|
|
||||||
<div class="section__body">
|
|
||||||
Section content
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
Section with title and table content:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section">
|
|
||||||
<div class="section__header">
|
|
||||||
<h1 class="section__title">Section title</h1>
|
|
||||||
</div>
|
|
||||||
<div class="section__body no-padding">
|
|
||||||
<table class="data-table">
|
|
||||||
<!-- ... -->
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Button
|
|
||||||
|
|
||||||
```html
|
|
||||||
<ANY class="button"></ANY>
|
|
||||||
```
|
|
||||||
|
|
||||||
Additional class names:
|
|
||||||
|
|
||||||
`rounded`: The button would have round corners.
|
|
||||||
|
|
||||||
`primary`: The button would have blue background.
|
|
||||||
|
|
||||||
`expanded`: The button would occupy full width of the parent.
|
|
||||||
|
|
||||||
`inverse`: TODO
|
|
||||||
|
|
||||||
### Input
|
|
||||||
|
|
||||||
```html
|
|
||||||
<X class="textbox"></X>
|
|
||||||
```
|
|
||||||
|
|
||||||
`X` could be `input` or `textarea`.
|
|
||||||
|
|
||||||
Additional class names:
|
|
||||||
|
|
||||||
`material`: TODO
|
|
||||||
|
|
||||||
`inverse`: TODO
|
|
||||||
|
|
||||||
### Paginator
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Menu
|
|
||||||
|
|
||||||
```html
|
|
||||||
<ol class="menu">
|
|
||||||
<li class="menu__item">
|
|
||||||
<a href="#" class="menu__link">Item</a>
|
|
||||||
</li>
|
|
||||||
<li class="menu__seperator"></li>
|
|
||||||
</ol>
|
|
||||||
```
|
|
||||||
|
|
||||||
Optionally, a menu item can be `active` or `highlight` (notice that the decorator class name is added to `menu__link` instead of `menu__item`):
|
|
||||||
|
|
||||||
```html
|
|
||||||
<li class="menu__item">
|
|
||||||
<a href="#" class="menu__link active">Active Item</a>
|
|
||||||
</li>
|
|
||||||
<li class="menu__item">
|
|
||||||
<a href="#" class="menu__link highlight">Highlight Item</a>
|
|
||||||
</li>
|
|
||||||
```
|
|
||||||
|
|
||||||
Menu can be put inside a section. It should be placed inside `section__body no-padding` or directly inside `section`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section">
|
|
||||||
<div>
|
|
||||||
<ol class="menu">
|
|
||||||
...
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Menu Item from Headings
|
|
||||||
|
|
||||||
Menu items can be automatically generated from headings. To enable this feature, you need to specify the region to extract headings and the destination of extracted menu items by setting `data-heading-extract-to` attribute:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="section" data-heading-extract-to="#my-menu-item">
|
|
||||||
<h1 id="h_1" data-heading>Heading 1</h1>
|
|
||||||
<h1 id="h_2" data-heading>Heading 2</h1>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
This attribute accepts a CSS selector and all elements that contain `data-heading` attribute in the element will be extracted. `id` is essential and it will be appended to the hash part so that the page will navigate when user clicks the newly generate menu item.
|
|
||||||
|
|
||||||
The CSS selector should match a `menu__item` element. Headings will become the sub-menu of that element.
|
|
||||||
|
|
||||||
### Sticky
|
|
||||||
|
|
||||||
Sticky elements are always visible when the user scrolls. To enable sticky, add `data-sticky` attribute to the element.
|
|
||||||
|
|
||||||
Optionally, the value of `data-sticky` can be `medium` or `large`. When `data-sticky` is `medium`, the element will be sticky only when window size is larger than mobile cutoff (can be tablet or desktop). When `data-sticky` is `large`, it will take effect only when window size is larger than desktop cutoff. See section Responsive Cutoffs for actual sizes.
|
|
||||||
|
|
||||||
The sticky element is restricted to the boundary of its closest parent. You can change this behavior by assigning attribute `data-sticky-parent` to the desired parent. `data-sticky-parent` can not be used in nested sticky elements.
|
|
||||||
|
|
||||||
A sample of sticky sidebar:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="row" data-sticky-parent>
|
|
||||||
<div class="medium-9 columns">
|
|
||||||
<!-- main content -->
|
|
||||||
</div>
|
|
||||||
<div class="medium-3 columns">
|
|
||||||
<div data-sticky="large">
|
|
||||||
<div class="section">Sticky!</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
```
|
|
||||||
|
|
||||||
- Because the columns will be stacked when window size is smaller than `large` (tablet and mobile) and we don't want sidebars keep sticky in such cases, we have `data-sticky="large"` so that the element will be sticky ONLY when window size is `large`.
|
|
||||||
|
|
||||||
- The height of the two columns are not equal so the sticky parent should be `.row` instead.
|
|
||||||
|
|
||||||
### CommonMark Editor
|
|
||||||
|
|
||||||
CommonMark editor can be automatically transformed from a normal textarea. Inputs in the CommonMark editor will be synced to the textarea in real-time. To enable this feature, add `data-markdown` to the `textarea` element.
|
|
||||||
|
|
||||||
Sample:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<textarea name="content" class="textbox" data-markdown></textarea>
|
|
||||||
```
|
|
||||||
|
|
||||||
> To make it work with newly added textareas, you need to trigger `vjContentNew` event for the new element. Textarea with `data-markdown` should be a children of the trigger target.
|
|
||||||
|
|
||||||
|
|
||||||
### Emoji
|
|
||||||
|
|
||||||
[Emoji code](http://www.webpagefx.com/tools/emoji-cheat-sheet/) can be automatically transformed into emoji images. To enable this feature, add `data-emoji-enabled` to the element.
|
|
||||||
|
|
||||||
Sample:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div class="typo" data-emoji-enabled></div>
|
|
||||||
```
|
|
||||||
|
|
||||||
> To make it work with newly added contents, you need to trigger `vjContentNew` event for the new element.
|
|
||||||
|
|
||||||
### Dropdown
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Navigation
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Star
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Tab
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
### Hotkey
|
|
||||||
|
|
||||||
#### Local Hotkey
|
|
||||||
|
|
||||||
Local hotkeys are triggered when it is assigned to a parent of the active element in which user presses specific key.
|
|
||||||
|
|
||||||
To enable local hotkey on an element, add `data-hotkey` attribute:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<button data-hotkey="f1"></button>
|
|
||||||
```
|
|
||||||
|
|
||||||
You can specify multiple hotkeys in the attribute.
|
|
||||||
|
|
||||||
#### Global hotkey
|
|
||||||
|
|
||||||
Global hotkeys are triggered no matter where user presses specific key.
|
|
||||||
|
|
||||||
To enable global hotkey on an element, add `data-global-hotkey` attribute:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<button data-global-hotkey="f2"></button>
|
|
||||||
```
|
|
||||||
|
|
||||||
You can specify multiple hotkeys in the attribute.
|
|
||||||
|
|
||||||
#### Hotkey Syntax
|
|
||||||
|
|
||||||
`hotKeyDef[,hotKeyDef[,hotKeyDef...]]`
|
|
||||||
|
|
||||||
`hotKeyDef`: `keySequence[:event]`
|
|
||||||
|
|
||||||
`keySequence`: `key1[+key2[+key3...]]`
|
|
||||||
|
|
||||||
When `keySequence` matches, the `event` will be triggered on the element that holds the attribute. If `event` is not given in `hotKeyDef`, it will be `click` by default. In addition, if `event` is `submit`, the event will be triggered on the closest `form` element, instead of the current element.
|
|
||||||
|
|
||||||
Sample:
|
|
||||||
|
|
||||||
`ctrl+f1`: Triggers click on this element when user presses `Ctrl`+`F1` or `Command`+`F1`.
|
|
||||||
|
|
||||||
`ctrl+enter:submit`: Triggers submit on the closest `form` when user presses `Ctrl+Enter` or `Command+Enter`.
|
|
||||||
|
|
||||||
`f1:submit,f2:client`: Triggers submit when user presses `f1` and triggers click when user presses `f2`.
|
|
||||||
|
|
||||||
### Tooltip
|
|
||||||
|
|
||||||
```html
|
|
||||||
<X data-tooltip="your tooltip text"></X>
|
|
||||||
```
|
|
||||||
|
|
||||||
Optionally, you can specify a location by assigning `data-tooltip-pos` attribute. Available values are:
|
|
||||||
|
|
||||||
- `"top left"`
|
|
||||||
- `"top middle"` (default)
|
|
||||||
- `"top right"`
|
|
||||||
- `"bottom left"`
|
|
||||||
- `"bottom middle"`
|
|
||||||
- `"bottom right"`
|
|
||||||
|
|
||||||
## High-Level Components
|
|
||||||
|
|
||||||
### Comment List
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
## Other
|
|
||||||
|
|
||||||
### JavaScript-Responsive Visibility
|
|
||||||
|
|
||||||
#### Hide if JavaScript is disabled
|
|
||||||
|
|
||||||
```html
|
|
||||||
<ANY class="nojs--hide"></ANY>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Hide if JavaScript is enabled
|
|
||||||
|
|
||||||
```html
|
|
||||||
<ANY class="hasjs--hide"></ANY>
|
|
||||||
```
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
for f in *.jpg
|
for f in *.jpg
|
||||||
do
|
do
|
||||||
echo "$f..."
|
echo "$f..."
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
#### 1. 收集的信息
|
#### 1. 收集的信息
|
||||||
|
|
||||||
我们收集信息是为了向所有用户提供更好的服务。我们有两种信息收集方式:
|
我们收集信息是为了向所有用户提供更好的服务。我们有两种信息收集方式:
|
||||||
s
|
|
||||||
- 您向我们提供信息。在您注册 Hydro 帐户时,我们会要求您提供个人信息,例如您的电子邮件地址、QQ号码等。
|
- 您向我们提供信息。在您注册 Hydro 帐户时,我们会要求您提供个人信息,例如您的电子邮件地址、QQ号码等。
|
||||||
- 我们在您使用服务的过程中获取信息。我们会收集关于您使用的服务以及使用方式的信息,例如您在何时使用了我们服务。
|
- 我们在您使用服务的过程中获取信息。我们会收集关于您使用的服务以及使用方式的信息,例如您在何时使用了我们服务。
|
||||||
|
|
||||||
|
|||||||
+14
-10
@@ -38,7 +38,9 @@ Hydro 评测机使用进程虚拟内存与物理内存总和计算内存空间
|
|||||||
- :::record-ignored Canceled::: 其他:评测被取消
|
- :::record-ignored Canceled::: 其他:评测被取消
|
||||||
- :::record-fail Unknown Error::: 其他:未知错误
|
- :::record-fail Unknown Error::: 其他:未知错误
|
||||||
|
|
||||||
:::note 有“成绩取消”字样则说明管理员手动标记此记录为取消,可能违反了服务条款,比如代码被发现与其他用户的代码十分相似。:::
|
:::note
|
||||||
|
有“成绩取消”字样则说明管理员手动标记此记录为取消,可能违反了服务条款,比如代码被发现与其他用户的代码十分相似。
|
||||||
|
:::
|
||||||
|
|
||||||
# Compile Error
|
# Compile Error
|
||||||
|
|
||||||
@@ -50,14 +52,14 @@ Hydro 评测机使用进程虚拟内存与物理内存总和计算内存空间
|
|||||||
- 一般性的编译错误
|
- 一般性的编译错误
|
||||||
|
|
||||||
:::warn
|
:::warn
|
||||||
对 C/C++ 选手的特别提醒:
|
对 C/C++ 选手的特别提醒:
|
||||||
<ul>
|
<ul>
|
||||||
<li>1. __int64 在 GNU C++ 中应写成 long long 类型</li>
|
<li>1. __int64 在 GNU C++ 中应写成 long long 类型</li>
|
||||||
<li>2. main() 返回值必须定义为 int ,而不是 void</li>
|
<li>2. main() 返回值必须定义为 int ,而不是 void</li>
|
||||||
<li>3. for 语句中的指标变量 i 将会在如"for (int i = 0...) {...}"语句之后变为无效</li>
|
<li>3. for 语句中的指标变量 i 将会在如"for (int i = 0...) {...}"语句之后变为无效</li>
|
||||||
<li>4. itoa 不是一个通用 ANSI 函数(标准 C/C++ 中无此函数)</li>
|
<li>4. itoa 不是一个通用 ANSI 函数(标准 C/C++ 中无此函数)</li>
|
||||||
<li>5. printf 中使用 %lf 格式是不正确的</li>
|
<li>5. printf 中使用 %lf 格式是不正确的</li>
|
||||||
</ul>
|
</ul>
|
||||||
:::
|
:::
|
||||||
|
|
||||||
# Training
|
# Training
|
||||||
@@ -82,7 +84,9 @@ ACM/ICPC 赛制排名规则为:通过题目数多的排在前面,通过题
|
|||||||
Hydro RP 分为固定 RP 与浮动 RP ,固定 RP 可由活动、比赛等的奖励获得,浮动 RP 由一般性通过题目获得。
|
Hydro RP 分为固定 RP 与浮动 RP ,固定 RP 可由活动、比赛等的奖励获得,浮动 RP 由一般性通过题目获得。
|
||||||
浮动 RP 是一个动态的数值,每个用户在每道题上获得的 RP 都不一样,并且未来也不固定(即浮动之意)。
|
浮动 RP 是一个动态的数值,每个用户在每道题上获得的 RP 都不一样,并且未来也不固定(即浮动之意)。
|
||||||
|
|
||||||
:::note 每道题的浮动 RP 由该题通过总人数与该用户通过此题的名次计算得来。:::
|
:::note
|
||||||
|
每道题的浮动 RP 由该题通过总人数与该用户通过此题的名次计算得来。
|
||||||
|
:::
|
||||||
|
|
||||||
# Dataset Format
|
# Dataset Format
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user