forked from bunnybeam/misskey-plugins
Headmate Hopper v1.1.0
This commit is contained in:
parent
04eea9eccf
commit
c08967fa3a
1 changed files with 28 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
/// @ 0.19.0
|
||||
### {
|
||||
name: "Headmate Hopper"
|
||||
version: "1.0.0"
|
||||
version: "1.1.0"
|
||||
author: "@bunnybeam@transfem.social"
|
||||
description: "Adds a tag containing the name of the selected headmate to the end of all new posts."
|
||||
permissions: ["read:account", "write:account"]
|
||||
|
@ -18,6 +18,18 @@
|
|||
description: "If enabled, selecting a headmate will add them to your display name. Requires permission to view and edit account info."
|
||||
default: false
|
||||
}
|
||||
switch_notif: {
|
||||
type: "boolean"
|
||||
label: "Switch notification"
|
||||
description: "If enabled, selecting a headmate will display a popup dialog."
|
||||
default: true
|
||||
}
|
||||
confirm_dialog: {
|
||||
type: "boolean"
|
||||
label: "Confirmation dialog"
|
||||
description: "If enabled, a confirmation dialog will pop up when posting a note to ensure you have the correct headmate selected. (WARNING: this feature abuses an error condition, and therefore may not work on all softwares. It may display an error popup, but you can generally ignore it.)"
|
||||
default: false
|
||||
}
|
||||
enable_attribution: {
|
||||
type: "boolean"
|
||||
label: "Enable attribution"
|
||||
|
@ -132,6 +144,14 @@
|
|||
}
|
||||
|
||||
Plugin:register_note_post_interruptor(@(note) {
|
||||
// Confirmation dialog
|
||||
if Plugin:config.confirm_dialog && headmate_name != "" {
|
||||
let confirmed = Mk:confirm("Confirm post", `You are about to post as {headmate_name}. Is that correct?`)
|
||||
if !confirmed {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
// Filter to only the fields we're allowed to use
|
||||
let new_note = {}
|
||||
let keys = Obj:keys(note)
|
||||
|
@ -161,10 +181,16 @@ Plugin:register_note_post_interruptor(@(note) {
|
|||
each let name, get_headmate_list() {
|
||||
Plugin:register_post_form_action(`Switch to {name}`, @(note, rewrite) {
|
||||
select_headmate_name(name)
|
||||
if Plugin:config.switch_notif {
|
||||
Mk:dialog("Switched headmate", `Switched headmate to "{name}".`, "success")
|
||||
}
|
||||
})
|
||||
}
|
||||
Plugin:register_post_form_action("Clear fronter", @(note, rewrite) {
|
||||
Plugin:register_post_form_action("Clear headmate", @(note, rewrite) {
|
||||
select_headmate_name("")
|
||||
if Plugin:config.switch_notif {
|
||||
Mk:dialog("Switched headmate", "Cleared the current headmate.", "success")
|
||||
}
|
||||
})
|
||||
|
||||
// Load the persistent selected headmate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue