MCPcopy
hub / github.com/ollm/OpenComic / openComic

Function openComic

scripts/opencomic.js:1315–1375  ·  view source on GitHub ↗
(filePath, animation = true)

Source from the content-addressed store, hash-verified

1313var fromLibrary = true;
1314
1315function openComic(filePath, animation = true)
1316{
1317 if(pathIsSupported(filePath))
1318 {
1319 let selectImage = false, path = false, mainPath = false;
1320
1321 if(fs.statSync(filePath).isDirectory())
1322 {
1323 path = filePath;
1324 }
1325 else
1326 {
1327 if(compatible.image(filePath))
1328 {
1329 selectImage = true;
1330 path = filePath;
1331
1332 filePath = p.dirname(filePath);
1333
1334 mainPath = filePath;
1335 }
1336 else
1337 {
1338 path = filePath;
1339 }
1340 }
1341
1342 if(mainPath === false)
1343 mainPath = path;
1344
1345 if(onReading)
1346 reading.progress.save();
1347
1348 recentlyOpened.set(mainPath);
1349
1350 dom.fromLibrary(false);
1351
1352 if(selectImage)
1353 dom.openComic(animation, path, mainPath);
1354 else
1355 dom.loadIndexPage(animation, path, false, false, mainPath);
1356 }
1357 else
1358 {
1359 if(!windowHasLoaded)
1360 dom.loadIndexPage(false);
1361
1362 events.snackbar({
1363 key: 'unsupportedFile',
1364 text: language.global.unsupportedFile,
1365 duration: 6,
1366 update: true,
1367 buttons: [
1368 {
1369 text: language.buttons.dismiss,
1370 function: 'events.closeSnackbar();',
1371 },
1372 ],

Callers 3

opencomic.jsFile · 0.70
startAppFunction · 0.70
openComicDialogFunction · 0.70

Calls 1

pathIsSupportedFunction · 0.85

Tested by

no test coverage detected