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
|
# CHANGELOG
|
||||||
|
|
||||||
|
## v1.1.1
|
||||||
|
|
||||||
|
- Bugs correction
|
||||||
|
|
||||||
## v1.1.0
|
## v1.1.0
|
||||||
|
|
||||||
- Bugs correction
|
- Bugs correction
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
href="https://www.flaticon.com/free-icons/mortarboard" target="_blank" rel="noopener noreferrer"
|
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>
|
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.
|
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
|
## Summary
|
||||||
|
|
||||||
- [MoodleGPT 1.1.0](#moodlegpt-110)
|
- [MoodleGPT 1.1.1](#moodlegpt-111)
|
||||||
- [Chrome Webstore](#chrome-webstore)
|
- [Chrome Webstore](#chrome-webstore)
|
||||||
- [Summary](#summary)
|
- [Summary](#summary)
|
||||||
- [Disclaimer !](#disclaimer-)
|
- [Disclaimer !](#disclaimer-)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- Before clicking on an answer check if the answer is already checked (or maybe reset the quiz first ?)
|
- 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,
|
"manifest_version": 3,
|
||||||
"name": "MoodleGPT",
|
"name": "MoodleGPT",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"description": "Hidden chat-gpt for your moodle quiz",
|
"description": "Hidden chat-gpt for your moodle quiz",
|
||||||
"permissions": ["storage"],
|
"permissions": ["storage"],
|
||||||
"action": {
|
"action": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const CURRENT_VERSION = '1.1.0';
|
const CURRENT_VERSION = '1.1.1';
|
||||||
const versionDisplay = document.querySelector('#version');
|
const versionDisplay = document.querySelector('#version');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "moodlegpt",
|
"name": "moodlegpt",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"description": "This extension allows you to hide CHAT-GPT in a Moodle quiz.",
|
"description": "This extension allows you to hide CHAT-GPT in a Moodle quiz.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run prettier && npm run lint && rollup -c",
|
"build": "npm run prettier && npm run lint && rollup -c",
|
||||||
|
|||||||
@@ -24,10 +24,15 @@ function handleContentEditable(
|
|||||||
|
|
||||||
if (config.typing) {
|
if (config.typing) {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
input.addEventListener('keydown', function (event: KeyboardEvent) {
|
|
||||||
if (event.key === 'Backspace') index = gptAnswer.response.length + 1;
|
const eventHandler = function (event: KeyboardEvent) {
|
||||||
if (index > gptAnswer.response.length) return;
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (event.key === 'Backspace' || index > gptAnswer.response.length) {
|
||||||
|
input.removeEventListener('keydown', eventHandler);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
input.textContent = gptAnswer.response.slice(0, ++index);
|
input.textContent = gptAnswer.response.slice(0, ++index);
|
||||||
|
|
||||||
// Put the cursor at the end of the typed text
|
// Put the cursor at the end of the typed text
|
||||||
@@ -40,7 +45,9 @@ function handleContentEditable(
|
|||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
input.addEventListener('keydown', eventHandler);
|
||||||
} else {
|
} else {
|
||||||
input.textContent = gptAnswer.response;
|
input.textContent = gptAnswer.response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,20 @@ function handleNumber(
|
|||||||
|
|
||||||
if (config.typing) {
|
if (config.typing) {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
input.addEventListener('keydown', function (event: Event) {
|
|
||||||
|
const eventHanlder = function (event: Event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if ((<KeyboardEvent>event).key === 'Backspace') index = number.length + 1;
|
if ((<KeyboardEvent>event).key === 'Backspace' || index > number.length) {
|
||||||
if (index > number.length) return;
|
input.removeEventListener('keydown', eventHanlder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (number.slice(index, index + 1) === '.') ++index;
|
if (number.slice(index, index + 1) === '.') ++index;
|
||||||
|
|
||||||
input.value = number.slice(0, ++index);
|
input.value = number.slice(0, ++index);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
input.addEventListener('keydown', eventHanlder);
|
||||||
} else {
|
} else {
|
||||||
input.value = number;
|
input.value = number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,14 +24,19 @@ function handleTextbox(
|
|||||||
|
|
||||||
if (config.typing) {
|
if (config.typing) {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
input.addEventListener('keydown', function (event: Event) {
|
|
||||||
|
const eventHandler = function (event: Event) {
|
||||||
event.preventDefault();
|
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.value = gptAnswer.response.slice(0, ++index);
|
||||||
});
|
};
|
||||||
|
|
||||||
|
input.addEventListener('keydown', eventHandler);
|
||||||
} else {
|
} else {
|
||||||
input.value = gptAnswer.response;
|
input.value = gptAnswer.response;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user