$obiwi(function() { var HighlightColor = "#FFFFCC"; /* Avant tout, avertit l'utilisateur qui veut ajouter un mot-clé alors * qu'il n'est pas connecté. */ $obiwi(".ajoutmotcle_impossible").click(function() { $obiwi.jGrowl.defaults.position = "top-left"; $obiwi.jGrowl($obiwi(".EnregistrementRequis").html(), { life: 20000 }); $obiwi("a.jGrowlConnect").click(function() { $obiwi("#TopZone-Login #TopZone-Connexion").trigger("click"); }); }); /* Quatre ancres dans ce documents. On les traite en jQuery pour contourner * les sempiternels limitations et bugs de IE */ /* 1ere ancre, les commentaires. On y accède d'abord via un lien externe à cette page, * généralement depuis la home (articles les plus commentés, en cliquant sur 'xx commentaires'). * On détecte au chargement de la page s'il y a une variable GET de type ?#goto= */ var UrlVar = getURLParam("goto"); if(UrlVar) { $obiwi.scrollTo("#Commentaires", { duration: 1500, offset: {left: 0, top: -80}, onAfter: Shine("#Commentaires", 10000, "") }); } // On y accède aussi via le lien "xx commentaires" sous le titre. $obiwi(".entete a.marqueur_class").click(function() { $obiwi.scrollTo("#Commentaires", { duration: 1500, offset: {left: 0, top: -80}, onAfter: Shine("#Commentaires", 10000, "") }); }); // 2e ancre, à partir du lien 'Ajouter un mot-clé' $obiwi("#NotationPadLinks .ajoutmotcle_possible").click(function() { $obiwi.scrollTo(".AjoutMC", { duration: 1500, onAfter: Shine(".AjoutMC", 10000, ".AjoutMC input:eq(0)") }); }); // 3e ancre, 'Envoyer a un ami' $obiwi("#NotationPadLinks .LienEnvoiAmi").click(function() { $obiwi(".EnvoyerPage").show(); $obiwi.scrollTo(".EnvoyerPage", { duration: 1500, offset: {left: 0, top: -80}, onAfter: Shine(".EnvoyerPage", 10000, ".EnvoyerPage textarea:eq(0)") }); }); // 4e ancre, 'Ecrire un commentaire' (s'ils sont activés) if($obiwi("span.InvitationEcrireComment a").length) { $obiwi("span.InvitationEcrireComment a").click(function() { $obiwi.scrollTo(".EcrireCommentaire", { duration: 1500, onAfter: Shine(".EnvoyerPage", 10000, ".EcrireCommentaire textarea") }); }); } /* Fonction Shine met en surbrillance ZeObject pendant Duree et remet la couleur * de fond initiale. Met le focus sur l'objet optionnalFocus. */ function Shine(ZeObject, Duree, optionnalFocus) { $obiwi(ZeObject).effect("highlight", {color: HighlightColor}, Duree); if(optionnalFocus) $obiwi(optionnalFocus).trigger("focus"); } /* Fonction getURLParam indique le paramètre passé par variable GET */ function getURLParam(strParamName) { var strReturn = ""; var strHref = window.location.href; var bFound=false; var cmpstring = strParamName + "="; var cmplen = cmpstring.length; if (strHref.indexOf("?") > -1) { var strQueryString = strHref.substr(strHref.indexOf("?")+1); var aQueryString = strQueryString.split("#"); for (var iParam = 0; iParam < aQueryString.length; iParam++) { if (aQueryString[iParam].substr(0,cmplen)==cmpstring){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; bFound=true; break; } } } if (bFound==false) return null; return strReturn; } });