mirror of
https://github.com/wassname/mad.git
synced 2026-09-10 12:14:21 +08:00
infiinite redirect loops hopefully fixed
This commit is contained in:
+32
-7
@@ -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)");
|
||||
|
||||
Reference in New Issue
Block a user