PageSourceSearch

http://centre-multilingualism.ch/themes/custom/idp2021/js/scripts.js?tjywmt

js centre-multilingualism.ch collected 2026-10-08 05:43:26 UTC 2,595 bytes, 96 lines download raw bytes

1// import once from '@drupal/once';
2(function($, Drupal) {
3  "use strict";
4
5  Drupal.behaviors.idp = {
6    attach: function(context, settings) {
7      //page_menu_view
8      if($('#page_menu_view').length){
9        let counter = 0;
10        // $( "table caption" ).once().each(function() {
11          once('table caption-key', '.table caption').forEach((element) => {
12          counter++;
13          $(this).append('<a class="anchor" id=element_' + counter + '></a>');
14          $('#page_menu_view ul').append('<li><a href="#element_' + counter +  '">' + $(this).text() + '</a></li>');
15        });
16      }
17
18
19
20    }
21  };
22  $('.idpprojetssearch').collapse({
23    toggle: true
24  })
25
26
27
28  $(window).scroll(function() {
29
30    if($(window).scrollTop() + $(window).height() >= (0.95 * $(document).height())) {
31      //alert("bottom!");
32
33      if($('#load_more_btn').length){
34
35        //$('#load_more_btn').hide();
36        $('#load_more_btn').click();
37        // let data = 10;
38        // $.post({
39        //   url: '/projects/customAjaxLinkAlert',
40        //   data: data,
41        //   //success: success
42        // });
43      }
44    }
45  });
46
47  highlightElement();
48  $(".expandable").click(function(){
49    console.log("toggle sub menu");
50    $(this).children(".sub_menu").toggle(400);
51    $(this).toggleClass('expanded');
52  });
53  $('.scrollToTop').hide();
54  $(window).scroll(function () {
55    if($(window).width() > 990) {
56      if ($(window).scrollTop() > ($(window).height() * 0.15)) {
57        $('.scrollToTop').show();
58      }
59      else {
60        $('.scrollToTop').hide();
61      }
62    }
63    else {
64      $('.scrollToTop').hide();
65    }
66  });
67
68  function highlightElement (){
69    //console.log("Publication highlight");
70    if (typeof idElement == 'undefined'){
71      var idElement =  window.location.hash.substring(1);
72    }
73    if (idElement.length > 0) {
74      console.log("---------------------" + idElement + "------------------");
75      console.log(window.location.hash.substring(1));
76      if ($('#article_' + idElement).length > 0) {
77          $("#article_" + idElement).addClass("highlight", 200, callbackHighlight(idElement));
78          //   $(  "#article_" + idElement ).animate({backgroundColor: "#ff0022"}, 500 );
79          //   $(  "#article_" + idElement ).animate({backgroundColor: "#ffffff"}, 12000 );
80
81      }
82      //$('html, body').animate({scrollTop: posTop}, 500, 'easeInOutCubic');
83      //easeInOutCubic
84    }
85  }
86
87  function callbackHighlight(idElement) {
88    setTimeout(function() {
89      $(  "#" + idElement).removeClass( "highlight" );
90    }, 5000 );
91  }
92
93})(jQuery, Drupal);
94
95
96

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.