Docs Auto Writer ✍️

Type text and insert it directly into Google Docs.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Docs Auto Writer ✍️
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Type text and insert it directly into Google Docs.
// @author       You
// @match        https://docs.google.com/document/*
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  if (document.getElementById("docs-writer-box")) return;

  // Create UI box
  const box = document.createElement("div");
  box.id = "docs-writer-box";

  Object.assign(box.style, {
    position: "fixed",
    bottom: "20px",
    right: "20px",
    width: "250px",
    background: "white",
    border: "1px solid #ccc",
    padding: "10px",
    zIndex: "999999",
    borderRadius: "8px",
    boxShadow: "0 2px 10px rgba(0,0,0,0.2)",
    fontFamily: "Arial"
  });

  // Input field
  const input = document.createElement("textarea");
  input.placeholder = "Type what you want to insert...";
  input.style.width = "100%";
  input.style.height = "80px";
  input.style.marginBottom = "5px";

  // Button
  const btn = document.createElement("button");
  btn.innerText = "Insert into Doc";
  btn.style.width = "100%";
  btn.style.cursor = "pointer";

  // Button click
  btn.onclick = () => {
    const text = input.value;
    if (!text) return;

    // Focus the doc editor
    const editor = document.querySelector('[contenteditable="true"]');
    if (!editor) return alert("Click inside the document first!");

    editor.focus();

    // Insert text at cursor
    document.execCommand("insertText", false, text);
  };

  // Add to page
  box.appendChild(input);
  box.appendChild(btn);
  document.body.appendChild(box);

})();