Skip to content

Commit f8453af

Browse files
Add more YT warnings
1 parent d02ff6a commit f8453af

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/_shared/modules/Localization/locale/de.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,5 +370,6 @@ window.FrameTrail_L10n['de'] = {
370370
"UserRoleAdmin": "Admin",
371371
"UserRoleUser": "User",
372372
"UserSelect": "Nutzer:in auswählen",
373+
"WarningYouTubeExport": "YouTube-Videos können nicht in exportierte HTML-Dateien eingebettet werden, die lokal geöffnet werden — das Hypervideo wird nicht abgespielt, es sei denn, die HTML-Datei wird auf einem Webserver gehostet.",
373374
"WarningYouTubeSource": "Wenn du ein YouTube-Video als Quelle auswählst, funktioniert das Hypervideo nicht, wenn es als HTML-Datei exportiert und lokal geöffnet wird (YouTube verhindert das)."
374375
}

src/_shared/modules/Localization/locale/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,5 +370,6 @@ window.FrameTrail_L10n['en'] = {
370370
"UserRoleAdmin": "Admin",
371371
"UserRoleUser": "User",
372372
"UserSelect": "Select a User",
373+
"WarningYouTubeExport": "YouTube videos cannot be embedded in exported HTML files opened locally — the hypervideo will not play unless the HTML file is hosted on a web server.",
373374
"WarningYouTubeSource": "If you choose a YouTube video as a source, the hypervideo will not work when exported as an HTML file and opened locally (YouTube prevents that)."
374375
}

src/_shared/modules/Localization/locale/fr.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,5 +370,6 @@ window.FrameTrail_L10n['fr'] = {
370370
"UserRoleAdmin": "Admin",
371371
"UserRoleUser": "Utilisateur",
372372
"UserSelect": "Sélectionner un utilisateur",
373+
"WarningYouTubeExport": "Les vidéos YouTube ne peuvent pas être intégrées dans des fichiers HTML exportés ouverts localement — l'hypervidéo ne sera pas lue, sauf si le fichier HTML est hébergé sur un serveur web.",
373374
"WarningYouTubeSource": "Si vous choisissez une vidéo YouTube comme source, l'hypervidéo ne fonctionnera pas lorsque vous l'exporterez en tant que fichier HTML et l'ouvrez localement (YouTube empêche cela)."
374375
}

src/player/modules/HypervideoModel/module.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,10 +1098,7 @@
10981098
+ '<label><input type="radio" name="downloadFormat" value="html" checked> HTML</label>'
10991099
+ '<label><input type="radio" name="downloadFormat" value="json"> JSON</label>'
11001100
+ '</div>'
1101-
+ '<div style="margin-top: 6px;">'
1102-
+ '<small>' + labels['DownloadResourceBaseUrl'] + '</small>'
1103-
+ '<input type="text" name="htmlDataPath" placeholder="https://example.com/_data/" style="margin-top: 2px;">'
1104-
+ '</div>'
1101+
+ (videoType === 'youtube' ? '<div class="message warning active youtubeExportWarning" style="margin-top: 8px;">' + labels['WarningYouTubeExport'] + '</div>' : '')
11051102
+ '</div>'
11061103
+ '<div class="downloadOptionsSection" style="display: none;">'
11071104
+ '<div class="checkboxRow">'
@@ -1117,11 +1114,15 @@
11171114

11181115
var formatSection = saveAsDialog.querySelector('.downloadFormatSection');
11191116
var optionsSection = saveAsDialog.querySelector('.downloadOptionsSection');
1117+
var ytWarning = saveAsDialog.querySelector('.youtubeExportWarning');
11201118

1121-
// Default htmlDataPath to the absolute URL of the current _data/ directory
1122-
var _dataPathInput = saveAsDialog.querySelector('[name="htmlDataPath"]');
1123-
var _resolvedDataURL = FrameTrail.module('RouteNavigation').resolveDataURL('');
1124-
_dataPathInput.value = new URL(_resolvedDataURL, window.location.href).href;
1119+
saveAsDialog.querySelectorAll('[name="downloadFormat"]').forEach(function(radio) {
1120+
radio.addEventListener('change', function() {
1121+
if (ytWarning) {
1122+
ytWarning.style.display = radio.value === 'html' && radio.checked ? '' : 'none';
1123+
}
1124+
});
1125+
});
11251126

11261127
saveAsDialog.querySelectorAll('[name="downloadScope"]').forEach(function(radio) {
11271128
radio.addEventListener('change', function() {
@@ -1171,11 +1172,12 @@
11711172
}
11721173
} else {
11731174
var format = saveAsDialog.querySelector('[name="downloadFormat"]:checked').value;
1174-
var dataPath = saveAsDialog.querySelector('[name="htmlDataPath"]').value.trim();
11751175
if (format === 'html') {
1176+
var _resolvedDataURL = FrameTrail.module('RouteNavigation').resolveDataURL('');
1177+
var dataPath = new URL(_resolvedDataURL, window.location.href).href;
11761178
downloadAdapter._generateStandaloneHTML(hvID, dataPath);
11771179
} else {
1178-
downloadAdapter._performDownload(hvID, dataPath);
1180+
downloadAdapter._performDownload(hvID);
11791181
}
11801182
}
11811183

0 commit comments

Comments
 (0)