Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnuqw committed Dec 30, 2019
2 parents 904f251 + 789a127 commit ca4788a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion addon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"author": "mbnuqw",
"name": "__MSG_ExtName__",
"version": "4.0.1",
"version": "4.0.2",
"default_locale": "en",
"description": "__MSG_ExtDesc__",
"homepage_url": "https://github.com/mbnuqw/sidebery",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sidebery",
"version": "4.0.1",
"version": "4.0.2",
"description": "Manage your tabs and bookmarks in sidebar",
"main": "index.js",
"scripts": {
Expand Down
29 changes: 12 additions & 17 deletions src/page.settings/actions/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,12 @@ async function loadPermissions(init) {
}
}

async function goToPerm(hash, permId) {
function goToPerm(permId) {
if (!this.state.settingsRefs) return
let scrollHighlightConf = { behavior: 'smooth', block: 'center' }
let el = this.state.settingsRefs[permId]

await this.actions.waitForInit()

if (hash !== undefined && this.state.settingsRefs) {
let el = this.state.settingsRefs[permId]
if (el) el.scrollIntoView(scrollHighlightConf)
}
if (el) el.scrollIntoView(scrollHighlightConf)

document.title = 'Sidebery / Settings'
this.state.activeView = 'Settings'
Expand All @@ -82,29 +79,27 @@ async function goToPerm(hash, permId) {
/**
* Check url hash and update active view
*/
function updateActiveView() {
async function updateActiveView() {
let hash = location.hash ? location.hash.slice(1) : location.hash
let hashArg = hash.split('.')
hash = hashArg[0]
let arg = hashArg[1]
let scrollSectionConf = { behavior: 'smooth', block: 'start' }

if (hash === 'all-urls') return this.actions.goToPerm(hash, 'all_urls')
if (hash === 'tab-hide') return this.actions.goToPerm(hash, 'tab_hide')
if (hash === 'clipboard-write') {
return this.actions.goToPerm(hash, 'clipboard_write')
}
if (hash === 'web-request-blocking') {
return this.actions.goToPerm(hash, 'web_request_blocking')
}

if (this.__navLockTimeout) clearTimeout(this.__navLockTimeout)
this.state.navLock = true
this.state.activeSection = hash
this.__navLockTimeout = setTimeout(() => {
this.state.navLock = false
}, 1250)

await this.actions.waitForInit()

if (hash === 'all-urls') return this.actions.goToPerm('all_urls')
if (hash === 'tab-hide') return this.actions.goToPerm('tab_hide')
if (hash === 'clipboard-write') return this.actions.goToPerm('clipboard_write')
if (hash === 'web-request-blocking') return this.actions.goToPerm('web_request_blocking')

if (hash.startsWith('menu_editor')) {
setTimeout(
() => {
Expand Down
8 changes: 6 additions & 2 deletions src/sidebar/actions/panels.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function updatePanels(newPanels) {
}
}

let activePanel = this.state.panels[this.state.panelIndex]
let panels = []
let panelsMap = {}
let updateNeeded = false
Expand Down Expand Up @@ -77,13 +78,16 @@ async function updatePanels(newPanels) {
this.state.panels = panels
this.state.panelsMap = panelsMap

let activePanelIndex = this.state.panels.indexOf(activePanel)
if (activePanelIndex !== -1) this.state.panelIndex = activePanelIndex

if (updateNeeded) this.actions.updatePanelsTabs()
if (reloadNeeded) {
this.handlers.resetTabsListeners()

let index = 0
let index = this.getters.pinnedTabs.length
let windowId = this.state.windowId
let allTabs = []
let allTabs = [...this.getters.pinnedTabs]
for (let panel of this.state.panels) {
if (!panel.tabs || !panel.tabs.length) continue
for (let tab of panel.tabs) {
Expand Down

0 comments on commit ca4788a

Please sign in to comment.