Noobroom Bookmarker

Lets you save videos for easy viewing later and adds the video name in the title

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        Noobroom Bookmarker
// @namespace   Kon
// @description Lets you save videos for easy viewing later and adds the video name in the title
// @include     http://noobroom7.com/*
// @include     http://noobroom5.com/*
// @version     1.1
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_getResourceURL
// @resource StarOn16 http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/16/Actions-rating-icon.png
// @resource StarOff16 http://icons.iconarchive.com/icons/icojam/onebit/16/star-0-icon.png
// ==/UserScript==
var $ = unsafeWindow.jQuery;
function gmGet(name, def){
	var theValue = GM_getValue(name, def);
	return theValue;
}
function gmSet(name, valuee){
	GM_setValue(name, valuee);
}
var videos = JSON.parse(GM_getValue("videos", '{"videos":[]}'));
var video_id = $("form#subform").attr("action").split("?")[1];
var video_name_div = $("div[style='position:absolute; left:20px; bottom:6px']");
video_name_div.text($.trim(video_name_div.text()));
var video_name = video_name_div.text();

//Add movie name to title
document.title = "Noobroom - "+video_name;

//Change favicon
var link = document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'http://107.6.170.83/~nooboard/2img/'+video_id+'.jpg';
document.getElementsByTagName('head')[0].appendChild(link);

var is_watch_later = isWatchLater(video_id);
if(is_watch_later == -1){
	video_name_div.prepend('<img id="watch_later" src="'+GM_getResourceURL("StarOff16")+'" style="cursor: pointer"/>');
}else{
	video_name_div.prepend('<img id="watch_later" src="'+GM_getResourceURL("StarOn16")+'" style="cursor: pointer"/>');
}
var right_area = $("td[style='width:50%; border-left: 0px solid #ffffff']").css("vertical-align","top");;
right_area.prepend('<div id="saved_videos" style="border-bottom: 1px solid #fff;border-right: 1px solid #fff;background-color:#000;overflow:hidden;min-height:600px;color:#FF7142;text-align:center;"><u>Watch Later</u><br/></div>');
var saved_videos = $("div#saved_videos");
var count = videos.videos.length;
if(count == 0){
	saved_videos.append('<br/>None!<br/>Click the star next to a video\'s name');
}
for(var i = 0; i < count; i++){
	saved_videos.append('<a href="/?'+videos.videos[i].id+'" style="color:#FFFFFF;text-decoration:none;">'+videos.videos[i].name+'</a><br/>');
}
$("img#watch_later").click(function(){
	setTimeout(function(){
		videos = JSON.parse(GM_getValue("videos", '{"videos":[]}'));
		count = videos.videos.length;
		if(is_watch_later == -1){
			videos.videos[count] = {};
			videos.videos[count].id = video_id;
			videos.videos[count].name = video_name;
			setTimeout(function(){$("img#watch_later").attr("src", GM_getResourceURL("StarOn16"))},0);
		}else{
			videos.videos.splice(is_watch_later,1);
			setTimeout(function(){$("img#watch_later").attr("src", GM_getResourceURL("StarOff16"))},0);
		}
		is_watch_later = isWatchLater(video_id);
		var serialized_videos = JSON.stringify(videos);
		setTimeout(function(){GM_setValue("videos", serialized_videos)},0);
	},0);
});
function isWatchLater(id){
	var count = videos.videos.length;
	for(var i = 0; i < count; i++){
		if(id == parseInt(videos.videos[i].id)) return i;
	}
	return -1;
}