PageSourceSearch

https://www.electionsquebec.qc.ca/wp-content/themes/electionsqc/assets/js/emplois.js?ver=260120140723

js electionsquebec.qc.ca collected 2026-10-02 04:10:13 UTC 4,249 bytes, 142 lines download raw bytes

1if (lang == "en-CA") {
2    i18n.translator.add({
3        "values":{
4            "Catégories :": "Categories:",
5            "Date limite : ": "Deadline",
6            "Filtrer les emplois et stages": "Filter jobs and internships",
7            "Tous les emplois et stages": "All jobs and internships",
8        }
9    })
10}
11
12$j(document).ready(function() {
13
14    $j.ajax({
15        url: electionsQC.urlREST + 'elecqc/v1/emplois', 
16        data: {
17        },
18        method: 'GET', 
19        success: function(data) {
20            if(data.length > 0){
21                afficher_emplois(data);
22            }
23        },  
24        error: function(error){
25            console.log(error);
26        }
27    });
28
29    $j.ajax({
30        url: electionsQC.urlREST + 'elecqc/v1/categories',
31        method: 'GET',
32        success: function(data) {
33            if(data){
34                afficher_filtre(data);
35            }
36        },  
37        error: function(error){
38            console.log(error);
39        }
40    });
41
42
43});
44
45function afficher_emplois(emplois){
46
47    $j(".listeEmplois").empty();
48
49    $j.each(emplois, function(key, emp){
50
51
52        let descriptionsEmploi = [];
53        
54        $j.each(emp.categories, function(key, cat){
55            descriptionsEmploi.push("<a href='#' class='applyFilterLink' data-typeemploi='"+cat.term_id+"'>" + cat.name + "</a>");
56        });
57
58        let strToAppend = "<div class='emploi'>";
59        if(emp.lien_de_remplacement != ""){
60            strToAppend += "<a href='"+emp.lien_de_remplacement+"' class='titreEmploi'>" + emp.post_title + "</a>";
61        }else{
62            strToAppend += "<a href='"+emp.permalink+"' class='titreEmploi'>" + emp.post_title + "</a>";
63        }
64
65        if(emp.date_limite){
66            strToAppend += "<p class='dateLimiteEmploi'>" + i18n("Date limite : ") + emp.date_limite + "</p>";
67        }
68        strToAppend += "<p class='descriptionEmploi'>" + emp.courte_description + "</p>";
69        strToAppend += "<p class='listeCategorieEmploi'>" + descriptionsEmploi.join(", ") + "</p>";
70        strToAppend += "</div>";
71
72        $j(".listeEmplois").append(strToAppend);
73
74        $j(".applyFilterLink").click(function(e){
75
76            e.preventDefault();
77            let categToDisplay = $j(this).data("typeemploi");
78    
79            $j.ajax({
80                url: electionsQC.urlREST + 'elecqc/v1/emplois',
81                data: {
82                    cat : categToDisplay
83                },
84                method: 'GET',
85                success:function(data) {
86                    if(data.length > 0){
87                        afficher_emplois(data);
88                        $j(".listeFiltreCategorie").val(categToDisplay);
89                    }
90                },  
91                error: function(error){
92                    console.log(error);
93                }
94            });
95    
96        });
97
98    });
99
100}
101
102function afficher_filtre(categs){
103    $j(".filtreEmplois").empty();
104    let categories = [];
105
106    $j.each(categs, function(key, cat){
107        categories.push("<option value='"+cat.term_id+"'>" + cat.name + "</option>");
108    });
109
110    let strToAppend = "<div class='row filtreEmploi'>";
111    strToAppend += "<div class='col-xl'><select name='listeFiltreCategorie' class='form-select form-select-lg listeFiltreCategorie'>";
112    strToAppend += "<option value=''>"+ i18n("Tous les emplois et stages") +"</option>";
113    strToAppend += categories.join();
114    strToAppend += "</select></div>";
115    strToAppend += "<div class='col-xl'><button type='button' class='col btn btn-lg btnElectionqcAlt applyFilter'>"+ i18n("Filtrer les emplois et stages") +"</button></div>";
116    strToAppend += "</div>";
117
118    $j(".filtreEmplois").append(strToAppend);
119    
120    $j(".applyFilter").click(function(e){
121
122        let categToDisplay = $j(".listeFiltreCategorie").val();
123
124        $j.ajax({
125            url: electionsQC.urlREST + 'elecqc/v1/emplois',
126            data: {
127                cat : categToDisplay
128            },
129            method: 'GET',
130            success:function(data) {
131                if(data.length > 0){
132                    afficher_emplois(data);
133                }
134            },  
135            error: function(error){
136                console.log(error);
137            }
138        });
139
140    });
141
142}

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.