PageSourceSearch

https://kulturportal.de/media/scripts/jquery.itemsList.js

js kulturportal.de collected 2026-09-24 22:23:19 UTC 1,903 bytes, 76 lines download raw bytes

1jQuery(function($) {
2
3   function ItemsList(el, params) {
4      this.lastScrollPosition = 0;
5      this.scrollPosition = 0;
6      this.isLoading = false;
7      this.params = params;
8      this.page = 1;
9      this.el = el;
10      this.init();
11   }
12
13   ItemsList.prototype.init = function() {
14      var self = this;
15
16      $(window).scroll(function() {
17         self.scrollPosition = $(window).scrollTop();
18         if (self.scrollPosition + $(window).height() > ($(document).height() - 200) &&
19            self.lastScrollPosition < self.scrollPosition && !self.isLoading) {
20            self.lastScrollPosition = self.scrollPosition;
21            self.load();
22         }
23      });
24
25      self.load();
26   };
27
28   ItemsList.prototype.load = function(callback) {
29      var self = this;
30
31      CbUx.showLoader();
32      self.isLoading = true;
33
34      $.ajax({
35         url: ENV.link_root + self.params.url,
36         data: $.extend({}, {
37            m : 'projects',
38            p : self.page
39         }, self.params.filter)
40      })
41      .done(function(data) {
42         self.params.status.html(data.Status);
43         $.each(data.Results, function(i, item) {
44            self.el.append(
45            Mustache.render(self.params.item_tmpl.html(), item)
46            );
47         });
48         self.page += 1;
49         self.isLoading = false;
50
51//         if ($(document).height() <= $(window).height()) {
52//            self.load();
53//         }
54
55         if(data.IsLastPage || data.NbResults === 0) {
56            $(window).unbind('scroll');
57         }
58
59         if(typeof callback === 'function'){
60            callback();
61         }
62      })
63      .fail(CbUx.ajaxError)
64      .always(function() {
65         CbUx.hideLoader();
66      });
67   };
68
69   $.fn.itemsList = function(params) {
70       console.log("ITEMS LIST EXISTS ");
71      return this.each(function(){
72         new ItemsList($(this), params);
73      });
74   };
75
76});

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.