Last active
June 2, 2023 05:12
-
-
Save ryonakae/5af02f45e50be8e4e90e137132784492 to your computer and use it in GitHub Desktop.
Twitterの興味関心 (https://twitter.com/settings/your_twitter_data/twitter_interests) のチェックをすべて外すブックマークレット
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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);})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
})(); |
ブックマークレット変換サービス: http://websitetools.biz-box.jp/js_bookmarklet.php
興味関心ページ以外のURLでブックマークレットを実行した場合、興味関心ページにリダイレクトするようにアップデート
チェックする間隔が1秒でもすぐAPI制限がかかるので、3秒にアップデート
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
setInterval
の間隔を100msから1000msに変更