PageSourceSearch

https://www.marklines.com/assets/javascripts/commons/utils.js

js marklines.com collected 2026-10-02 04:05:18 UTC 3,022 bytes, 108 lines download raw bytes

1(function() {
2  if (!("indexOf" in Array.prototype)) {
3    Array.prototype.indexOf = function(find, i) {
4      var n;
5      if (i === undefined) i = 0;
6      if (i < 0) i += this.length;
7      if (i < 0) i = 0;
8      n = this.length;
9      while (i < n) {
10        if (i in this && this[i] === find) return i;
11        i++;
12      }
13      return -1;
14    };
15  }
16
17  if (!Array.prototype.find) {
18    Array.prototype.find = function(predicate) {
19      if (this === null) {
20        throw new TypeError('Array.prototype.find called on null or undefined');
21      }
22      if (typeof predicate !== 'function') {
23        throw new TypeError('predicate must be a function');
24      }
25      var list = Object(this);
26      var length = list.length >>> 0;
27      var thisArg = arguments[1];
28      var value;
29
30      for (var i = 0; i < length; i++) {
31        value = list[i];
32        if (predicate.call(thisArg, value, i, list)) {
33          return value;
34        }
35      }
36      return undefined;
37    };
38  }
39
40  if(!String.prototype.trim) {
41    String.prototype.trim = function () {
42      return this.replace(/^\s+|\s+$/g,'');
43    };
44  }
45
46  if (!String.prototype.startsWith) {
47    String.prototype.startsWith = function(searchString, position){
48      position = position || 0;
49      return this.substr(position, searchString.length) === searchString;
50    };
51  }
52
53  window.utils = window.utils || {};
54  window.utils.getUrlVars = function() {
55    var h, hash, hashes, i, len, v;
56    v = [];
57    hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
58    for (i = 0, len = hashes.length; i < len; i++) {
59      hash = hashes[i];
60      h = hash.split('=');
61      v.push(h[0]);
62      v[h[0]] = h[1];
63    }
64    return v;
65  };
66
67  window.utils.isIE = function() {
68    var userAgent = window.navigator.userAgent.toLowerCase();
69    return userAgent.indexOf("msie") != -1;
70  };
71
72  window.utils.isIE11 = function() {
73    var userAgent = window.navigator.userAgent.toLowerCase();
74    return userAgent.indexOf("trident/7.0") != -1;
75  };
76
77  window.utils.isOldIE = function() {
78    if (window.utils.isIE()) {
79      var appVersion = window.navigator.userAgent.toLowerCase();
80      return appVersion.indexOf("msie 9.") != -1 ||
81         appVersion.indexOf("msie 8.") != -1 ||
82         appVersion.indexOf("msie 7.") != -1 ||
83         appVersion.indexOf("msie 6.") != -1;
84    } else {
85      return false;
86    }
87  };
88
89  if (window.utils.isOldIE()) {
90    $(document).ready(function(){
91      function setToolTip(obj) {
92        var appVersion = window.navigator.userAgent.toLowerCase();
93        var message = obj.attr('data-tooltip');
94        if(obj[0] !== undefined) {
95            obj[0].setAttribute('data-toggle', 'tooltip');
96            obj[0].setAttribute('data-placement', 'bottom');
97            obj[0].setAttribute('title', message);
98            obj.tooltip();
99        }
100      }
101
102      // ツールチップ有効
103      setToolTip($('#__search_input'));
104      setToolTip($('#_full_text_search_text'));
105    });
106  }
107
108}).call(this);

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.