Skip to content

Commit

Permalink
fix(promo): add SolExt reminder
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyurec committed Sep 27, 2022
1 parent 5f02bc1 commit ba82002
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 20 deletions.
28 changes: 20 additions & 8 deletions src/css/awesomeLinks.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
/*
>>> BEGIN: External links
*/
.is-awesome-favicons .external-link-img {
.is-awesomelinks-ext .external-link-img {
display: inline-block;
width: 16px;
height: 16px;
margin: -3px 5px 0 0;
border-radius: 3px;
}
.is-awesome-favicons .external-link::before,
.is-awesome-favicons .external-link::after {
.is-awesomelinks-ext .external-link::before,
.is-awesomelinks-ext .external-link::after {
display: none !important;
}
/*
Expand All @@ -42,7 +42,7 @@
width: 1.4em;
}
/* content */
.is-awesome-icons .link-icon {
.is-awesomelinks-int .link-icon {
display: inline-block;
margin-right: 0.34em !important;
font-family: var(--icon-font);
Expand Down Expand Up @@ -86,13 +86,25 @@ body:not(.is-banner-active).is-awesome-journal-icon .is-journals h1.title::befor
*/



/*
>>> BEGIN: Settigns
*/
.desc-item[data-key="featureJournalIcons"] .form-input {
font-family: var(--icon-font);
.panel-wrap[data-id="logseq-awesome-links"] .desc-item[data-key="featureInheritPageIcons"] {
margin-left: 46px;
}
/*
<<<< END: Settings
*/
*/

/* promo */
.is-solext .panel-wrap[data-id="logseq-awesome-links"] .desc-item[data-key="promoSolext"] {
display: none;
}

.desc-item[data-key="promoSolext"] {
margin: 1em 0;
font-size: 1.3em;
}
.desc-item[data-key="promoSolext"] .form-checkbox {
display: none;
}
26 changes: 14 additions & 12 deletions src/js/awesomeLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ let oldPluginConfig: LSPluginBaseInfo['settings'];
let pluginConfig: LSPluginBaseInfo['settings'];

const settingSchema: SettingSchemaDesc[] = [
{
key: 'promoSolext',
title: '',
description: '⚡ Also try "Solarized Extended" theme with lots of UI changes and more features! ⚡ https://github.com/yoyurec/logseq-solarized-extended-theme',
type: 'boolean',
default: false,
},
{
key: 'featureFaviconsEnabled',
title: '',
Expand Down Expand Up @@ -45,7 +52,6 @@ const settingSchema: SettingSchemaDesc[] = [
}
];


const toggleFaviconsFeature = () => {
if (pluginConfig.featureFaviconsEnabled) {
faviconsLoad();
Expand Down Expand Up @@ -86,7 +92,7 @@ const setFavicons = (extLinkList: NodeListOf<HTMLAnchorElement>) => {
extLinkList[i].insertAdjacentElement('afterbegin', fav);
}
}
body.classList.add('is-awesome-favicons');
body.classList.add('is-awesomelinks-ext');
}
const removeFavicons = () => {
const favicons = doc.querySelectorAll('.external-link-img');
Expand All @@ -95,7 +101,7 @@ const removeFavicons = () => {
favicons[i].remove();
}
}
body.classList.remove('is-awesome-favicons');
body.classList.remove('is-awesomelinks-ext');
}


Expand Down Expand Up @@ -169,7 +175,7 @@ const setPageIcons = async (linkList: NodeListOf<HTMLAnchorElement>) => {
linkItem.insertAdjacentHTML('afterbegin', `<span class="link-icon">${pageIcon}</span>`);
}
}
body.classList.add('is-awesome-icons');
body.classList.add('is-awesomelinks-int');
}
const removePageIcons = () => {
const pageIcons = doc.querySelectorAll('.link-icon');
Expand All @@ -178,7 +184,7 @@ const removePageIcons = () => {
pageIcons[i].remove();
}
}
body.classList.remove('is-awesome-icons');
body.classList.remove('is-awesomelinks-int');
}

// const setTitleInheritedIcons = async (titleList: NodeListOf<HTMLAnchorElement>) => {
Expand Down Expand Up @@ -294,11 +300,9 @@ const runLinksObserver = () => {
if (!appContainer) {
return;
}
console.log(`AwesomeIcons: links observer started`);
linksObserver.observe(appContainer, linksObserverConfig);
}
const stopLinksObserver = () => {
console.log(`AwesomeIcons: links observer stopped`);
linksObserver.disconnect();
}

Expand All @@ -313,6 +317,7 @@ const runStuff = () => {
if (pluginConfig.featureFaviconsEnabled || pluginConfig.featurePageIconsEnabled) {
runLinksObserver();
}
body.classList.add('is-awesomelinks');
}, 1000)
}
const stopStuff = () => {
Expand All @@ -321,16 +326,14 @@ const stopStuff = () => {
faviconsUnload();
journalIconsUnload();
stopLinksObserver();
body.classList.remove('is-awesomelinks');
}

// Setting changed
const onSettingsChangedCallback = (settings: LSPluginBaseInfo['settings'], oldSettings: LSPluginBaseInfo['settings']) => {
oldPluginConfig = { ...oldSettings };
pluginConfig = { ...settings };
console.log(`AwesomeIcons: settings changed`);
const settingsDiff = objectDiff(oldPluginConfig, pluginConfig)
console.log(`AwesomeIcons: settings changed:`, settingsDiff);

if (settingsDiff.includes('featureFaviconsEnabled')) {
toggleFaviconsFeature();
}
Expand Down Expand Up @@ -372,9 +375,8 @@ const registerPlugin = async () => {
${tabsPluginStyles}
</style>`
);
console.log(`AwesomeIcons: Tabs css inject`);
}
}, 500)
}, 500);
}

const unregisterPlugin = () => {
Expand Down

0 comments on commit ba82002

Please sign in to comment.