PageSourceSearch

https://www.onefm.ch/wp-content/themes/click-mag/js/retina.js?ver=7.0.2

js onefm.ch collected 2026-09-24 09:29:22 UTC 3,104 bytes, 100 lines download raw bytes

1(function (global, factory) {
2	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3	typeof define === 'function' && define.amd ? define(factory) :
4	(global.retinajs = factory());
5}(this, (function () { 'use strict';
6
7var hasWindow = typeof window !== 'undefined';
8var environment = Math.round(hasWindow ? window.devicePixelRatio || 1 : 1);
9var srcReplace = /(\.[A-z]{3,4}\/?(\?.*)?)$/;
10var inlineReplace = /url\(('|")?([^)'"]+)('|")?\)/i;
11var selector = '[data-rjs]';
12var processedAttr = 'data-rjs-processed';
13function arrayify(object) {
14  return Array.prototype.slice.call(object);
15}
16function chooseCap(cap) {
17  var numericCap = parseInt(cap, 10);
18  if (environment < numericCap) {
19    return environment;
20  } else {
21    return numericCap;
22  }
23}
24function forceOriginalDimensions(image) {
25  if (!image.hasAttribute('data-no-resize')) {
26    if (image.offsetWidth === 0 && image.offsetHeight === 0) {
27      image.setAttribute('width', image.naturalWidth);
28      image.setAttribute('height', image.naturalHeight);
29    } else {
30      image.setAttribute('width', image.offsetWidth);
31      image.setAttribute('height', image.offsetHeight);
32    }
33  }
34  return image;
35}
36function setSourceIfAvailable(image, retinaURL) {
37  var imgType = image.nodeName.toLowerCase();
38  var testImage = document.createElement('img');
39  testImage.addEventListener('load', function () {
40    if (imgType === 'img') {
41      forceOriginalDimensions(image).setAttribute('src', retinaURL);
42    } else {
43      image.style.backgroundImage = 'url(' + retinaURL + ')';
44    }
45  });
46  testImage.setAttribute('src', retinaURL);
47  image.setAttribute(processedAttr, true);
48}
49function dynamicSwapImage(image, src) {
50  var rjs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
51  var cap = chooseCap(rjs);
52  if (src && cap > 1) {
53    var newSrc = src.replace(srcReplace, '@' + cap + 'x$1');
54    setSourceIfAvailable(image, newSrc);
55  }
56}
57function manualSwapImage(image, src, hdsrc) {
58  if (environment > 1) {
59    setSourceIfAvailable(image, hdsrc);
60  }
61}
62function getImages(images) {
63  if (!images) {
64    return typeof document !== 'undefined' ? arrayify(document.querySelectorAll(selector)) : [];
65  } else {
66    return typeof images.forEach === 'function' ? images : arrayify(images);
67  }
68}
69function cleanBgImg(img) {
70  return img.style.backgroundImage.replace(inlineReplace, '$2');
71}
72function retina(images) {
73  getImages(images).forEach(function (img) {
74    if (!img.getAttribute(processedAttr)) {
75      var isImg = img.nodeName.toLowerCase() === 'img';
76      var src = isImg ? img.getAttribute('src') : cleanBgImg(img);
77      var rjs = img.getAttribute('data-rjs');
78      var rjsIsNumber = !isNaN(parseInt(rjs, 10));
79      if (rjs === null) {
80        return;
81      }
82      if (rjsIsNumber) {
83        dynamicSwapImage(img, src, rjs);
84      } else {
85        manualSwapImage(img, src, rjs);
86      }
87    }
88  });
89}
90if (hasWindow) {
91  window.addEventListener('load', function () {
92    retina();
93  });
94  window.retinajs = retina;
95}
96
97return retina;
98
99})));
100//# sourceMappingURL=retina.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.