Skip to content

Commit

Permalink
v1.8.0 + final tweaks + fixed #27
Browse files Browse the repository at this point in the history
  • Loading branch information
lxieyang committed Apr 5, 2020
1 parent 767a004 commit a203b0d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Please provide valuable feedback by:

- Automatically show/hide sidebar ([#27](https://github.com/lxieyang/vertical-tabs-chrome-extension/issues/27)):

_Simply move your mouse cursor to either side (depending on your chosen sidebar position, see the first setting entry) of the window to open the sidebar. Once your cursor moves away, the sidebar will automatically close._

<img src="preview/repo/auto-show-hide-feature-new-feature.png" width="250"/>

- Refreshed "Update Notice":
Expand Down
6 changes: 6 additions & 0 deletions src/pages/Background/modules/installationHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ chrome.runtime.onInstalled.addListener((details) => {
const prevVersion = details.previousVersion;
console.log(thisVersion, prevVersion);
}
if (details.reason === 'install' || details.reason === 'update') {
console.log('go to release log page');
chrome.tabs.create({
url: `https://github.com/lxieyang/vertical-tabs-chrome-extension/blob/master/CHANGELOG.md#v1x-official-releases`,
});
}
});

let shouldShowTips = false;
Expand Down
22 changes: 22 additions & 0 deletions src/pages/Content/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ updateNoticeRoot.setAttribute('id', 'vt-update-notice');
localStorage.removeItem('vt-update-notice-dismissed');

document.addEventListener('visibilitychange', (info) => {
// console.log(info);
// console.log(document.hidden);
try {
chrome.runtime.sendMessage({ msg: 'GET_VERSION_NUMBER' }, (response) => {
Expand Down Expand Up @@ -219,6 +220,19 @@ const focusOffSidebarHandler = (event) => {
clearTimeout(mouseLeftSidebarTimer);
};

const visibilityChangeOnSidebarHandler = (info) => {
if (isToggledOpenGloballyFromBackground === true) {
return;
}
if (document.hidden) {
// console.log('mouse left');
if (Frame.isReady()) {
Frame.toggle(false);
}
clearTimeout(mouseLeftSidebarTimer);
}
};

let isMouseWithinEdgeDelta = false;
let isToggledOpenGloballyFromBackground = false;
const openSidebarUponMouseOverWindowEdgeEventHandler = (event) => {
Expand Down Expand Up @@ -260,6 +274,10 @@ const mountAutoShowHideListener = () => {
);

$(document).on('blur', `#${SIDEBAR_CONTAINER_ID}`, focusOffSidebarHandler);
document.addEventListener(
'visibilitychange',
visibilityChangeOnSidebarHandler
);
};

const unmountAutoShowHideListener = () => {
Expand All @@ -275,6 +293,10 @@ const unmountAutoShowHideListener = () => {
mouseLeftSidebarHandler
);
$(document).off('blur', `#${SIDEBAR_CONTAINER_ID}`, focusOffSidebarHandler);
document.removeEventListener(
'visibilitychange',
visibilityChangeOnSidebarHandler
);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Sidebar/containers/Title/Title.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import DarkModeContext from '../../context/dark-mode-context';
class Title extends Component {
state = {
sidebarOnLeft: null,
isSettingsPopoverOpen: true,
isSettingsPopoverOpen: false,

// settings
settingSidebarLocation: 'left',
Expand Down

0 comments on commit a203b0d

Please sign in to comment.