infiinite redirect loops hopefully fixed

This commit is contained in:
qt31415926
2015-04-02 18:44:36 -04:00
parent 98481749e5
commit 79f261e1fb
4 changed files with 65 additions and 13 deletions
+32 -7
View File
@@ -45,14 +45,41 @@ window.onload = function setupUpdater(){
input.onkeydown=input.onkeyup=onClick=eventHandler;
};
var activate = function(){
var currTabs = chrome.extension.getBackgroundPage().currTabs;
chrome.tabs.query({
active: true,
windowId: window.id
}, function (tabs, req){
/* console.log("GPS CWGC tabs");
console.log(tabs);
console.log("GPS CWGC tabs[0]");
console.log(tabs[0]);
console.log("GPS CWGC currTabs");
console.log(currTabs);*/
result = $.grep(currTabs, function(e){
return e.tabId == tabs[0].id;
});
/* console.log("result");
console.log(result);*/
req = result;
if (req.length==0){
return "";
}
else{
$("#message").text("You've Unlocked The Button...\nI hope you don't regret this");
$(".btn-success").removeAttr("disabled");
$(".btn-success").attr("href", req[0].origUrl);
}
});
}
//Button Listener function yeah yeah its jquery and the rest of this wasnt, I am learning!
$(function(){
$(".btn-primary").click(function(){
if (passed){
$("#message").text("You've Unlocked The Button...\nI hope you don't regret this");
$(".btn-success").removeAttr("disabled");
console.log(chrome.extension.getBackgroundPage());
$(".btn-success").attr("href", chrome.extension.getBackgroundPage().prevSite);
activate();
}
else
$("#message").text("You failed! (typos are allowed)");
@@ -64,9 +91,7 @@ $(function(){
$('#input-a').keydown(function(e) {
if (e.keyCode == 13){
if (passed){
$("#message").text("You've Unlocked The Button...\nI hope you don't regret this");
$(".btn-success").removeAttr("disabled");
$(".btn-success").attr("href", chrome.extension.getBackgroundPage().prevSite);
activate();
}
else
$("#message").text("You failed! (typos are allowed)");