Skip to content

Commit fa0262e

Browse files
committed
Merge branch 'main' into lunny/improve_notification
2 parents 886c476 + e01c921 commit fa0262e

File tree

11 files changed

+96
-36
lines changed

11 files changed

+96
-36
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ module.exports = {
484484
'max-nested-callbacks': [0],
485485
'max-params': [0],
486486
'max-statements': [0],
487-
'multiline-comment-style': [2, 'separate-lines'],
487+
'multiline-comment-style': [0],
488488
'new-cap': [0],
489489
'no-alert': [0],
490490
'no-array-constructor': [0], // handled by @typescript-eslint/no-array-constructor

options/locale/locale_fr-FR.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ no_results_found=Aucun résultat trouvé.
167167
internal_error_skipped=Une erreur interne est survenue, mais ignorée : %s
168168

169169
[search]
170+
search=Rechercher…
170171
type_tooltip=Type de recherche
171172
fuzzy=Approximative
172173
fuzzy_tooltip=Inclure également les résultats proches de la recherche
@@ -176,9 +177,18 @@ regexp=Regexp
176177
regexp_tooltip=Inclure uniquement les résultats qui correspondent à l’expression régulière recherchée
177178
exact=Exact
178179
exact_tooltip=Inclure uniquement les résultats qui correspondent exactement au terme de recherche
180+
repo_kind=Chercher des dépôts…
181+
user_kind=Chercher des utilisateurs…
182+
org_kind=Chercher des organisations…
183+
team_kind=Chercher des équipes…
184+
code_kind=Chercher du code…
179185
code_search_unavailable=La recherche dans le code n’est pas disponible actuellement. Veuillez contacter l’administrateur de votre instance Gitea.
180186
code_search_by_git_grep=Les résultats de recherche de code actuels sont fournis par « git grep ». L’administrateur peut activer l’indexeur de dépôt, qui pourrait fournir de meilleurs résultats.
187+
package_kind=Chercher des paquets…
188+
project_kind=Chercher des projets…
189+
branch_kind=Chercher des branches…
181190
tag_tooltip=Cherchez des étiquettes correspondantes. Utilisez « % » pour rechercher n’importe quelle suite de nombres.
191+
commit_kind=Chercher des révisions…
182192
no_results=Aucun résultat correspondant trouvé.
183193
keyword_search_unavailable=La recherche par mot clé n’est pas disponible actuellement. Veuillez contacter l’administrateur de votre instance Gitea.
184194

options/locale/locale_ga-IE.ini

Lines changed: 50 additions & 0 deletions
Large diffs are not rendered by default.

web_src/js/modules/toast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type ToastOpts = {
4242

4343
type ToastifyElement = HTMLElement & {_giteaToastifyInstance?: Toast };
4444

45-
// See https://github.com/apvarun/toastify-js#api for options
45+
/** See https://github.com/apvarun/toastify-js#api for options */
4646
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast {
4747
const body = useHtmlBody ? message : htmlEscape(message);
4848
const parent = document.querySelector('.ui.dimmer.active') ?? document.body;

web_src/js/render/plugins/3d-viewer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {extname} from '../../utils.ts';
33

44
// support common 3D model file formats, use online-3d-viewer library for rendering
55

6-
// eslint-disable-next-line multiline-comment-style
76
/* a simple text STL file example:
87
solid SimpleTriangle
98
facet normal 0 0 1

web_src/js/utils.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@ import {decode, encode} from 'uint8-to-base64';
22
import type {IssuePageInfo, IssuePathInfo, RepoOwnerPathInfo} from './types.ts';
33
import {toggleElemClass, toggleElem} from './utils/dom.ts';
44

5-
// transform /path/to/file.ext to /path/to
5+
/** transform /path/to/file.ext to /path/to */
66
export function dirname(path: string): string {
77
const lastSlashIndex = path.lastIndexOf('/');
88
return lastSlashIndex < 0 ? '' : path.substring(0, lastSlashIndex);
99
}
1010

11-
// transform /path/to/file.ext to file.ext
11+
/** transform /path/to/file.ext to file.ext */
1212
export function basename(path: string): string {
1313
const lastSlashIndex = path.lastIndexOf('/');
1414
return lastSlashIndex < 0 ? path : path.substring(lastSlashIndex + 1);
1515
}
1616

17-
// transform /path/to/file.ext to .ext
17+
/** transform /path/to/file.ext to .ext */
1818
export function extname(path: string): string {
1919
const lastSlashIndex = path.lastIndexOf('/');
2020
const lastPointIndex = path.lastIndexOf('.');
2121
if (lastSlashIndex > lastPointIndex) return '';
2222
return lastPointIndex < 0 ? '' : path.substring(lastPointIndex);
2323
}
2424

25-
// test whether a variable is an object
25+
/** test whether a variable is an object */
2626
export function isObject(obj: any): boolean {
2727
return Object.prototype.toString.call(obj) === '[object Object]';
2828
}
2929

30-
// returns whether a dark theme is enabled
30+
/** returns whether a dark theme is enabled */
3131
export function isDarkTheme(): boolean {
3232
const style = window.getComputedStyle(document.documentElement);
3333
return style.getPropertyValue('--is-dark-theme').trim().toLowerCase() === 'true';
3434
}
3535

36-
// strip <tags> from a string
36+
/** strip <tags> from a string */
3737
export function stripTags(text: string): string {
3838
return text.replace(/<[^>]*>?/g, '');
3939
}
@@ -62,27 +62,27 @@ export function parseIssuePageInfo(): IssuePageInfo {
6262
};
6363
}
6464

65-
// parse a URL, either relative '/path' or absolute 'https://localhost/path'
65+
/** parse a URL, either relative '/path' or absolute 'https://localhost/path' */
6666
export function parseUrl(str: string): URL {
6767
return new URL(str, str.startsWith('http') ? undefined : window.location.origin);
6868
}
6969

70-
// return current locale chosen by user
70+
/** return current locale chosen by user */
7171
export function getCurrentLocale(): string {
7272
return document.documentElement.lang;
7373
}
7474

75-
// given a month (0-11), returns it in the documents language
75+
/** given a month (0-11), returns it in the documents language */
7676
export function translateMonth(month: number) {
7777
return new Date(Date.UTC(2022, month, 12)).toLocaleString(getCurrentLocale(), {month: 'short', timeZone: 'UTC'});
7878
}
7979

80-
// given a weekday (0-6, Sunday to Saturday), returns it in the documents language
80+
/** given a weekday (0-6, Sunday to Saturday), returns it in the documents language */
8181
export function translateDay(day: number) {
8282
return new Date(Date.UTC(2022, 7, day)).toLocaleString(getCurrentLocale(), {weekday: 'short', timeZone: 'UTC'});
8383
}
8484

85-
// convert a Blob to a DataURI
85+
/** convert a Blob to a DataURI */
8686
export function blobToDataURI(blob: Blob): Promise<string> {
8787
return new Promise((resolve, reject) => {
8888
try {
@@ -100,7 +100,7 @@ export function blobToDataURI(blob: Blob): Promise<string> {
100100
});
101101
}
102102

103-
// convert image Blob to another mime-type format.
103+
/** convert image Blob to another mime-type format. */
104104
export function convertImage(blob: Blob, mime: string): Promise<Blob> {
105105
return new Promise(async (resolve, reject) => {
106106
try {
@@ -143,15 +143,15 @@ export function toAbsoluteUrl(url: string): string {
143143
return `${window.location.origin}${url}`;
144144
}
145145

146-
// Encode an Uint8Array into a URLEncoded base64 string.
146+
/** Encode an Uint8Array into a URLEncoded base64 string. */
147147
export function encodeURLEncodedBase64(uint8Array: Uint8Array): string {
148148
return encode(uint8Array)
149149
.replace(/\+/g, '-')
150150
.replace(/\//g, '_')
151151
.replace(/=/g, '');
152152
}
153153

154-
// Decode a URLEncoded base64 to an Uint8Array.
154+
/** Decode a URLEncoded base64 to an Uint8Array. */
155155
export function decodeURLEncodedBase64(base64url: string): Uint8Array {
156156
return decode(base64url
157157
.replace(/_/g, '/')

web_src/js/utils/color.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import tinycolor from 'tinycolor2';
22
import type {ColorInput} from 'tinycolor2';
33

4-
// Returns relative luminance for a SRGB color - https://en.wikipedia.org/wiki/Relative_luminance
4+
/** Returns relative luminance for a SRGB color - https://en.wikipedia.org/wiki/Relative_luminance */
55
// Keep this in sync with modules/util/color.go
66
function getRelativeLuminance(color: ColorInput): number {
77
const {r, g, b} = tinycolor(color).toRgb();
@@ -12,8 +12,9 @@ function useLightText(backgroundColor: ColorInput): boolean {
1212
return getRelativeLuminance(backgroundColor) < 0.453;
1313
}
1414

15-
// Given a background color, returns a black or white foreground color that the highest
16-
// contrast ratio. In the future, the APCA contrast function, or CSS `contrast-color` will be better.
15+
/** Given a background color, returns a black or white foreground color that the highest
16+
* contrast ratio. */
17+
// In the future, the APCA contrast function, or CSS `contrast-color` will be better.
1718
// https://github.com/color-js/color.js/blob/eb7b53f7a13bb716ec8b28c7a56f052cd599acd9/src/contrast/APCA.js#L42
1819
export function contrastColor(backgroundColor: ColorInput): string {
1920
return useLightText(backgroundColor) ? '#fff' : '#000';

web_src/js/utils/dom.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function queryElemSiblings<T extends Element>(el: Element, selector = '*'
7171
}), fn);
7272
}
7373

74-
// it works like jQuery.children: only the direct children are selected
74+
/** it works like jQuery.children: only the direct children are selected */
7575
export function queryElemChildren<T extends Element>(parent: Element | ParentNode, selector = '*', fn?: ElementsCallback<T>): ArrayLikeIterable<T> {
7676
if (isInFrontendUnitTest()) {
7777
// https://github.com/capricorn86/happy-dom/issues/1620 : ":scope" doesn't work
@@ -81,7 +81,7 @@ export function queryElemChildren<T extends Element>(parent: Element | ParentNod
8181
return applyElemsCallback<T>(parent.querySelectorAll(`:scope > ${selector}`), fn);
8282
}
8383

84-
// it works like parent.querySelectorAll: all descendants are selected
84+
/** it works like parent.querySelectorAll: all descendants are selected */
8585
// in the future, all "queryElems(document, ...)" should be refactored to use a more specific parent if the targets are not for page-level components.
8686
export function queryElems<T extends HTMLElement>(parent: Element | ParentNode, selector: string, fn?: ElementsCallback<T>): ArrayLikeIterable<T> {
8787
return applyElemsCallback<T>(parent.querySelectorAll(selector), fn);
@@ -95,8 +95,8 @@ export function onDomReady(cb: () => Promisable<void>) {
9595
}
9696
}
9797

98-
// checks whether an element is owned by the current document, and whether it is a document fragment or element node
99-
// if it is, it means it is a "normal" element managed by us, which can be modified safely.
98+
/** checks whether an element is owned by the current document, and whether it is a document fragment or element node
99+
* if it is, it means it is a "normal" element managed by us, which can be modified safely. */
100100
export function isDocumentFragmentOrElementNode(el: Node) {
101101
try {
102102
return el.ownerDocument === document && el.nodeType === Node.ELEMENT_NODE || el.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
@@ -106,8 +106,8 @@ export function isDocumentFragmentOrElementNode(el: Node) {
106106
}
107107
}
108108

109-
// autosize a textarea to fit content. Based on
110-
// https://github.com/github/textarea-autosize
109+
/** autosize a textarea to fit content. */
110+
// Based on https://github.com/github/textarea-autosize
111111
// ---------------------------------------------------------------------
112112
// Copyright (c) 2018 GitHub, Inc.
113113
//
@@ -246,8 +246,8 @@ export function onInputDebounce(fn: () => Promisable<any>) {
246246

247247
type LoadableElement = HTMLEmbedElement | HTMLIFrameElement | HTMLImageElement | HTMLScriptElement | HTMLTrackElement;
248248

249-
// Set the `src` attribute on an element and returns a promise that resolves once the element
250-
// has loaded or errored.
249+
/** Set the `src` attribute on an element and returns a promise that resolves once the element
250+
* has loaded or errored. */
251251
export function loadElem(el: LoadableElement, src: string) {
252252
return new Promise((resolve) => {
253253
el.addEventListener('load', () => resolve(true), {once: true});
@@ -286,7 +286,7 @@ export function isElemVisible(el: HTMLElement): boolean {
286286
return !el.classList.contains('tw-hidden') && (el.offsetWidth || el.offsetHeight || el.getClientRects().length) && el.style.display !== 'none';
287287
}
288288

289-
// replace selected text in a textarea while preserving editor history, e.g. CTRL-Z works after this
289+
/** replace selected text in a textarea while preserving editor history, e.g. CTRL-Z works after this */
290290
export function replaceTextareaSelection(textarea: HTMLTextAreaElement, text: string) {
291291
const before = textarea.value.slice(0, textarea.selectionStart ?? undefined);
292292
const after = textarea.value.slice(textarea.selectionEnd ?? undefined);
@@ -368,7 +368,7 @@ export function addDelegatedEventListener<T extends HTMLElement, E extends Event
368368
}, options);
369369
}
370370

371-
// Returns whether a click event is a left-click without any modifiers held
371+
/** Returns whether a click event is a left-click without any modifiers held */
372372
export function isPlainClick(e: MouseEvent) {
373373
return e.button === 0 && !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey;
374374
}

web_src/js/utils/image.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ type ImageInfo = {
2929
dppx?: number,
3030
}
3131

32-
// decode a image and try to obtain width and dppx. It will never throw but instead
33-
// return default values.
32+
/** decode a image and try to obtain width and dppx. It will never throw but instead
33+
* return default values. */
3434
export async function imageInfo(blob: Blob): Promise<ImageInfo> {
3535
let width = 0, dppx = 1; // dppx: 1 dot per pixel for non-HiDPI screens
3636

web_src/js/utils/time.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ export function fillEmptyStartDaysWithZeroes(startDays: number[], data: DayDataO
6565

6666
let dateFormat: Intl.DateTimeFormat;
6767

68-
// format a Date object to document's locale, but with 24h format from user's current locale because this
69-
// option is a personal preference of the user, not something that the document's locale should dictate.
68+
/** Format a Date object to document's locale, but with 24h format from user's current locale because this
69+
* option is a personal preference of the user, not something that the document's locale should dictate. */
7070
export function formatDatetime(date: Date | number): string {
7171
if (!dateFormat) {
7272
// TODO: replace `hour12` with `Intl.Locale.prototype.getHourCycles` once there is broad browser support

0 commit comments

Comments
 (0)