var tabId=parseInt(location.href.replace(/.*tabid=([0-9]*).*/,"$1"));isNaN(tabId)&&alert("Invalid tab id");var backgroundPage=chrome.extension.getBackgroundPage(),tabInfo=backgroundPage.tabStatus[tabId],setting=backgroundPage.setting;tabInfo||alert("Cannot get tab tabInfo");
$(document).ready(function(){$(".status").hide();$("#submitissue").hide();tabInfo.urldetect?$("#status_urldetect").show():tabInfo.count&&(tabInfo.error?$("#status_error").show():tabInfo.count!=tabInfo.actived?$("#status_disabled").show():($("#status_ok").show(),$("#submitissue").show()))});
$(document).ready(function(){$("#issue_view").hide();if(0!==tabInfo.error){var b=setting.issues[tabInfo.issueId];$("#issue_content").text(b.description);var a=b.url;a||(a="http://code.google.com/p/np-activex/issues/detail?id="+b.issueId);$("#issue_track").click(function(){chrome.tabs.create({url:a});window.close()});$("#issue_view").show()}});function refresh(){alert($$("refresh_needed"));window.close()}
function showEnableBtns(){var b=$("#enable_btns");b.hide();if(tabInfo.urldetect||tabInfo.count>tabInfo.actived){b.show();for(var a={actived:!0},c=0;c<tabInfo.frames&&a.actived;++c)for(var d=0;d<tabInfo.objs[c].length&&a.actived;++d)a=tabInfo.objs[c][d];if(!a.actived){var e=setting.getFirstMatchedRule(a,setting.defaultRules);if(e)a=$("<button>").addClass("defaultRule"),a.text($$("enable_default_rule",e.title)),a.click(function(){setting.activeRule(e);refresh()}),b.append(a);else{var c=a.href.replace(/[^:]*:\/\/([^\/]*).*/,
"$1"),f=a.href.replace(/([^:]*:\/\/[^\/]*).*/,"$1/*"),c=$("<button>").addClass("customRule").text($$("add_rule_site",c)).click(function(){var a=setting.createRule();a.type="wild";a.value=f;setting.addCustomRule(a,"popup");refresh()}),g=a.clsid,a=$("<button>").addClass("customRule").text($$("add_rule_clsid")).click(function(){var a=setting.createRule();a.type="clsid";a.value=g;setting.addCustomRule(a,"popup");refresh()});b.append(c).append(a)}}}}
$(document).ready(function(){$("#submitissue").click(function(){tabInfo.tracking=!0;alert($$("issue_submitting_desp"));window.close()})});$(document).ready(showEnableBtns);
