微件:B站用户:修订间差异
来自植物大战僵尸杂交版Wiki
更多操作
无编辑摘要 |
无编辑摘要 |
||
| (未显示同一用户的1个中间版本) | |||
| 第48行: | 第48行: | ||
white-space: nowrap; | white-space: nowrap; | ||
flex-shrink: 0; | flex-shrink: 0; | ||
border: none; | |||
cursor: pointer; | cursor: pointer; | ||
transition: all 0.2s; | |||
} | } | ||
.bili-card-btn:hover { background: #0091c2; } | .bili-card-btn:hover { background: #0091c2; } | ||
.bili-card-btn.followed { background: #f0f0f0; color: #999; pointer-events: none; } | .bili-card-btn.followed { | ||
background: #f0f0f0; | |||
color: #999; | |||
pointer-events: none; | |||
} | |||
</style> | </style> | ||
| 第66行: | 第71行: | ||
<div class="bili-card-desc"><!--{$desc|escape:'html'}--></div> | <div class="bili-card-desc"><!--{$desc|escape:'html'}--></div> | ||
</div> | </div> | ||
< | <button class="bili-card-btn" id="bili-btn-<!--{$uid|escape:'html'}-->" | ||
onclick="followUser('<!--{$uid|escape:'html'}-->', this)"> | |||
+关注 | |||
</button> | |||
</ | |||
</div> | </div> | ||
<script> | <script> | ||
function followUser(uid, btn) { | |||
btn.textContent = '已关注'; | |||
btn.classList.add('followed'); | |||
localStorage.setItem('bili_followed_' + uid, 'true'); | |||
} | |||
(function() { | (function() { | ||
var uid = '<!--{$uid|escape:'html'}-->'; | var uid = '<!--{$uid|escape:'html'}-->'; | ||
| 第78行: | 第88行: | ||
if (localStorage.getItem('bili_followed_' + uid) === 'true') { | if (localStorage.getItem('bili_followed_' + uid) === 'true') { | ||
var btn = document.getElementById('bili-btn-' + uid); | var btn = document.getElementById('bili-btn-' + uid); | ||
if (btn) { btn.textContent = '已关注'; btn.classList.add('followed'); } | if (btn) { | ||
btn.textContent = '已关注'; | |||
btn.classList.add('followed'); | |||
} | |||
} | } | ||
})(); | })(); | ||