cryptohopper-dashboard-watchlist icon indicating copy to clipboard operation
cryptohopper-dashboard-watchlist copied to clipboard

Make Dashboard position indicators hopper-unique

Open Kanaharath opened this issue 3 years ago • 3 comments

When I set indicators on positions (icon/colored rows), I would like them to be able to be unique for that specific position.

I would use this for instance to mark heavy DCA positions. These same coins are not heavy DCA in other positions/hoppers.

Kanaharath avatar Apr 21 '21 19:04 Kanaharath

I looked into the possibility of this last night but it seems like the website doesn't make it very easy to determine which hopper you're using. Seems like the only way might be too parse the sidebar html menu to get the hopper IDs and then do a text comparison to the selected hopper name.

This is the only place in code or html that I an find to uniquely identify the hopper ids:

Screen Shot 2021-04-22 at 9 22 13 AM

markrickert avatar Apr 22 '21 13:04 markrickert

I'm still looking into how to do this... i may have a solution.

markrickert avatar May 05 '21 18:05 markrickert

I looked into the possibility of this last night but it seems like the website doesn't make it very easy to determine which hopper you're using. Seems like the only way might be too parse the sidebar html menu to get the hopper IDs and then do a text comparison to the selected hopper name.

This is the only place in code or html that I an find to uniquely identify the hopper ids:

Screen Shot 2021-04-22 at 9 22 13 AM

We can get the currently active hopper ID (at least on the dashboard page - haven't checked other pages yet) from the #active_hopper_id hidden input elements value attribute: var hopperID = $('#active_hopper_id').val();

Alternatively we can use the following code to get the current hopper ID which should work for all pages, though it has the caveat that all hoppers would have to have a unique name (not sure if CH enforces this): var hopperMenu = $('#sidebar-menu>ul>li:first-of-type'); var hopperName = $('>a>span:first-of-type',hopperMenu).text().trim(); var hopperID = $(`>ul>li>a[title="${hopperName}"]`,hopperMenu).prop('href').match(/set=(\d+)/)[1];

We could then add that value to the data stored by GM_setValue(); and use that as a filter to have unique indicators to each hopper.

eatsleepcoderepeat-gl avatar May 15 '21 21:05 eatsleepcoderepeat-gl