WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 952731a

Browse files
committed
show confirm dialog before opening external link
1 parent df23cb8 commit 952731a

File tree

20 files changed

+64
-17
lines changed

20 files changed

+64
-17
lines changed

src/lib/ui/mobile.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,38 @@ export function useI18nUIComponents() {
319319
});
320320
}
321321

322+
function openExternalUrl(url: string): void {
323+
const textDirection = getCurrentLanguageTextDirection();
324+
325+
const cancelButton: Dialog.DialogButton = {
326+
text: tt('Cancel')
327+
};
328+
329+
const confirmButton: Dialog.DialogButton = {
330+
text: tt('OK'),
331+
onClick: () => {
332+
window.open(url, '_blank');
333+
}
334+
};
335+
336+
f7ready((f7) => {
337+
f7.dialog.create({
338+
title: tt('global.app.title'),
339+
text: tt('Are you sure you want to open this link?'),
340+
content: `<div style="word-break: break-all">${url}</div>`,
341+
animate: isEnableAnimate(),
342+
buttons: textDirection == TextDirection.RTL ? [confirmButton, cancelButton] : [cancelButton, confirmButton]
343+
}).open();
344+
});
345+
}
346+
322347
return {
323348
showAlert: showAlert,
324349
showConfirm: showConfirm,
325350
showPrompt: showPrompt,
326351
showCancelableLoading: showCancelableLoading,
327352
showToast: showToast,
353+
openExternalUrl,
328354
routeBackOnError
329355
}
330356
}

src/locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "Problem melden",
23622362
"Getting help": "Getting help",
23632363
"License": "Lizenz",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "Ein Fehler ist aufgetreten",
23652366
"Parameter Invalid": "Parameter ungültig",
23662367
"Numeric Overflow": "Numerischer Überlauf",

src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "Report Issue",
23622362
"Getting help": "Getting help",
23632363
"License": "License",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "An error occurred",
23652366
"Parameter Invalid": "Parameter Invalid",
23662367
"Numeric Overflow": "Numeric Overflow",

src/locales/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "Informar problema",
23622362
"Getting help": "Getting help",
23632363
"License": "Licencia",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "Se produjo un error",
23652366
"Parameter Invalid": "Parámetro no válido",
23662367
"Numeric Overflow": "Desbordamiento numérico",

src/locales/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "Signaler un problème",
23622362
"Getting help": "Obtenir de l'aide",
23632363
"License": "Licence",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "Une erreur s'est produite",
23652366
"Parameter Invalid": "Paramètre invalide",
23662367
"Numeric Overflow": "Dépassement numérique",

src/locales/it.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "Segnala problema",
23622362
"Getting help": "Ottenere aiuto",
23632363
"License": "Licenza",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "Si è verificato un errore",
23652366
"Parameter Invalid": "Parametro non valido",
23662367
"Numeric Overflow": "Overflow numerico",

src/locales/ja.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "問題を報告",
23622362
"Getting help": "Getting help",
23632363
"License": "ライセンス",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "エラーが発生しました",
23652366
"Parameter Invalid": "パラメーターが無効です",
23662367
"Numeric Overflow": "数値オーバーフロー",

src/locales/ko.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "문제 보고",
23622362
"Getting help": "도움 받기",
23632363
"License": "라이선스",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "오류가 발생했습니다.",
23652366
"Parameter Invalid": "잘못된 매개변수",
23662367
"Numeric Overflow": "숫자 오버플로우",

src/locales/nl.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "Probleem melden",
23622362
"Getting help": "Hulp krijgen",
23632363
"License": "Licentie",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "Er is een fout opgetreden",
23652366
"Parameter Invalid": "Ongeldige parameter",
23662367
"Numeric Overflow": "Numerieke overloop",

src/locales/pt_BR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@
23612361
"Report Issue": "Relatar problema",
23622362
"Getting help": "Obtendo ajuda",
23632363
"License": "Licença",
2364+
"Are you sure you want to open this link?": "Are you sure you want to open this link?",
23642365
"An error occurred": "Ocorreu um erro",
23652366
"Parameter Invalid": "Parâmetro inválido",
23662367
"Numeric Overflow": "Transbordo numérico",

0 commit comments

Comments
 (0)