PageSourceSearch

https://vaincre-noma.com/wp-content/themes/VaincreNoma/js/actualites.js?ver=6.8.10

js vaincre-noma.com collected 2026-10-02 21:52:49 UTC 5,162 bytes, 124 lines download raw bytes

1/**
2 * Created by ChatNoir on 01/03/15.
3 */
4
5var initPagination = function() {
6    $.get("https://vaincre-noma.com/api/get_posts?count=1000", function(data) {
7        $('.article').append("<div class='archive'><input type='hidden' class='current_page' /><input type='hidden' class='show_per_page' /><h3>Archive</h3><ul></ul><div class='page_navigation'></div></div>");
8
9        $.each(data.posts, function(key, value) {
10            var dateFix = value.date.split(' ')
11            var date = new Date(dateFix[0]);
12            var curr_month = date.getMonth();
13            var curr_year = date.getFullYear();
14            var m_names = new Array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
15            var articleUrl = document.URL
16            if (articleUrl.indexOf("?") > -1) {
17                articleUrl = articleUrl.substr(0, articleUrl.indexOf("?"));
18            }
19            articleUrl = articleUrl + '?title=' + encodeURIComponent(value.title.replace(/ /g, "-")) + '&post=' + value.id;
20
21
22            var thumb = '<img src="https://vaincre-noma.com/wp-content/uploads/2015/03/logo-vaincre-noma-carre.jpg" alt="">';
23            if (value.thumbnail_images) {
24              if (value.thumbnail_images["thumbnail"] != undefined) {
25                thumb = value.thumbnail_images.thumbnail.url ? '<img src="' + value.thumbnail_images.thumbnail.url + '" alt="">' : '<img src="https://vaincre-noma.com/wp-content/uploads/2015/03/logo-vaincre-noma-carre.jpg" alt="">';
26              }
27            }
28
29            $('.archive ul').append(
30                '<li style="display: none;">' +
31                  '<a href="' + value.url + '">' +
32                    '<div class="img">' +
33                      thumb +
34                    '</div>' +
35                    '<div class="info">' +
36                      '<p>' + m_names[curr_month] + ", " + curr_year + '</p>' +
37                      '<h4>' + value.title + '</h4>' +
38                    '</div>' +
39                  '</a>' +
40                '</li>'
41            )
42        });
43
44        //how much items per page to show
45        var show_per_page = 5;
46        //getting the amount of elements inside content div
47        var number_of_items = data.count;
48        //calculate the number of pages we are going to have
49        var number_of_pages = Math.ceil((number_of_items / show_per_page));
50
51        //set the value of our hidden input fields
52        $('.current_page').val(0);
53        $('.show_per_page').val(show_per_page);
54
55        //now when we got all we need for the navigation let's make it '
56
57        //  what are we going to have in the navigation?
58        //  - link to previous page
59        //  - links to specific pages
60        //  - link to next page
61
62        var navigation_html = '';
63        var current_link = 0;
64        while (number_of_pages > current_link) {
65            first_link_class = current_link === 0 ? 'active_page' : '';
66            navigation_html += '<a class="page_link ' + first_link_class + '" href="javascript:go_to_page(' + current_link + ')" longdesc="' + current_link + '">' + (current_link + 1) + '</a>';
67            current_link++;
68        }
69        navigation_html += '<a class="next_link" href="javascript:go_to_page(' + (number_of_pages - 1) + ');">&raquo;</a>';
70
71        $('.page_navigation').html(navigation_html);
72
73        //hide all the elements inside content div
74
75        //and show the first n (show_per_page) elements
76        $.each($('.archive'), function( index, el) {
77          $(el).find('ul').children().slice(0, show_per_page).css('display', 'block');
78        });
79
80        $("nav.archive").stick_in_parent();
81
82    });
83};
84
85function previous() {
86
87    new_page = parseInt($('.current_page').val()) - 1;
88    //if there is an item before the current active link run the function
89    if ($('.active_page').prev('.page_link').length == true) {
90        go_to_page(new_page);
91    }
92
93}
94
95function next() {
96    new_page = parseInt($('.current_page').val()) + 1;
97    //if there is an item after the current active link run the function
98    if ($('.active_page').next('.page_link').length == true) {
99        go_to_page(new_page);
100    }
101
102}
103
104function go_to_page(page_num) {
105    //get the number of items shown per page
106    var show_per_page = parseInt($('.show_per_page').val());
107
108    //get the element number where to start the slice from
109    start_from = page_num * show_per_page;
110
111    //get the element number where to end the slice
112    end_on = start_from + show_per_page;
113
114    //hide all children elements of content div, get specific items and show them
115    $.each($('.archive'), function( index, el) {
116      $(el).find('ul').children().css('display', 'none').slice(start_from, end_on).css('display', 'block');
117    });
118    /*get the page link that has longdesc attribute of the current page and add active_page class to it
119     and remove that class from previously active page link*/
120    $('.page_link[longdesc=' + page_num + ']').addClass('active_page').siblings('.active_page').removeClass('active_page');
121
122    //update the current page input field
123    $('.current_page').val(page_num);
124}

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.