{"id":162,"date":"2025-06-16T19:43:33","date_gmt":"2025-06-16T19:43:33","guid":{"rendered":"https:\/\/cptdcli.com\/?page_id=162"},"modified":"2025-06-18T21:52:53","modified_gmt":"2025-06-18T21:52:53","slug":"getcommand","status":"publish","type":"page","link":"https:\/\/www.cptdcli.org\/?page_id=162","title":{"rendered":"GetCommand"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <title>Plugin Cards<\/title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;\n      background: #ffffff;\n      margin: 0;\n      padding: 20px;\n    }\n    .back-button {\n      margin-bottom: 20px;\n    }\n    .filters {\n      margin-bottom: 20px;\n      display: flex;\n      flex-wrap: wrap;\n      gap: 12px;\n    }\n    .filters input,\n    .filters select,\n    .filters button,\n    .filters label {\n      margin: 0;\n    }\n    .card {\n      background: #ffffff;\n      border: 1px solid #ccc;\n      border-radius: 8px;\n      padding: 15px;\n      margin: 10px;\n      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n    }\n    .card button {\n      margin-top: 10px;\n    }\n    button {\n      background-color: #2b6cb0;\n      color: white;\n      border: none;\n      padding: 10px 18px;\n      border-radius: 8px;\n      font-weight: 500;\n      font-size: 15px;\n      cursor: pointer;\n      transition: background-color 0.25s ease, transform 0.1s ease;\n      box-shadow: 0 2px 4px rgba(0,0,0,0.08);\n    }\n    button:hover {\n      background-color: #225ea8;\n    }\n    button:active {\n      transform: scale(0.97);\n      background-color: #1d4f91;\n    }\n    .pagination {\n      margin-top: 30px;\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      gap: 10px;\n      font-weight: bold;\n    }\n    #cardsContainer.grid-2 {\n      display: grid;\n      grid-template-columns: repeat(2, 1fr);\n      gap: 20px;\n    }\n  <\/style>\n<\/head>\n<body>\n\n  <h1 id=\"pluginHeader\">Available commands:<\/h1>\n\n  <div class=\"filters\">\n    <input type=\"text\" id=\"filterName\" placeholder=\"Filter by name\">\n    <input type=\"text\" id=\"filterAuthor\" placeholder=\"Filter by author\">\n    <select id=\"filterTarget\">\n      <option value=\"\">Target: All<\/option>\n      <option value=\"windows\">Windows<\/option>\n      <option value=\"linux\">Linux<\/option>\n      <option value=\"macos\">macOS<\/option>\n    <\/select>\n    <input type=\"text\" id=\"filterDescription\" placeholder=\"Filter by description\">\n    <input type=\"text\" id=\"filterlongDescription\" placeholder=\"Filter by long description\">\n\n    <label for=\"limitSelect\">Show:<\/label>\n    <select id=\"limitSelect\">\n      <option value=\"10\">10<\/option>\n      <option value=\"20\">20<\/option>\n      <option value=\"30\">30<\/option>\n    <\/select>\n\n    <label for=\"columnSelect\">Columns:<\/label>\n    <select id=\"columnSelect\" onchange=\"updateColumnLayout()\">\n      <option value=\"1\">1<\/option>\n      <option value=\"2\">2<\/option>\n    <\/select>\n\n    <button onclick=\"applyFilters()\">Apply Filters<\/button>\n    <button onclick=\"resetFilters()\">Reset<\/button>\n  <\/div>\n\n  <div class=\"summary\" id=\"totalCount\">Loading plugins&#8230;<\/div>\n  <div id=\"cardsContainer\">Loading&#8230;<\/div>\n  <div class=\"pagination\">\n    <button onclick=\"prevPage()\">\u2190 Prev<\/button>\n    <span id=\"pageInfo\"><\/span>\n    <button onclick=\"nextPage()\">Next \u2192<\/button>\n  <\/div>\n\n  <script>\n    let plugins = [];\n    let filteredPlugins = [];\n    let currentPage = 1;\n    let itemsPerPage = 10;\n\n    async function loadPlugins() {\n      try {\n        const res = await fetch('https:\/\/raw.githubusercontent.com\/asbjornrasen\/cptdcli-plugin\/main\/community-plugins.json');\n        plugins = await res.json();\n        applyFilters();\n        updateColumnLayout();\n      } catch (err) {\n        document.getElementById('cardsContainer').textContent = 'Error loading plugins.';\n        console.error(err);\n      }\n    }\n\n    function renderCards(data) {\n      const container = document.getElementById('cardsContainer');\n      container.innerHTML = '';\n      data.forEach((plugin) => {\n        const card = document.createElement('div');\n        card.className = 'card';\n        card.innerHTML = `\n          <h3>${plugin.name}<\/h3>\n          <p><strong>Description:<\/strong> ${plugin.description || '\u2014'}<\/p>\n          <p><strong>Target OS:<\/strong> ${plugin.target || '\u2014'}<\/p>\n          <p><strong>Version:<\/strong> ${plugin.version || '\u2014'}<\/p>\n          <p><strong>Author:<\/strong> ${plugin.author || '\u2014'}<\/p>\n          <p><strong>Email:<\/strong> <a href=\"mailto:${plugin.email}\">${plugin.email}<\/a><\/p>\n          <p><strong>Website:<\/strong> <a href=\"${plugin.website}\" target=\"_blank\">${plugin.website}<\/a><\/p>\n          <p><strong>Dependencies:<\/strong> ${(plugin.dependencies || []).join(', ') || '\u2014'}<\/p>\n          <p><strong>Long Description:<\/strong><\/p>\n          <div style=\"white-space: pre-wrap; font-size: 14px; line-height: 1.4;\">${plugin.long_description || '\u2014'}<\/div>\n          <div style=\"margin-top: 10px;\">\n            <a href=\"${plugin.download}\" target=\"_blank\"><button>Download<\/button><\/a>\n            <a href=\"${plugin.documentation}\" target=\"_blank\"><button>Documentation<\/button><\/a>\n            <a href=\"${plugin.license}\" target=\"_blank\"><button>License<\/button><\/a>\n\n          <\/div>\n        `;\n        container.appendChild(card);\n      });\n    }\n\n    function paginate(data, page, limit) {\n      const start = (page - 1) * limit;\n      const end = start + limit;\n      return data.slice(start, end);\n    }\n\n    function updatePagination() {\n      const totalPages = Math.ceil(filteredPlugins.length \/ itemsPerPage);\n      document.getElementById('pageInfo').textContent = `Page ${currentPage} of ${totalPages}`;\n      document.getElementById('totalCount').textContent = `Total plugins: ${filteredPlugins.length}`;\n    }\n\nfunction applyFilters() {\n  const name = document.getElementById('filterName').value.toLowerCase();\n  const author = document.getElementById('filterAuthor').value.toLowerCase();\n  const target = document.getElementById('filterTarget').value.toLowerCase();\n  const description = document.getElementById('filterDescription').value.toLowerCase();\n  const longDescription = document.getElementById('filterlongDescription').value.toLowerCase();\n  itemsPerPage = parseInt(document.getElementById('limitSelect').value);\n\n  filteredPlugins = plugins.filter(plugin =>\n    (plugin.name || '').toLowerCase().includes(name) &&\n    (plugin.author || '').toLowerCase().includes(author) &&\n    ((plugin.target || '').toLowerCase().includes(target) || target === '') &&\n    (plugin.description || '').toLowerCase().includes(description) &&\n    (plugin.long_description || '').toLowerCase().includes(longDescription)\n  );\n\n  currentPage = 1;\n  const pagedData = paginate(filteredPlugins, currentPage, itemsPerPage);\n  renderCards(pagedData);\n  updatePagination();\n}\n\n\n    function resetFilters() {\n      document.getElementById('filterName').value = '';\n      document.getElementById('filterAuthor').value = '';\n      document.getElementById('filterTarget').value = '';\n      document.getElementById('filterDescription').value = '';\n      document.getElementById('limitSelect').value = '10';\n      document.getElementById('columnSelect').value = '1';\n      currentPage = 1;\n      itemsPerPage = 10;\n      filteredPlugins = plugins;\n      const pagedData = paginate(filteredPlugins, currentPage, itemsPerPage);\n      renderCards(pagedData);\n      updatePagination();\n      updateColumnLayout();\n    }\n\n    function nextPage() {\n      const totalPages = Math.ceil(filteredPlugins.length \/ itemsPerPage);\n      if (currentPage < totalPages) {\n        currentPage++;\n        renderCards(paginate(filteredPlugins, currentPage, itemsPerPage));\n        updatePagination();\n        scrollToTop();\n      }\n    }\n\n    function prevPage() {\n      if (currentPage > 1) {\n        currentPage--;\n        renderCards(paginate(filteredPlugins, currentPage, itemsPerPage));\n        updatePagination();\n        scrollToTop();\n      }\n    }\n\n    function downloadPlugin(url) {\n      if (url) {\n        window.open(url, '_blank');\n      } else {\n        alert(\"\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430.\");\n      }\n    }\n\n    function updateColumnLayout() {\n      const container = document.getElementById('cardsContainer');\n      const columns = document.getElementById('columnSelect').value;\n      container.classList.toggle('grid-2', columns === '2');\n    }\n\n    function scrollToTop() {\n      document.getElementById('pluginHeader').scrollIntoView({ behavior: 'smooth' });\n    }\n\n    loadPlugins();\n  <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Plugin Cards Available commands: Target: AllWindowsLinuxmacOS Show: 102030 Columns: 12 Apply Filters Reset Loading plugins&#8230; Loading&#8230; \u2190 Prev Next \u2192<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-162","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/pages\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=162"}],"version-history":[{"count":22,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/pages\/162\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=\/wp\/v2\/pages\/162\/revisions\/323"}],"wp:attachment":[{"href":"https:\/\/www.cptdcli.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}