Skip to content

Commit 75174d0

Browse files
committed
Revert "Add content script for check to playing video"
This reverts commit 231ed81.
1 parent 231ed81 commit 75174d0

File tree

3 files changed

+6
-36
lines changed

3 files changed

+6
-36
lines changed

manifest.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"name": "Web Activity Time Tracker",
55
"short_name": "Web Activity",
6-
"version": "0.8.1",
6+
"version": "0.8.0",
77
"minimum_chrome_version": "26",
88

99
"description": "Track your activity in the browser.",
@@ -23,16 +23,10 @@
2323
"idle",
2424
"chrome://favicon/*",
2525
"webNavigation",
26-
"unlimitedStorage"
26+
"unlimitedStorage",
27+
"<all_urls>"
2728
],
2829
"offline_enabled": true,
29-
"content_scripts": [
30-
{
31-
"matches": ["http://*/*", "https://*/*"],
32-
"js": ["scripts/contentScript.js"],
33-
"run_at": "document_end"
34-
}
35-
],
3630
"background": {
3731
"scripts": ["scripts/common.js",
3832
"scripts/storage.js",

scripts/background.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ function backgroundCheck() {
3636

3737
if (tab !== undefined) {
3838
activity.setCurrentActiveTab(tab.url);
39-
4039
chrome.idle.queryState(parseInt(setting_interval_inactivity), function (state) {
4140
if (state === 'active') {
4241
mainTRacker(activeUrl, tab, activeTab);
@@ -105,12 +104,9 @@ function isVideoPlayedOnPage() {
105104

106105
function checkDOM(state, activeUrl, tab, activeTab) {
107106
if (state === 'idle') {
108-
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
109-
chrome.tabs.sendMessage(tabs[0].id, { action: 'CHECK_VIDEO' }, function (response) {
110-
if (response !== undefined && response.value !== undefined && response.value === true) {
111-
mainTRacker(activeUrl, tab, activeTab);
112-
}
113-
});
107+
chrome.tabs.executeScript({ code: "var videoElement = document.getElementsByTagName('video')[0]; (videoElement !== undefined && videoElement.currentTime > 0 && !videoElement.paused && !videoElement.ended && videoElement.readyState > 2);" }, (results) => {
108+
if (results !== undefined && results[0] !== undefined && results[0] === true)
109+
mainTRacker(activeUrl, tab, activeTab);
114110
});
115111
}
116112
}

scripts/contentScript.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)