diff --git a/src/extensions/truncated-titles/client.mjs b/src/extensions/truncated-titles/client.mjs deleted file mode 100644 index b0fe2d6..0000000 --- a/src/extensions/truncated-titles/client.mjs +++ /dev/null @@ -1,66 +0,0 @@ -/** - * notion-enhancer: truncated titles - * (c) 2021 admiraldus (https://github.com/admiraldus) - * (c) 2021 dragonwocky (https://dragonwocky.me/) - * (https://notion-enhancer.github.io/) under the MIT license - */ - -export default async function ({ web, components }, db) { - const enhanceTableTitles = await db.get(['tables']), - enhanceTimelineItems = await db.get(['timelines']), - tableCellSelector = '.notion-table-view-header-cell', - tableTitleSelector = `${tableCellSelector} div[style*="text-overflow"]`, - timelineItemSelector = '.notion-timeline-item', - $elements = []; - - const addTooltips = () => { - if (enhanceTableTitles) { - document.querySelectorAll(tableTitleSelector).forEach(($tableTitle) => { - if ($elements.includes($tableTitle)) return; - - if ($tableTitle.scrollWidth > $tableTitle.clientWidth) { - components.addTooltip( - $tableTitle.parentElement.parentElement.parentElement, - web.html`${web.escape($tableTitle.innerText)}`, - 750 - ); - $elements.push($tableTitle); - } - }); - } - - if (enhanceTimelineItems) { - document.querySelectorAll(timelineItemSelector).forEach(($timelineItem) => { - const $title = $timelineItem.nextElementSibling.firstElementChild; - $title.style.position = 'absolute'; - $title.style.left = $timelineItem.style.left; - - if ($elements.includes($timelineItem)) return; - $elements.push($timelineItem); - - $title.style.width = $timelineItem.clientWidth + 'px'; - $title.firstElementChild.firstElementChild.style.maxWidth = - $timelineItem.clientWidth + 'px'; - $timelineItem.addEventListener('mouseover', (event) => { - $title.style.width = '100%'; - $title.firstElementChild.firstElementChild.style.maxWidth = '400px'; - }); - $timelineItem.addEventListener('mouseout', async (event) => { - if (!$timelineItem.matches(':hover')) { - $title.style.width = $timelineItem.clientWidth + 'px'; - $title.firstElementChild.firstElementChild.style.maxWidth = - $timelineItem.clientWidth + 'px'; - } - }); - }); - } - }; - - await web.whenReady(); - addTooltips(); - web.addDocumentObserver(addTooltips, [ - tableCellSelector, - timelineItemSelector, - `${timelineItemSelector} + div > :first-child`, - ]); -} diff --git a/src/extensions/truncated-titles/mod.json b/src/extensions/truncated-titles/mod.json deleted file mode 100644 index eb2cf39..0000000 --- a/src/extensions/truncated-titles/mod.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "truncated titles", - "id": "1794c0bd-7b96-46ad-aa0b-fc4bd76fc7fb", - "version": "0.2.0", - "description": "see the full text of a truncated title on hover.", - "preview": "truncated-titles.jpg", - "tags": ["extension", "layout"], - "authors": [ - { - "name": "admiraldus", - "homepage": "https://github.com/admiraldus", - "avatar": "https://raw.githubusercontent.com/admiraldus/admiraldus/main/module.gif" - } - ], - "js": { - "client": ["client.mjs"] - }, - "css": {}, - "options": [ - { - "type": "toggle", - "key": "tables", - "label": "table titles", - "value": true - }, - { - "type": "toggle", - "key": "timelines", - "label": "timeline items", - "value": true - } - ] -} diff --git a/src/extensions/truncated-titles/truncated-titles.jpg b/src/extensions/truncated-titles/truncated-titles.jpg deleted file mode 100644 index 94a1cdb..0000000 Binary files a/src/extensions/truncated-titles/truncated-titles.jpg and /dev/null differ