From 9c176fb846377edf0d9e600140c1863f84dc9b32 Mon Sep 17 00:00:00 2001 From: khloke Date: Thu, 24 Oct 2013 23:13:32 +1000 Subject: [PATCH] -Bump version number to prepare for new release -Some code clean up --- .../khanacademy-content-scripts.js | 9 ++++++- js/remote.js | 27 +++++++++---------- js/shared.js | 2 +- js/xbmc-helper.js | 18 ++++++++----- manifest.json | 4 +-- options.html | 6 +++++ 6 files changed, 40 insertions(+), 26 deletions(-) diff --git a/js/content_scripts/khanacademy-content-scripts.js b/js/content_scripts/khanacademy-content-scripts.js index 73872ef..e9fe864 100644 --- a/js/content_scripts/khanacademy-content-scripts.js +++ b/js/content_scripts/khanacademy-content-scripts.js @@ -4,7 +4,14 @@ init(); chrome.extension.onMessage.addListener( function(request, sender, sendResponse) { - if (request.action == "getYoutubeId") { + if (request.action == "isValid") { + if (youtubeid) { + sendResponse({valid: JSON.stringify(true)}); + } else { + sendResponse({valid: JSON.stringify(false)}) + } + + } else if (request.action == "getYoutubeId") { if (youtubeid) { sendResponse({youtubeId: JSON.stringify(youtubeid)}); } diff --git a/js/remote.js b/js/remote.js index 2741ef5..a02980b 100644 --- a/js/remote.js +++ b/js/remote.js @@ -251,7 +251,7 @@ function initJsonVersion() { }); } -function activateVideoButton() { +function enableVideoButtons() { $(".disabled-btn").each(function () { $(this).removeAttr('disabled') }); @@ -260,25 +260,22 @@ function activateVideoButton() { }); } +function enablePlaylistButtons() { + var queueListButton = $('#queueListButton'); + queueListButton.attr('disabled', false); + queueListButton.parent().removeClass('disabled'); +} function initVideoButton() { chrome.tabs.getSelected(null, function (tab) { var url = tab.url; - var valid = validUrl(url); - var validPlaylist = validPlaylistUrl(url); - // if valid, enable buttons - if (valid) { - activateVideoButton(); - } - - if (validPlaylist) { - var queueListButton = $('#queueListButton'); - queueListButton.attr('disabled', false); - queueListButton.parent().removeClass('disabled'); - } - validPage(function() { - activateVideoButton(); + validVideoPage(url, function() { + enableVideoButtons(); }); + + if (validPlaylistUrl(url)) { + enablePlaylistButtons(); + } }); } diff --git a/js/shared.js b/js/shared.js index 8dc0098..2420b9c 100644 --- a/js/shared.js +++ b/js/shared.js @@ -1,4 +1,4 @@ -var currentVersion = 1422; +var currentVersion = 1430; var storageKeys = { "showRepeat": "showRepeat", diff --git a/js/xbmc-helper.js b/js/xbmc-helper.js index 21c6150..6c16c19 100644 --- a/js/xbmc-helper.js +++ b/js/xbmc-helper.js @@ -265,14 +265,18 @@ function validPlaylistUrl(url) { return false; } -function validPage(callback) { - chrome.tabs.getSelected(null, function (tab) { - chrome.tabs.sendMessage(tab.id, {action: 'getYoutubeId'}, function (response) { - if (response) { - callback(); - } +function validVideoPage(url, callback) { + if (validUrl(url)) { + callback(); + } else { + chrome.tabs.getSelected(null, function (tab) { + chrome.tabs.sendMessage(tab.id, {action: 'isValid'}, function (response) { + if (response) { + callback(); + } + }); }); - }); + } } function clearPlaylist(callback) { diff --git a/manifest.json b/manifest.json index f33ce3b..2f63bc8 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, - "version": "1.4.2.2", + "version": "1.4.3.0", "name": "Play to XBMC", - "description": "Play YouTube, Vimeo, DailyMotion, CollegeHumor, eBaumsWorld, LiveLeak, Twitch.tv, Khan Academy, Hulu and more on XBMC.", + "description": "Play, queue and control your favourite Internet media on XBMC.", "options_page": "options.html", "permissions": [ "tabs", "http://*/*", "contextMenus" ], "browser_action": { diff --git a/options.html b/options.html index 74a797b..9cd69ac 100644 --- a/options.html +++ b/options.html @@ -86,6 +86,12 @@
+

+ Update 1.4.3.0: +

    +
  • Added support for XBMCtorrent. You can now use the context menus to play magnet links. For more information on XBMCtorrent, click HERE.
  • +
+

Update 1.4.2.1: