PageSourceSearch

https://amoreiradagandaraparedesdobairroancas.pt/front_end/js/mixitup-loadmore.js

js amoreiradagandaraparedesdobairroancas.pt collected 2026-10-09 02:07:10 UTC 5,651 bytes, 190 lines download raw bytes

1/**!
2 * MixItUp loadmore v0.0.1
3 *
4 * @author    Wayne Durack.
5 * @link      https://github.com/trolleymusic/mixitup-loadmore
6 */ 
7
8(function ($, undf) {
9  $.extend(true, $.MixItUp.prototype, {
10
11    // Mixitup hooks
12    
13    _actions: {
14      _constructor: {
15        post: {
16          loadmore: function () {
17            this.loadmore = {
18              buttonClass: 'loadmore-button',
19              buttonLabel: 'Load more',
20              buttonWrapper: '.loadmore',
21              initial: 2,
22              lessClass: 'loadmore-less',
23              lessLabel: 'less',
24              loadMore: 2
25            }
26
27            $.extend(this.selectors, {
28              button: '.' + this.loadmore.buttonClass,
29              buttonWrapper: this.loadmore.buttonWrapper,
30              less: '.' + this.loadmore.lessClass
31            })
32
33            this._currentCount = null
34            this._$button = $()
35          }
36        }
37      },
38      
39      _init: {
40        post: {
41          loadmore: function () {
42            this._currentCount = this.loadmore.initial
43          }
44        }
45      },
46      
47      _bindHandlers: {
48        post: {
49          loadmore: function () {
50            // Find the button
51            this._$button = $(this.selectors.buttonWrapper)
52            // Bind the buttons
53            // More
54            this._$button.on('click.mixItUp.' + this._id, this.selectors.button, function () {
55              this.multiMix({ loadmore: "more" })
56            }.bind(this))
57            // Less
58            this._$button.on('click.mixItUp.' + this._id, this.selectors.less, function () {
59              this.multiMix({ loadmore: "less" })
60            }.bind(this))
61          }
62        }
63      },
64      
65      _buildState: {
66        post: {
67          loadmore: function () {
68            $.extend(this._state, {
69              _currentCount: this._currentCount
70            })
71          }
72        }
73      },
74      
75      _sort: {
76        post: {
77          loadmore: function () {
78            this._printSort()
79          }
80        }
81      },
82      
83      _filter: {
84        post: {
85          loadmore: function () {
86            
87            var current = this._currentCount || this.loadmore.initial,
88                total = this._$targets.length,
89                show,
90                hide;
91            
92            // Can't go over the total
93            if (current > total) {
94              current = total
95            }
96            
97            if (this.loadmore.loadMore > 0) {
98              
99              show = this._$show.filter(function (i) {
100                return i <= current - 1
101              })
102              
103              hide = this._$show.filter(function (i) {
104                return i > current - 1
105              })
106              
107              this._$show = show
108              this._$hide = this._$hide.add(hide)
109
110              if (this._sorting) {
111                this._printSort(true)
112              }
113              
114              // Make the button
115              if (this._$button.length) {
116                this.generateButtons()
117              }
118              
119            }
120          }
121        }
122      },
123      
124      multiMix: {
125        pre: {
126          loadmore: function (args) {
127            var args = this._parseMultiMixArgs(args)
128            
129            // Reset
130            if (this._currentCount > this._$targets.length) {
131              this._currentCount = this._$targets.length
132            }
133            
134            if (args.command.loadmore && args.command.loadmore === "more") {
135              // Load more
136              this._currentCount = this._currentCount + this.loadmore.loadMore
137            } else if (args.command.loadmore && args.command.loadmore === "less") {
138              // Load less
139              this._currentCount = this.loadmore.initial
140            } else if (args.command.filter && args.command.filter === "all") {
141              // Filter has been turned off
142              this._currentCount = this.loadmore.initial
143            } else if (args.command.filter || args.command.sort) {
144              // Make currentCount more than the targets so that
145              //  the buttons will disappear
146              this._currentCount = this._$targets.length + 1
147            }
148          }  
149        }
150      },
151      
152      destroy: {
153        post: {
154          loadmore: function () {
155            this._$button.off('.mixItUp').html('')
156          }
157        }
158      }
159    },
160
161    // Generate Load more and Less buttons
162    generateButtons: function () {
163      var buttonClass = this.loadmore.buttonClass || '',
164          lessClass = this.loadmore.lessClass || '',
165          buttonLabel = this.loadmore.buttonLabel || 'Load more',
166          lessLabel = this.loadmore.lessLabel || 'Less',
167          buttonDisabled,
168          lessDisabled,
169          disabled = ' disabled="disabled"',
170          buttons
171      
172      if (this._currentCount > this._$targets.length) {
173        buttonDisabled = disabled
174        lessDisabled = disabled
175      } else {
176        buttonDisabled = this._currentCount == this._$targets.length ? disabled : ''
177        lessDisabled = this._currentCount <= this.loadmore.initial ? disabled : ''
178      }
179      
180      buttons = [
181            '<button class="', buttonClass, '"', buttonDisabled, '>', buttonLabel, '</button>',
182            '<button class="', lessClass, '"', lessDisabled, '>', lessLabel, '</button>'
183            ].join('')
184      
185      this._$button.html(buttons)
186    }
187    
188  })
189
190})(jQuery);

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.