mirror of
https://github.com/go-gitea/gitea.git
synced 2026-01-31 19:59:56 +01:00
This adds [knip](https://github.com/webpro-nl/knip), a tool to find unused files, dependencies and exports in JS. Fixed all discovered issues. 1. knip apparently has some issue resolving imports from `d.ts` to `.ts` so I worked around it by moving the two affected types to where they are used. 2. I don't know why `modules/fomantic/dropdown.ts` had a new typescript error, but I fixed it. 3. Use named export for `EsbuildPlugin`, I think this was added recently.
50 lines
2.8 KiB
Handlebars
50 lines
2.8 KiB
Handlebars
{{/* ==== DO NOT EDIT ====
|
|
If you are customizing Gitea, please do not change this file.
|
|
If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
|
|
*/}}
|
|
<script>
|
|
{{/* before our JS code gets loaded, use arrays to store errors, then the arrays will be switched to our error handler later */}}
|
|
window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
|
window.addEventListener('unhandledrejection', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
|
|
window.config = {
|
|
appUrl: '{{AppUrl}}',
|
|
appSubUrl: '{{AppSubUrl}}',
|
|
assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly
|
|
assetUrlPrefix: '{{AssetUrlPrefix}}',
|
|
runModeIsProd: {{.RunModeIsProd}},
|
|
customEmojis: {{CustomEmojis}},
|
|
pageData: {{.PageData}},
|
|
notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}}
|
|
enableTimeTracking: {{EnableTimetracking}},
|
|
{{if or .Participants .Assignees .MentionableTeams}}
|
|
mentionValues: Array.from(new Map([
|
|
{{- range .Participants -}}
|
|
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink ctx}}'}],
|
|
{{- end -}}
|
|
{{- range .Assignees -}}
|
|
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink ctx}}'}],
|
|
{{- end -}}
|
|
{{- range .MentionableTeams -}}
|
|
['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}', name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}],
|
|
{{- end -}}
|
|
]).values()),
|
|
{{else}}
|
|
mentionValues: [],
|
|
{{end}}
|
|
mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}},
|
|
{{/* this global i18n object should only contain general texts. for specialized texts, it should be provided inside the related modules by: (1) API response (2) HTML data-attribute (3) PageData */}}
|
|
i18n: {
|
|
copy_success: {{ctx.Locale.Tr "copy_success"}},
|
|
copy_error: {{ctx.Locale.Tr "copy_error"}},
|
|
error_occurred: {{ctx.Locale.Tr "error.occurred"}},
|
|
remove_label_str: {{ctx.Locale.Tr "remove_label_str"}},
|
|
modal_confirm: {{ctx.Locale.Tr "modal.confirm"}},
|
|
modal_cancel: {{ctx.Locale.Tr "modal.cancel"}},
|
|
more_items: {{ctx.Locale.Tr "more_items"}},
|
|
},
|
|
};
|
|
{{/* in case some pages don't render the pageData, we make sure it is an object to prevent null access */}}
|
|
window.config.pageData = window.config.pageData || {};
|
|
</script>
|
|
<script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script>
|