import 'es6-promise/auto';
import mediumZoom from 'src/config/medium-zoom';
import lqip from 'src/modules/lqip';
import galleryLoader from 'src/modules/gallery-lazy-load';

window.addEventListener('DOMContentLoaded', () => {
  galleryLoader({
    afterInsert(lastPost) {
      lqip({
        selectorRoot: lastPost,
        rootMargin: '0px',
        afterReplace: (lqipImage, originalImage) => {
          if (lqipImage) lqipImage.remove();
          mediumZoom(originalImage);
        },
      })
    },
  });
  lqip({
    afterReplace: (lqipImage, originalImage) => {
      if (lqipImage) lqipImage.remove();
      mediumZoom(originalImage);
    },
  });
});

@@ -166,16 +166,139 @@
 load';%0A%0A
+const afterReplace = (lqipImage, originalImage) =%3E %7B%0A  if (lqipImage) lqipImage.remove();%0A  mediumZoom(originalImage);%0A%7D;%0A%0A
 window.a
@@ -483,295 +483,57 @@
 lace
-: (lqipImage, originalImage) =%3E %7B%0A          if (lqipImage) lqipImage.remove();%0A          mediumZoom(originalImage);%0A        %7D,%0A      %7D)%0A    %7D,%0A  %7D);%0A  lqip(%7B%0A    afterReplace: (lqipImage, originalImage) =%3E %7B%0A      if (lqipImage) lqipImage.remove();%0A      mediumZoom(originalImage);%0A    %7D
+,%0A      %7D)%0A    %7D,%0A  %7D);%0A  lqip(%7B%0A    afterReplace
 ,%0A  

Simplify code