Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 395e9caff4 | |||
| e1c73181d4 | |||
| 874e35bba3 | |||
| 69b04d3336 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "vue-nonograms-solid",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "vue-nonograms-solid",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"dependencies": {
|
||||
"fireworks-js": "^2.10.8",
|
||||
"flag-icons": "^7.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-nonograms-solid",
|
||||
"version": "1.2.0",
|
||||
"version": "1.3.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -212,7 +212,7 @@ const buildShareUrl = (target, text, url) => {
|
||||
const encodedText = encodeURIComponent(text);
|
||||
const encodedUrl = encodeURIComponent(url);
|
||||
if (target === 'x') {
|
||||
return `https://twitter.com/intent/tweet?text=${encodedText}&url=${encodedUrl}`;
|
||||
return `https://x.com/intent/tweet?text=${encodedText}&url=${encodedUrl}`;
|
||||
}
|
||||
if (target === 'facebook') {
|
||||
return `https://www.facebook.com/sharer/sharer.php?u=${encodedUrl}"e=${encodedText}`;
|
||||
@@ -226,13 +226,18 @@ const buildShareUrl = (target, text, url) => {
|
||||
const shareTo = async (target) => {
|
||||
if (shareInProgress.value) return;
|
||||
shareInProgress.value = true;
|
||||
try {
|
||||
const blob = await createShareBlob();
|
||||
if (!blob) return;
|
||||
const file = new File([blob], `nonogram-${store.size}x${store.size}.png`, { type: 'image/png' });
|
||||
|
||||
const text = shareText.value;
|
||||
const url = window.location.href;
|
||||
if (navigator.share && navigator.canShare && navigator.canShare({ files: [file] })) {
|
||||
const shareUrl = buildShareUrl(target, text, url);
|
||||
|
||||
try {
|
||||
// Try native share first if available (supports images)
|
||||
if (navigator.share && navigator.canShare) {
|
||||
const blob = await createShareBlob();
|
||||
if (blob) {
|
||||
const file = new File([blob], `nonogram-${store.size}x${store.size}.png`, { type: 'image/png' });
|
||||
if (navigator.canShare({ files: [file] })) {
|
||||
await navigator.share({
|
||||
files: [file],
|
||||
text,
|
||||
@@ -241,14 +246,28 @@ const shareTo = async (target) => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
await downloadShareImage();
|
||||
const shareUrl = buildShareUrl(target, text, url);
|
||||
if (shareUrl) {
|
||||
window.open(shareUrl, '_blank', 'noopener');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.name === 'AbortError') {
|
||||
return; // User cancelled native share, do nothing
|
||||
}
|
||||
// Other errors -> fall through to fallback
|
||||
} finally {
|
||||
shareInProgress.value = false;
|
||||
}
|
||||
|
||||
// Fallback: Direct Link + Download
|
||||
// Open window immediately if possible (though we awaited above, so it might be blocked,
|
||||
// but we can't do much about it if we want to try native share first).
|
||||
// Ideally, for Desktop, navigator.share is undefined so we skip the await above.
|
||||
|
||||
if (shareUrl) {
|
||||
window.open(shareUrl, '_blank', 'noopener');
|
||||
}
|
||||
|
||||
// Trigger download as "screenshot support"
|
||||
downloadShareImage();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -295,9 +295,17 @@ const messages = {
|
||||
'custom.cancel': '取消',
|
||||
'custom.start': '开始',
|
||||
'custom.sizeError': '尺寸必须在 5 到 80 之间!',
|
||||
'custom.fillRate': '填充率',
|
||||
'custom.difficulty': '难度',
|
||||
'difficulty.easy': '简单',
|
||||
'difficulty.harder': '较难',
|
||||
'difficulty.hardest': '最难',
|
||||
'difficulty.extreme': '极限',
|
||||
'win.title': '恭喜!',
|
||||
'win.message': '你解开了谜题!',
|
||||
'win.time': '时间:',
|
||||
'win.difficulty': '难度:',
|
||||
'win.usedGuide': '使用指南: {count}',
|
||||
'win.playAgain': '再玩一次',
|
||||
'win.shareTitle': '分享你的结果',
|
||||
'win.shareText': '我在 {time} 内解开了 {size}x{size} 的数织!',
|
||||
@@ -495,9 +503,17 @@ const messages = {
|
||||
'custom.cancel': 'Cancelar',
|
||||
'custom.start': 'Empezar',
|
||||
'custom.sizeError': '¡El tamaño debe estar entre 5 y 80!',
|
||||
'custom.fillRate': 'Relleno',
|
||||
'custom.difficulty': 'Dificultad',
|
||||
'difficulty.easy': 'Fácil',
|
||||
'difficulty.harder': 'Más difícil',
|
||||
'difficulty.hardest': 'El más difícil',
|
||||
'difficulty.extreme': 'Extremo',
|
||||
'win.title': '¡FELICIDADES!',
|
||||
'win.message': '¡Has resuelto el rompecabezas!',
|
||||
'win.time': 'Tiempo:',
|
||||
'win.difficulty': 'Dificultad:',
|
||||
'win.usedGuide': 'Guía usada: {count}',
|
||||
'win.playAgain': 'Jugar de nuevo',
|
||||
'win.shareTitle': 'Comparte tu resultado',
|
||||
'win.shareText': '¡Resolví un nonograma de {size}x{size} en {time}!',
|
||||
@@ -561,9 +577,17 @@ const messages = {
|
||||
'custom.cancel': 'Annuler',
|
||||
'custom.start': 'Démarrer',
|
||||
'custom.sizeError': 'La taille doit être entre 5 et 80 !',
|
||||
'custom.fillRate': 'Remplissage',
|
||||
'custom.difficulty': 'Difficulté',
|
||||
'difficulty.easy': 'Facile',
|
||||
'difficulty.harder': 'Plus difficile',
|
||||
'difficulty.hardest': 'Le plus difficile',
|
||||
'difficulty.extreme': 'Extrême',
|
||||
'win.title': 'FÉLICITATIONS !',
|
||||
'win.message': 'Vous avez résolu le puzzle !',
|
||||
'win.time': 'Temps:',
|
||||
'win.difficulty': 'Difficulté :',
|
||||
'win.usedGuide': 'Guide utilisé : {count}',
|
||||
'win.playAgain': 'Rejouer',
|
||||
'win.shareTitle': 'Partagez votre résultat',
|
||||
'win.shareText': 'J’ai résolu un nonogramme {size}x{size} en {time} !',
|
||||
@@ -627,9 +651,17 @@ const messages = {
|
||||
'custom.cancel': 'إلغاء',
|
||||
'custom.start': 'ابدأ',
|
||||
'custom.sizeError': 'يجب أن يكون الحجم بين 5 و80!',
|
||||
'custom.fillRate': 'معدل الملء',
|
||||
'custom.difficulty': 'الصعوبة',
|
||||
'difficulty.easy': 'سهل',
|
||||
'difficulty.harder': 'أصعب',
|
||||
'difficulty.hardest': 'الأصعب',
|
||||
'difficulty.extreme': 'أقصى',
|
||||
'win.title': 'تهانينا!',
|
||||
'win.message': 'لقد حللت اللغز!',
|
||||
'win.time': 'الوقت:',
|
||||
'win.difficulty': 'الصعوبة:',
|
||||
'win.usedGuide': 'تم استخدام الدليل: {count}',
|
||||
'win.playAgain': 'العب مرة أخرى',
|
||||
'win.shareTitle': 'شارك نتيجتك',
|
||||
'win.shareText': 'حللت نونوغرام {size}x{size} في {time}!',
|
||||
@@ -759,9 +791,17 @@ const messages = {
|
||||
'custom.cancel': 'Отмена',
|
||||
'custom.start': 'Старт',
|
||||
'custom.sizeError': 'Размер должен быть от 5 до 80!',
|
||||
'custom.fillRate': 'Заполнение',
|
||||
'custom.difficulty': 'Сложность',
|
||||
'difficulty.easy': 'Легкий',
|
||||
'difficulty.harder': 'Сложный',
|
||||
'difficulty.hardest': 'Очень сложный',
|
||||
'difficulty.extreme': 'Экстремальный',
|
||||
'win.title': 'ПОЗДРАВЛЯЕМ!',
|
||||
'win.message': 'Вы решили головоломку!',
|
||||
'win.time': 'Время:',
|
||||
'win.difficulty': 'Сложность:',
|
||||
'win.usedGuide': 'Подсказок использовано: {count}',
|
||||
'win.playAgain': 'Сыграть снова',
|
||||
'win.shareTitle': 'Поделитесь результатом',
|
||||
'win.shareText': 'Я решил(а) нонограмму {size}x{size} за {time}!',
|
||||
@@ -958,9 +998,17 @@ const messages = {
|
||||
'custom.cancel': 'Abbrechen',
|
||||
'custom.start': 'Start',
|
||||
'custom.sizeError': 'Die Größe muss zwischen 5 und 80 liegen!',
|
||||
'custom.fillRate': 'Füllrate',
|
||||
'custom.difficulty': 'Schwierigkeit',
|
||||
'difficulty.easy': 'Einfach',
|
||||
'difficulty.harder': 'Schwerer',
|
||||
'difficulty.hardest': 'Am schwersten',
|
||||
'difficulty.extreme': 'Extrem',
|
||||
'win.title': 'HERZLICHEN GLÜCKWUNSCH!',
|
||||
'win.message': 'Sie haben das Rätsel gelöst!',
|
||||
'win.time': 'Zeit:',
|
||||
'win.difficulty': 'Schwierigkeit:',
|
||||
'win.usedGuide': 'Hilfe benutzt: {count}',
|
||||
'win.playAgain': 'Erneut spielen',
|
||||
'win.shareTitle': 'Teilen Sie Ihr Ergebnis',
|
||||
'win.shareText': 'Ich habe ein {size}x{size} Nonogramm in {time} gelöst!',
|
||||
|
||||
Reference in New Issue
Block a user