Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chrome.browserAction.onClicked.addListener(function(activeTab){
- // Get URL
- var streamURL = activeTab.url;
- // Check if URL is eligible
- var matches = streamURL.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
- var domain = matches && matches[1];
- var allowedHosts = ["www.youtube.com", "www.twitch.tv", "gaming.youtube.com"];
- if(allowedHosts.indexOf(domain) == -1){
- alert("Error: Did not find a stream that can be clipped! Please use directly on the stream on Youtube or Twitch.");
- return;
- }
- // Run miner = True
- // Create clip in a new tab
- var newURL = "https://neatclip.com/clipper?stream=" + encodeURIComponent(streamURL);
- chrome.tabs.create({ url: newURL });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement