Skip to content

Commit

Permalink
Add first-install prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyu9575 committed Jan 31, 2020
1 parent 29db860 commit 4e7dd88
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/_locales/en/messages.cson
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ general:
excludePinnedTabs:
message: 'Exclude pinned tabs'
discardInactiveTabs:
message: 'Unload inactive tabs after switching groups'
message: 'Unload inactive tabs after switching groups'
enableBrowserRestoreSessionDesc:
message: 'Please enable "Restore previous session" in Firefox options.'
4 changes: 3 additions & 1 deletion src/_locales/zh_CN/messages.cson
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ general:
excludePinnedTabs:
message: '排除已固定标签页'
discardInactiveTabs:
message: '切换群组后不载入非活动标签页'
message: '切换群组后不载入非活动标签页'
enableBrowserRestoreSessionDesc:
message: '请在火狐选项中启用“恢复先前的浏览状态”。'
5 changes: 5 additions & 0 deletions src/background/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ export class BackgroundRemote {
}
}
registerRemoteHandler(new BackgroundRemote)

browser.runtime.onInstalled.addListener(({ reason, temporary }) => {
if (reason === 'install' && !temporary)
browser.tabs.create({ url: '/pages/first-install.html' });
})
Binary file added src/pages/first-install.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/pages/first-install.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends ../common/base.i.pug
append head
link(rel="stylesheet" href="first-install.css")
append body
h1(data-i18n='extensionName')
h2(data-i18n='enableBrowserRestoreSessionDesc')
img(src='./first-install.png' alt='Screenshot' width='960')
script(type='module' src='first-install.js')
2 changes: 2 additions & 0 deletions src/pages/first-install.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
body
text-align: center
3 changes: 3 additions & 0 deletions src/pages/first-install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { applyI18n } from "../util/webext/i18n.js";

applyI18n()

0 comments on commit 4e7dd88

Please sign in to comment.