Skip to content

Instantly share code, notes, and snippets.

@ryonakae
Last active June 2, 2023 05:12
Show Gist options
  • Save ryonakae/5af02f45e50be8e4e90e137132784492 to your computer and use it in GitHub Desktop.
Save ryonakae/5af02f45e50be8e4e90e137132784492 to your computer and use it in GitHub Desktop.
Twitterの興味関心 (https://twitter.com/settings/your_twitter_data/twitter_interests) のチェックをすべて外すブックマークレット
javascript:(function(){var%20href_pc="https://twitter.com/settings/your_twitter_data/twitter_interests";var%20href_mobile="https://mobile.twitter.com/settings/your_twitter_data/twitter_interests";if(location.href!==href_pc&&location.href!==href_mobile){return%20location.href=href_pc;}var%20inputArray=[];var%20timer=0;var%20count=0;document.querySelector("main").querySelectorAll('input[type="checkbox"][checked]').forEach(function(input){inputArray.push(input);});window.addEventListener("error",function(error){clearInterval(timer);alert("エラーが発生したため中断しました");});timer=setInterval(function(){var%20input=inputArray[count];var%20label=input.closest("label");var%20offsetTop=input.getBoundingClientRect().top+window.scrollY-100;window.scrollTo(0,offsetTop);label.dispatchEvent(new%20MouseEvent("click"));count++;if(count===inputArray.length){clearInterval(timer);alert("すべてのチェックを外しました");}},3000);})();
javascript:(function () {
var href_pc = "https://twitter.com/settings/your_twitter_data/twitter_interests";
var href_mobile = "https://mobile.twitter.com/settings/your_twitter_data/twitter_interests";
if (location.href !== href_pc && location.href !== href_mobile) {
return location.href = href_pc;
}
var inputArray = [];
var timer = 0;
var count = 0;
document
.querySelector("main")
.querySelectorAll('input[type="checkbox"][checked]')
.forEach(function (input) {
inputArray.push(input);
});
window.addEventListener("error", function (error) {
clearInterval(timer);
alert("エラーが発生したため中断しました");
});
timer = setInterval(function () {
var input = inputArray[count];
var label = input.closest("label");
var offsetTop = input.getBoundingClientRect().top + window.scrollY - 100;
window.scrollTo(0, offsetTop);
label.dispatchEvent(new MouseEvent("click"));
count++;
if (count === inputArray.length) {
clearInterval(timer);
alert("すべてのチェックを外しました");
}
}, 3000);
})();
@ryonakae
Copy link
Author

setIntervalの間隔を100msから1000msに変更

@ryonakae
Copy link
Author

ブックマークレット変換サービス: http://websitetools.biz-box.jp/js_bookmarklet.php

@ryonakae
Copy link
Author

興味関心ページ以外のURLでブックマークレットを実行した場合、興味関心ページにリダイレクトするようにアップデート

@ryonakae
Copy link
Author

チェックする間隔が1秒でもすぐAPI制限がかかるので、3秒にアップデート

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment