$(document).ready(function(){ //Navigation de l'Archive $("a#next_year, a#prev_year").click(change_archive_year); /*$("a.readmore").click(function(){ var more = $(this).parent().find(".textmore"); if(more.is(":visible")){ more.slideUp("slow"); }else{ more.slideDown("slow"); } });*/ $(".categories a").click(function(){ $(".categories a").removeClass("active"); $(this).addClass("active"); var choice = $(this).attr("href"); choice = choice.replace(/#/, ""); $("div.bulletin_article").each(function(){ if (choice == 'all'){ if($(this).is(":hidden")) $(this).show(); }else if($(this).is("div." + choice)){ if($(this).is(":hidden")) $(this).show(); } else{ if($(this).is(":visible")) $(this).hide(); } }); }); var choice = document.location.href; choice = choice.split("/"); nbchoice = choice.length-1; choice = choice[nbchoice].replace(/#/, ""); $("div.bulletin_article").each(function(){ if (choice == 'all'){ if($(this).is(":hidden")) $(this).show(); }else if($(this).is("div." + choice)){ if($(this).is(":hidden")) $(this).show(); } else{ if($(this).is(":visible")) $(this).hide(); } }); //Pour l'options de sélection de bulletin. disableDays(); // validation du formulaire d'inscription /*$("#form_article").validate({ event: "keyUp" }); $("textarea.richtext").tinymce(); $("textarea.richtext").each(function(){toogleEditorMode($(this).attr("id"))}); */ // validation du formulaire d'inscription $("#frm_proposition").validate({ event: "keyUp", messages: { proposition_titre: { required: "Erreur, veuillez entrer un titre.", maxLength: "Le titre doit avoir maximum 100 caractères." }, proposition_date: { required: "Erreur, veuillez sélectionner une date.", dateISO: "La date doit être dans le format (ANNÉE.MOIS.JOUR.)" }, proposition_texte: { required: "Vous avez oublié d'entrer votre texte." }, proposition_coordonnees: { required: "Entrer vos coordonnées." }, proposition_nom: { required: "Entrer votre nom." }, proposition_courriel: { required: "Entrer votre courriel.", emailUQAM: "Votre courriel est non valide." } }, submitHandler: function(form) { changeverification(); $("#frm_proposition").submit(); } }); function changeverification(){ $("#verification").val("okidou"); } //GESTION DE LA TAILLE DES IMAGES $('#frm_proposition').submit(function(event){ var file = $('#proposition_image')[0].files[0]; var size=-1; if(file !== undefined){ size = file.size/1024; } if(size > 500){ event.preventDefault(); alert("Le poids de l'image de doit pas dépasser 500Ko."); } }); }); function change_archive_year(){ var action = $(this).attr("id"); var annee = parseInt($("#annee").val()); if(action == "prev_year"){annee = annee -1;}else{annee = annee + 1;} $.post("https://bulletin-arts.uqam.ca/modules/nav_bulletin.php",{'annee':annee}, function(data){ $("#nav_bulletin").html(data); $("#next_year, #prev_year").click(change_archive_year); }); } var initAttempts = 0; function disableDays() { try { var dp = datePickerController.getDatePicker("proposition_date"); } catch(err) { if(initAttempts++ < 10) setTimeout("disableDays()", 200); return; }; var dayArr = [1,0,1,1,1,1,1]; dp.setDisabledDays(dayArr); }