You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

head_script.tmpl 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {{/*
  2. ==== DO NOT EDIT ====
  3. If you are customizing Gitea, please do not change this file.
  4. If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
  5. */}}
  6. <script>
  7. window.addEventListener('error', function(e) {window._globalHandlerErrors=window._globalHandlerErrors||[]; window._globalHandlerErrors.push(e);});
  8. window.config = {
  9. appUrl: '{{AppUrl}}',
  10. appSubUrl: '{{AppSubUrl}}',
  11. assetVersionEncoded: encodeURIComponent('{{AssetVersion}}'), // will be used in URL construction directly
  12. assetUrlPrefix: '{{AssetUrlPrefix}}',
  13. runModeIsProd: {{.RunModeIsProd}},
  14. customEmojis: {{CustomEmojis}},
  15. useServiceWorker: {{UseServiceWorker}},
  16. csrfToken: '{{.CsrfToken}}',
  17. pageData: {{.PageData}},
  18. requireTribute: {{.RequireTribute}},
  19. notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}}
  20. enableTimeTracking: {{EnableTimetracking}},
  21. {{if .RequireTribute}}
  22. tributeValues: Array.from(new Map([
  23. {{range .Participants}}
  24. ['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
  25. name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
  26. {{end}}
  27. {{range .Assignees}}
  28. ['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}',
  29. name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink}}'}],
  30. {{end}}
  31. {{range .MentionableTeams}}
  32. ['{{$.MentionableTeamsOrg}}/{{.Name}}', {key: '{{$.MentionableTeamsOrg}}/{{.Name}}', value: '{{$.MentionableTeamsOrg}}/{{.Name}}',
  33. name: '{{$.MentionableTeamsOrg}}/{{.Name}}', avatar: '{{$.MentionableTeamsOrgAvatar}}'}],
  34. {{end}}
  35. ]).values()),
  36. {{end}}
  37. mermaidMaxSourceCharacters: {{MermaidMaxSourceCharacters}},
  38. {{/* 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 */}}
  39. i18n: {
  40. copy_success: '{{.locale.Tr "copy_success"}}',
  41. copy_error: '{{.locale.Tr "copy_error"}}',
  42. error_occurred: '{{.locale.Tr "error.occurred"}}',
  43. network_error: '{{.locale.Tr "error.network_error"}}',
  44. },
  45. };
  46. {{/* in case some pages don't render the pageData, we make sure it is an object to prevent null access */}}
  47. window.config.pageData = window.config.pageData || {};
  48. </script>