Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not change the tab activity colour (fade) when quickly skipping past tabs. #2182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
35 changes: 28 additions & 7 deletions js/navbar/tabActivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,39 @@ var tabBar = require('navbar/tabBar.js')

var tabActivity = {
minFadeAge: 330000,
refreshInterval: 7500,
tabSelected: function() {
var selected = tabs.getSelected()
if (tabBar.getTab(selected).classList.contains('fade')) {
// check to see if it is still has been selected in .500 seconds
setTimeout(function (tabID) {
if (tabs.getSelected() != tabID) {
var tab = tabs.get(tabID)
if (tab) {
tabBar.getTab(tabID).classList.add('fade')
tabs.update(tabID, {'lastActivity':tab.lastActivity - tabActivity.minFadeAge})
}

}
}, 500, selected);
}

// never fade the current tab
tabBar.getTab(selected).classList.remove('fade')


},
refresh: function () {
requestAnimationFrame(function () {
var tabSet = tabs.get()
var selected = tabs.getSelected()
var time = Date.now()

tabSet.forEach(function (tab) {
if (selected === tab.id) { // never fade the current tab
tabBar.getTab(tab.id).classList.remove('fade')
return
}
if (time - tab.lastActivity > tabActivity.minFadeAge) { // the tab has been inactive for greater than minActivity, and it is not currently selected
if (selected == tab.id) { return }

//else
if ((time - tab.lastActivity > tabActivity.minFadeAge)) { // the tab has been inactive for greater than minActivity, and it is not currently selected
tabBar.getTab(tab.id).classList.add('fade')
} else {
tabBar.getTab(tab.id).classList.remove('fade')
Expand All @@ -24,9 +45,9 @@ var tabActivity = {
})
},
initialize: function () {
setInterval(tabActivity.refresh, 7500)
setInterval(tabActivity.refresh, this.refreshInterval)

tasks.on('tab-selected', this.refresh)
tasks.on('tab-selected', this.tabSelected)
}
}

Expand Down