mastodon-confirm-no-replying

prevent user post a replying toot without click *reply* button of the origin toot.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name     mastodon-confirm-no-replying
// @namespace http://gholk.github.io
// @version  1
// @grant    none
// @license GPLv3
// @description prevent user post a replying toot without click *reply* button of the origin toot.
// @include https://g0v.social/*
// @exclude https://g0v.social/settings/*
// ==/UserScript==


window.addEventListener('keydown', e=>{
  const t = e.target;
  if (!(e.key == 'Enter' && e.ctrlKey)) return true
  if (t.nodeName == 'TEXTAREA' && t.matches('.autosuggest-textarea__textarea')) {
    const f = t.form;
    confirmNotReply(f, e)
  }
}, {
  capture: true,
  passive: false
})
window.addEventListener('click', e=>{
  const b = e.target;
  if (b.matches('.compose-form__publish-button-wrapper *')) {
    const f = b.closest('form');
    confirmNotReply(f, e)
  }
}, {
  capture: true,
  passive: false
})
function confirmNotReply(form, event) {
    const f = form
    const e = event
    if (f.querySelector('.reply-indicator')) return;
    if (confirm('not replying, toot this?')) return;
    e.preventDefault();
    e.stopImmediatePropagation()
}