Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/scripts/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ class Activity {
this.addTimeInterval(domain);
}

clearCurrentActiveTab() {
this.closeIntervalForCurrentTab();
currentTab = null;
}

addTimeInterval(domain) {
var item = timeIntervalList.find(o => o.url.isMatch(domain) && o.day == todayLocalDate());
if (item != undefined) {
Expand All @@ -136,13 +131,16 @@ class Activity {
}
}

closeIntervalForCurrentTab() {
closeIntervalForCurrentTab(preserveCurrentTab) {
if (currentTab && timeIntervalList != undefined) {
var item = timeIntervalList.find(o => o.url.isMatch(currentTab) && o.day == todayLocalDate());
if (item != undefined)
item.closeInterval();
}
currentTab = null;

if (!preserveCurrentTab) {
currentTab = null;
}
}

isNeedNotifyView(domain, tab){
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function backgroundCheck() {
});
} else {
if (tab !== undefined) {
if (currentTab == null || !tab.url.isHostMatch(currentTab.host)) {
if (!tab.url.isMatch(currentTab)) {
activity.setCurrentActiveTab(tab.url);
}
chrome.idle.queryState(parseInt(setting_interval_inactivity), function(state) {
Expand All @@ -60,7 +60,7 @@ function backgroundCheck() {
}
}
}
} else activity.closeIntervalForCurrentTab();
} else activity.closeIntervalForCurrentTab(true);
});
}

Expand Down
11 changes: 6 additions & 5 deletions src/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ class UI {
this.getTableOfSite().appendChild(document.createElement('hr'));
}

setActiveTooltipe(currentTab) {
if (currentTab !== '') {
var element = document.getElementById(currentTab);
setActiveTooltip(currentTab) {
if (!!currentTab) {
const host = currentTab.host;
var element = document.getElementById(host);
if (element !== null) {
var event = new Event("mouseenter");
document.getElementById(currentTab).dispatchEvent(event);
document.getElementById(host).dispatchEvent(event);
}
}
}
Expand Down Expand Up @@ -197,7 +198,7 @@ class UI {
var spanUrl = this.createElement('span', ['span-url'], tabUrlString);
spanUrl.setAttribute('href', 'https://' + tabUrlString);

if (currentTab != null && tab.url.isHostMatch(currentTab.host)) {
if (tab.url.isMatch(currentTab)) {
var divForImage = document.createElement('div');
div.classList.add('span-active-url');
var imgCurrentDomain = document.createElement('img');
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/webact.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function getTabsFromStorage(tabs) {

summaryCounter += counter;

const targetTab = tabGroup.tabs[0];
const targetTab = tabGroup.tabs.find(t => t.url.isMatch(currentTab)) || tabGroup.tabs[0];

if (
currentTypeOfList === TypeListEnum.ToDay ||
Expand All @@ -271,7 +271,7 @@ function getTabsFromStorage(tabs) {
ui.addHrAfterTableOfSite();
ui.createTotalBlock(totalTime, currentTypeOfList, summaryCounter);
ui.drawChart(tabsForChart);
ui.setActiveTooltipe(currentTab);
ui.setActiveTooltip(currentTab);

ui.removePreloader();
}
Expand Down Expand Up @@ -576,7 +576,7 @@ function getTabsFromStorageByDay(day, blockName) {
for (const tabGroup of tabGroups){
var summaryTime = tabGroup.summaryTime;
var counter = tabGroup.counter;
const targetTab = tabGroup.tabs[0];
const targetTab = tabGroup.tabs.find(t => t.url.isMatch(currentTab)) || tabGroup.tabs[0];

ui.addLineToTableOfSite(targetTab, currentTab, summaryTime, TypeListEnum.ByDays, counter, blockName + '_content');
}
Expand Down