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

Function headerPath

scripts/dom.js:1329–1369  ·  view source on GitHub ↗
(path, mainPath, windowTitle = false)

Source from the content-addressed store, hash-verified

1327}
1328
1329function headerPath(path, mainPath, windowTitle = false)
1330{
1331 let _mainPath = mainPath;
1332
1333 if((config.showFullPathLibrary && isFromLibrary) || (config.showFullPathOpened && !isFromLibrary))
1334 _mainPath = p.parse(path).root;
1335
1336 mainPathR = addSepToEnd(p.dirname(_mainPath));
1337
1338 let files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep);
1339 path = [];
1340
1341 let _path = mainPathR;
1342
1343 for(let i = 0, len = files.length; i < len; i++)
1344 {
1345 if(!files[i] && i === len - 1)
1346 continue;
1347
1348 _path = p.normalize(p.join(_path, files[i]));
1349 path.push({name: metadataPathName({path: _path, name: files[i]}, true), path: _path, mainPath: mainPath});
1350 }
1351
1352 const root = history.root();
1353
1354 if(config.showLibraryPath && (isFromLibrary || root.indexLabel?.has || root.recentlyOpened))
1355 path.unshift({name: labels.getName(root.indexLabel, root.recentlyOpened), path: '', mainPath: ''});
1356
1357 let len = path.length;
1358
1359 if(len > 0)
1360 path[len - 1].last = true;
1361
1362 if(windowTitle && len > 0)
1363 {
1364 let firstCompressedFile = fileManager.firstCompressedFile(_path);
1365 setWindowTitle(dom.metadataPathName({path: firstCompressedFile, name: p.basename(firstCompressedFile)}, true));
1366 }
1367
1368 handlebarsContext.headerTitlePath = path;
1369}
1370
1371async function nextComic(path, mainPath)
1372{

Callers 2

loadIndexPageFunction · 0.85
openComicFunction · 0.85

Calls 4

addSepToEndFunction · 0.85
pregQuoteFunction · 0.85
metadataPathNameFunction · 0.85
setWindowTitleFunction · 0.85

Tested by

no test coverage detected