Skip to content

joysound.com: nuisance #7320

Closed
Closed

Description

@Yuki2718

URL(s) where the issue occurs

https://www.joysound.com/web/search/song/746956

Describe the issue

Annoyances: context menu, copy, and text-selection disabled

Screenshot(s)

joysound1

Versions

  • Browser/version: 1.8.90
  • uBlock Origin version: 1.26.0

Settings

  • Default + uBlock Annoyances

Notes

As style overriding didn't work, I added

joysound.com##+js(set, document.body.oncopy, null)
joysound.com##+js(set, document.body.onselectstart, null)
joysound.com##+js(set, document.body.oncontextmenu, null)

as set by https://www.joysound.com/web/feature/search/js/songdetail.min.js, then the page hid the lyrics:

joysound2

Activity

  1. uBlock-user commented on May 7, 2020

    @uBlock-user
    Member

    set sets the value in early which is causing site breakage(document.body gets set to null as per dev-tools). You will need an event based setter/getter scriptlet or do it manually by copy-pasting in the console after page-load --

    document.body.oncontextmenu = document.body.onselectstart = document.body.oncopy = null;

  2. mapx- commented on May 7, 2020

    @mapx-
    Contributor
  3. gorhill commented on May 7, 2020

    @gorhill
    Member

    I could prevent the context menu from being disable with:

    joysound.com##+js(aopr, document.body.oncontextmenu)
    

    However, the same approach did not work for the selection.

    The reason is how the aopr scriptlet is written and I think this can be overcome with the same fix I did here.

    Edit: actually set would also work using the same fix.

  4. uBlock-user commented on May 7, 2020

    @uBlock-user
    Member

    joysound.com##+js(aopr, document.body.oncontextmenu)

    doesn't it break anything ?

  5. mapx- commented on May 7, 2020

    @mapx-
    Contributor

    joysound.com##+js(aopr, document.body.oncontextmenu) does not work either, it breaks the "pretender" section (see the pic above)

  6. gorhill commented on May 7, 2020

    @gorhill
    Member

    Oh I see, I need to investigate more then -- though it wouldn't hurt to ensure that set and aopr are reentrant-resistant.

  7. gorhill commented on May 7, 2020

    @gorhill
    Member

    Ok, document.body is special, though the scriptlet traps the property to detect when its value changes, the browser is modifying its value internally, bypassing the trap.

  8. gorhill commented on May 7, 2020

    @gorhill
    Member

    Right... This kind of lead me back to the idea of simple operators which can be chained, in such case it would be to merely add a match-readystate operator and thus all scriptlet operators which would follow would be executed after the target ready state is reached, without keeping duplicating code.

    +js:match-readystate(/interactive|complete/):set-constant(document.body.oncontextmenu, null)
    
  9. uBlock-user commented on May 7, 2020

    @uBlock-user
    Member

    That would be much better ofcourse and without having to resort to adding another scriptlet, also you can shorten :match-readystate to just :readystate as we don't have any such existing operator.

  10. kulfoon commented on May 10, 2020

    @kulfoon

    It seems gorhill likes to keep words match/watch as a first part of the name (matches-css, matches-css-before, matches-css-after, watch-attr) for procedural operators, perhaps that will applied to scriplets as well, so I'm curious, following this logic: :watch-attributes ==> :watch-attrs ==> :watch-attr
    we get___________________________________:match-readystate ==> :match-ready ==> :match-rdy

  11. Yuki2718 commented on May 29, 2020

    @Yuki2718
    MemberAuthor

    I guess found another case.
    [NSFW] https://www.j-live.tv/

  12. Yuki2718 commented on Jul 25, 2021

    @Yuki2718
    Author
  13. 2 remaining items

  14. mapx- commented on Apr 1, 2022

    @mapx-
    Contributor

    document.body.oncopy
    #12528

  15. mapx- commented on Apr 13, 2023

    @mapx-
    Contributor

    This issue should be fixed with the last improvement of set-constant scriptlet

    Add ability to defer set-constant execution
    A new optional parameter has been added to `set-constant`
    scriptlet: `runAt`, default to `0`.
    
     ..##+js(set, document.body.oncontextmenu, null, 2)
    
    When the `runAt` parameter is present, uBO will take it into
    account to possibly defer execution of `set-constant`:
    
    - `runAt` not present: execute immediately
    - `runAt` = 1: execute immediately
    - `runAt` = 2: execute when document state is "interactive"
    - `runAt` = 3: execute when document state is `"complete"
    

    Tested in firefox, uBO 1.48.9b1

    (sometimes I need more than 1 refresh)

    joysound.com##+js(set, document.body.oncopy, null, 3)
    joysound.com##+js(set, document.body.onselectstart, null, 3)
    joysound.com##+js(set, document.body.oncontextmenu, null, 3)
    joysound.com##body:style(-webkit-touch-callout: default !important; -webkit-user-select: text !important; -moz-user-select: text !important; -ms-user-select: text !important; user-select: text !important;)
    joysound.com##style:has-text(@media print):remove()
    
  16. gorhill commented on Apr 13, 2023

    @gorhill
    Member

    This issue should be fixed with the last improvement of set-constant scriptlet

    I used the case here to test but it didn't fix it on my side (at least in Chromium). There is this weird state in the DOM where document.body.oncontextmenu is null, but the event listener that was assigned to it is still executed by the browser.

  17. mapx- commented on Apr 13, 2023

    @mapx-
    Contributor

    maybe it's why even in firefox the right-click is still disabled but upon refreshing the page it will finally work

  18. mapx- commented on Apr 15, 2023

    @mapx-
    Contributor

    @gorhill

    adding this filter makes right click works in chrome on my end

    joysound.com##+js(aeld, DOMContentLoaded, ready)

  19. gorhill commented on Apr 15, 2023

    @gorhill
    Member

    Nice, so the extra parameter was indeed required to solve this issue.

  20. gorhill commented on Apr 16, 2023

    @gorhill
    Member

    @Yuki2718 Are you satisified that the following filters (using dev build) are taking care of the issue?

    joysound.com##+js(set, document.body.oncopy, null, 3)
    joysound.com##+js(set, document.body.onselectstart, null, 3)
    joysound.com##+js(set, document.body.oncontextmenu, null, 3)
    joysound.com##+js(aeld, DOMContentLoaded, ready)
    joysound.com##body:style(user-select: unset !important)
    
  21. Yuki2718 commented on Apr 19, 2023

    @Yuki2718
    MemberAuthor

    Yes, they're working fine, thx!

  22. changed the title [-]www.joysound.com[/-] [+]joysound.com: nuisance[/+] on Apr 19, 2023
  23. gorhill commented on Apr 27, 2023

    @gorhill
    Member

    I am going to change the last parameter to make the purpose more clear, and to align the values with already existing documentation out there. So it will be:

    • end or interactive: at DOMContentLoaded event time
    • idle or complete: at load event time

    Anything else will be "as soon as possible".


    To be clear, end and idle are documented in extensions API, interactive and complete are documented in Web API. Using number would be more difficult to remember and thus inconvenient as filter list maintainer.

  24. stephenhawk8054 commented on Apr 28, 2023

    @stephenhawk8054
    Member

    So for future filters that need runAt parameter, we will need to write in JSON format, is it correct?

  25. gorhill commented on Apr 28, 2023

    @gorhill
    Member

    Depends of the scriptlet. For set-constant, the positional form is available; for aeld, only with the JSON notation.

  26. stephenhawk8054 commented on Apr 28, 2023

    @stephenhawk8054
    Member

    Got it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions