PageSourceSearch

https://www.soboba-nsn.gov/sites/all/modules/ais/assets/js/ais.js?t59umf

js soboba-nsn.gov collected 2026-10-01 12:31:39 UTC 2,539 bytes, 89 lines download raw bytes

1/**
2 * @file
3 * Set the adaptive image cookie based on the window size
4 *
5 */
6
7// For older browsers that don't support filter()
8if (!Array.prototype.filter)
9{
10  Array.prototype.filter = function(fun /*, thisp */)
11  {
12    "use strict";
13
14    if (this == null)
15      throw new TypeError();
16
17    var t = Object(this);
18    var len = t.length >>> 0;
19    if (typeof fun != "function")
20      throw new TypeError();
21
22    var res = [];
23    var thisp = arguments[1];
24    for (var i = 0; i < len; i++)
25    {
26      if (i in t)
27      {
28        var val = t[i]; // in case fun mutates this
29        if (fun.call(thisp, val, i, t))
30          res.push(val);
31      }
32    }
33
34    return res;
35  };
36}
37
38
39/**
40 * Set the cookie with the width value
41 */
42(function ($) {
43  Drupal.behaviors.ais = function () {
44    /*
45      First, get the actual browser size.
46      window.outerWidth/outerHeight answers honestly on Android devices, dishonestly on iOS, and not at all in IE
47      window.screen.availWidth/availHeight answers honestly on iOS devices, dishonestly on Android, and not at all in pre-html5 browsers
48      $(window).width()/height() will always answer (thanks jQuery!) and is the fall back
49    */
50    var width = [ window.outerWidth, window.screen.availWidth, $(window).width()];
51    var height = [ window.outerHeight, window.screen.availHeight, $(window).height()];
52    
53    width = width.filter(Number);
54    height = height.filter(Number);
55
56    var width = Math.min.apply( Math, width);
57    var height = Math.min.apply( Math, height);
58
59    /* Select a method for determining the size */
60    var size = width;
61    if (Drupal.settings.ais_method == 'both-max') {
62      size = Math.max( width, height );
63    } else if (Drupal.settings.ais_method == 'both-min') {
64      size = Math.min( width, height );
65    } else if (Drupal.settings.ais_method == 'width') {
66      size = width;
67    } else if (Drupal.settings.ais_method == 'height') {
68      size = height;
69    }
70
71    /* Match an image style and set the cookie */
72    var style = Drupal.settings.ais[0];
73    for (i in Drupal.settings.ais) {
74       if (Number(Drupal.settings.ais[i].size) < size && Number(Drupal.settings.ais[i].size) > Number(style.size)) {
75         style = Drupal.settings.ais[i];
76       }
77    }
78    if (style) {
79      document.cookie='ais='+style.name+'; path=/';
80    } else {
81      document.cookie='ais=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT';
82    }
83  }
84  $(window).resize(Drupal.behaviors.ais);
85}(jQuery));
86
87  // Call the cookie set function right away
88  Drupal.behaviors.ais();
89

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.