|
|
|
@ -22,10 +22,17 @@ module.exports = function (processorConfig) {
|
|
|
|
const imgWrap = document.elementFromPoint(300, 300);
|
|
|
|
const imgWrap = document.elementFromPoint(300, 300);
|
|
|
|
const children = imgWrap.querySelectorAll('.pswp__img');
|
|
|
|
const children = imgWrap.querySelectorAll('.pswp__img');
|
|
|
|
const img = children[children.length - 1];
|
|
|
|
const img = children[children.length - 1];
|
|
|
|
console.log(img, imgWrap);
|
|
|
|
|
|
|
|
// debugger;
|
|
|
|
// debugger;
|
|
|
|
// Full image hasn't loaded yet
|
|
|
|
// Full image hasn't loaded yet
|
|
|
|
const src = imgWrap.src.split('?')[0]// get rid of querystring
|
|
|
|
const src = imgWrap.src.split('?')[0]// get rid of querystring
|
|
|
|
|
|
|
|
//check for a duplicated src
|
|
|
|
|
|
|
|
for(var i = 0;i < galleryUrls.length;i++) {
|
|
|
|
|
|
|
|
if(src === galleryUrls[i].url && externalCounter > 1) {
|
|
|
|
|
|
|
|
//we're using the fallback counter, reset it to 1 to trigger the exit.
|
|
|
|
|
|
|
|
externalCounter = 0;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return downloadSrc(src, id);
|
|
|
|
return downloadSrc(src, id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -37,11 +44,16 @@ module.exports = function (processorConfig) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function nextImage() {
|
|
|
|
function nextImage() {
|
|
|
|
document.querySelector('.pswp__button.pswp__button--arrow--right').click();
|
|
|
|
//get the navigation button element
|
|
|
|
|
|
|
|
const navigation = document.querySelector('.pswp__button.pswp__button--arrow--right') || document.querySelector('.pswp__button.pswp__button--arrow--next')
|
|
|
|
|
|
|
|
navigation.click();
|
|
|
|
|
|
|
|
externalCounter += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var externalCounter = 1;
|
|
|
|
function getCounterValue() {
|
|
|
|
function getCounterValue() {
|
|
|
|
const [position, total] = document.querySelector('.pswp__counter').textContent.split('/');
|
|
|
|
const internalCounterElement = document.querySelector('.pswp__counter');
|
|
|
|
|
|
|
|
if(!internalCounterElement) return externalCounter;
|
|
|
|
|
|
|
|
const [position, total] = internalCounterElement.textContent.split('/');
|
|
|
|
return parseInt(position.trim(), 10);
|
|
|
|
return parseInt(position.trim(), 10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|