From 6ebf0895d34bb75a82bce4afe01ec85372bc27f5 Mon Sep 17 00:00:00 2001 From: huangxin Date: Thu, 9 Jan 2020 09:32:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E8=BF=98=E6=9C=89=E6=96=B0=E6=9C=AA=E8=AF=BB=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/background.js | 9 +++++++-- js/oa.js | 2 ++ manifest.json | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/js/background.js b/js/background.js index 7ac27f8..54f82cf 100644 --- a/js/background.js +++ b/js/background.js @@ -26,7 +26,10 @@ chrome.runtime.onInstalled.addListener(function () { } var now = new Date().getTime(); + //console.log("++++++++++++++++ Process Page %d", i); + if (g_tabArray[i].lastClick == 0 || now - g_tabArray[i].stamp > 5 * 1000) { + //console.log("++++++++++++++++ Send Read Page"); chrome.tabs.sendMessage(tabId, { from: 'background', to: 'content_scripts', action: 'cs_read_page', tabId: tabId }, function (response) { @@ -51,6 +54,7 @@ chrome.runtime.onInstalled.addListener(function () { } } + /* if(g_readItems >= g_totalItems && g_tabArray.length == 0 && g_readItems != 0) { g_isRunCmd = false; chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { @@ -58,13 +62,13 @@ chrome.runtime.onInstalled.addListener(function () { console.log(response); }); }); - } + }*/ }, 1000); }); chrome.tabs.onRemoved.addListener(function (tabId, removeInfo) { for (var i = 0; i < g_tabArray.length; i++) { - if (g_tabArray[i].tab.id = tabId) { + if (g_tabArray[i].tab.id == tabId) { g_tabArray.splice(i, 1); console.log("Remove Page[%d]:", tabId, removeInfo); } @@ -116,6 +120,7 @@ chrome.extension.onMessage.addListener(function (request, sender, sendResponse) chrome.tabs.create({ url: request.url, active: false }, function (tb) { g_tabArray.push({ tab: tb, stamp: new Date().getTime(), status: "new", url: request.url, lastClick: 0 }) console.log("%o", tb); + console.log("Create %d tables", g_tabArray.length); }); } else if (request.action == "bg_click_table") { diff --git a/js/oa.js b/js/oa.js index cf0ce5e..33527ad 100644 --- a/js/oa.js +++ b/js/oa.js @@ -154,6 +154,8 @@ document.addEventListener('DOMContentLoaded', function () { console.log(msg); flushUnReadList(nUnRead.index, nUnRead.nItem); g_proStep = STEP_GET_UNREADLIST; + } else { + g_isRun = false; } break; case STEP_GET_UNREADLIST: diff --git a/manifest.json b/manifest.json index 14a47e3..6ba8ac3 100644 --- a/manifest.json +++ b/manifest.json @@ -16,12 +16,22 @@ }, "content_scripts": [ { - "matches": ["https://oa.komect.com/oa/oa*"], + "matches": ["https://oa.komect.com/oa/oa/*"], "js": ["js/oa.js"], "run_at": "document_start" }, { - "matches": ["https://oa.komect.com/oa/document*"], + "matches": ["https://oa.komect.com:2100/oa/oa/*"], + "js": ["js/oa.js"], + "run_at": "document_start" + }, + { + "matches": ["https://oa.komect.com/oa/document/*"], + "js": ["js/read.js"], + "run_at": "document_start" + }, + { + "matches": ["https://oa.komect.com:2100/oa/document/*"], "js": ["js/read.js"], "run_at": "document_start" }