PageSourceSearch

https://knoxvilledivorceattorney.net/wp-content/themes/mmwm_2025/js/ouibounce.js

js knoxvilledivorceattorney.net collected 2026-10-06 19:57:07 UTC 3,841 bytes, 133 lines download raw bytes

vendor: 3,841 bytes, lines 1-133
1function ouibounce(el, custom_config) {
2  "use strict";
3
4  var config     = custom_config || {},
5    aggressive   = config.aggressive || false,
6    sensitivity  = setDefault(config.sensitivity, 20),
7    timer        = setDefault(config.timer, 1000),
8    delay        = setDefault(config.delay, 0),
9    callback     = config.callback || function() {},
10    cookieExpire = setDefaultCookieExpire(config.cookieExpire) || '',
11    cookieDomain = config.cookieDomain ? ';domain=' + config.cookieDomain : '',
12    cookieName   = config.cookieName ? config.cookieName : 'viewedOuibounceModal',
13    sitewide     = config.sitewide === true ? ';path=/' : '',
14    _delayTimer  = null,
15    _html        = document.documentElement;
16
17  function setDefault(_property, _default) {
18    return typeof _property === 'undefined' ? _default : _property;
19  }
20
21  function setDefaultCookieExpire(days) {
22    // transform days to milliseconds
23    var ms = days*24*60*60*1000;
24
25    var date = new Date();
26    date.setTime(date.getTime() + ms);
27
28    return "; expires=" + date.toUTCString();
29  }
30
31  setTimeout(attachOuiBounce, timer);
32  function attachOuiBounce() {
33    if (isDisabled()) { return; }
34
35    _html.addEventListener('mouseleave', handleMouseleave);
36    _html.addEventListener('mouseenter', handleMouseenter);
37    _html.addEventListener('keydown', handleKeydown);
38  }
39
40  function handleMouseleave(e) {
41    if (e.clientY > sensitivity) { return; }
42
43    _delayTimer = setTimeout(fire, delay);
44  }
45
46  function handleMouseenter() {
47    if (_delayTimer) {
48      clearTimeout(_delayTimer);
49      _delayTimer = null;
50    }
51  }
52
53  var disableKeydown = false;
54  function handleKeydown(e) {
55    if (disableKeydown) { return; }
56    else if(!e.metaKey || e.keyCode !== 76) { return; }
57
58    disableKeydown = true;
59    _delayTimer = setTimeout(fire, delay);
60  }
61
62  function checkCookieValue(cookieName, value) {
63    return parseCookies()[cookieName] === value;
64  }
65
66  function parseCookies() {
67    // cookies are separated by '; '
68    var cookies = document.cookie.split('; ');
69
70    var ret = {};
71    for (var i = cookies.length - 1; i >= 0; i--) {
72      var el = cookies[i].split('=');
73      ret[el[0]] = el[1];
74    }
75    return ret;
76  }
77
78  function isDisabled() {
79    return checkCookieValue(cookieName, 'true') && !aggressive;
80  }
81
82  // You can use ouibounce without passing an element
83  // https://github.com/carlsednaoui/ouibounce/issues/30
84  function fire() {
85    if (isDisabled()) { return; }
86
87    if (el) { el.style.display = 'block'; }
88
89    callback();
90    disable();
91  }
92
93  function disable(custom_options) {
94    var options = custom_options || {};
95
96    // you can pass a specific cookie expiration when using the OuiBounce API
97    // ex: _ouiBounce.disable({ cookieExpire: 5 });
98    if (typeof options.cookieExpire !== 'undefined') {
99      cookieExpire = setDefaultCookieExpire(options.cookieExpire);
100    }
101
102    // you can pass use sitewide cookies too
103    // ex: _ouiBounce.disable({ cookieExpire: 5, sitewide: true });
104    if (options.sitewide === true) {
105      sitewide = ';path=/';
106    }
107
108    // you can pass a domain string when the cookie should be read subdomain-wise
109    // ex: _ouiBounce.disable({ cookieDomain: '.example.com' });
110    if (typeof options.cookieDomain !== 'undefined') {
111      cookieDomain = ';domain=' + options.cookieDomain;
112    }
113
114    if (typeof options.cookieName !== 'undefined') {
115      cookieName = options.cookieName;
116    }
117
118    document.cookie = cookieName + '=true' + cookieExpire + cookieDomain + sitewide;
119
120    // remove listeners
121    _html.removeEventListener('mouseleave', handleMouseleave);
122    _html.removeEventListener('mouseenter', handleMouseenter);
123    _html.removeEventListener('keydown', handleKeydown);
124  }
125
126  return {
127    fire: fire,
128    disable: disable,
129    isDisabled: isDisabled
130  };
131}
132
133/*exported ouibounce */

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.