-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Showing
27 changed files
with
240 additions
and
234 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,67 @@ | ||
import '@logseq/libs'; | ||
|
||
import { | ||
globalContext, | ||
doc, body, getDOMContainers, | ||
pageIconsLoad, pageIconsUnload, | ||
nerdFontLoad, nerdFontUnload, | ||
faviconsLoad, faviconsUnload, | ||
journalIconsLoad, journalIconsUnload, | ||
sidebarIconsLoad, sidebarIconsUnload, | ||
initLinksObserver, stopLinksObserver, runLinksObserver, settingsLoad | ||
} from './modules/internal'; | ||
|
||
const registerPlugin = async () => { | ||
setTimeout(() => { | ||
if (doc.head) { | ||
doc.head.insertAdjacentHTML('beforeend', `<link rel="stylesheet" id="css-awesomeLinks" href="lsp://logseq.io/${globalContext.pluginID}/dist/assets/awesomeLinks.css">`) | ||
} | ||
}, 500); | ||
} | ||
|
||
// Main logic runners | ||
const runStuff = async () => { | ||
settingsLoad(); | ||
initLinksObserver(); | ||
getDOMContainers(); | ||
setTimeout(() => { | ||
pageIconsLoad(); | ||
faviconsLoad(); | ||
journalIconsLoad(); | ||
sidebarIconsLoad(); | ||
nerdFontLoad(); | ||
if (globalContext.pluginConfig?.featureFaviconsEnabled || globalContext.pluginConfig?.featurePageIconsEnabled) { | ||
runLinksObserver(); | ||
} | ||
body.classList.add('is-awesomeLinks'); | ||
}, 1000) | ||
} | ||
const stopStuff = () => { | ||
pageIconsUnload(); | ||
faviconsUnload(); | ||
journalIconsUnload(); | ||
sidebarIconsUnload(); | ||
nerdFontUnload(); | ||
stopLinksObserver(); | ||
body.classList.remove('is-awesomeLinks'); | ||
} | ||
|
||
// Main logseq on ready | ||
const main = async () => { | ||
console.log(`AwesomeIcons: plugin loaded`); | ||
|
||
globalContext.pluginConfig = logseq.settings; | ||
registerPlugin(); | ||
|
||
runStuff(); | ||
|
||
setTimeout(() => { | ||
// Listen plugin unload | ||
logseq.beforeunload(async () => { | ||
stopStuff(); | ||
}); | ||
}, 2000) | ||
|
||
}; | ||
|
||
logseq.ready(main).catch(null); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
10 changes: 7 additions & 3 deletions
10
src/js/modules/favIcons.ts → src/modules/favicons/favIcons.ts
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 @@ | ||
/* | ||
>>> BEGIN: External links | ||
*/ | ||
/* hide other themes icons at first */ | ||
.is-awesomeLinks-ext .external-link::before, | ||
.is-awesomeLinks-ext .external-link::after { | ||
display: none !important; | ||
} | ||
.is-awesomeLinks-ext .awLinks-link-icon { | ||
display: inline-block; | ||
width: 16px; | ||
height: 16px; | ||
margin: -3px 5px 0 0; | ||
border-radius: 3px; | ||
} | ||
/* | ||
<<<< END: External links | ||
*/ |
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,14 +1,12 @@ | ||
import { logseq as PL } from '../../../package.json'; | ||
import { logseq as PL } from '../../package.json'; | ||
|
||
type globalContextType = { | ||
pluginID: string; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
[key: string]: any; | ||
} | ||
|
||
const globalContext: globalContextType = { | ||
export const globalContext: globalContextType = { | ||
pluginID: PL.id, | ||
pluginConfig: null | ||
}; | ||
|
||
export default globalContext; |
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,11 @@ | ||
export * from './globals'; | ||
export * from './DOMContainers'; | ||
export * from './settings/settings'; | ||
export * from './linksObserver/linksObserver'; | ||
export * from './pageIcons/pageIcons'; | ||
export * from './pageIcons/queries'; | ||
export * from './titleIcon/titleIcon'; | ||
export * from './sidebarIcon/sidebarIcon'; | ||
export * from './journalIcons/journalIcons'; | ||
export * from './favicons/favIcons'; | ||
export * from './nerdFont/nerdFont'; |
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,16 @@ | ||
/* | ||
>>> BEGIN: Journal icon | ||
*/ | ||
body:not(.is-banner-active).is-awesomeLinks-journal .journal-item h1.title::before, | ||
body:not(.is-banner-active).is-awesomeLinks-journal .is-journals h1.title::before { | ||
content: var(--awesomeLinks-journal-icon); | ||
display: inline-block; | ||
margin-right: 0.24em !important; | ||
font-family: var(--icon-font); | ||
text-align: center; | ||
line-height: 1.2em; | ||
width: 1.4em; | ||
} | ||
/* | ||
<<<< END: Journal icon | ||
*/ |
Oops, something went wrong.