1/* 2Général JS 3*/ 4 5test = true; 6 7(function () { 8 'use strict'; 9 var $window = $(window); 10 11 /*******************/ 12 /* */ 13 /* Smooth scroll */ 14 /* */ 15 /*******************/ 16 $("#nav ul li a[href^='#']").on('click', function(e) { 17 18 // prevent default anchor click behavior 19 e.preventDefault(); 20 21 // store hash 22 var hash = this.hash; 23 24 // animate 25 $('html, body').animate({ 26 scrollTop: $(hash).offset().top 27 }, 300, function(){ 28 29 // when done, add hash to url 30 // (default click behaviour) 31 window.location.hash = hash; 32 }); 33 34 }); 35 36 37 /**************/ 38 /* */ 39 /* lightbox */ 40 /* */ 41 /**************/ 42 43 /*$(document).delegate('*[data-toggle="lightbox"]', 'click', function(event) { 44 event.preventDefault(); 45 $(this).ekkoLightbox(); 46 });*/ 47 48 /*******************/ 49 /* */ 50 /* scroll to top */ 51 /* */ 52 /*******************/ 53 if ( typeof(noScroll) !== "undefined" ) { 54 $('body').append('<div id="toTop" class="btn btn-info"><span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span> Haut de page</div>'); 55 $(window).scroll(function () { 56 if ($(this).scrollTop() != 0) { 57 $('#toTop').fadeIn(); 58 } else { 59 $('#toTop').fadeOut(); 60 } 61 }); 62 $('#toTop').click(function(){ 63 $("html, body").animate({ scrollTop: 0 }, 600); 64 return false; 65 }); 66 } 67 68 /****************************/ 69 /* */ 70 /* open/close conditional */ 71 /* */ 72 /****************************/ 73 74 $("#optionnalField").hide(); 75 openCloseFromSelect("object","suivi","optionnalField"); 76 $("#object").change(function() { 77 openCloseFromSelect("object","suivi","optionnalField"); 78 }); 79 80 function openCloseFromSelect(toCheck,toCheckValue, toHideShow){ 81 if(($("#" + toCheck).val()) == toCheckValue){ 82 $("#" + toHideShow).show("slow"); 83 }else{ 84 $("#" + toHideShow).hide("slow"); 85 } 86 87 } 88 89 $("#seeAllThema").hide(); 90 91 $("#changeThema").on('click', function(e) { 92 93 // prevent default anchor click behavior 94 e.preventDefault(); 95 96 $("#seeAllThema").show(); 97 $("#selectedThema").hide(); 98 }); 99 100 $("#attachment2div").hide(); 101 102 $("#attachment2divShow").on('click', function(e) { 103 104 // prevent default anchor click behavior 105 e.preventDefault(); 106 107 $("#attachment2div").show(); 108 $("#attachment2divShow").hide(); 109 }); 110 111 $("#attachment3div").hide(); 112 113 $("#attachment3divShow").on('click', function(e) { 114 115 // prevent default anchor click behavior 116 e.preventDefault(); 117 118 $("#attachment3div").show(); 119 $("#attachment3divShow").hide(); 120 }); 121 122 $("#attachment4div").hide(); 123 124 $("#attachment4divShow").on('click', function(e) { 125 126 // prevent default anchor click behavior 127 e.preventDefault(); 128 129 $("#attachment4div").show(); 130 $("#attachment4divShow").hide(); 131 }); 132 133 // mise à jour sous-thème/catégorie apres choix du thème 134 $("#thema").on('change', function(e) { 135 $("#ssthema").find('option').remove().end(); 136 $("#ssthema").append($("<option />").val("").text("Sélectionnez ci-dessous la catégorie de votre demande !")); 137 var liste = $("#ssthemalist").val(); 138 var i1 = liste.indexOf($("#thema").val() + "=>"); 139 var i2 = liste.indexOf("|", i1 + 1); 140 var liste = liste.substring(i1 + (($("#thema").val() + "=>").length), i2 - 1); 141 var ssthemes = liste.split(";"); 142 for (var sstheme in ssthemes) { 143 $("#ssthema").append($("<option />").val(ssthemes[sstheme]).text(ssthemes[sstheme])); 144 } 145 }); 146 147 /****************************/ 148 /* */ 149 /* textarea limitation */ 150 /* */ 151 /****************************/ 152 153 var text_max = 1000; 154 checkLenght("message","countMessage",text_max); 155 156 $('#message').keyup(function() { 157 checkLenght("message","countMessage",text_max); 158 }); 159 160 function checkLenght(textarea,counter,maxLenght){ 161 var text_length = $("#" + textarea).val().length; 162 var text_remaining = maxLenght - text_length; 163 164 $("#" + counter).html(text_remaining + ' caractères restants'); 165 166 if(text_remaining>0){ 167 $("#" + counter).addClass("ok"); 168 $("#" + counter).removeClass("ko"); 169 }else{ 170 $("#" + counter).addClass("ko"); 171 $("#" + counter).removeClass("ok"); 172 } 173 174 } 175 176 $.fn.datepicker.dates['fr'] = { 177 months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'], 178 monthsShort: ['Janv.', 'Févr.', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil.', 'Août', 'Sept.', 'Oct.', 'Nov.', 'Déc.'], 179 days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'], 180 daysShort: ['Dim.', 'Lun.', 'Mar.', 'Mer.', 'Jeu.', 'Ven.', 'Sam.'], 181 daysMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'] 182 }; 183 184 $('#naissance').datepicker({ 185 language: 'fr', 186 startView:2, 187 format: 'dd/mm/yyyy', 188 startDate:'01/01/1910', 189 endDate:'01/01/2010' 190 }); 191 192 193})(); 194 195 196
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.