DocScripts icon indicating copy to clipboard operation
DocScripts copied to clipboard

[View Trades] Page stuck when adjusting Min or Max values

Open trs4ece opened this issue 1 year ago • 8 comments

This is likely a browser compatibility issue as I've only seen this with the new Arc Browser.

When clicking either Max Food or Min Food under the View Trades Config, the browser page will get stuck with the finger selector button. You cannot interact with anything. The browser itself is still responsive. There aren't any errors in the console.

trs4ece avatar May 12 '24 05:05 trs4ece

What is a finger selector button? I tried it on the Arc browser myself and it seems to work as expected.

BlackAsLight avatar May 12 '24 11:05 BlackAsLight

Interesting. I'll try disabling other scripts. When you hold the cursor over a button, it turns into a finger.

Did you use the Arc browser for Mac? I am using it on Windows.

On Sun, May 12, 2024 at 4:46 AM Doctor @.***> wrote:

What is a finger selector button? I tried it on the Arc browser myself and it seems to work as expected.

— Reply to this email directly, view it on GitHub https://github.com/BlackAsLight/DocScripts/issues/11#issuecomment-2106218900, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADT7ONUXWODZ7JTURUDQSNDZB5JCNAVCNFSM6AAAAABHSQ225OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGIYTQOJQGA . You are receiving this because you authored the thread.Message ID: @.***>

trs4ece avatar May 12 '24 16:05 trs4ece

Even with all my other scripts disabled, I still get the same issue. I'd take a screenshot, but the cursor isn't captured in the screenshot.

trs4ece avatar May 13 '24 00:05 trs4ece

The buttons call a prompt() which makes sense for everything else to become unresponsive as it should show an overlay, tinting everything a bit black, for you to enter a number with the buttons, cancel and okay. I am on Mac, and don't have access to windows to try it. Does anything show up in the console when you click on it?

BlackAsLight avatar May 13 '24 00:05 BlackAsLight

There was nothing in the console either. I can add some break points if you let me know where would be a good place for one.

trs4ece avatar May 13 '24 02:05 trs4ece

This is the section of code in question, https://github.com/BlackAsLight/DocScripts/blob/main/static/scripts/ViewTrades.user.js#L129-L168, but I'm not sure what break points would be good.

BlackAsLight avatar May 13 '24 03:05 BlackAsLight

Yep, it's specifically prompt() which does not work in the Arc for Windows browser. Even on a search engine page in Incognito mode, entering prompt(hello) to the console causes the page to become unresponsive with no prompt popped up. I'll look into filing a bug with Arc, but it doesn't seem like a problem with your script and Arc necessarily. I've sent in a support request to the Arc team.

On Sun, May 12, 2024 at 8:08 PM Doctor @.***> wrote:

This is the section of code in question, https://github.com/BlackAsLight/DocScripts/blob/main/static/scripts/ViewTrades.user.js#L129-L168, but I'm not sure what break points would be good.

— Reply to this email directly, view it on GitHub https://github.com/BlackAsLight/DocScripts/issues/11#issuecomment-2106553249, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADT7ONUL7O4D2JSOP6FZ5SLZCAVDZAVCNFSM6AAAAABHSQ225OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGU2TGMRUHE . You are receiving this because you authored the thread.Message ID: @.***>

trs4ece avatar May 13 '24 17:05 trs4ece

In the meantime, I've written a work-around that replaces the prompt with two text fields:

    divTag.append(document.createElement('br'))
    divTag.append('Max lot size:')
    var maxAmountInput = document.createElement('input')
    maxAmountInput.type = 'number'
    maxAmountInput.value = MaxAmount(currentResource)
    maxAmountInput.id = 'maxAmountInputId'
    maxAmountInput.oninput = function() {
      var currentMax = MaxAmount(currentResource)
      var newMax = parseFloat(document.getElementById('maxAmountInputId').value)
      if (newMax !== 'NaN' && newMax !== currentMax) {
        const key = `Doc_MaxResource_${ currentResource }`
        if (newMax > 0) {
          localStorage.setItem(key, newMax)
        }
        else if (currentMax > 0) {
          localStorage.removeItem(key)
        }
        UpdateLinks()
      }
    }
    divTag.append(maxAmountInput)
	}

  divTag.append(document.createElement('br'))
  divTag.append('Min to keep on hand:')
  var minAmountInput = document.createElement('input')
  minAmountInput.type = 'number'
  minAmountInput.value = MinAmount(currentResource)
  minAmountInput.id = 'minAmountInputId'
  minAmountInput.oninput = function() {
    var currentMin = MinAmount(currentResource)
    var newMin = parseFloat(document.getElementById('minAmountInputId').value)
    if (newMin != 'NaN' && newMin != currentMin) {
      const key = `Doc_MinResource_${ currentResource }`
      if (newMin > 0) {
        localStorage.setItem(key, newMin)
      }
      else if (currentMin > 0) {
        localStorage.removeItem(key)
      }
      UpdateQuantities()
      UpdateLinks()
    }
  }
  divTag.append(minAmountInput)

trs4ece avatar May 13 '24 21:05 trs4ece