Greasy Fork 支持简体中文。

OneClick Tools - Canvas Instructure

Copy/Google with a single click on all instructure.com quizzes/exam questions of your course.

安裝腳本?
作者推薦腳本

您可能也會喜歡 OneClick Tools - McGraw-Hill

安裝腳本
  1. // ==UserScript==
  2. // @name OneClick Tools - Canvas Instructure
  3. // @namespace https://greasyfork.org/en/users/670188-hacker09?sort=daily_installs
  4. // @version 2
  5. // @description Copy/Google with a single click on all instructure.com quizzes/exam questions of your course.
  6. // @author hacker09
  7. // @match https://*.instructure.com/courses/*/quizzes/*
  8. // @icon https://du11hjcvx0uqb.cloudfront.net/br/dist/images/favicon-e10d657a73.ico
  9. // @run-at document-end
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. document.querySelectorAll(".text").forEach(el => { //forEach question
  16. el.style.cursor = "pointer"; //Change cursor style to pointer
  17. el.addEventListener('mouseup', function(event) { //When the mouse is clicked
  18. event.preventDefault(); //Prevent the default context menu from being opened
  19. var textToCopy = el.cloneNode(true); //Clone the question/answers
  20. textToCopy.querySelectorAll('.original_question_text, #question_input_1_statusbar, .ic-RichContentEditor, .tox-editor-header, style')?.forEach(editor => editor.remove()); //If existent, select elements to remove their text
  21. if (event.button === 0) { //If the user single clicks anywhere on the question/answer
  22. navigator.clipboard.writeText(textToCopy.innerText.replace(/(\r?\n\s*){2,}/g, '\n')); //Copy the text and question
  23. } else if (event.button === 2) { //If the user right clicks anywhere on the question/answer
  24. navigator.clipboard.writeText(el.querySelector(".question_text.user_content.enhanced").innerText); //Copy only the question
  25. open('https://www.google.com/search?q=' + encodeURIComponent(textToCopy.innerText.replace(/(\r?\n\s*){2,}/g, '\n'))); //Google the question and answer
  26. } //Finishes the else condition
  27. }); //Finishes the mouseup event listener
  28. }); //Finishes the forEach loop
  29. })();