fixed backspace for text input, number input and contenteditable. Also moved to v1.1.1
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# CHANGELOG
|
||||
|
||||
## v1.1.1
|
||||
|
||||
- Bugs correction
|
||||
|
||||
## v1.1.0
|
||||
|
||||
- Bugs correction
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
href="https://www.flaticon.com/free-icons/mortarboard" target="_blank" rel="noopener noreferrer"
|
||||
title="Mortarboard icons created by itim2101 - Flaticon" ><img src="./extension/icon.png" alt="Mortarboard icons created by itim2101 - Flaticon" width="150" style="display:block; margin:auto;"></a></p>
|
||||
|
||||
# MoodleGPT 1.1.0
|
||||
# MoodleGPT 1.1.1
|
||||
|
||||
This extension allows you to hide CHAT-GPT in a Moodle quiz. You just need to click on the question you want to solve, and CHAT-GPT will automatically provide the answer. However, one needs to be careful because as we know, CHAT-GPT can make errors especially in calculations.
|
||||
|
||||
@@ -12,7 +12,7 @@ Find the extension on the Chrome Webstore right [here](https://chrome.google.com
|
||||
|
||||
## Summary
|
||||
|
||||
- [MoodleGPT 1.1.0](#moodlegpt-110)
|
||||
- [MoodleGPT 1.1.1](#moodlegpt-111)
|
||||
- [Chrome Webstore](#chrome-webstore)
|
||||
- [Summary](#summary)
|
||||
- [Disclaimer !](#disclaimer-)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# TODO
|
||||
|
||||
- Before clicking on an answer check if the answer is already checked (or maybe reset the quiz first ?)
|
||||
- Fixe contenteditable not filled and remove useless content that is send to chatgpt
|
||||
- Fixe contenteditable not filled and remove useless content that is send to chatgpt (getVisibleText)
|
||||
- Fixe backspace pressed on contenteditable
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "MoodleGPT",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "Hidden chat-gpt for your moodle quiz",
|
||||
"permissions": ["storage"],
|
||||
"action": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const CURRENT_VERSION = '1.1.0';
|
||||
const CURRENT_VERSION = '1.1.1';
|
||||
const versionDisplay = document.querySelector('#version');
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "moodlegpt",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "This extension allows you to hide CHAT-GPT in a Moodle quiz.",
|
||||
"scripts": {
|
||||
"build": "npm run prettier && npm run lint && rollup -c",
|
||||
|
||||
@@ -24,10 +24,15 @@ function handleContentEditable(
|
||||
|
||||
if (config.typing) {
|
||||
let index = 0;
|
||||
input.addEventListener('keydown', function (event: KeyboardEvent) {
|
||||
if (event.key === 'Backspace') index = gptAnswer.response.length + 1;
|
||||
if (index > gptAnswer.response.length) return;
|
||||
|
||||
const eventHandler = function (event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
|
||||
if (event.key === 'Backspace' || index > gptAnswer.response.length) {
|
||||
input.removeEventListener('keydown', eventHandler);
|
||||
return;
|
||||
}
|
||||
|
||||
input.textContent = gptAnswer.response.slice(0, ++index);
|
||||
|
||||
// Put the cursor at the end of the typed text
|
||||
@@ -40,7 +45,9 @@ function handleContentEditable(
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
input.addEventListener('keydown', eventHandler);
|
||||
} else {
|
||||
input.textContent = gptAnswer.response;
|
||||
}
|
||||
|
||||
@@ -28,13 +28,20 @@ function handleNumber(
|
||||
|
||||
if (config.typing) {
|
||||
let index = 0;
|
||||
input.addEventListener('keydown', function (event: Event) {
|
||||
|
||||
const eventHanlder = function (event: Event) {
|
||||
event.preventDefault();
|
||||
if ((<KeyboardEvent>event).key === 'Backspace') index = number.length + 1;
|
||||
if (index > number.length) return;
|
||||
if ((<KeyboardEvent>event).key === 'Backspace' || index > number.length) {
|
||||
input.removeEventListener('keydown', eventHanlder);
|
||||
return;
|
||||
}
|
||||
|
||||
if (number.slice(index, index + 1) === '.') ++index;
|
||||
|
||||
input.value = number.slice(0, ++index);
|
||||
});
|
||||
};
|
||||
|
||||
input.addEventListener('keydown', eventHanlder);
|
||||
} else {
|
||||
input.value = number;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,19 @@ function handleTextbox(
|
||||
|
||||
if (config.typing) {
|
||||
let index = 0;
|
||||
input.addEventListener('keydown', function (event: Event) {
|
||||
|
||||
const eventHandler = function (event: Event) {
|
||||
event.preventDefault();
|
||||
if ((<KeyboardEvent>event).key === 'Backspace') {
|
||||
index = gptAnswer.response.length + 1;
|
||||
|
||||
if ((<KeyboardEvent>event).key === 'Backspace' || index > gptAnswer.response.length) {
|
||||
input.removeEventListener('keydown', eventHandler);
|
||||
return;
|
||||
}
|
||||
if (index > gptAnswer.response.length) return;
|
||||
|
||||
input.value = gptAnswer.response.slice(0, ++index);
|
||||
});
|
||||
};
|
||||
|
||||
input.addEventListener('keydown', eventHandler);
|
||||
} else {
|
||||
input.value = gptAnswer.response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user