diff --git a/getting-started/_package.json b/getting-started/_package.json index 65c52814..ad6fb5ab 100644 --- a/getting-started/_package.json +++ b/getting-started/_package.json @@ -12,7 +12,7 @@ }, "homepage": "https://github.com/chocolatey/chocolatey.org#readme", "devDependencies": { - "choco-theme": "^0.1.3" + "choco-theme": "^0.1.4" }, "resolutions": { "glob-parent": "^6.0.1", diff --git a/js/chocolatey-packages.js b/js/chocolatey-packages.js index f32fdd70..dce6e08f 100644 --- a/js/chocolatey-packages.js +++ b/js/chocolatey-packages.js @@ -1,7 +1,7 @@ import jQuery from 'jquery'; import EasyMDE from 'easymde'; import { Collapse, Modal } from 'bootstrap'; -import { getCookie, setCookieExpirationNever } from './util/chocolatey-functions'; +import { getCookie, setCookieExpirationNever, truncateResults } from './util/chocolatey-functions'; (() => { // Community Disclaimer @@ -373,4 +373,7 @@ import { getCookie, setCookieExpirationNever } from './util/chocolatey-functions } }); } + + // Show or hide truncated version history table results on click + truncateResults(document.querySelector('#versionTableTruncateResults')); })(); diff --git a/js/util/chocolatey-functions.js b/js/util/chocolatey-functions.js index fe2d19e0..ee75d9c3 100644 --- a/js/util/chocolatey-functions.js +++ b/js/util/chocolatey-functions.js @@ -167,3 +167,20 @@ deploymentMethods.forEach(el => { if (deploymentMethodHashArray.includes(deploymentMethodHash)) { document.cookie = `deployment_method=${deploymentMethodHash}; path=/`; } + +// Show more or hide truncated results on click +export const truncateResults = btnId => { + if (btnId) { + btnId.addEventListener('click', () => { + const results = document.querySelectorAll('tr.truncate-results'); + + for (const i of results) { + if (i.classList.contains('d-none')) { + i.classList.remove('d-none'); + } else { + i.classList.add('d-none'); + } + } + }); + } +}; diff --git a/package.json b/package.json index e16eb1b2..7461b6e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "choco-theme", - "version": "0.1.3", + "version": "0.1.4", "description": "The global theme for Chocolatey Software.", "repository": { "type": "git",