diff --git a/README.md b/README.md index 7434cf3..eecdfdd 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,15 @@ You can technically use this extension on *any* site, as it will always automati However, I've built in additional autofill support for certain websites. When you visit one of these sites, a badge will appear on the moffsoft icon to indicate that additional autofill is available. +- Forgejo instances (except codeberg for now ;3;): Title and author fields are autofilled from metadata. Currently, only `git.eleboog.com` +triggers the supported site badge, but other Forgejo instances should work too. - GitHub: Title and author fields are autofilled from scraping the page. - Medium: Title, author, and date published fields are autofilled from the handy [`NewsArticle` JSON-LD schema](https://schema.org/NewsArticle) included on every page. +- Substack: Title, author, and date published fields are autofilled form the handy [`NewsArticle` JSON-LD schema](https://schema.org/NewsArticle) +included on every page. The supported site badge may not show for custom domains (i.e. not a `*.substack.com` url), but autofill +should still work. - Youtube: Title, author, and date published fields are autofilled from either the `watch7-content` metadata or the [`VideoObject` JSON-LD schema](https://schema.org/VideoObject). -- Forgejo instances (except codeberg for now ;3;): Title and author fields are autofilled from metadata. Currently, only `git.eleboog.com` -triggers the supported site badge, but other Forgejo instances should work too. ## Wait, what is this even for? diff --git a/popup.js b/popup.js index 5a51c7f..4794443 100644 --- a/popup.js +++ b/popup.js @@ -16,13 +16,13 @@ function parsePage() { if (jsonLDElem) { const jsonLDObj = JSON.parse(jsonLDElem.textContent); if (jsonLDObj['@type'] == 'NewsArticle') { // medium, etc. - entry.publishedDate = jsonLDObj.datePublished?.slice(0, 19); - entry.author = jsonLDObj.author?.name; + entry.publishedDate = jsonLDObj.datePublished.slice(0, 19); + entry.author = jsonLDObj.author.name ?? jsonLDObj.author[0].name; entry.title = jsonLDObj.headline; } if (jsonLDObj['@type'] == 'VideoObject') { // youtube, etc. entry.url = jsonLDObj['@id']; // url fix - entry.publishedDate = jsonLDObj.uploadDate?.slice(0, 19); + entry.publishedDate = jsonLDObj.uploadDate.slice(0, 19); entry.author = jsonLDObj.author; entry.title = jsonLDObj.name; } diff --git a/service-worker.js b/service-worker.js index 9a16b19..fbbf5c5 100644 --- a/service-worker.js +++ b/service-worker.js @@ -8,6 +8,7 @@ chrome.tabs.onActivated.addListener((activeInfo) => { 'youtube.com', 'github.com', 'git.eleboog.com', + 'substack.com' ]; let supportedSite = false;