mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-04 17:07:23 +00:00
pages/search: cleanup
This commit is contained in:
parent
47fae3dfa7
commit
58bd805ee3
2 changed files with 8 additions and 8 deletions
|
|
@ -4,16 +4,12 @@ const labels = {
|
||||||
|
|
||||||
const lettersOrder = 'lkjhyuionm'
|
const lettersOrder = 'lkjhyuionm'
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
const digits2label = (digits) => [...digits]
|
const digits2label = (digits) => [...digits]
|
||||||
.map((digit) => lettersOrder[digit])
|
.map((digit) => lettersOrder[digit])
|
||||||
.join('')
|
.join('')
|
||||||
|
|
||||||
const label2digits = (label) => [...label]
|
|
||||||
.map((letter) => [...lettersOrder].findIndex((x) => x === letter))
|
|
||||||
.join('')
|
|
||||||
|
|
||||||
/* */
|
|
||||||
|
|
||||||
export const id2label = (id, tabs) => {
|
export const id2label = (id, tabs) => {
|
||||||
if (!labels[id]) {
|
if (!labels[id]) {
|
||||||
const label = Object.keys(labels).length
|
const label = Object.keys(labels).length
|
||||||
|
|
@ -25,6 +21,12 @@ export const id2label = (id, tabs) => {
|
||||||
return digits2label(digits)
|
return digits2label(digits)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
|
const label2digits = (label) => [...label]
|
||||||
|
.map((letter) => [...lettersOrder].findIndex((x) => x === letter))
|
||||||
|
.join('')
|
||||||
|
|
||||||
export const label2id = (label) => {
|
export const label2id = (label) => {
|
||||||
const paddedDigits = label2digits(label)
|
const paddedDigits = label2digits(label)
|
||||||
const digits = String(parseInt(paddedDigits))
|
const digits = String(parseInt(paddedDigits))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import * as Store from './modules/store.js'
|
import * as Store from './modules/store.js'
|
||||||
|
|
||||||
console.log('1234')
|
|
||||||
|
|
||||||
const store = Store.init({
|
const store = Store.init({
|
||||||
tabs: browser.tabs,
|
tabs: browser.tabs,
|
||||||
onStateUpdate: console.log,
|
onStateUpdate: console.log,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue