forked from bunnybeam/misskey-plugins
Link Action v1.0.0
This commit is contained in:
parent
c08967fa3a
commit
3bed0b4471
1 changed files with 33 additions and 0 deletions
33
link-action.ais
Normal file
33
link-action.ais
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/// @ 0.19.0
|
||||||
|
### {
|
||||||
|
name: "Link Action"
|
||||||
|
version: "1.0.0"
|
||||||
|
author: "@bunnybeam@transfem.social"
|
||||||
|
description: "Add post form actions that navigate to a specified page when clicked."
|
||||||
|
config: {
|
||||||
|
links: {
|
||||||
|
type: "string"
|
||||||
|
label: "Links"
|
||||||
|
description: "List of links, each in the form 'label*link'."
|
||||||
|
default: "Link Action on Kitsudev*https://kitsunes.dev/bunnybeam/misskey-plugins/src/branch/main/link-action.ais,plugin settings*settings/plugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the list of links by splitting the config line and trimming the results
|
||||||
|
@get_link_list() {
|
||||||
|
let raw_list = Plugin:config.links.split(",")
|
||||||
|
let new_list = []
|
||||||
|
each let name, raw_list {
|
||||||
|
new_list.push(name.trim())
|
||||||
|
}
|
||||||
|
return new_list
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register post form actions for each link
|
||||||
|
each let link, get_link_list() {
|
||||||
|
let parts = link.split("*")
|
||||||
|
Plugin:register_post_form_action(`Go to {parts[0]}`, @(note, rewrite) {
|
||||||
|
Plugin:open_url(parts[1])
|
||||||
|
})
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue