README feature list updates: new mods + options

This commit is contained in:
dragonwocky 2020-11-01 22:53:11 +11:00
parent b985217611
commit c4a890ea91
4 changed files with 41 additions and 45 deletions

View File

@ -403,10 +403,10 @@ window['__start'] = async () => {
).toString(); ).toString();
function createOption(opt, id) { function createOption(opt, id) {
let $opt; let $opt;
const description = opt.description const desc = opt.desc
? question_icon.replace( ? question_icon.replace(
'<svg', '<svg',
`<svg data-tooltip="${opt.description.replace(/"/g, '&quot;')}"` `<svg data-tooltip="${opt.desc.replace(/"/g, '&quot;')}"`
) )
: ''; : '';
switch (opt.type) { switch (opt.type) {
@ -415,16 +415,14 @@ window['__start'] = async () => {
<input type="checkbox" id="${opt.type}_${id}--${opt.key}" <input type="checkbox" id="${opt.type}_${id}--${opt.key}"
${store(id, { [opt.key]: opt.value })[opt.key] ? 'checked' : ''}/> ${store(id, { [opt.key]: opt.value })[opt.key] ? 'checked' : ''}/>
<label for="${opt.type}_${id}--${opt.key}"> <label for="${opt.type}_${id}--${opt.key}">
<span class="name">${opt.label}${description}</span> <span class="name">${opt.label}${desc}</span>
<span class="switch"><span class="dot"></span></span> <span class="switch"><span class="dot"></span></span>
</label> </label>
`; `;
break; break;
case 'select': case 'select':
$opt = ` $opt = `
<label for="${opt.type}_${id}--${opt.key}">${ <label for="${opt.type}_${id}--${opt.key}">${opt.label}${desc}</label>
opt.label
}${description}</label>
<select id="${opt.type}_${id}--${opt.key}"> <select id="${opt.type}_${id}--${opt.key}">
${opt.value ${opt.value
.map((val) => `<option value="${val}">${val}</option>`) .map((val) => `<option value="${val}">${val}</option>`)
@ -434,9 +432,7 @@ window['__start'] = async () => {
break; break;
case 'input': case 'input':
$opt = ` $opt = `
<label for="${opt.type}_${id}--${opt.key}">${ <label for="${opt.type}_${id}--${opt.key}">${opt.label}${desc}</label>
opt.label
}${description}</label>
<input type="${typeof value === 'number' ? 'number' : 'text'}" id="${ <input type="${typeof value === 'number' ? 'number' : 'text'}" id="${
opt.type opt.type
}_${id}--${opt.key}"> }_${id}--${opt.key}">
@ -444,7 +440,7 @@ window['__start'] = async () => {
break; break;
case 'color': case 'color':
$opt = ` $opt = `
<label for="${opt.type}_${id}--${opt.key}">${opt.label}${description}</label> <label for="${opt.type}_${id}--${opt.key}">${opt.label}${desc}</label>
<input type="button" id="${opt.type}_${id}--${opt.key}"> <input type="button" id="${opt.type}_${id}--${opt.key}">
`; `;
break; break;
@ -460,7 +456,7 @@ window['__start'] = async () => {
}> }>
<label for="${opt.type}_${id}--${opt.key}"> <label for="${opt.type}_${id}--${opt.key}">
<span class="label"> <span class="label">
<span class="name">${opt.label}${description}</span> <span class="name">${opt.label}${desc}</span>
<button class="clear"></button> <button class="clear"></button>
</span> </span>
<span class="choose"> <span class="choose">
@ -639,25 +635,6 @@ window['__start'] = async () => {
.forEach((checkbox) => .forEach((checkbox) =>
checkbox.addEventListener('click', (event) => event.target.blur()) checkbox.addEventListener('click', (event) => event.target.blur())
); );
const $tooltip = document.querySelector('#tooltip');
document.querySelectorAll('[data-tooltip]').forEach((el) => {
el.addEventListener('mouseenter', (e) => {
$tooltip.innerText = el.getAttribute('data-tooltip');
$tooltip.classList.add('active');
});
el.addEventListener('mouseover', (e) => {
$tooltip.style.top = e.clientY - $tooltip.clientHeight + 'px';
$tooltip.style.left =
e.clientX < window.innerWidth / 2 ? e.clientX + 'px' : '';
$tooltip.style.right =
e.clientX > window.innerWidth / 2
? window.innerWidth - e.clientX + 'px'
: '';
});
el.addEventListener('mouseleave', (e) =>
$tooltip.classList.remove('active')
);
});
conflicts.check(); conflicts.check();
// draggable re-ordering // draggable re-ordering
@ -750,4 +727,24 @@ window['__start'] = async () => {
.forEach((input) => (input.disabled = draggable.state)); .forEach((input) => (input.disabled = draggable.state));
search(); search();
}); });
const $tooltip = document.querySelector('#tooltip');
document.querySelectorAll('[data-tooltip]').forEach((el) => {
el.addEventListener('mouseenter', (e) => {
$tooltip.innerText = el.getAttribute('data-tooltip');
$tooltip.classList.add('active');
});
el.addEventListener('mouseover', (e) => {
$tooltip.style.top = e.clientY - $tooltip.clientHeight + 'px';
$tooltip.style.left =
e.clientX < window.innerWidth / 2 ? e.clientX + 'px' : '';
$tooltip.style.right =
e.clientX > window.innerWidth / 2
? window.innerWidth - e.clientX + 'px'
: '';
});
el.addEventListener('mouseleave', (e) =>
$tooltip.classList.remove('active')
);
});
}; };

View File

@ -18,7 +18,7 @@ module.exports = {
{ {
key: 'autoresolve', key: 'autoresolve',
label: 'auto-resolve theme conflicts', label: 'auto-resolve theme conflicts',
description: desc:
'when a theme is enabled any other themes of the same mode (light/dark) will be disabled.', 'when a theme is enabled any other themes of the same mode (light/dark) will be disabled.',
type: 'toggle', type: 'toggle',
value: false, value: false,
@ -26,7 +26,7 @@ module.exports = {
{ {
key: 'openhidden', key: 'openhidden',
label: 'hide app on open', label: 'hide app on open',
description: desc:
'app can be made visible by clicking the tray icon or using the hotkey.', 'app can be made visible by clicking the tray icon or using the hotkey.',
type: 'toggle', type: 'toggle',
value: false, value: false,
@ -34,7 +34,7 @@ module.exports = {
{ {
key: 'maximized', key: 'maximized',
label: 'auto-maximise windows', label: 'auto-maximise windows',
description: desc:
'whenever a window is un-hidden or is created it will be maximised.', 'whenever a window is un-hidden or is created it will be maximised.',
type: 'toggle', type: 'toggle',
value: false, value: false,
@ -42,7 +42,7 @@ module.exports = {
{ {
key: 'close_to_tray', key: 'close_to_tray',
label: 'close window to the tray', label: 'close window to the tray',
description: `pressing the × close button will hide the app instead of quitting it.\ desc: `pressing the × close button will hide the app instead of quitting it.\
it can be re-shown by clicking the tray icon or using the hotkey.`, it can be re-shown by clicking the tray icon or using the hotkey.`,
type: 'toggle', type: 'toggle',
value: true, value: true,
@ -53,7 +53,7 @@ module.exports = {
{ {
key: 'frameless', key: 'frameless',
label: 'integrated titlebar', label: 'integrated titlebar',
description: `replace the native titlebar with buttons inset into the app.`, desc: `replace the native titlebar with buttons inset into the app.`,
type: 'toggle', type: 'toggle',
value: true, value: true,
platformOverwrite: { platformOverwrite: {
@ -63,7 +63,7 @@ module.exports = {
{ {
key: 'tiling_mode', key: 'tiling_mode',
label: 'tiling window manager mode', label: 'tiling window manager mode',
description: `completely remove the close/minimise/maximise buttons - desc: `completely remove the close/minimise/maximise buttons -
this is for a special type of window manager. if you don't understand it, don't use it.`, this is for a special type of window manager. if you don't understand it, don't use it.`,
type: 'toggle', type: 'toggle',
value: false, value: false,
@ -71,22 +71,21 @@ module.exports = {
{ {
key: 'hotkey', key: 'hotkey',
label: 'window display hotkey:', label: 'window display hotkey:',
description: 'used to toggle hiding/showing all app windows.', desc: 'used to toggle hiding/showing all app windows.',
type: 'input', type: 'input',
value: 'CommandOrControl+Shift+A', value: 'CommandOrControl+Shift+A',
}, },
{ {
key: 'menu_toggle', key: 'menu_toggle',
label: 'open enhancements menu hotkey:', label: 'open enhancements menu hotkey:',
description: desc: 'used to toggle opening/closing this menu while notion is focused.',
'used to toggle opening/closing this menu while notion is focused.',
type: 'input', type: 'input',
value: 'Alt+E', value: 'Alt+E',
}, },
{ {
key: 'default_page', key: 'default_page',
label: 'default page id/url:', label: 'default page id/url:',
description: `every new tab/window that isn't opening a url via the notion://\ desc: `every new tab/window that isn't opening a url via the notion://\
protocol will load this page. to get a page link from within the app,\ protocol will load this page. to get a page link from within the app,\
go to the triple-dot menu and click "copy link".\ go to the triple-dot menu and click "copy link".\
leave blank to just load the last page you opened.`, leave blank to just load the last page you opened.`,

View File

@ -19,8 +19,8 @@ module.exports = {
{ {
key: 'padded', key: 'padded',
label: 'add padding to bottom of the page', label: 'add padding to bottom of the page',
description: `will only take effect when the sidebar is hidden. aims to make the canvas\ desc: `will only take effect when the sidebar is hidden. aims to make the canvas\
as symmetrical/consistent as possible: if there is empty space on 3 sides, the 4th should follow.z`, as symmetrical/consistent as possible: if there is empty space on 3 sides, the 4th should follow.`,
type: 'toggle', type: 'toggle',
value: true, value: true,
}, },

View File

@ -18,7 +18,7 @@ module.exports = {
{ {
key: 'dragarea_height', key: 'dragarea_height',
label: 'height of frameless dragarea:', label: 'height of frameless dragarea:',
description: `the rectangle added at the top of a window in "integrated titlebar" mode,\ desc: `the rectangle added at the top of a window in "integrated titlebar" mode,\
used to drag/move the window.`, used to drag/move the window.`,
type: 'input', type: 'input',
value: 15, value: 15,
@ -29,7 +29,7 @@ module.exports = {
{ {
key: 'responsive_breakpoint', key: 'responsive_breakpoint',
label: 'width to wrap columns at:', label: 'width to wrap columns at:',
description: `the size in pixels below which in-page columns are resized to appear\ desc: `the size in pixels below which in-page columns are resized to appear\
full width so content isn't squished.`, full width so content isn't squished.`,
type: 'input', type: 'input',
value: 600, value: 600,
@ -37,7 +37,7 @@ module.exports = {
{ {
key: 'smooth_scrollbars', key: 'smooth_scrollbars',
label: 'integrated scrollbars', label: 'integrated scrollbars',
description: desc:
"use scrollbars that fit better into notion's ui instead of the default chrome ones.", "use scrollbars that fit better into notion's ui instead of the default chrome ones.",
type: 'toggle', type: 'toggle',
value: true, value: true,