From 6889f4764a9d85edff1a7c6cc6526e28e137f84e Mon Sep 17 00:00:00 2001 From: "Roman V. Nikolaev" Date: Thu, 9 Aug 2018 22:07:47 +0300 Subject: [PATCH] stormo.tv --- README | 1 + .../stormotv-content-scripts.js | 16 +++++++++++++++ js/modules.js | 20 +++++++++++++++++++ manifest.json | 3 +++ 4 files changed, 40 insertions(+) create mode 100644 js/content_scripts/stormotv-content-scripts.js diff --git a/README b/README index 63fd34b..f45ab77 100755 --- a/README +++ b/README @@ -26,6 +26,7 @@ Supported websites include * Seasonvar * Sopcast * SoundCloud + * Stormo.tv * StreamCloud * SVTPlay & Öppet Arkiv (Swedish TV Station) * Torrent diff --git a/js/content_scripts/stormotv-content-scripts.js b/js/content_scripts/stormotv-content-scripts.js new file mode 100644 index 0000000..0feaa1e --- /dev/null +++ b/js/content_scripts/stormotv-content-scripts.js @@ -0,0 +1,16 @@ + + +chrome.runtime.onMessage.addListener( + function(request, sender, sendResponse) { + var $video = $('video'); + if (request.action == "getVideoSrc") { + var videoSrc = + $video.find('source:first').attr('src') + || $video.attr('src') + ; + sendResponse({videoSrc: videoSrc}); + } else if (request.action == "onPlayback") { + $video[0].pause(); + } + } +); diff --git a/js/modules.js b/js/modules.js index 82f9675..c853c07 100755 --- a/js/modules.js +++ b/js/modules.js @@ -538,6 +538,25 @@ function getSoundcloudTrackId(url, callback) { }); } +var StormoTvModule = { + canHandleUrl: function(url) { + var validPatterns = [ + "^https?://(www\\.)?stormo\\.tv/videos/" + ]; + return urlMatchesOneOfPatterns(url, validPatterns); + }, + getMediaType: function() { + return 'video'; + }, + getPluginPath: function(url, getAddOnVersion, callback) { + chrome.tabs.sendMessage(currentTabId, {action: 'getVideoSrc'}, function (response) { + if (response) { + callback(response.videoSrc); + } + }); + } + }; + var StreamCloudModule = { canHandleUrl: function(url) { var validPatterns = [ @@ -922,6 +941,7 @@ var allModules = [ SolarmoviezModule, SopcastModule, SoundcloudModule, + StormoTvModule, StreamCloudModule, SVTOppetArkivModule, SVTPLAYModule, diff --git a/manifest.json b/manifest.json index 342e2e1..aefb8cb 100644 --- a/manifest.json +++ b/manifest.json @@ -89,6 +89,9 @@ }, { "matches": ["*://*.pornhub.com/*"], "js": ["js/jquery-2.1.4.min.js", "js/content_scripts/pornhub-content-scripts.js"] + }, { + "matches": ["*://*.stormo.tv/*"], + "js": ["js/jquery-2.1.4.min.js", "js/content_scripts/stormotv-content-scripts.js"] }], "web_accessible_resources": [ "images/*"