if (typeof Nicovideo == 'undefined') {
	Nicovideo = new Object();
}
if (typeof Nicovideo.Global == 'undefined') {
	Nicovideo.Global = {
		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 = 'http://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.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'
	},


	_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++);
	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);
				}
			}
		});
	});
}


(function () {
	var b = true;
	try {
		var w = window.parent, self = window.self;
		while (w && w != self) {
			if (w.location.host != self.location.host) {
				b = false;
				break;
			}
			if (w === w.parent) break;
			w = w.parent;
		}
	} catch (e) {
		b = false;
	}

	if (!b) {
		Nicovideo = undefined;
		document.write(
			'<p><a href="https://www.nicovideo.jp/watch/sm3414731" target="_blank">\u30d5\u30a1\u30c3\u4f11\u3055\u3093\u3000\u3010\u4e00\u4f11\u3055\u3093\u00d7\u30ac\u30c1\u30e0\u30c1\u3011</a></p>'
		);
		return;
	}

	var video = new Nicovideo.Video({
		v: 'sm3414731'
	,	id: 'sm3414731'
	,	title: '\u30d5\u30a1\u30c3\u4f11\u3055\u3093\u3000\u3010\u4e00\u4f11\u3055\u3093\u00d7\u30ac\u30c1\u30e0\u30c1\u3011'
	,	description: '\u672c\u683c\u7684\u306a\u30de\uff71\uff6f\uff70\u30c9\u3092\u4f5c\u308b\u306e\u306f\u521d\u3081\u3066\u306a\u306e\u3067\u898b\u82e6\u3057\u3044\u70b9\u304c\u591a\u3005\u3042\u308b\u3068\u601d\u308f\u308c\u307e\u3059\u300210\u4e07\u30a4\u30c3\u305f\u30fb\u30fb\u30fb\u3002\u4ed5\u65b9\u306a\u3044\u306d\u3002\u6b6a\u307f\u306e\u7121\u3044\u52d5\u753b\u3092\u4f5c\u308c\u308b\u3088\u3046\u306b\u52aa\u529b\u3057\u3001\u66f4\u306a\u308b\u30cf\u30c3\u30c6\u30f3\u3092\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u25cf7\/14\u8ffd\u8a18\uff1a\u5144\u8cb4\u3078\u306e\u8a95\u751f\u65e5\u30d7\u30ec\u30bc\u30f3\u30c8\u2192sm3954997 \u25cf12\/24\u8ffd\u8a18\uff1a\u56fd\u5bb6\u8a66\u9a13\u306e\u52c9\u5f37\u3084\u3089\u306a\u3093\u3084\u3089\u3067\u3001\u7cde\u6666\u65e5\u7528\u306e\u52d5\u753b\u4f5c\u308c\u306a\u3055\u305d\u3046\u3067\u3059(\u00b4\uff65\u03c9\uff65`)\uff81\uff6e\uff9b\uff70\uff9d\u3000\u5c31\u8077\u306a\u3093\u3066\u7cde\u304f\u3089\u3048\u3048\u3048\u3048\u3047\u3047\u3002 \u3000mylist\/6755521\u3053\u306e\u52d5\u753b\u306f\u6771\u6620\u682a\u5f0f\u4f1a\u793e\u306e\u6a29\u5229\u3092\u4fb5\u5bb3\u3057\u3066\u3044\u305f\u305f\u3081\u3001\u307e\u305f\u306f\u7533\u3057\u7acb\u3066\u304c\u3042\u3063\u305f\u305f\u3081\u524a\u9664\u3055\u308c\u307e\u3057\u305f\u3002'
	,	thumbnail: 'https:\/\/nicovideo.cdn.nimg.jp\/web\/img\/common\/video_deleted.jpg?_t=20181018'
	,	postedAt: new Date('2008\/05\/24 10:47:27 +0900')
	,	length: 90
	,	viewCount: 151791
	,	mylistCount: 825
	,	commentCount: 4429
	,	movieType: 'flv'
	,	isDeleted: true	,	isMymemory: false	});
	var player = new Nicovideo.MiniPlayer(video, {
	'thumbWatch': '1'
	,'thumbPlayKey': '1620043358.0.1.HqJsQHyPiGyfG7vW-mnpr9RAhoc.aHR0cDovL3dvcmtpbmduZXdzLmJsb2cxMTcuZmMyLmNvbS9ibG9nLWVudHJ5LTE0OTAuaHRtbA==...0'
	,'playerTimestamp': '1597813798'
	,'player_version_xml': '1597813798'
	,'player_info_xml': '1556089684'
	,'translation_version_json': ''
	,'v': 'sm3414731'
	,'videoId': 'sm3414731'
	,'thumbTitle': '\u30d5\u30a1\u30c3\u4f11\u3055\u3093\u3000\u3010\u4e00\u4f11\u3055\u3093\u00d7\u30ac\u30c1\u30e0\u30c1\u3011'
	,'thumbDescription': '\u672c\u683c\u7684\u306a\u30de\uff71\uff6f\uff70\u30c9\u3092\u4f5c\u308b\u306e\u306f\u521d\u3081\u3066\u306a\u306e\u3067\u898b\u82e6\u3057\u3044\u70b9\u304c\u591a\u3005\u3042\u308b\u3068\u601d\u308f\u308c\u307e\u3059\u300210\u4e07\u30a4\u30c3\u305f\u30fb\u30fb\u30fb\u3002\u4ed5\u65b9\u306a\u3044\u306d\u3002\u6b6a\u307f\u306e\u7121\u3044\u52d5\u753b...'
	,'thumbTags': '\u30ec\u30b9\u30ea\u30f3\u30b0\u30b7\u30ea\u30fc\u30ba \u54f2\u5b66 \u306a\u305c\u6d88\u3057\u305f\u3057'
	,'thumbImage': 'https:\/\/nicovideo.cdn.nimg.jp\/web\/img\/common\/video_deleted.jpg?_t=20181018'
	,'movie_type': 'flv'
	,'wv_id': 'sm3414731'
	,'language': 'ja-jp'
	,'has_owner_thread': '1'
	,'iee': '1'
	,'noAdSense': '1'
	,'leaf_switch': '2'
	,'accessFromHash': '1619956958:0d8d34a8dab4e27fd0ad39dfa9e513de155b4ea0c2f6381f93467323154a518c'
	}, '485', '386');
	player.write();
})();

