{"id":1325,"date":"2025-05-08T09:27:44","date_gmt":"2025-05-08T07:27:44","guid":{"rendered":"https:\/\/agripedia.ch\/klima\/activites-des-cantons\/"},"modified":"2026-04-23T18:04:49","modified_gmt":"2026-04-23T16:04:49","slug":"activites-des-cantons","status":"publish","type":"post","link":"https:\/\/agripedia.ch\/klima\/fr\/activites-des-cantons\/","title":{"rendered":"Projets et programmes cantonaux"},"content":{"rendered":"\n<p>En Suisse, la plupart des projets li\u00e9s \u00e0 la protection du climat et \u00e0 l\u2019adaptation de l\u2019agriculture aux impacts du changement climatique sont coordonn\u00e9s et mis en \u0153uvre au niveau cantonal. Selon les particularit\u00e9s locales, les cantons s\u2019engagent dans diff\u00e9rents domaines.<\/p>\n\n\n\n<p><br>Avec l\u2019outil suivant, vous pouvez consulter les divers projets et mesures cantonaux \u2013 tels que les contributions ou les subventions \u2013 et les filtrer par th\u00e8me.<\/p>\n\n\n\n<p><br>Les r\u00e9sultats contiennent des informations sur le canton, le th\u00e8me, la p\u00e9riode, le statut, les objectifs, les partenaires impliqu\u00e9s ainsi que l\u2019impact sur le climat (protection du climat et\/ou adaptation au climat).<\/p>\n\n\n\n<div style=\"height:61px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><\/p>\n\n\n\n<!DOCTYPE html>\n<html lang=\"fr\">\n<head>\n  <meta charset=\"UTF-8\" \/>\n  <title>Recherche affin\u00e9e<\/title>\n  <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/xlsx@0.18.5\/dist\/xlsx.full.min.js\"><\/script>\n  <style>\n    body {\n      font-family: Arial, sans-serif;\n      background-color: #ffffff;\n      padding: 20px;\n    }\n    .filter-section {\n      background: #dff2fa;\n      border-radius: 8px;\n      margin-bottom: 20px;\n    }\n    .filter-header {\n      background-color: #008bcc;\n      color: white;\n      padding: 10px;\n      border-radius: 6px 6px 0 0;\n      font-weight: bold;\n      font-size: 1.2em;\n    }\n    .filter-content {\n      display: flex;\n      justify-content: space-between;\n      flex-wrap: wrap;\n      padding: 15px;\n      gap: 40px;\n    }\n    .filter-group {\n      flex: 1 1 45%;\n      min-width: 300px;\n    }\n    .checkbox-list {\n      max-height: 100px;\n      overflow-y: auto;\n      border: 1px solid #ccc;\n      padding: 5px;\n      background: #fff;\n      border-radius: 4px;\n      margin-bottom: 15px;\n    }\n    .toggle-label {\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      margin: 12px 0;\n    }\n    .toggle-switch {\n      position: relative;\n      display: inline-block;\n      width: 50px;\n      height: 24px;\n    }\n    .toggle-switch input {\n      opacity: 0;\n      width: 0;\n      height: 0;\n    }\n    .slider {\n      position: absolute;\n      cursor: pointer;\n      top: 0;\n      left: 0;\n      right: 0;\n      bottom: 0;\n      background-color: #ccc;\n      transition: 0.4s;\n      border-radius: 24px;\n    }\n    .slider:before {\n      position: absolute;\n      content: \"\";\n      height: 18px;\n      width: 18px;\n      left: 3px;\n      bottom: 3px;\n      background-color: white;\n      transition: 0.4s;\n      border-radius: 50%;\n    }\n    .toggle-switch input:checked + .slider {\n      background-color: #008bcc;\n    }\n    .toggle-switch input:checked + .slider:before {\n      transform: translateX(26px);\n    }\n    .project {\n      background: #e9f6fb;\n      border-radius: 6px;\n      margin-bottom: 20px;\n    }\n    .project-header {\n      background-color: #008bcc;\n      color: white;\n      padding: 10px;\n      border-radius: 6px 6px 0 0;\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      text-align: center;\n    }\n    .project-title-content {\n      font-size: 1.2em;\n      font-weight: bold;\n    }\n    .project-body {\n      padding: 20px;\n      line-height: 1.6em;\n      position: relative;\n    }\n    .project-tags-inside {\n      position: absolute;\n      top: 20px;\n      right: 20px;\n    }\n    .badge {\n      display: inline-block;\n      background-color: #87d68d;\n      color: white;\n      padding: 4px 10px;\n      border-radius: 5px;\n      margin-left: 5px;\n      font-weight: bold;\n    }\n    .badge.adaptation {\n      background-color: #d1821b;\n    }\n    .project-body-row {\n      display: flex;\n      align-items: flex-start;\n      margin-bottom: 10px;\n    }\n    .project-body-row strong {\n      width: 180px;\n      flex-shrink: 0;\n    }\n    .project-body .status-Actif {\n      color: #00B050;\n      font-weight: bold;\n    }\n    .project-body .status-Termin\u00e9 {\n      color: #A6A6A6;\n      font-weight: bold;\n    }\n    .no-results {\n      padding: 20px;\n      text-align: center;\n      color: #555;\n      background: #fff6f6;\n      border: 1px solid #ffc7c7;\n      border-radius: 6px;\n      font-size: 1.1em;\n      animation: fadeIn 0.4s ease-in-out;\n    }\n    @keyframes fadeIn {\n      from { opacity: 0; transform: translateY(10px); }\n      to   { opacity: 1; transform: translateY(0); }\n    }\n  <\/style>\n<\/head>\n<body>\n  <div class=\"filter-section\">\n    <div class=\"filter-header\">Recherche affin\u00e9e<\/div>\n    <div class=\"filter-content\">\n      <div class=\"filter-group\">\n        <label>Canton\u202f:<\/label>\n        <div id=\"kantonCheckboxes\" class=\"checkbox-list\"><\/div>\n        <label>Domaine th\u00e9matique\u202f:<\/label>\n        <div id=\"themenbereichCheckboxes\" class=\"checkbox-list\"><\/div>\n      <\/div>\n      <div class=\"filter-group\" style=\"margin-top: 40px;\">\n        <label class=\"toggle-label\">\n          <span>Afficher uniquement les projets actifs<\/span>\n          <label class=\"toggle-switch\">\n            <input type=\"checkbox\" id=\"statusCheck\">\n            <span class=\"slider\"><\/span>\n          <\/label>\n        <\/label>\n        <label class=\"toggle-label\">\n          <span>Projets de protection du climat<\/span>\n          <label class=\"toggle-switch\">\n            <input type=\"checkbox\" id=\"klimaschutzCheck\" checked>\n            <span class=\"slider\"><\/span>\n          <\/label>\n        <\/label>\n        <label class=\"toggle-label\">\n          <span>Projets d\u2019adaptation<\/span>\n          <label class=\"toggle-switch\">\n            <input type=\"checkbox\" id=\"anpassungCheck\" checked>\n            <span class=\"slider\"><\/span>\n          <\/label>\n        <\/label>\n\n        <p id=\"resultCount\" style=\"font-weight: bold; margin-top: 20px; text-align: right;\">\n          0 projets trouv\u00e9s\n        <\/p>\n      <\/div>\n    <\/div>\n  <\/div>\n\n  <div id=\"results\"><\/div>\n\n  <script>\n    let data = [];\n\n    function isValidUrl(string) {\n      try {\n        new URL(string);\n        return true;\n      } catch (_) {\n        return false;\n      }\n    }\n\n    function cleanData(rawData) {\n      return rawData.map(row => {\n        const cleaned = {};\n        for (const key in row) {\n          const trimmedKey = key.trim();\n          const value = typeof row[key] === 'string' ? row[key].trim() : row[key];\n          cleaned[trimmedKey] = value;\n        }\n        return cleaned;\n      });\n    }\n\n    function createCheckboxList(container, values, name) {\n      const selectAllLabel = document.createElement(\"label\");\n      const selectAllCheckbox = document.createElement(\"input\");\n      selectAllCheckbox.type = \"checkbox\";\n      selectAllCheckbox.checked = true;\n      selectAllCheckbox.style.marginBottom = \"5px\";\n\n      selectAllCheckbox.addEventListener(\"change\", () => {\n        container.querySelectorAll(`input[name='${name}']`)\n                 .forEach(cb => cb.checked = selectAllCheckbox.checked);\n        filterData();\n      });\n\n      selectAllLabel.appendChild(selectAllCheckbox);\n      selectAllLabel.append(\n        ` S\u00e9lectionner tous les ${name === \"kanton\"\n          ? \"cantons\"\n          : \"domaines th\u00e9matiques\"}`\n      );\n      container.appendChild(selectAllLabel);\n\n      values.forEach(value => {\n        const label = document.createElement(\"label\");\n        const checkbox = document.createElement(\"input\");\n        checkbox.type = \"checkbox\";\n        checkbox.value = value;\n        checkbox.name = name;\n        checkbox.checked = true;\n\n        checkbox.addEventListener(\"change\", () => {\n          const all = container.querySelectorAll(`input[name='${name}']`);\n          const checkedCount = Array.from(all).filter(cb => cb.checked).length;\n          selectAllCheckbox.checked = checkedCount === all.length;\n          filterData();\n        });\n\n        label.appendChild(checkbox);\n        label.append(\" \", value);\n        container.appendChild(label);\n      });\n    }\n\n    function getCheckedValues(name) {\n      return Array.from(\n        document.querySelectorAll(`input[name='${name}']:checked`)\n      ).map(el => el.value);\n    }\n\n    function filterData() {\n      const selectedKantone = getCheckedValues(\"kanton\");\n      const selectedThemen  = getCheckedValues(\"thema\");\n      const onlyActif       = document.getElementById(\"statusCheck\").checked;\n      const showProt        = document.getElementById(\"klimaschutzCheck\").checked;\n      const showAdapt       = document.getElementById(\"anpassungCheck\").checked;\n\n      if (!selectedKantone.length || !selectedThemen.length) {\n        renderResults([]);\n        return;\n      }\n\n      const filtered = data.filter(row => {\n        const prot = String(row['Protection du climat'] || \"\").trim().toUpperCase();\n        const adpt = String(row.Adaptation           || \"\").trim().toUpperCase();\n        const hasProt = prot === \"OUI\";\n        const hasAdpt = adpt === \"OUI\";\n\n        if (!selectedKantone.includes(row.Canton))                         return false;\n        if (!selectedThemen.includes(row['Domaine th\u00e9matique']))          return false;\n        if (onlyActif && row.Statut !== \"Actif\")                           return false;\n        if (!showProt    && !showAdapt)                                    return false;\n        if (showProt && showAdapt) {\n          if (!hasProt && !hasAdpt)                                        return false;\n        } else if (showProt) {\n          if (!hasProt)                                                    return false;\n        } else if (showAdapt) {\n          if (!hasAdpt)                                                    return false;\n        }\n        return true;\n      });\n\n      renderResults(filtered);\n    }\n\n    function formatDescription(text) {\n      if (!text) return \"<i>Aucune description<\/i>\";\n      const lines = text.split(\/\\r?\\n\/).filter(l => l.trim());\n      let out = \"\", inList = false;\n\n      lines.forEach(line => {\n        const t = line.trim();\n        if (\/^[-\u2013\u2022*]\\s+\/.test(t)) {\n          if (!inList) { out += \"<ul>\"; inList = true; }\n          out += `<li>${t.replace(\/^[-\u2013\u2022*]\\s+\/, \"\")}<\/li>`;\n        } else if (\/^\\d+\\.\\s+\/.test(t)) {\n          if (!inList) { out += \"<ol>\"; inList = true; }\n          out += `<li>${t.replace(\/^\\d+\\.\\s+\/, \"\")}<\/li>`;\n        } else {\n          if (inList) { out += out.includes(\"<ol>\") ? \"<\/ol>\" : \"<\/ul>\"; inList = false; }\n          out += `<p>${t}<\/p>`;\n        }\n      });\n      if (inList) out += out.includes(\"<ol>\") ? \"<\/ol>\" : \"<\/ul>\";\n      return out;\n    }\n\n    function renderResults(results) {\n      const c = document.getElementById(\"results\");\n      c.innerHTML = \"\";\n\n      if (!results.length) {\n        c.innerHTML = `\n          <div class=\"no-results\">\n            \ud83d\udd0d Aucun projet trouv\u00e9<br>\n            Veuillez ajuster vos filtres.\n          <\/div>`;\n        document.getElementById(\"resultCount\").textContent = `0 projets trouv\u00e9s`;\n        return;\n      }\n\n      results.forEach(row => {\n        const div = document.createElement(\"div\");\n        div.className = \"project\";\n        const statusCls = row.Statut === \"Actif\"\n                          ? \"status-Actif\"\n                          : \"status-Termin\u00e9\";\n\n        const safe = v => v && v !== \"undefined\" && v !== \"null\" && String(v).trim();\n\n        let html = `\n          <div class=\"project-header\">\n            <div class=\"project-title-content\">${row.Titre}<\/div>\n          <\/div>\n          <div class=\"project-body\">\n            <div class=\"project-tags-inside\">\n              ${hasProt = (String(row['Protection du climat']).toUpperCase()===\"OUI\")\n                ? '<span class=\"badge\">Protection du climat<\/span>' : ''}\n              ${hasAdpt = (String(row.Adaptation).toUpperCase()===\"OUI\")\n                ? '<span class=\"badge adaptation\">Adaptation<\/span>' : ''}\n            <\/div>\n        `;\n\n        if (safe(row['Domaine th\u00e9matique']))\n          html += `<div class=\"project-body-row\"><strong>Domaine th\u00e9matique\u202f:<\/strong> <span>${row['Domaine th\u00e9matique']}<\/span><\/div>`;\n        if (safe(row.Canton))\n          html += `<div class=\"project-body-row\"><strong>Canton\u202f:<\/strong> <span>${row.Canton}<\/span><\/div>`;\n        if (safe(row.P\u00e9riode))\n          html += `<div class=\"project-body-row\"><strong>P\u00e9riode\u202f:<\/strong> <span>${row.P\u00e9riode}<\/span><\/div>`;\n        if (safe(row.Statut))\n          html += `<div class=\"project-body-row\"><strong>Statut\u202f:<\/strong> <span class=\"${statusCls}\">${row.Statut}<\/span><\/div>`;\n\n        const desc = formatDescription(row.Description);\n        if (safe(desc))\n          html += `<div class=\"project-body-row\"><strong>Description\u202f:<\/strong> <div style=\"flex:1\">${desc}<\/div><\/div>`;\n\n        if (safe(row['Organisation de contact']))\n          html += `<div class=\"project-body-row\"><strong>Organisation de contact\u202f:<\/strong> <span>${row['Organisation de contact']}<\/span><\/div>`;\n        if (safe(row.Partenaire))\n          html += `<div class=\"project-body-row\"><strong>Partenaire\u202f:<\/strong> <span>${row.Partenaire}<\/span><\/div>`;\n\n        const src = row['Informations \/ Source'];\n        if (safe(src)) {\n          html += `\n            <div class=\"project-body-row\">\n              <strong>Informations \/ Source\u202f:<\/strong>\n              <span>${\n                isValidUrl(src)\n                  ? `<a href=\"${src}\" target=\"_blank\">${row.Titre}<\/a>`\n                  : src\n              }<\/span>\n            <\/div>`;\n        }\n\n        html += `<\/div>`;\n        div.innerHTML = html;\n        c.appendChild(div);\n      });\n\n      document.getElementById(\"resultCount\").textContent =\n        `${results.length} projet${results.length>1?'s':''} trouv\u00e9${results.length>1?'s':''}`;\n    }\n\nfetch(\"https:\/\/agripedia.ch\/klima\/wp-content\/uploads\/sites\/66\/2025\/07\/2026_Liste-Aktivitaeten-Kantone_Klima_FR-1.xlsx\")\n      .then(res => {\n        if (!res.ok) throw new Error(\"Impossible de charger le fichier Excel\");\n        return res.arrayBuffer();\n      })\n      .then(buffer => {\n        const wb    = XLSX.read(buffer, { type: \"array\" });\n        const sheet = wb.Sheets[wb.SheetNames[0]];\n        data = cleanData(XLSX.utils.sheet_to_json(sheet));\n\n        const ks = [...new Set(data.map(d => d.Canton))].sort();\n        const ts = [...new Set(data.map(d => d['Domaine th\u00e9matique']))].sort();\n        createCheckboxList(document.getElementById(\"kantonCheckboxes\"), ks, \"kanton\");\n        createCheckboxList(document.getElementById(\"themenbereichCheckboxes\"), ts, \"thema\");\n\n        document.getElementById(\"statusCheck\").onchange      = filterData;\n        document.getElementById(\"klimaschutzCheck\").onchange = filterData;\n        document.getElementById(\"anpassungCheck\").onchange   = filterData;\n\n        filterData();\n      })\n      .catch(err => console.error(err));\n  <\/script>\n<\/body>\n<\/html>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>En Suisse, la plupart des projets li\u00e9s \u00e0 la protection du climat et \u00e0 l\u2019adaptation de l\u2019agriculture aux impacts du changement climatique sont coordonn\u00e9s et mis en \u0153uvre au niveau cantonal. Selon les particularit\u00e9s locales, les cantons s\u2019engagent dans diff\u00e9rents domaines. Avec l\u2019outil suivant, vous pouvez consulter les divers projets et mesures cantonaux \u2013 tels [&hellip;]<\/p>\n","protected":false},"author":927,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_sb_is_suggestion_mode":false,"_sb_show_suggestion_boards":false,"_sb_show_comment_boards":false,"_sb_suggestion_history":"","_sb_update_block_changes":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1325","post","type-post","status-publish","format-standard","hentry","category-non-classifiee"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/posts\/1325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/users\/927"}],"replies":[{"embeddable":true,"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/comments?post=1325"}],"version-history":[{"count":11,"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/posts\/1325\/revisions"}],"predecessor-version":[{"id":2165,"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/posts\/1325\/revisions\/2165"}],"wp:attachment":[{"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/media?parent=1325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/categories?post=1325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agripedia.ch\/klima\/fr\/wp-json\/wp\/v2\/tags?post=1325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}