mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
Re-enable arrow-body-style
This commit is contained in:
parent
db8f0e21ad
commit
a6ca46d147
11 changed files with 37 additions and 89 deletions
|
@ -155,7 +155,7 @@ module.exports = {
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
"@typescript-eslint/type-annotation-spacing": "error",
|
||||||
"@typescript-eslint/unbound-method": "off", //"error",
|
"@typescript-eslint/unbound-method": "off", //"error",
|
||||||
"@typescript-eslint/unified-signatures": "off", //"error",
|
"@typescript-eslint/unified-signatures": "off", //"error",
|
||||||
"arrow-body-style": "off", //"error",
|
"arrow-body-style": "error",
|
||||||
"arrow-parens": [
|
"arrow-parens": [
|
||||||
"off",
|
"off",
|
||||||
"always"
|
"always"
|
||||||
|
|
|
@ -239,9 +239,7 @@ export abstract class CompletionSourceFuse extends CompletionSource {
|
||||||
|
|
||||||
/** Rtn sorted array of {option, score} */
|
/** Rtn sorted array of {option, score} */
|
||||||
scoredOptions(query: string, options = this.options): ScoredOption[] {
|
scoredOptions(query: string, options = this.options): ScoredOption[] {
|
||||||
const searchThis = this.options.map((elem, index) => {
|
const searchThis = this.options.map((elem, index) => ({ index, fuseKeys: elem.fuseKeys }))
|
||||||
return { index, fuseKeys: elem.fuseKeys }
|
|
||||||
})
|
|
||||||
this.fuse = new Fuse(searchThis, this.fuseOptions)
|
this.fuse = new Fuse(searchThis, this.fuseOptions)
|
||||||
return this.fuse.search(query).map(result => {
|
return this.fuse.search(query).map(result => {
|
||||||
// console.log(result, result.item, query)
|
// console.log(result, result.item, query)
|
||||||
|
|
|
@ -64,14 +64,12 @@ export class BindingsCompletionSource extends Completions.CompletionSourceFuse {
|
||||||
this.options = Object.keys(patterns)
|
this.options = Object.keys(patterns)
|
||||||
.filter(pattern => pattern.startsWith(urlPattern))
|
.filter(pattern => pattern.startsWith(urlPattern))
|
||||||
.sort()
|
.sort()
|
||||||
.map(pattern => {
|
.map(pattern => new BindingsCompletionOption(
|
||||||
return new BindingsCompletionOption(
|
|
||||||
pattern, {
|
pattern, {
|
||||||
name: pattern,
|
name: pattern,
|
||||||
value: "",
|
value: "",
|
||||||
mode: "URL Pattern",
|
mode: "URL Pattern",
|
||||||
})
|
}))
|
||||||
})
|
|
||||||
|
|
||||||
return this.updateChain()
|
return this.updateChain()
|
||||||
}
|
}
|
||||||
|
@ -84,14 +82,12 @@ export class BindingsCompletionSource extends Completions.CompletionSourceFuse {
|
||||||
const modeStr = margs.length > 1 ? margs[1] : ""
|
const modeStr = margs.length > 1 ? margs[1] : ""
|
||||||
this.options = Binding.modes
|
this.options = Binding.modes
|
||||||
.filter(k => k.startsWith(modeStr))
|
.filter(k => k.startsWith(modeStr))
|
||||||
.map(name => {
|
.map(name => new BindingsCompletionOption(
|
||||||
return new BindingsCompletionOption(
|
|
||||||
options + "--mode=" + name, {
|
options + "--mode=" + name, {
|
||||||
name,
|
name,
|
||||||
value: "",
|
value: "",
|
||||||
mode: "Mode Name",
|
mode: "Mode Name",
|
||||||
})
|
}))
|
||||||
})
|
|
||||||
return this.updateChain()
|
return this.updateChain()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,14 +120,12 @@ export class BindingsCompletionSource extends Completions.CompletionSourceFuse {
|
||||||
this.options = Object.keys(bindings)
|
this.options = Object.keys(bindings)
|
||||||
.filter(x => x.toLowerCase().startsWith(query) )
|
.filter(x => x.toLowerCase().startsWith(query) )
|
||||||
.sort()
|
.sort()
|
||||||
.map(keystr => {
|
.map(keystr => new BindingsCompletionOption(
|
||||||
return new BindingsCompletionOption(
|
|
||||||
options + keystr + " " + bindings[keystr], {
|
options + keystr + " " + bindings[keystr], {
|
||||||
name: keystr,
|
name: keystr,
|
||||||
value: JSON.stringify(bindings[keystr]),
|
value: JSON.stringify(bindings[keystr]),
|
||||||
mode: `${configName} (${modeName})`,
|
mode: `${configName} (${modeName})`,
|
||||||
})
|
}))
|
||||||
})
|
|
||||||
|
|
||||||
return this.updateChain()
|
return this.updateChain()
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,25 +428,19 @@ export function hintPage(
|
||||||
|
|
||||||
const firstTarget = modeState.hints[0].target
|
const firstTarget = modeState.hints[0].target
|
||||||
|
|
||||||
const firstTargetIsSelectable = (): boolean => {
|
const firstTargetIsSelectable = (): boolean => (
|
||||||
return (
|
|
||||||
firstTarget instanceof HTMLAnchorElement &&
|
firstTarget instanceof HTMLAnchorElement &&
|
||||||
firstTarget.href !== "" &&
|
firstTarget.href !== "" &&
|
||||||
!firstTarget.href.startsWith("javascript:")
|
!firstTarget.href.startsWith("javascript:")
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
const allTargetsAreEqual = (): boolean => {
|
const allTargetsAreEqual = (): boolean => (
|
||||||
return (
|
|
||||||
undefined ===
|
undefined ===
|
||||||
modeState.hints.find(h => {
|
modeState.hints.find(h => (
|
||||||
return (
|
|
||||||
!(h.target instanceof HTMLAnchorElement) ||
|
!(h.target instanceof HTMLAnchorElement) ||
|
||||||
h.target.href !== (firstTarget as HTMLAnchorElement).href
|
h.target.href !== (firstTarget as HTMLAnchorElement).href
|
||||||
)
|
))
|
||||||
})
|
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
modeState.hints.length == 1 ||
|
modeState.hints.length == 1 ||
|
||||||
|
@ -551,9 +545,7 @@ function* hintnames_uniform(
|
||||||
// And return first n permutations
|
// And return first n permutations
|
||||||
yield* map(
|
yield* map(
|
||||||
islice(permutationsWithReplacement(hintchars, taglen), n),
|
islice(permutationsWithReplacement(hintchars, taglen), n),
|
||||||
perm => {
|
perm => perm.join(""),
|
||||||
return perm.join("")
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2620,13 +2620,9 @@ export async function qall() {
|
||||||
//#background
|
//#background
|
||||||
export async function containerclose(name: string) {
|
export async function containerclose(name: string) {
|
||||||
const containerId = await Container.getId(name)
|
const containerId = await Container.getId(name)
|
||||||
return browser.tabs.query({ cookieStoreId: containerId }).then(tabs => {
|
return browser.tabs.query({ cookieStoreId: containerId }).then(tabs => browser.tabs.remove(
|
||||||
return browser.tabs.remove(
|
tabs.map(tab => tab.id),
|
||||||
tabs.map(tab => {
|
))
|
||||||
return tab.id
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
/** Creates a new container. Note that container names must be unique and that the checks are case-insensitive.
|
/** Creates a new container. Note that container names must be unique and that the checks are case-insensitive.
|
||||||
|
|
||||||
|
@ -2761,12 +2757,8 @@ async function getnexttabs(tabid: number, n?: number) {
|
||||||
const tabs: browser.tabs.Tab[] = await browser.tabs.query({
|
const tabs: browser.tabs.Tab[] = await browser.tabs.query({
|
||||||
currentWindow: true,
|
currentWindow: true,
|
||||||
})
|
})
|
||||||
const indexFilter = ((tab: browser.tabs.Tab) => {
|
const indexFilter = ((tab: browser.tabs.Tab) => curIndex <= tab.index && (n ? tab.index < curIndex + Number(n) : true)).bind(n)
|
||||||
return curIndex <= tab.index && (n ? tab.index < curIndex + Number(n) : true)
|
return tabs.filter(indexFilter).map((tab: browser.tabs.Tab) => tab.id)
|
||||||
}).bind(n)
|
|
||||||
return tabs.filter(indexFilter).map((tab: browser.tabs.Tab) => {
|
|
||||||
return tab.id
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Moderately slow; should load in results as they arrive, perhaps
|
// Moderately slow; should load in results as they arrive, perhaps
|
||||||
|
|
|
@ -180,9 +180,7 @@ export class AutoContain implements IAutoContain {
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
getCancelledRequest = (tabId: number): ICancelledRequest => {
|
getCancelledRequest = (tabId: number): ICancelledRequest => this.cancelledRequests[tabId]
|
||||||
return this.cancelledRequests[tabId]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the cancelled requests.
|
// Clear the cancelled requests.
|
||||||
clearCancelledRequests = (tabId: number): void => {
|
clearCancelledRequests = (tabId: number): void => {
|
||||||
|
@ -311,7 +309,5 @@ export class AutoContain implements IAutoContain {
|
||||||
// Parses autocontain directives and returns valid cookieStoreIds or errors.
|
// Parses autocontain directives and returns valid cookieStoreIds or errors.
|
||||||
getAuconForDetails = async (
|
getAuconForDetails = async (
|
||||||
details: browser.webRequest.IDetails,
|
details: browser.webRequest.IDetails,
|
||||||
): Promise<string> => {
|
): Promise<string> => this.getAuconForUrl(details.url)
|
||||||
return this.getAuconForUrl(details.url)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,16 +93,12 @@ export function getCommandlineFns(cmdline_state) {
|
||||||
/**
|
/**
|
||||||
* Selects the next history line.
|
* Selects the next history line.
|
||||||
*/
|
*/
|
||||||
"next_history": () => {
|
"next_history": () => cmdline_state.history(1),
|
||||||
return cmdline_state.history(1)
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects the prev history line.
|
* Selects the prev history line.
|
||||||
*/
|
*/
|
||||||
"prev_history": () => {
|
"prev_history": () => cmdline_state.history(-1),
|
||||||
return cmdline_state.history(-1)
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* Execute the content of the command line and hide it.
|
* Execute the content of the command line and hide it.
|
||||||
**/
|
**/
|
||||||
|
|
|
@ -122,9 +122,7 @@ export async function exists(cname: string): Promise<boolean> {
|
||||||
let exists = false
|
let exists = false
|
||||||
try {
|
try {
|
||||||
const containers = await getAll()
|
const containers = await getAll()
|
||||||
const res = containers.filter(c => {
|
const res = containers.filter(c => c.name.toLowerCase() === cname.toLowerCase())
|
||||||
return c.name.toLowerCase() === cname.toLowerCase()
|
|
||||||
})
|
|
||||||
if (res.length > 0) {
|
if (res.length > 0) {
|
||||||
exists = true
|
exists = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,7 @@ export function mouseEvent(
|
||||||
export function elementsWithText() {
|
export function elementsWithText() {
|
||||||
return getElemsBySelector("*", [
|
return getElemsBySelector("*", [
|
||||||
isVisible,
|
isVisible,
|
||||||
hint => {
|
hint => hint.textContent !== "",
|
||||||
return hint.textContent !== ""
|
|
||||||
},
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,36 +164,30 @@ export const transpose_words = wrap_input(
|
||||||
* Behaves like readline's [upcase_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the word the caret is in uppercase.
|
* Behaves like readline's [upcase_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the word the caret is in uppercase.
|
||||||
**/
|
**/
|
||||||
export const upcase_word = wrap_input(
|
export const upcase_word = wrap_input(
|
||||||
needs_text((text, selectionStart, selectionEnd) => {
|
needs_text((text, selectionStart, selectionEnd) => applyWord(text, selectionStart, selectionEnd, word =>
|
||||||
return applyWord(text, selectionStart, selectionEnd, word =>
|
|
||||||
word.toUpperCase(),
|
word.toUpperCase(),
|
||||||
)
|
)),
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Behaves like readline's [downcase_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the word the caret is in lowercase.
|
* Behaves like readline's [downcase_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the word the caret is in lowercase.
|
||||||
**/
|
**/
|
||||||
export const downcase_word = wrap_input(
|
export const downcase_word = wrap_input(
|
||||||
needs_text((text, selectionStart, selectionEnd) => {
|
needs_text((text, selectionStart, selectionEnd) => applyWord(text, selectionStart, selectionEnd, word =>
|
||||||
return applyWord(text, selectionStart, selectionEnd, word =>
|
|
||||||
word.toLowerCase(),
|
word.toLowerCase(),
|
||||||
)
|
)),
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Behaves like readline's [capitalize_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the initial character of the word the caret is in uppercase.
|
* Behaves like readline's [capitalize_word](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC14). Makes the initial character of the word the caret is in uppercase.
|
||||||
**/
|
**/
|
||||||
export const capitalize_word = wrap_input(
|
export const capitalize_word = wrap_input(
|
||||||
needs_text((text, selectionStart, selectionEnd) => {
|
needs_text((text, selectionStart, selectionEnd) => applyWord(
|
||||||
return applyWord(
|
|
||||||
text,
|
text,
|
||||||
selectionStart,
|
selectionStart,
|
||||||
selectionEnd,
|
selectionEnd,
|
||||||
word => word[0].toUpperCase() + word.substring(1),
|
word => word[0].toUpperCase() + word.substring(1),
|
||||||
)
|
)),
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -339,17 +333,13 @@ export const end_of_line = wrap_input(
|
||||||
/**
|
/**
|
||||||
* Behaves like readline's [forward_char](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC12). Moves the caret one character to the right.
|
* Behaves like readline's [forward_char](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC12). Moves the caret one character to the right.
|
||||||
**/
|
**/
|
||||||
export const forward_char = wrap_input((text, selectionStart, selectionEnd) => {
|
export const forward_char = wrap_input((text, selectionStart, selectionEnd) => [null, selectionStart + 1, null])
|
||||||
return [null, selectionStart + 1, null]
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Behaves like readline's [backward_char](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC12). Moves the caret one character to the left.
|
* Behaves like readline's [backward_char](http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC12). Moves the caret one character to the left.
|
||||||
**/
|
**/
|
||||||
export const backward_char = wrap_input(
|
export const backward_char = wrap_input(
|
||||||
(text, selectionStart, selectionEnd) => {
|
(text, selectionStart, selectionEnd) => [null, selectionStart - 1, null],
|
||||||
return [null, selectionStart - 1, null]
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -383,21 +373,17 @@ export const backward_word = wrap_input(
|
||||||
* Insert text in the current input.
|
* Insert text in the current input.
|
||||||
**/
|
**/
|
||||||
export const insert_text = wrap_input(
|
export const insert_text = wrap_input(
|
||||||
(text, selectionStart, selectionEnd, arg) => {
|
(text, selectionStart, selectionEnd, arg) => [
|
||||||
return [
|
|
||||||
text.slice(0, selectionStart) + arg + text.slice(selectionEnd),
|
text.slice(0, selectionStart) + arg + text.slice(selectionEnd),
|
||||||
selectionStart + arg.length,
|
selectionStart + arg.length,
|
||||||
null,
|
null,
|
||||||
]
|
],
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
export const rot13 = wrap_input(
|
export const rot13 = wrap_input(
|
||||||
(text, selectionStart, selectionEnd) => {
|
(text, selectionStart, selectionEnd) => [
|
||||||
return [
|
|
||||||
rot13_helper(text.slice(0, selectionStart) + text.slice(selectionEnd)),
|
rot13_helper(text.slice(0, selectionStart) + text.slice(selectionEnd)),
|
||||||
selectionStart,
|
selectionStart,
|
||||||
null,
|
null,
|
||||||
]
|
],
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -254,9 +254,7 @@ export function deleteQuery(url: URL, matchQuery: string): URL {
|
||||||
|
|
||||||
const qys = getUrlQueries(url)
|
const qys = getUrlQueries(url)
|
||||||
|
|
||||||
const new_qys = qys.filter(q => {
|
const new_qys = qys.filter(q => q.split("=")[0] !== matchQuery)
|
||||||
return q.split("=")[0] !== matchQuery
|
|
||||||
})
|
|
||||||
|
|
||||||
setUrlQueries(newUrl, new_qys)
|
setUrlQueries(newUrl, new_qys)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue