Skip to content

Instantly share code, notes, and snippets.

@OskarKlintrot
Last active March 13, 2018 12:02
Show Gist options
  • Save OskarKlintrot/4684c640abcfa497f85dc7e6655c541c to your computer and use it in GitHub Desktop.
Save OskarKlintrot/4684c640abcfa497f85dc7e6655c541c to your computer and use it in GitHub Desktop.
Twitter extension
https://api.twitter.com/1.1/users/report_spam.json?screen_name=rabish2&perform_block=true
var template = username => `<span>
<button type="button" class="
EdgeButton
EdgeButton--danger
EdgeButton--small
button-text
follow-text" onclick="jQuery.post('https://api.twitter.com/1.1/users/report_spam.json?screen_name=${username}&amp;perform_block=true')">
<span aria-hidden="true">Spam</span>
<span class="u-hiddenVisually">Report <span class="username u-dir u-textTruncate" dir="ltr">@<b>${username}</b></span></span>
</button>
</span>`
$('.GridTimeline-items')
.find('.user-actions')
.each(function(index, element) {
$(template($(element).data('screen-name'))).insertAfter($(element).find('.user-actions-follow-button'))
}
)
<span>
<button type="button" class="
EdgeButton
EdgeButton--danger
EdgeButton--small
button-text
follow-text" onclick="jQuery.post('https://api.twitter.com/1.1/users/report_spam.json?screen_name=rabish2&amp;perform_block=true')">
<span aria-hidden="true">Spam</span>
<span class="u-hiddenVisually">Report <span class="username u-dir u-textTruncate" dir="ltr">@<b>rabish2</b></span></span>
</button>
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment