PageSourceSearch

https://www.ipcms.fr/themes/cnrswebkit-child/assets/js/cnrs-common.js?ver=1.0-1790367205

js ipcms.fr collected 2026-09-25 20:14:18 UTC 5,615 bytes, 186 lines download raw bytes

1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7function launchMediathequePopin(obj) {
8  console.log(obj);
9  var htmlPopin = "";
10  htmlPopin += "<div class='itemContainer'>";
11  htmlPopin += "<div class='imgContainer'><img src='" + obj.link + "' alt='" + obj.post_title + "' /></div>";
12  htmlPopin += "<div class='detailsContainer'>";
13  htmlPopin += "<h1>" + obj.post_title + "</h1>";
14  htmlPopin += obj.share;
15  htmlPopin += "<p>" + obj.chapo + "</p>";
16  htmlPopin += "<span>© " + obj.credits + "</span>";
17  htmlPopin += "</div>";
18  htmlPopin += "<div id='popinClose'><a href='#'></a></div>";
19  htmlPopin += "</div>";
20  var htmlClose = "";
21  $("body").addClass("fixed");
22  $("#popinOverlay").fadeIn().css("display", "flex");
23  $("#popinContainer").append(htmlPopin).fadeIn().css("display", "flex");
24  $("#popinClose").click(function (event) {
25    closeMediathequePopin();
26    event.preventDefault();
27    return false;
28  });
29  $(document).keyup(function (event) {
30    if (event.keyCode === 27) {
31      closeMediathequePopin();
32      event.preventDefault();
33    }
34    return false;
35  });
36}
37function closeMediathequePopin() {
38  $("#popinContainer").empty().fadeOut();
39  $("#popinOverlay").fadeOut();
40  $("body").removeClass("fixed");
41}
42
43function launchEmploiFormPopin(event) {
44  displayEmploiForm(event.target.attributes.dataid.value, '#popinContainerform');
45  $("body").addClass("fixed");
46  $("#popinOverlay").fadeIn().css("display", "flex");
47  $("#popinContainer").fadeIn().css("display", "flex");
48  $("#popinClose").click(function (event) {
49    closeEmploiFormPopin();
50    event.preventDefault();
51    return false;
52  });
53  $(document).keyup(function (event) {
54    if (event.keyCode === 27) {
55      closeEmploiFormPopin();
56      event.preventDefault();
57      return false;
58    }
59  });
60}
61function closeEmploiFormPopin() {
62  $("#popinContainer").fadeOut();
63  $("#popinContainerform").empty();
64  $("#popinOverlay").fadeOut();
65  $("body").removeClass("fixed");
66}
67
68function populateContact(obj, id) {
69  console.log(obj);
70  var target = $("a[data-id=" + id + "]").next(".contactDetails");
71  $(target).children(".thumbContainer").html("img " + obj.nom + " " + obj.prenom);
72  $(target).children(".detailsContainer").children(".name").html(obj.nom + " " + obj.prenom);
73  $(target).children(".detailsContainer").children(".function").html(obj.job);
74  $(target).children(".detailsContainer").children("p").html(obj.description);
75  $(target).children(".detailsContainer").children("a.contactLink").attr("data-id", id);
76}
77
78var contactClick = function () {
79  // details contact
80  $(".loop-contents-contact article .contact").unbind();
81  $(".loop-contents-contact article .contact").click(function (event) {
82    $(this).next(".contactDetails").toggleClass('visible').slideToggle(300).css("display", "flex");
83    event.preventDefault();
84    return false;
85  });
86
87  // close
88  $(".closeContact").unbind();
89  $(".closeContact").click(function () {
90    $(this).parent(".contactDetails").toggleClass('visible').slideToggle(300);
91  });
92}
93
94$(document).ready(function () {
95
96  //Actualités Masonry
97  // var $grida = $('.loop-contents-actualite').masonry({
98  //     itemSelector: 'article',
99  //     //columnWidth: 400
100  //     columnWidth: 'article',
101  //     gutter: 40
102  // });
103
104  // $grida.imagesLoaded().progress(function () {
105  //     $grida.masonry();
106  // });
107
108  // Médiathèque Masonry
109  var $gridm = $('.mediasContainer').masonry({
110    itemSelector: 'article',
111    //columnWidth: 400,
112    columnWidth: 350,
113    //gutter:2
114  });
115
116  $gridm.imagesLoaded().progress(function () {
117    $gridm.masonry();
118  });
119
120  // Popin Mediatheque function
121  $("article.mediatheque a").click(function (event) {
122    var thisID = jQuery(this).attr("data-id");
123    var thisObj = eval("imagepopin_" + thisID);
124    launchMediathequePopin(thisObj);
125    event.preventDefault();
126    return false;
127  });
128
129  // Popin Emploi function
130  $("article.emploi .contactMail a").click(function (event) {
131    launchEmploiFormPopin(event);
132    event.preventDefault();
133    return false;
134  });
135
136  // Add to calendar function
137  $(".addCalendar a").click(function (event) {
138    $(this).parent().children("form").submit();
139    event.preventDefault();
140    return false;
141  });
142
143  // bouton En savoir plus Publications
144  $(".knowMorePubLink").click(function (event) {
145    if ($(this).hasClass("deployed")) {
146      $(this).prev(".knowMorePub").slideUp();
147      $(this).removeClass("deployed");
148      $(this).html("En savoir plus");
149    } else {
150      $(this).prev(".knowMorePub").slideDown();
151      $(this).addClass("deployed");
152      $(this).html("Fermer");
153    }
154    event.preventDefault();
155    return false;
156  });
157
158  contactClick();
159
160});
161
162
163// Alternative JS pour non support de animation-timeline: scroll
164// On sélectionne le bouton "to-top"
165const toTopButton = document.querySelector(".to-top");
166let rangeStart = 0;
167
168// Fonction pour gérer l'affichage du bouton
169function handleScroll() {
170  if (!toTopButton) return;
171
172  if (window.scrollY >= rangeStart) {
173    toTopButton.style.opacity = "1";
174    toTopButton.style.scale = "1";
175  } else {
176    toTopButton.style.opacity = "0";
177    toTopButton.style.scale = "0";
178  }
179}
180
181// On vérifie si le navigateur supporte animation-timeline et si le bouton existe
182if (toTopButton && !CSS.supports("animation-timeline: scroll()")) {
183  rangeStart = parseInt(getComputedStyle(toTopButton).getPropertyValue("--to-top-range-start"));
184  window.addEventListener("scroll", handleScroll);
185  handleScroll();
186}

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.