Vlamtweet

Replaces the Twitter "like" button with a tiny Vlambeer logo, effects included.

< 腳本Vlamtweet的回應

評論:OK - script works, but has bugs

§
發表於:2015-11-04

Slight modification

Script wasn't working for me so I changed the target conditions. Also added a more dramatic shake for tweets with lots of faves. Changed portion below:



document.body.addEventListener("click", function(e) {
if (!e.target.classList.contains("ProfileTweet-actionButton") || !e.target.classList.contains("js-actionFavorite")) return;
var shake = Math.max(8, 2*Math.floor(Math.log2(parseInt(e.target.getElementsByClassName("IconTextContainer")[0].getElementsByClassName("ProfileTweet-actionCount")[0].getAttribute("data-tweet-stat-count")))));
var shakeScale = shake/2;

§
發表於:2015-11-04

After a little more investigation data-tweet-stat-count isn't actually populated on your first click. after you favorite and unfavorite it'll be populated when you favorite again (which I didn't realize while testing initially). Changed to:

var shake = Math.max(8, 2*Math.floor(Math.log2(parseInt(e.target.getElementsByClassName("IconTextContainer")[0].getElementsByClassName("ProfileTweet-actionCount")[0].getElementsByClassName("ProfileTweet-actionCountForPresentation")[0].textContent))));

發表回覆

登入以回復