PageSourceSearch

https://www.xploresports.com/js/filter/customFilter.js?v=1.7.2.9

js xploresports.com collected 2026-09-30 11:47:35 UTC 12,932 bytes, 451 lines download raw bytes

1
2angular.module('listingFilter',[]).filter('searchName', function() {
3    return function(list,name) {
4        var filtered = [];
5
6        if(!name ){return list;}
7        angular.forEach(list, function(item) {
8
9            if(angular.lowercase(item.title).indexOf(angular.lowercase(name))!=-1)
10            {
11                filtered.push(item);
12            }
13
14        });
15        return filtered;
16    };
17}).filter('searchSport', function() {
18    return function(list,id) {
19        var filtered = [];
20        if(!id ){return list;}
21        angular.forEach(list, function(item) {
22
23            if(angular.lowercase(item.sport_id)== (angular.lowercase(id)))
24            {
25                filtered.push(item);
26            }
27
28        });
29        return filtered;
30    };
31}).filter('myBlogs', function() {
32    return function(list,id) {
33        var filtered = [];
34        if(!id ){return list;}
35        angular.forEach(list, function(item) {
36
37            if(angular.lowercase(item.member_id) == (angular.lowercase(id)))
38            {
39                filtered.push(item);
40            }
41
42        });
43        return filtered;
44    };
45}).filter('emojiType', function() {
46    return function(list,id) {
47        var filtered = [];
48        if(!id ){return list;}
49        angular.forEach(list, function(item) {
50
51            if(angular.lowercase(item.type) == (angular.lowercase(id)))
52            {
53                filtered.push(item);
54            }
55
56        });
57        return filtered;
58    };
59}).filter('myBuddiesBlogs', function() {
60    return function(list,ids,isClicked) {
61        var filtered = [];
62        if(!ids.length && isClicked ){return filtered;}
63        if(!ids.length && !isClicked ){return list;}
64        angular.forEach(list, function(item) {
65            angular.forEach(ids,function(id){
66                if(angular.lowercase(item.member_id) == (angular.lowercase(id)))
67                {
68                    filtered.push(item);
69                }
70            });
71        });
72        return filtered;
73    };
74}).filter('myRssFeed', function() {
75    return function(list,ids,isClicked) {
76        var filtered = [];
77        if(!ids.length && !isClicked ){return list;}
78        if(ids.length && !isClicked ){return list;}
79        angular.forEach(list, function(item) {
80            angular.forEach(ids,function(id){
81                if(angular.lowercase(item.category) == (angular.lowercase(id)))
82                {
83                    filtered.push(item);
84                }
85            });
86        });
87
88        return filtered;
89    };
90}).filter('RssSportCategory', function() {
91    return function(list,category) {
92        var filtered = [];
93        /*if(!ids.length && isClicked ){return filtered;}*/
94        if(category!=''){
95            angular.forEach(list, function(item) {
96                if(angular.lowercase(item.category) == (angular.lowercase(category)))
97                {
98                    filtered.push(item);
99                }
100            });
101        }else{
102            return list;
103        }
104        return filtered;
105    };
106}).filter('filterOutBuddy', function() {
107    return function(list,name) {
108        var filtered = [];
109        if(!name ){return filtered;}
110        angular.forEach(list, function(item) {
111
112            if(angular.lowercase(item.member_name + item.last_name).indexOf(angular.lowercase(name))!=-1)
113            {
114                filtered.push(item);
115            }
116
117
118        });
119        return filtered;
120    };
121}).filter('filterOutMember', function() {
122    return function(list,name) {
123        var filtered = [];
124        if(!name ){return filtered;}
125        angular.forEach(list, function(item) {
126
127            if(angular.lowercase(item.name).indexOf(angular.lowercase(name))!=-1)
128            {
129                filtered.push(item);
130            }
131
132
133        });
134        return filtered;
135    };
136}).filter('filterOutMemberinMsg', function() {
137    return function(list,name) {
138        var filtered = [];
139        if(!name ){return filtered;}
140        angular.forEach(list, function(item) {
141            if(item && item.member_name) {
142                if(angular.lowercase(item.member_name).indexOf(angular.lowercase(name))!=-1)
143                {
144                    filtered.push(item);
145                }
146            }
147
148
149
150        });
151        return filtered;
152    };
153}).filter('filterOutBuddyinMsg', function() {
154    return function(list,name) {
155        var filtered = [];
156        if(!name ){return list;}
157        angular.forEach(list, function(item) {
158
159            if(angular.lowercase(item.company_name).indexOf(angular.lowercase(name))!=-1)
160            {
161                filtered.push(item);
162            }
163
164
165        });
166        return filtered;
167    };
168}).filter('startFrom', function () {
169    return function (input, start) {
170        if (input) {
171            start = +start;
172            return input.slice(start);
173        }
174        return [];
175    };
176}).filter('pagination', function() {
177    return function(input, currentPage, pageSize) {
178        if (angular.isArray(input)) {
179            var start = (currentPage - 1) * pageSize;
180            var end = currentPage * pageSize;
181            return input.slice(start, end);
182        }
183    };
184})
185    .filter('filterOutCompanyinMsg', function() {
186        return function(list,name) {
187            var filtered = [];
188            if(!name ){return list;}
189            angular.forEach(list, function(item) {
190
191                if(angular.lowercase(item.company_name).indexOf(angular.lowercase(name))!=-1)
192                {
193                    filtered.push(item);
194                }
195
196
197            });
198            return filtered;
199        };
200    })
201
202.filter('myDateFilter', ['$filter',
203    function($filter) {
204        return function(input) {
205            var inp = new Date(0, 0, 0, 0, input, 0); // assumes minutes as an input
206            var m = inp.getMinutes();
207            var h = inp.getHours();
208            var d = inp.getDay();
209
210            return d + 'd ' + h + 'h ' + m + 'm ';
211        }
212    }])
213
214.filter('htmlToPlaintext', function() {
215    return function(text) {
216        return  text ? String(text).replace(/<[^>]+>/gm, '') : '';
217    };
218})
219
220
221
222    .filter("toArray", function(){
223    return function(obj) {
224        var result = [];
225        angular.forEach(obj, function(val, key) {
226            result.push(val);
227        });
228        return result;
229    };
230}).filter("shuffleArray",function(){
231    return function(array){
232
233        var currentIndex = array.length,
234            temporaryValue, randomIndex;
235
236        // While there remain elements to shuffle...
237        while (0 !== currentIndex) {
238
239            // Pick a remaining element...
240            randomIndex = Math.floor(Math.random() * currentIndex);
241            currentIndex -= 1;
242
243            // And swap it with the current element.
244            temporaryValue = array[currentIndex];
245            array[currentIndex] = array[randomIndex];
246            array[randomIndex] = temporaryValue;
247        }
248
249        return array;
250
251
252    }
253
254})
255
256
257
258    .value('HTMLIZE_CONVERSIONS', [
259        { expr: /\n+?/g, value: '<br>' }
260    ])
261
262    .filter('htmlize',['HTMLIZE_CONVERSIONS',function(HTMLIZE_CONVERSIONS) {
263        return function(string) {
264            return HTMLIZE_CONVERSIONS.reduce(function(result, conversion) {
265                return result.replace(conversion.expr, conversion.value);
266            }, string || '');
267        };
268    }])
269    .filter('ellipsis', function () {
270        return function (text, length) {
271            if (text.length > length) {
272                return text.substr(0, length) + "<a href='#'>...</a>";
273            }
274            return text;
275        }
276    })
277
278    .filter('commentsFilter',function(){
279    return function (list,page,totalPages) {
280        var length = list.length;
281        var result =[];
282        if(length >5){
283
284            if(totalPages > page ){
285                for(var i=length-(5*page);i<length;i++){
286                    result.push(list[i]);
287                }
288            } else{
289                return list;
290            }
291
292
293
294
295        }else{
296            return list;
297        }
298        return result;
299    }
300})
301
302    .filter('ageFilter', function () {
303        function calculateAge (birthday) { // birthday is a date
304            var date = new Date(birthday);
305            var ageDifMs = Date.now() - date.getTime();
306            var ageDate = new Date(ageDifMs); // miliseconds from epoch
307            return Math.abs(ageDate.getUTCFullYear() - 1970);
308        }
309
310        return function (birthdate) {
311            return calculateAge(birthdate);
312        };
313    }).filter('trusted', ['$sce', function ($sce) {
314    return $sce.trustAsResourceUrl;
315}])
316    .filter('totalSumPriceQty', function() {
317        return function(data, key1, key2) {
318            if (angular.isUndefined(data) || angular.isUndefined(key1) || angular.isUndefined(key2))
319                return 0;
320
321            var sum = 0;
322            angular.forEach(data, function(v, k) {
323                sum = sum + (parseInt(v[key1]) * parseInt(v[key2]) / 100);
324            });
325            return sum;
326        }
327    })
328    .filter('dateRange', function() {
329
330        var fromStr2Date = function (date) {
331            var days = +date.substr(0, 2);
332            var month = +date.substr(3, 2);
333            var year = +date.substr(6, 4);
334            return new Date(year, month, days);
335        }
336    })
337
338
339
340    .filter('monthName', [function() {
341        return function (monthNumber) { //1 = January
342            var monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June',
343                'July', 'August', 'September', 'October', 'November', 'December' ];
344            return monthNames[monthNumber - 1];
345        }
346    }])
347
348.filter('sumOfValue', function () {
349    return function (data, key) {
350        if (angular.isUndefined(data) && angular.isUndefined(key))
351            return 0;
352        var sum = 0;
353
354        angular.forEach(data,function(v,k){
355            sum = sum + parseFloat(v[key]);
356        });
357        return sum.toFixed(2);
358    }
359})
360    .filter('objOrder', function () {
361        return function(object) {
362            var array = [];
363            angular.forEach(object, function (value, key) {
364                array.push({key: key, value: value});
365            });
366            return array;
367        };
368    })
369.filter('byFullName', function() {
370    return function(names, search) {
371        //names is the array that is passed to the filter
372        //search is the comparison value passed to the filter
373        if(angular.isDefined(search)) {
374            //make sure search is not undefined
375            var results = [];
376            var i;
377            var searchVal = search;
378            for(i = 0; i < names.length; i++){
379                var member_name = names[i].member_name;
380                var last_name = names[i].last_name;
381                //*OPTIONAL: convert values to lowercase for case insensitive filter
382                if(member_name.indexOf(searchVal) >=0 || last_name.indexOf(searchVal) >=0){
383                    //Loop over the array and check if the search string matches either
384                    //the firstName or LastName
385                    results.push(names[i]);
386                    //If there's a match, add the value to the results array that is returned
387                }
388            }
389            return results;
390        } else {
391            return names;
392            //If no search value is provided, we just want to return the whole array
393        }
394    };
395})
396    .filter('fromNow', function() {
397        return function(date) {
398            return moment(date).fromNow();
399        }
400    })
401
402.filter('customSplitString', function() {
403    return function(input) {
404        var arr = input.split(',');
405        return arr;
406    };
407})
408
409
410    .filter('unique', function () {
411
412        return function (items, filterOn) {
413
414
415            if (filterOn === false) {
416                return items;
417            }
418
419            if ((filterOn || angular.isUndefined(filterOn)) && angular.isArray(items)) {
420                var hashCheck = {}, newItems = [];
421
422                var extractValueToCompare = function (item) {
423                    if (angular.isObject(item) && angular.isString(filterOn)) {
424                        return item[filterOn];
425                    } else {
426                        return item;
427                    }
428                };
429
430                angular.forEach(items, function (item) {
431                    var valueToCheck, isDuplicate = false;
432
433                    for (var i = 0; i < newItems.length; i++) {
434                        if (angular.equals(extractValueToCompare(newItems[i]), extractValueToCompare(item))) {
435                            isDuplicate = true;
436                            break;
437                        }
438                    }
439                    if (!isDuplicate) {
440                        newItems.push(item);
441                    }
442
443                });
444                items = newItems;
445            }
446            return items;
447        };
448    });
449
450
451

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.