Skip to content

Instantly share code, notes, and snippets.

@a4lg
Last active January 6, 2017 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a4lg/2cbb5caf2153ceddca145b544ec5e9b5 to your computer and use it in GitHub Desktop.
Save a4lg/2cbb5caf2153ceddca145b544ec5e9b5 to your computer and use it in GitHub Desktop.
Greasemonkey/Tampermonkey 用ニコニコ動画プレイヤー (HTML5) のレジューム機能を無効化するスクリプト
// ==UserScript==
// @name Disable resume feature on Nicovideo HTML5 player
// @description ニコニコ動画プレイヤー (HTML5) のレジューム機能を無効化
// @namespace http://a4lg.com/
// @version 1.1
// @include http://www.nicovideo.jp/watch/*
// @author a4lg
// @license CC0
// @run-at document-start
// ==/UserScript==
var observer2 = new MutationObserver(function(event)
{
var dataElement = document.getElementById("js-initial-watch-data");
if (dataElement)
{
var data = JSON.parse(dataElement.getAttribute("data-api-data"));
data.context.initialPlaybackPosition = null;
data.context.initialPlaybackType = null;
dataElement.setAttribute("data-api-data", JSON.stringify(data));
observer2.disconnect();
}
});
var observer1 = new MutationObserver(function(event)
{
if (document.body)
{
observer1.disconnect();
observer2.observe(document.body, {childList:true});
}
});
observer1.observe(document.documentElement, {childList:true});
@a4lg
Copy link
Author

a4lg commented Jan 6, 2017

Version 1.1: Firefox で正しく動かない問題を解決

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment