修改判断是否还有新未读的文件方法
This commit is contained in:
parent
32d06134c8
commit
6ebf0895d3
|
@ -26,7 +26,10 @@ chrome.runtime.onInstalled.addListener(function () {
|
||||||
}
|
}
|
||||||
var now = new Date().getTime();
|
var now = new Date().getTime();
|
||||||
|
|
||||||
|
//console.log("++++++++++++++++ Process Page %d", i);
|
||||||
|
|
||||||
if (g_tabArray[i].lastClick == 0 || now - g_tabArray[i].stamp > 5 * 1000) {
|
if (g_tabArray[i].lastClick == 0 || now - g_tabArray[i].stamp > 5 * 1000) {
|
||||||
|
//console.log("++++++++++++++++ Send Read Page");
|
||||||
chrome.tabs.sendMessage(tabId, {
|
chrome.tabs.sendMessage(tabId, {
|
||||||
from: 'background', to: 'content_scripts', action: 'cs_read_page', tabId: tabId
|
from: 'background', to: 'content_scripts', action: 'cs_read_page', tabId: tabId
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
|
@ -51,6 +54,7 @@ chrome.runtime.onInstalled.addListener(function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(g_readItems >= g_totalItems && g_tabArray.length == 0 && g_readItems != 0) {
|
if(g_readItems >= g_totalItems && g_tabArray.length == 0 && g_readItems != 0) {
|
||||||
g_isRunCmd = false;
|
g_isRunCmd = false;
|
||||||
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
||||||
|
@ -58,13 +62,13 @@ chrome.runtime.onInstalled.addListener(function () {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.tabs.onRemoved.addListener(function (tabId, removeInfo) {
|
chrome.tabs.onRemoved.addListener(function (tabId, removeInfo) {
|
||||||
for (var i = 0; i < g_tabArray.length; i++) {
|
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);
|
g_tabArray.splice(i, 1);
|
||||||
console.log("Remove Page[%d]:", tabId, removeInfo);
|
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) {
|
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 })
|
g_tabArray.push({ tab: tb, stamp: new Date().getTime(), status: "new", url: request.url, lastClick: 0 })
|
||||||
console.log("%o", tb);
|
console.log("%o", tb);
|
||||||
|
console.log("Create %d tables", g_tabArray.length);
|
||||||
});
|
});
|
||||||
} else if (request.action == "bg_click_table") {
|
} else if (request.action == "bg_click_table") {
|
||||||
|
|
||||||
|
|
2
js/oa.js
2
js/oa.js
|
@ -154,6 +154,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
flushUnReadList(nUnRead.index, nUnRead.nItem);
|
flushUnReadList(nUnRead.index, nUnRead.nItem);
|
||||||
g_proStep = STEP_GET_UNREADLIST;
|
g_proStep = STEP_GET_UNREADLIST;
|
||||||
|
} else {
|
||||||
|
g_isRun = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STEP_GET_UNREADLIST:
|
case STEP_GET_UNREADLIST:
|
||||||
|
|
|
@ -16,12 +16,22 @@
|
||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": ["https://oa.komect.com/oa/oa*"],
|
"matches": ["https://oa.komect.com/oa/oa/*"],
|
||||||
"js": ["js/oa.js"],
|
"js": ["js/oa.js"],
|
||||||
"run_at": "document_start"
|
"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"],
|
"js": ["js/read.js"],
|
||||||
"run_at": "document_start"
|
"run_at": "document_start"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue