1300

移行用のテストです

Youtubeで現在再生中の動画を終了させるボタン設置

// ==UserScript==
// @name         youtube_skip_button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.youtube.com/watch?v=*
// @grant        none
// ==/UserScript==
var result = document.evaluate('id("head")/div[@id="upnext"]', document, null, 7, null);
result.snapshotItem(0).insertAdjacentHTML("afterend", "<a href='javascript:void(0);'><img src='https://cdn-ak.f.st-hatena.com/images/fotolife/j/jigendaddy/20181027/20181027181215.png'></a>");
var result2 = document.evaluate('id("head")/div[@id="upnext"]/following-sibling::a[1]', document, null, 7, null);
result2.snapshotItem(0).addEventListener('click', sample, false);

function sample() {
  var result3 = document.evaluate('//video', document, null, 7, null);
  result3.snapshotItem(0).currentTime = result3.snapshotItem(0).duration;
}