PageSourceSearch

https://www.dalloz-actualite.fr/sites/all/themes/dallozactu/js/rwd.js?Q

js dalloz-actualite.fr collected 2026-10-02 02:56:16 UTC 9,250 bytes, 285 lines download raw bytes

1(function($) {
2
3  /* On window ready */
4  $(document).ready(function() {
5
6    $(window).resize(function() {
7      var windowWith = window.innerWidth;
8
9      if ( windowWith <= 992 && windowWith > 480 ) {
10        // Equalize view-edition-magazines grey blocks
11        if ($('.pane-views-panes .view-edition-magazines').length > 0) {
12          equalizeBlocks($('.view-edition-magazines .views-row'), true, 2);
13        }
14        // Equalize view-une-theme-magazines grey blocks
15        if ($('.pane-views-panes .view-une-theme-magazines').length > 0) {
16          equalizeBlocks($('.view-une-theme-magazines .views-row'), true, 2);
17        }
18      }
19      else {
20        // Unequalize view-edition-magazines grey blocks
21        if ($('.pane-views-panes .view-edition-magazines').length > 0) {
22          equalizeBlocks($('.view-edition-magazines .views-row'), false, 2);
23        }
24        // Unequalize view-une-theme-magazines grey blocks
25        if ($('.pane-views-panes .view-une-theme-magazines').length > 0) {
26          equalizeBlocks($('.view-une-theme-magazines .views-row'), false, 2);
27        }
28      }
29
30      if ( windowWith >= 768 ) {
31
32        if ($( "#user-mobile-menu" ).hasClass('opened')) {
33          $( "#user-mobile-menu" ).removeClass('opened');
34          $( "#user-mobile-menu" ).hide();
35        }
36
37        if ($( "#user-mobile-menu2" ).hasClass('opened')) {
38          $( "#user-mobile-menu2" ).removeClass('opened');
39          $( "#user-mobile-menu2" ).hide();
40        }
41
42      }
43
44      // Passage Actuel Avocat dans la colonne de gauche en mode mobile
45      if ($('.panel-sidebar-first .pane-edition-actu-avocat-panel-pane-1').length > 0 && windowWith < 768 ) {
46        var $actuelAvocat = $('.pane-edition-actu-avocat-panel-pane-1').closest('.box6_m');
47        $('.pane-edition-actu-avocat-panel-pane-1').closest('.box6_m').remove();
48        $('.pane-edition-actualites-panel-pane-1').prepend($actuelAvocat);
49      } else if  ($('.pane-edition-actualites-panel-pane-1 .pane-edition-actu-avocat-panel-pane-1').length > 0 && windowWith >= 768 ) {
50        var $actuelAvocat = $('.pane-edition-actu-avocat-panel-pane-1').closest('.box6_m');
51        $('.pane-edition-actu-avocat-panel-pane-1').closest('.box6_m').remove();
52        $('.panel-sidebar-first').prepend($actuelAvocat);
53      }
54
55    }).trigger('resize');
56
57    // Mobile navigation
58    $('#sliding-panel').slidingPanel({
59      trigger: $('#btn--burger, #btn--search, #btn--burger2, #btn--search2'),
60      wrapper: $('#site-wrap')
61    });
62    mobileNav();
63
64    // Fixed header
65    fixedHeader();
66
67    // User menu
68    userMenu();
69
70
71    // Correctif Datepickers
72    var datePickerIndex  = [-1,-1];
73    var $datePickers     = [];
74
75    // Avoid keyboard display
76    $('#edit-published-at-daterangepicker-popup-range-picker0, #edit-date-reference-daterangepicker-popup-range-picker0').attr('readonly', 'true');
77
78    $('#edit-published-at-daterangepicker-popup-range-picker0').click(function(event) {
79
80      $datePickers = $('.ui-daterangepickercontain');
81      if ($('.ui-daterangepickercontain').length == 1)  {
82        datePickerIndex = [0,1];
83      }
84      else {
85        if ($('.ui-daterangepickercontain').length == 2) {
86          $($datePickers[datePickerIndex[1]]).find('.ui-daterangepicker').hide();
87        }
88      }
89      $($datePickers[datePickerIndex[0]]).css('top', ($(this).offset().top + $(this).height() + 5).toString() + 'px');
90    });
91    $('#edit-date-reference-daterangepicker-popup-range-picker0').click(function(event) {
92      $datePickers = $('.ui-daterangepickercontain');
93      if ($('.ui-daterangepickercontain').length == 1)  {
94        datePickerIndex = [1,0];
95      }
96      else {
97        if ($('.ui-daterangepickercontain').length == 2) {
98          $($datePickers[datePickerIndex[0]]).find('.ui-daterangepicker').hide();
99        }
100      }
101      $($datePickers[datePickerIndex[1]]).css('top', ($(this).offset().top + $(this).height() + 5).toString() + 'px');
102    });
103
104
105    // Scroll haut de page si message d'erreur
106    if ($('.messages.error').length > 0)  {
107      // An anchor tag is specified in the url so that is difficult to force scrolling to top
108      // Instead of scrolling, let's move error message div to the concerned form
109      if ($('#comment-form').length > 0) {
110        $('.messages.error').prependTo('#comment-form');
111        // Scroll to be sure the header doesn't mask the error message
112        setTimeout(function() {
113          window.scrollTo(0, $('#comment-form').offset().top - 110);
114        }, 1);
115      }
116      if ($('#print-mail-form').length > 0) {
117        $('.messages.error').prependTo('#print-mail-form');
118        // Scroll to be sure the header doesn't mask the error message
119        setTimeout(function() {
120          window.scrollTo(0, $('#print-mail-form').offset().top - 110);
121        }, 1);
122      }
123    }
124
125  });
126
127})(jQuery)
128
129
130
131/**
132  * Equalize children blocks height based on higher one
133  * @Params
134  * $elements: elements to equalize
135  * onState: state
136  * lineElementCount: how many element to equalize
137  */
138var equalizeBlocks = function($elements, onState, lineElementCount) {
139
140  if (onState) {
141    // Remove height: auto
142    if ($elements.hasClass('auto-height')) {
143      $elements.removeClass('auto-height');
144    }
145
146    // Get biggest height
147    var highestHeight = 0;
148    var $lineElements = [];
149    var lineElementIndex = 0;
150    var i = 0;
151    $elements.each(function() {
152      $lineElements.push($(this));
153      if ($(this).height() > highestHeight) {
154        highestHeight = $(this).height();
155      }
156
157      if (((i % lineElementCount) == 1 || i == $elements.length - 1) && $elements.length > 1) {
158        for (var j = 0; j < lineElementCount; j++) {
159          if ($lineElements[j]) {
160            $lineElements[j].height(highestHeight);
161          }
162        }
163
164        // Init line vars
165        $lineElements     = [];
166        highestHeight     = 0;
167        lineElementIndex  = 0;
168      }
169
170      lineElementIndex++;
171      i++;
172    });
173
174
175  }
176  else {
177    // Force height: auto
178    if (!$elements.hasClass('auto-height')) {
179      $elements.addClass('auto-height');
180    }
181  }
182}
183
184/**
185  * mobileNav: Handle mobile nav
186  * No param
187  */
188var mobileNav = function (){
189  // First of all. Add "une" links at the top
190  $('.sp--panel .expanded > a').each(function(){
191    $(this).parent().children('.menu').prepend('<li class="leaf first"><a href="' + $(this).attr('href') + '">Toute la matière</a></li>');
192    //Modify this link url
193    $urlArray = $(this).attr('href').split('/');
194    $(this).attr('href','/une/'  + $urlArray[2]);
195  });
196
197  // Titles
198  var openTitle   = $('.sp--panel').attr('data-label-open');
199  var closeTitle  = $('.sp--panel').attr('data-label-close');
200
201  // Add toggle icons buttons
202  $('.sp--panel .expanded').each(function(){
203    if ($(this).children('.menu').length > 0) {
204      $(this).prepend('<button class="subopen" title="' + openTitle  + ' ' + $(this).find('> a span').text() + '">' + openTitle + ' ' + $(this).find('> a span').text() + '</button>');
205    }
206    else {
207      $(this).find('a').addClass('nomargin');
208    }
209  });
210
211  // Expand to active menu
212  $currentMenu = $('.sp--panel .expanded').find('a.active');
213  if ($currentMenu != null) {
214    if ($currentMenu.parent().hasClass('leaf')) {
215      // Second level -> add opened class on subopened link
216      $currentMenu.closest('.expanded').addClass('opened');
217    }
218  }
219
220  // Toggle sub menus
221  $('.subopen').click(function(){
222
223    if ($('.expanded.opened').length > 0) {
224      if ($('.expanded.opened').find('.subopen').attr('title') != $(this).attr('title')) {
225        // Close open submenu if different
226        $('.expanded.opened').children('.menu').slideUp();
227        $('.expanded.opened').removeClass('opened');
228        //Open new submenu
229        $(this).closest('.expanded').addClass('opened');
230        $(this).parent().children('.menu').slideDown();
231      }
232      else {
233        // Close current opened submenu
234        $('.expanded.opened').children('.menu').slideUp();
235        $('.expanded.opened').removeClass('opened');
236      }
237    }
238    else {
239      //Open new submenu
240      $(this).closest('.expanded').addClass('opened');
241      $(this).parent().children('.menu').slideDown();
242    }
243
244  });
245
246};
247
248/**
249  * fixedHeader: Handle fixed header on scrolling (to smartphone max.)
250  * No param
251  */
252var fixedHeader = function (){
253  $(window).scroll(function (event) {
254    var scroll      = $(window).scrollTop();
255    var windowWith  = window.innerWidth;
256
257    if (scroll > 150 && !$('body').hasClass('header-fixed') && windowWith <= 767) {
258      $('body').addClass('header-fixed');
259    }
260    else if ((scroll <= 150 || windowWith > 767) && $('body').hasClass('header-fixed')) {
261      $('body').removeClass('header-fixed');
262    }
263  });
264};
265
266/**
267  * userMenu: Handle smartphone user menu
268  * No param
269  */
270var userMenu = function (){
271  $('.pane-dzactu-core-subscriber h2').click(function (event) {
272    $( "#user-mobile-menu" ).toggleClass('opened');
273
274    if ($( "#user-mobile-menu" ).hasClass('opened')) {
275      $( "#user-mobile-menu" ).slideDown('fast');
276      $( "#user-mobile-menu2" ).slideDown('fast');
277    }
278    else {
279      $( "#user-mobile-menu" ).slideUp('fast');
280      $( "#user-mobile-menu2" ).slideUp('fast');
281    }
282
283  });
284
285};

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.