민병수

Merge branch 'html-home' into 'main'

Html home



See merge request !4
......@@ -15,7 +15,7 @@ a{
color:var(--text-color);
}
.menu{
.voi_menu{
display:flex;
justify-content:space-between;
align-items:center;
......@@ -25,10 +25,12 @@ a{
.menu_bar_content li:hover{
background-color:var(--accent-color);
border-radius: 4px;
color:var(--text-color);
}
.menu_bar_icons li:hover{
background-color:var(--accent-color);
border-radius: 4px;
color:var(--text-color);
}
.menu_bar_logo{
font-size: 20px;
......@@ -37,6 +39,9 @@ a{
.menu_bar_logo i{
color:var(--accent-color);
}
.basic:hover{
color:var(--text-color);
}
.menu_bar_content{
display:flex;
list-style: none;
......@@ -54,13 +59,17 @@ a{
padding: 8px 12px;
}
.menu_toggle{
color:var(--text-color);
display: none;
position: absolute;
right:32px;
font-size: 24px;
}
.menu_toggle:hover{
color:var(--text-color);
}
@media screen and (max-width: 500px) {
.menu{
.voi_menu{
flex-direction: column;
align-items: flex-start;
padding: 8px 24px;
......@@ -82,6 +91,7 @@ a{
}
.menu_toggle{
display: block;
color:var(--text-color);
}
.menu_bar_content.active,
.menu_bar_icons.active{
......@@ -109,25 +119,35 @@ button:hover{
margin: 23px;
}
#output{
width:50%;
margin-left:20px;
margin:20px;
display:flex;
border: 3px solid var(--accent-color);
align-items:center;
height:700px;
background-color:rgba(0,0,0,.87);
color:var(--text-color);
}
#recordButton{
line-height: 22px;
font-size:50px;
}
#transcribeButton{
line-height: 22px;
font-size:50px;
}
.output_bar{
display:flex;
justify-content:space-around;
justify-content:center;
color:black;
border: 3px solid var(--accent-color);
margin: 20px;
font-size:100px;
}
.ttp{
.basic{
color:var(--text-color);
font-size:20px;
}
.fas.fa-arrow-circle-down{
color:var(--background-color);
font-size:70px;
display:block;
text-align:center;
}
\ No newline at end of file
......
This diff is collapsed. Click to expand it.
......@@ -13,7 +13,7 @@ a{
color:var(--text-color);
}
.menu{
.voi_menu{
display:flex;
justify-content:space-between;
align-items:center;
......
......@@ -12,7 +12,7 @@
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300&display=swap" rel="stylesheet">
</head>
<body>
<nav class="menu">
<nav class="voi_menu">
<div class="menu_bar_logo">
<i class="fas fa-microphone-alt"></i>
<a href="Voico_Home.html">Voicoding</a>
......
......@@ -13,7 +13,7 @@ a{
color:var(--text-color);
}
.menu{
.voi_menu{
display:flex;
justify-content:space-between;
align-items:center;
......
......@@ -12,7 +12,7 @@
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300&display=swap" rel="stylesheet">
</head>
<body>
<nav class="menu">
<nav class="voi_menu">
<div class="menu_bar_logo">
<i class="fas fa-microphone-alt"></i>
<a href="Voico_Home.html">Voicoding</a>
......
body {
background: url(/images/judge0_background.png) no-repeat center center fixed;
-webkit-background-size: cover;
......@@ -87,6 +86,7 @@ body {
}
#site-content {
display:flex;
height: calc(100% - 45px - 19px);
}
......
......@@ -141,8 +141,8 @@ function localStorageGetItem(key) {
}
function showMessages() {
var width = $updates.offset().left - parseFloat($updates.css("padding-left")) -
$navigationMessage.parent().offset().left - parseFloat($navigationMessage.parent().css("padding-left")) - 5;
var width = 100//$updates.offset().left - parseFloat($updates.css("padding-left")) -
//$navigationMessage.parent().offset().left - parseFloat($navigationMessage.parent().css("padding-left")) - 5;
if (width < 200 || messagesData === undefined) {
return;
......@@ -255,7 +255,7 @@ function getIdFromURI() {
}
function downloadSource() {
var value = parseInt($selectLanguage.val());
var value = parseInt(71);
download(sourceEditor.getValue(), fileNames[value], "text/plain");
}
......@@ -308,7 +308,7 @@ function run() {
var sourceValue = encode(sourceEditor.getValue());
var stdinValue = encode(stdinEditor.getValue());
var languageId = resolveLanguageId($selectLanguage.val());
var languageId = resolveLanguageId(71);
var compilerOptions = $compilerOptions.val();
var commandLineArguments = $commandLineArguments.val();
......@@ -393,21 +393,21 @@ function fetchSubmission(submission_token) {
function changeEditorLanguage() {
monaco.editor.setModelLanguage(sourceEditor.getModel(), $selectLanguage.find(":selected").attr("mode"));
currentLanguageId = parseInt($selectLanguage.val());
currentLanguageId = parseInt(71);
$(".lm_title")[0].innerText = fileNames[currentLanguageId];
apiUrl = resolveApiUrl($selectLanguage.val());
apiUrl = resolveApiUrl(71);
}
function insertTemplate() {
currentLanguageId = parseInt($selectLanguage.val());
currentLanguageId = parseInt(71);
sourceEditor.setValue(sources[currentLanguageId]);
changeEditorLanguage();
}
function loadRandomLanguage() {
// $selectLanguage.dropdown("set selected", values[Math.floor(Math.random() * $selectLanguage[0].length)]);
$selectLanguage.dropdown("set selected", 71);
apiUrl = resolveApiUrl($selectLanguage.val());
//$selectLanguage.dropdown("set selected", 71);
apiUrl = resolveApiUrl(71);
insertTemplate();
}
......@@ -591,7 +591,7 @@ $(document).ready(function () {
changeEditorMode();
sourceEditor.getModel().onDidChangeContent(function (e) {
currentLanguageId = parseInt($selectLanguage.val());
currentLanguageId = parseInt(71);
isEditorDirty = sourceEditor.getValue() != sources[currentLanguageId];
});
......
let rec = null;
let audioStream = null;
const recordButton = document.getElementById("recordButton");
const transcribeButton = document.getElementById("transcribeButton");
recordButton.addEventListener("click", startRecording);
transcribeButton.addEventListener("click", transcribeText);
let cnt = 0;
function startRecording() {
let constraints = { audio: true, video:false }
recordButton.disabled = true;
transcribeButton.disabled = false;
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {
const audioContext = new window.AudioContext();
audioStream = stream;
const input = audioContext.createMediaStreamSource(stream);
rec = new Recorder(input, { numChannels:1 })
rec.record()
}).catch(function(err) {
recordButton.disabled = false;
transcribeButton.disabled = true;
});
}
function transcribeText() {
transcribeButton.disabled = true;
recordButton.disabled = false;
rec.stop();
audioStream.getAudioTracks()[0].stop();
rec.exportWAV(uploadSoundData);
}
function uploadSoundData(blob) {
let filename = new Date().toISOString();
let xhr = new XMLHttpRequest();
let formData = new FormData();
xhr.onload = function(e) {
if(this.readyState === 4) {
document.getElementById("output").innerHTML += `${cnt++}: ${JSON.parse(e.target.responseText)}<br>`;
}
};
formData.append("audio_data", blob, filename);
xhr.open("POST", "/upload_sound", true);
xhr.send(formData);
}
\ No newline at end of file
File mode changed
......@@ -3,7 +3,7 @@ const multer = require('multer');
const fs = require('fs');
const upload = multer();
const app = express();
const port = 5501;
const port = 5500;
app.use(express.static('Voicoding_web'));
app.use(express.static('./'));
async function testGoogleTextToSpeech(audioBuffer) {
......