1/* 2 * Remodal - v1.1.1 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 = a.css('animation-duration') || a.css('-webkit-animation-duration') || a.css('-moz-animation-duration') || a.css('-o-animation-duration') || a.css('-ms-animation-duration') || '0s', 35 g = a.css('animation-delay') || a.css('-webkit-animation-delay') || a.css('-moz-animation-delay') || a.css('-o-animation-delay') || a.css('-ms-animation-delay') || '0s', 36 h = 37 a.css('animation-iteration-count') || 38 a.css('-webkit-animation-iteration-count') || 39 a.css('-moz-animation-iteration-count') || 40 a.css('-o-animation-iteration-count') || 41 a.css('-ms-animation-iteration-count') || 42 '1'; 43 for (f = f.split(', '), g = g.split(', '), h = h.split(', '), e = 0, c = f.length, b = Number.NEGATIVE_INFINITY; e < c; e++) 44 (d = parseFloat(f[e]) * parseInt(h[e], 10) + parseFloat(g[e])), d > b && (b = d); 45 return b; 46 } 47 function d() { 48 if (b(document).height() <= b(window).height()) return 0; 49 var a, 50 c, 51 d = document.createElement('div'), 52 e = document.createElement('div'); 53 return ( 54 (d.style.visibility = 'hidden'), 55 (d.style.width = '100px'), 56 document.body.appendChild(d), 57 (a = d.offsetWidth), 58 (d.style.overflow = 'scroll'), 59 (e.style.width = '100%'), 60 d.appendChild(e), 61 (c = e.offsetWidth), 62 d.parentNode.removeChild(d), 63 a - c 64 ); 65 } 66 function e() { 67 if (!x) { 68 var a, 69 c, 70 e = b('html'), 71 f = k('is-locked'); 72 e.hasClass(f) || ((c = b(document.body)), (a = parseInt(c.css('padding-right'), 10) + d()), c.css('padding-right', a + 'px'), e.addClass(f)); 73 } 74 } 75 function f() { 76 if (!x) { 77 var a, 78 c, 79 e = b('html'), 80 f = k('is-locked'); 81 e.hasClass(f) && ((c = b(document.body)), (a = parseInt(c.css('padding-right'), 10) - d()), c.css('padding-right', a + 'px'), e.removeClass(f)); 82 } 83 } 84 function g(a, b, c, d) { 85 var e = k('is', b), 86 f = [k('is', u.CLOSING), k('is', u.OPENING), k('is', u.CLOSED), k('is', u.OPENED)].join(' '); 87 a.$bg.removeClass(f).addClass(e), 88 a.$overlay.removeClass(f).addClass(e), 89 a.$wrapper.removeClass(f).addClass(e), 90 a.$modal.removeClass(f).addClass(e), 91 (a.state = b), 92 !c && a.$modal.trigger({ type: b, reason: d }, [{ reason: d }]); 93 } 94 function h(a, d, e) { 95 var f = 0, 96 g = function (a) { 97 a.target === this && f++; 98 }, 99 h = function (a) { 100 a.target === this && 101 0 === --f && 102 (b.each(['$bg', '$overlay', '$wrapper', '$modal'], function (a, b) { 103 e[b].off(r + ' ' + s); 104 }), 105 d()); 106 }; 107 b.each(['$bg', '$overlay', '$wrapper', '$modal'], function (a, b) { 108 e[b].on(r, g).on(s, h); 109 }), 110 a(), 111 0 === c(e.$bg) && 112 0 === c(e.$overlay) && 113 0 === c(e.$wrapper) && 114 0 === c(e.$modal) && 115 (b.each(['$bg', '$overlay', '$wrapper', '$modal'], function (a, b) { 116 e[b].off(r + ' ' + s); 117 }), 118 d()); 119 } 120 function i(a) { 121 a.state !== u.CLOSED && 122 (b.each(['$bg', '$overlay', '$wrapper', '$modal'], function (b, c) { 123 a[c].off(r + ' ' + s); 124 }), 125 a.$bg.removeClass(a.settings.modifier), 126 a.$overlay.removeClass(a.settings.modifier).hide(), 127 a.$wrapper.hide(), 128 f(), 129 g(a, u.CLOSED, !0)); 130 } 131 function j(a) { 132 var b, 133 c, 134 d, 135 e, 136 f = {}; 137 for (a = a.replace(/\s*:\s*/g, ':').replace(/\s*,\s*/g, ','), b = a.split(','), e = 0, c = b.length; e < c; e++) 138 (b[e] = b[e].split(':')), 139 (d = b[e][1]), 140 ('string' == typeof d || d instanceof String) && (d = 'true' === d || ('false' !== d && d)), 141 ('string' == typeof d || d instanceof String) && (d = isNaN(d) ? d : +d), 142 (f[b[e][0]] = d); 143 return f; 144 } 145 function k() { 146 for (var a = q, b = 0; b < arguments.length; ++b) a += '-' + arguments[b]; 147 return a; 148 } 149 function l() { 150 var a, 151 c, 152 d = location.hash.replace('#', ''); 153 if (d) { 154 try { 155 c = b('[data-remodal-id="' + d + '"]'); 156 } catch (e) {} 157 c && c.length && ((a = b[p].lookup[c.data(p)]), a && a.settings.hashTracking && a.open()); 158 } else n && n.state === u.OPENED && n.settings.hashTracking && n.close(); 159 } 160 function m(a, c) { 161 var d = b(document.body), 162 e = d, 163 f = this; 164 (f.settings = b.extend({}, t, c)), 165 (f.index = b[p].lookup.push(f) - 1), 166 (f.state = u.CLOSED),
167 (f.$overlay = b('.' + k('overlay'))), 168 null !== f.settings.appendTo && f.settings.appendTo.length && (e = b(f.settings.appendTo)), 169 f.$overlay.length || 170 ((f.$overlay = b('<div>') 171 .addClass(k('overlay') + ' ' + k('is', u.CLOSED)) 172 .hide()), 173 e.append(f.$overlay)), 174 (f.$bg = b('.' + k('bg')).addClass(k('is', u.CLOSED))), 175 (f.$modal = a.addClass(q + ' ' + k('is-initialized') + ' ' + f.settings.modifier + ' ' + k('is', u.CLOSED)).attr('tabindex', '-1')), 176 (f.$wrapper = b('<div>') 177 .addClass(k('wrapper') + ' ' + f.settings.modifier + ' ' + k('is', u.CLOSED)) 178 .hide() 179 .append(f.$modal)), 180 e.append(f.$wrapper), 181 f.$wrapper.on('click.' + q, '[data-remodal-action="close"]', function (a) { 182 a.preventDefault(), f.close(); 183 }), 184 f.$wrapper.on('click.' + q, '[data-remodal-action="cancel"]', function (a) { 185 a.preventDefault(), f.$modal.trigger(v.CANCELLATION), f.settings.closeOnCancel && f.close(v.CANCELLATION); 186 }), 187 f.$wrapper.on('click.' + q, '[data-remodal-action="confirm"]', function (a) { 188 a.preventDefault(), f.$modal.trigger(v.CONFIRMATION), f.settings.closeOnConfirm && f.close(v.CONFIRMATION); 189 }), 190 f.$wrapper.on('click.' + q, function (a) { 191 var c = b(a.target); 192 c.hasClass(k('wrapper')) && f.settings.closeOnOutsideClick && f.close(); 193 }); 194 } 195 var n, 196 o, 197 p = 'remodal', 198 q = (a.REMODAL_GLOBALS && a.REMODAL_GLOBALS.NAMESPACE) || p, 199 r = b 200 .map(['animationstart', 'webkitAnimationStart', 'MSAnimationStart', 'oAnimationStart'], function (a) { 201 return a + '.' + q; 202 }) 203 .join(' '), 204 s = b 205 .map(['animationend', 'webkitAnimationEnd', 'MSAnimationEnd', 'oAnimationEnd'], function (a) { 206 return a + '.' + q; 207 }) 208 .join(' '), 209 t = b.extend( 210 { hashTracking: !0, closeOnConfirm: !0, closeOnCancel: !0, closeOnEscape: !0, closeOnOutsideClick: !0, modifier: '', appendTo: null }, 211 a.REMODAL_GLOBALS && a.REMODAL_GLOBALS.DEFAULTS 212 ), 213 u = { CLOSING: 'closing', CLOSED: 'closed', OPENING: 'opening', OPENED: 'opened' }, 214 v = { CONFIRMATION: 'confirmation', CANCELLATION: 'cancellation' }, 215 w = (function () { 216 var a = document.createElement('div').style; 217 return void 0 !== a.animationName || void 0 !== a.WebkitAnimationName || void 0 !== a.MozAnimationName || void 0 !== a.msAnimationName || void 0 !== a.OAnimationName; 218 })(), 219 x = /iPad|iPhone|iPod/.test(navigator.platform); 220 (m.prototype.open = function () { 221 var a, 222 c = this; 223 c.state !== u.OPENING && 224 c.state !== u.CLOSING && 225 ((a = c.$modal.attr('data-remodal-id')), 226 a && c.settings.hashTracking && ((o = b(window).scrollTop()), (location.hash = a)), 227 n && n !== c && i(n), 228 (n = c), 229 e(), 230 c.$bg.addClass(c.settings.modifier), 231 c.$overlay.addClass(c.settings.modifier).show(), 232 c.$wrapper.show().scrollTop(0), 233 c.$modal.focus(), 234 h( 235 function () { 236 g(c, u.OPENING); 237 }, 238 function () { 239 g(c, u.OPENED); 240 }, 241 c 242 )); 243 }), 244 (m.prototype.close = function (a) { 245 var c = this; 246 c.state !== u.OPENING && 247 c.state !== u.CLOSING && 248 c.state !== u.CLOSED && 249 (c.settings.hashTracking && c.$modal.attr('data-remodal-id') === location.hash.substr(1) && ((location.hash = ''), b(window).scrollTop(o)), 250 h( 251 function () { 252 g(c, u.CLOSING, !1, a); 253 }, 254 function () { 255 c.$bg.removeClass(c.settings.modifier), c.$overlay.removeClass(c.settings.modifier).hide(), c.$wrapper.hide(), f(), g(c, u.CLOSED, !1, a); 256 }, 257 c 258 )); 259 }), 260 (m.prototype.getState = function () { 261 return this.state; 262 }), 263 (m.prototype.destroy = function () { 264 var a, 265 c = b[p].lookup; 266 i(this), 267 this.$wrapper.remove(), 268 delete c[this.index], 269 (a = b.grep(c, function (a) { 270 return !!a; 271 }).length), 272 0 === a && (this.$overlay.remove(), this.$bg.removeClass(k('is', u.CLOSING) + ' ' + k('is', u.OPENING) + ' ' + k('is', u.CLOSED) + ' ' + k('is', u.OPENED))); 273 }), 274 (b[p] = { lookup: [] }), 275 (b.fn[p] = function (a) { 276 var c, d; 277 return ( 278 this.each(function (e, f) { 279 (d = b(f)), 280 null == d.data(p) ? ((c = new m(d, a)), d.data(p, c.index), c.settings.hashTracking && d.attr('data-remodal-id') === location.hash.substr(1) && c.open()) : (c = b[p].lookup[d.data(p)]); 281 }), 282 c 283 ); 284 }), 285 b(document).ready(function () { 286 b(document).on('click', '[data-remodal-target]', function (a) { 287 a.preventDefault(); 288 const openModal = function () { 289 var c = a.currentTarget, 290 d = c.getAttribute('data-remodal-target'), 291 e = b('[data-remodal-id="' + d + '"]'); 292 b[p].lookup[e.data(p)].open(); 293 }; 294 if (navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/)) { 295 setTimeout(openModal, 1000); 296 } else { 297 openModal(); 298 } 299 }), 300 b(document) 301 .find('.' + q) 302 .each(function (a, c) { 303 var d = b(c), 304 e = d.data('remodal-options'); 305 e ? ('string' == typeof e || e instanceof String) && (e = j(e)) : (e = {}), d[p](e); 306 }), 307 b(document).on('keydown.' + q, function (a) { 308 n && n.settings.closeOnEscape && n.state === u.OPENED && 27 === a.keyCode && n.close(); 309 }), 310 b(window).on('hashchange.' + q, l); 311 }); 312});
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.