PageSourceSearch

https://survivorfitness.org/wp-content/plugins/codemonkeys-hipaa-f…viewport-units-buggyfill.hacks.js?ver=3.3.0

js survivorfitness.org collected 2026-10-04 06:14:25 UTC 3,818 bytes, 124 lines download raw bytes

1/*!
2 * viewport-units-buggyfill.hacks v0.6.0
3 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/
4 * @author: Zoltan Hawryluk - http://www.useragentman.com/
5 */
6
7(function (root, factory) {
8  'use strict';
9  if (typeof define === 'function' && define.amd) {
10    // AMD. Register as an anonymous module.
11    define([], factory);
12  } else if (typeof exports === 'object') {
13    // Node. Does not work with strict CommonJS, but
14    // only CommonJS-like enviroments that support module.exports,
15    // like Node.
16    module.exports = factory();
17  } else {
18    // Browser globals (root is window)
19    root.viewportUnitsBuggyfillHacks = factory();
20  }
21}(this, function () {
22  'use strict';
23
24  var options;
25  var calcExpression = /calc\(/g;
26  var quoteExpression = /[\"\']/g;
27  var urlExpression = /url\([^\)]*\)/g;
28  var userAgent = window.navigator.userAgent;
29  var isBuggyIE = /MSIE [0-9]\./i.test(userAgent);
30  var isOldIE = /MSIE [0-8]\./i.test(userAgent);
31  var supportsVminmax = true;
32  var supportsVminmaxCalc = true;
33
34  // added check for IE10, IE11 and Edge < 20, since it *still* doesn't understand vmax
35  // http://caniuse.com/#feat=viewport-units
36  if (!isBuggyIE) {
37    isBuggyIE = !!navigator.userAgent.match(/MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./);
38  }
39
40  if (isBuggyIE === true) {
41    supportsVminmaxCalc = false;
42    supportsVminmax = false;
43  }
44
45  // iOS SAFARI, IE9, or Stock Android: abuse "content" if "viewport-units-buggyfill" specified
46  function checkHacks(declarations, rule, name, value) {
47    var needsHack = name === 'content' && value.indexOf('viewport-units-buggyfill') > -1;
48    if (!needsHack) {
49      return;
50    }
51
52    var fakeRules = value.replace(quoteExpression, '');
53    fakeRules.split(';').forEach(function(fakeRuleElement) {
54      var fakeRule = fakeRuleElement.split(':');
55      if (fakeRule.length !== 2) {
56        return;
57      }
58
59      var name = fakeRule[0].trim();
60      if (name === 'viewport-units-buggyfill') {
61        return;
62      }
63
64      var value = fakeRule[1].trim();
65      declarations.push([rule, name, value]);
66      if (calcExpression.test(value)) {
67        var webkitValue = value.replace(calcExpression, '-webkit-calc(');
68        declarations.push([rule, name, webkitValue]);
69      }
70    });
71  }
72
73  return {
74    required: function(options) {
75      return options.isMobileSafari || isBuggyIE;
76    },
77
78    initialize: function(initOptions) {
79      options = initOptions;
80
81      // Test viewport units support in calc() expressions
82      var div = document.createElement('div');
83      div.style.width = '1vmax';
84      supportsVminmax = div.style.width !== '';
85
86      // there is no accurate way to detect this programmatically.
87      if (options.isMobileSafari || options.isBadStockAndroid) {
88        supportsVminmaxCalc = false;
89      }
90
91    },
92
93    initializeEvents: function(options, refresh, _refresh) {
94      if (options.force) {
95        return;
96      }
97
98      if (isBuggyIE && !options._listeningToResize) {
99        window.addEventListener('resize', _refresh, true);
100        options._listeningToResize = true;
101      }
102    },
103
104    findDeclarations: function(declarations, rule, name, value) {
105      if (name === null) {
106        // KeyframesRule does not have a CSS-PropertyName
107        return;
108      }
109
110      checkHacks(declarations, rule, name, value);
111    },
112
113    overwriteDeclaration: function(rule, name, _value) {
114      if (isBuggyIE && name === 'filter') {
115        // remove unit "px" from complex value, e.g.:
116        // filter: progid:DXImageTransform.Microsoft.DropShadow(OffX=5.4px, OffY=3.9px, Color=#000000);
117        _value = _value.replace(/px/g, '');
118      }
119
120      return _value;
121    }
122  };
123
124}));

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.