-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.js
executable file
·35 lines (35 loc) · 1.47 KB
/
display.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Display Status
var Display = (function () {
return {
add_select: (domid, text, value) => {
let option = document.createElement("option");
option.text = text;
option.value = value;
document.getElementById(domid).appendChild(option);
},
clear_select: (domid) => {
$('#' + domid + ' option').remove();
$('#' + domid).append($('<option>').html("---").val("-"));
},// アニメーションしながら「並び替え・絞り込み」(Filter)へ移動
ScrollTop: function () {
let begin = new Date() - 0;
let prev = 0;
let term = 200;
let x = document.documentElement.scrollLeft || document.body.scrollLeft;
let y = ((document.documentElement.scrollTop || document.body.scrollTop) * -1);
let id = setInterval(() => {
let current = new Date() - begin;
if (current > term) {
clearInterval(id);
current = term;
let keyfld = document.getElementById("keywords");
keyfld.focus();
keyfld.setSelectionRange(keyfld.value.length, keyfld.value.length);
}
let diff = current - prev;
prev = current;
window.scrollBy((diff / term) * x, (diff / term) * y);
}, 10);
}
};
})();