40 lines
1.6 KiB
JavaScript
40 lines
1.6 KiB
JavaScript
const fs = require('fs');
|
|
const file = process.argv[2] || 'c:/GitHub/FW/Trainings/WBT_ErkW_2_Aufbau_und_Ueberblick_Bedienoberflaeche/html5/data/js/5eDZVsflCng.js';
|
|
const data = fs.readFileSync(file, 'utf8');
|
|
|
|
// The file contains `window.globalProvideData('slide', "{...}");`
|
|
// We need to carefully extract the JSON string and unescape it.
|
|
const match = data.match(/window\.globalProvideData\('slide',\s*"(.*)"\);/s);
|
|
if (match) {
|
|
let jsonStr = match[1];
|
|
// Replace \" with " and \\ with \
|
|
jsonStr = jsonStr.replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
|
try {
|
|
const obj = JSON.parse(jsonStr);
|
|
console.log('Slide:', obj.title);
|
|
if (obj.slideLayers) {
|
|
obj.slideLayers.forEach((layer, i) => {
|
|
let texts = [];
|
|
let audios = [];
|
|
|
|
if (layer.audiolib) {
|
|
audios = layer.audiolib.map(a => a.id + ' (assetId ' + a.assetId + ')');
|
|
}
|
|
if (layer.objects) {
|
|
layer.objects.forEach(o => {
|
|
if (o.data && o.data.vectorData && o.data.vectorData.altText) {
|
|
texts.push(o.data.vectorData.altText);
|
|
}
|
|
});
|
|
}
|
|
console.log(`Layer ${i} (ID: ${layer.id}):`);
|
|
console.log(` Audio: ${audios.join(', ')}`);
|
|
console.log(` Texts: ${texts.join(' | ').substring(0, 150)}`);
|
|
});
|
|
}
|
|
} catch (e) {
|
|
console.error("JSON parse error:", e.message);
|
|
console.error(jsonStr.substring(0, 500));
|
|
}
|
|
}
|