PageSourceSearch

https://journee-visu.github.io/js/site.js

js journee-visu.github.io collected 2026-10-03 09:25:17 UTC 2,222 bytes, 94 lines download raw bytes

1$(document).ready(function() {
2
3  // Variables
4  var $codeSnippets = $('.code-example-body'),
5      $nav = $('.navbar'),
6      $body = $('body'),
7      $window = $(window),
8      $popoverLink = $('[data-popover]'),
9      navOffsetTop = $nav.offset().top,
10      $document = $(document),
11      entityMap = {
12        "&": "&",
13        "<": "&lt;",
14        ">": "&gt;",
15        '"': '&quot;',
16        "'": '&#39;',
17        "/": '&#x2F;'
18      }
19
20  function init() {
21    $window.on('scroll', onScroll)
22    $window.on('resize', resize)
23    $popoverLink.on('click', openPopover)
24    $document.on('click', closePopover)
25    $('a[href^="#"]').on('click', smoothScroll)
26    buildSnippets();
27  }
28
29  function smoothScroll(e) {
30    e.preventDefault();
31    $(document).off("scroll");
32    var target = this.hash,
33        menu = target;
34    $target = $(target);
35    $('html, body').stop().animate({
36        'scrollTop': $target.offset().top-40
37    }, 0, 'swing', function () {
38        window.location.hash = target;
39        $(document).on("scroll", onScroll);
40    });
41  }
42
43  function openPopover(e) {
44    e.preventDefault()
45    closePopover();
46    var popover = $($(this).data('popover'));
47    popover.toggleClass('open')
48    e.stopImmediatePropagation();
49  }
50
51  function closePopover(e) {
52    if($('.popover.open').length > 0) {
53      $('.popover').removeClass('open')
54    }
55  }
56
57  $("#button").click(function() {
58    $('html, body').animate({
59        scrollTop: $("#elementtoScrollToID").offset().top
60    }, 2000);
61});
62
63  function resize() {
64    $body.removeClass('has-docked-nav')
65    navOffsetTop = $nav.offset().top
66    onScroll()
67  }
68
69  function onScroll() {
70    if(navOffsetTop < $window.scrollTop() && !$body.hasClass('has-docked-nav')) {
71      $body.addClass('has-docked-nav')
72    }
73    if(navOffsetTop > $window.scrollTop() && $body.hasClass('has-docked-nav')) {
74      $body.removeClass('has-docked-nav')
75    }
76  }
77
78  function escapeHtml(string) {
79    return String(string).replace(/[&<>"'\/]/g, function (s) {
80      return entityMap[s];
81    });
82  }
83
84  function buildSnippets() {
85    $codeSnippets.each(function() {
86      var newContent = escapeHtml($(this).html())
87      $(this).html(newContent)
88    })
89  }
90
91
92  init();
93
94});

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.