-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1798fde
commit dc433cf
Showing
27 changed files
with
601 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { getConfig } from "../../../config/Configuration"; | ||
import { applyStyle } from "../../../lib/style"; | ||
|
||
/** | ||
* @param {NodeList} links | ||
* @return {Promise<void>} | ||
*/ | ||
export async function handler(links) { | ||
const config = getConfig(); | ||
const style = config.styles.values[config.itemMatch.groups["1"].styles[0].toString()]; | ||
for (const item of config.itemMatch.groups["1"].items) { | ||
for (const link of links) { | ||
const td = link.parentElement; | ||
if (td.textContent.indexOf(item) > -1) | ||
applyStyle(style, td); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export function arrayCopy(arr) { | ||
const out = new Array(arr.length); | ||
|
||
for (let i = 0; i < arr.length; i++) | ||
out[i] = arr[i]; | ||
|
||
return out; | ||
} | ||
|
||
export function arrayOmit(arr, val) { | ||
const out = []; | ||
|
||
for (const v of out) | ||
if (v !== val) | ||
out.push(v); | ||
|
||
return out; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,39 @@ | ||
:root { | ||
--text-color: #555; | ||
--tab-fade: 750ms; | ||
--text-color: #555; | ||
--tab-fade: 500ms; | ||
|
||
--plus-svg: url("../../../res/plus.svg"); | ||
--trash-svg: url("../../../res/trash-alt.svg"); | ||
|
||
--general-font: Cantarell, Arial, sans-serif; | ||
|
||
--input-line-height: 1.6em; | ||
--input-font-size: 1.4em; | ||
--input-font-family: var(--general-font); | ||
|
||
pointer-events: inherit; | ||
} | ||
|
||
textarea, | ||
input[type=text] { | ||
width: 300px; | ||
display: block; | ||
} | ||
|
||
textarea { | ||
padding: 10px; | ||
border-radius: 5px; | ||
} | ||
|
||
select, | ||
textarea, | ||
input[type=text], | ||
input[type=number] { | ||
line-height: var(--input-line-height); | ||
font-size: var(--input-font-size); | ||
font-family: var(--input-font-family); | ||
} | ||
|
||
label { | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @param {function():undefined} onTimeout | ||
* Function to be called on timeout conclusion | ||
* @param {number} [delay] | ||
* Debounce delay in milliseconds | ||
* @param {function(Event): void} cb | ||
* Optional callback to fire when the debounce | ||
* triggering event is fired. | ||
* | ||
* @return {function(Event): void} | ||
* Function to be called by the input events that should | ||
* be debounced. | ||
*/ | ||
export function newDebouncer(onTimeout, delay = 500, cb = null) { | ||
let timeout = null; | ||
|
||
return e => { | ||
clearTimeout(timeout); | ||
timeout = setTimeout(onTimeout, delay); | ||
if (cb) cb(e); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const LINE_END_PATTERN = / +\n|\n{2,}/g; | ||
const LINE_END_REPLACE = '\n'; | ||
const LINE_START_PATTERN = /^ +/g; | ||
const LINE_START_REPLACE = ''; | ||
const SPLIT_PATTERN = '\n'; | ||
|
||
/** | ||
* @param {string} input | ||
* | ||
* @return {string} | ||
*/ | ||
export function cleanItemString(input) { | ||
return input.trim() | ||
.replace(LINE_START_PATTERN, LINE_START_REPLACE) | ||
.replace(LINE_END_PATTERN, LINE_END_REPLACE); | ||
} | ||
|
||
/** | ||
* @param {string} input | ||
* | ||
* @return {string[]} | ||
*/ | ||
export function toItemArray(input) { | ||
return input.split(SPLIT_PATTERN); | ||
} |
Oops, something went wrong.