PageSourceSearch

https://www.mda.org/sites/default/files/js/js_48GWnBpT6pqtmGHwnmM0xz1CisoOpTPr0HJSjRwSiU8.js

js mda.org collected 2026-09-24 08:38:35 UTC 2,040 bytes, 71 lines download raw bytes

1(function(){
2  function sortDrupalBehaviors() {
3    var weights = {};
4    for (var k in Drupal.behaviors) {
5      var v = Drupal.behaviors[k];
6      var pieces = k.split('.');
7      if (pieces.length == 2 && pieces[1] === 'weight') {
8        // This v is not a behavior, but a weight setting for another behavior.
9        weights[pieces[0]] = v;
10        delete Drupal.behaviors[k];
11      }
12      else if (typeof weights[k] != 'number') {
13        // This v is a behavior object, but it might contain a weight setting.
14        if (typeof v == 'object' && v && typeof v.weight == 'number') {
15          weights[k] = v.weight;
16        }
17        else if (weights[k] == undefined) {
18          weights[k] = false;
19        }
20      }
21    }
22
23    var ww = [0];
24    var by_weight = {0: {}};
25    for (var k in weights) {
26      if (Drupal.behaviors[k] == undefined) {
27        continue;
28      }
29      var w = weights[k];
30      w = (typeof w == 'number') ? w : 0;
31      if (by_weight[w] == undefined) {
32        by_weight[w] = {};
33        ww.push(w);
34      }
35      by_weight[w][k] = Drupal.behaviors[k];
36    }
37    ww.sort(function(a,b){return a - b;});
38
39    // Other scripts that want to mess with behaviors, will only see those with weight = 0.
40    Drupal.behaviors = by_weight[0];
41
42    var sorted = [];
43    for (var i = 0; i < ww.length; ++i) {
44      var w = ww[i];
45      sorted.push(by_weight[w]);
46    }
47    return sorted;
48  }
49
50  var attachBehaviors_original = Drupal.attachBehaviors;
51
52  Drupal.attachBehaviors = function(context, settings) {
53    var sorted = sortDrupalBehaviors();
54    Drupal.attachBehaviors = function(context, settings) {
55      context = context || document;
56      settings = settings || Drupal.settings;
57      // Execute all of them.
58      for (var i = 0; i < sorted.length; ++i) {
59        jQuery.each(sorted[i], function() {
60          if (typeof this.attach == 'function') {
61            this.attach(context, settings);
62          }
63        });
64      }
65    }
66    Drupal.attachBehaviors.apply(this, [context, settings]);
67  };
68
69})();
70
71;

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.