god

joined 1 year ago
MODERATOR OF
[–] [email protected] 3 points 1 year ago* (last edited 1 year ago)

for the lazy clickers:

/c/[email protected]> formuladan

other communities you might be interested in

/c/[email protected] - 233 subs

/c/[email protected] - 25 subs

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (2 children)

Sounds very cool. Does running with that file also handle the SSL certificate and validation automatically? Or are there extra steps?

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (4 children)

Someone said this about Caddy "it injects advertising headers into your responses". Is this true? I don't know anything about caddy but that doesn't sound too good lo (to be fair it could be misinformation).

[–] [email protected] 2 points 1 year ago (1 children)

You probably understood me the first time but I'm editing because I made a mistake in how I phrased it.

to another ~~community~~ → instance

the number identifier is different on each ~~community~~ → instance

[–] [email protected] 1 points 1 year ago

i made a new userscript for submitting forms with Ctrl + Enter. Is that something you'd find useful?

// ==UserScript==
// @name         Lemmy Form Submit with Ctrl+Enter
// @version      1.0
// @description  Submit forms with Ctrl+Enter in Lemmy instances so you don't have to click the button every time you want to post something.
// @author       God (https://sh.itjust.works/u/god)
// @match        https://*/post/*
// @match        https://*/comment/*
// @icon         https://join-lemmy.org/static/assets/icons/favicon.svg
// ==/UserScript==

var isLemmy =
  document.head.querySelector("[name~=Description][content]").content ===
  "Lemmy";

if (isLemmy) {
  // Define a global variable to keep track of the currently focused textarea.
  var currentFocusedTextarea = null;

  // Function to attach focus and blur event handlers to all textareas.
  function attachEventHandlers() {
    document.querySelectorAll("textarea").forEach((textarea) => {
      if (!textarea.dataset.ctrlEnterHandled) {
        textarea.dataset.ctrlEnterHandled = true;

        // Check if this textarea is currently focused
        const wasFocused = document.activeElement === textarea;

        textarea.addEventListener("focus", function () {
          currentFocusedTextarea = this;
        });

        textarea.addEventListener("blur", function () {
          currentFocusedTextarea = null;
        });

        // If this textarea was focused, blur and re-focus it to ensure event handlers get triggered
        if (wasFocused) {
          textarea.blur();
          textarea.focus();
        }
      }
    });
  }

  // Attach a keydown event handler to the entire document.
  document.addEventListener("keydown", function (event) {
    // If Ctrl + Enter is pressed
    if (event.ctrlKey && event.key === "Enter") {
      // If a textarea is focused and contains text
      if (
        currentFocusedTextarea &&
        currentFocusedTextarea.value.trim() !== ""
      ) {
        // Your submit logic here
        handleSubmit(currentFocusedTextarea);
      }
    }
  });

  function handleSubmit(textarea) {
    // find the closest type="submit" button and press it.
    textarea.closest("form").querySelector('[type="submit"]').click();
  }

  // Call the function initially to cover textareas that exist when the page is first loaded.
  attachEventHandlers();

  // Observe the document for changes and reattach event handlers when new textareas are added.
  const observer = new MutationObserver(function (mutations) {
    mutations.forEach((mutation) => {
      if (mutation.type === "childList") {
        attachEventHandlers();
      }
    });
  });

  observer.observe(document.body, { childList: true, subtree: true });
}
[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (5 children)

do you know of any way to switch not a community but a post to another instance? afaik they're numeric so the number identifier is different on each instance which makes it hard.

[–] [email protected] 1 points 1 year ago

The good thing is since it's federated and open source, we can just make our own instances without them and block them. The bad thing is since they have the biggest instance (lemmy.ml) because, well, they made it and pioneered it, it's unlikely we'll want that or them blocked.

I think this is one of the reasons why many ppl are pushing to join Kbin instead since it's a bit more separated from the "overlords" than lemmy. I don't really know a solution yet to this problem, let's keep exploring.

[–] [email protected] 1 points 1 year ago

hey so regarding Kbin, I tried it, I got super lost. I can use Lemmy alright, very easy, but on Kbin I don't know how to browse either local or global "magazines". Do you know where these buttons are? lol.

[–] [email protected] 9 points 1 year ago

They don't have to leave leave. They can just join here and reduce the time they give reddit. Little by little they can just get out of that and into other stuff.

[–] [email protected] 6 points 1 year ago

Omg nice! Glad to join the ranks!

view more: ‹ prev next ›