[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script Not executing on OnSelect function #781

Closed
dev-AshishRanjan opened this issue Jul 5, 2024 · 4 comments
Closed

Script Not executing on OnSelect function #781

dev-AshishRanjan opened this issue Jul 5, 2024 · 4 comments

Comments

@dev-AshishRanjan
Copy link

Expected behaviour

It should open a new tab in browser and and go to the specified url

Actual behaviour

No Redirection is found

Steps to reproduce

Code :

settings: [
        {
          html: "Subtitle",
          width: 250,
          tooltip: "",
          selector: subtitles,
          onSelect: function (item, $dom, event) {
            console.info(item, $dom, event);
            art.subtitle.url = item?.url;
            return item?.html;
          },
        },
        {
          html: "Watch Party",
          width: 250,
          height: 500,
          selector: [
            {
              html: "watchparty.me",
              url: "https://www.watchparty.me/create?video=" + option?.url,
            }
          ],
          onSelect: function (item: any) {
            setTimeout(() => {
              window.open(option?.url);
            }, 0);
          },
        },
        {
          html: "Download",
          width: 250,
          height: 500,
          icon: '<img src="/images/logo512.svg" alt="download"/>',
          selector:
            format === "hls"
              ? [
                {
                  html: "Download HLS (Recommended)",
                  url: option.url,
                  opt: 1,
                },
                {
                  html: "Download HLS (mediatools)",
                  url: option.url,
                  opt: 2,
                },
                {
                  html: "Download HLS (thetuhin)",
                  url: option.url,
                  opt: 3,
                },
              ]
              : [
                {
                  html: "Download mp4",
                  url: option.url,
                  opt: 4,
                },
              ],
          onSelect: function (item: any) {
            if (item.opt === 1)
              window.open(
                `https://hlsdownload.vidbinge.com/?url=${option.url}`,
              );
            if (item.opt === 2)
              window.open(
                `https://mediatools.cc/hlsDownloader?query=${option.url}`,
              );
            if (item.opt === 3) {
              navigator?.clipboard?.writeText(option.url);
              window.open(
                `https://hlsdownloader.thetuhin.com/?text=${option.url}`,
              );
            }
            if (item.opt === 4) {
              navigator?.clipboard?.writeText(option.url);
              window.open(`${option.url}`);
            }
          },
        },
      ],
      

Few days back, after selecting the submenu, it use to run the script

 window.open(
       `https://hlsdownload.vidbinge.com/?url=${option.url}`,
    );

but now this script is not running in onSelect function

Environment

  • Browser: chrome
  • Version:
  • Operating System: windows 11
  • Version:

Console errors (if any)

no error

Link to where the bug is happening

https://rivestream.live/watch?type=movie&id=786892

@dev-AshishRanjan dev-AshishRanjan changed the title Redirect from Settings not working Script Not executing on OnSelect function Jul 5, 2024
@zhw2590582
Copy link
Owner

I can execute this code in your demo link

window.open(
https://hlsdownload.vidbinge.com/?url=${option.url},
);

@dev-AshishRanjan
Copy link
Author

@zhw2590582 ,

I have changed the logic.
window.open() is still not working

The new logic to do this is:

onSelect: function (item: any) {
            // window.open("https://www.watchparty.me/create?video=" + option?.url);
            // window.location.href = "https://www.watchparty.me/create?video=" + option?.url;
            let url = `https://www.watchparty.me/create?video=${option.url}`;
            let event = new MouseEvent("click", {
              bubbles: true,
              cancelable: true,
              view: window,
            });
            let a = document.createElement("a");
            a.href = url;
            a.target = "_blank";
            a.dispatchEvent(event);
          },

@dev-AshishRanjan
Copy link
Author

The issue has been resolved from my side by changing logic.
But I would like to mention that window.open() was working few days back.

Thanks for your support, I am closing this issue 👍

@zhw2590582
Copy link
Owner

Maybe you accidentally modified the Chrome security policy, you may have disabled the use of JS to open third-party pages, you can try using incognito mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants