From 42f4b84b41ad84f5f6dd2426e996dd1f7e1967b1 Mon Sep 17 00:00:00 2001 From: Wassup789 Date: Fri, 11 Jul 2014 19:28:45 -0700 Subject: [PATCH] Fixed channel input and placeholder --- background.js | 22 +++++++++++++++++++--- settings.js | 6 +++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/background.js b/background.js index 3a3dbf8..653e175 100644 --- a/background.js +++ b/background.js @@ -125,9 +125,8 @@ $(document).ready(function(){ localStorage.setItem("serverStatus", true); var channelsa = JSON.parse(localStorage.getItem("channels")); for(var i = 0; i < Object.keys(channelsa).length; i++){ - if(channelsa[i] != null){ + if(channelsa[i] != null) checkYoutube(i, channelsa[i]); - } } if(check == 1){ chrome.extension.sendMessage({browsing: "refreshPage"}, function(callback){}); @@ -151,7 +150,22 @@ $(document).ready(function(){ var channelsa = JSON.parse(localStorage.getItem("channels")); cname = channelsa[cnum]; } - var channelStatus = false; + + if(cname.indexOf(".com/") > -1){ + if(cname.split(".com/")[1].split("/").length < 1){ + setVariable("ytStatus", cnum, false); + wyn.log(1, "Channel: \"" + cname + "\" does not exist or connection cannot be made"); + return; + }else{ + cname = cname.split(".com/")[1]; + if(cname.indexOf("channel/") > -1) + cname = cname.split("channel/")[1].split("/")[0]; + else if(cname.indexOf("user/") > -1) + cname = cname.split("user/")[1].split("/")[0]; + setVariable("channels", cnum, cname); + } + } + var channel = "http://gdata.youtube.com/feeds/api/users/" + cname + "/uploads?v=2"; var channel2 = "http://gdata.youtube.com/feeds/api/users/" + cname + "?v=2"; @@ -176,6 +190,8 @@ $(document).ready(function(){ return time; } + var channelStatus; + $.ajax({ async: false, type: "GET", diff --git a/settings.js b/settings.js index 969c26f..cb7b1be 100644 --- a/settings.js +++ b/settings.js @@ -181,7 +181,7 @@ $(document).ready(function(){ \ ' + channels + '\ \ - \ + \ \ @@ -198,7 +198,7 @@ $(document).ready(function(){ \ ' + names + '\ \ - \ + \ \ @@ -276,7 +276,7 @@ $(document).ready(function(){