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

Function eachImagesDistribution

scripts/reading.js:4205–4240  ·  view source on GitHub ↗
(index, contains, callback, first = false, notFound = false, onlyFirstMeet = false)

Source from the content-addressed store, hash-verified

4203
4204//Returns an image depending on the type (Image, folder, blank)
4205function eachImagesDistribution(index, contains, callback, first = false, notFound = false, onlyFirstMeet = false)
4206{
4207 var img = false;
4208 if(contains && contains.indexOf('image') !== -1)
4209 img = true;
4210
4211 var folder = false;
4212 if(contains && contains.indexOf('folder') !== -1)
4213 folder = true;
4214
4215 var blank = false;
4216 if(contains && contains.indexOf('blank') !== -1)
4217 blank = true;
4218
4219 if(typeof imagesDistribution[index] !== 'undefined')
4220 {
4221 each:
4222 for(let key in imagesDistribution[index])
4223 {
4224 if(!contains || (img && !imagesDistribution[index][key].folder && !imagesDistribution[index][key].blank) || (folder && imagesDistribution[index][key].folder) || (blank && imagesDistribution[index][key].blank))
4225 {
4226 callback(imagesDistribution[index][key]);
4227
4228 if(onlyFirstMeet)
4229 break each;
4230 }
4231
4232 if(first)
4233 break each;
4234 }
4235 }
4236 else if(notFound)
4237 {
4238 notFound();
4239 }
4240}
4241
4242function getImage(index = 0)
4243{

Callers 4

goToIndexFunction · 0.85
onScrollFunction · 0.85
reloadIndexFunction · 0.85
createAndDeleteBookmarkFunction · 0.85

Calls 1

callbackFunction · 0.85

Tested by

no test coverage detected