mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: allow skipAnimation
This commit is contained in:
1 parent
3b81c72846
commit
f72209beb5
7 files changed
+27
-16
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.17.0",
|
"version": "3.17.1",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ const ServerLangSettingNode = {
|
|||||||
|
|
||||||
PreferenceSetting(
|
PreferenceSetting(
|
||||||
Setting('setting_display', 'viewLang', null, langRange, 'UI Language'),
|
Setting('setting_display', 'viewLang', null, langRange, 'UI Language'),
|
||||||
|
Setting('setting_display', 'skipAnimate', false, 'boolean', 'Skip Animation'),
|
||||||
Setting('setting_display', 'timeZone', 'Asia/Shanghai', timezones, 'Timezone'),
|
Setting('setting_display', 'timeZone', 'Asia/Shanghai', timezones, 'Timezone'),
|
||||||
LangSettingNode,
|
LangSettingNode,
|
||||||
Setting('setting_usage', 'codeTemplate', '', 'textarea', 'Default Code Template',
|
Setting('setting_usage', 'codeTemplate', '', 'textarea', 'Default Code Template',
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ export default function DomComponent(props: React.HTMLAttributes<HTMLDivElement>
|
|||||||
return () => {
|
return () => {
|
||||||
$(ref.current).empty();
|
$(ref.current).empty();
|
||||||
};
|
};
|
||||||
});
|
}, []);
|
||||||
return <div {...omit(props, 'childDom')} ref={ref}></div>;
|
return <div {...omit(props, 'childDom')} ref={ref}></div>;
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,24 @@ function buildSequence(pages, type) {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function animate() {
|
||||||
|
if (UserContext.skipAnimate) return;
|
||||||
|
const style = document.createElement('style');
|
||||||
|
style.innerHTML = `.section {
|
||||||
|
transition: transform .5s, opacity .5s;
|
||||||
|
transition-timing-function: ease-out-cubic;
|
||||||
|
}`;
|
||||||
|
document.head.append(style);
|
||||||
|
const sections = _.map($('.section').get(), (section, idx) => ({
|
||||||
|
shouldDelay: idx < 5, // only animate first 5 sections
|
||||||
|
$element: $(section),
|
||||||
|
}));
|
||||||
|
for (const { $element, shouldDelay } of sections) {
|
||||||
|
$element.addClass('visible');
|
||||||
|
if (shouldDelay) await delay(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
for (const page of window.Hydro.preload) await eval(page); // eslint-disable-line no-eval
|
for (const page of window.Hydro.preload) await eval(page); // eslint-disable-line no-eval
|
||||||
|
|
||||||
@@ -78,18 +96,12 @@ async function load() {
|
|||||||
console.log(`${page.name}: ${type}Loading took ${time}ms`);
|
console.log(`${page.name}: ${type}Loading took ${time}ms`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const sections = _.map($('.section').get(), (section, idx) => ({
|
|
||||||
shouldDelay: idx < 5, // only animate first 5 sections
|
|
||||||
$element: $(section),
|
|
||||||
}));
|
|
||||||
$('.page-loader').hide();
|
|
||||||
console.log('done! %d ms', Date.now() - start.getTime());
|
console.log('done! %d ms', Date.now() - start.getTime());
|
||||||
for (const { $element, shouldDelay } of sections) {
|
$('.page-loader').hide();
|
||||||
$element.addClass('visible');
|
await animate();
|
||||||
if (shouldDelay) await delay(50);
|
$('.section').addClass('visible');
|
||||||
}
|
|
||||||
await delay(500);
|
await delay(500);
|
||||||
for (const { $element } of sections) $element.trigger('vjLayout');
|
$('.section').trigger('vjLayout');
|
||||||
$(document).trigger('vjPageFullyInitialized');
|
$(document).trigger('vjPageFullyInitialized');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
.section
|
.section
|
||||||
background: $section-bg-color
|
background: $section-bg-color
|
||||||
box-shadow: $section-shadow
|
box-shadow: $section-shadow
|
||||||
transition: transform .5s, opacity .5s
|
|
||||||
transition-timing-function: ease-out-cubic
|
|
||||||
|
|
||||||
+mobile()
|
+mobile()
|
||||||
box-shadow: none
|
box-shadow: none
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.40.0",
|
"version": "4.40.1",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if rdoc.files.hack %}<span class="text-orange">({{ _('Hack') }})</span>{% endif %}
|
{% if rdoc.files.hack %}<span class="text-orange">({{ _('Hack') }})</span>{% endif %}
|
||||||
{% if rdoc.contest and rdoc.contest.toHexString() == '000000000000000000000000' %}<span class="text-orange">(({{ _('Pretest') }})</span>{% endif %}
|
{% elif rdoc.contest and rdoc.contest.toString() == '000000000000000000000000' %}<span class="text-orange">({{ _('Pretest') }})</span>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="col--submit-by">
|
<td class="col--submit-by">
|
||||||
<a href="{{ url('user_detail', uid=rdoc.uid) }}">
|
<a href="{{ url('user_detail', uid=rdoc.uid) }}">
|
||||||
|
|||||||
Reference in new issue
Block a user