highlight subscribed members on ladder hover
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 1 May 2019 22:21:44 +0000 (00:21 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 1 May 2019 22:32:48 +0000 (00:32 +0200)
battle.css
widget.html

index 710d151d37beba5c6f685a105c1dda3f2c4bc824..bed4a6ec10fdeae1eaa815a615af9763022c2be3 100644 (file)
@@ -2,8 +2,6 @@ body {
        background: #000D1A;
        color: #CCE6FF;
        font: 24px Source Sans Pro, Arial, sans-serif;
-}
-body {
        margin-top: 1ex;
 }
 
@@ -31,10 +29,16 @@ strong {
        letter-spacing: .05em;
        text-shadow: 0 2px 4px rgba(0, 0, 0, .8), 0 8px 16px rgba(0, 0, 0, .6);
 }
-h2,
 a {
-       color: #CCE6FF;
+       color: inherit;
        text-decoration: none;
+       transition: all .5s;
+}
+a:hover {
+       color: #FFF;
+}
+a:hover img {
+       border-color: #FFF;
 }
 em {
        color: #A3B8CC;
@@ -69,6 +73,23 @@ img {
        background: #021120;
 }
 
+li, li img {
+       transition: all 1s;
+}
+.select > li {
+       opacity: .5;
+}
+.select > li.select {
+       opacity: 1;
+}
+.select > .select img {
+       border-color: #055CB3;
+}
+.ladders li:hover {
+       background: #0C2643;
+       cursor: help;
+}
+
 .rank:before {
        background: url("https://static.starcraft2.com/dist/images/none.c8b435f5900fab1ac7981cc9b56f6f44.png") no-repeat;
        background-position: -100px 0;
index 19e7fe3266a8978f9301a09875a43d81b44c162e..a9d615fa5f7cbaa418673229cda27ccdc8df3210 100644 (file)
                        `).join('')}
                        </ul>
                `
+
+               let i = 0
+               document.querySelectorAll('.ladders li').forEach(ladder => {
+                       let laddermembers = clan.ladders[i++].members
+                       let membercont = document.querySelector('.members')
+                       ladder.onmouseover = e => {
+                               membercont.classList.add('select')
+                               laddermembers.forEach(member => {
+                                       membercont.children[member].classList.add('select')
+                               })
+                       }
+                       ladder.onmouseout = e => {
+                               membercont.classList.remove('select')
+                               laddermembers.forEach(member => {
+                                       membercont.children[member].classList.remove('select')
+                               })
+                       }
+               })
        })
        .catch(error => console.log(error))
 </script>