WatchCommon.ns("harajuku.log.watchtime",function(i,e,c,b){function h(){if(c.NicoplayerEventDispatcher&&c.Event){this._kind=null;var a=this.NicoplayerEventDispatcher=c.NicoplayerEventDispatcher,g=c.Event;a.addEventListener("videoStarted",this.onVideoStarted.bind(this));a.addEventListener("videoPlayed",this.onVideoPlayed.bind(this));a.addEventListener("videoStopped",this.onVideoStopped.bind(this));a.addEventListener("videoEnded",this.onVideoEnded.bind(this));c.Prototype.Browser.IE&&(b.attachEvent("onfocusout",
this.onBlur.bind(this)),b.attachEvent("onfocusin",this.onFocus.bind(this)));g.observe(b,"mousemove",d(this.onMouseMove.bind(this)));g.observe(b,"scroll",d(this.onScroll.bind(this)));g.observe(b,"keyup",d(this.onKeyUp.bind(this)))}}function d(a,b){var f=null;return function(){var d=this;f&&c.clearTimeout(f);var e=arguments;f=c.setTimeout(function(){f=null;a.apply(d,e)},b||500)}}i.mixin(h.prototype,{onVideoStarted:function(a){if(a&&a.video_id)this._kind&&this._kind.cleanup(),(this._kind=new e.log.kind.WatchTimeLogKind(a.video_id,
e.log.Logger)).onVideoStarted()},onVideoPlayed:function(){this._kind.onVideoPlayed()},onVideoStopped:function(){this._kind.onVideoStopped()},onVideoEnded:function(a){this._kind.onVideoEnded(a)},onMouseMove:function(){this._dispachUserActioned()},onScroll:function(){this._dispachUserActioned()},onKeyUp:function(){this._dispachUserActioned()},onBlur:function(){if(!b.hasFocus()&&(this._dispachUserActioned(),this._kind))this._kind.onBlur()},onFocus:function(){if(b.hasFocus()&&(this._dispachUserActioned(),
this._kind))this._kind.onFocus()},_dispachUserActioned:function(){if(this._kind)this._kind.onUserActioned()}});return h},"WatchTimeLogController");
