PageSourceSearch

https://www.bananalink.org.uk/wp-content/themes/banana/bootstrap/js/bootstrap-portfilter.js?ver=7.1.2

js bananalink.org.uk collected 2026-10-02 04:34:38 UTC 2,937 bytes, 106 lines download raw bytes

1/* ============================================================
2 * bootstrap-portfilter.js for Bootstrap v2.3.1
3 * https://github.com/geedmo/portfilter
4 * ============================================================
5 * Copyright 2012 Twitter, Inc.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============================================================
19 * 
20 * jQuery (Very) Lightweight Portfolio Filter for Bootstrap
21 * 
22 * Author: Geedmo (http://geedmo.com)
23 * Version: 1.0
24 * Usage:
25 *   For handlers
26 *     <tag data-toggle="portfilter" data-target="targetname">...
27 *   For items
28 *     <tag data-tag="targetname">...
29 * ============================================================ */
30
31!function ($) {
32
33  "use strict"; // jshint ;_;
34  
35  var pluginName = 'portfilter';
36
37 /* PUBLIC CLASS DEFINITION
38  * ============================== */
39
40  var PortFilter = function (element) {
41    
42    this.$element = $(element)
43    this.stuff    = $('[data-tag]');
44    this.target   = this.$element.data('target') || '';
45
46  }
47
48  PortFilter.prototype.filter = function (params) {
49    var items = [],
50      target = this.target;
51    this.stuff
52        .fadeOut('fast').promise().done(function(){
53            $(this).each(function(){
54                var elem = this
55                  , tagArray = $($(this).data('tag').split(" "));
56                  
57                tagArray.each(function(i, tag){
58                    if(tag == target || target == 'all') 
59                        items.push(elem);
60                });
61                
62            });
63            $(items).show()
64        });  
65  }
66
67
68 /* PLUGIN DEFINITION
69  * ======================== */
70
71  var old = $.fn[pluginName]
72
73  $.fn[pluginName] = function (option) {
74    return this.each(function () {
75      var $this = $(this)
76        , data = $this.data(pluginName);
77      
78      if(!data) $this.data(pluginName, (data = new PortFilter(this)))
79      
80      if (option == 'filter') data.filter()
81    })
82  }
83  
84  // DEFAULTS
85  $.fn[pluginName].defaults = {}
86  
87  // CONSTRUCTOR CONVENTION 
88  $.fn[pluginName].Constructor = PortFilter;
89
90
91 /* PORTFILTER NO CONFLICT
92  * ================== */
93
94  $.fn[pluginName].noConflict = function () {
95    $.fn[pluginName] = old
96    return this
97  }
98
99 /* PORTFILTER DATA-API
100  * =============== */
101
102  $(document).on('click.portfilter.data-api', '[data-toggle^=portfilter]', function (e) {
103    $(this).portfilter('filter')
104  })
105
106}(window.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.