Skip to content

Commit a203b0d

Browse files
committed
v1.8.0 + final tweaks + fixed #27
1 parent 767a004 commit a203b0d

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Please provide valuable feedback by:
2323

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

26+
_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._
27+
2628
<img src="preview/repo/auto-show-hide-feature-new-feature.png" width="250"/>
2729

2830
- Refreshed "Update Notice":

src/pages/Background/modules/installationHelper.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ chrome.runtime.onInstalled.addListener((details) => {
1818
const prevVersion = details.previousVersion;
1919
console.log(thisVersion, prevVersion);
2020
}
21+
if (details.reason === 'install' || details.reason === 'update') {
22+
console.log('go to release log page');
23+
chrome.tabs.create({
24+
url: `https://github.com/lxieyang/vertical-tabs-chrome-extension/blob/master/CHANGELOG.md#v1x-official-releases`,
25+
});
26+
}
2127
});
2228

2329
let shouldShowTips = false;

src/pages/Content/index.jsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ updateNoticeRoot.setAttribute('id', 'vt-update-notice');
1818
localStorage.removeItem('vt-update-notice-dismissed');
1919

2020
document.addEventListener('visibilitychange', (info) => {
21+
// console.log(info);
2122
// console.log(document.hidden);
2223
try {
2324
chrome.runtime.sendMessage({ msg: 'GET_VERSION_NUMBER' }, (response) => {
@@ -219,6 +220,19 @@ const focusOffSidebarHandler = (event) => {
219220
clearTimeout(mouseLeftSidebarTimer);
220221
};
221222

223+
const visibilityChangeOnSidebarHandler = (info) => {
224+
if (isToggledOpenGloballyFromBackground === true) {
225+
return;
226+
}
227+
if (document.hidden) {
228+
// console.log('mouse left');
229+
if (Frame.isReady()) {
230+
Frame.toggle(false);
231+
}
232+
clearTimeout(mouseLeftSidebarTimer);
233+
}
234+
};
235+
222236
let isMouseWithinEdgeDelta = false;
223237
let isToggledOpenGloballyFromBackground = false;
224238
const openSidebarUponMouseOverWindowEdgeEventHandler = (event) => {
@@ -260,6 +274,10 @@ const mountAutoShowHideListener = () => {
260274
);
261275

262276
$(document).on('blur', `#${SIDEBAR_CONTAINER_ID}`, focusOffSidebarHandler);
277+
document.addEventListener(
278+
'visibilitychange',
279+
visibilityChangeOnSidebarHandler
280+
);
263281
};
264282

265283
const unmountAutoShowHideListener = () => {
@@ -275,6 +293,10 @@ const unmountAutoShowHideListener = () => {
275293
mouseLeftSidebarHandler
276294
);
277295
$(document).off('blur', `#${SIDEBAR_CONTAINER_ID}`, focusOffSidebarHandler);
296+
document.removeEventListener(
297+
'visibilitychange',
298+
visibilityChangeOnSidebarHandler
299+
);
278300
};
279301

280302
/**

src/pages/Sidebar/containers/Title/Title.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import DarkModeContext from '../../context/dark-mode-context';
1717
class Title extends Component {
1818
state = {
1919
sidebarOnLeft: null,
20-
isSettingsPopoverOpen: true,
20+
isSettingsPopoverOpen: false,
2121

2222
// settings
2323
settingSidebarLocation: 'left',

0 commit comments

Comments
 (0)