1/* 2 jQuery wookmark plugin 3 @name jquery.wookmark.js 4 @author Christoph Ono ([email protected] or @gbks) 5 @author Sebastian Helzle ([email protected] or @sebobo) 6 @version 1.4.7 7 @date 05/18/2014 8 @category jQuery plugin 9 @copyright (c) 2009-2014 Christoph Ono (www.wookmark.com) 10 @license Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license. 11 */ 12!(function (t) { 13 'function' == typeof define && define.amd ? define(['jquery'], t) : t(jQuery); 14})(function (t) { 15 function i(t) { 16 n(function () { 17 var i, e; 18 for (i = 0; t.length > i; i++) ((e = t[i]), e.obj.css(e.css)); 19 }); 20 } 21 function e(i) { 22 return t.trim(i).toLowerCase(); 23 } 24 var s, h, o; 25 ((o = function (t, i) { 26 return function () { 27 return t.apply(i, arguments); 28 }; 29 }), 30 (h = { align: 'center', autoResize: !1, comparator: null, container: t('body'), direction: void 0, ignoreInactiveItems: !0, itemWidth: 0, fillEmptySpace: !1, flexibleWidth: 0, offset: 2, outerOffset: 0, onLayoutChanged: void 0, possibleFilters: [], resizeDelay: 50, verticalOffset: void 0 })); 31 var n = 32 window.requestAnimationFrame || 33 function (t) { 34 t(); 35 }, 36 r = t(window); 37 ((s = (function () { 38 function s(i, e) { 39 ((this.handler = i), 40 (this.columns = this.containerWidth = this.resizeTimer = null), 41 (this.activeItemCount = 0), 42 (this.itemHeightsDirty = !0), 43 (this.placeholders = []), 44 t.extend(!0, this, h, e), 45 (this.verticalOffset = this.verticalOffset || this.offset), 46 (this.update = o(this.update, this)), 47 (this.onResize = o(this.onResize, this)), 48 (this.onRefresh = o(this.onRefresh, this)), 49 (this.getItemWidth = o(this.getItemWidth, this)), 50 (this.layout = o(this.layout, this)), 51 (this.layoutFull = o(this.layoutFull, this)), 52 (this.layoutColumns = o(this.layoutColumns, this)), 53 (this.filter = o(this.filter, this)), 54 (this.clear = o(this.clear, this)), 55 (this.getActiveItems = o(this.getActiveItems, this)), 56 (this.refreshPlaceholders = o(this.refreshPlaceholders, this)), 57 (this.sortElements = o(this.sortElements, this)), 58 (this.updateFilterClasses = o(this.updateFilterClasses, this)), 59 this.updateFilterClasses(), 60 this.autoResize && r.bind('resize.wookmark', this.onResize), 61 this.container.bind('refreshWookmark', this.onRefresh)); 62 } 63 return ( 64 (s.prototype.updateFilterClasses = function () { 65 for (var t, i, s, h, o = 0, n = 0, r = 0, a = {}, l = this.possibleFilters; this.handler.length > o; o++) 66 if (((i = this.handler.eq(o)), (t = i.data('filterClass')), 'object' == typeof t && t.length > 0)) for (n = 0; t.length > n; n++) ((s = e(t[n])), void 0 === a[s] && (a[s] = []), a[s].push(i[0])); 67 for (; l.length > r; r++) ((h = e(l[r])), h in a || (a[h] = [])); 68 this.filterClasses = a; 69 }), 70 (s.prototype.update = function (i) { 71 ((this.itemHeightsDirty = !0), t.extend(!0, this, i)); 72 }), 73 (s.prototype.onResize = function () { 74 (clearTimeout(this.resizeTimer), (this.itemHeightsDirty = 0 !== this.flexibleWidth), (this.resizeTimer = setTimeout(this.layout, this.resizeDelay))); 75 }), 76 (s.prototype.onRefresh = function () { 77 ((this.itemHeightsDirty = !0), this.layout()); 78 }), 79 (s.prototype.filter = function (i, s, h) { 80 var o, 81 n, 82 r, 83 a, 84 l, 85 f = [], 86 c = t(); 87 if (((i = i || []), (s = s || 'or'), (h = h || !1), i.length)) { 88 for (n = 0; i.length > n; n++) ((l = e(i[n])), l in this.filterClasses && f.push(this.filterClasses[l])); 89 if (((o = f.length), 'or' == s || 1 == o)) for (n = 0; o > n; n++) c = c.add(f[n]); 90 else if ('and' == s) { 91 var u, 92 d, 93 m, 94 p = f[0], 95 g = !0; 96 for (n = 1; o > n; n++) f[n].length < p.length && (p = f[n]); 97 for (p = p || [], n = 0; p.length > n; n++) { 98 for (d = p[n], g = !0, r = 0; f.length > r && g; r++) 99 if (((m = f[r]), p != m)) { 100 for (a = 0, u = !1; m.length > a && !u; a++) u = m[a] == d; 101 g &= u; 102 } 103 g && c.push(p[n]); 104 } 105 } 106 h || this.handler.not(c).addClass('inactive'); 107 } else c = this.handler; 108 return (h || (c.removeClass('inactive'), (this.columns = null), this.layout()), c); 109 }), 110 (s.prototype.refreshPlaceholders = function (i, e) { 111 for (var s, h, o, n, r, a, l = this.placeholders.length, f = this.columns.length, c = this.container.innerHe
111ight(); f > l; l++) ((s = t('<div class="wookmark-placeholder"/>').appendTo(this.container)), this.placeholders.push(s)); 112 for (a = this.offset + 2 * parseInt(this.placeholders[0].css('borderLeftWidth'), 10), l = 0; this.placeholders.length > l; l++) 113 if (((s = this.placeholders[l]), (o = this.columns[l]), l >= f || !o[o.length - 1])) s.css('display', 'none'); 114 else { 115 if (!(h = o[o.length - 1])) continue; 116 ((n = c - (r = h.data('wookmark-top') + h.data('wookmark-height') + this.verticalOffset) - a), s.css({ position: 'absolute', display: n > 0 ? 'block' : 'none', left: l * i + e, top: r, width: i - a, height: n })); 117 } 118 }), 119 (s.prototype.getActiveItems = function () { 120 return this.ignoreInactiveItems ? this.handler.not('.inactive') : this.handler; 121 }), 122 (s.prototype.getItemWidth = function () { 123 var t = this.itemWidth, 124 i = this.container.width() - 2 * this.outerOffset, 125 e = this.handler.eq(0), 126 s = this.flexibleWidth; 127 if ((void 0 === this.itemWidth || (0 === this.itemWidth && !this.flexibleWidth) ? (t = e.outerWidth()) : 'string' == typeof this.itemWidth && this.itemWidth.indexOf('%') >= 0 && (t = (parseFloat(this.itemWidth) / 100) * i), s)) { 128 'string' == typeof s && s.indexOf('%') >= 0 && (s = (parseFloat(s) / 100) * i); 129 var h = i + this.offset, 130 o = ~~(0.5 + h / (s + this.offset)), 131 n = ~~(h / (t + this.offset)), 132 r = Math.max(o, n), 133 a = Math.min(s, ~~((i - (r - 1) * this.offset) / r)); 134 ((t = Math.max(t, a)), this.handler.css('width', t)); 135 } 136 return t; 137 }), 138 (s.prototype.layout = function (t) { 139 if (this.container.is(':visible')) { 140 var i, 141 e, 142 s = this.getItemWidth() + this.offset, 143 h = this.container.width() - 2 * this.outerOffset, 144 o = ~~((h + this.offset) / s), 145 n = 0, 146 r = 0, 147 a = this.getActiveItems(), 148 l = a.length; 149 if (this.itemHeightsDirty || !this.container.data('itemHeightsInitialized')) { 150 for (; l > r; r++) ((i = a.eq(r)), i.data('wookmark-height', i.outerHeight())); 151 ((this.itemHeightsDirty = !1), this.container.data('itemHeightsInitialized', !0)); 152 } 153 ((o = Math.max(1, Math.min(o, l))), 154 (n = this.outerOffset), 155 'center' == this.align && (n += ~~((h - (o * s - this.offset) + 0.5) >> 1)), 156 (this.direction = this.direction || ('right' == this.align ? 'right' : 'left')), 157 (e = t || null === this.columns || this.columns.length != o || this.activeItemCount != l ? this.layoutFull(s, o, n) : this.layoutColumns(s, n)), 158 (this.activeItemCount = l), 159 this.container.attr({ 'data-min-height': this.container.attr('data-flexible-height') == '1' || this.container.attr('data-min-height') > parseInt(e) ? this.container.attr('data-min-height') : e }), 160 this.container.css('height', this.container.attr('data-min-height') > parseInt(e) ? this.container.attr('data-min-height') + 'px' : e), 161 this.fillEmptySpace && this.refreshPlaceholders(s, n), 162 void 0 !== this.onLayoutChanged && 'function' == typeof this.onLayoutChanged && this.onLayoutChanged()); 163 } 164 }), 165 (s.prototype.sortElements = function (t) { 166 return 'function' == typeof this.comparator ? t.sort(this.comparator) : t; 167 }), 168 (s.prototype.layoutFull = function (e, s, h) { 169 var o, 170 n, 171 r = 0, 172 a = 0, 173 l = t.makeArray(this.getActiveItems()), 174 f = l.length, 175 c = null, 176 u = null, 177 d = [], 178 m = [], 179 p = 'left' == this.align; 180 for (this.columns = [], l = this.sortElements(l); s > d.length; ) (d.push(this.outerOffset), this.columns.push([])); 181 for (; f > r; r++) { 182 for (o = t(l[r]), c = d[0], u = 0, a = 0; s > a; a++) c > d[a] && ((c = d[a]), (u = a)); 183 (o.data('wookmark-top', c), (n = h), (u > 0 || !p) && (n += u * e), ((m[r] = { obj: o, css: { position: 'absolute', top: c } }).css[this.direction] = n), (d[u] += o.data('wookmark-height') + this.verticalOffset), this.columns[u].push(o)); 184 } 185 return (i(m), Math.max.apply(Math, d)); 186 }), 187 (s.prototype.layoutColumns = function (t, e) { 188 for (var s, h, o, n, r = [], a = [], l = 0, f = 0, c = 0; this.columns.length > l; l++) { 189 for (r.push(this.outerOffset), h = this.columns[l], n = l * t + e, s = r[l], f = 0; h.length > f; f++, c++) ((o = h[f].data('wookmark-top', s)), ((a[c] = { obj: o, css: { top: s } }).css[this.direction] = n), (s += o.data('wookmark-height') + this.verticalOffset)); 190 r[l] = s; 191 } 192 return (i(a), Math.max.apply(Math, r)); 193 }), 194 (s.prototype.clear = function () { 195 (clearTimeout(this.resizeTimer), r.unbind('resize.wookmark', this.onResize), this.container.unbind('refreshWookmark', this.onRefresh), (this.handler.wookmarkInstance = null)); 196 }), 197 s 198 ); 199 })()), 200 (t.fn.wookmark = function (t) { 201 return (this.wookmarkInstance ? this.wookmarkInstance.update(t || {}) : (this.wookmarkInstance = new s(this, t || {})), this.wookmarkInstance.layout(!0), this.show()); 202 })); 203});
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.