Quizlet.com Export

Adds functionality for copying quizlet lists to the clipboard

28.02.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Quizlet.com Export
// @version     1.0.4
// @author      petracoding
// @namespace   petracoding
// @grant       none
// @license     MIT
// @include     https://quizlet.com/*
// @include     http://quizlet.com/*
// @include     https://www.quizlet.com/*
// @include     http://www.quizlet.com/*
// @description Adds functionality for copying quizlet lists to the clipboard
// ==/UserScript==

// SETTINGS:

const swapTermAndDefinition = false; // true or false
const delimiter = "	"; // Use "\n" for a new line. Default: "	"
const delimiterBetweenTerms = "\n"; // Use "\n" for a new line. Default: "\n"

// DO NOT CHANGE ANYTHING BELOW HERE.

start();

function start() {
  const wrapper = document.querySelector(".SetPageHeader");
  if (!wrapper) return;

  const el = document.createElement("div");

  el.innerHTML = `
    <br/><div class="primary"><a class="action-1 button quizlet-export">Copy to clipboard</a></div>
  `;

  wrapper.appendChild(el);

  const btn = document.querySelector(".quizlet-export");
  btn.addEventListener("click", () => {
    copy();
  });
}

function copy() {
  const list = document.querySelectorAll(".SetPageTerms-termsList .SetPageTerms-term");
  let output = "";

  [...list].forEach((li) => {
    if (li.querySelector(".count")) {
      li.querySelector(".count").remove();
    }

    const lineBreak = " | ";

    //   "> * > * > * > * > *:first-child"
    const term = li.querySelector(":scope > * > * > * > * > *:nth-child(1) .TermText").innerHTML.replaceAll("<br>", lineBreak).trim();
    const definition = li.querySelector(":scope > * > * > * > * > *:nth-child(2) .TermText").innerHTML.replaceAll("<br>", lineBreak).trim();

    if (swapTermAndDefinition) {
      output += definition + delimiter + term + delimiterBetweenTerms;
    } else {
      output += term + delimiter + definition + delimiterBetweenTerms;
    }
  });

  navigator.clipboard.writeText(output);
  alert(
    "Done! All visible terms have been copied to the clipboard, you can now paste them anywhere.\n\nIf you are missing terms make sure to scroll down on your Quizlet list and load all terms before pressing the copy button."
  );
}