回答編集履歴

1

tuiki

2021/06/29 08:04

投稿

yambejp
yambejp

スコア116736

test CHANGED
@@ -25,3 +25,43 @@
25
25
  <span class="new">2021/08/01 00:00:00</span>
26
26
 
27
27
  ```
28
+
29
+ # 追記
30
+
31
+ ```javascript
32
+
33
+ <script>
34
+
35
+ window.addEventListener('DOMContentLoaded', ()=>{
36
+
37
+ setInterval((function func(){
38
+
39
+ const now=new Date();
40
+
41
+ document.querySelectorAll('.new:not([hidden])').forEach(x=>{
42
+
43
+ x.hidden=!(Date(x.textContent) && now<new Date(x.textContent));
44
+
45
+ });
46
+
47
+ return func;
48
+
49
+ })(),1000);
50
+
51
+
52
+
53
+ });
54
+
55
+ </script>
56
+
57
+ <span class="new">2021/05/01 00:00:00</span>
58
+
59
+ <span class="new">2021/06/01 00:00:00</span>
60
+
61
+ <span class="new">2021/07/01 00:00:00</span>
62
+
63
+ <span class="new">2021/08/01 00:00:00</span>
64
+
65
+ <span class="new">test</span>
66
+
67
+ ```