vendor: 6,472 bytes, lines 1-170
1/*! 2 * @preserve 3 * 4 * Readmore.js jQuery plugin 5 * Licensed under the MIT license 6 * 7 * Debounce function from http://davidwalsh.name/javascript-debounce-function 8 */ 9! function(t) { 10 "function" == typeof define && define.amd ? define(["jquery"], t) : "object" == typeof exports ? module.exports = t(require("jquery")) : t(jQuery) 11}(function(t) { 12 "use strict"; 13 14 function e(t, e, i) { 15 var a; 16 return function() { 17 var n = this, 18 o = arguments, 19 r = function() { 20 a = null, i || t.apply(n, o) 21 }, 22 s = i && !a; 23 clearTimeout(a), a = setTimeout(r, e), s && t.apply(n, o) 24 } 25 } 26 27 function i(t) { 28 var e = ++h; 29 return String(null == t ? "rmjs-" : t) + e 30 } 31 32 function a(t) { 33 var e = t.clone().css({ 34 height: "auto", 35 width: t.width(), 36 maxHeight: "none", 37 overflow: "hidden" 38 }).insertAfter(t), 39 i = e.outerHeight(), 40 a = parseInt(e.css({ 41 maxHeight: "" 42 }).css("max-height").replace(/[^-\d\.]/g, ""), 10), 43 n = t.data("defaultHeight"); 44 e.remove(); 45 var o = a || t.data("collapsedHeight") || n; 46 t.data({ 47 expandedHeight: i, 48 maxHeight: a, 49 collapsedHeight: o 50 }).css({ 51 maxHeight: "none" 52 }) 53 } 54 55 function n(t) { 56 if (!d[t.selector]) { 57 var e = " "; 58 t.embedCSS && "" !== t.blockCSS && (e += t.selector + " + [data-readmore-toggle], " + t.selector + "[data-readmore]{" + t.blockCSS + "}"), e += t.selector + "[data-readmore]{transition: height " + t.speed + "ms;overflow: hidden;}", 59 function(t, e) { 60 var i = t.createElement("style"); 61 i.type = "text/css", i.styleSheet ? i.styleSheet.cssText = e : i.appendChild(t.createTextNode(e)), t.getElementsByTagName("head")[0].appendChild(i) 62 }(document, e), d[t.selector] = !0 63 } 64 } 65 66 function o(e, i) { 67 this.element = e, this.options = t.extend({}, s, i), n(this.options), this._defaults = s, this._name = r, this.init(), window.addEventListener ? (window.addEventListener("load", l), window.addEventListener("resize", l)) : (window.attachEvent("load", l), window.attachEvent("resize", l)) 68 } 69 var r = "readmore", 70 s = { 71 speed: 100, 72 collapsedHeight: 200, 73 heightMargin: 16, 74 moreLink: '<p class="morelink"><a href="#">Read on »</a></p>', 75 lessLink: '<p class="morelink"><a href="#">Read off »</a></p>', 76 embedCSS: !0, 77 //blockCSS: "display: block; width: 100%;", 78 startOpen: !1, 79 beforeToggle: function() {}, 80 afterToggle: function() {} 81 }, 82 d = {}, 83 h = 0, 84 l = e(function() { 85 t("[data-readmore]").each(function() { 86 var e = t(this), 87 i = "true" === e.attr("aria-expanded"); 88 a(e), e.css({ 89 height: e.data(i ? "expandedHeight" : "collapsedHeight") 90 }) 91 }) 92 }, 100); 93 o.prototype = { 94 init: function() { 95 var e = t(this.element); 96 e.data({ 97 defaultHeight: this.options.collapsedHeight, 98 heightMargin: this.options.heightMargin 99 }), a(e); 100 var n = e.data("collapsedHeight"), 101 o = e.data("heightMargin"); 102 if (e.outerHeight(!0) <= n + o) return !0; 103 var r = e.attr("id") || i(), 104 s = this.options.startOpen ? this.options.lessLink : this.options.moreLink; 105 e.attr({ 106 "data-readmore": "", 107 "aria-expanded": this.options.startOpen, 108 id: r 109 }), e.after(t(s).on("click", function(t) { 110 return function(i) { 111 t.toggle(this, e[0], i) 112 } 113 }(this)).attr({ 114 "data-readmore-toggle": "", 115 "aria-controls": r 116 })), this.options.startOpen || e.css({ 117 height: n 118 }) 119 }, 120 toggle: function(e, i, a) { 121 a && a.preventDefault(), e || (e = t('[aria-controls="' + _this.element.id + '"]')[0]), i || (i = _this.element); 122 var n = t(i), 123 o = "", 124 r = "", 125 s = !1, 126 d = n.data("collapsedHeight"); 127 n.height() <= d ? (o = n.data("expandedHeight") + "px", r = "lessLink", s = !0) : (o = d, r = "moreLink"), this.options.beforeToggle(e, n, !s), n.css({ 128 height: o 129 }), n.on("transitionend", function(i) { 130 return function() { 131 i.options.afterToggle(e, n, s), t(this).attr({ 132 "aria-expanded": s 133 }).off("transitionend") 134 } 135 }(this)), t(e).replaceWith(t(this.options[r]).on("click", function(t) { 136 return function(e) { 137 t.toggle(this, i, e) 138 } 139 }(this)).attr({ 140 "data-readmore-toggle": "", 141 "aria-controls": n.attr("id") 142 })) 143 }, 144 destroy: function() { 145 t(this.element).each(function() { 146 var e = t(this); 147 e.attr({ 148 "data-readmore": null, 149 "aria-expanded": null 150 }).css({ 151 maxHeight: "", 152 height: "" 153 }).next("[data-readmore-toggle]").remove(), e.removeData() 154 }) 155 } 156 }, t.fn.readmore = function(e) { 157 var i = arguments, 158 a = this.selector; 159 return e = e || {}, "object" == typeof e ? this.each(function() { 160 if (t.data(this, "plugin_" + r)) { 161 var i = t.data(this, "plugin_" + r); 162 i.destroy.apply(i) 163 } 164 e.selector = a, t.data(this, "plugin_" + r, new o(this, e)) 165 }) : "string" == typeof e && "_" !== e[0] && "init" !== e ? this.each(function() { 166 var a = t.data(this, "plugin_" + r); 167 a instanceof o && "function" == typeof a[e] && a[e].apply(a, Array.prototype.slice.call(i, 1)) 168 }) : void 0 169 } 170});
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.