Skip to content

Instantly share code, notes, and snippets.

@hrdtbs
Last active March 16, 2018 12:48
Show Gist options
  • Save hrdtbs/24b818cb93fb6b7d97ace779062e6ce9 to your computer and use it in GitHub Desktop.
Save hrdtbs/24b818cb93fb6b7d97ace779062e6ce9 to your computer and use it in GitHub Desktop.
これはだめだ
src = "https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js";
sc = document.createElement("script");
sc.type = "text/javascript";
sc.src = src;
document.body.appendChild(sc);
var tweetText = $(".js-tweet-text.tweet-text:contains('誰か')")
var tweet = tweetText.parents('li')
var tweetLike = tweet.find(".js-actionButton.js-actionFavorite");
tweetLike.click(function (event) {
if (!$(this).hasClass("aaaaaaaaaaa")) {
$this = $(this);
$this.addClass("aaaaaaaaaaa")
$this.removeClass("js-actionFavorite")
$this.attr("disabled", true)
var selectedTweet = $(this).parents("li");
var clone1 = selectedTweet.clone(true)
var clone2 = selectedTweet.clone(true)
clone1.find(".content").empty()
clone2.find(".content").empty()
clone1.children("div").append(`
<p style="padding: .5em 0;">
このツイートはお前宛てではありませし、<br/>
お前とは絶対にIDを交換しません。それでもよろしいですか?
</p>
<div style="float:right;padding: .5em 0;">
<button id="cancel" class="UserActions-editButton edit-button EdgeButton EdgeButton--tertiary">キャンセル</button>
<button id="allow" style="color: white;background-color:rgb(224, 36, 94);border-color:rgb(224, 36, 94);"class="UserActions-editButton edit-button EdgeButton EdgeButton--tertiary">それでもいいねする</button>
</div>
`)
clone2.children("div").append(`
<p class="fullname ProfileNameTruncated-link u-textInheritColor">
このツイートの「誰か」にお前は含まれていません。
</p>
`)
clone2.children("div").css({
minHeight: 20,
textAlign: 'center'
})
clone1.insertAfter(selectedTweet);
clone2.insertBefore(selectedTweet);
clone1.find("#allow").click(function () {
clone1.remove();
clone2.remove();
$this.addClass("js-actionFavorite")
$this.attr("disabled", false)
$this.click()
$this.removeClass("aaaaaaaaaaa")
})
clone1.find("#cancel").click(function () {
clone1.remove();
clone2.remove();
$this.addClass("js-actionFavorite")
$this.attr("disabled", false)
$this.removeClass("aaaaaaaaaaa")
})
return false;
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment