PageSourceSearch

https://www.joyobank.co.jp/js/base.dev.js

js joyobank.co.jp collected 2026-09-24 09:27:16 UTC 7,325 bytes, 266 lines download raw bytes

1"use strict";
2
3/* eslint-disable no-undef */
4
5/* eslint-disable no-unused-vars */
6
7/* eslint-disable func-names */
8
9/* eslint-disable prefer-arrow-callback */
10var baseFn = function () {
11  function scrollTo(ele) {
12    var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
13    var speed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 300;
14
15    if (!ele) {
16      $('html,body').animate({
17        scrollTop: 0
18      }, speed);
19    } else if (ele.length > 0) {
20      $('html,body').animate({
21        scrollTop: $(ele).offset().top + offset
22      }, speed);
23    }
24
25    return false;
26  }
27
28  function accordion($tab, $body, pattern, cb) {
29    var tab = typeof $tab === 'string' ? $($tab) : $tab;
30    $($tab).click(function () {
31      var $this = $(this);
32      $this.next($body).slideToggle('fast', function () {
33        if (cb) cb();
34      });
35      $this.toggleClass('open');
36      if (pattern) $($tab).not(this).removeClass('open');
37    });
38  }
39
40  function tabChange(tab, body, action, cb) {
41    $(tab).each(function (i, k) {
42      k.addEventListener(action, function () {
43        if (action === 'click') {
44          $(tab).removeClass('active');
45          $(this).addClass('active');
46        }
47
48        $(body).removeClass('active').eq(i).addClass('active');
49        if (cb) cb();
50      });
51    });
52  }
53
54  function request(url, o) {
55    var options = $.extend({
56      type: 'GET',
57      dataType: 'json'
58    }, o);
59    return $.ajax(url, options);
60  }
61
62  function getParamFromUrl(paramsStr, name) {
63    var query = paramsStr.substring(1);
64    var vars = query.split('&');
65
66    for (var i = 0; i < vars.length; i += 1) {
67      var pair = vars[i].split('=');
68
69      if (pair[0] === name) {
70        return pair[1];
71      }
72    }
73
74    return false;
75  }
76
77  function addFigure(str) {
78    if (typeof str !== 'string') str = str.toString();
79    var num = str.replace(/,/g, '');
80
81    while (num !== (num = num.replace(/^(-?\d+)(\d{3})/, '$1,$2'))) {
82      ;
83    }
84
85    return num;
86  }
87
88  function bubbleSort(arr, attr, order) {
89    var len = arr.length;
90    var temp = null;
91
92    for (var i = 0; i < len - 1; i++) {
93      for (var j = 0; j < len - 1 - i; j++) {
94        if (isNaN(arr[j][attr]) === false) {
95          arr[j][attr] = Number(arr[j][attr]);
96        }
97
98        if (isNaN(arr[j + 1][attr]) === false) {
99          arr[j + 1][attr] = Number(arr[j + 1][attr]);
100        }
101
102        if (arr[j][attr] === '-') {
103          arr[j][attr] = 0;
104          arr[j].temp = '-';
105        }
106
107        if (arr[j + 1][attr] === '-') {
108          arr[j + 1][attr] = 0;
109          arr[j + 1].temp = '-';
110        }
111
112        if (order) {
113          if (arr[j][attr] < arr[j + 1][attr]) {
114            temp = arr[j]; // 要素交换
115
116            arr[j] = arr[j + 1];
117            arr[j + 1] = temp;
118          }
119        } else if (arr[j][attr] > arr[j + 1][attr]) {
120          temp = arr[j]; // 要素交换
121
122          arr[j] = arr[j + 1];
123          arr[j + 1] = temp;
124        }
125
126        if (arr[j].temp) arr[j][attr] = '-';
127        if (arr[j + 1].temp) arr[j + 1][attr] = '-';
128      }
129    }
130
131    return arr;
132  }
133
134  function convertFundCategory(cate) {
135    var cat = '';
136
137    switch (cate) {
138      case '国内債券型':
139        cat = 'fund-tag -domestic-bonds';
140        break;
141
142      case '海外債券型':
143        cat = 'fund-tag -international-bonds';
144        break;
145
146      case '世界債券型':
147        cat = 'fund-tag -international-bonds';
148        break;
149
150      case 'バランス型':
151        cat = 'fund-tag -domestic-balance';
152        break;
153
154      case '不動産型':
155        cat = 'fund-tag -domestic-trusts';
156        break;
157
158      case '国内株式型':
159        cat = 'fund-tag -domestic-stocks';
160        break;
161
162      case '海外株式型':
163        cat = 'fund-tag -international-stocks';
164        break;
165
166      case '世界株式型':
167        cat = 'fund-tag -international-stocks';
168        break;
169
170      default:
171        cat = '';
172        break;
173    }
174
175    return cat;
176  }
177
178  function popup() {
179    var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
180    var _obj$title = obj.title,
181        title = _obj$title === void 0 ? '' : _obj$title,
182        _obj$content = obj.content,
183        content = _obj$content === void 0 ? '' : _obj$content,
184        _this = obj._this;
185    var docWidth = window.innerWidth;
186    var existPopUpBox = document.getElementsByClassName('popupbox');
187
188    if (!existPopUpBox.length) {
189      var popBox = document.createElement('div');
190      var popBoxClose = document.createElement('div');
191      var popContentDiv = document.createElement('div');
192
193      if (title) {
194        var popTitleDiv = document.createElement('div');
195        popTitleDiv.innerText = "\u3010".concat(title, "\u3011");
196        popTitleDiv.className = 'popupbox-title';
197        popBox.appendChild(popTitleDiv);
198      }
199
200      popBox.className = 'popupbox';
201      popBoxClose.className = 'popupbox-close J_popupClose';
202      popContentDiv.className = 'popupbox-content';
203      popContentDiv.innerHTML = content; // popBoxClose.setAttribute('href', 'javascript:;');
204
205      popBoxClose.innerText = '閉じる';
206      popBox.appendChild(popContentDiv);
207      popBox.appendChild(popBoxClose);
208
209      _this.appendChild(popBox);
210    }
211
212    var leftAdjust1 = '182';
213    var leftAdjust2 = '181';
214
215    if (document.getElementsByClassName('popupstyle').length === 0) {
216      $("<style class=\"popupstyle\">\n      .popupbox::before{left: ".concat(leftAdjust1, "px}\n      .popupbox::after{left: ").concat(leftAdjust2, "px}\n      </style>")).appendTo('head');
217    }
218
219    var $existPopUpBox = $(existPopUpBox[0]);
220    var boxRight = existPopUpBox[0].getBoundingClientRect().right;
221    var positionLeft = $existPopUpBox.position().left;
222
223    if ($existPopUpBox.offset().left < 0) {
224      var leftOffset = $existPopUpBox.offset().left - 20;
225      $existPopUpBox.css('left', positionLeft - leftOffset);
226
227      var _leftAdjust = 182 + leftOffset;
228
229      var _leftAdjust2 = 181 + leftOffset;
230
231      $('head').find('.popupstyle').remove();
232      $("<style class=\"popupstyle\">\n        .popupbox::before{left: ".concat(_leftAdjust, "px}\n        .popupbox::after{left: ").concat(_leftAdjust2, "px}\n        </style>")).appendTo('head');
233    } else if (boxRight > docWidth) {
234      var positionDiff = docWidth - boxRight - 20;
235      $existPopUpBox.css('left', positionLeft + positionDiff);
236
237      var _leftAdjust3 = 182 - positionDiff;
238
239      var _leftAdjust4 = 181 - positionDiff;
240
241      $('head').find('.popupstyle').remove();
242      $("<style class=\"popupstyle\">\n        .popupbox::before{left: ".concat(_leftAdjust3, "px}\n        .popupbox::after{left: ").concat(_leftAdjust4, "px}\n        </style>")).appendTo('head');
243    }
244  }
245
246  function closePopUp() {
247    var closeBtn = document.getElementsByClassName('J_popupClose')[0];
248    $(closeBtn).on('click', function () {
249      $(this).parent().remove();
250      $('head').find('.popupstyle').remove();
251    });
252  }
253
254  return {
255    scrollTo: scrollTo,
256    accordion: accordion,
257    tabChange: tabChange,
258    request: request,
259    getParamFromUrl: getParamFromUrl,
260    addFigure: addFigure,
261    bubbleSort: bubbleSort,
262    convertFundCategory: convertFundCategory,
263    popup: popup,
264    closePopUp: closePopUp
265  };
266}();

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.