1/* 2 * Remodal - v1.0.3 3 * Responsive, lightweight, fast, synchronized with CSS animations, fully customizable modal window plugin with declarative configuration and hash tracking. 4 * http://vodkabears.github.io/remodal/ 5 * 6 * Made by Ilya Makarov 7 * Under MIT License 8 */ 9 10!(function (a, b) { 11 "function" == typeof define && define.amd 12 ? define(["jquery"], function (c) { 13 return b(a, c); 14 }) 15 : "object" == typeof exports 16 ? b(a, require("jquery")) 17 : b(a, a.jQuery || a.Zepto); 18})(this, function (a, b) { 19 "use strict"; 20 function c(a) { 21 if ( 22 w && 23 "none" === a.css("animation-name") && 24 "none" === a.css("-webkit-animation-name") && 25 "none" === a.css("-moz-animation-name") && 26 "none" === a.css("-o-animation-name") && 27 "none" === a.css("-ms-animation-name") 28 ) 29 return 0; 30 var b, 31 c, 32 d, 33 e, 34 f = 35 a.css("animation-duration") || 36 a.css("-webkit-animation-duration") || 37 a.css("-moz-animation-duration") || 38 a.css("-o-animation-duration") || 39 a.css("-ms-animation-duration") || 40 "0s", 41 g = 42 a.css("animation-delay") || 43 a.css("-webkit-animation-delay") || 44 a.css("-moz-animation-delay") || 45 a.css("-o-animation-delay") || 46 a.css("-ms-animation-delay") || 47 "0s", 48 h = 49 a.css("animation-iteration-count") || 50 a.css("-webkit-animation-iteration-count") || 51 a.css("-moz-animation-iteration-count") || 52 a.css("-o-animation-iteration-count") || 53 a.css("-ms-animation-iteration-count") || 54 "1"; 55 for ( 56 f = f.split(", "), 57 g = g.split(", "), 58 h = h.split(", "), 59 e = 0, 60 c = f.length, 61 b = Number.NEGATIVE_INFINITY; 62 c > e; 63 e++ 64 ) 65 (d = parseFloat(f[e]) * parseInt(h[e], 10) + parseFloat(g[e])), 66 d > b && (b = d); 67 return d; 68 } 69 function d() { 70 if (b(document.body).height() <= b(window).height()) return 0; 71 var a, 72 c, 73 d = document.createElement("div"), 74 e = document.createElement("div"); 75 return ( 76 (d.style.visibility = "hidden"), 77 (d.style.width = "100px"), 78 document.body.appendChild(d), 79 (a = d.offsetWidth), 80 (d.style.overflow = "scroll"), 81 (e.style.width = "100%"), 82 d.appendChild(e), 83 (c = e.offsetWidth), 84 d.parentNode.removeChild(d), 85 a - c 86 ); 87 } 88 function e() { 89 var a, 90 c, 91 e = b("html"), 92 f = k("is-locked"); 93 e.hasClass(f) || 94 ((c = b(document.body)), 95 //(a = parseInt(c.css("padding-right"), 10) + d()), 96 (a = parseInt(c.css("padding-right"), 10)), 97 c.css("padding-right", a + "px"), 98 e.addClass(f)); 99 } 100 function f() { 101 var a, 102 c, 103 e = b("html"), 104 f = k("is-locked"); 105 e.hasClass(f) && 106 ((c = b(document.body)), 107 // (a = parseInt(c.css("padding-right"), 10) - d()), 108 (a = parseInt(c.css("padding-right"), 10)), 109 c.css("padding-right", a + "px"), 110 e.removeClass(f)); 111 } 112 function g(a, b, c, d) { 113 var e = k("is", b), 114 f = [ 115 k("is", u.CLOSING), 116 k("is", u.OPENING), 117 k("is", u.CLOSED), 118 k("is", u.OPENED), 119 ].join(" "); 120 a.$bg.removeClass(f).addClass(e), 121 a.$overlay.removeClass(f).addClass(e), 122 a.$wrapper.removeClass(f).addClass(e), 123 a.$modal.removeClass(f).addClass(e), 124 (a.state = b), 125 !c && a.$modal.trigger({ type: b, reason: d }, [{ reason: d }]); 126 } 127 function h(a, d, e) { 128 var f = 0, 129 g = function (a) { 130 a.target === this && f++; 131 }, 132 h = function (a) { 133 a.target === this && 134 0 === --f && 135 (b.each(["$bg", "$overlay", "$wrapper", "$modal"], function (a, b) { 136 e[b].off(r + " " + s); 137 }), 138 d()); 139 }; 140 b.each(["$bg", "$overlay", "$wrapper", "$modal"], function (a, b) { 141 e[b].on(r, g).on(s, h); 142 }), 143 a(), 144 0 === c(e.$bg) && 145 0 === c(e.$overlay) && 146 0 === c(e.$wrapper) && 147 0 === c(e.$modal) && 148 (b.each(["$bg", "$overlay", "$wrapper", "$modal"], function (a, b) { 149 e[b].off(r + " " + s); 150 }), 151 d()); 152 } 153 function i(a) { 154 a.state !== u.CLOSED && 155 (b.each(["$bg", "$overlay", "$wrapper", "$modal"], function (b, c) { 156 a[c].off(r + " " + s); 157 }), 158 a.$bg.removeClass(a.settings.modifier), 159 a.$overlay.removeClass(a.settings.modifier).hide(), 160 a.$wrapper.hide(), 161 f(), 162 g(a, u.CLOSED, !0)); 163 } 164 function j(a) { 165 var b, 166 c, 167 d, 168 e, 169 f = {}; 170 for ( 171 a = a.replace(/\s*:\s*/g, ":").replace(/\s*,\s*/g, ","), 172 b = a.split(","), 173 e = 0, 174 c = b.length; 175 c > e; 176 e++ 177 ) 178 (b[e] = b[e].split(":")), 179 (d = b[e][1]), 180 ("string" == typeof d || d instanceof String) && 181 (d = "true" === d || ("false" === d ? !1 : d)), 182 ("string" == typeof d || d instanceof String) && 183 (d = isNaN(d) ? d : +d), 184 (f[b[e][0]] = d); 185 return f; 186 } 187 function k() { 188 for (var a = q, b = 0; b < arguments.length; ++b) a += "-" + arguments[b]; 189 return a; 190 } 191 function l() { 192 var a, 193 c, 194 d = location.hash.replace("#", ""); 195 if (d) {
196 try { 197 c = b( 198 "[data-" + p + "-id=" + d.replace(new RegExp("/", "g"), "\\/") + "]" 199 ); 200 } catch (e) {} 201 c && 202 c.length && 203 ((a = b[p].lookup[c.data(p)]), 204 a && a.settings.hashTracking && a.open()); 205 } else n && n.state === u.OPENED && n.settings.hashTracking && n.close(); 206 } 207 function m(a, c) { 208 var d = b(document.body), 209 e = this; 210 (e.settings = b.extend({}, t, c)), 211 (e.index = b[p].lookup.push(e) - 1), 212 (e.state = u.CLOSED), 213 (e.$overlay = b("." + k("overlay"))), 214 e.$overlay.length || 215 ((e.$overlay = b("<div>") 216 .addClass(k("overlay") + " " + k("is", u.CLOSED)) 217 .hide()), 218 d.append(e.$overlay)), 219 (e.$bg = b("." + k("bg")).addClass(k("is", u.CLOSED))), 220 (e.$modal = a 221 .addClass( 222 q + 223 " " + 224 k("is-initialized") + 225 " " + 226 e.settings.modifier + 227 " " + 228 k("is", u.CLOSED) 229 ) 230 .attr("tabindex", "-1")), 231 (e.$wrapper = b("<div>") 232 .addClass( 233 k("wrapper") + " " + e.settings.modifier + " " + k("is", u.CLOSED) 234 ) 235 .hide() 236 .append(e.$modal)), 237 d.append(e.$wrapper), 238 e.$wrapper.on( 239 "click." + q, 240 "[data-" + p + '-action="close"]', 241 function (a) { 242 a.preventDefault(), e.close(); 243 } 244 ), 245 e.$wrapper.on( 246 "click." + q, 247 "[data-" + p + '-action="cancel"]', 248 function (a) { 249 a.preventDefault(), 250 e.$modal.trigger(v.CANCELLATION), 251 e.settings.closeOnCancel && e.close(v.CANCELLATION); 252 } 253 ), 254 e.$wrapper.on( 255 "click." + q, 256 "[data-" + p + '-action="confirm"]', 257 function (a) { 258 a.preventDefault(), 259 e.$modal.trigger(v.CONFIRMATION), 260 e.settings.closeOnConfirm && e.close(v.CONFIRMATION); 261 } 262 ), 263 e.$wrapper.on("click." + q, function (a) { 264 var c = b(a.target); 265 c.hasClass(k("wrapper")) && e.settings.closeOnOutsideClick && e.close(); 266 }); 267 } 268 var n, 269 o, 270 p = "remodal", 271 q = (a.REMODAL_GLOBALS && a.REMODAL_GLOBALS.NAMESPACE) || p, 272 r = b 273 .map( 274 [ 275 "animationstart", 276 "webkitAnimationStart", 277 "MSAnimationStart", 278 "oAnimationStart", 279 ], 280 function (a) { 281 return a + "." + q; 282 } 283 ) 284 .join(" "), 285 s = b 286 .map( 287 [ 288 "animationend", 289 "webkitAnimationEnd", 290 "MSAnimationEnd", 291 "oAnimationEnd", 292 ], 293 function (a) { 294 return a + "." + q; 295 } 296 ) 297 .join(" "), 298 t = b.extend( 299 { 300 hashTracking: !0, 301 closeOnConfirm: !0, 302 closeOnCancel: !0, 303 closeOnEscape: !0, 304 closeOnOutsideClick: !0, 305 modifier: "", 306 }, 307 a.REMODAL_GLOBALS && a.REMODAL_GLOBALS.DEFAULTS 308 ), 309 u = { 310 CLOSING: "closing", 311 CLOSED: "closed", 312 OPENING: "opening", 313 OPENED: "opened", 314 }, 315 v = { CONFIRMATION: "confirmation", CANCELLATION: "cancellation" }, 316 w = (function () { 317 var a = document.createElement("div").style; 318 return ( 319 void 0 !== a.animationName || 320 void 0 !== a.WebkitAnimationName || 321 void 0 !== a.MozAnimationName || 322 void 0 !== a.msAnimationName || 323 void 0 !== a.OAnimationName 324 ); 325 })(); 326 (m.prototype.open = function () { 327 var a, 328 c = this; 329 c.state !== u.OPENING && 330 c.state !== u.CLOSING && 331 ((a = c.$modal.attr("data-" + p + "-id")), 332 a && 333 c.settings.hashTracking && 334 ((o = b(window).scrollTop()), (location.hash = a)), 335 n && n !== c && i(n), 336 (n = c), 337 e(), 338 c.$bg.addClass(c.settings.modifier), 339 c.$overlay.addClass(c.settings.modifier).show(), 340 c.$wrapper.show().scrollTop(0), 341 c.$modal.focus(), 342 h( 343 function () { 344 g(c, u.OPENING); 345 }, 346 function () { 347 g(c, u.OPENED); 348 }, 349 c 350 )); 351 }), 352 (m.prototype.close = function (a) { 353 var c = this; 354 c.state !== u.OPENING && 355 c.state !== u.CLOSING && 356 (c.settings.hashTracking && 357 c.$modal.attr("data-" + p + "-id") === location.hash.substr(1) && 358 ((location.hash = ""), b(window).scrollTop(o)), 359 h( 360 function () { 361 g(c, u.CLOSING, !1, a); 362 }, 363 function () { 364 c.$bg.removeClass(c.settings.modifier), 365 c.$overlay.removeClass(c.settings.modifier).hide(), 366 c.$wrapper.hide(), 367 f(), 368 g(c, u.CLOSED, !1, a); 369 }, 370 c 371 )); 372 }), 373 (m.prototype.getState = function () { 374 return this.state; 375 }), 376 (m.prototype.destroy = function () { 377 var a, 378 c = b[p].lookup; 379 i(this), 380 this.$wrapper.remove(), 381 delete c[this.index], 382 (a = b.grep(c, function (a) { 383 return !!a; 384 }).length), 385 0 === a && 386 (this.$overlay.remove(), 387 this.$bg.removeClass( 388 k("is", u.CLOSING) + 389 " " + 390 k("is", u.OPENING) + 391 " " + 392 k("is", u.CLOSED) + 393 " " + 394 k("is", u.OPENED) 395 )); 396 }), 397 (b[p] = { lookup: [] }), 398 (b.fn[p] = function (a) { 399 var c, d; 400 return ( 401 this.each(function (e, f) { 402 (d = b(f)), 403 null == d.data(p) 404 ? ((c = new m(d, a)), 405 d.data(p, c.index), 406 c.settings.hashTracking && 407 d.attr("data-" + p + "-id") === location.hash.substr(1) && 408 c.open()) 409 : (c = b[p].lookup[d.data(p)]); 410 }), 411 c 412 ); 413 }), 414 b(document).ready(function () { 415 b(document).on("click", "[data-" + p + "-target]", function (a) { 416 a.preventDefault(); 417 var c = a.currentTarget, 418 d = c.getAttribute("data-" + p + "-target"), 419 e = b("[data-" + p + "-id=" + d + "]"); 420 b[p].lookup[e.data(p)].open(); 421 }), 422 b(document) 423 .find("." + q) 424 .each(function (a, c) { 425 var d = b(c), 426 e = d.data(p + "-options"); 427 e 428 ? ("string" == typeof e || e instanceof String) && (e = j(e)) 429 : (e = {}), 430 d[p](e); 431 }), 432 b(document).on("keydown." + q, function (a) { 433 n && 434 n.settings.closeOnEscape && 435 n.state === u.OPENED && 436 27 === a.keyCode && 437 n.close(); 438 }), 439 b(window).on("hashchange." + q, l); 440 }); 441});
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.