integ/js/script.js
changeset 0 ca1b8c0fbe35
equal deleted inserted replaced
-1:000000000000 0:ca1b8c0fbe35
       
     1 // Buttons Yes/No
       
     2 //----------------------
       
     3 var btn_thumb = function(){
       
     4 	$('.film_list .btn_thumb, .social_results .btn_thumb, .moviePage .actionsBlock .btn_thumb').click(function(){
       
     5 		if ($(this).hasClass('btn_on')){
       
     6 			 $(this).removeClass("btn_on");
       
     7 		} else {
       
     8 			$(this).parent('.btn_thumbs').find('.btn_thumb').removeClass("btn_on");
       
     9 			$(this).addClass("btn_on");
       
    10 		}
       
    11 	});
       
    12 }
       
    13 
       
    14 // Buttons Yes/No Speednoter
       
    15 //----------------------
       
    16 var btn_thumb_sn = function(){
       
    17 	$('.w-interest .button').click(function(){
       
    18 		if ($(this).hasClass('btn06')){
       
    19 			if ($(this).hasClass('btn06_on')){
       
    20 				 $(this).removeClass("btn06_on");
       
    21 			} else {
       
    22 				$(this).addClass("btn06_on");			
       
    23 			}
       
    24 			$(this).parent('.w-interest').find('.btn07').removeClass("btn07_on");
       
    25 		} 
       
    26 		else if ($(this).hasClass('btn07')) {
       
    27 			if ($(this).hasClass('btn07_on')){
       
    28 				 $(this).removeClass("btn07_on");
       
    29 			} else {
       
    30 				$(this).addClass("btn07_on");
       
    31 			}
       
    32 			$(this).parent('.w-interest').find('.btn06').removeClass("btn06_on");			
       
    33 		}
       
    34 		
       
    35 	});
       
    36 }
       
    37 
       
    38 
       
    39 
       
    40 //Filters
       
    41 //--------
       
    42 var toggle_filters = function(){
       
    43 	$('.filters_trigger ul li').toggleClass('current');
       
    44 	$('.filters_trigger ul li').toggleClass('current');
       
    45 	$('body').toggleClass('open');
       
    46 }
       
    47 
       
    48 
       
    49 // Filters on/off
       
    50 //------------------
       
    51 
       
    52 var btn_filter = function(){
       
    53 	
       
    54 		// trigger filter col
       
    55 	/*$('.filters_trigger > span, .filters_trigger #footer_search i' ).click(function(){	
       
    56 		toggle_filters();
       
    57 	});*/
       
    58 
       
    59 	$('.column_button' ).click(function(){	
       
    60 		toggle_filters();
       
    61 		$(this).toggleClass("btn_search_on");
       
    62 		setTimeout("centerFilmListBloc()",600);
       
    63 	});
       
    64 		
       
    65 	$('.filters_trigger ul li span').click(function(){
       
    66 		if (!$(this).parent().hasClass('current')){
       
    67 			$(this).parent().find('li').removeClass('current').end();
       
    68 			$(this).parent().find('li').addClass('current');
       
    69 			toggle_filters();
       
    70 		}
       
    71 	});
       
    72 		
       
    73 }
       
    74 
       
    75 
       
    76 /*var btn_filter = function(){
       
    77 	$('.filters_trigger ul li span').click(function(){
       
    78 		if (!$(this).parent().hasClass('current')){
       
    79 			$(this).parents('.filters_trigger ul').find('li').removeClass('current');
       
    80 			$(this).parent('.filters_trigger ul li').addClass('current');
       
    81 			toggle_filters();
       
    82 		}
       
    83 	});
       
    84 	
       
    85 	$('.filters_trigger form i').click(function(){
       
    86 			$(this).parents('.filters_trigger ul').find('li').removeClass('current');
       
    87 			$(this).parent('.filters_trigger ul li').addClass('current');
       
    88 			toggle_filters();
       
    89 	});
       
    90 	
       
    91 	$('.filters_trigger > span').click(function(){
       
    92 		$(this).parent('.filters_trigger').find('ul li').toggleClass('current');
       
    93 			toggle_filters();
       
    94 	});
       
    95 }
       
    96 
       
    97 */
       
    98 
       
    99 // Filters on/off
       
   100 //------------------
       
   101 var btns_filter = function(){
       
   102 	
       
   103 	$('.filters_trigger > span').click(function(){
       
   104 		$(this).parent('.filters_trigger').find('ul li').toggleClass('current');
       
   105 			toggle_filters();
       
   106 	});
       
   107 }
       
   108 
       
   109 
       
   110 
       
   111 // Manage profiles
       
   112 //------------------
       
   113 var manage_profiles = function(){
       
   114 
       
   115 	$('.add_profiles span').click(function(){	
       
   116 		$('.manage_profiles > div ').hide();
       
   117 		$('.connect_profiles').show();
       
   118 	});
       
   119 	
       
   120 	$('.logout' ).click(function(){	
       
   121 		$('.manage_profiles > div ').hide();
       
   122 		$('.deconnect_profiles').show();
       
   123 	});
       
   124 	
       
   125 	$('.deconnect' ).click(function(){	
       
   126 		$('.deconnect_profiles').hide();
       
   127 	});
       
   128 		
       
   129 	
       
   130 }
       
   131 
       
   132 
       
   133 
       
   134 //ACCORDION
       
   135 
       
   136 
       
   137 $('.adCntnr div.acco2:eq(0)').find('div.collapse').hide().end()
       
   138 	.find('div.expand').click(function() {
       
   139 $(this).toggleClass('openAd').siblings().removeClass('openAd').end()
       
   140 	.next('div.collapse').slideToggle().siblings('div.collapse:visible').slideUp();
       
   141 	return false;
       
   142 });
       
   143 
       
   144 
       
   145 /*
       
   146 var initCollapsed = function(){
       
   147 	$('.collapse').addClass('invisibility');
       
   148 }
       
   149 initCollapsed();
       
   150 
       
   151 
       
   152 
       
   153 $('.adCntnr div.acco2 .expand').click(function() {	
       
   154 	
       
   155 	$(this).
       
   156 		toggleClass('openAd').
       
   157 		siblings().
       
   158 		removeClass('openAd').
       
   159 		end().
       
   160 		next('.collapse').
       
   161 		hide().
       
   162 		removeClass('invisibility').		
       
   163 		slideToggle().		
       
   164 		siblings('.collapse:visible').
       
   165 		slideUp();	
       
   166 	return false;		
       
   167 });
       
   168 */
       
   169 
       
   170 
       
   171 //MODAL (http://www.ericmmartin.com/projects/simplemodal/)
       
   172 /*
       
   173 $('#basic').click(function (e) {
       
   174 	$('#basic-modal-content').modal({overlayClose: true});
       
   175 	return false;
       
   176 });
       
   177 */
       
   178 
       
   179 $("body:not('.profile') .facettes").mCustomScrollbar({
       
   180 	advanced:{
       
   181 	    updateOnContentResize: true
       
   182 	},
       
   183 	autoDraggerLength:false,
       
   184 	scrollButtons:{
       
   185 		enable:false
       
   186 	}
       
   187 });
       
   188 
       
   189 $('#basic2').click(function (e) {
       
   190 	$('#basic-modal-content2').modal({
       
   191 		containerCss:{
       
   192 		height:320,
       
   193 		width:690
       
   194 		},
       
   195 		overlayClose: true
       
   196 	});
       
   197 	return false;
       
   198 });
       
   199 
       
   200 
       
   201 $('.filters_search input[type="text"]').click(function () {
       
   202 	$(this).parent().find('.search_dropdown').toggle();
       
   203 });
       
   204 
       
   205 $('.search_dropdown ul li a').click(function () {
       
   206 	$(this).parents('.search_dropdown').hide();
       
   207 	return false;
       
   208 });
       
   209 
       
   210 
       
   211 
       
   212 var openNodal = function(){
       
   213 	$('#basic-modal-content3').modal({
       
   214 		containerCss:{
       
   215 		height:460,
       
   216 		width:900
       
   217 		},
       
   218 		overlayClose: true
       
   219 	});
       
   220 	
       
   221 	$('.simplemodal-close').hide();
       
   222 	
       
   223 	$('.btn_see ').click(function(){
       
   224 		$('.simplemodal-close').trigger('click');
       
   225 	});
       
   226 }, modifMovieModal = function(){
       
   227 	$('#modif-movie-modal').modal({
       
   228 		containerCss:{
       
   229 		height:268,
       
   230 		width:672
       
   231 		},
       
   232 		overlayClose: true
       
   233 	});
       
   234 	
       
   235 	$('.btn_see ').click(function(){
       
   236 		$('.simplemodal-close').trigger('click');
       
   237 	});
       
   238 }, addMovieModal = function(){
       
   239 	$('#add-movie-modal').modal({
       
   240 		containerCss:{
       
   241 		height:268,
       
   242 		width:672
       
   243 		},
       
   244 		overlayClose: true
       
   245 	});
       
   246 	
       
   247 	$('.btn_see ').click(function(){
       
   248 		$('.simplemodal-close').trigger('click');
       
   249 	});
       
   250 }, fullVitrineModal = function(){
       
   251 	$('#full-vitrine-modal').modal({
       
   252 		containerCss:{
       
   253 		height:160,
       
   254 		width:590
       
   255 		},
       
   256 		overlayClose: true
       
   257 	});
       
   258 	
       
   259 	$('.btn_see ').click(function(){
       
   260 		$('.simplemodal-close').trigger('click');
       
   261 	});
       
   262 }, commentModal = function(){
       
   263 	$('#comment-modal').modal({
       
   264 		containerCss:{
       
   265 		height:238,
       
   266 		width:672
       
   267 		},
       
   268 		overlayClose: true
       
   269 	});
       
   270 	
       
   271 	$('.btn_see ').click(function(){
       
   272 		$('.simplemodal-close').trigger('click');
       
   273 	});
       
   274 }, allBadgesModal = function(){
       
   275 	$('#allBadges-modal').modal({
       
   276 		containerCss:{
       
   277 		height:540,
       
   278 		width:622
       
   279 		},
       
   280 		overlayClose: true
       
   281 	});
       
   282 	
       
   283 	$('.btn_see ').click(function(){
       
   284 		$('.simplemodal-close').trigger('click');
       
   285 	});
       
   286 }, newBadgesModal = function(){
       
   287 	$('#newBadges-modal').modal({
       
   288 		containerCss:{
       
   289 		height:268,
       
   290 		width:612
       
   291 		},
       
   292 		overlayClose: true
       
   293 	});
       
   294 	
       
   295 	$('.btn_see, .valid_badge ').click(function(){
       
   296 		$('.simplemodal-close').trigger('click');
       
   297 	});
       
   298 }
       
   299 
       
   300 $('.film_list .btn_thumbs .btn_yes').click(function(){
       
   301 	$('#interest-modal-content').modal({
       
   302 		containerCss:{
       
   303 		height:310,
       
   304 		width:590
       
   305 		},
       
   306 		overlayClose: true
       
   307 	});
       
   308 });
       
   309 $('.film_list .btn_thumbs .btn_no').click(function(){
       
   310 	$('#not-interest-modal-content').modal({
       
   311 		containerCss:{
       
   312 		height:310,
       
   313 		width:590
       
   314 		},
       
   315 		overlayClose: true
       
   316 	});
       
   317 });
       
   318 
       
   319 //Center film list block
       
   320 var centerFilmListBloc = function(){
       
   321 
       
   322 	var wArea = $(".results").width(),
       
   323 		w = wArea % $(".film_list li").outerWidth();
       
   324 
       
   325 	$(".results > ul").stop(true,true).width(wArea - w);
       
   326 
       
   327 }, mediaQueriesTest = function(){
       
   328 	var windowWidth= window.innerWidth;
       
   329 
       
   330 	if(windowWidth < 1352){
       
   331 		$(".other_container").insertAfter(".container_table_row .like_container:eq(0)");
       
   332 	} else{
       
   333 		$(".other_container").insertAfter(".container_table");
       
   334 	}
       
   335 }, synopsisDotDotDot = function(){
       
   336 	var heightSynop = $(".synopsis").height(),
       
   337 		synopContent = $(".synopsis").triggerHandler("originalContent");
       
   338 
       
   339 	$(".synopsis").dotdotdot({
       
   340         watch: "window",
       
   341         callback: function() {
       
   342 			$(".sinopSee").removeClass("allText");
       
   343 			$(".sinopSee").addClass("dotDoted");
       
   344 			$(".sinopSee span").text("+");
       
   345         }
       
   346     });
       
   347     $(".dotDoted").live('click',function() {
       
   348 	    $(".synopsis").trigger("destroy");
       
   349 	    $(".synopsis").height("auto");
       
   350 	    $(".sinopSee").addClass("allText");
       
   351 	    $(".sinopSee").removeClass("dotDoted");
       
   352 	    $(".sinopSee span").text("-");
       
   353 	});
       
   354     $(".allText").live('click',function() {
       
   355     	$(".synopsis").height(heightSynop);
       
   356 	    $(".synopsis").dotdotdot({
       
   357 	        watch: "window",
       
   358 	        callback: function() {
       
   359 				$(".sinopSee").addClass("dotDoted");
       
   360 				$(".sinopSee").removeClass("allText");
       
   361 				$(".sinopSee span").text("+");
       
   362 	        }
       
   363 	    });
       
   364 	});
       
   365 
       
   366 }
       
   367 
       
   368 //Speednoter Animation
       
   369 var activateSeeRecommandations = function(){
       
   370 	$(".stillToRate").animate({"opacity":"0"},300);
       
   371 	$(".stillToRate").animate({width: 'toggle'},500);
       
   372 	$(".btn_see").animate({"opacity":"1"},1500);
       
   373 
       
   374 	/* $('.my_reco').attr({
       
   375 		href: 'new_link...',
       
   376 		title: '...'
       
   377 	}); */
       
   378 }, youhouNumber = function(){
       
   379 	$(".stillToRate span").addClass("youhou");
       
   380 	setTimeout(function() {
       
   381 		$(".stillToRate span").removeClass("youhou");
       
   382 	}, 300);//the same time like ".stillToRate span" CSS transition animation
       
   383 }
       
   384 
       
   385 //profile - hide message tuto
       
   386 var closeMsgTuto = function(){
       
   387 	$('.msg_box i.close').click(function(){
       
   388 		$(this).parent().animate({"opacity":"0"},300,function(){
       
   389 			$(this).slideUp();
       
   390 		});
       
   391 	});
       
   392 }
       
   393 $(function() {
       
   394 
       
   395 	$(window).resize(function(){
       
   396 		centerFilmListBloc();
       
   397 		mediaQueriesTest();
       
   398 	});
       
   399 	mediaQueriesTest();
       
   400 	centerFilmListBloc();
       
   401 	//socialGrid();
       
   402 	// manageyes/no buttons
       
   403 	if($('.film_list .btn_thumb').length){
       
   404 		 btn_thumb();
       
   405 	}
       
   406 	if($('.social_results .btn_thumb').length){
       
   407 		 btn_thumb();
       
   408 	}
       
   409 	if($('.moviePage .actionsBlock .btn_thumb').length){
       
   410 		 btn_thumb();
       
   411 	}
       
   412 	
       
   413 	// manageyes/no buttons speednoter
       
   414 	if($('.speednoter').length){
       
   415 		 btn_thumb_sn();
       
   416 	}
       
   417 	
       
   418 	//
       
   419 	if($('.msg_box i.close').length){
       
   420 		 closeMsgTuto();
       
   421 	}
       
   422 
       
   423 	// trigger filter col
       
   424 	btn_filter();
       
   425 	
       
   426 	manage_profiles();
       
   427 
       
   428 		/* fiche film */
       
   429 	$('.movie_vitrine').not(".vitrineFull").click(function (e) {
       
   430 		addMovieModal();
       
   431 		return false;
       
   432 	});
       
   433 	$('.vitrineFull').click(function (e) {
       
   434 		fullVitrineModal();
       
   435 		return false;
       
   436 	});
       
   437 		/* vitrine */
       
   438 	$('.edit_btn').click(function (e) {
       
   439 		modifMovieModal();
       
   440 		return false;
       
   441 	});
       
   442 	$('.vitr_list .overlay_area .desc').click(function (e) {
       
   443 		commentModal();
       
   444 		return false;
       
   445 	});
       
   446 	$('.moreBadges').click(function (e) {
       
   447 		allBadgesModal();
       
   448 		return false;
       
   449 	});
       
   450 	$('nav .notification').click(function (e) {
       
   451 		newBadgesModal();
       
   452 		return false;
       
   453 	});
       
   454 	
       
   455 		/* */
       
   456 	$('.simple_modal_trigger').click(function (e) {
       
   457 		$('#simple_modal').modal({
       
   458 			containerCss:{
       
   459 			height:320,
       
   460 			width:690
       
   461 			},
       
   462 			overlayClose: true
       
   463 		});
       
   464 		return false;
       
   465 	});
       
   466 	
       
   467 	$('#basic').click(function() {
       
   468 		$("#basic-modal-content").modal({
       
   469 			containerCss:{
       
   470 				height:440,
       
   471 				width:690
       
   472 				},
       
   473 			overlayClose: true,
       
   474 			onShow : function() {
       
   475 				$(".star_names").
       
   476 					mCustomScrollbar({
       
   477 						autoDraggerLength:false,
       
   478 						scrollButtons:{
       
   479 							enable:false
       
   480 						}
       
   481 					});
       
   482 				}
       
   483 			});
       
   484 		return false;
       
   485 	});
       
   486 
       
   487 	//TOOLTIP INFO VIGNETTE
       
   488 	var show_tooltip_info = function(elem){
       
   489 
       
   490 		var clWidth = $("body").width(),//WIDTH AREA
       
   491 			$thisEl = elem.parent().parent().parent(),// target LI
       
   492 			$thisElDiv = $thisEl.children("div"),// target LI DIV
       
   493 			elWidth = elem.parent().find(".tooltip_info").outerWidth() + elem.parent().find(".arrow_tooltip").outerWidth() ,//WIDTH 1 ELEMENT
       
   494 			thisElPos = $thisEl.offset();//POSITION ELEMENT
       
   495 
       
   496 		//move on the left IF the last line element
       
   497 		if ((clWidth - thisElPos.left) < elWidth*2) {
       
   498 			$thisEl.find(".tooltip_info, .arrow_tooltip").addClass("posLeft");
       
   499 		} else {
       
   500 			$thisEl.find(".tooltip_info, .arrow_tooltip").removeClass("posLeft");
       
   501 		};
       
   502 
       
   503 		//tooltip vetical alignement
       
   504 		var vignHeight = $thisElDiv.outerHeight(),
       
   505 			tooltipHeight = $thisEl.find(".tooltip_info").outerHeight(),
       
   506 			toAddToTop = Math.round((vignHeight - tooltipHeight)/2);
       
   507 			
       
   508 			
       
   509 			if(toAddToTop > -3){
       
   510 				toAddToTop = -3;
       
   511 			}
       
   512 			var toAddToTopArrow = 13 - toAddToTop;
       
   513 
       
   514 		$thisEl.find(".tooltip_info").css({"top":toAddToTop+"px"});
       
   515 		$thisEl.find(".arrow_tooltip").css({"top":toAddToTopArrow+"px"});
       
   516 		
       
   517 	}
       
   518 	//SHOW TOOLTIP
       
   519 	$(".info_btn").hover(function(){
       
   520 		show_tooltip_info($(this));
       
   521 	},function(){
       
   522 		show_tooltip_info($(this));
       
   523 	});
       
   524 
       
   525 	//JCAROUSEL
       
   526 	if ( $('.carousels .js_jcar').length ) {
       
   527 		$('.carousels .js_jcar').each(function(){
       
   528 			$(this).jcarousel();
       
   529 		});
       
   530 	}
       
   531 
       
   532 });