(function($){ var imgList = []; $.extend({ preload: function(ruta, imgArr, option){ var setting = $.extend({ init: function(loaded, total){}, loaded: function(img, loaded, total){}, loaded_all: function(loaded, total){} }, option); var total = imgArr.length; var loaded = 0; setting.init(0, total); for (var i in imgArr){ imgList.push($("") .attr("src", ruta + imgArr[i]) .load(function(){ loaded++; setting.loaded(this, loaded, total); if (loaded == total){ setting.loaded_all(loaded, total); } }) ); } } }); })(jQuery); function centrarLetreros(){ // Calcula alto de mensaje inicial $altoDer = $("#tDer").height(); $altoIzq = $("#tIzq").height(); // Centra letreros $("#tDer").css("margin-top", -($altoDer / 2)); $("#tIzq").css("margin-top", -($altoIzq / 2)); return false; } FB.init({ appId: '164590300222442', status: true, cookie: true, xfbml: true }); $(".publicarFB").live('click', function(){ $elIDi = $(".imgIzq").attr("id"); $laURL = "getContador.php?vid=" + $elIDi + "_01.png"; $("#me-gusta").load($laURL); $elVideo = ""; var elVid = ""; if ($(".imgIzq").attr("id") == "1"){ $elVideo = 'http://www.vimeo.com/14360134'; } else{ elVid = $(".imgIzq").attr("id"); elVid = elVid.substring(0, elVid.length - 7); $elVideo = 'http://www.youtube.com/watch?v=' + elVid; } FB.getLoginStatus(function(response){ if (response.session){ FB.ui( { method: 'stream.publish', message: 'Hey, acabo de ver un video en FlickMotion. Ten�s que verlo', attachment: { name: 'VER VIDEO', caption: 'Video hecho por FlickMotion', description: ('FlickMotion es una productora de videos ubicada en la ciudad de Medellin.' + ' �Ya viste el nuevo sitio web de FlickMotion? ' + ' Entre pues: http://bit.ly/FlickM'), media: [ { type: 'image', src: 'http://img.youtube.com/vi/' + elVid + '/1.jpg', href: $elVideo } ], href: $elVideo }, action_links: [ { text: 'Ir a FlickMotion', href: 'http://bit.ly/FlickM' } ], user_message_prompt: 'Dele clic en publicar ¿o se va a quedar con las ganas?' }, function(response){ if (response && response.post_id){ FB.api( { method: 'stream.addLike', post_id: response.post_id }, function(response){ if (!response || response.error){ alert('Error !'); } else{ alert('Mensaje publicado con éxito en Facebook!'); } } ); } else{ alert('El mensaje no se publicó en Facebook.'); } } ); } else{ FB.login(function(response){ if (response.session){ if (response.perms){ $(".publicarFB").click(); } else{ alert("No puedo escribir en tu muro. Por favor dame permisos."); } } else{ alert("Tu mensaje no será publicado en Facebook"); } }, { perms: 'publish_stream' }); } }); $centeredY = (screen.height - 500) / 2; $centeredX = (screen.width - 500) / 2; if ($(".imgIzq").attr("id") == "1"){ window.open('http://twitter.com/share?text=Acabo%20de%20ver%20el%20Reel%20de%20%40FlickMotion%20y%20lo%20quiero%20compartir%20http%3A%2F%2Fvimeo.com%2F14360134%20http%3A%2F%2Fbit.ly%2FFlickM&lang=es&related=FlickMotion', 'Compartilo en Twitter', 'height=500, width=500, left=' + $centeredX + ',top=' + $centeredY).focus(); } else{ window.open('http://twitter.com/share?text=acabo%20de%20ver%20un%20video%20en%20%40FlickMotion%20y%20lo%20quiero%20compartir%20http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D' + elVid + '%20http%3A%2F%2Fbit.ly%2FFlickM&lang=es&related=FlickMotion', 'Compartilo en Twitter', 'height=500, width=500, left=' + $centeredX + ',top=' + $centeredY).focus(); } }); // Fin .publicarFB function menuVideos(quien){ if ((quien == ".reel") || (quien == ".contacto")){ if ($("#navcontainer-videos").css("display") == "block"){ $("#navcontainer-videos").animate({ "margin-top": "0" }, function(){ $("#navcontainer-videos").css("display", "none"); $("#menu-videos").css("left", "10px"); $cont = 10; }); } } else{ $("#navcontainer-videos").css("display", "block"); $("#navcontainer-videos").animate({ "margin-top": "-50px" }); } } function carruselVideosAdentro(){ var scroll_prev_adentro = false, scroll_next_adentro = false; $("#menu-videos-adentro").carouFredSel({ width: $anchoTotal, height: 23, items: { minimum: 2, width: "variable", visible: 17, }, scroll: { items: 1, duration: 900, easing: "linear" }, auto: false, prev: { onAfter: function(){ if (scroll_prev_adentro) setTimeout(function(){ $("#menu-videos-adentro").trigger("prev"); }, 10); } }, next: { onAfter: function(){ if (scroll_next_adentro) setTimeout(function(){ $("#menu-videos-adentro").trigger("next"); }, 10); } } }); $("#flechaIzq-adentro").live("mouseover mouseout", function(event){ if (event.type == 'mouseover'){ scroll_prev_adentro = true; $("#menu-videos-adentro").trigger("prev"); } else{ scroll_prev_adentro = false; } }).live("click", function(){ return false; }); $("#flechaDer-adentro").live("mouseover mouseout", function(event){ if (event.type == 'mouseover'){ scroll_next_adentro = true; $("#menu-videos-adentro").trigger("next"); } else{ scroll_next_adentro = false; } }).live("click", function(){ return false; }); } function flickmotion_init(){ //Preload de las im�genes del sitio var imgsGral = ["botones.png","btn-blanco.bk.png","btn-blanco.png","cerrar.png","contacto_01.png","contacto_02.png","der-sombra.png","der.png","flecha_der.png","flecha_ftv_der.png","flecha_ftv_izq.png","flecha_izq.png","fondo-barra.png","fondo-menu.bk.png","fondo-menu.png","fondo_titulos_videos.png","izq.png","me-gusta-btn.png","redes.png","reel_01.png","reel_02.png","reel_negro.png","sombra-barra.png","videoclips_01.png","videoclips_02.png","vinieta.png"]; $.preload("./imgs/", imgsGral); //Centrado autom�tico de los letreros $(".imgIzq").load(function(){ $(".imgDer").load(function(){ centrarLetreros(); }); }); centrarLetreros(); // Cierra paneles $("#izq").animate({ "left": "0%" }, 1300); $("#der").animate({ "left": "50%" }, 1300, function(){ $(".fondoDer").attr("src", "./imgs/der-sombra.png"); $("#contenido").css("display", "block"); $("body").css("background-color", "#000000"); }); // Esconde barra de menu // Inicializa variables $abierto = false; $elID = 1; $cambiar = false; $enContacto = false; $anchoMenuAdentro = 0; $anchoTotalAdentro = 0; var listaVideosJQ = ["-o4HoXFuvY4_01.png","-o4HoXFuvY4_02.png","-o4HoXFuvY4_negro.png","0n6S7j-R-Ew_01.png","0n6S7j-R-Ew_02.png","0n6S7j-R-Ew_negro.png","1TxQXY4i4fw_01.png","1TxQXY4i4fw_02.png","1TxQXY4i4fw_negro.png","2JpENGdmuAc_01.png","2JpENGdmuAc_02.png","2JpENGdmuAc_negro.png","5UeHDyfImhk_01.png","5UeHDyfImhk_02.png","5UeHDyfImhk_negro.png","5o2J6HiHTRs_01.png","5o2J6HiHTRs_02.png","5o2J6HiHTRs_negro.png","8YPhpbCMtfs_01.png","8YPhpbCMtfs_02.png","8YPhpbCMtfs_negro.png","9BGix-EX4z8_01.png","9BGix-EX4z8_02.png","9BGix-EX4z8_negro.png","Ax4L9E2uKIs_01.png","Ax4L9E2uKIs_02.png","Ax4L9E2uKIs_negro.png","HRTTBoXCkOY_01.png","HRTTBoXCkOY_02.png","HRTTBoXCkOY_negro.png","JyYm_2Q_Pv0_01.png","JyYm_2Q_Pv0_02.png","JyYm_2Q_Pv0_negro.png","KHwkYlJmZEk_01.png","KHwkYlJmZEk_02.png","KHwkYlJmZEk_negro.png","SrFGzmbFOtM_01.png","SrFGzmbFOtM_02.png","SrFGzmbFOtM_negro.png","Sx9riQr_3k8_01.png","Sx9riQr_3k8_02.png","Sx9riQr_3k8_negro.png","YnMRBS6uqCA_01.png","YnMRBS6uqCA_02.png","YnMRBS6uqCA_negro.png","ZHHMrAB3Pzs_01.png","ZHHMrAB3Pzs_02.png","ZHHMrAB3Pzs_negro.png","cybjZJ6yxTY_01.png","cybjZJ6yxTY_02.png","cybjZJ6yxTY_negro.png","e1Iu2tldov0_01.png","e1Iu2tldov0_02.png","e1Iu2tldov0_negro.png","hk6ivi8IGnA_01.png","hk6ivi8IGnA_02.png","hk6ivi8IGnA_negro.png","svT6hUVfHDk_01.png","svT6hUVfHDk_02.png","svT6hUVfHDk_negro.png","tj9_zmJ3rg4_01.png","tj9_zmJ3rg4_02.png","tj9_zmJ3rg4_negro.png","vp2sHYQZojs_01.png","vp2sHYQZojs_02.png","vp2sHYQZojs_negro.png","xDUUei-FzLI_01.png","xDUUei-FzLI_02.png","xDUUei-FzLI_negro.png","z8Yrzaqf3_4_01.png","z8Yrzaqf3_4_02.png","z8Yrzaqf3_4_negro.png","ziCib2wPg58_01.png","ziCib2wPg58_02.png","ziCib2wPg58_negro.png"]; $numVideos = listaVideosJQ.length; $.preload("./imgs/videos/", listaVideosJQ); $videoAct = 0; $conta = 0; //$anchoMnuVideos = screen.width-227; //alert($anchoMnuVideos); //$("#menu-videos").css("width",$anchoMnuVideos); // Captura Clic para abrir y cerrar paneles $(".cerrable").live("click", function(){ if ($enContacto != true){ if ($abierto == false){ // Carga video if (this.rel == "menu"){ $elID = this.id + "_01.png"; $(".imgIzq").attr("id", $elID); } else{ $elID = $(".imgIzq").attr("id"); } $("#contenido").fadeOut(1); $("#contenido").load("verVideo.php?vid=" + $elID, function(){ // Centra el letrero del video una vez carga la imagen $(".imgTv").load(function(){ $altoBtn = $("#btn-me-gusta").height(); $altoT = $("#tVideo").height(); $("#tVideo").css("margin-top", -(($altoT + $altoBtn) / 2)); }); $altoRelAdentro = $("#izq").height() - 33; $('#navcontainer-videos-adentro').css('top', $altoRelAdentro + 'px'); $('#tVideo').css('top', '120%'); $anchoMenuAdentro = $("#menu-videos-adentro").width(); $('#menu-videos-adentro > li').each(function(){ $anchoTotalAdentro += $(this).width() + 23; }); carruselVideosAdentro(); $('#menu-videos-adentro').height('23px'); $('#menu-videos-adentro').width('2000px'); }); setTimeout('$(\'#contenido\').fadeIn(1500);', 1000); // Quita sombra $(".fondoDer").attr("src", "./imgs/der.png"); //Oculta barra $("#barra").animate({ "bottom": "-130px" }); // Abre paneles $("#izq").animate({ "left": "-=36%" }, 1300); $("#der").animate({ "left": "+=36%" }, 1300); //$(".cerrar").css("display","block"); $abierto = true; $cambiar = false; } else{ if (this.rel == "menu-adentro"){ if (! ($(this).hasClass("activo"))){ var indexone = $("a").index( this ); var elIDdef = this.id; $elID = this.id + "_01.png"; $("#contenido").load("verVideo.php?vid=" + $elID, function(){ // Centra el letrero del video una vez carga la imagen $(".imgTv").load(function(){ $altoBtn = $("#btn-me-gusta").height(); $altoT = $("#tVideo").height(); $("#tVideo").css("margin-top", -(($altoT + $altoBtn) / 2)); }); $altoRelAdentro = $("#izq").height() - 33; $('#navcontainer-videos-adentro').css('top', $altoRelAdentro + 'px'); carruselVideosAdentro(); var index = $("a").index( $('#'+elIDdef) ); //alert('indexone: '+indexone+' index:'+index); $("#menu-videos-adentro").trigger("slideTo",[index,-1,null]); }); $(".imgIzq").fadeOut(200); $(".imgDer").fadeOut(200); $(".imgIzq").attr("id", $elID); $(".imgIzq").attr("src", "./imgs/videos/" + this.id + "_01.png"); $(".imgDer").attr("src", "./imgs/videos/" + this.id + "_02.png"); $(".imgIzq").fadeIn(200); $(".imgDer").fadeIn(200); } } else{ $("#contenido").fadeOut(500); $("#contenido").load("verVideo.php?vid=0", function(){ //$(".cerrar").css("display","none"); $("#izq").animate({ "left": "0%" }, 1300); $("#der").animate({ "left": "50%" }, 1300, function(){ $(".fondoDer").attr("src", "./imgs/der-sombra.png"); }); $("#barra").animate({ "bottom": "0" });/*, function(){ if ($(".videoclips").hasClass("actV")){ menuVideos(".videoclips"); } });*/ if ($(".videoclips").hasClass("actV")){ menuVideos(".videoclips"); } $abierto = false; $elID = $elID = $(".imgIzq").attr("id"); if ($elID != "1"){ $cambiar = true; } }); } } } return false; }); // Fin .cerrable.click $altoRel = $("#izq").height() - 100; $mnuVideos = false; $("body").mousemove(function(e){ //Aparece y desaparece barra de videos if ($("#videoclips").hasClass("actV")){ if ((e.pageY >= $altoRel)){ if (!$mnuVideos){ menuVideos(".videoclips"); $mnuVideos = true; } } else{ if ($mnuVideos){ menuVideos(".contacto"); $mnuVideos = false; } } } }); $(".cambiable").mousemove(function(){ if ($cambiar){ $conta++; if ($conta == 30){ if ($videoAct >= ($numVideos - 3)){ $videoAct = 0; } $(".imgIzq").fadeOut(100); $(".imgDer").fadeOut(100, function(){ $(".imgIzq").attr("id", listaVideosJQ[$videoAct]); $(".imgIzq").attr("src", "./imgs/videos/" + listaVideosJQ[$videoAct]); $(".imgDer").attr("src", "./imgs/videos/" + listaVideosJQ[$videoAct + 1]); }); $(".imgIzq").fadeIn(100); $(".imgDer").fadeIn(100); $conta = 0; $videoAct += 3; } } }); // Fin cambiable.mousemove $(".reel").click(function(){ menuVideos(".reel"); $(".imgIzq").attr("id", "1"); $(".imgIzq").fadeOut(200, function(){ $(".imgIzq").attr("src", "./imgs/reel_01.png"); }); $(".imgDer").fadeOut(200, function(){ $(".imgDer").attr("src", "./imgs/reel_02.png"); }); $cambiar = false; $enContacto = false; $(".cerrable").css("cursor", "pointer"); $(".reel").addClass("actR"); $(".videoclips").removeClass("actV"); $(".contacto").removeClass("actC"); $(".imgDer").fadeIn(200); $(".imgIzq").fadeIn(200); return false; }); //$anchoMenu = 0; $(".videoclips").click(function(){ //$("#menu-videos").load("gnMenu.php",function(){ //$anchoMenu = $("#menu-videos").width(); //}); menuVideos(".videoclips"); $mnuVideos = true; $(".imgIzq").attr("id", "1"); $(".imgIzq").fadeOut(200, function(){ $(".imgIzq").attr("src", "./imgs/videoclips_01.png"); }); $(".imgDer").fadeOut(200, function(){ $(".imgDer").attr("src", "./imgs/videoclips_02.png"); }); $cambiar = true; $enContacto = false; $(".cerrable").css("cursor", "pointer"); $(".videoclips").addClass("actV"); $(".reel").removeClass("actR"); $(".contacto").removeClass("actC"); $(".imgDer").fadeIn(200); $(".imgIzq").fadeIn(200); return false; }); $cont = 10; $contAdentro = 10; $anchoMenu = $("#menu-videos").width(); $anchoTotal = 0; $('#menu-videos > li').each(function(){ $anchoTotal += $(this).width() + 23; }); /* $("#flechaIzq").live("mouseenter",function(){ var self = $(this); this.iid = setInterval(function() { if($cont<10){ $("#menu-videos").css("left",$cont+"px"); $cont+=10; } }, 50); }).bind('mouseleave', function(){ this.iid && clearInterval(this.iid); }); $("#flechaDer").live("mouseenter",function(){ var self = $(this); this.iid = setInterval(function() { if($cont>(-($anchoTotal-$anchoMenu))){ $("#menu-videos").css("left",$cont+"px"); $cont-=10; } }, 50); }).bind('mouseleave', function(){ this.iid && clearInterval(this.iid); }); $("#flechaIzq-adentro").live("mouseenter",function(){ var self = $(this); this.iid = setInterval(function() { if($contAdentro<10){ $("#menu-videos-adentro").css("left",$contAdentro+"px"); $contAdentro +=10; } }, 50); }).live('mouseleave', function(){ this.iid && clearInterval(this.iid); }); $("#flechaDer-adentro").live("mouseenter",function(){ var self = $(this); this.iid = setInterval(function() { if($cont>(-($anchoTotalAdentro-$anchoMenuAdentro))){ $("#menu-videos-adentro").css("left",$contAdentro+"px"); $contAdentro -=10; } }, 50); }).live('mouseleave', function(){ this.iid && clearInterval(this.iid); }); */ var scroll_prev = false, scroll_next = false; $("#menu-videos").carouFredSel({ width: $anchoTotal, items: { minimum: 2, width: "variable", visible: 17, }, scroll: { items: 1, duration: 900, easing: "linear" }, auto: false, prev: { onAfter: function(){ if (scroll_prev) setTimeout(function(){ $("#menu-videos").trigger("prev"); }, 10); } }, next: { onAfter: function(){ if (scroll_next) setTimeout(function(){ $("#menu-videos").trigger("next"); }, 10); } } }); $("#flechaIzq").hover( function(){ scroll_prev = true; $("#menu-videos").trigger("prev"); }, function(){ scroll_prev = false; } ).click(function(){ return false; }); $("#flechaDer,#btn-blanco").hover( function(){ scroll_next = true; $("#menu-videos").trigger("next"); }, function(){ scroll_next = false; } ).click(function(){ return false; }); $('.cerrable').live('mouseover mouseout', function(event){ if (event.type == 'mouseover'){ if (this.rel == "menu"){ $(".imgIzq").fadeOut(200); $(".imgDer").fadeOut(200); $elIDMnu = this.id; $(".imgIzq").attr("id", $elIDMnu); $(".imgIzq").attr("src", "./imgs/videos/" + $elIDMnu + '_01.png'); $(".imgDer").attr("src", "./imgs/videos/" + $elIDMnu + '_02.png'); $(".imgIzq").fadeIn(200); $(".imgDer").fadeIn(200); } } else{ // nada } }); $(".contacto").click(function(){ menuVideos(".contacto"); $(".imgIzq").fadeOut(200, function(){ $(".imgIzq").attr("src", "./imgs/contacto_01.png"); }); $(".imgDer").fadeOut(200, function(){ $(".imgDer").attr("src", "./imgs/contacto_02.png"); }); $cambiar = false; $enContacto = true; $(".cerrable").css("cursor", "auto"); $(".contacto").addClass("actC"); $(".videoclips").removeClass("actV"); $(".reel").removeClass("actR"); $(".imgDer").fadeIn(200); $(".imgIzq").fadeIn(200); return false; }); return false; }