Jump to content

tangledhelix

Member
  • Posts

    6
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by tangledhelix

  1. I have an Alfred workflow based on a JXA script. It acts as a control mechanism for focusatwill.com (an online music streaming service). It has basic functionality, play/pause, skip track...

     

    This was working fine in an earlier version, interacting with the page using query selectors, e.g.

    tab.execute({ javascript: "document.querySelector('.playerControls .playButton').click();" })

    This site recently refactored their UI to use React. My basic controls still work (using querySelector), but one part of the setup (changing the genre) has broken. It used to use querySelectorAll for this task, but in the new React UI, the controls I need to reach don't exist unless you click in the UI ... 

     

    In any case, the developers exposed an API in the site code, so I can do stuff like

    window.faw.play()
    window.faw.skip()
    window.faw.genre(genreId)

    And doing that in the developer console in Chrome works fine. But if I try to do the same using tab.execute in JXA (from Alfred), nothing happens.

     

    I'm guessing that I'm running afoul of the security model in Chrome. Does anyone know if what I'm trying to do is even possible (from Alfred/JXA)? Or am I going to have to try to do this as a Chrome extension instead?

     

    If it's helpful, here is the repository:

    https://github.com/tangledhelix/focusatwill-in-google-chrome

     

    And there's some discussion between me and someone at focusatwill.com on this commit:

    https://github.com/tangledhelix/focusatwill-in-google-chrome/commit/eb339cba143cdbc2593c73869e11bcd70f18042a

×
×
  • Create New...