PageSourceSearch

https://www.veritas-english.jp/wp-content/themes/veritas/javascripts/param.js

js veritas-english.jp collected 2026-10-06 17:57:26 UTC 2,268 bytes, 79 lines download raw bytes

1  (function () {
2    //クエリ付与対象とするリンクのドメイン一覧
3    var domainsToDecorate = [
4      'veritas-english.jp',
5      'www.veritas-english.jp'
6    ],
7    //保持対象のパラメータ一覧
8      queryParams = [
9        'utm_medium',
10        'utm_source',
11        'utm_campaign',
12        'gclid'
13      ];
14
15    //ページ内のリンク(aタグ)をすべて取得
16    var links = document.querySelectorAll('a');
17
18    //ページ内のリンク毎の処理
19    for (
20      var linkIndex = 0;
21      linkIndex < links.length;
22      linkIndex++
23    ) {
24      for (
25        var domainIndex = 0;
26        domainIndex < domainsToDecorate.length;
27        domainIndex++
28      ) {
29        //ページ内のリンクが対象ドメインの場合、リンクURLを置き換え
30        if (
31          links[linkIndex].href.indexOf(
32            domainsToDecorate[domainIndex]
33          ) > -1 &&
34          links[linkIndex].href.indexOf('#') === -1
35        ) {
36          links[linkIndex].href = decorateUrl(
37            links[linkIndex].href
38          );
39        }
40      }
41    }
42
43    //ページ内のリンクURLに、現在のURLのクエリパラメータを連結
44    function decorateUrl(urlToDecorate) {
45      urlToDecorate =
46        urlToDecorate.indexOf('?') === -1
47          ? urlToDecorate + '?'
48          : urlToDecorate + '&';
49      var collectedQueryParams = [];
50      for (
51        var queryIndex = 0;
52        queryIndex < queryParams.length;
53        queryIndex++
54      ) {
55        if (getQueryParam(queryParams[queryIndex])) {
56          collectedQueryParams.push(
57            queryParams[queryIndex] +
58              '=' +
59              getQueryParam(queryParams[queryIndex])
60          );
61        }
62      }
63      //クエリパラメータがない場合はURL末尾の?を削除
64      return collectedQueryParams.length === 0
65        ? urlToDecorate.slice(0, -1)
66        : urlToDecorate +
67            collectedQueryParams.join('&');
68    }
69
70    //現在のURLのクエリパラメータを取得
71    function getQueryParam(name) {
72      if (
73        (name = new RegExp(
74          '[?&]' + encodeURIComponent(name) + '=([^&]*)'
75        ).exec(window.location.search))
76      )
77        return decodeURIComponent(name[1]);
78    }
79  })();

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.