Skip to content

Commit

Permalink
fixed arrow function issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Patzer committed Mar 27, 2018
1 parent e5d412a commit f01d16c
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/Resources/public/js/jquery.list-bundle.es6.js
Expand Up @@ -2,12 +2,12 @@ let jQuery = require('jquery');

($ => {
let listBundle = {
init: () => {
init: function() {
listBundle.initPagination();
listBundle.initMasonry();
},
initPagination: () => {
$('.huh-list .ajax-pagination').each(() => {
initPagination: function() {
$('.huh-list .ajax-pagination').each(function() {
import(/* webpackChunkName: "jscroll" */ 'jscroll').then(() =>
{
let $list = $(this).closest('.huh-list'),
Expand All @@ -20,18 +20,18 @@ let jQuery = require('jquery');
nextSelector: '.ajax-pagination a.next',
autoTrigger: $wrapper.data('add-infinite-scroll') == 1,
contentSelector: id,
callback: () => {
callback: function() {
let $jscrollAdded = $(this),
$newItems = $jscrollAdded.find('.item');

$newItems.hide();

import(/* webpackChunkName: "imagesloaded" */ 'imagesloaded').then(() => {
$jscrollAdded.imagesLoaded(() => {
import(/* webpackChunkName: "imagesloaded" */ 'imagesloaded').then(function() {
$jscrollAdded.imagesLoaded(function() {
$items.append($newItems.fadeIn(300));

if ($wrapper.attr('data-add-masonry') === "1") {
import(/* webpackChunkName: "masonry-layout" */ 'masonry-layout').then(() => {
import(/* webpackChunkName: "masonry-layout" */ 'masonry-layout').then(function() {
$items.masonry('appended', $newItems);
$items.masonry();
});
Expand Down Expand Up @@ -85,19 +85,20 @@ let jQuery = require('jquery');
});
});
},
initMasonry: () => {
initMasonry: function() {
if ($('.huh-list .wrapper[data-add-masonry="1"]').length < 1)
{
return;
}

import(/* webpackChunkName: "masonry-layout" */ 'masonry-layout').then(() => {
import(/* webpackChunkName: "imagesloaded" */ 'imagesloaded').then(() => {
$('.huh-list .wrapper[data-add-masonry="1"]').each(() => {
import(/* webpackChunkName: "masonry-layout" */ 'masonry-layout').then(function() {
import(/* webpackChunkName: "imagesloaded" */ 'imagesloaded').then(function() {
$('.huh-list .wrapper[data-add-masonry="1"]').each(function() {
let $this = $(this).find('.items'),
options = $(this).data('masonry-options');

let $grid = $this.imagesLoaded(() => {
let $grid = $this.imagesLoaded(function() {
console.log($grid);
$grid.masonry({
// fitWidth: true,
itemSelector: '.item',
Expand All @@ -115,7 +116,7 @@ let jQuery = require('jquery');

module.exports = listBundle;

$(document).ready(() => {
$(document).ready(function() {
listBundle.init();
});
})(jQuery);

0 comments on commit f01d16c

Please sign in to comment.