/* 2010 Alban COQUOIN */ void 0!==typeof jQuery&&function(b){b.fn.ratingSprite=function(e){function f(a,c,d){b("img",c).removeAttr("class");b.browser.msie?b("img",c).css({"background-position-x":"","background-position-y":""}):b("img",c).css("background-position","");0==a?b("img",c).addClass(d.className.empty):parseInt(a,10)!=a?(a=parseInt(a,10),b("img:gt("+(a-1)+")",c).addClass(d.className.empty),b("img:lt("+(a+1)+")",c).addClass(d.className.full),b("img:eq("+a+")",c).addClass(d.className.half)):(b("img:gt("+(a-1)+")",c).addClass(d.className.empty), b("img:lt("+a+")",c).addClass(d.className.full));b("img",c).each(function(a){var c,e;b.browser.msie?(c=parseInt(b(this).css("background-position-x"),10),e=parseInt(b(this).css("background-position-y"),10)):(c=parseInt(b(this).css("background-position").split(" ")[0],10),e=parseInt(b(this).css("background-position").split(" ")[1],10));b(this).css({"background-position":0==a%d.divide?c+"px "+(e-Math.round(parseInt(b(this).width(),10))*(a%d.divide))+"px":c-Math.round(parseInt(b(this).width(),10))*(a% d.divide)+"px "+e+"px"})})}var a=b.extend({},{note:10,divide:2,className:{empty:"",full:""},readOnly:!1,defaultValue:5,image:"/api/img/pixel.gif",callback:function(){return!1},hover:function(){return!1}},e);return this.each(function(){var g=b(this),c=a.note*Math.max(1,a.divide);e.className.empty=e.className.empty.replace(/\./gi," ");e.className.full=e.className.full.replace(/\./gi," ");e.className.half&&(e.className.half=e.className.half.replace(/\./gi," "));b(this).html("");for(var d=1;d<=c;d++){var h= b("<img />").attr({src:a.image,title:Math.round(100*(d/a.divide))/100+"/"+a.note,alt:Math.round(100*(d/a.divide))/100}).addClass(a.defaultValue*a.divide>=d?a.className.full:a.className.empty);b(this).append(h)}b("img",this).each(function(c){b(this).css("width",Math.round(b(this).width()/a.divide))});f(a.defaultValue*a.divide,this,a);a.hover(a.defaultValue);!1===a.readOnly&&(b("img",this).css("cursor","pointer").mouseenter(function(c){f(b(this).index()+1,g,a);a.hover(b(this).attr("alt"))}),b("img", this).css("cursor","pointer").mouseleave(function(c){var d=b(this).offset();0==b(this).index()&&d.left>c.pageX&&(f(0,g,a),a.hover(0))}),b(this).mouseleave(function(){a.hover(a.defaultValue);f(a.defaultValue*a.divide,g,a)}),b("img",this).click(function(){a.defaultValue=b(this).attr("alt");a.readOnly=!0;g.find("img").unbind().css("cursor","default");a.callback(b(this).attr("alt"))}))})}}(jQuery); $(document).ready(function(){$(window).on("user.loggedIn",function(){window.location.reload()});$(".quote .quote .quote").hide();$("#content .forum table").length&&$("#content .forum table").tablesorter({widgets:["zebra"]});if(0<window.location.hash.length){var b=window.location.hash.replace("#",""),c=b.indexOf(":");switch(b.substring(0,c)){case "stop":$(".topic"+b.substring(c+1)).addClass("stop").goTo();break;case "message":$("#message_total"+b.substring(c+1)).goTo()}}$(".suggest").defaultValue("Ex : Super Mario Galaxy 2...").keyup(function(){var a= $(this).val();2<a.length?$.post("/ajax.php?action=autocomplete",{key:a,mode:"forum"},function(a){$(".suggestContent").html(a).show();$(".suggestContent p:first").remove()}):$(".suggestContent").html("").hide()});$(".SAVGamesplus").live("click",function(){$("#suggestSAVGames > li").each(function(){$(".SAVGamesplus").hide();$(this).show()})});$("input",".notAssociate label").click(function(){$(this).is(":checked")?$(".suggest, .suggestContent",".newPost").hide():$(".suggest, .suggestContent",".newPost").show()}); $(".itemGame").live("click",function(a){a.preventDefault();a=$(this).attr("rel").split("|");$("label[for=suggest]").html("Jeu associ\u00e9 :");$("#id_fiche").val(a[0]);$("#redirect").val(a[4]);$("input[name=forumSupport]").val(a[3]);$(".suggestContent").addClass("choose").html("<p><img src='"+a[2]+"' alt=\""+a[1]+'" title="'+a[1]+'" /> '+a[1]+"</p> <a href='javascript:;' class='resetSuggest bleu7'>(Changer de jeu)</a></p>");$(".suggest").hide()});$(".resetSuggest").live("click",function(a){a.preventDefault(); $("label[for=suggest]").html("Veuillez choisir un jeu \u00e0 associer :");$(".suggest").show().val("").focus();$(".suggestContent").removeClass("choose").html("").hide();$("#id_fiche").val("");$("#redirect").val($("#oldForum").val());$("input[name=forumSupport]").val($("#oldForum").val())});$(".btnciter").css("cursor","pointer").click(function(){var a=$(this).attr("id").split("_");$.ajax({url:"/api/forum/ajax.php?act=citer_message",type:"POST",data:{id_message:a[1],id_sujet:a[2]},success:function(a){$("#txt").val($("#txt").val()+ (""!=$("#txt").val()?"\n":"")+a).focus();$(".block-forum-nouveau").goTo()}})});$(".btnrepondre").css("cursor","pointer").click(function(){var a=$(this).attr("id").split("_"),a=$("#message_total"+a[1]+" .message_profil_pseudo a").html();$("#txt").val($("#txt").val()+(""!=$("#txt").val()?"\n":"")+"[b]@ "+a+" :[/b]\n").focus();$(".block-forum-nouveau").goTo()});displayImgPost=function(){$("img.inpost").each(function(){var a=parseInt($(this).css("width"));if(470<a)var a="100%",b=!0;b&&$(this).css({width:a, cursor:"pointer"}).attr({rel:"facebox-gallery",rev:"Image par "+$(this).offsetParent(".message").find(".message_profil_pseudo a").text(),title:$(".block-forum-messages h2").text()})})};$(".block-video-listeVideo").length&&$("div.qtip").hover(function(){$(this).children().show();$("#container").offset().left>$(".qtipExpand",this).offset().left?($(".qtipExpand",this).addClass("right"),$(".arrowLeftTips_png",this).addClass("arrowRightTips_png").removeClass("arrowLeftTips_png")):$(".qtipExpand",this).addClass("left")}, function(){var a=$(".qtipExpand",this),b=setTimeout(function(){a.hide()},50);$(".qtipExpand",this).mouseenter(function(){clearTimeout(b)});$(".qtipExpand",this).mouseleave(function(){a.hide()})});$(".cancel_edit").click(function(a){a.preventDefault();$("#message_total"+$("#editer","#formsujet").val()+" .message").fadeTo("slow",1);$(".layoutEdit").remove();$(".newPost").removeClass("edit");$("#editer, #txt","#formsujet").val("").focus();$(".newPost .messageEditSubmit, .titreSujet").hide();$(".newPost .messageSubmit").show()}); $(".afficher_cacher_spoiler").remove();$(".spoiler").hide().before('<div class="afficher_cacher_spoiler"><img src="/api/forum/img/afficher_spoiler_off.gif" title="Attention ! Le contenu cach\u00e9 peut vous d\u00e9voiler certaines informations \u00e0 propos de ce sujet." border="0" style="cursor:pointer" /></div>').prev().click(function(){$(this).next().slideToggle("fast")});displayImgPost();setInterval(function(){return displayImgPost()},2E3)}); (function() { var fieldSelection = { getSelection: function() { var e = this.jquery ? this[0] : this; return ( ('selectionStart' in e && function() { var l = e.selectionEnd - e.selectionStart; return {start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l)}; }) || (document.selection && function() { e.focus(); var r = document.selection.createRange(); if (r == null) { return {start: 0, end: e.value.length, length: 0} } var re = e.createTextRange(); var rc = re.duplicate(); re.moveToBookmark(r.getBookmark()); rc.setEndPoint('EndToStart', re); return {start: rc.text.length, end: rc.text.length + r.text.length, length: r.text.length, text: r.text}; }) || function() { return {start: 0, end: e.value.length, length: 0}; } )(); }, replaceSelection: function() { var e = this.jquery ? this[0] : this; var text = arguments[0] || ''; return ( ('selectionStart' in e && function() { e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length); return this; }) || (document.selection && function() { e.focus(); document.selection.createRange().text = text; return this; }) || function() { e.value += text; return this; } )(); } }; jQuery.each(fieldSelection, function(i) {jQuery.fn[i] = this;}); })(); url_encode = function(plaintext) { var SAFECHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'()"; var HEX = "0123456789ABCDEF"; var encoded = ""; for (var i = 0; i < plaintext.length; i++ ) { var ch = plaintext.charAt(i); if (ch == " ") { encoded += "+"; // x-www-urlencoded, rather than %20 } else if (SAFECHARS.indexOf(ch) != -1) { encoded += ch; } else { var charCode = ch.charCodeAt(0); if (charCode > 255) { alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" + "(URL encoding only supports 8-bit characters.)\n" + "A space (+) will be substituted." ); encoded += "+"; } else { encoded += "%"; encoded += HEX.charAt((charCode >> 4) & 0xF); encoded += HEX.charAt(charCode & 0xF); } } } // for return encoded; }; //Fonction qui va tester le remplissage de tous les champs input de classe obligatoire //et lancer la fonction callback en cas de réussite (kdt) checkform = function(nom_form,callback) { var chp_non_remplis=false; var oldstyle; if($('.obligatoire','#'+nom_form)[0].tagName=='IFRAME') { callback = callback || function(){}; callback(); return true; } $('.obligatoire','#'+nom_form).each( function() { if($(this).val()=='') { $(this).addClass('obligatoire_erreur').focus(function(){$(this).removeClass('obligatoire_erreur');}); chp_non_remplis=true; } }); if(chp_non_remplis==false) { callback = callback || function(){}; callback(); return true; } else { alert("Remplissez les champs obligatoires"); return false; } }; //fonction pour v�rifier l'existance de l'utilisateur function check_user_exist(login,target) { if (login.length > 2) { $('#'+target).load('/api/forum/ajax.php?act=recherche_membre_existe',{recherche: escape(login)}); } else { $('#'+target).html(''); } } // Parse avec le BBCode function TextareaParse(obj_textarea) { var tag=new Array(); //option : 1=[url=http://...][/url], 2=[img]url[/img], 3=bbcode this.bbcode = function(bbcode_text,option) { if(typeof(document.selection)!='undefined') var nav='ie';// ie, opera else var nav='firefox';// firefox // Selection du texte en fonction du navigateur var Selection; obj_textarea=$('#txt')[0]; if(nav=='ie') { obj_textarea.focus();// SUPP crée une erreur sous ie Selection=document.selection.createRange().text; } else { var start=obj_textarea.selectionStart; var end=obj_textarea.selectionEnd; var scroll=obj_textarea.scrollTop; var textdeb=obj_textarea.value.substring(0,start); var textfin=obj_textarea.value.substring(end); Selection=obj_textarea.value.substring(start, end); } // Prompt pour demande d'url if(tag[bbcode_text]!=1 && ((option==2 && Selection=='') || option==1)) var url_prompt=prompt('Entrer l\'adresse URL :','http://'); if(option==1 && Selection=='' && url_prompt!=null) var text_prompt=prompt('Entrer le texte du lien :',''); obj_textarea.focus();// SUPP cr�e une erreur sous ie // null=si clic sur annuler, undefined si pas d�clar� if(option==1 && url_prompt==null && (tag[bbcode_text]==undefined || tag[bbcode_text]==0)) {} else if(option==3) { if(nav=='ie') document.selection.createRange().text=bbcode_text; else obj_textarea.value=textdeb+bbcode_text+textfin; obj_textarea.focus(); if(nav=='firefox') obj_textarea.setSelectionRange(textdeb.length + bbcode_text.length, textdeb.length + bbcode_text.length); } else { if(Selection!='')// Une selection : on insert toute la balise : open et close { if(nav=='ie') document.selection.createRange().text='['+bbcode_text+(url_prompt!=undefined?'='+url_prompt:'')+']'+Selection+'[/'+bbcode_text+']'; else obj_textarea.value=textdeb+'['+bbcode_text+(url_prompt!=undefined?'='+url_prompt:'')+']'+Selection+'[/'+bbcode_text+']'+textfin; obj_textarea.focus(); if(nav=='firefox') obj_textarea.setSelectionRange(textdeb.length + bbcode_text.length + 2 + (option==1?1+url_prompt.length:0), textdeb.length + bbcode_text.length + 2 + Selection.length + (option==1?1+url_prompt.length:0)); } else// pas de selection : on insert uniquement une partie : open ou close { if(tag[bbcode_text]=='undefined') tag[bbcode_text]=0;// si pas tag deja seté if(option==2 || (option==1 && text_prompt!=null))// si prompt=2 (img par exemple), ou 1 (url avec texte) { if(url_prompt!=null)// si il y a une url { if(nav=='ie') document.selection.createRange().text='['+bbcode_text+(option==1?'='+url_prompt:'')+']'+(option==1?text_prompt:url_prompt)+'[/'+bbcode_text+']'; else obj_textarea.value=textdeb+'['+bbcode_text+(option==1?'='+url_prompt:'')+']'+(option==1?text_prompt:url_prompt)+'[/'+bbcode_text+']'+textfin; // Permet de rester dans le focus actuel if(nav=='firefox') { if(option==1) obj_textarea.setSelectionRange(textdeb.length + bbcode_text.length + 3 + url_prompt.length, textdeb.length + bbcode_text.length + 3 + url_prompt.length + text_prompt.length); else obj_textarea.setSelectionRange(textdeb.length + bbcode_text.length*2 + 5 + url_prompt.length, textdeb.length + bbcode_text.length*2 + 5 + url_prompt.length); } } } else// si code normal ou prompt=1 (url) { if(tag[bbcode_text]==1)// Fermeture { if(nav=='ie') document.selection.createRange().text='[/'+bbcode_text+']'; else obj_textarea.value=textdeb+'[/'+bbcode_text+']'+textfin; tag[bbcode_text]=0; } else// Ouverture { if(nav=='ie') document.selection.createRange().text='['+bbcode_text+(option==1?'='+url_prompt:'')+']'; else obj_textarea.value=textdeb+'['+bbcode_text+(option==1?'='+url_prompt:'')+']'+textfin; tag[bbcode_text]=1; } // Permet de rester dans le focus actuel if(nav=='firefox') obj_textarea.setSelectionRange(textdeb.length + bbcode_text.length + 3 - tag[bbcode_text] + (url_prompt!=undefined?1+url_prompt.length:0), textdeb.length + bbcode_text.length + 3 - tag[bbcode_text] + (url_prompt!=undefined?1+url_prompt.length:0)); } obj_textarea.focus(); } } if(scroll) obj_textarea.scrollTop=scroll;// On retourne � la position du scroll pr�c�dent }; } // Capture le contenu pour detecter les tags function post(forum, sujet, editer, contexte, next, num_mess_pp, api_mode, nocache){ // Pour les sites utilisant les nouvelles versions de jquery - ancienne version hack� // JVFR / DECO if($(contexte).hasClass('newPost')){ nMessage = editer ? editer : ''; $.post('/api/forum/ajax.php?act=checkInsults', {content: $('#txt', contexte).val()}, function(content){ if(content == 'found'){ $.facebox.alert('<strong>Votre message contient un mot � caract�re insultant.<br />Merci de le corriger pour pouvoir publier votre message.</strong><br /><a href="/api/creer_un_compte.php"><u>En devenant membre</u></a>, vous ne serez pas soumis � ce type de filtre.', 8); }else{ if(sujet == ''){ $.facebox({url:'#formsujet .loading', titre : 'Cr�ation du sujet', close : false, closeOverlay : false}); }else{ if(editer <= 0){ $.facebox({url:'#formsujet .loading', titre : 'Ajout du message', close : false, closeOverlay : false}); } } if(editer > 0){ $.facebox({url:'#formsujet .loading', titre : 'Edition du message', close : false, closeOverlay : false}); } $.ajax({ url: '/api/forum/ajax.php?act=' + (editer != 0 ? 'editer' : 'poster') + '_message', type : 'POST', data : { sujet : sujet, txt : $('#txt', contexte).val(), titre : $('#titre', contexte).val(), contenu : $('#contenu', contexte).val(), id_fiche : $('#id_fiche', contexte).val(), type_fiche : $('#type_fiche', contexte).val(), str_codec : $('#str_codec', contexte).val(), forum : forum, note : ($("input[type=hidden][name='note']", contexte).val() != undefined ? $("input[type=hidden][name='note']", contexte).val() : ''), motcle : $('#motcle', contexte).val(), next : next, api_mode : api_mode, nocache : nocache, num_mess_pp : num_mess_pp, idmsg : nMessage, fiche : (api_mode == 'question' ? $('.question', contexte).val() : ''), redirect : $('#redirect', contexte).val(), newPost : true }, error : function(){ $.facebox.close(); $.facebox.alert('Une erreur est survenue, veuillez essayer ult�rieurement'); }, dataType : 'html', success : function(nMessage2){ nMessage = nMessage2 ? nMessage2 : nMessage; if($('#reloadComment', contexte).length){ $('#reloadComment', contexte).hide().html(nMessage2); $.facebox.close(); window.location = '#goto:commentaire'; }else{ if(sujet == ''){ window.location = $('#redirect', contexte).val() + '#stop:' + nMessage; }else{ $.get('/api/forum/ajax.php?act=urlmessage&sujet=' + sujet + '&message=' + nMessage, function(url){ setTimeout(function(){ if(document.location.pathname == url){ window.location = window.location.replace(/\#([0-9]+)/g, '#' + nMessage); window.location.reload(true); }else{ document.location.replace(url + '#' + nMessage); } }, 1500); }); } } } }); } }); }else{ // Sites utilisant une ancienne version de jquery hack avec un overdraw :p // METTRE en none les boutons et afficher le bouton griser avec anime gif pour envoi du post !!! var div=$('#message',contexte); var contenu=div.html(); if($('#txt_tmp',contexte).val()){ // si mode preview var theText=$('#txt_tmp',contexte).val(); var theTextdiv=$('#id_iframe',contexte); } else{ // si mode textarea var theText=$('#txt',contexte).val(); var theTextdiv=$('#txt',contexte); } var txt_tmp=theText;// sauvegarde le contenu var width=theTextdiv[0].offsetWidth; var height=theTextdiv[0].offsetHeight; if($('#txt').size()>0) $('#txt',contexte).val(txt_tmp);// renvoi $('#submit_mess'+(editer!=0 && api_mode?editer:'')).removeAttr('onclick');// Pour �viter les envois r�p�titifs if(api_mode=='avis_marchand') { var queries = $('#formsujet'+(editer ? editer : '')).serialize(); }else{ var queries = '&sujet='+sujet+ '&txt='+encodeURIComponent(theText)+ ($('#titre_message',contexte).val() ? '&titre_message='+encodeURIComponent($('#titre_message',contexte).val()) : '')+ ($('#id_fiche',contexte).val() ? '&id_fiche='+$('#id_fiche',contexte).val():'')+ ($('#type_fiche',contexte).val() ? '&type_fiche='+$('#type_fiche',contexte).val():'')+ ($('#source_actu',contexte).val() ? '&source_actu='+$('#source_actu',contexte).val():''); } queries += '&forum='+forum+ '&titre='+($('#titre',contexte).size()>0 ? encodeURIComponent($('#titre',contexte).val()) : '')+ '&contenu='+($('#contenu',contexte).size()>0 ? encodeURIComponent($('#contenu',contexte).val()) : '')+ '&motcle='+encodeURIComponent($('#motcle',contexte).val())+ ($("select[name='note']",contexte).val() != undefined?'¬e='+$("select[name='note']",contexte).val():'')+ ($("input[type=radio][name='note']:checked",contexte).val() != undefined?'¬e='+$("input[type=radio][name='note']:checked",contexte).val():'')+ ($("input[type=hidden][name='note']",contexte).val() != undefined?'¬e='+$("input[type=hidden][name='note']",contexte).val():'')+ (editer ? '&idmsg='+editer : '')+ (next ? '&next='+next : '')+ (api_mode ? '&api_mode='+api_mode : '')+ (api_mode=='question' ? '&fiche='+$("input[type=radio][name='forum_fiche'][checked]",contexte).val() : '')+ (nocache ? '&nocache='+nocache : '')+ (num_mess_pp ? '&num_mess_pp='+num_mess_pp : ''); $.post('/api/forum/ajax.php?act=checkInsults', {content: $('#txt', contexte).val()}, function(content){ if(content == 'found'){ if(typeof $.facebox === 'function') { $.facebox.alert('<strong>Votre message contient un mot � caract�re insultant. Merci de le corriger pour pouvoir publier votre message.</strong>', 8); } else { alert('Votre message contient un mot � caract�re insultant.\nMerci de le corriger pour pouvoir publier votre message.'); } }else{ $.ajax({ url: (editer!=0 ? '/api/forum/ajax.php?act=editer_message' : '/api/forum/ajax.php?act=poster_message'), type:'post', data : queries, error:function(XMLHttpRequest,textStatus,errorThrown) { $('#idoverdraw').html('Une erreur s\'est produite lors de l\'envoi de votre message.<br /><br /><a href=\'javascript:;\' onclick=\' $.overdraw_close();\'>Cliquer ici pour r�essayer</a>' ); }, /*dataType: 'noscript',*/ over_msg: 'Analyse <img src="/api/img/loading.gif" width="16" height="16" border="0" alt="" align="absmiddle" /><br />', over_target: '#message'+(editer!=0 && api_mode?editer:''), over_stop: '1', success: function (msg) { // @TODO : probl�me de double post sous firefox if(!$('#idoverdraw').length) { $('body').append('<div id="idoverdraw" style="display:none;"></div>'); } $('#idoverdraw').html(msg); if(editer!=0) { //le calque avec le message prend la hauteur du calque de sauvegarde du message if($('#layer_reponse'+editer).html()){ $('#message'+editer).find('.message_txt').html($('#layer_reponse'+editer).html()).css({height:'auto'}); //le calque de sauvegarde reprend une hauteur de 10 //on replace le texte correctement dans le layer du message $('#layer_reponse'+editer).css({height: '10px'}).html(' ').show(); $('body').append('<div id="layer_editer"> </div>'); } //on met � jour le texte avec la bonne valeur if(!api_mode){ $.ajax({ url: '/api/forum/ajax.php?act=message_contenu', type:'post', dataType:'json', success: function (msg) { //mise a jour du contenu $('#message'+editer).find('.message_txt').html(msg.contenu); //mise a jour du titre et du type if(sujet=='') { //faire le regex pour enlever les crochets du titre; $('#titre_titre').html(msg.titre); } if($('#clubic').length && editer){ $('blockquote div.quote blockquote', '#message' + editer).each(function(){ if($(this).prev().hasClass('moreQuote') === false){ $(this).before($('<div />').addClass('moreQuote').html('Cliquez-ici pour voir les citations précédentes').click(function(){ $(this).next('blockquote *:not(.spoiler)').show(); $(this).next('blockquote').find('*:not(.spoiler)').show(); $(this).next('blockquote').find('.moreQuote').remove(); $(this).remove(); })); } }); } }, data:'id_message='+editer+'&id_sujet='+sujet+'&html=1&is_sujet='+(sujet=='' ? 1 : 0) }); }else{ if($('#clubic').length && editer){ $('blockquote div.quote blockquote', '#message' + editer).each(function(){ if($(this).prev().hasClass('moreQuote') === false){ $(this).before($('<div />').addClass('moreQuote').html('Cliquez-ici pour voir les citations précédentes').click(function(){ $(this).next('blockquote *:not(.spoiler)').show(); $(this).next('blockquote').find('*:not(.spoiler)').show(); $(this).next('blockquote').find('.moreQuote').remove(); $(this).remove(); })); } }); } } $('img.btnciter').show(); $('img.btnrepondre').show(); $('img.btnediter').show(); $('#form_layer_fenetre_post_reponse').show(); //on rebinde les boutons avec le fonction du onready ! dans message.js: if(!api_mode){ unbind_element(); ready_message(); $('#message'+editer).Rollover().Tooltip(); } } } }); } }); } } var contexte=''; var css_path = css_path != undefined ? css_path : 'style'; // Cr�er l'apercu function preview(contexte) { if(contexte) { if($('#txt_tmp',contexte).val()!='')// si en mode preview { theIframe=$('#id_iframe',contexte); //$('.resizehandle').remove(); theTextarea=document.createElement('textarea'); theTextarea.style.width=theIframe[0].offsetWidth; theTextarea.style.height=theIframe[0].offsetHeight; theTextarea.id='txt'; theTextarea.className=theIframe[0].className; theIframe.hide(); theIframe[0].parentNode.replaceChild(theTextarea, theIframe[0]); //$('#txt').resizehandle(); textarea=new TextareaParse($('#txt',contexte)[0]);// initialisation de bbcode pour le textarea $('#bbcode',contexte).show(); $('#bbcode_smiley',contexte).show(); $('#bbcode_smiley_more',contexte).show(); $('#txt',contexte).val($('#txt_tmp',contexte).val()); $('#txt_tmp',contexte).val(''); $('#btnprevisualiser',contexte).attr('src','/forum/img/previsualiser_off.gif'); $(contexte).Rollover().Tooltip(); } else// si en mode textarea { theTextarea=$('#txt',contexte); if(theTextarea.val()!='') { $('#txt_tmp',contexte).val(theTextarea.val()); //$('.resizehandle').remove(); theIframe=document.createElement('iframe'); theIframe.style.border='0px solid #000000'; theIframe.style.marginTop='1px'; theIframe.style.marginBottom='1px'; theIframe.style.width=theTextarea[0].offsetWidth; theIframe.style.height=theTextarea[0].offsetHeight; theIframe.id='id_iframe'; theIframe.className=theTextarea[0].className; $('#id_iframe',contexte).hide(); $('#bbcode',contexte).hide(); $('#bbcode_smiley',contexte).hide(); $('#bbcode_smiley_more',contexte).hide(); theTextarea[0].parentNode.replaceChild(theIframe, theTextarea[0]); //$("#id_iframe").resizehandle(); var docTemplate="<html><head><script type='text/javascript' src='/api/js/jquery-1.8.2.min.js'></script><script type='text/javascript' src='/api/forum/message.js'></script><script src='/api/plugin_rollover.js' type='text/javascript'></script><script src='/api/plugin_tooltip.js' type='text/javascript'></script><style>BODY{background-color:#FFF;margin:0px;padding:0px;color:#000;font-size:11px;font-family:Verdana;}</style><link href='/"+(css_path ? css_path : 'style')+"/forum.css' rel='stylesheet' type='text/css'/></head><body id='iframeBody'><div class='message_txt'>INSERT:CONTENT:END</div></body></html>"; $.ajax({ url: '/api/forum/ajax.php?act=preview_message', type: 'POST', data: 'txt='+escape(theTextarea.val())+($('#desactive_smileys',contexte)>0 ? '&desactive_smileys='+$('#desactive_smileys',contexte)[0].checked : ''), success: function(msg){ docTemplate=docTemplate.replace(/INSERT:CONTENT:END/, msg); theIframe.contentWindow.document.open(); theIframe.contentWindow.document.write(docTemplate); theIframe.contentWindow.document.close(); } }); $('#btnprevisualiser',contexte).attr('src','/forum/img/editer_preview_off.gif'); $(contexte).Rollover().Tooltip(); //over_target: '#message', //over_msg: 'Pr�visualisation en cours...', } } } } function vote(id_mess,mode,id_membre,res_sujet_id_mess,api_mode) { if(mode=='supp') { $('#supp'+id_mess).css("display","none"); $('#supp_off'+id_mess).css("display","inline"); $('.message_contenu_moderer','#message_redux'+id_mess).load('/api/forum/ajax.php?act=voter_message',{ mode: mode, id_mess: id_mess, id_membre: id_membre, id_sujet_mess: res_sujet_id_mess, api_mode: api_mode }); $('#message'+id_mess).css("display","none"); $('#message_bottom'+id_mess).css("display","none"); $('#message_redux'+id_mess).css("display","block"); } else if(mode=='restaurer') { $('.message_contenu_moderer','#message_redux'+id_mess).load('/api/forum/ajax.php?act=voter_message',{ mode: mode, id_mess: id_mess, id_membre: id_membre, id_sujet_mess: res_sujet_id_mess, api_mode: api_mode }); $('#message'+id_mess).css("display","block"); $('#message_bottom'+id_mess).css("display","block"); $('#message_redux'+id_mess).css("display","none"); } else if(mode=='up' || mode=='down') { $('#up'+id_mess).css("display","none"); $('#up_off'+id_mess).css("display","inline"); if($('#down'+id_mess)>0) { $('#down'+id_mess).css("display","none"); $('#down_off'+id_mess).css("display","inline"); } if($('#supp'+id_mess)) { $('#supp'+id_mess).css("display","none"); $('#supp_off'+id_mess).css("display","inline"); } if(mode!='down') { $.ajax({ url: '/api/forum/ajax.php?act=voter_message', data: { mode: mode, id_mess: id_mess, id_membre: id_membre, id_sujet_mess: res_sujet_id_mess, api_mode: api_mode }, over_msg: 'Envoi...', over_target: '#message_vote'+id_mess, success: function (msg) { if(api_mode && msg) alert(msg); else $('#idoverdraw').append(msg); } }); } else $('#vote').css("display","none"); } } jQuery.extend({ upload_ugc: function(options){ var settings = $.extend({ width: 760, height: 560, cible: '#txt', titre: 'Photos', url: true, align: true, size: true, upload: true }, options); if(settings.url == true && ($(settings.cible).get(0).tagName.toLowerCase() == 'textarea' || $(settings.cible).get(0).tagName.toLowerCase() == 'input') && $(settings.cible).getSelection().length > 0){ $(settings.cible).replaceSelection('[img]' + $(settings.cible).getSelection().text + '[/img]'); } else { $.facebox({ titre: settings.titre, height: 400, url:'/api/forum/photo.php?' + $.param(settings) }); } return false; } }); $(document).ready(function(){ $('.message_light textarea.obligatoire').focus(function() { if($('.message_light textarea.obligatoire').val() == "�crivez votre commentaire ici...") { $('.message_light textarea.obligatoire').val(''); } }); }); $(document).ready(function(){ if($('#clubic').length){ $('blockquote div.quote blockquote').each(function(){ if($(this).prev().hasClass('moreQuote') === false){ $(this).before($('<div />').addClass('moreQuote').html('Cliquez-ici pour voir les citations précédentes').click(function(){ $(this).next('blockquote *:not(.spoiler)').show(); $(this).next('blockquote').find('*:not(.spoiler)').show(); $(this).next('blockquote').find('.moreQuote').remove(); $(this).remove(); })); } }); } }); $(document).ready(function() { var selecteurAttente = '.header .block-infos-right .attente'; $.each($(selecteurAttente), function(index, val) { var c = Utils.getCookie('attente_jeu_' + $(val).find('.idJeu').val()); if (c != null) { // Si l'utilisateur � d�j� donn� son niveau d'attente $(val).find("input[name='input_attente'][value=" + c + "]").attr('checked', 'checked'); $(val).find("input[name='input_attente']").attr('disabled', 'disabled'); } else { $(val).find("input[name='input_attente']").removeAttr('disabled').removeAttr('checked'); // On est sur le niveau d'attente et dans les widgets $(val).find(".widget .attente_internaute_form input[type='radio']").live('click', function() { $(this).closest('form').trigger('submit'); return false; }); $(val).find('.attente_internaute_form input[type=radio]').click(function() { $(this).closest('form').trigger('submit'); }); $(val).find('.attente_internaute_form').submit(function() { if(typeof $(val).find("input[name='input_attente']:checked").val() == 'undefined'){ $.facebox.alert("Veuillez choisir un niveau d'attente !"); }else{ var note = $(val).find("input[name='input_attente']:checked").val(); $.ajax({ url: $(this).attr('action'), type: 'post', data: { idJeu: $(val).find('.idJeu').val(), note: note, type: 'attente' }, success: function(){ $(val).find("input[name='input_attente']").attr('disabled', 'disabled'); $.facebox({ url : '/api/membre/facebox.post.attente.php', //titre : (note == '1' ? 'Souhaitez-vous recevoir les alertes de ce jeu ?' : 'Pourquoi n\'attendez-vous pas ce jeu ?'), titre : 'Pourquoi ' + ($(val).find("input[name='input_attente']:checked").val() == 1 ? 'attendez-vous' : 'vous n\'attendez pas') + ' ce jeu ?', post : { id : $(val).find('.idJeu').val(), type : 'fiche jeux', note : note, forum : $('#forumJeu').val() } }); } }); } return false; }); } }); $('.donner_son_avis a').click(function() { $.facebox({ url: '/ajax.php?action=donner_votre_avis', post: {idJeu: $('#infosJeux .id').attr('rel')}, titre: 'Donner votre avis sur ' + $('#infosJeux').attr('rel'), width: '500' }); return false; }); if( $('.header .bloc_header.preview ').length == 0 ){ var cadrePlus = $('.bloc_header').eq(0), cadreMoins = $('.bloc_header').eq(1); if(cadrePlus.outerHeight() > cadreMoins.outerHeight()) { cadreMoins.css('height',cadrePlus.outerHeight()+'px'); }else{ cadrePlus.css('height',cadreMoins.outerHeight()+'px'); } } }); "undefined"==typeof[].arrayUnique&&(Array.prototype.arrayUnique=function(){for(var a=[],b=0,d=0;b<this.length;b++){for(var c=0;c<a.length&&this[b]!=a[c];c++);c==a.length&&(a[d++]=this[b])}return a});var tabrollover=[]; (function(a){a.fn.Rollover=function(){a(this).find("img.rollover").hover(function(){"off.gif"==a(this).attr("src").substring(a(this).attr("src").lastIndexOf(".")-3,a(this).attr("src").lastIndexOf(".")+6)&&a(this).attr("src",a(this).attr("src").substring(0,a(this).attr("src").lastIndexOf(".")-3)+"on.gif")},function(){"on.gif"==a(this).attr("src").substring(a(this).attr("src").lastIndexOf(".")-2,a(this).attr("src").lastIndexOf(".")+6)&&a(this).attr("src",a(this).attr("src").substring(0,a(this).attr("src").lastIndexOf(".")- 2)+"off.gif")}).each(function(){tabrollover.push(a(this).attr("src").substring(0,a(this).attr("src").lastIndexOf(".")-3)+"on.gif")});a.each(tabrollover.arrayUnique(),function(b,d){a("<img>").attr("src",d)});return this}})(jQuery);$(document).ready(function(){$("body").Rollover()}); (function(b){b.extend({tablesorter:new function(){function a(c,a){l(c+","+((new Date).getTime()-a.getTime())+"ms")}function l(c){"undefined"!=typeof console&&"undefined"!=typeof console.debug?console.log(c):alert(c)}function h(c,a){if(c.config.debug)var e="";var f=c.tBodies[0].rows;if(c.tBodies[0].rows[0])for(var d=[],f=f[0].cells,C=f.length,k=0;k<C;k++){var p=!1;b.metadata&&b(a[k]).metadata()&&b(a[k]).metadata().sorter?p=r(b(a[k]).metadata().sorter):c.config.headers[k]&&c.config.headers[k].sorter&& (p=r(c.config.headers[k].sorter));if(!p)a:{for(var p=c,m=f[k],n=q.length,u=1;u<n;u++)if(q[u].is(b.trim(y(p.config,m)),p,m)){p=q[u];break a}p=q[0]}c.config.debug&&(e+="column:"+k+" parser:"+p.id+"\n");d.push(p)}c.config.debug&&l(e);return d}function r(c){for(var a=q.length,b=0;b<a;b++)if(q[b].id.toLowerCase()==c.toLowerCase())return q[b];return!1}function t(c){if(c.config.debug)var g=new Date;for(var e=c.tBodies[0]&&c.tBodies[0].rows.length||0,f=c.tBodies[0].rows[0]&&c.tBodies[0].rows[0].cells.length|| 0,d=c.config.parsers,l={row:[],normalized:[]},k=0;k<e;++k){var p=c.tBodies[0].rows[k],m=[];l.row.push(b(p));for(var n=0;n<f;++n)m.push(d[n].format(y(c.config,p.cells[n]),c,p.cells[n]));m.push(k);l.normalized.push(m)}c.config.debug&&a("Building cache for "+e+" rows:",g);return l}function y(c,a){if(!a)return"";var e="";return e="simple"==c.textExtraction?a.childNodes[0]&&a.childNodes[0].hasChildNodes()?a.childNodes[0].innerHTML:a.innerHTML:"function"==typeof c.textExtraction?c.textExtraction(a):b(a).text()} function w(c,g){if(c.config.debug)var e=new Date;for(var f=g.row,d=g.normalized,l=d.length,k=d[0].length-1,p=b(c.tBodies[0]),m=[],n=0;n<l;n++)if(m.push(f[d[n][k]]),!c.config.appender)for(var h=f[d[n][k]],q=h.length,s=0;s<q;s++)p[0].appendChild(h[s]);c.config.appender&&c.config.appender(c,m);m=null;c.config.debug&&a("Rebuilt table:",e);x(c);setTimeout(function(){b(c).trigger("sortEnd")},0)}function D(c){if(c.config.debug)var g=new Date;for(var e=0;e<c.tHead.rows.length;e++);$tableHeaders=b("thead th", c);$tableHeaders.each(function(a){this.count=0;this.column=a;var d=c.config.sortInitialOrder;this.order=i="Number"!=typeof d?"desc"==d.toLowerCase()?1:0:1==d?d:0;d=b.metadata&&!1===b(this).metadata().sorter?!0:!1;d||(d=c.config.headers[a]&&!1===c.config.headers[a].sorter?!0:!1);d&&(this.sortDisabled=!0);this.sortDisabled||b(this).addClass(c.config.cssHeader);c.config.headerList[a]=this});c.config.debug&&(a("Built headers:",g),l($tableHeaders));return $tableHeaders}function x(a){for(var b=a.config.widgets, e=b.length,f=0;f<e;f++)z(b[f]).format(a)}function z(a){for(var b=v.length,e=0;e<b;e++)if(v[e].id.toLowerCase()==a.toLowerCase())return v[e]}function E(a,b){for(var e=b.length,f=0;f<e;f++)if(b[f][0]==a)return!0;return!1}function A(a,g,e,f){g.removeClass(f[0]).removeClass(f[1]);var d=[];g.each(function(a){this.sortDisabled||(d[this.column]=b(this))});a=e.length;for(g=0;g<a;g++)d[e[g][0]].addClass(f[e[g][1]])}function F(a,g){if(a.config.widthFixed){var e=b("<colgroup>");b("tr:first td",a.tBodies[0]).each(function(){e.append(b("<col>").css("width", b(this).width()))});b(a).prepend(e)}}function B(c,b,e){if(c.config.debug)var f=new Date;for(var d="var sortWrapper = function(a,b) {",l=b.length,k=0;k<l;k++)var p=b[k][0],m=b[k][1],n="e"+k,d=d+("var "+n+" = "+("text"==c.config.parsers[p].type?0==m?"sortText":"sortTextDesc":0==m?"sortNumeric":"sortNumericDesc")+"(a["+p+"],b["+p+"]); "),d=d+("if("+n+") { return "+n+"; } "),d=d+"else { ";k=e.normalized[0].length-1;d+="return a["+k+"]-b["+k+"];";for(k=0;k<l;k++)d+="}; ";d+="return 0; }; ";eval(d);e.normalized.sort(sortWrapper); c.config.debug&&a("Sorting on "+b.toString()+" and dir "+m+" time:",f);return e}var q=[],v=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:!1,cancelSelection:!0,sortList:[],headerList:[],dateFormat:"us",decimal:".",debug:!1};this.benchmark=a;this.construct=function(a){return this.each(function(){if(this.tHead&& this.tBodies){var g,e,f,d;this.config={};d=b.extend(this.config,b.tablesorter.defaults,a);g=b(this);e=D(this);this.config.parsers=h(this,e);f=t(this);var l=[d.cssDesc,d.cssAsc];F(this);e.click(function(a){g.trigger("sortStart");var c=g[0].tBodies[0]&&g[0].tBodies[0].rows.length||0;if(!this.sortDisabled&&0<c){b(this);c=this.column;this.order=this.count++%2;if(a[d.sortMultiSortKey])if(E(c,d.sortList))for(a=0;a<d.sortList.length;a++){var m=d.sortList[a],n=d.headerList[m[0]];m[0]==c&&(n.count=m[1],n.count++, m[1]=n.count%2)}else d.sortList.push([c,this.order]);else{d.sortList=[];if(null!=d.sortForce){m=d.sortForce;for(a=0;a<m.length;a++)m[a][0]!=c&&d.sortList.push(m[a])}d.sortList.push([c,this.order])}setTimeout(function(){A(g[0],e,d.sortList,l);w(g[0],B(g[0],d.sortList,f))},1);return!1}}).mousedown(function(){if(d.cancelSelection)return this.onselectstart=function(){return!1},!1});g.bind("update",function(){this.config.parsers=h(this,e);f=t(this)}).bind("sorton",function(a,c){b(this).trigger("sortStart"); d.sortList=c;for(var g=d.sortList,n=this.config,h=g.length,s=0;s<h;s++){var q=g[s],r=n.headerList[q[0]];r.count=q[1];r.count++}A(this,e,g,l);w(this,B(this,g,f))}).bind("appendCache",function(){w(this,f)}).bind("applyWidgetId",function(a,c){z(c).format(this)}).bind("applyWidgets",function(){x(this)});b.metadata&&(b(this).metadata()&&b(this).metadata().sortlist)&&(d.sortList=b(this).metadata().sortlist);0<d.sortList.length&&g.trigger("sorton",[d.sortList]);x(this)}})};this.addParser=function(a){for(var b= q.length,e=!0,f=0;f<b;f++)q[f].id.toLowerCase()==a.id.toLowerCase()&&(e=!1);e&&q.push(a)};this.addWidget=function(a){v.push(a)};this.formatFloat=function(a){a=parseFloat(a);return isNaN(a)?0:a};this.formatInt=function(a){a=parseInt(a);return isNaN(a)?0:a};this.isDigit=function(a,g){return RegExp("^(((\\d{1,3})(\\s\\d{3})*)|(\\d+))(\\"+g.decimal+"\\d+)?$").test(b.trim(a))};this.clearTableBody=function(a){b.browser.msie?function(){for(;this.firstChild;)this.removeChild(this.firstChild)}.apply(a.tBodies[0]): a.tBodies[0].innerHTML=""}}});b.fn.extend({tablesorter:b.tablesorter.construct});var h=b.tablesorter;h.addParser({id:"text",is:function(a){return!0},format:function(a){return b.trim(a.toLowerCase())},type:"text"});h.addParser({id:"digit",is:function(a,l){return b.tablesorter.isDigit(a,l.config)},format:function(a){return b.tablesorter.formatFloat(a.replace(/\s/,""))},type:"numeric"});h.addParser({id:"currency",is:function(a){return/^[\u00a3$\u20ac?.]/.test(a)},format:function(a){return b.tablesorter.formatFloat(a.replace(RegExp(/[^0-9.]/g), ""))},type:"numeric"});h.addParser({id:"ipAddress",is:function(a){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(a)},format:function(a){a=a.split(".");for(var l="",h=a.length,r=0;r<h;r++)var t=a[r],l=2==t.length?l+("0"+t):l+t;return b.tablesorter.formatFloat(l)},type:"numeric"});h.addParser({id:"url",is:function(a){return/^(https?|ftp|file):\/\/$/.test(a)},format:function(a){return jQuery.trim(a.replace(RegExp(/(https?|ftp|file):\/\//),""))},type:"text"});h.addParser({id:"isoDate",is:function(a){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)}, format:function(a){return b.tablesorter.formatFloat(""!=a?(new Date(a.replace(RegExp(/-/g),"/"))).getTime():"0")},type:"numeric"});h.addParser({id:"percent",is:function(a){return/\%$/.test(b.trim(a))},format:function(a){return b.tablesorter.formatFloat(a.replace(RegExp(/%/g),""))},type:"numeric"});h.addParser({id:"usLongDate",is:function(a){return a.match(RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(a){return b.tablesorter.formatFloat((new Date(a)).getTime())}, type:"numeric"});h.addParser({id:"shortDate",is:function(a){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(a)},format:function(a,l){var h=l.config;a=a.replace(/\-/g,"/");if("us"==h.dateFormat)a=a.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");else if("uk"==h.dateFormat)a=a.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");else if("dd/mm/yy"==h.dateFormat||"dd-mm-yy"==h.dateFormat)a=a.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");return b.tablesorter.formatFloat((new Date(a)).getTime())}, type:"numeric"});h.addParser({id:"time",is:function(a){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(a)},format:function(a){return b.tablesorter.formatFloat((new Date("2000/01/01 "+a)).getTime())},type:"numeric"});h.addParser({id:"metadata",is:function(a){return!1},format:function(a,l,h){a=l.config;a=!a.parserMetadataName?"sortValue":a.parserMetadataName;return b(h).metadata()[a]},type:"numeric"});h.addWidget({id:"zebra",format:function(a){if(a.config.debug)var h=new Date; b("tr:visible",a.tBodies[0]).filter(":even").removeClass(a.config.widgetZebra.css[1]).addClass(a.config.widgetZebra.css[0]).end().filter(":odd").removeClass(a.config.widgetZebra.css[0]).addClass(a.config.widgetZebra.css[1]);a.config.debug&&b.tablesorter.benchmark("Applying Zebra widget",h)}})})(jQuery); /** * Autocomplete */ $(document).ready(function(){ var sav = { init : function init(){ $('#category').change(function() { $('#titreQuestionSAV').val($(this).val()); }); $('#buttonAskQuestion').live('click', function(e) { $.facebox.close(); $.facebox({ url: '/sav/askQuestion.php', post: { id_jeu : $('#idJeuHidden').val(), titre : $('#titreQuestionSAV').val()/*, anonyme : (!getCookie('nfuserid') ? true : false)*/ }, titre: $('#titreQuestionSAV').val(), id: 'askQuestion' }); }); $('#suggestbtn input').live('click', function(e) { e.preventDefault(); var idJeu = $('#idJeuHidden').val() != '' ? parseInt($('#idJeuHidden').val()) : 0, support = $('#supportForumHidden').val(), titreQuestion = $('#titreQuestionSAV').val(), errorCss = {'color' : '#F43D3D', 'text-shadow' : '0 0 2px #000'}, errorDie = false; Encoder.EncodeType = "entity"; titreQuestion = Encoder.htmlEncode(titreQuestion); $('#anonymeEmail label, #textAcceptQuestion, #zoneTitreJeu label, label[for=titreQuestion]').css({'color':'#FFF','text-shadow':'none'}); if(idJeu <= 0 || $('#idJeuHidden').val() == ''){ $('#zoneTitreJeu label').css(errorCss); errorDie = true; } if(titreQuestion.length <= 3){ $('label[for=titreQuestion]').css(errorCss); errorDie = true; } if($('#acceptQuestion').attr('checked') == false){ $('#textAcceptQuestion').css(errorCss); errorDie = true; } if ($('#anonymePost').is(':visible')){ if ($('#acceptEmail').attr('checked') && !/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test($('#anonymeEmailInput').val())) { $('#anonymeEmail label').css(errorCss); errorDie = true; } } $.post('/api/forum/ajax.php?act=checkInsults', { content: titreQuestion }, function(content){ if(content == 'found'){ $.facebox.alert('<strong>Votre message contient un mot � caract�re insultant.<br />Merci de le corriger pour pouvoir publier votre message.</strong><br /><a href="/api/creer_un_compte.php" style="color:#016683 !important"><u>En devenant membre</u></a>, vous ne serez pas soumis � ce type de filtre.', 8); }else{ if (errorDie == false && idJeu > 0 && support.length > 0 && titreQuestion.length > 3) { $.facebox({ url: '/sav/searchQuestion.php', post: { id_jeu : idJeu, displayall : true, titre : titreQuestion, question: true }, titre: 'R�sultats de la recherche' }); } } }); }); } }; sav.init(); $('#titreJeuSAV').keyup(function(){ var keys = $(this).val(), i = 0; if(keys.length > 2){ $.ajax({ url: '/ajax.php?action=autocomplete', type: 'POST', data: { key : keys, mode : 'sav' }, success: function(res){ $('#suggestSAVGame').html(res).show(); } }); }else{ $('#suggestSAVGame').html('').hide(); $('#selectedSAVGame').html(''); $('#supportForumHiddenn #idJeuHidden').val(''); } }); $('.SAVGamesplus').live('click', function(){ $('#suggestSAVGames > li').each(function(){ $('.SAVGamesplus').hide(); $(this).show(); }); }); $('.itemGame').live('click', function() { var tmp = $(this).attr('rel').split('|'); $('#idJeuHidden').val(tmp[0]); $('#supportForumHidden').val(tmp[3]); $('#selectedSAVGame').html('<img src="'+tmp[2].replace('"', '\\"')+'" alt="'+tmp[1]+'" /><p>'+tmp[1]+'</p><a href="#" id="changeSAVGame">(Changer de jeu)</a>'); $('#suggestSAVGame').html('').hide(); $('#zoneTitreJeu').hide(); return false; }); $('#changeSAVGame').live('click', function() { $('#selectedSAVGame').html(''); $('#idJeuHidden, #supportForumHidden').val(''); $('#zoneTitreJeu').show(); $('input#titreJeuSAV').val('').focus(); return false; }); $('#formSAV').submit(function(){ checkSavForm(); return false; }); $('#btnSearchTips').live('click', function() { checkSavSearch(); return false; }); }); function checkSavForm(){ } function checkSavSearch(){ var errorDie = false; var idJeu = $('#idJeuHidden').val() != '' ? parseInt($('#idJeuHidden').val()) : 0; var support = $('#supportForumHidden').val(), text = $('#searchTips').val(); if(idJeu <= 0 || idJeu == ''){ errorDie = true; } if(text.length <= 3){ errorDie = true; //$.facebox.alert('<strong>Votre message contient un mot � caract�re insultant.<br />Merci de le corriger pour pouvoir publier votre message.</strong><br /><a href="/api/creer_un_compte.php" style="color:#016683 !important"><u>En devenant membre</u></a>, vous ne serez pas soumis � ce type de filtre.', 8); } if (errorDie == false && idJeu > 0 && support.length > 0 ) { $.facebox({url: '/sav/searchQuestion.php',post: { id_jeu: $('#idJeuHidden').val(), displayall : true, titre: text},titre: 'R�sultats de la recherche'}); } } function refreshBlockSolved(page, id_jeu, filterSelectedSubjets){ $.ajax({ url: '/ajax.php?action=refreshBlockSolved', type: 'POST', data: { page: page, id_jeu: id_jeu, selected : filterSelectedSubjets }, success: function(contenu2){ tmpDiv = filterSelectedSubjets ? '#selectedQuestion' : '#solvedQuestion'; $(tmpDiv).html(contenu2); $(tmpDiv).goTo(); } }); } function refreshBlockUnsolved(page, id_jeu){ $.ajax({ url: '/ajax.php?action=refreshBlockUnsolved', type: 'POST', data: { page: page, id_jeu: id_jeu }, success: function(contenu2){ $('#unsolvedQuestion').html(contenu2); $('#unsolvedQuestion').goTo(); } }); } $(document).ready(function(){(function(){getCookie("nfuserid")||($("#anonymeLoginInput").defaultValue("Anonyme"),$("#anonymePost").show());$(document).delegate("#boutonEnvoisQuestion","click",function(){var c=$.trim($("#titreQuestionSAV").val()),e=$.trim($("#detailsQuestion").val()),d=$("#supportForumHidden").val(),a=!1,f={color:"#F43D3D","text-shadow":"0 0 2px #000"};$("#acceptEmail").attr("checked");var h=$("#acceptEmail").attr("checked")||getCookie("nfuserid")?"true":"false",k=getCookie("nfuserid")? "":$("#anonymeLoginInput").val(),l=getCookie("nfuserid")||""==$("#anonymeEmailInput").val()?"":$("#anonymeEmailInput").val(),m=getCookie("nfuserid")?!1:!0,b=""!=$("#idJeuHidden").val()?parseInt($("#idJeuHidden").val()):0;$("#anonymePost").is(":visible")&&$("#acceptEmail").attr("checked")&&!/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test($("#anonymeEmailInput").val())&&($("#anonymeEmail label").css(f),a=!0);0==$("#acceptQuestion2").attr("checked")&&($("#textAcceptQuestion2 label").css(f), a=!0);if(0==a){$.facebox.startLoading();var g=d+":fiche jeux:"+b;$.ajax({url:"/api/forum/ajax.php?act=poster_message",type:"POST",dataType:"html",data:{api_mode:"question",titre:c,txt:e,forum:d,fiche:g,id_fiche:b,type_fiche:"fiche jeux",redirect:"true",anonyme:m,notify:h,pseudo:k,email:l},success:function(a){Utils.setCookie("questionSavId",a,Utils.strtotime("+10 min"),"/",".jeuxvideo.fr");$.ajax({url:"/ajax.php?action=finQuestionSav",type:"POST",data:{titre:c,forum:d,fiche:g,id_fiche:b,type_fiche:"fiche jeux"}, success:function(){Utils.setCookie("questionSavTitre",b+"-"+c,Utils.strtotime("+5 min"),"/",".jeuxvideo.fr");Utils.setCookie("questionSavMessage",e,Utils.strtotime("+5 min"),"/",".jeuxvideo.fr");window.location="/sav/question-enregistree"}})}})}})})()}); Collection=function(a){this.initialize(a)}; Collection.prototype={id_user:0,games:[],callbacks:null,initialize:function(a){this.id_user=a;this.callbacks=new Collection_Callbacks(this)},setGames:function(a){for(var b in a)if("function"!=typeof a[b]){var c=new Collection_Game(this,a[b]);c instanceof Collection_Game&&0!=c.id&&this.pushGame(c)}},load:function(a,b){if(this.logged()){"number"!=typeof a&&(a=-1);typeof b!=typeof $.noop&&(b=$.noop);var c=this;$.post("/ajax.php?action=collection-load",{id_user:this.id_user,partial:a},function(a){a.error|| c.setGames(a.games);b.call(this,""!==a.error)},"json")}},addGame:function(a,b){typeof b!=typeof $.noop&&(b=$.noop);var c=this;$.post("/ajax.php?action=collection-add",{id:a,id_user:this.id_user},function(a){a.error?b.call(this,!1,a.error):(a=new Collection_Game(c,a.game),c.pushGame(a),c.callbacks.execute("add",a),b.call(this,!0))},"json")},pushGame:function(a){var b=this;a.onRemove(function(a){var d=b.indexOf(a.datas.id);delete b.games[d];b.games.splice(d,1);b.callbacks.execute("remove",a)});this.callbacks.execute("push", a);this.games.push(a)},exists:function(a){for(var b in this.games)if(this.games[b].datas&&this.games[b].datas.id==a)return!0;return!1},indexOf:function(a){for(var b in this.games)if(this.games[b].datas.id==a)return b;return-1},logged:function(){return 0<this.id_user},onPush:function(a){this.callbacks.add("push",a)},onAdd:function(a){this.callbacks.add("add",a)},onRemove:function(a){this.callbacks.add("remove",a)}};Collection_Game=function(a,b){this.initialize(a,b)}; Collection_Game.prototype={callbacks:null,collection:null,datas:null,initialize:function(a,b){if(!1===a instanceof Collection)throw"Collection_Game.initialize() : collection is not a Collection object";this.callbacks=new Collection_Callbacks(this);this.collection=a;this.datas=b},setDatas:function(a){this.datas=a;return this},load:function(){var a=this;$.post("/ajax.php?action=collection-game",{id:this.datas.id,id_user:this.collection.id_user},function(b){b.error?alert(b.error):(a.datas=b,a.callbacks.execute("change"))}, "json");return this},change:function(a,b){typeof b!=typeof $.noop&&(b=$.noop);if(a==this.datas.id)b.call(this,!1);else{var c=this;$.post("/ajax.php?action=collection-change",{id_user:this.collection.id_user,old:this.datas.id,"new":a},function(a){a.error?(alert(a.error),b.call(this,!1)):(b.call(this,!0),c.datas=a.game,c.callbacks.execute("change"))},"json");return this}},note:function(a,b){typeof b!=typeof $.noop&&(b=$.noop);var c=this;$.post("/ajax.php?action=collection-note",{id_user:this.collection.id_user, id_jeu:this.datas.id,note:a},function(a){a.error?(alert(a.error),b.call(this,!1)):(b.call(this,!0),c.datas=a.game)},"json");return this},remove:function(){var a=this;$.post("/ajax.php?action=collection-remove",{id:this.datas.id,id_user:this.collection.id_user},function(b){b.error?alert(b.error):a.callbacks.execute("remove",a)},"json");return this},onChange:function(a){this.callbacks.add("change",a)},onRemove:function(a){this.callbacks.add("remove",a)}};Collection_Callbacks=function(a){this.initialize(a)}; Collection_Callbacks.prototype={context:null,callbacks:null,initialize:function(a){"undefined"==typeof a&&(a=this);this.context=a;this.callbacks={}},add:function(a,b){"undefined"==typeof this.callbacks[a]&&(this.callbacks[a]=[]);this.callbacks[a].push(b)},execute:function(a){if("undefined"!=typeof this.callbacks[a]){for(var b=[],c=0;c<arguments.length;c++)0<c&&b.push(arguments[c]);for(c in this.callbacks[a])this.callbacks[a][c].apply(this.context,b)}}}; Collection_Btn=function(a){this.initialize(a)};Collection_Btn.collection=null;Collection_Btn.ready=!1;Collection_Btn.instances=[]; Collection_Btn.prototype={$:null,datas:null,supports:null,members:null,loading:!1,opened:!1,disabled:!1,initialize:function(a){Collection_Btn.instances.push(this);this.checkCollection();this.datas=a;this.members=new Collection_Btn_Members(this);this.render()},checkCollection:function(){null===Collection_Btn.collection&&(Collection_Btn.collection=new Collection(Utils.getCookie("nfuserid")),Collection_Btn.collection.loading=!1);!Collection_Btn.collection.logged()||Collection_Btn.ready||Collection_Btn.collection.loading|| (Collection_Btn.collection.loading=!0,Collection_Btn.collection.load(0,function(a){for(var b in Collection_Btn.instances)Collection_Btn.ready=!0,Collection_Btn.collection.loading=!1,"function"===typeof Collection_Btn.instances[b].update&&Collection_Btn.instances[b].update()}))},add:function(a){if(!this.disabled&&!this.loading){var b=this;Collection_Btn.collection.logged()?(this.load(),Collection_Btn.collection.addGame(a,function(a,d){b.load(!0);a?b.thanks():b.error(d)})):$.facebox({url:"/api/membre/facebox.login.php", titre:"Vous devez vous connecter",callbacks:{success:function(){Collection_Btn.collection.id_user=Utils.getCookie("nfuserid");b.checkCollection();b.add(a);$.facebox.close()}}})}},error:function(a){if(!this.disabled&&!this.loading){var b=this,c=this.$.find(".btn"),d=c.text();this.disable();this.$.addClass("error");c.text(a);setTimeout(function(){c.text(d);b.$.removeClass("error");b.enable()},3E3)}},toggle:function(){this.opened?this.close():this.open()},open:function(){this.disabled||this.loading|| this.opened||(this.$.addClass("opened"),this.opened=!0)},close:function(){this.opened&&(this.$.removeClass("opened"),this.opened=!1)},load:function(a){"boolean"==typeof a&&a&&this.loading?(this.$.removeClass("loading"),this.loading=!1):this.loading||(this.$.addClass("loading"),this.loading=!0)},enable:function(){this.disabled&&!this.loading&&(this.$.removeClass("disabled"),this.disabled=!1)},disable:function(){this.disabled||this.loading||(this.close(),this.$.addClass("disabled"),this.disabled=!0)}, thanks:function(){if(!this.disabled&&!this.loading){this.disable();this.$.find(".btn").text("Ajout\u00e9");this.$.find(".count .txt").text(this.datas.count+"+1");var a=this;setTimeout(function(){a.$.find(".btn").text("G\u00e9rer ma collection").unbind("click").click(function(a){window.location="/forum/profil.php"});a.renderCount(parseInt(a.datas.count)+1)},3E3)}},exists:function(){this.disabled||this.loading||(this.disable(),this.$.find(".btn").text("D\u00e9j\u00e0 ajout\u00e9").unbind("click").click(function(a){window.location= "/forum/profil.php"}))},update:function(){if(Collection_Btn.ready&&Collection_Btn.collection.logged())if(1<this.datas.supports.length)for(var a in this.datas.supports){if(Collection_Btn.collection.exists(this.datas.supports[a].id)){this.exists();break}}else Collection_Btn.collection.exists(this.datas.supports[0].id)&&this.exists()},render:function(){var a;a='<div class="collection-btn">\t<a class="btn" href="javascript:;">Ajouter \u00e0 ma collection</a>';a+='\t<div class="bull count">';a+='\t\t<div class="arrow"></div>'; a+='\t\t<div class="txt">'+this.datas.count+"</div>";a+="\t</div>";a+='\t<div class="bull loading">';a+='\t\t<div class="arrow"></div>';a+='\t\t<div class="txt"> </div>';a+="\t</div>";a+="</div>";this.$=$(a);this.renderCount(this.datas.count);var b=this;$(document).click(function(a){$(a.target).closest(".collection-btn").length||b.close()});1<this.datas.supports.length?(this.supports=new Collection_Btn_Supports(this.datas.supports),this.supports.onClick=function(a){b.add(b.datas.supports[a].id)}, this.$.append(this.supports.$),this.$.find(".btn").click(function(a){a.preventDefault();b.toggle()})):this.$.find(".btn").click(function(a){a.preventDefault();b.add(b.datas.supports[0].id)});this.update()},renderCount:function(a){var b=this,c=1<this.datas.count?this.datas.count+" utilisateurs poss\u00e8dent ce jeu":1==this.datas.count?"1 utilisateur poss\u00e8de ce jeu":"Aucun utilisateur poss\u00e8de ce jeu";0<a?this.$.find(".count .txt").html('<a href="javascript:;" title="'+c+'">'+a+"</a>").find("a").click(function(a){a.preventDefault(); b.members.hide();b.members.show()}):this.$.find(".count .txt").html('<span title="'+c+'">0</span>')}};Collection_Btn_Supports=function(a){this.initialize(a)}; Collection_Btn_Supports.prototype={$:null,list:null,count:0,initialize:function(a){this.list=a;this.render()},render:function(){var a;a='<div class="bull supports">\t<div class="arrow"></div>';a+='\t<div class="txt">';for(var b in this.list)a+='\t<a href="javascript:;">'+this.list[b].name+"</a>";a+="\t</div>";a+="</div>";this.$=$(a);var c=this;this.$.find("a").each(function(a){$(this).click(function(b){b.preventDefault();c.onClick(a)})})},disabled:function(){return this.count==this.list.length},disable:function(a){a= this.indexOf(a);0>a||(this.$.find(".txt > *:eq("+a+")").unbind().replaceWith("<span>"+this.list[a].name+"</span>"),this.count++)},indexOf:function(a){for(var b in this.list)if(this.list[b].id==a)return b;return-1},onClick:function(a){}};Collection_Btn_Members=function(a){this.initialize(a)}; Collection_Btn_Members.prototype={$:null,btn:null,sb:null,filters:null,shawn:!1,initialize:function(a){this.btn=a;this.filters={}},create:function(){if(null===this.$){var a=this,b;b='<div class="collection-btn-members" style="display:none">\t<div class="cbm-arrow"><span></span></div>';b+='\t<a class="cbm-close" href="javascript:;">Fermer</a>';b+='\t<div class="cbm-content"><div style="display:none">';b+='\t\t<div class="cbm-top">';b+="\t\t\t<p>Membres ayant ajout\u00e9 "+this.btn.datas.title+" \u00e0 leur collection</p>"; b+="\t\t</div>";b+='\t\t<div class="cbm-list">Chargement...</div>';b+="\t</div></div>";b+="</div>";this.$=$(b);if(1<this.btn.datas.supports.length){this.sb=new Collection_Btn_Selectbox;this.sb.setBlankField("Tous supports");this.sb.onChange=function(b){b.key?a.filters.game=b.key:"undefined"!==typeof a.filters.game&&delete a.filters.game;a.load()};for(var c in this.btn.datas.supports)b=this.btn.datas.supports[c],this.sb.fields.add(new Collection_Btn_Selectbox_Field(b.id,b.name));this.$.find(".cbm-top").prepend(this.sb.render())}this.$.appendTo(this.btn.$.find(".bull")); this.$.find(".cbm-close").click(function(b){b.preventDefault();a.hide()});$(document).click(function(b){$(b.target).closest(".collection-btn-members").length||a.hide()})}},show:function(){if(!this.shawn){this.btn.load();this.create();var a=this;this.load(1,function(b){if(b){a.btn.load(!0);a.shawn=!0;b=$(document).width();var c=a.btn.$.find(".bull"),d=c.width(),c=c.offset().left+Math.floor(d/2)+5;c<=b/2?(b=Math.max(0,(b-1E3)/2-(c-620)),a.$.find(".cbm-content").css("margin-left","-"+(600-b)+"px"),a.$.find(".cbm-close").css({right:0, left:"auto","margin-left":"0"})):(b=Math.min(0,1E3+(b-1E3)/2-(c+620)),a.$.find(".cbm-content").css("margin-left","-"+(200-b)+"px"),a.$.find(".cbm-close").css({right:"auto",left:0,"margin-left":"-"+(200-b)+"px"}));a.$.fadeIn("fast",function(){a.$.find(".cbm-content > div").slideDown("fast")});this.btn.$.find(".bull.count").css("z-index",this.btn.$.find(".bull.count").css("z-index")+1)}})}},hide:function(){this.shawn&&(this.shawn=!1,this.$.hide().find(".cbm-content > div").hide(),this.btn.$.find(".bull.count").css("z-index", this.btn.$.find(".bull.count").css("z-index")-1))},getFilters:function(){filters={games:[]};if("undefined"!==typeof this.filters.game)filters.games.push(this.filters.game);else for(var a in this.btn.datas.supports)filters.games.push(this.btn.datas.supports[a].id);return filters},load:function(a,b){"undefined"==typeof a&&(a=1);"function"!==typeof b&&(b=$.noop);var c=this,d=this.getFilters();d.page=a;$.post("/ajax.php?action=collection-members",d,function(d){d.e?$.facebox.alert(d.e,function(){b.call(c, !1)}):(d.page=a,c.render(d),b.call(c,!0))},"json")},render:function(a){var b="";0==a.t?b+='<div class="cbm-empty">Aucun membre n\'\u00e0 \u00e9t\u00e9 trouv\u00e9</div>':(b+=this.renderMembers(a.m),b+=this.renderNavigation(a.page,a.t));this.$.find(".cbm-content .cbm-list").html(b);var c=this;this.$.find(".cbm-nav a").click(function(a){a.preventDefault();c.load($(this).attr("href").substr(1))})},renderMembers:function(a){Utils.getCookie("nfusername");var b="",c;for(c in a){var d=a[c],e=/ \(moi\)$/.test(d.l); "object"==typeof d&&(b+='<div class="cbm-member"><div>',b+='\t<img src="/api/img/pixel.gif" style="background-image:url('+d.a+')" />',b+='\t<p class="l"><a href="'+d.p+'">'+d.l+"</a></p>",b+='\t<p class="s"><span></span> '+d.s+"</p>",b+='\t<p class="c"><a href="'+d.p+'">Voir '+(e?"ma":"sa")+" collection</a></p>",d.mp&&!e&&(b+='<p class="mp"><a href="'+d.mp+'">Envoyer un MP</a></p>'),b+="</div></div>")}return b+'<div class="clearer"></div>'},renderNavigation:function(a,b){a=parseInt(a);b=parseInt(b); var c=Math.ceil(b/20),d="",e=Math.max(1,Math.min(a,c-3)),c=Math.min(a+3,c);if(20<b){d+='<div class="cbm-nav">\t<b>Page :</b>';for(1<e&&(d+='<a href="#1">1</a>'+(2<a?"<b>...</b>":""));e<=c;e++)d=e==a?d+("<span>"+e+"</span>"):d+('<a href="#'+e+'">'+e+"</a>");d+="</div>"}return d}};Collection_Btn_Selectbox=function(a){this.initialize(a)};Collection_Btn_Selectbox.count=0; Collection_Btn_Selectbox.prototype={$:null,id:0,fields:null,opened:!1,disabled:!1,initialize:function(a){this.id=Collection_Btn_Selectbox.count++;this.fields=new Collection_Btn_Selectbox_Fields(a);this.$=$('<div class="cbm-selectbox cbm-selectbox'+this.id+'"></div>');var b=this;this.fields.onSelect=function(a){b.select(a)};$(document).click(function(a){$(a.target).closest(".cbm-selectbox"+b.id).length||b.close()})},onChange:function(){},enable:function(){this.disabled&&this.$.show();this.disabled= !1},disable:function(){this.disabled||this.$.hide();this.disabled=!0},toggle:function(){this.opened?this.close():this.open();return this},close:function(){this.opened&&(this.$.removeClass("open"),this.opened=!1);return this},open:function(){this.opened||(this.$.addClass("open"),this.opened=!0);return this},cancel:function(){this.fields.setCurrent(this.fields.defaut);this.$.find(".cbm-sb-selected").text(this.fields.defaut.value)},select:function(a){this.fields.setCurrent(a)&&(this.$.find(".cbm-sb-selected").text(a.value), this.onChange(a));this.close();return this},setBlankField:function(a){a=new Collection_Btn_Selectbox_Field("",a);a.blank=!0;this.fields.add(a)},setFields:function(a){this.fields.setFields(a)},addField:function(a,b){this.fields.add(new Collection_Btn_Selectbox_Field(a,b))},removeField:function(a){return this.fields.remove(a)},render:function(){var a;a='<div class="cbm-sb-arrow"><span></span></div>'+('<div class="cbm-sb-selected">'+this.fields.current.value+"</div>");this.$.html(a);this.$.append(this.fields.$); var b=this;this.$.find(".cbm-sb-arrow").click(function(){b.toggle()});return this.$}};Collection_Btn_Selectbox_Fields=function(a){this.initialize(a)}; Collection_Btn_Selectbox_Fields.prototype={$:null,fields:null,defaut:null,current:null,index:-1,initialize:function(a){this.$=$('<div class="cbm-sb-list"></div>');this.fields=[];this.setFields(a)},setFields:function(a){for(var b in a)this.add(new Collection_Btn_Selectbox_Field(b,a[b]));return this},setDefault:function(a){!1===a instanceof Collection_Btn_Selectbox_Field&&(a=this.get(a));this.current=this.defaut=a;return this},setCurrent:function(a){!1===a instanceof Collection_Btn_Selectbox_Field&& (a=this.get(a));if(!this.exists(a.key)||this.current.key==a.key)return!1;this.current=a;return!0},add:function(a){if(!this.exists(a.key)){var b=-1,c;for(c in this.fields){if(a.blank){b=-1;break}if(!this.fields[c].blank&&a.value<this.fields[c].value){b=c-1;break}b=c}0>b?this.$.prepend(a.$):a.$.insertAfter(this.fields[b].$);var d=this;a.onClick=function(a){d.onSelect(a)};null===this.defaut&&this.setDefault(a);this.push(a,b+1)}},remove:function(a){var b=this.indexOf(a);if(0>b)return!1;this.fields[b].$.remove(); delete this.fields[b];this.fields.splice(b,1);if(a==this.current.key)this.onSelect(this.fields[0]);return!0},push:function(a,b){"number"!=typeof b||0==this.fields.length?this.fields.push(a):0>b?this.fields.unshift(a):this.fields.splice(b,0,a)},get:function(a){for(var b in this.fields)if(a==this.fields[b].key)return this.fields[b];return!1},exists:function(a){"string"!=typeof a&&(a="");return 0<=this.indexOf(a)},indexOf:function(a){var b=0,c;for(c in this.fields){if(this.fields[c].key==a)return b; b++}return-1},fetch:function(){return++this.index==this.fields.length?(this.index=-1,!1):this.fields[this.index]},onSelect:function(a){}};Collection_Btn_Selectbox_Field=function(a,b){this.initialize(a,b)};Collection_Btn_Selectbox_Field.prototype={$:null,key:null,value:null,blank:!1,initialize:function(a,b){this.$=$('<a href="javascript:;" class="cbm-sb-item">'+b+"</a>");this.key=a;this.value=b;var c=this;this.$.click(function(a){a.preventDefault();c.onClick(c)})},onClick:function(a){}};