Spaces:
Sleeping
Sleeping
Commit
·
909b565
1
Parent(s):
f7ed3df
fix
Browse files- public/controller.js +1 -1
- public/esltool.js +13 -8
- public/index.html +2 -3
- public/index2.html +73 -0
- public/utils.js +1 -1
public/controller.js
CHANGED
|
@@ -28,7 +28,7 @@ const controller = {
|
|
| 28 |
view.elem.voiceButton,
|
| 29 |
(audioBlob) => {
|
| 30 |
utils.stt(audioBlob).then((transcribe) => {
|
| 31 |
-
if (transcribe
|
| 32 |
console.log("transcribe failed, try alternative way");
|
| 33 |
whisperjaxws(audioBlob).then((transcribe) => { // Replace with your alternative transcription
|
| 34 |
utils.writeText(document.activeElement, transcribe);
|
|
|
|
| 28 |
view.elem.voiceButton,
|
| 29 |
(audioBlob) => {
|
| 30 |
utils.stt(audioBlob).then((transcribe) => {
|
| 31 |
+
if (!transcribe?.text ) {
|
| 32 |
console.log("transcribe failed, try alternative way");
|
| 33 |
whisperjaxws(audioBlob).then((transcribe) => { // Replace with your alternative transcription
|
| 34 |
utils.writeText(document.activeElement, transcribe);
|
public/esltool.js
CHANGED
|
@@ -111,27 +111,32 @@ askButton.addEventListener("click", () => {
|
|
| 111 |
|
| 112 |
|
| 113 |
// Correct Button:
|
| 114 |
-
correctBtn.addEventListener("
|
| 115 |
ask('correct mistakes of the text: \n');
|
| 116 |
});
|
| 117 |
|
| 118 |
// Translate Button:
|
| 119 |
-
translateBtn.addEventListener("
|
| 120 |
-
ask(`translate to English, ${config.first_language}:\n `);
|
| 121 |
});
|
| 122 |
|
| 123 |
// Explain Button:
|
| 124 |
-
explainBtn.addEventListener("
|
| 125 |
-
ask('explain this for english seconds language learner in simple english:\n ');
|
| 126 |
|
| 127 |
});
|
| 128 |
|
| 129 |
// Define Button:
|
| 130 |
-
defineBtn.addEventListener("
|
| 131 |
-
ask('define the word ,
|
| 132 |
});
|
| 133 |
|
| 134 |
-
removeButton.addEventListener('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
| 136 |
// Style the toolbar
|
| 137 |
toolbar.style.position = "fixed";
|
|
|
|
| 111 |
|
| 112 |
|
| 113 |
// Correct Button:
|
| 114 |
+
correctBtn.addEventListener("pointerdown", () => {
|
| 115 |
ask('correct mistakes of the text: \n');
|
| 116 |
});
|
| 117 |
|
| 118 |
// Translate Button:
|
| 119 |
+
translateBtn.addEventListener("pointerdown", () => {
|
| 120 |
+
ask(`translate to English, ${config.first_language} French :\n `);
|
| 121 |
});
|
| 122 |
|
| 123 |
// Explain Button:
|
| 124 |
+
explainBtn.addEventListener("pointerdown", () => {
|
| 125 |
+
ask('explain this for english seconds language learner in simple english first,then analyse step by step:\n ');
|
| 126 |
|
| 127 |
});
|
| 128 |
|
| 129 |
// Define Button:
|
| 130 |
+
defineBtn.addEventListener("pointerdown", () => {
|
| 131 |
+
ask('define the word in simple english , tell me all definitions if it has,and part of speech, and give some usage example:\n ' )
|
| 132 |
});
|
| 133 |
|
| 134 |
+
removeButton.addEventListener('pointerdown', () => {
|
| 135 |
+
if(prompt('remove?')==true){
|
| 136 |
+
toolbar.style.display = 'none'
|
| 137 |
+
|
| 138 |
+
}
|
| 139 |
+
});
|
| 140 |
|
| 141 |
// Style the toolbar
|
| 142 |
toolbar.style.position = "fixed";
|
public/index.html
CHANGED
|
@@ -54,13 +54,12 @@
|
|
| 54 |
</style>
|
| 55 |
</head>
|
| 56 |
<body>
|
| 57 |
-
<div style="height:
|
| 58 |
share the note via url:
|
| 59 |
-
<
|
| 60 |
<div id="notebin_editor"></div>
|
| 61 |
|
| 62 |
|
| 63 |
-
<div style="height: 300vh;"></div>
|
| 64 |
|
| 65 |
|
| 66 |
|
|
|
|
| 54 |
</style>
|
| 55 |
</head>
|
| 56 |
<body>
|
| 57 |
+
<div style="height: 30px;"></div>
|
| 58 |
share the note via url:
|
| 59 |
+
<span id="url_div"></span>
|
| 60 |
<div id="notebin_editor"></div>
|
| 61 |
|
| 62 |
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
|
public/index2.html
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
+
<link rel="manifest" href="./manifest.json">
|
| 8 |
+
<link rel="stylesheet" href="./libs/toastui-editor.min.css" />
|
| 9 |
+
|
| 10 |
+
<title>groqnote</title>
|
| 11 |
+
<style>
|
| 12 |
+
body {
|
| 13 |
+
font-family: Arial, sans-serif;
|
| 14 |
+
background-color: #f4f4f4;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
#testLinkContainer a {
|
| 18 |
+
width: fit-content;
|
| 19 |
+
display: inline-block;
|
| 20 |
+
margin-bottom: 10px;
|
| 21 |
+
color: #333;
|
| 22 |
+
text-decoration: none;
|
| 23 |
+
background-color: #ddd;
|
| 24 |
+
padding: 10px;
|
| 25 |
+
border-radius: 5px;
|
| 26 |
+
}
|
| 27 |
+
#testLinkContainer a:hover {
|
| 28 |
+
background-color: #eee;
|
| 29 |
+
}
|
| 30 |
+
textarea {
|
| 31 |
+
width: 90%;
|
| 32 |
+
height: 40vh;
|
| 33 |
+
margin-bottom: 20px;
|
| 34 |
+
padding: 10px;
|
| 35 |
+
border-radius: 5px;
|
| 36 |
+
border: 1px solid #ccc;
|
| 37 |
+
}
|
| 38 |
+
input {
|
| 39 |
+
display: block;
|
| 40 |
+
margin-bottom: 20px;
|
| 41 |
+
padding: 10px;
|
| 42 |
+
border-radius: 5px;
|
| 43 |
+
border: 1px solid #ccc;
|
| 44 |
+
}
|
| 45 |
+
#editableDiv {
|
| 46 |
+
padding: 20px;
|
| 47 |
+
border: 1px solid #ccc;
|
| 48 |
+
border-radius: 5px;
|
| 49 |
+
background-color: #fff;
|
| 50 |
+
}
|
| 51 |
+
#editableDiv div {
|
| 52 |
+
padding: 10px;
|
| 53 |
+
}
|
| 54 |
+
</style>
|
| 55 |
+
</head>
|
| 56 |
+
<body>
|
| 57 |
+
<div style="height: 300px;"></div>
|
| 58 |
+
share the note via url:
|
| 59 |
+
<div id="url_div"></div>
|
| 60 |
+
<div id="notebin_editor"></div>
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
<div style="height: 3000px;"></div>
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
<script src="./index.js" type="module"></script>
|
| 68 |
+
<script src="./esltool.js" type="module"></script>
|
| 69 |
+
<script src="./libs/toastui-editor-all.min.js"></script>
|
| 70 |
+
<script type="module" src="./notebin.js"></script>
|
| 71 |
+
|
| 72 |
+
</body>
|
| 73 |
+
</html>
|
public/utils.js
CHANGED
|
@@ -187,7 +187,7 @@ const utils = {
|
|
| 187 |
}, 200);
|
| 188 |
mediaRecorder.addEventListener("dataavailable", (event) => {
|
| 189 |
if (autoStop === true) {
|
| 190 |
-
if (Date.now() - startTime >
|
| 191 |
mediaRecorder.stop();
|
| 192 |
}
|
| 193 |
}
|
|
|
|
| 187 |
}, 200);
|
| 188 |
mediaRecorder.addEventListener("dataavailable", (event) => {
|
| 189 |
if (autoStop === true) {
|
| 190 |
+
if (Date.now() - startTime > 10000) {
|
| 191 |
mediaRecorder.stop();
|
| 192 |
}
|
| 193 |
}
|