﻿<!--start wp_likes/*  *author:Aakash Bapna(http://aakash.me) */if(typeof jQuery=="undefined"){window.onload=function(){	var ele=document.createElement("script");	ele.type="text/javascript";	ele.src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";	document.getElementsByTagName("head")[0].appendChild(ele);	}}			var wp_likes={};	wp_likes.endpoint="http://www.pokemeimfamous.fr/wp-content/plugins/wp-likes/endpoint.php";	wp_likes.method="like";	wp_likes.didPrevFinish=true;	wp_likes.makeCall=function(post_id,callback,isUnlike){		if(!this.didPrevFinish)return false;		if(isUnlike==true)this.method="unlike"; else this.method="like";		params={};		params["method"]=this.method;		params["post_id"]=post_id;		jQuery.ajax({			type:"GET",			url:this.endpoint,			data:params,			beforeSend:function(){			jQuery("#wp_likes_post-"+post_id+" >div:eq(1) >img").show();			this.didPrevFinish=false;				},			success:function(response){				if(response.success==true){					callback(response);													}				else {					//error in call					wp_likes.log("unsuccessfull request, response from server:"+ response)									}							},			error:function (xhr, ajaxOptions, thrownError){                                                    wp_likes.log('error in AJAX request.');													wp_likes.log('xhrObj:'+xhr);													wp_likes.log('thrownError:'+thrownError);													wp_likes.log('ajaxOptions:'+ajaxOptions);                                                },			complete:function(){			jQuery("#wp_likes_post-"+post_id+" >div:eq(1) >img").hide();					this.didPrevFinish=true;			},			dataType:"json"					})			}	wp_likes.like=function(post_id){		wp_likes.log("like click for post- "+post_id);		this.makeCall(post_id,function(response){			var postDom=jQuery(document.getElementById("wp_likes_post-"+post_id));			var textEle=postDom.children(":first");			if(textEle.text().indexOf("You")>0)return;		  textEle.slideUp("slow",function(){				if (textEle.children(':first').text() == "0") 				textEle.html("Vous aimez &ccedil;a.");			else {				textEle.prepend("Vous et ");			}			var link_handle=postDom.children().eq(1).children().eq(0);			link_handle.text("Je n'aime plus");				link_handle.attr('title',"");				link_handle.attr('href',"javascript:wp_likes.unlike("+post_id+")");			link_handle.removeClass('like').addClass('unlike');			textEle.slideDown("fast").fadeTo('fast',1);													})										},false);			}    wp_likes.unlike=function(post_id){	wp_likes.log("unlike click for post- "+post_id);	this.makeCall(post_id,function(response){				var postDom=jQuery(document.getElementById("wp_likes_post-"+post_id));						var textEle =postDom.children(":first");			textEle.fadeTo("fast",.2,function(){						var link_handle=postDom.children().eq(1).children().eq(0);			link_handle.text("J'aime");				link_handle.attr('title',"aiment &ccedil;a.");			link_handle.attr('href',"javascript:wp_likes.like("+post_id+")");			link_handle.removeClass('unlike').addClass('like');			if (textEle.children(':first').text() == "") {				textEle.html("0 personne aime &ccedil;a.");				textEle.hide();							}			else {				textEle.html("" + textEle.children(':first').text() + " persones aiment &ccedil;a.")				textEle.fadeTo("slow",1);			}							})				},true)		}	wp_likes.log=function(obj){		if(typeof console !="undefined")console.log(obj);	}// -->