PageSourceSearch

https://www.federvini.it/media/plg_jspeed/cache/js/4e4f00e3d1ced207c9ff4ac7497cd0f4_0_4.js

js federvini.it collected 2026-10-02 10:30:39 UTC 11,054 bytes, 371 lines download raw bytes

1try {
2function getMoreArticles(replaceArticles) {
3
4  // only used in dynamic fetching
5  if (!document.querySelector("#elsiso_articlesloading"))
6  {
7    if (prefetchedData) {
8
9      els_isoinsert(prefetchedData.ev_pdata_array, false);
10
11      // workaround for problem with scrolling in some yootheme templates
12      document.querySelector("#easylayouts.isotope").style.minHeight = 0;
13
14    }
15    return;
16  }
17
18  document.querySelector("#elsiso_articlesloading").removeAttribute('hidden');
19  document.querySelector('.no_more').setAttribute('hidden', true);
20  document.querySelector("#elsiso_loadmore").setAttribute('hidden', true);
21
22  var dataurl = currentFloatArgs.dataURL;
23  var total = currentFloatArgs.total;
24  var current = document.querySelectorAll('.elsiso_item.elsfilter_show').length;
25  let insertedCount = 0;
26  if (replaceArticles && !prefetchedData) {
27    if (document.querySelector('form#elsfilter')) {
28      let formData = new FormData(document.querySelector('form#elsfilter'));
29      currentFloatArgs.formData = formData;
30    }
31    currentFloatArgs.limitstart = 0;
32
33    current = 0;
34  } else {
35    currentFloatArgs.formData = new FormData();
36    currentFloatArgs.formData.append('json', JSON.stringify(currentFloatArgs));
37  }
38  var limitstart = currentFloatArgs.limitstart;
39
40  if (total < current) {
41    alert('too many items, something is not right');
42  }
43
44  if (!prefetchedData && (total <= current && (limitstart >= total || current < currentFloatArgs.limit))) {
45
46    // special case when doing a valid filter AFTER having nothing that matches
47    if (total > 0 || current > 0) {
48      document.querySelector('.no_more').removeAttribute('hidden');
49      document.querySelector("#elsiso_loadmore").setAttribute('hidden', true);
50      document.querySelector("#elsiso_articlesloading").setAttribute('hidden', true);
51      return;
52    }
53  }
54
55  if (prefetchedData) {
56
57    insertedCount = els_isoinsert(prefetchedData.ev_pdata_array, false);
58
59    document.querySelector("#elsiso_articlesloading").setAttribute('hidden', true);
60
61    current = document.querySelectorAll('.elsiso_item.elsfilter_show').length;
62
63    //limitstart += Math.max(currentFloatArgs.limit, prefetchedData.returned_count);
64    limitstart = current;
65    currentFloatArgs.limitstart = limitstart;
66
67    // clear out the prefetched data source
68    prefetchedData = false;
69
70    if (total <= current && (limitstart >= total || current < currentFloatArgs.limit)) {
71      document.querySelector('.no_more').removeAttribute('hidden');
72      document.querySelector("#elsiso_loadmore").setAttribute('hidden', true);
73    }
74    else
75    {
76      document.querySelector("#elsiso_loadmore").removeAttribute('hidden');
77    }
78
79    // workaround for problem with scrolling in some yootheme templates
80    document.querySelector("#easylayouts.isotope").style.minHeight = 0;
81
82    loadingArticles = false;
83
84    elsiso_showmore();
85  } else {
86
87    const xhr = new XMLHttpRequest();
88    let url = dataurl.replaceAll('LIMITSTART', currentFloatArgs.limitstart).replaceAll('LIMIT', currentFloatArgs.limit);
89    xhr.open("POST", url);
90
91    xhr.onload = function () {
92      if (xhr.status != 200) {
93        alert(currentFloatArgs.error_not_get_data);
94        return;
95      }
96      let json = JSON.parse(xhr.responseText);
97      if (json.error) {
98        try {
99          eval(json.error);
100        } catch (e) {
101          alert(currentFloatArgs.error_not_process_handler);
102        }
103      } else {
104
105        if (typeof json.totalTime !== 'undefined')
106        {
107          console.log('Total time = ' + json.totalTime);
108        }
109
110        insertedCount = els_isoinsert(json.ev_pdata_array, replaceArticles);
111
112        document.querySelector("#elsiso_articlesloading").setAttribute('hidden', true);
113
114        // get up to date total from results
115        currentFloatArgs.total = total = json.total;
116        current = document.querySelectorAll('.elsiso_item.elsfilter_show').length;
117
118       // console.log('JSON returned ' + json.returned_count);
119       // console.log('limit is ' + limit);
120
121        //limitstart += Math.max(currentFloatArgs.limit, json.returned_count);
122        limitstart = current;
123        currentFloatArgs.limitstart = limitstart;
124
125        if (total <= current && (limitstart >= total || current < limit )) {
126          document.querySelector('.no_more').removeAttribute('hidden');
127          document.querySelector("#elsiso_loadmore").setAttribute('hidden', true);
128        }
129        // we may have had duplicates!!
130        else if (json.returned_count < limit)
131        {
132          document.querySelector('.no_more').removeAttribute('hidden');
133          document.querySelector("#elsiso_loadmore").setAttribute('hidden', true);
134        }
135        else
136        {
137          document.querySelector("#elsiso_loadmore").removeAttribute('hidden');
138        }
139
140        if (json.datatiming) {
141          alert(json.datatiming);
142        }
143        loadingArticles = false;
144      }
145
146      elsiso_showmore();
147    }
148
149    xhr.onerror = function () {
150      document.querySelector("#elsiso_articlesloading").setAttribute('hidden', true);
151      alert(xhr.statusText);
152      //alert(jqxhr.responseText);
153      //alert(dataurl.replaceAll('LIMITSTART',currentFloatArgs.limitstart).replaceAll('LIMIT',currentFloatArgs.limit))
154      loadingArticles = false;
155    }
156
157    xhr.send(currentFloatArgs.formData);
158
159
160  }
161
162
163}
164
165function elsiso_showmore() {
166  if ( document.querySelector('div.elsiso_container').getAttribute('data-fetch-more_button') == 'true') {
167    return;
168  }
169  if (!loadingArticles && isScrolledIntoView("#elsiso_loadmore")) {
170    loadingArticles = true;
171    getMoreArticles();
172  }
173}
174
175function elsiso_layout() {
176  if (document.querySelector('div.elsiso_container').getAttribute('data-layout') == 'list') {
177    elsiso_list();
178  } else {
179    elsiso_grid();
180  }
181}
182
183// Lets do a function, we can expand it as needed then.
184function elsiso_list() {
185
186  document.querySelectorAll('div.elsiso_container .elsiso_item').forEach(function(item){
187    item.classList.remove('w' + currentFloatArgs.itemWidth);
188    item.classList.add('w1');
189    item.classList.add('listv');
190  });
191  document.querySelector('div.elsiso_container').setAttribute('data-layout', 'list');
192  // Reset layout for the changes to take effect
193  Joomla.elsIsotope.layout();
194  return false;
195}
196
197// Lets do a function, we can expand it as needed then.
198function elsiso_grid() {
199
200  document.querySelectorAll('div.elsiso_container .elsiso_item').forEach(function(item){
201    item.classList.add('w' + currentFloatArgs.itemWidth);
202    item.classList.remove('w1');
203    item.classList.remove('listv');
204  });
205
206  document.querySelector('div.elsiso_container').setAttribute('data-layout', 'grid');
207  // Reset layout for the changes to take effect
208  Joomla.elsIsotope.layout();
209  return false;
210}
211
212function els_isoinsert(ev_pdata_array, replaceArticles)
213{
214  let isoElems = Joomla.elsIsotope.getItemElements();
215
216  let newItems = [];
217  let newItemIds = [];
218  ev_pdata_array.forEach(function (pvdata) {
219    newItemIds.push(pvdata.id);
220    newItems.push(pvdata.item);
221  })
222  if (replaceArticles) {
223    isoElems.forEach(function (existingElement){
224      let existingElementId = parseInt(existingElement.id.replace('elsiso_item_', ''));
225      if(newItemIds.indexOf(existingElementId) == -1)
226      {
227        existingElement.classList.add('elsfilter_hide');
228        existingElement.classList.remove('elsfilter_show');
229        //Joomla.elsIsotope.remove(existingElement);
230      }
231      else
232      {
233        existingElement.classList.add('elsfilter_show');
234        existingElement.classList.remove('elsfilter_hide');
235      }
236
237    });
238    elsiso_arrange();
239  }
240
241  let insertedItems = 0;
242  newItems.forEach(function (value) {
243
244    var div = document.createElement('div');
245    div.innerHTML = value;
246    let newId = div.querySelector('.elsiso_item').id;
247    if (existingElement = document.querySelector('div.elsiso_container #' + newId))
248    {
249      existingElement.classList.add('elsfilter_show');
250      existingElement.classList.remove('elsfilter_hide');
251
252      elsiso_arrange();
253
254      return;
255    }
256
257    if (div.children.length > 0) {
258      let elem = div.children[0]; 
259      Joomla.elsIsotope.insert(elem);
260
261      let item = Joomla.elsIsotope.getItem(elem);
262      Joomla.elsIsotope.layoutItems([item]);
263
264      // layout Isotope after each image loads, otherwise we will get overlaps
265      imagesLoaded(document.getElementById(newId)).on('always', function (img) {
266        //  Don't do this - it repositions everything below!
267        //let item = Joomla.elsIsotope.getItem(img.elements[0]);
268        //Joomla.elsIsotope.layoutItems([item]);
269        elsiso_arrange();
270        return;
271      });
272
273      insertedItems ++;
274
275    }
276
277  });
278  elsiso_arrange();
279
280  return insertedItems;
281}
282
283function elsiso_arrange() {
284  Joomla.elsIsotope.arrange({
285    // item element provided as argument
286    filter: function( index, itemElem ) {
287      return itemElem.classList.contains('elsfilter_show');
288    }
289  });
290
291}
292
293function isScrolledIntoView(el) {
294  el = document.querySelector(el);
295  if (!el)
296  {
297    return false;
298  }
299  var rect = el.getBoundingClientRect();
300  var elemTop = rect.top;
301  var elemBottom = rect.bottom;
302
303  // If element is hidden then skip!!
304  if (el.getAttribute('hidden', false))
305  {
306    return false;
307  }
308
309  // Only completely visible elements return true:
310  //var isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight);
311
312  //console.log(elemTop + " < " + window.innerHeight + " && " + elemBottom + ">= 0");
313  // Partially visible elements return true:
314  isVisible = elemTop < window.innerHeight && elemBottom >= 0;
315  return isVisible;
316}
317
318document.addEventListener('DOMContentLoaded', function () {
319  Joomla.elsIsotope = new Isotope('div.elsiso_container', {
320    // options
321    itemSelector: '.elsiso_item',
322    layoutMode: 'masonry',
323    percentPosition: false,
324    masonry: {
325      gutter: '.elsiso_gutter'
326    },
327    packery: {
328      gutter: '.elsiso_gutter'
329    },
330    originLeft : true,
331    //stagger: 30,
332    // disable scale transform transition when hiding
333    hiddenStyle: {
334      opacity: 0
335    },
336    visibleStyle: {
337      opacity: 1
338    },
339    // fast transitions
340    transitionDuration: '0.8s',
341    filter: '.elsiso_item:not(.elsfilter_hide)'
342
343  });
344  
345  // always get the first batch automatically
346  getMoreArticles();
347
348  if (document.querySelector('form#elsfilter') && document.querySelector('#elsiso_loadmore')) {
349    let form = document.querySelector('form#elsfilter');
350    form.addEventListener('submit', function (event) {
351      getMoreArticles(true);
352      event.preventDefault();
353      return false;
354    });
355  }
356
357  if ( document.querySelector('div.elsiso_container').getAttribute('data-fetch-more_button') != 'true') {
358    window.addEventListener('scroll', function () {
359      if (!loadingArticles && isScrolledIntoView("#elsiso_loadmore")) {
360        loadingArticles = true;
361        getMoreArticles();
362      }
363    });
364  }
365
366});
367
368
369} catch (e) {
370console.error('Error in file:/plugins/system/easylayouts/js/floatItems.js?CVS: 1.7.24; Error:' + e.message);
371};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.