Give me Xianxia or give me death. I feed off incoherence.

  • 0 Posts
  • 20 Comments
Joined 1 year ago
cake
Cake day: June 9th, 2023

help-circle






  • Developers should have the responsibility of ensuring their users get the freedoms they deserve.

    No one deserves anything

    right to study and modify the program and distribute the original copy and the modifications

    there is no such right in any code, legal or moral, that i’ve read in the past, i wonder what philosophical branch it is that sources this perspective

    what’s stopping the developer from adding spyware into the app

    nothing, but when they do that, that’s when they’re “being unethical”. That’s like saing it’s unethical to have a kitchen knife in your kitchen because you COULD stab someone with it.

    Why would anyone trust that the program does what’s in their best interest?

    cuz they’re dumb & uninformed. doesn’t make it unethical tho, afaik.













  • 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 });
    }