Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. chrome.browserAction.onClicked.addListener(function(activeTab){
  2. // Get URL
  3. var streamURL = activeTab.url;
  4.  
  5. // Check if URL is eligible
  6. var matches = streamURL.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
  7. var domain = matches && matches[1];
  8. var allowedHosts = ["www.youtube.com", "www.twitch.tv", "gaming.youtube.com"];
  9. if(allowedHosts.indexOf(domain) == -1){
  10. alert("Error: Did not find a stream that can be clipped! Please use directly on the stream on Youtube or Twitch.");
  11. return;
  12. }
  13. // Run miner = True
  14. // Create clip in a new tab
  15. var newURL = "https://neatclip.com/clipper?stream=" + encodeURIComponent(streamURL);
  16. chrome.tabs.create({ url: newURL });
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement