Created
October 27, 2022 19:37
-
-
Save zacjones93/4c56e544e59afbff2807f73e0a7aa71b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Name: tana-paste-twitter | |
// Author: Ian Jones | |
import "@johnlindquist/kit"; | |
const url = await getActiveTab("Brave"); | |
const months = [ | |
"January", | |
"February", | |
"March", | |
"April", | |
"May", | |
"June", | |
"July", | |
"August", | |
"September", | |
"October", | |
"November", | |
"December", | |
]; | |
export const nth = function (d) { | |
if (d > 3 && d < 21) return "th"; | |
switch (d % 10) { | |
case 1: | |
return "st"; | |
case 2: | |
return "nd"; | |
case 3: | |
return "rd"; | |
default: | |
return "th"; | |
} | |
}; | |
export const formatDate = (dateString) => { | |
const d = new Date(dateString); | |
const year = d.getFullYear(); | |
const date = d.getDate(); | |
const month = months[d.getMonth()]; | |
const nthStr = nth(date); | |
return `${month} ${date}${nthStr}, ${year}`; | |
}; | |
const summary = await arg("Summarize media"); | |
const author = await arg("Author"); | |
const state = await arg("Media State", [ | |
{ name: "Viewed", value: "viewed" }, | |
{ name: "Unviewed", value: "unviewed" }, | |
]); | |
await copy(`%%tana%% | |
- ${summary} #tweet | |
- Source:: ${url} | |
- Author:: [[${author}]] | |
- State:: ${state} | |
`); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment