richiehowelll / jira-diff

https://chromewebstore.google.com/detail/jira-diff-highlighter/imlebnoogjdcbkaaighofkpfciamehni
GNU General Public License v3.0
3 stars 0 forks source link

Allow showing history for other fields other than description #1

Open chasewallis opened 3 months ago

chasewallis commented 3 months ago

First of all, you're my hero.

Second, we've got a number of fields that this diff tool would be nice to use in, not just description. Test steps, User Story, and a bunch of custom ones. Is it possible to enable this for any field, not just description?

richiehowelll commented 3 months ago

Thanks! @chasewallis as long as we can locate those elements in the DOM reliably it should be totally doable. The relevant code is in the findDiffContainers function in content.js.

  findDiffContainers() {
    const updateElements = Array.from(document.querySelectorAll('div'))
      .filter(el => el.textContent.includes('updated the Description'));

    return updateElements.map(el => {
      const possibleDiffContainer = el.nextElementSibling;
      return (possibleDiffContainer && possibleDiffContainer.children.length === 3) ? possibleDiffContainer : null;
    }).filter(Boolean);
  },