Commit 3830e4b9 authored by Zeyu DONG's avatar Zeyu DONG
Browse files

optimize tab searching policy to release 1.0

parent 6ece3671
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -5,17 +5,22 @@ chrome.runtime.onMessage.addListener(
						password: localStorage.getItem('password'), 
						auto: localStorage.getItem('autologin')});
		else if(request.command == "close")
			chrome.tabs.getSelected(function(tab) {
				chrome.tabs.getAllInWindow(function(tab2) {
					if(tab2.length > 1) {
						chrome.tabs.remove(tab.id);
			chrome.tabs.getAllInWindow(function(tab) {
				var target_tab;
				for (var i=0; i<tab.length; i++) {
					if(tab[i].url.indexOf("http://enet.10000.gd.cn:10001/sz/sz112/index.jsp") >= 0)
						target_tab = tab[i];
				}
				if(tab != null) {
					if(tab.length > 1) {
						chrome.tabs.remove(target_tab.id);
					}
					else {
						chrome.tabs.update(tab.id, {
						chrome.tabs.update(target_tab.id, {
							url: "chrome://newtab"
						});
					}			
				});
				}
			});
	}
);
+1 −1
Original line number Diff line number Diff line
{
"name": "CAS Login",
"version": "0.1",
"version": "1.0",
"manifest_version": 2,
"description": "Auto login cas in SUSTech",
"icons": { "128": "icon.png" },