PageSourceSearch

https://quarto.com/js/Bootstrap-4-Breakpoints/bs-breakpoints.js?v=318bde25605a41bbbab1f74a831d6a16

js quarto.com collected 2026-09-24 19:02:08 UTC 4,270 bytes, 144 lines download raw bytes

1/*!
2 * bsBreakpoints v1.1.1 (https://github.com/Johann-S/bs-breakpoints)
3 * Copyright 2018 - 2019 Johann-S <[email protected]>
4 * Licensed under MIT (https://github.com/Johann-S/bs-breakpoints/blob/master/LICENSE)
5 */
6(function (global, factory) {
7  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8  typeof define === 'function' && define.amd ? define(factory) :
9  (global = global || self, global.bsBreakpoints = factory());
10}(this, function () { 'use strict';
11
12  (function () {
13    // Add polyfill for Custom Events
14    function CustomEvent(ev, params) {
15      var evt = document.createEvent('CustomEvent');
16      params = params || {
17        bubbles: false,
18        cancelable: false,
19        detail: undefined
20      };
21      evt.initCustomEvent(ev, params.bubbles, params.cancelable, params.detail);
22      return evt;
23    }
24
25    if (typeof window.CustomEvent !== 'function') {
26      CustomEvent.prototype = window.Event.prototype;
27      window.CustomEvent = CustomEvent;
28    }
29  })();
30
31  var breakPoints = {
32    xSmall: {
33      min: 0,
34      max: 575
35    },
36    small: {
37      min: 576,
38      max: 767
39    },
40    medium: {
41      min: 768,
42      max: 991
43    },
44    large: {
45      min: 992,
46      max: 1199
47    },
48    xLarge: {
49      min: 1200,
50      max: Infinity
51    }
52  };
53  var breakPointsDetected = false;
54  var currentBreakpoint = null;
55  var Events = {
56    INIT: 'init.bs.breakpoint',
57    NEW: 'new.bs.breakpoint'
58  };
59
60  var getJQuery = function getJQuery() {
61    return window.jQuery;
62  };
63
64  var getBreakPoints = function getBreakPoints() {
65    var minSmall = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('--breakpoint-sm'), 10);
66    var minMedium = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('--breakpoint-md'), 10);
67    var minLarge = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('--breakpoint-lg'), 10);
68    var minXlarge = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('--breakpoint-xl'), 10); // update xSmall
69
70    breakPoints.xSmall.max = minSmall - 1; // update small
71
72    breakPoints.small.min = minSmall;
73    breakPoints.small.max = minMedium - 1; // update medium
74
75    breakPoints.medium.min = minMedium;
76    breakPoints.medium.max = minLarge - 1; // update large
77
78    breakPoints.large.min = minLarge;
79    breakPoints.large.max = minXlarge - 1; // update XL
80
81    breakPoints.xLarge.min = minXlarge;
82    breakPointsDetected = true;
83  };
84
85  var _detectBreakPoint = function _detectBreakPoint() {
86    var widthWindow = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
87
88    for (var key in breakPoints) {
89      if (widthWindow <= breakPoints[key].max && widthWindow >= breakPoints[key].min) {
90        return key;
91      }
92    }
93
94    return currentBreakpoint;
95  };
96
97  var dispatchBreakpoint = function dispatchBreakpoint(breakPointKey, eventName) {
98    if (eventName === void 0) {
99      eventName = Events.NEW;
100    }
101
102    if (!currentBreakpoint || currentBreakpoint !== breakPointKey) {
103      currentBreakpoint = breakPointKey;
104      var $ = getJQuery();
105
106      if ($) {
107        var $event = $.Event(eventName, {
108          breakpoint: breakPointKey
109        });
110        $(window).trigger($event);
111      } else {
112        var event = new window.CustomEvent(eventName, {
113          detail: breakPointKey
114        });
115        window.dispatchEvent(event);
116      }
117    }
118  };
119
120  var bsBreakpoints = {
121    init: function init() {
122      getBreakPoints();
123      dispatchBreakpoint(_detectBreakPoint(), Events.INIT);
124      window.addEventListener('resize', function () {
125        dispatchBreakpoint(_detectBreakPoint());
126      });
127    },
128    detectBreakpoint: function detectBreakpoint() {
129      if (!breakPointsDetected) {
130        getBreakPoints();
131      }
132
133      currentBreakpoint = _detectBreakPoint();
134      return currentBreakpoint;
135    },
136    getCurrentBreakpoint: function getCurrentBreakpoint() {
137      return currentBreakpoint;
138    }
139  };
140
141  return bsBreakpoints;
142
143}));
144//# sourceMappingURL=bs-breakpoints.js.map

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.