site.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. function map() {
  2. var $carte = $('#carte');
  3. if ( $carte.length ) {
  4. var mymap = L.map('carte').setView([44.7365818, 4.9776488], 13);
  5. var greenIcon = L.icon({
  6. iconUrl: '/user/themes/lecampus/images/mappoint.svg',
  7. iconSize: [38, 95], // size of the icon
  8. iconAnchor: [22, 94], // point of the icon which will correspond to marker's location
  9. popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
  10. });
  11. L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
  12. maxZoom: 18,
  13. id: 'mapbox.streets'
  14. }).addTo(mymap);
  15. L.marker([44.7365818, 4.9776488], {icon: greenIcon}).addTo(mymap);
  16. function onMapClick(e) {
  17. popup
  18. .setLatLng(e.latlng)
  19. .setContent("You clicked the map at " + e.latlng.toString())
  20. .openOn(mymap);
  21. }
  22. mymap.on('click', onMapClick);
  23. }
  24. }
  25. function filteritem() {
  26. var $card = $('.body-wrapper > .card');
  27. var $cat = $('.cat a');
  28. var $img = $('.body-wrapper .img');
  29. $(".filters .btn").click(function(e) {
  30. // e.preventDefault();
  31. var filter = $(this).attr("data-filter");
  32. var self = $('.body-wrapper');
  33. self.masonryFilter({
  34. filter: function () {
  35. if (!filter) return true;
  36. return $(this).attr("data-filter") == filter;
  37. }
  38. });
  39. });
  40. var $grid = $('#archive .body-wrapper, #calendrier .body-wrapper').masonry({
  41. // columnWidth: 200,
  42. itemSelector: '.card',
  43. gutter: 40,
  44. transitionDuration: '0.2s'
  45. });
  46. $grid.imagesLoaded().progress(function() {
  47. $grid.masonry();
  48. });
  49. }
  50. function slide() {
  51. $('.gal').bxSlider({
  52. responsive: true,
  53. infiniteLoop: true,
  54. preloadImages:'visible',
  55. pager:false,
  56. auto:true
  57. });
  58. $('.gal-salles').slidesjs({
  59. width: 800,
  60. height: 533,
  61. navigation: true,
  62. pagination: false
  63. });
  64. }
  65. function links() {
  66. var $a = $('.dropmenu > ul > li > .no-click');
  67. var $map = $('a#carte');
  68. $a.on('click', function(e) {
  69. e.preventDefault();
  70. })
  71. $map.on('click', function(e) {
  72. e.preventDefault();
  73. })
  74. }
  75. function clickbutton() {
  76. var $button = $('#ajax-test-form .radio label');
  77. $button.on('click', function(){
  78. $(this).parents('.form-data').find('.check').removeClass('check');
  79. $(this).parent('.radio').addClass('check');
  80. });
  81. }
  82. function clicksenddevis() {
  83. var $ok = $('.ok');
  84. var $send = $('#send-valide');
  85. $ok.on('click', function () {
  86. $(this).parent('#send-valide').remove();
  87. })
  88. }
  89. function addclass() {
  90. var $map = $('a#carte');
  91. $map.parents('.content_s').addClass('map')
  92. var $reco_click = $('#reco .title');
  93. var $reco_txt = $('#reco .txt');
  94. $reco_click.on('click', function() {
  95. $reco_txt.toggleClass('open');
  96. $(this).toggleClass('open');
  97. $('html, body').animate({scrollTop:$('#reco').position().top}, 'slow');
  98. })
  99. var $out = $('.opt-out .txt');
  100. $out.on('click', function() {
  101. $(this).parent('.opt-out').toggleClass('open');
  102. })
  103. }
  104. function mapsalles() {
  105. var $salles = $('.fond svg path');
  106. var $content = $('.content .content_salle');
  107. arrayid = [];
  108. $('.content .content_salle#salle_trois_becs').css("visibility", "visible");
  109. $('.fond svg path#salle_trois_becs').css("fill", "#0093a3");
  110. $salles.on('click', function(idsalle) {
  111. var idsalle = this.id;
  112. arrayid.push(idsalle);
  113. $salles.css("fill", "white");
  114. $(this).css("fill", "#0093a3");
  115. $('.content .content_salle').css("visibility", "hidden");
  116. $('.content .content_salle#'+arrayid).css("visibility", "visible");
  117. arrayid.length = 0;
  118. });
  119. var $close = $('.content_salle .header-salles img');
  120. $close.on('click', function () {
  121. $(this).parents('.content_salle').css("visibility", "hidden");
  122. $salles.css("fill", "white");
  123. })
  124. };
  125. function burger() {
  126. $('.navTrigger').click(function(){
  127. $(this).toggleClass('active');
  128. $('.dropmenu').toggleClass('active');
  129. });
  130. }
  131. function ajaxformulaire() {
  132. $(".ok").on('click', function () {
  133. $(this).parent('#send-valide').remove();
  134. location.reload();
  135. });
  136. var form = $('#ajax-test-form');
  137. form.submit(function(e) {
  138. // prevent form submission
  139. e.preventDefault();
  140. // submit the form via Ajax
  141. $.ajax({
  142. url: form.attr('action'),
  143. type: form.attr('method'),
  144. dataType: 'html',
  145. data: form.serialize(),
  146. success: function(result) {
  147. // Inject the result in the HTML
  148. $('#form-result').html(result);
  149. }
  150. });
  151. });
  152. }
  153. jQuery(document).ready(function(){
  154. tarteaucitron.init({
  155. "privacyUrl": "/charte-cookies", /* Privacy policy url */
  156. "hashtag": "#gestion_des_cookies", /* Open the panel with this hashtag */
  157. "cookieName": "gestion_des_cookies", /* Cookie name */
  158. "orientation": "bottom", /* Banner position (top - bottom) */
  159. "showAlertSmall": false, /* Show the small banner on bottom right */
  160. "cookieslist": false, /* Show the cookie list */
  161. "adblocker": false, /* Show a Warning if an adblocker is detected */
  162. "AcceptAllCta" : true, /* Show the accept all button when highPrivacy on */
  163. "highPrivacy": true, /* Disable auto consent */
  164. "handleBrowserDNTRequest": true, /* If Do Not Track == 1, disallow all */
  165. "removeCredit": false, /* Remove credit link */
  166. "moreInfoLink": true, /* Show more info link */
  167. "useExternalCss": true, /* If false, the tarteaucitron.css file will be loaded */
  168. //"cookieDomain": ".my-multisite-domaine.fr", /* Shared cookie for multisite */
  169. "readmoreLink": "/cookiespolicy" /* Change the default readmore link */
  170. });
  171. addclass();
  172. mapsalles();
  173. clickbutton();
  174. clicksenddevis();
  175. links();
  176. slide();
  177. filteritem();
  178. map();
  179. burger();
  180. });