Skip to content

Instantly share code, notes, and snippets.

@superswanman
Created December 11, 2018 18:16
Show Gist options
  • Save superswanman/ea248f7e0d2900d7db37476b1c924b7f to your computer and use it in GitHub Desktop.
Save superswanman/ea248f7e0d2900d7db37476b1c924b7f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name モーメントの編集で一番上に移動するボタンを追加するやつ
// @namespace http://lyna.space/
// @version 0.1
// @description Twitterのモーメント編集画面に「ツイートを一番上に移動するボタン(⏫)」を追加します。
// @author Lyna
// @match https://twitter.com/i/moments/edit/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var addButton = function(button) {
if (button == null) return;
var buttonTop = document.createElement("button");
buttonTop.type = 'button';
buttonTop.textContent = '⏫';
buttonTop.onclick = function(e) {
for (var i = 0; i < 100; i++) button.click();
};
button.parentElement.insertBefore(buttonTop, button);
};
document.querySelectorAll('.MomentCapsuleItem').forEach(function(element) {
addButton(element.querySelector('.MomentMakerActionButtons-button--up'));
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment