(function() {
'use strict';
$(document).on('mouseenter', function(e) {
$('.ytp-right-controls').prepend($('.ytp-watch-later-button'));
});
})();
(function() {
'use strict';
const period = 190;
const classNamesByKeyCode = {};
classNamesByKeyCode["H".charCodeAt(0)] = ["ytp-watch-later-button"];
classNamesByKeyCode["N".charCodeAt(0)] = ["ytp-next-button"];
classNamesByKeyCode["O".charCodeAt(0)] = ["ytp-fullscreen-button"];
classNamesByKeyCode["P".charCodeAt(0)] = ["ytp-prev-button"];
classNamesByKeyCode[period] = ["close-button", "videoAdUiSkipButton"];
const $buttonsByKeyCode = (keyCode) => {
const classNames = classNamesByKeyCode[keyCode];
if (!classNames) { return []; }
return classNames
.map((className) => $("." + className)[0])
.filter(($buttons) => $buttons);
};
$(document).on('keydown', function(e) {
if (e.target.tagName === "INPUT") { return; }
const $buttons = $buttonsByKeyCode(e.which);
$buttons.forEach((button) => button.click());
});
})();
(function() {
'use strict';
const $linkToSearchByVideoId = (videoId) => {
const query = 'v=' + videoId;
const url = 'https://www.google.co.jp/search?q=' + encodeURIComponent(query);
const $link = $('<a target="_blank" href="' + url + '">' + query + '</a>');
$link.css({
'display': 'inline-block',
'margin-left': '10px'
});
return $link;
};
const addSearchLink = function(elem){
const videoId = elem.dataset.videoId;
const $link = $linkToSearchByVideoId(videoId);
$(elem).find('.pl-video-title-link').after($link);
};
const isDeletedVideo = (elem) => {
const titles = [
"[動画は削除されました]",
"[非公開動画]"
];
return titles.indexOf(elem.dataset.title) != -1;
};
const clearVideoTitle = (elem) => {
elem.dataset.title = '';
};
$(document).on('mouseenter', '.pl-video', (e) => {
const videoItem = e.currentTarget;
if (!isDeletedVideo(videoItem)) return;
addSearchLink(videoItem);
clearVideoTitle(videoItem);
});
})();
(function() {
'use strict';
let url = window.location.href;
let rep = url.replace('nicovideo.jp', 'nicozon.net');
let link = $('<h2><a href="' + rep + '">zon</a></h2>');
$('.VideoTitle').after(link);
})();
(function() {
'use strict';
window.confirm = function(){ return true; };
})();
userscripts gist..