@shzlx/ui-default 4.58.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/api.ts +61 -0
- package/backendlib/builder.ts +182 -0
- package/backendlib/markdown-it-imsize.ts +235 -0
- package/backendlib/markdown-it-katex.ts +139 -0
- package/backendlib/markdown-it-media.ts +163 -0
- package/backendlib/markdown-it-xss.ts +200 -0
- package/backendlib/markdown.js +64 -0
- package/backendlib/misc.ts +54 -0
- package/backendlib/template.ts +279 -0
- package/breakpoints.json +5 -0
- package/components/DOMAttachedObject.ts +128 -0
- package/components/autocomplete/AssignSelectAutoComplete.tsx +22 -0
- package/components/autocomplete/CustomSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/DomainSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/FileSelectAutoComplete.tsx +26 -0
- package/components/autocomplete/LanguageSelectAutoComplete.tsx +24 -0
- package/components/autocomplete/ProblemSelectAutoComplete.tsx +18 -0
- package/components/autocomplete/UserSelectAutoComplete.tsx +23 -0
- package/components/autocomplete/components/AssignSelectAutoComplete.tsx +118 -0
- package/components/autocomplete/components/DomainSelectAutoComplete.tsx +53 -0
- package/components/autocomplete/components/FileSelectAutoComplete.tsx +50 -0
- package/components/autocomplete/components/LanguageSelectAutoComplete.tsx +48 -0
- package/components/autocomplete/components/ProblemSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/components/UserSelectAutoComplete.tsx +54 -0
- package/components/autocomplete/domainselectautocomplete.page.styl +6 -0
- package/components/autocomplete/index.tsx +110 -0
- package/components/autocomplete/problemselectautocomplete.page.styl +6 -0
- package/components/autocomplete/userselectautocomplete.page.styl +6 -0
- package/components/browser-update.page.ts +27 -0
- package/components/calendar/calendar.page.styl +129 -0
- package/components/calendar/index.js +367 -0
- package/components/clipboard.page.ts +23 -0
- package/components/contest/contest.page.styl +119 -0
- package/components/contest/contest.page.ts +23 -0
- package/components/contest/contest_sidebar.page.styl +21 -0
- package/components/contest/problem-contest-bg.png +0 -0
- package/components/contest/problem-contest-bg@2x.png +0 -0
- package/components/customFont.page.tsx +90 -0
- package/components/datepicker/datepicker.page.tsx +94 -0
- package/components/dialog/DomDialog.ts +145 -0
- package/components/dialog/dialog.page.styl +40 -0
- package/components/dialog/index.tsx +285 -0
- package/components/discussion/CommentBox.js +103 -0
- package/components/discussion/collapsible.page.styl +40 -0
- package/components/discussion/collapsible.page.tsx +62 -0
- package/components/discussion/comments.page.styl +142 -0
- package/components/discussion/comments.page.tsx +192 -0
- package/components/discussion/discussion.page.styl +17 -0
- package/components/discussion/history.page.tsx +81 -0
- package/components/discussion/reaction.page.styl +30 -0
- package/components/discussion/reaction.page.tsx +103 -0
- package/components/drop/drop.page.styl +40 -0
- package/components/dropdown/Dropdown.js +50 -0
- package/components/dropdown/dropdown.page.styl +33 -0
- package/components/dropdown/dropdown.page.ts +8 -0
- package/components/editor/cmeditor.page.ts +23 -0
- package/components/editor/cmeditor.styl +10 -0
- package/components/editor/index.tsx +293 -0
- package/components/editor/mdeditor.ts +60 -0
- package/components/editor/textareaHandler.ts +29 -0
- package/components/footer/footer.page.styl +94 -0
- package/components/footer/footer.page.ts +26 -0
- package/components/form/button.page.default.styl +59 -0
- package/components/form/button.page.styl +36 -0
- package/components/form/checkbox.page.styl +89 -0
- package/components/form/form.page.styl +200 -0
- package/components/form/form.page.ts +20 -0
- package/components/form/multiSelectCheckbox.page.js +46 -0
- package/components/form/radiobox.page.styl +62 -0
- package/components/form/select.page.styl +29 -0
- package/components/form/textbox.page.styl +79 -0
- package/components/form/textbox.page.ts +21 -0
- package/components/form/var.inc.styl +14 -0
- package/components/header/header.page.styl +79 -0
- package/components/highlighter/code-example.js +111 -0
- package/components/highlighter/highlighter.page.styl +99 -0
- package/components/highlighter/highlighter.page.ts +72 -0
- package/components/highlighter/meta.js +15 -0
- package/components/highlighter/prismjs.js +122 -0
- package/components/hint.page.styl +9 -0
- package/components/hint.ts +19 -0
- package/components/hitokoto/index.page.js +21 -0
- package/components/hotkey/hotkey.page.js +83 -0
- package/components/katex/katex.page.js +26 -0
- package/components/katex/katex.page.styl +2 -0
- package/components/languageselect.tsx +94 -0
- package/components/loader/loader.page.styl +40 -0
- package/components/mantine.page.tsx +39 -0
- package/components/marker/Marker.js +192 -0
- package/components/marker/MarkerReactive.js +55 -0
- package/components/marker/marker.page.js +8 -0
- package/components/marker/marker.page.styl +57 -0
- package/components/media/media.page.js +46 -0
- package/components/menu/menu-heading.page.js +28 -0
- package/components/menu/menu.page.js +18 -0
- package/components/menu/menu.page.styl +68 -0
- package/components/message/index.page.ts +166 -0
- package/components/message/worker.ts +110 -0
- package/components/messagepad/DialogueListItem.page.styl +28 -0
- package/components/messagepad/DialogueListItemComponent.jsx +39 -0
- package/components/messagepad/Message.page.styl +64 -0
- package/components/messagepad/MessageComponent.jsx +33 -0
- package/components/messagepad/MessagePad.page.styl +99 -0
- package/components/messagepad/MessagePadDialogueContentContainer.jsx +104 -0
- package/components/messagepad/MessagePadDialogueListContainer.jsx +49 -0
- package/components/messagepad/MessagePadInputContainer.jsx +100 -0
- package/components/messagepad/index.jsx +49 -0
- package/components/messagepad/reducers/activeId.ts +36 -0
- package/components/messagepad/reducers/dialogues.js +53 -0
- package/components/messagepad/reducers/index.ts +14 -0
- package/components/messagepad/reducers/inputs.js +43 -0
- package/components/messagepad/reducers/isPosting.ts +49 -0
- package/components/monaco/index.ts +178 -0
- package/components/monaco/languages/markdown.ts +97 -0
- package/components/monaco/languages/typescript.ts +45 -0
- package/components/monaco/languages/yaml.ts +22 -0
- package/components/monaco/loader.ts +96 -0
- package/components/monaco/monaco.styl +30 -0
- package/components/monaco/nls.js +31 -0
- package/components/monaco/schema/problemconfig.ts +123 -0
- package/components/navigation/hamburgers.page.styl +87 -0
- package/components/navigation/nav-logo-small_dark.png +0 -0
- package/components/navigation/navigation.page.js +203 -0
- package/components/navigation/navigation.page.styl +211 -0
- package/components/notification/index.ts +105 -0
- package/components/notification/notification.page.js +14 -0
- package/components/notification/notification.page.styl +84 -0
- package/components/nprogress.page.styl +50 -0
- package/components/omnisearch/index.page.tsx +124 -0
- package/components/omnisearch/omnibar.page.styl +138 -0
- package/components/pager/pager.page.styl +57 -0
- package/components/preview/preview.page.ts +187 -0
- package/components/problem/create.page.js +12 -0
- package/components/problem/list.page.js +9 -0
- package/components/problem/rp.page.styl +4 -0
- package/components/problem/tag.page.styl +84 -0
- package/components/problemconfig/BasicForm.tsx +92 -0
- package/components/problemconfig/ProblemConfigEditor.tsx +170 -0
- package/components/problemconfig/ProblemConfigForm.tsx +140 -0
- package/components/problemconfig/ProblemConfigTree.tsx +163 -0
- package/components/problemconfig/ProblemType.tsx +165 -0
- package/components/problemconfig/index.tsx +91 -0
- package/components/problemconfig/reducer/config.ts +173 -0
- package/components/problemconfig/reducer/index.ts +11 -0
- package/components/problemconfig/reducer/testdata.ts +16 -0
- package/components/problemconfig/tree/AddTestcase.tsx +137 -0
- package/components/problemconfig/tree/SelectionManager.tsx +140 -0
- package/components/problemconfig/tree/SubtaskSettings.tsx +180 -0
- package/components/problemconfig/tree/Testcase.tsx +98 -0
- package/components/profile/backgrounds/1.jpg +0 -0
- package/components/profile/backgrounds/10.jpg +0 -0
- package/components/profile/backgrounds/11.jpg +0 -0
- package/components/profile/backgrounds/12.jpg +0 -0
- package/components/profile/backgrounds/13.jpg +0 -0
- package/components/profile/backgrounds/14.jpg +0 -0
- package/components/profile/backgrounds/15.jpg +0 -0
- package/components/profile/backgrounds/16.jpg +0 -0
- package/components/profile/backgrounds/17.jpg +0 -0
- package/components/profile/backgrounds/18.jpg +0 -0
- package/components/profile/backgrounds/19.jpg +0 -0
- package/components/profile/backgrounds/2.jpg +0 -0
- package/components/profile/backgrounds/20.jpg +0 -0
- package/components/profile/backgrounds/21.jpg +0 -0
- package/components/profile/backgrounds/3.jpg +0 -0
- package/components/profile/backgrounds/4.jpg +0 -0
- package/components/profile/backgrounds/5.jpg +0 -0
- package/components/profile/backgrounds/6.jpg +0 -0
- package/components/profile/backgrounds/7.jpg +0 -0
- package/components/profile/backgrounds/8.jpg +0 -0
- package/components/profile/backgrounds/9.jpg +0 -0
- package/components/profile/backgrounds/gen_thumbnails.sh +7 -0
- package/components/profile/backgrounds/thumbnail/1.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/10.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/11.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/12.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/13.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/14.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/15.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/16.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/17.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/18.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/19.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/2.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/20.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/21.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/3.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/4.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/5.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/6.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/7.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/8.jpg +0 -0
- package/components/profile/backgrounds/thumbnail/9.jpg +0 -0
- package/components/profile/profile.page.styl +23 -0
- package/components/react/DomComponent.tsx +14 -0
- package/components/react/IconComponent.tsx +20 -0
- package/components/record/record.page.styl +26 -0
- package/components/rotator/index.js +75 -0
- package/components/rotator/rotator.page.styl +20 -0
- package/components/scratchpad/DataInput.page.styl +17 -0
- package/components/scratchpad/DataInputComponent.jsx +45 -0
- package/components/scratchpad/Editor.page.styl +13 -0
- package/components/scratchpad/Panel.page.styl +18 -0
- package/components/scratchpad/PanelButton.page.styl +15 -0
- package/components/scratchpad/PanelButtonComponent.jsx +19 -0
- package/components/scratchpad/PanelComponent.jsx +25 -0
- package/components/scratchpad/ScratchpadEditorContainer.tsx +137 -0
- package/components/scratchpad/ScratchpadPretestContainer.jsx +57 -0
- package/components/scratchpad/ScratchpadRecordsContainer.jsx +45 -0
- package/components/scratchpad/ScratchpadRecordsRowContainer.jsx +83 -0
- package/components/scratchpad/ScratchpadSettings.tsx +48 -0
- package/components/scratchpad/ScratchpadToolbarContainer.jsx +190 -0
- package/components/scratchpad/Tab.page.styl +24 -0
- package/components/scratchpad/Toolbar.page.styl +53 -0
- package/components/scratchpad/ToolbarComponent.jsx +85 -0
- package/components/scratchpad/index.tsx +132 -0
- package/components/scratchpad/reducers/editor.ts +24 -0
- package/components/scratchpad/reducers/index.ts +17 -0
- package/components/scratchpad/reducers/pretest.ts +34 -0
- package/components/scratchpad/reducers/records.ts +40 -0
- package/components/scratchpad/reducers/state.ts +10 -0
- package/components/scratchpad/reducers/ui.ts +152 -0
- package/components/scratchpad/scratchpad.page.styl +55 -0
- package/components/scratchpad/var.inc.styl +2 -0
- package/components/selectUser.tsx +16 -0
- package/components/signin/signInDialog.page.js +84 -0
- package/components/signin/signin_dialog.page.styl +57 -0
- package/components/smoothscroll/smoothscroll.page.js +44 -0
- package/components/socket/index.ts +68 -0
- package/components/star/star.page.styl +20 -0
- package/components/star/star.page.ts +58 -0
- package/components/sticky/sticky.page.js +66 -0
- package/components/tab/Tab.js +168 -0
- package/components/tab/tab.page.js +9 -0
- package/components/tab/tab.page.styl +105 -0
- package/components/tab/var.inc.styl +3 -0
- package/components/table/StyledTable.js +51 -0
- package/components/table/styledTable.page.js +8 -0
- package/components/table/table.page.styl +73 -0
- package/components/time/time.page.js +47 -0
- package/components/tooltip/Tooltip.js +49 -0
- package/components/tooltip/tooltip.page.js +29 -0
- package/components/tooltip/tooltip.page.styl +69 -0
- package/components/training/training.page.styl +25 -0
- package/components/upload.tsx +103 -0
- package/components/vote/vote.page.js +43 -0
- package/components/zipDownloader/index.ts +157 -0
- package/constant/domain.js +21 -0
- package/constant/message.js +5 -0
- package/constant/record.js +52 -0
- package/context.ts +11 -0
- package/entry.js +72 -0
- package/hydro.ts +112 -0
- package/index.ts +226 -0
- package/lazyload.ts +69 -0
- package/locales/en.yaml +71 -0
- package/locales/ko.yaml +823 -0
- package/locales/zh.yaml +1137 -0
- package/locales/zh_TW.yaml +1133 -0
- package/misc/Page.ts +49 -0
- package/misc/PageLoader.js +31 -0
- package/misc/float.styl +14 -0
- package/misc/grid.styl +1048 -0
- package/misc/immersive-background.jpg +0 -0
- package/misc/immersive-background@2x.jpg +0 -0
- package/misc/immersive.styl +23 -0
- package/misc/nothing.styl +13 -0
- package/misc/puzzled_twd2.svg +1 -0
- package/misc/section.styl +105 -0
- package/misc/slideout.styl +46 -0
- package/misc/structure.styl +158 -0
- package/misc/textalign.styl +11 -0
- package/misc/typography.styl +485 -0
- package/package.json +148 -0
- package/polyfill.ts +90 -0
- package/postcss.config.js +15 -0
- package/sentry.ts +26 -0
- package/service-worker.ts +265 -0
- package/setting.yaml +98 -0
- package/templates/about.html +14 -0
- package/templates/bsod.html +35 -0
- package/templates/components/comments_discussion.html +165 -0
- package/templates/components/comments_solution.html +171 -0
- package/templates/components/contest.html +12 -0
- package/templates/components/form.html +214 -0
- package/templates/components/home.html +20 -0
- package/templates/components/homework.html +8 -0
- package/templates/components/md_hint.html +39 -0
- package/templates/components/noscript_note.html +15 -0
- package/templates/components/nothing.html +6 -0
- package/templates/components/paginator.html +25 -0
- package/templates/components/problem.html +33 -0
- package/templates/components/record.html +21 -0
- package/templates/components/sidemenu.html +11 -0
- package/templates/components/user.html +49 -0
- package/templates/contest_balloon.html +48 -0
- package/templates/contest_clarification.html +103 -0
- package/templates/contest_detail.html +56 -0
- package/templates/contest_edit.html +259 -0
- package/templates/contest_main.html +146 -0
- package/templates/contest_manage.html +80 -0
- package/templates/contest_print.html +27 -0
- package/templates/contest_problemlist.html +231 -0
- package/templates/contest_scoreboard.html +46 -0
- package/templates/contest_scoreboard_download_html.html +71 -0
- package/templates/contest_user.html +47 -0
- package/templates/discussion_create.html +28 -0
- package/templates/discussion_detail.html +149 -0
- package/templates/discussion_edit.html +30 -0
- package/templates/discussion_main_or_node.html +47 -0
- package/templates/domain_base.html +26 -0
- package/templates/domain_create.html +55 -0
- package/templates/domain_dashboard.html +45 -0
- package/templates/domain_edit.html +6 -0
- package/templates/domain_group.html +51 -0
- package/templates/domain_join.html +47 -0
- package/templates/domain_join_applications.html +67 -0
- package/templates/domain_permission.html +66 -0
- package/templates/domain_role.html +71 -0
- package/templates/domain_user.html +86 -0
- package/templates/domain_user_raw.html +5 -0
- package/templates/error.html +25 -0
- package/templates/home_domain.html +64 -0
- package/templates/home_files.html +16 -0
- package/templates/home_messages.html +9 -0
- package/templates/home_security.html +224 -0
- package/templates/home_settings.html +21 -0
- package/templates/homework_detail.html +82 -0
- package/templates/homework_edit.html +138 -0
- package/templates/homework_files.html +24 -0
- package/templates/homework_main.html +76 -0
- package/templates/layout/basic.html +27 -0
- package/templates/layout/home_base.html +13 -0
- package/templates/layout/html5.html +74 -0
- package/templates/layout/immersive.html +22 -0
- package/templates/layout/mail.html +31 -0
- package/templates/layout/simple.html +4 -0
- package/templates/layout/wiki_base.html +16 -0
- package/templates/main.html +22 -0
- package/templates/manage_base.html +24 -0
- package/templates/manage_config.html +6 -0
- package/templates/manage_dashboard.html +27 -0
- package/templates/manage_script.html +56 -0
- package/templates/manage_setting.html +6 -0
- package/templates/manage_user_import.html +23 -0
- package/templates/manage_user_priv.html +76 -0
- package/templates/partials/category.html +19 -0
- package/templates/partials/contest.html +3 -0
- package/templates/partials/contest_balloon.html +37 -0
- package/templates/partials/contest_sidebar.html +150 -0
- package/templates/partials/contest_sidebar_management.html +56 -0
- package/templates/partials/contest_user.html +19 -0
- package/templates/partials/discussion_edit_form.html +45 -0
- package/templates/partials/discussion_list.html +50 -0
- package/templates/partials/discussion_nodes_widget.html +17 -0
- package/templates/partials/files.html +49 -0
- package/templates/partials/footer.html +108 -0
- package/templates/partials/hamburger.html +7 -0
- package/templates/partials/header_mobile.html +12 -0
- package/templates/partials/homepage/bulletin.html +7 -0
- package/templates/partials/homepage/contest.html +48 -0
- package/templates/partials/homepage/discussion.html +13 -0
- package/templates/partials/homepage/discussion_nodes.html +4 -0
- package/templates/partials/homepage/error.html +5 -0
- package/templates/partials/homepage/hitokoto.html +6 -0
- package/templates/partials/homepage/homework.html +45 -0
- package/templates/partials/homepage/problem_search.html +13 -0
- package/templates/partials/homepage/ranking.html +39 -0
- package/templates/partials/homepage/recent_problems.html +17 -0
- package/templates/partials/homepage/starred_problems.html +15 -0
- package/templates/partials/homepage/suggestion.html +34 -0
- package/templates/partials/homepage/training.html +50 -0
- package/templates/partials/homework.html +3 -0
- package/templates/partials/homework_default_penalty_rules.yaml +6 -0
- package/templates/partials/homework_sidebar.html +93 -0
- package/templates/partials/login_dialog.html +56 -0
- package/templates/partials/manage_user_priv.html +78 -0
- package/templates/partials/nav.html +138 -0
- package/templates/partials/problem-sidebar-information.html +25 -0
- package/templates/partials/problem.html +2 -0
- package/templates/partials/problem_category_dialog.html +43 -0
- package/templates/partials/problem_default.md +26 -0
- package/templates/partials/problem_description.html +33 -0
- package/templates/partials/problem_files.html +63 -0
- package/templates/partials/problem_list.html +68 -0
- package/templates/partials/problem_lucky.html +10 -0
- package/templates/partials/problem_sidebar.html +14 -0
- package/templates/partials/problem_sidebar_contest.html +43 -0
- package/templates/partials/problem_sidebar_homework.html +42 -0
- package/templates/partials/problem_sidebar_normal.html +152 -0
- package/templates/partials/problem_stat.html +3 -0
- package/templates/partials/scoreboard.html +79 -0
- package/templates/partials/setting.html +92 -0
- package/templates/partials/training_default.json +14 -0
- package/templates/partials/training_detail.html +153 -0
- package/templates/partials/user.html +2 -0
- package/templates/partials/user_detail/activity.html +18 -0
- package/templates/partials/user_detail/solution.html +29 -0
- package/templates/problem_config.html +39 -0
- package/templates/problem_detail.html +150 -0
- package/templates/problem_edit.html +111 -0
- package/templates/problem_files.html +91 -0
- package/templates/problem_hack.html +41 -0
- package/templates/problem_import.html +58 -0
- package/templates/problem_main.html +100 -0
- package/templates/problem_solution.html +55 -0
- package/templates/problem_statistics.html +96 -0
- package/templates/problem_submit.html +40 -0
- package/templates/ranking.html +81 -0
- package/templates/record_detail.html +134 -0
- package/templates/record_detail_status.html +93 -0
- package/templates/record_detail_summary.html +19 -0
- package/templates/record_main.html +142 -0
- package/templates/record_main_tr.html +35 -0
- package/templates/status.html +75 -0
- package/templates/training_detail.html +120 -0
- package/templates/training_edit.html +68 -0
- package/templates/training_files.html +64 -0
- package/templates/training_main.html +107 -0
- package/templates/user_changemail_mail.html +6 -0
- package/templates/user_changemail_mail_sent.html +9 -0
- package/templates/user_delete_pending.html +10 -0
- package/templates/user_detail.html +181 -0
- package/templates/user_login.html +46 -0
- package/templates/user_logout.html +13 -0
- package/templates/user_lostpass.html +27 -0
- package/templates/user_lostpass_mail.html +6 -0
- package/templates/user_lostpass_mail_sent.html +9 -0
- package/templates/user_lostpass_with_code.html +29 -0
- package/templates/user_register.html +22 -0
- package/templates/user_register_mail.html +6 -0
- package/templates/user_register_mail_sent.html +9 -0
- package/templates/user_register_with_code.html +35 -0
- package/templates/user_sudo.html +54 -0
- package/templates/user_sudo_redirect.html +18 -0
- package/templates/wiki_help.html +189 -0
- package/theme/bp6-compat.css +48 -0
- package/theme/dark.styl +397 -0
- package/theme/default.js +33 -0
- package/typed.d.ts +20 -0
- package/utils/base.ts +209 -0
- package/utils/base64.js +104 -0
- package/utils/db.ts +32 -0
- package/utils/index.ts +73 -0
- package/utils/loadReactRedux.ts +32 -0
- package/utils/mediaQuery.ts +13 -0
- package/utils/pjax.js +148 -0
- package/utils/slide.ts +57 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { getFeatures, load as loadModule } from '../../lazyload';
|
|
2
|
+
|
|
3
|
+
let loaded;
|
|
4
|
+
|
|
5
|
+
const val: Record<string, any> = {};
|
|
6
|
+
/** @deprecated */
|
|
7
|
+
export async function legacyLoadExternalModule(target: string) {
|
|
8
|
+
if (val[target]) return val[target];
|
|
9
|
+
const ele = document.createElement('script');
|
|
10
|
+
ele.src = target;
|
|
11
|
+
await new Promise((resolve, reject) => {
|
|
12
|
+
ele.onload = resolve;
|
|
13
|
+
ele.onerror = reject;
|
|
14
|
+
document.head.appendChild(ele);
|
|
15
|
+
});
|
|
16
|
+
val[target] = window.exports;
|
|
17
|
+
return val[target];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const loaders = {
|
|
21
|
+
i18n: async () => {
|
|
22
|
+
const { setLocaleData } = await import('./nls');
|
|
23
|
+
let resource;
|
|
24
|
+
const lang = UserContext.viewLang;
|
|
25
|
+
if (lang === 'zh') {
|
|
26
|
+
resource = await import('monaco-editor-nls/locale/zh-hans.json');
|
|
27
|
+
} else if (lang === 'zh_TW') {
|
|
28
|
+
resource = await import('monaco-editor-nls/locale/zh-hant.json');
|
|
29
|
+
} else if (lang === 'ko') {
|
|
30
|
+
resource = await import('monaco-editor-nls/locale/ko.json');
|
|
31
|
+
}
|
|
32
|
+
if (resource) setLocaleData(resource);
|
|
33
|
+
},
|
|
34
|
+
markdown: () => import('./languages/markdown'),
|
|
35
|
+
typescript: () => import('./languages/typescript').then((m) => m.loadTypes()),
|
|
36
|
+
yaml: () => import('./languages/yaml'),
|
|
37
|
+
external: async (monaco, feat) => {
|
|
38
|
+
for (const item of await getFeatures(`monaco-${feat}`)) {
|
|
39
|
+
let apply = typeof item === 'function'
|
|
40
|
+
? item
|
|
41
|
+
: (item.startsWith('http') || item.startsWith('/'))
|
|
42
|
+
? await legacyLoadExternalModule(item)
|
|
43
|
+
: (await loadModule(item)).apply;
|
|
44
|
+
if (typeof apply !== 'function') apply = apply.default || apply.apply;
|
|
45
|
+
if (typeof apply === 'function') await apply(monaco);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
let loadPromise = Promise.resolve();
|
|
51
|
+
|
|
52
|
+
export async function load(features = ['markdown']) {
|
|
53
|
+
let s = Date.now();
|
|
54
|
+
await loadPromise;
|
|
55
|
+
let resolve;
|
|
56
|
+
loadPromise = new Promise((r) => { resolve = r; });
|
|
57
|
+
if (!loaded) {
|
|
58
|
+
await loaders.i18n();
|
|
59
|
+
console.log('Loading monaco editor');
|
|
60
|
+
}
|
|
61
|
+
const res = await import('./index');
|
|
62
|
+
if (!loaded) {
|
|
63
|
+
console.log('Loaded monaco editor in', Date.now() - s, 'ms');
|
|
64
|
+
loaded = [];
|
|
65
|
+
}
|
|
66
|
+
for (const feat of features) {
|
|
67
|
+
if (loaded.includes(feat)) continue;
|
|
68
|
+
if (!loaders[feat]) {
|
|
69
|
+
const items = await getFeatures(`monaco-${feat}`);
|
|
70
|
+
if (!items.length) {
|
|
71
|
+
console.warn('Unknown monaco feature:', feat);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
s = Date.now();
|
|
76
|
+
console.log('Loading monaco feature:', feat);
|
|
77
|
+
try {
|
|
78
|
+
if (loaders[feat]) await loaders[feat]();
|
|
79
|
+
else await loaders.external(res.default, feat);
|
|
80
|
+
console.log('Loaded monaco feature:', feat, 'in', Date.now() - s, 'ms');
|
|
81
|
+
loaded.push(feat);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.log('Monaco feat', feat, 'failed to load:', e);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
await res.loadThemePromise;
|
|
87
|
+
resolve();
|
|
88
|
+
return {
|
|
89
|
+
monaco: res.default,
|
|
90
|
+
registerAction: res.registerAction,
|
|
91
|
+
customOptions: res.customOptions,
|
|
92
|
+
renderMarkdown: res.renderMarkdown,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default load;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[data-mode-id="markdown"] > .monaco-editor
|
|
2
|
+
[widgetid="editor.widget.suggestWidget"]
|
|
3
|
+
width: 250px !important;
|
|
4
|
+
|
|
5
|
+
[widgetid="suggest.details"], .suggest-details.no-type
|
|
6
|
+
width: 64px !important;
|
|
7
|
+
height: 64px !important;
|
|
8
|
+
.codicon-close, .scrollbar
|
|
9
|
+
display: none;
|
|
10
|
+
.docs.markdown-docs > div
|
|
11
|
+
padding: 0 !important;
|
|
12
|
+
img
|
|
13
|
+
z-index: 100;
|
|
14
|
+
width: 64px;
|
|
15
|
+
height: 64px;
|
|
16
|
+
position: absolute;
|
|
17
|
+
a[title="#loader"]
|
|
18
|
+
text-indent: -9999em
|
|
19
|
+
z-index: 99;
|
|
20
|
+
border: rem(5px) solid rgba($primary-color, .2)
|
|
21
|
+
border-left: rem(5px) solid $primary-color
|
|
22
|
+
animation: load8 1.1s infinite linear
|
|
23
|
+
border-radius: 50%
|
|
24
|
+
width: rem(50px)
|
|
25
|
+
height: rem(50px)
|
|
26
|
+
margin-left: rem(-25px)
|
|
27
|
+
margin-top: rem(-25px)
|
|
28
|
+
left: 50%
|
|
29
|
+
top: 50%
|
|
30
|
+
position: absolute
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { getNLSLanguage, getNLSMessages } from 'monaco-editor/esm/vs/nls.messages';
|
|
2
|
+
|
|
3
|
+
function format(message, args) {
|
|
4
|
+
let result;
|
|
5
|
+
if (!args.length) result = message;
|
|
6
|
+
else {
|
|
7
|
+
result = String(message).replace(/\{(\d+)\}/g, (match, rest) => {
|
|
8
|
+
const index = rest[0];
|
|
9
|
+
return typeof args[index] !== 'undefined' ? args[index] : match;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let CURRENT_LOCALE_DATA = {}; // eslint-disable-line ts/naming-convention
|
|
16
|
+
|
|
17
|
+
export function localize(path, message, ...args) {
|
|
18
|
+
return format(CURRENT_LOCALE_DATA[path.key || path] || CURRENT_LOCALE_DATA[message] || message, args);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function localize2(data, message, ...args) {
|
|
22
|
+
const original = localize(data, message, args);
|
|
23
|
+
return {
|
|
24
|
+
value: original,
|
|
25
|
+
original,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function setLocaleData(data) {
|
|
30
|
+
CURRENT_LOCALE_DATA = Object.assign(...Object.values(data));
|
|
31
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
|
+
|
|
3
|
+
export const testlibCheckers = [
|
|
4
|
+
'acmp', 'caseicmp', 'casencmp', 'casewcmp', 'dcmp', 'fcmp', 'hcmp',
|
|
5
|
+
'icmp', 'lcmp', 'ncmp', 'nyesno', 'pointscmp', 'pointsinfo',
|
|
6
|
+
'rcmp', 'rcmp4', 'rcmp6', 'rcmp9', 'rncmp', 'uncmp', 'wcmp', 'yesno',
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
const problemConfigSchema: JSONSchema7 = {
|
|
10
|
+
type: 'object',
|
|
11
|
+
definitions: {
|
|
12
|
+
cases: { type: 'array', items: { $ref: '#/definitions/case' } },
|
|
13
|
+
case: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
input: { type: 'string' },
|
|
17
|
+
output: { type: 'string' },
|
|
18
|
+
time: { $ref: '#/definitions/time' },
|
|
19
|
+
memory: { $ref: '#/definitions/memory' },
|
|
20
|
+
score: { $ref: '#/definitions/score', description: 'score' },
|
|
21
|
+
},
|
|
22
|
+
required: ['input'],
|
|
23
|
+
additionalProperties: false,
|
|
24
|
+
},
|
|
25
|
+
subtask: {
|
|
26
|
+
description: 'Subtask Info',
|
|
27
|
+
type: 'object',
|
|
28
|
+
properties: {
|
|
29
|
+
type: { enum: ['min', 'max', 'sum'] },
|
|
30
|
+
time: { $ref: '#/definitions/time' },
|
|
31
|
+
memory: { $ref: '#/definitions/memory' },
|
|
32
|
+
score: { $ref: '#/definitions/score', description: 'score' },
|
|
33
|
+
cases: { $ref: '#/definitions/cases' },
|
|
34
|
+
if: { type: 'array', items: { type: 'integer' } },
|
|
35
|
+
id: { type: 'integer' },
|
|
36
|
+
},
|
|
37
|
+
required: ['score'],
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
},
|
|
40
|
+
time: { type: 'string', pattern: '^([1-9][0-9]*(?:\\.[0-9]+)?|0\\.[0-9]*[1-9][0-9]*)([mu]?)s?$' },
|
|
41
|
+
memory: { type: 'string', pattern: '^([1-9][0-9]*(?:\\.[0-9]+)?|0\\.[0-9]*[1-9][0-9]*)([kKmMgG])[bB]?$' },
|
|
42
|
+
score: { type: 'integer', maximum: 100, minimum: 1 },
|
|
43
|
+
rateConfig: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
patternProperties: {
|
|
46
|
+
'^.+$': {
|
|
47
|
+
type: 'number',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
compilableFile: {
|
|
52
|
+
oneOf: [
|
|
53
|
+
{ type: 'string', pattern: '\\.' },
|
|
54
|
+
{
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
file: { type: 'string', pattern: '\\.' },
|
|
58
|
+
lang: { type: 'string' },
|
|
59
|
+
},
|
|
60
|
+
required: ['file', 'lang'],
|
|
61
|
+
additionalProperties: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
properties: {
|
|
67
|
+
redirect: { type: 'string', pattern: '[0-9a-zA-Z_-]+\\/[0-9]+' },
|
|
68
|
+
key: { type: 'string', pattern: '[0-9a-f]{32}' },
|
|
69
|
+
type: { enum: ['default', 'interactive', 'communication', 'submit_answer', 'objective', 'remote_judge'] },
|
|
70
|
+
subType: { type: 'string' },
|
|
71
|
+
langs: { type: 'array', items: { type: 'string' } },
|
|
72
|
+
target: { type: 'string' },
|
|
73
|
+
checker_type: { enum: ['default', 'lemon', 'syzoj', 'hustoj', 'testlib', 'strict', 'qduoj', 'kattis'] },
|
|
74
|
+
checker: {
|
|
75
|
+
oneOf: [
|
|
76
|
+
{ type: 'string', enum: testlibCheckers },
|
|
77
|
+
{ $ref: '#/definitions/compilableFile' },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
interactor: { $ref: '#/definitions/compilableFile' },
|
|
81
|
+
manager: { $ref: '#/definitions/compilableFile' },
|
|
82
|
+
num_processes: { type: 'integer', maximum: 5, minimum: 1 },
|
|
83
|
+
multi_pass: { type: 'integer', maximum: 20, minimum: 2 },
|
|
84
|
+
validator: { $ref: '#/definitions/compilableFile' },
|
|
85
|
+
user_extra_files: { type: 'array', items: { type: 'string' } },
|
|
86
|
+
judge_extra_files: { type: 'array', items: { type: 'string' } },
|
|
87
|
+
cases: { $ref: '#/definitions/cases' },
|
|
88
|
+
subtasks: { type: 'array', items: { $ref: '#/definitions/subtask' } },
|
|
89
|
+
filename: { type: 'string' },
|
|
90
|
+
detail: { type: 'string', enum: ['full', 'case', 'none'] },
|
|
91
|
+
time: { $ref: '#/definitions/time' },
|
|
92
|
+
memory: { $ref: '#/definitions/memory' },
|
|
93
|
+
score: { $ref: '#/definitions/score' },
|
|
94
|
+
template: {
|
|
95
|
+
type: 'object',
|
|
96
|
+
patternProperties: {
|
|
97
|
+
'^.*$': {
|
|
98
|
+
type: 'array',
|
|
99
|
+
minLength: 2,
|
|
100
|
+
maxLength: 2,
|
|
101
|
+
items: { type: 'string' },
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
additionalProperties: false,
|
|
105
|
+
},
|
|
106
|
+
answers: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
patternProperties: {
|
|
109
|
+
'^\\d+(-\\d+)?$': {
|
|
110
|
+
type: 'array',
|
|
111
|
+
minLength: 2,
|
|
112
|
+
maxLength: 2,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
additionalProperties: false,
|
|
116
|
+
},
|
|
117
|
+
time_limit_rate: { $ref: '#/definitions/rateConfig' },
|
|
118
|
+
memory_limit_rate: { $ref: '#/definitions/rateConfig' },
|
|
119
|
+
},
|
|
120
|
+
additionalProperties: false,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export default problemConfigSchema;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// extracted from:
|
|
2
|
+
// https://github.com/jonsuh/hamburgers/blob/master/dist/hamburgers.css
|
|
3
|
+
// copyright @jonsuh
|
|
4
|
+
.hamburger
|
|
5
|
+
padding: 0px 0px
|
|
6
|
+
display: inline-block
|
|
7
|
+
cursor: pointer
|
|
8
|
+
transition-property: opacity, -webkit-filter
|
|
9
|
+
transition-property: opacity, filter
|
|
10
|
+
transition-property: opacity, filter, -webkit-filter
|
|
11
|
+
transition-duration: 0.15s
|
|
12
|
+
transition-timing-function: linear
|
|
13
|
+
font: inherit
|
|
14
|
+
color: inherit
|
|
15
|
+
text-transform: none
|
|
16
|
+
background-color: transparent
|
|
17
|
+
border: 0
|
|
18
|
+
margin: 0
|
|
19
|
+
overflow: visible
|
|
20
|
+
|
|
21
|
+
.hamburger:hover
|
|
22
|
+
opacity: 0.7
|
|
23
|
+
|
|
24
|
+
.hamburger-box
|
|
25
|
+
width: rem(18px)
|
|
26
|
+
height: rem(12px)
|
|
27
|
+
display: inline-block
|
|
28
|
+
position: relative
|
|
29
|
+
|
|
30
|
+
.hamburger-inner
|
|
31
|
+
display: block
|
|
32
|
+
top: 50%
|
|
33
|
+
margin-top: rem(-1px)
|
|
34
|
+
|
|
35
|
+
.hamburger-inner,
|
|
36
|
+
.hamburger-inner::before,
|
|
37
|
+
.hamburger-inner::after
|
|
38
|
+
width: rem(18px)
|
|
39
|
+
height: rem(2px)
|
|
40
|
+
background-color: #FFF
|
|
41
|
+
border-radius: 1px
|
|
42
|
+
position: absolute
|
|
43
|
+
transition-property: transform
|
|
44
|
+
transition-duration: 0.15s
|
|
45
|
+
transition-timing-function: ease
|
|
46
|
+
|
|
47
|
+
.layout--immersive
|
|
48
|
+
.hamburger-inner,
|
|
49
|
+
.hamburger-inner::before,
|
|
50
|
+
.hamburger-inner::after
|
|
51
|
+
background-color: #FFF
|
|
52
|
+
|
|
53
|
+
.hamburger-inner::before,
|
|
54
|
+
.hamburger-inner::after
|
|
55
|
+
content: ""
|
|
56
|
+
display: block
|
|
57
|
+
|
|
58
|
+
.hamburger-inner::before
|
|
59
|
+
top: rem(-5px)
|
|
60
|
+
|
|
61
|
+
.hamburger-inner::after
|
|
62
|
+
bottom: rem(-5px)
|
|
63
|
+
|
|
64
|
+
.hamburger--spin .hamburger-inner
|
|
65
|
+
transition-duration: 0.3s
|
|
66
|
+
transition-timing-function: ease-out-cubic
|
|
67
|
+
|
|
68
|
+
.hamburger--spin .hamburger-inner::before
|
|
69
|
+
transition: top 0.1s 0.34s ease-in, opacity 0.1s ease-in
|
|
70
|
+
|
|
71
|
+
.hamburger--spin .hamburger-inner::after
|
|
72
|
+
transition: bottom 0.1s 0.34s ease-in, transform 0.3s ease-in-cubic
|
|
73
|
+
|
|
74
|
+
.hamburger--spin.is-active .hamburger-inner
|
|
75
|
+
transform: rotate(225deg)
|
|
76
|
+
transition-delay: 0.14s
|
|
77
|
+
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1)
|
|
78
|
+
|
|
79
|
+
.hamburger--spin.is-active .hamburger-inner::before
|
|
80
|
+
top: 0
|
|
81
|
+
opacity: 0
|
|
82
|
+
transition: top 0.1s ease-out, opacity 0.1s 0.14s ease-out
|
|
83
|
+
|
|
84
|
+
.hamburger--spin.is-active .hamburger-inner::after
|
|
85
|
+
bottom: 0
|
|
86
|
+
transform: rotate(-90deg)
|
|
87
|
+
transition: bottom 0.1s ease-out, transform 0.3s 0.14s ease-out-cubic
|
|
Binary file
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import $ from 'jquery';
|
|
2
|
+
import responsiveCutoff from 'vj/breakpoints.json';
|
|
3
|
+
import Notification from 'vj/components/notification';
|
|
4
|
+
import selectUser from 'vj/components/selectUser';
|
|
5
|
+
import { AutoloadPage } from 'vj/misc/Page';
|
|
6
|
+
import { i18n, request, tpl } from 'vj/utils';
|
|
7
|
+
|
|
8
|
+
function handleNavLogoutClick(ev) {
|
|
9
|
+
const $logoutLink = $(ev.currentTarget);
|
|
10
|
+
request
|
|
11
|
+
.post($logoutLink.attr('href'))
|
|
12
|
+
.then(() => window.location.reload());
|
|
13
|
+
ev.preventDefault();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function handlerSwitchAccount(ev) {
|
|
17
|
+
ev.preventDefault();
|
|
18
|
+
const target = await selectUser('Hint::icon::switch_account');
|
|
19
|
+
if (!target) return;
|
|
20
|
+
try {
|
|
21
|
+
const res = await request.get(`/account/${target._id}`);
|
|
22
|
+
if (res.url) window.location.href = res.url;
|
|
23
|
+
else window.location.reload();
|
|
24
|
+
} catch (error) {
|
|
25
|
+
Notification.error(error.message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let $trigger;
|
|
30
|
+
let $menu;
|
|
31
|
+
|
|
32
|
+
function handleNavbar() {
|
|
33
|
+
let fromHide = false;
|
|
34
|
+
if ($(document).width() <= responsiveCutoff.mobile) {
|
|
35
|
+
$menu.children().each(function () {
|
|
36
|
+
const $ele = $(this);
|
|
37
|
+
$ele.addClass('nav__list-item').removeClass('menu__item');
|
|
38
|
+
$ele.children('a').addClass('nav__item').removeClass('menu__link');
|
|
39
|
+
$ele.insertBefore($trigger, null);
|
|
40
|
+
});
|
|
41
|
+
$trigger.hide();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
$trigger.show();
|
|
45
|
+
|
|
46
|
+
const base = 70;
|
|
47
|
+
|
|
48
|
+
let navItems = $('.nav__list--main > .nav__list-item');
|
|
49
|
+
let navItem = navItems.length - 2;
|
|
50
|
+
while (navItem && $('#menu').children('div').height() > base) {
|
|
51
|
+
if (!$(navItems[navItem]).children('a').hasClass('nav--active')) {
|
|
52
|
+
$(navItems[navItem]).removeClass('nav__list-item').addClass('menu__item');
|
|
53
|
+
$(navItems[navItem]).children('a').removeClass('nav__item').addClass('menu__link');
|
|
54
|
+
$menu.prepend($(navItems[navItem]));
|
|
55
|
+
}
|
|
56
|
+
navItem--;
|
|
57
|
+
fromHide = true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!fromHide && $menu.children().length) {
|
|
61
|
+
while ($('#menu').children('div').height() <= base && $menu.children().length) {
|
|
62
|
+
const $ele = $menu.children().first();
|
|
63
|
+
$ele.addClass('nav__list-item').removeClass('menu__item');
|
|
64
|
+
$ele.children('a').addClass('nav__item').removeClass('menu__link');
|
|
65
|
+
$ele.insertBefore($trigger, null);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
navItems = $('.nav__list--main > .nav__list-item');
|
|
70
|
+
navItem = navItems.length - 2;
|
|
71
|
+
if ($('#menu').children('div').height() > base) {
|
|
72
|
+
while (navItem && $('#menu').children('div').height() > base) {
|
|
73
|
+
if (!$(navItems[navItem]).children('a').hasClass('nav--active')) {
|
|
74
|
+
$(navItems[navItem]).removeClass('nav__list-item').addClass('menu__item');
|
|
75
|
+
$(navItems[navItem]).children('a').removeClass('nav__item').addClass('menu__link');
|
|
76
|
+
$menu.prepend($(navItems[navItem]));
|
|
77
|
+
}
|
|
78
|
+
navItem--;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!$menu.children().length) $trigger.hide();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const navigationPage = new AutoloadPage('navigationPage', () => {
|
|
86
|
+
if (!document.getElementById('panel') || !document.getElementById('menu')) return;
|
|
87
|
+
|
|
88
|
+
$(document).on('click', '[name="nav_logout"]', handleNavLogoutClick);
|
|
89
|
+
$(document).on('click', '[name="nav_switch_account"]', handlerSwitchAccount);
|
|
90
|
+
|
|
91
|
+
let isOpen = false;
|
|
92
|
+
const panel = document.getElementById('panel');
|
|
93
|
+
const $slideoutOverlay = $('.slideout-overlay');
|
|
94
|
+
const $hamburger = $('.header__hamburger .hamburger');
|
|
95
|
+
const PADDING = 200;
|
|
96
|
+
const TOLERANCE = 70;
|
|
97
|
+
|
|
98
|
+
function isMobileLayout() {
|
|
99
|
+
return $(document).width() <= responsiveCutoff.mobile;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function setTranslateX(x) {
|
|
103
|
+
panel.style.transform = x ? `translateX(${x}px)` : '';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function open() {
|
|
107
|
+
if (!isMobileLayout()) return;
|
|
108
|
+
isOpen = true;
|
|
109
|
+
$('html').addClass('slideout-open');
|
|
110
|
+
setTranslateX(-PADDING);
|
|
111
|
+
$hamburger.addClass('is-active');
|
|
112
|
+
$slideoutOverlay.show();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Touch swipe support
|
|
116
|
+
let touchStartX = 0;
|
|
117
|
+
let touchStartY = 0;
|
|
118
|
+
let touchCurrentX = 0;
|
|
119
|
+
let isSwiping = false;
|
|
120
|
+
let isScrolling = false;
|
|
121
|
+
|
|
122
|
+
function close() {
|
|
123
|
+
isOpen = false;
|
|
124
|
+
isSwiping = false;
|
|
125
|
+
isScrolling = false;
|
|
126
|
+
panel.style.transition = '';
|
|
127
|
+
setTranslateX(0);
|
|
128
|
+
$hamburger.removeClass('is-active');
|
|
129
|
+
$slideoutOverlay.hide();
|
|
130
|
+
$('html').removeClass('slideout-open');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
panel.addEventListener('touchstart', (e) => {
|
|
134
|
+
if (!isMobileLayout() || e.target.closest('[data-slideout-ignore]')) return;
|
|
135
|
+
touchStartX = e.touches[0].clientX;
|
|
136
|
+
touchStartY = e.touches[0].clientY;
|
|
137
|
+
touchCurrentX = touchStartX;
|
|
138
|
+
isSwiping = false;
|
|
139
|
+
isScrolling = false;
|
|
140
|
+
}, { passive: true });
|
|
141
|
+
|
|
142
|
+
panel.addEventListener('touchmove', (e) => {
|
|
143
|
+
if (!isMobileLayout()) return;
|
|
144
|
+
touchCurrentX = e.touches[0].clientX;
|
|
145
|
+
const dx = touchStartX - touchCurrentX;
|
|
146
|
+
if (!isSwiping) {
|
|
147
|
+
if (isScrolling) return;
|
|
148
|
+
const dy = touchStartY - e.touches[0].clientY;
|
|
149
|
+
const absDx = Math.abs(dx);
|
|
150
|
+
const absDy = Math.abs(dy);
|
|
151
|
+
if (absDx < 10 && absDy < 10) return;
|
|
152
|
+
// Lock to scroll if vertical movement dominates
|
|
153
|
+
if (absDy > absDx) {
|
|
154
|
+
isScrolling = true;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
isSwiping = true;
|
|
158
|
+
if (!isOpen) $slideoutOverlay.show();
|
|
159
|
+
$('html').addClass('slideout-open');
|
|
160
|
+
panel.style.transition = 'none';
|
|
161
|
+
}
|
|
162
|
+
setTranslateX(isOpen
|
|
163
|
+
? Math.max(-PADDING, Math.min(0, -PADDING - dx))
|
|
164
|
+
: Math.max(-PADDING, Math.min(0, -dx)));
|
|
165
|
+
}, { passive: true });
|
|
166
|
+
|
|
167
|
+
panel.addEventListener('touchend', () => {
|
|
168
|
+
if (!isMobileLayout() || !isSwiping) return;
|
|
169
|
+
panel.style.transition = '';
|
|
170
|
+
const dx = touchStartX - touchCurrentX;
|
|
171
|
+
if (isOpen) {
|
|
172
|
+
if (-dx > TOLERANCE) close();
|
|
173
|
+
else open();
|
|
174
|
+
} else {
|
|
175
|
+
if (dx > TOLERANCE) open();
|
|
176
|
+
else close();
|
|
177
|
+
}
|
|
178
|
+
isSwiping = false;
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
$slideoutOverlay.on('click', close);
|
|
182
|
+
$('.header__hamburger').on('click', () => (isOpen ? close() : open()));
|
|
183
|
+
$(window).on('resize', () => {
|
|
184
|
+
handleNavbar();
|
|
185
|
+
if (!isMobileLayout()) close();
|
|
186
|
+
});
|
|
187
|
+
setInterval(handleNavbar, 3000);
|
|
188
|
+
}, () => {
|
|
189
|
+
$trigger = $(tpl`
|
|
190
|
+
<li class="nav__list-item nav_more" data-dropdown-pos="bottom right" data-dropdown-target="#menu-nav-more">
|
|
191
|
+
<a href="javascript:;" class="nav__item">
|
|
192
|
+
${i18n('More')} <span class="icon icon-expand_more"></span>
|
|
193
|
+
</a>
|
|
194
|
+
</li>
|
|
195
|
+
`);
|
|
196
|
+
$menu = $('<ol class="dropdown-target menu menu_more" id="menu-nav-more">');
|
|
197
|
+
$trigger.append($menu);
|
|
198
|
+
$('.nav__list--main').append($trigger);
|
|
199
|
+
|
|
200
|
+
handleNavbar();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
export default navigationPage;
|