flag-overlay"),e.addListeners(),e.initCarousel(),e.yt_players={},e.yt_int,e.vidId},addListeners:function(){var e=this;e.$buttons&&e.$buttons.remove();for(var n=0;n<e.buttonCount;n++)e.$navContainer.append(e.$buttonTemplate.clone());e.commentCount>0&&e.$commentsBtn.on(s.touch?"click touch":"click",t.proxy(e.commentsClick,e)),e.$thumbsUpBtn.on(s.touch?"click touch":"click",t.proxy(e.thumbsUpClick,e)),e.$thumbsDownBtn.on(s.touch?"click touch":"click",t.proxy(e.thumbsDownClick,e)),e.$flagBtn.on(s.touch?"click touch":"click",t.proxy(e.flagClick,e)),e.$mediaThumbs.on(s.touch?"click touch":"click",t.proxy(e.mediaThumbClick,e)),e.$mediaCloseBtn.on(s.touch?"click touch":"click",t.proxy(e.mediaCloseClick,e))},initCarousel:function(){var e=this;e.$mediaCarousel.sonyCarousel({wrapper:".reviews-media-carousel-wrapper",slides:".reviews-media-slide",useCSS3:!0,paddles:!0,animationSpeed:300}),e.$el.has(t(".media-video")).length>0&&t.getScript("//www.youtube.com/player_api",function(){e.yt_int=setInterval(function(){e.initYT(),clearInterval(e.yt_int)},500)}),e.getImageBgSizes()},getImageBgSizes:function(){var e=this,t=e.$mediaCarousel.find(".iq-img");for(var n=0;n<t.length;n++){var r=t[n];e.getBackgroundImageHeight(r,e.returnedImageHeight)}},getBackgroundImageHeight:function(e,n){var r=this,i=new Image,s,o=t(e).data("src-desktop");i.src=o,i.onload=function(){var t=this.height;r.returnedImageHeight(e,t)}},returnedImageHeight:function(e,n){var r=this;n>r.$mediaCarousel.find(".reviews-media-slide").height()?t(e).css("background-size","contain"):t(e).css("background-size","auto")},initYT:function(){var e=this;e.vidId=e.$el.find(".media-video").data("video-id"),t(".ytplayer-"+e.vidId).each(function(){e.yt_players[this.id]=new YT.Player(this.id)}),e.$mediaCarousel.on("SonyCarousel:AnimationComplete",function(){setTimeout(function(){e.$el.trigger(e.UPDATE_DISPLAY_EVENT)},400)}),e.$leftPaddle=e.$el.find(".pagination-prev"),e.$rightPaddle=e.$el.find(".pagination-next"),e.$leftPaddle.on("click",function(t){e.selectedIndex--,e.updateMediaThumbs(),e.stopVideos()}),e.$rightPaddle.on("click",function(t){e.selectedIndex++,e.updateMediaThumbs(),e.stopVideos()})},updateMediaThumbs:function(){var e=this,t=e.$el.find(".media-thumb[data-index="+e.selectedIndex+"]");t.addClass("active"),e.$mediaThumbs.not(t).removeClass("active")},mediaThumbClick:function(e){var n=this,r=t(e.currentTarget);n.selectedIndex=t(e.currentTarget).data("index"),n.stopVideos(),n.$mediaThumbs.not(e.currentTarget).removeClass("active"),r.addClass("active"),n.$mediaCloseBtn.addClass("active"),n.$mediaCarousel.addClass("active"),n.$mediaCarousel.sonyCarousel("gotoSlide",n.selectedIndex),setTimeout(function(){n.$el.trigger(n.UPDATE_DISPLAY_EVENT)},150)},mediaCloseClick:function(e){var t=this;t.yt_players&&t.stopVideos(),t.$mediaThumbs.removeClass("active"),t.$mediaCloseBtn.removeClass("active"),t.$mediaCarousel.removeClass("active"),setTimeout(function(){t.$el.trigger(t.UPDATE_DISPLAY_EVENT)},400)},stopVideos:function(){var e=this;if(e.yt_players)for(var t in e.yt_players)e.yt_players[e.vidId].getPlayerState()===1&&e.yt_players[e.vidId].stopVideo()},commentsClick:function(e){var n=this;n.commentsShown?(n.commentsShown=!1,t(e.target).removeClass("active"),window.alert("Hide comments now")):(n.commentsShown=!0,t(e.target).addClass("active"),window.alert("Show comments now"))},thumbsUpClick:function(e){var t=this,n;if(t.votedDown)return;t.votedUp?t.votedUp&&(t.$thumbsUpBtn.removeClass("active"),t.$thumbsUpBtn.find(".action-count").text(Number(t.$thumbsUpBtn.find(".action-count").text())-1),t.votedUp=!1,n="UNDO",t.callHelpfulnessApi(n)):(t.$thumbsUpBtn.addClass("active"),t.$thumbsUpBtn.find(".action-count").text(Number(t.$thumbsUpBtn.find(".action-count").text())+1),t.votedUp=!0,n="positive",t.callHelpfulnessApi(n))},thumbsDownClick:function(e){var t=this,n;if(t.votedUp)return;t.votedDown?t.votedDown&&(t.$thumbsDownBtn.removeClass("active"),t.$thumbsDownBtn.find(".action-count").text(Number(t.$thumbsDownBtn.find(".action-count").text())-1),t.votedDown=!1,n="UNDO"):(t.$thumbsDownBtn.addClass("active"),t.$thumbsDownBtn.find(".action-count").text(Number(t.$thumbsDownBtn.find(".action-count").text())+1),t.votedDown=!0,n="negative"),t.callHelpfulnessApi(n)},callHelpfulnessApi:function(e){var n=this;t.ajax({type:"POST",url:n.api,dataType:"json",cache:!1,data:{ContentType:"review",ContentId:n.contentId,FeedbackType:"helpfulness",Vote:e},success:function(t){t.hasErrors||(e=="positive"?n.showOverlay(n.$posOverlay):e=="negative"&&n.showOverlay(n.$negOverlay))},error:function(e,t,n){}})},callInappropriateApi:function(){var e=this;t.ajax({type:"POST",dataType:"json",url:e.api,data:{ContentType:"review",ContentId:e.contentId,FeedbackType:"inappropriate"},success:function(n){n.hasErrors||(e.$flagBtn.addClass("disabled"),e.showOverlay(e.$flagOverlay),e.$flagBtn.off(s.touch?"click touchend":"click",t.proxy(e.flagClick,e)))}})},showOverlay:function(e){var n=this;t(e).removeClass("hidden"),setTimeout(function(){t(e).addClass("hidden")},2e3)},flagClick:function(e){var t=this;t.callInappropriateApi()},setActiveButton:function(){var e=this},destroy:function(){var e=this;e.$navContainer.remove(),e.$el.removeData("sonyReviewListing")}},t.fn.sonyReviewListing=function(e){var n=Array.prototype.slice.call(arguments,1);return this.each(function(){var r=t(this),i=r.data("sonyReviewListing");i||(i=new o(r),r.data("sonyReviewListing",i)),typeof e=="string"&&i[e].apply(i,n)})},t.fn.sonyReviewListing.Constructor=o}),define("secondary/sony-reviewuser",["require","jquery","modernizr","require/sony-global-settings"],function(e){var t=e("jquery"),n=e("modernizr"),r=e("require/sony-global-settings"),i=function(e){var t=this;t.$el=e,t.init()};i.prototype={constructor:i,init:function(){var e=this;jQuery.support.cors=!0,e.userEnabled=e.$el.data("user-enabled"),e.$userBtn=e.$el.find(".user-nickname"),e.$userTooltip=e.$el.find(".user-info-tooltip"),e.userTitle=e.$userTooltip.find(".user-info-content"),e.userName=e.userTitle.find(".user-name"),e.userVerified=e.userTitle.find(".user-verified"),e.userVotes=e.$userTooltip.find(".user-votes"),e.

Prev | Next
Pg.: 1 ... 51 52 53 54 55 56 57 58 59 60 61 ... 66


Back to home | File page

Subscribe | Register | Login | N