brian-girko / multiple-highlight

Color-coded highlighter extension to find queries
https://add0n.com/multiple-highlight.html
23 stars 4 forks source link

Feature request: Add ScrollMarkers #24

Open dnngll opened 2 years ago

dnngll commented 2 years ago

Hello,

would it be possible to add ScrollMarkers, just like in the regular search? Or even altered, like in the extension Selection Highlighter? Snippet:

...

  areScrollMarkersEnabled: function () {
    return true;
  },

  scrollMarkerClassName: 'highlighted_selection_scroll_marker',

  scrollMarkerStyles: function ({ window, document, highlightedNode }) {
    const clientRect = highlightedNode.getBoundingClientRect();
    if (!clientRect.width || !clientRect.height) {
      return false;
    }

    return {
      height: '1px',
      width: '40px',
      boxSizing: 'content-box',
      border: '1px solid grey',
      position: 'fixed',
      top: (
        // window height times percent of element position in document
        window.innerHeight * (
          + window.scrollY
          + clientRect.top
          + (0.5 * (clientRect.top - clientRect.bottom))
        ) / document.body.clientHeight
      ) + 'px',
      right: '0px',
      backgroundColor: 'green',
      zIndex: '2147483647',
    };
  }

...

Thanks!