Button 隐藏跟随按钮推特卡Blockquote
我需要使用以下命令隐藏Twitter卡上的以下按钮:Button 隐藏跟随按钮推特卡Blockquote,button,twitter,hide,Button,Twitter,Hide,我需要使用以下命令隐藏Twitter卡上的以下按钮: <blockquote width="581" height="250" class="twitter-tweet"><p></p><a href="https://twitter.com/twitterapi/status/'+tt[i][1]+'" data-datetime="2011-11-07T20:21:07+00:00"></a></blockquote>&
<blockquote width="581" height="250" class="twitter-tweet"><p></p><a href="https://twitter.com/twitterapi/status/'+tt[i][1]+'" data-datetime="2011-11-07T20:21:07+00:00"></a></blockquote></div>
如何隐藏卡上的“跟随”按钮
谢谢,twitter小部件将扩展为一个iframe,因此您必须等待它完全加载。之后,您可以完全移除按钮或将其隐藏。您将需要一点JavaScript。问题是,您必须等待它加载。我不知道如何捕捉推文完全加载的时间,所以我会每隔100毫秒检查一次按钮,直到它出现。当然,你可以根据自己的需要改变这一点 JS: 这当然现在只适用于一条推特。如果要删除多个跟随按钮,则必须稍微修改此脚本
window.setTimeout(removeButton, 100);
function removeButton() {
var iframe = document.querySelector('iframe.twitter-tweet');
if(iframe == undefined) {
window.setTimeout(removeButton, 100);
return;
}
var button = iframe.contentDocument.querySelector('.follow-button.profile');
if(button == undefined) {
window.setTimeout(removeButton, 100);
return;
}
//Hide
button.style.display = 'none';
//Or remove
button.parentNode.removeChild(button); //Note: Not using button.remove() because of compatibility
}