-
Notifications
You must be signed in to change notification settings - Fork 1
/
hololive_shop_item_quantity.user.js
68 lines (60 loc) · 1.51 KB
/
hololive_shop_item_quantity.user.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// ==UserScript==
// @name Hololive shop display item quantity
// @version 1.0.0
// @include https://shop.hololivepro.com/*
// @run-at document-end
// @grant GM_addStyle
// @noframes
// ==/UserScript==
'use strict';
const items = document.querySelectorAll("[data-quantity]");
items.forEach((item) => {
const quantity = item.dataset.quantity;
const tooltip = `在庫: ${quantity}`;
const parent = item.parentElement;
if (parent) {
parent.classList.add("shiaupiau_tooltip");
parent.insertAdjacentHTML("beforeend", `<span class="shiaupiau_tooltiptext">${tooltip}</span>`);
}
});
GM_addStyle(`
/* Tooltip container */
.shiaupiau_tooltip {
position: relative;
}
/* Tooltip text */
.shiaupiau_tooltip .shiaupiau_tooltiptext {
visibility: hidden;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text */
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -60px;
/* Fade in tooltip */
opacity: 0;
transition: opacity 0.3s;
}
/* Tooltip arrow */
.shiaupiau_tooltip .shiaupiau_tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
/* Show the tooltip text when you mouse over the tooltip container */
.shiaupiau_tooltip:hover .shiaupiau_tooltiptext {
visibility: visible;
opacity: 1;
}
`);