Skip to content

Commit

Permalink
Attempt #2 to fix Vessel. This time load the script on vessel.com ins…
Browse files Browse the repository at this point in the history
…tead of vessel.com/videos so people visiting vessel.com will also get the content script.
  • Loading branch information
khloke committed Jun 23, 2015
1 parent f7a898c commit 5f7148f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 12 deletions.
4 changes: 4 additions & 0 deletions js/background_scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ chrome.extension.onMessage.addListener(
sendResponse({response: "OK"});
});
break;

case 'resume':
playThisUrl(request.url, function(){
resume(request.currentTime, function () {
sendResponse({response: "OK"});
})});
break;
case 'setLogging':
debugLogsEnabled = request.enable;
break;
}

return true;
Expand Down
3 changes: 3 additions & 0 deletions js/content_scripts/vessel-content-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

chrome.extension.onMessage.addListener(
function(request, sender, sendResponse) {
console.log("Received message: " + request.action);
if (request.action == "getVideoSrc") {
var videoSrc = decodeURIComponent($('video.video-show').attr('src'));
sendResponse({videoSrc: videoSrc});
} else if (request.action == 'onPlayback') {
$('video')[0].pause();
} else {
console.log('Unknown action: ' + request.action);
}
}
);
4 changes: 3 additions & 1 deletion js/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,13 @@ var VesselLabModule = {
return 'video';
},
getPluginPath: function(url, callback) {
if (debugLogsEnabled) console.log("Sending message to tab '" + currentTabId + "' for video source.");
chrome.tabs.sendMessage(currentTabId, {action: 'getVideoSrc'}, function (response) {
if (debugLogsEnabled) {console.log("Response from content script:"); console.log(response); }
if (response) {
callback(response.videoSrc);
} else {
if (debugLogsEnabled) console.log("Did not receive response for message")
if (debugLogsEnabled) console.log("Did not receive response for message");
}
});
}
Expand Down
3 changes: 3 additions & 0 deletions js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ $(document).ready(function(){
localStorage.setItem(storageKeys.enableMultiHost, $(this).prop('checked'));
populateProfiles();
});
$('#enableDebugLogs').change(function() {
chrome.extension.sendMessage({action: 'setLogging', enable: $(this).prop('checked')}, function (response) {});
});
$('#paypalDonate').click(function() {
goToPaypal();
});
Expand Down
4 changes: 2 additions & 2 deletions js/xbmc-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* curl -i -X POST --header Content-Type:"application/json" -d '' http://localhost:8085/jsonrpc
*/

var debugLogsEnabled = localStorage[storageKeys.enableDebugLogs];
var debugLogsEnabled = localStorage[storageKeys.enableDebugLogs] == 'true';

function getSiteName(url) {
if (url.match("magnet:")) {
Expand All @@ -22,7 +22,7 @@ function getPluginPath(url, callback) {
foundModule = true;
if (debugLogsEnabled) console.log("Found module to handle url: " + url);
module.getPluginPath(url, function(path) {
if (debugLogsEnabled) console.log("Path to play media: " + url);
if (debugLogsEnabled) console.log("Path to play media: " + path);
callback(module.getMediaType(), path);
});
}
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifest_version": 2,
"version": "1.7.5.2",
"version": "1.7.5.3",
"name": "Play to Kodi",
"description": "Play, queue and remote control your favourite online media on Kodi / XBMC.",
"options_page": "options.html",
Expand Down Expand Up @@ -59,7 +59,7 @@
"matches": ["*://*.kino-live.org/*"],
"js": ["js/content_scripts/kinolive-content-scripts.js", "js/jquery-2.1.4.min.js"]
}, {
"matches": ["*://*.vessel.com/videos/*"],
"matches": ["*://*.vessel.com/*"],
"js": ["js/content_scripts/vessel-content-scripts.js", "js/jquery-2.1.4.min.js"]
}],
"web_accessible_resources": [
Expand Down
12 changes: 5 additions & 7 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,13 @@
<div class="alert" style="margin: 0 25px 15px 25px;">If you have problems please contact me directly at <a href="mailto:[email protected]">[email protected]</a>. Leaving your problems in the <strong>Reviews won't help</strong> you or me solve the problem if I can't replicate it.</div>
<div style="margin: 0 25px">
<p>
<strong>Update 1.7.5.2</strong>
<ul>
<li>Fixed an issue with enabling/disabling multi hosts.</li>
</ul>
</p>
<p>
<strong>Update 1.7.5.1</strong>
<strong>Update 1.7.5.1 - 1.7.5.3</strong>
<ul>
<li>Make "Pause on Play" work when using the "Play Now" button on YouTube</li>
<li>Fixed an issue with enabling/disabling multi hosts.</li>
<li>More fixes for Vessel.</li>
<li>Fix debug logging toggle</li>
<li>Add more logging to help pinpoint problem with Vessel</li>
</ul>
</p>
<p>
Expand Down

0 comments on commit 5f7148f

Please sign in to comment.