Sleazy Fork is available in English.

Fix source dropdown menu

When loading a previously visited page, the website won't display the selected media source. You need to select another source and then reselect the source you wanted, in order for it to show the media. This user script fixes that bug

  1. // ==UserScript==
  2. // @name Fix source dropdown menu
  3. // @namespace kawa.tf
  4. // @match *://*.japaneseasmr.com/*
  5. // @grant none
  6. // @version 1.1.0
  7. // @author Tilwa Qendov
  8. // @description When loading a previously visited page, the website won't display the selected media source. You need to select another source and then reselect the source you wanted, in order for it to show the media. This user script fixes that bug
  9. // @license Artistic-2.0
  10. // ==/UserScript==
  11.  
  12. const MAX_ATTEMPTS = 10
  13. const RETRY_INTERVAL = 1000
  14. const DROPDOWN_ID = 'selectSource'
  15. const SOURCE_IDS = ['audioplayer', 'cleanp_audio', 'dl_links']
  16.  
  17. function checkDropdown() {
  18. let dropdown = document.getElementById(DROPDOWN_ID)
  19. if (dropdown !== null) {
  20. dropdown.dispatchEvent(new Event('change'))
  21. console.log("fix-dropdown-menu: Sent an update to the dropdown menu.")
  22. }
  23. }
  24.  
  25. function aSourceIsVisible() {
  26. return !SOURCE_IDS.every(x => document.getElementById(x).style.display === "none")
  27. }
  28.  
  29. console.log("fix-dropdown-menu: Started")
  30.  
  31. // Execute 10 times, once every second
  32. let count = 0
  33. let doIt = () => {
  34. count++
  35. checkDropdown()
  36. if (aSourceIsVisible()) {
  37. console.log("fix-dropdown-menu: The selected source should now be visible.")
  38. return
  39. }
  40. if (count === MAX_ATTEMPTS) {
  41. console.log(`fix-dropdown-menu: ${MAX_ATTEMPTS} attempts were made to update the dropdown without success.`)
  42. return
  43. }
  44. setTimeout(doIt, RETRY_INTERVAL)
  45. }
  46.  
  47. doIt()