if (typeof Nicovideo == 'undefined') {
	Nicovideo = new Object();
}
if (typeof Nicovideo.Global == 'undefined') {
	Nicovideo.Global = {
		players: {},
		playerCount: 0,
		embedMode: "noflash"
	};
	(function () {
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] === "object" && navigator.mimeTypes && navigator.mimeTypes.length) {
			Nicovideo.Global.embedMode = "embed";
		} else if (typeof ActiveXObject !== "undefined") {
			try {
				var ax = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				if (ax) {
					Nicovideo.Global.embedMode = "object";
				}
			} catch (e) {}
		}
	})();
	}

Nicovideo.version = '1.6.1';
Nicovideo.url = 'https://www.nicovideo.jp/';
Nicovideo.playerUrl = 'https://ext.nicovideo.jp/swf/player/thumbwatch.swf?ts=1556178770';

Nicovideo.Video = function (video) {
	if (video) {
		for (var key in video) {
			this[key] = video[key];
		}
	}
};
Nicovideo.Video.prototype = {
	getPlayURL: function () {
		return Nicovideo.url + 'watch/' + encodeURIComponent(this.v);
	},
	getShortTitle: function () {
		return this.title.substring(0, 60) +
			(this.title.length > 60 ? "..." : "");
	},
	getShortDescription: function () {
		return this.description.substring(0, 60) +
			(this.description.length > 60 ? "..." : "");
	}
};

Nicovideo.MiniPlayer = function (video, vars, width, height) {
	this.id          = Nicovideo.MiniPlayer.allocateId(this);
	this.video       = video;
	this.attributes  = {};
	this.parameters  = {};
	this.variables   = vars || {};
	this.listeners   = {};
	this.width = width ? width : '485';
	this.height = height ? height : '385';
	if (window.innerWidth && this.width > window.innerWidth) {
		var scale = (window.innerWidth - 20) / this.width;		if (scale > 0) {
			this.width = this.width * scale;
			this.height = this.height * scale;
		}
	}
};
Nicovideo.MiniPlayer.prototype = {
	defaultAttributes: {},
	defaultParameters: {
		allowScriptAccess: 'always',
		allowFullScreen: 'true',
		bgcolor: '#000000',
		quality: 'high'
	},

	addEventListener: function (type, listener) {
		type = String(type).toLowerCase();
		if (!this.listeners[type]) {
			this.listeners[type] = [];
		}
		this.listeners[type].push(listener);
	},
	removeEventListener: function (type, listener) {
		type = String(type).toLowerCase();
		if (this.listeners[type]) {
			var a = this.listeners[type];
			for (var i = a.length - 1; i >= 0; i--) {
				if (a[i] === listener) {
					a.splice(i, 1);
				}
			}
		}
	},
	fire: function (type, args) {
		type = String(type).toLowerCase();
		if (this.listeners[type]) {
			args = [this].concat(args || []);
			var a = this.listeners[type];
			for (var i = 0, l = a.length; i < l; i++) {
				var v = a[i];
				(typeof v == "string" ? window[v] : v).apply(window, args);
			}
		}
	},

	_merge: function () {
		var o = {};
		for (var i = 0, len = arguments.length; i < len; i++) {
			var arg = arguments[i];
			if (typeof arg != "object") continue;
			for (var key in arg) {
				o[key] = arg[key];
			}
		}
		return o;
	},
	_escape: function (s) {
		return String(s).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
	},
	getHTML: function () {
		var id = this.id,
			video = this.video,
			attrs = this._merge(this.defaultAttributes, this.attributes),
			params = this._merge(this.defaultParameters, this.parameters),
			vars = this.variables;

		var flashvars = [];
		for (var key in vars) {
			flashvars.push(key + '=' + encodeURIComponent(vars[key]));
		}
		params.flashvars = flashvars.join("&");

		var html;
		switch (Nicovideo.Global.embedMode) {
		case "embed":
			html =
				'<embed type="application/x-shockwave-flash"'
				+ ' id="' + id + '"'
				+ ' name="' + id + '"'
				+ ' src="' + Nicovideo.playerUrl + '"'
				+ ' width="' + this.width  + '"'
				+ ' height="' + this.height + '"'
				;
			for (var key in params) {
				html += ' ' + key + '="' + params[key] + '"';
			}
			for (var key in attrs) {
				html += ' ' + key + '="' + attrs[key] + '"';
			}
			html += ' />';
			break;
		case "object":
			html =
				'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
				+ ' id="' + id + '"'
				+ ' name="' + id + '"'
				+ ' width="' + this.width + '"'
				+ ' height="' + this.height + '"'
				;
			for (var key in attrs) {
				html += ' ' + key + '="' + attrs[key] + '"';
			}
	 		html += '>';
			html += '<param name="movie" value="' + Nicovideo.playerUrl + '" />';
			for (var key in params) {
				html += '<param name="' + key + '" value="' + params[key] + '" />';
			}
			html += '</object>';
			break;
		default:
			html =
				'<div style="'
						+ 'width:' + (this.width === "100%" ? this.width : this.width + "px")
						+ '; height:' + (this.height === "100%" ? this.height : this.height + "px")
						+ '; display:inline-block; background:#000; color:#FFF; margin:0; padding:0; overflow:hidden;">'
				+ '<a href="' + video.getPlayURL() + '" target="_blank" title="' + this._escape(video.title) + '"'
						+ ' style="position:relative; display:inline-block; width:100%; height:100%;">'
					+ '<img src="' + video.thumbnail + '" alt="" style="width:100%; height:100%; border:none;" />';
			if (!video.isDeleted && (this.width === "100%" || this.width >= 240) && (this.height === "100%" || this.height >= 120)) {
				html += '<span style="display:inline-block; position:absolute; left:0; top:0; width:100%; height:100%;'
							+ ' background-image: url(https://nicovideo.cdn.nimg.jp/web/img/thumb/nico/play.png); background-repeat: no-repeat; background-position: center center;"></span>';
			}
			html += '</a>'
				+ '</div>';
			break;
		}

		return html;
	},
	write: function (id) {
		if (id === undefined) {
			document.write(this.getHTML());
		} else if (typeof id == "string") {
			var el = document.all ? document.all[id] : document.getElementById(id);
			if (el) el.innerHTML = this.getHTML();
		} else if (id) {
			id.innerHTML = this.getHTML();
		}
	}
};

Nicovideo.MiniPlayer.allocateId = function (player) {
	var id = 'external_nico_' + (Nicovideo.Global.playerCount++);
	Nicovideo.Global.players[id] = player;
	return id;
};

if (document.all && !window.opera) {
	window.attachEvent("onbeforeunload", function () {
		window.attachEvent("onunload", function () {
			for (var i = 0, l = Nicovideo.Global.playerCount; i < l; i++) {
				var id = 'external_nico_' + i, el = document.all ? document.all[id] : document.getElementById(id);
				if (el && el.parentNode) {
					for (var key in el) {
						if (typeof el[key] == 'function')
							el[key] = null;
					}
					el.parentNode.removeChild(el);
				}
			}
		});
	});
}

window.onNicoPlayerReady = function (id) {
	var player = Nicovideo.Global.players[id];
	if (player) player.fire("onReady");
};
window.onNicoPlayerStatus = function (id, newStatus) {
	var player = Nicovideo.Global.players[id];
	if (player) {
		player.fire("onStateChange", [newStatus]);
		if (newStatus == "end") {
			player.fire("onVideoEnd");
		}
	}
};

(function () {

	var video = new Nicovideo.Video({
		v: '1424247729'
	,	id: 'so25605567'
	,	title: '\u3010\u96fb\u738b\u6226FINAL\u3078\u306e\u9053\u3011#52 \u6c38\u702c\u62d3\u77e2 vs Selene 30\u5206\u5207\u308c\u8ca0\u3051\u2460'
	,	description: '\u96fb\u738b\u6226\u53f2\u4e0a\u3001\u521d\u3081\u3066\u306e\u9023\u65e5\u66f4\u65b0\u30de\u30e9\u30bd\u30f3\u30fb\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\uff01 \u5c06\u68cb\u96fb\u738b\u6226FINAL\u306b\u51fa\u5834\u3059\u308b5\u4eba\u306e\u68cb\u58eb\u306e\u7d20\u9854\u3068\u6700\u5f8c\u306e\u6c7a\u6226\u3078\u306e\u65e5\u3005\u3092\u5b8c\u5168\u5bc6\u7740\u3002 \u201c\u4eba\u985e\u306e\u3001\u3051\u3058\u3081\u306e\u95d8\u3044\u3002\u201d \u524d\u56de\u306e\u52d5\u753b\u21d2watch\/1424163427\u6b21\u56de\u306e\u52d5\u753b\u21d2watch\/1424306829\u96fb\u738b\u6226FINAL\u3078\u306e\u9053\u21d2\u52d5\u753b\u4e00\u89a7---\u5c06\u68cb \u96fb\u738b\u6226FINAL\u51fa\u5834\u68cb\u58eb---\u963f\u4e45\u6d25\u4e3b\u7a0e\uff08\u3042\u304f\u3064 \u3061\u304b\u3089\uff09\u516b\u6bb5\u6751\u5c71\u6148\u660e\uff08\u3080\u3089\u3084\u307e \u3084\u3059\u3042\u304d\uff09\u4e03\u6bb5\u7a32\u8449\u967d\uff08\u3044\u306a\u3070 \u3042\u304d\u3089\uff09\u4e03\u6bb5\u6c38\u702c\u62d3\u77e2\uff08\u306a\u304c\u305b \u305f\u304f\u3084\uff09\u516d\u6bb5\u658e\u85e4\u614e\u592a\u90ce\uff08\u3055\u3044\u3068\u3046 \u3057\u3093\u305f\u308d\u3046\uff09\u4e94\u6bb5\u25c6\u7b2c1\u5c40\u25c62015\u5e743\u670814\u65e5\uff08\u571f\uff09\u658e\u85e4\u614e\u592a\u90ce\u4e94\u6bb5 vs Apery\u25c6\u7b2c2\u5c40\u25c62015\u5e743\u670821\u65e5\uff08\u571f\uff09\u6c38\u702c\u62d3\u77e2\u516d\u6bb5 vs Selene\u25c6\u7b2c3\u5c40\u25c62015\u5e743\u670828\u65e5\uff08\u571f\uff09\u7a32\u8449\u967d\u4e03\u6bb5 vs \u3084\u306d\u3046\u3089\u738b\u25c6\u7b2c4\u5c40\u25c62015\u5e744\u67084\u65e5\uff08\u571f\uff09\u6751\u5c71\u6148\u660e\u4e03\u6bb5 vs ponanza\u25c6\u7b2c5\u5c40\u25c62015\u5e744\u670811\u65e5\uff08\u571f\uff09\u963f\u4e45\u6d25\u4e3b\u7a0e\u516b\u6bb5 vs AWAKE'
	,	thumbnail: 'https:\/\/nicovideo.cdn.nimg.jp\/thumbnails\/25605567\/25605567'
	,	postedAt: new Date('2015\/02\/18 17:00:00 +0900')
	,	length: 368
	,	viewCount: 31438
	,	mylistCount: 45
	,	commentCount: 446
	,	movieType: 'mp4'
	,	isDeleted: false	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'thumbWatch': '1'
	,'thumbPlayKey': '1596372314.1.1.Apz9PfG5AzRbo82Dcvu4koL0xyg.aHR0cDovL25ld3Mubmljb3ZpZGVvLmpwL3dhdGNoL253MTUxMTc3Mw==...0'
	,'playerTimestamp': '1556178770'
	,'player_version_xml': '1560930529'
	,'player_info_xml': '1556089684'
	,'translation_version_json': ''
	,'v': '1424247729'
	,'videoId': 'so25605567'
	,'thumbTitle': '\u3010\u96fb\u738b\u6226FINAL\u3078\u306e\u9053\u3011#52 \u6c38\u702c\u62d3\u77e2 vs Selene 30\u5206\u5207\u308c\u8ca0\u3051\u2460'
	,'thumbDescription': '\u96fb\u738b\u6226\u53f2\u4e0a\u3001\u521d\u3081\u3066\u306e\u9023\u65e5\u66f4\u65b0\u30de\u30e9\u30bd\u30f3\u30fb\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\uff01 \u5c06\u68cb\u96fb\u738b\u6226FINAL\u306b\u51fa\u5834\u3059\u308b5\u4eba\u306e\u68cb\u58eb\u306e\u7d20\u9854\u3068\u6700\u5f8c\u306e\u6c7a\u6226\u3078\u306e\u65e5\u3005...'
	,'thumbTags': '\u30a8\u30f3\u30bf\u30fc\u30c6\u30a4\u30e1\u30f3\u30c8 \u5c06\u68cb \u96fb\u738b\u6226 \u96fb\u738b\u6226FINAL\u3078\u306e\u9053 \u6c38\u702c\u62d3\u77e2 Selene \u6295\u7a3f\u8005\u30b3\u30e1\u30f3\u30c8'
	,'thumbImage': 'https:\/\/nicovideo.cdn.nimg.jp\/thumbnails\/25605567\/25605567'
	,'movie_type': 'mp4'
	,'wv_id': 'so25605567'
	,'language': 'ja-jp'
	,'has_owner_thread': '1'
	,'is_community_thread': '1'
	,'isWide': '1'
	,'noAdSense': '1'
	,'category': '\u30a8\u30f3\u30bf\u30fc\u30c6\u30a4\u30e1\u30f3\u30c8'
	,'categoryGroup': '\u30a8\u30f3\u30bf\u30e1\u30fb\u97f3\u697d'
	,'leaf_switch': '1'
	,'accessFromHash': '1596285914:fd62658e7936e96e0c7e993ec0510a7bf6177ab884e21de02901ad87fbc9a5d0'
	}, '490', '307');
	player.write();
})();

