Skip to content

Commit

Permalink
Amend style
Browse files Browse the repository at this point in the history
  • Loading branch information
pskl committed Aug 21, 2024
1 parent 435f377 commit 2c5decb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
<script src="script.js"></script>
</body>

</html>
</html>
15 changes: 13 additions & 2 deletions docs/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ function displayChat(answers, score) {
playAnswer(answers[i].sample).onended = () => {
const img = images[i];
img.style.display = 'inline-block';
img.scrollIntoView({ behavior: 'smooth', inline: 'start' });
updateIntensityGraph(answers[i], i, answers.length);
i++;
scrollImageIntoView(img);
nextQuestion();
};
}
Expand All @@ -122,6 +122,17 @@ function displayChat(answers, score) {
nextQuestion();
}

function scrollImageIntoView(img) {
setTimeout(() => {
const container = document.getElementById('image-display');
const scrollLeft = img.offsetLeft - container.offsetLeft;
container.scrollTo({
left: scrollLeft,
behavior: 'smooth'
});
}, 50);
}

function displayScore(score) {
const container = document.getElementById('chat-container');

Expand Down Expand Up @@ -208,4 +219,4 @@ function drawGrid(svgContainer) {
.attr("stroke", strokeColor)
.attr("stroke-width", 0.2);
}
}
}
13 changes: 12 additions & 1 deletion docs/serve.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#!/bin/bash

python3 -m http.server 8000 --directory "." & chromium-browser --start-fullscreen "http://localhost:8000"
# Check if a directory was provided as an argument
if [ $# -eq 0 ]; then
# If no argument, use the current directory
DIR="."
else
# Use the provided directory
DIR="$1"
fi

python3 -m http.server 8069 --directory "$DIR" > /dev/null 2>&1 &
sleep 2
chromium-browser --start-fullscreen "http://localhost:8069"
15 changes: 9 additions & 6 deletions docs/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ html {
}

#tableContainer .tableHead {
font-size: clamp(12px, 2.2vw, 30px);
font-size: clamp(13px, 2.2vw, 30px);
text-align: center;
font-weight: 400;
}
Expand Down Expand Up @@ -130,7 +130,7 @@ html {
}

#tableContainer #promptContent {
font-size: clamp(12px, 1.6vw, 40px);
font-size: clamp(15px, 1.6vw, 40px);
}

#chat-container {
Expand Down Expand Up @@ -159,14 +159,14 @@ html {
.question {
margin-left: 0;
margin-right: auto;
width: 30%;
width: 40%;
text-align: center;
}

.answer {
margin-left: auto;
margin-right: 0;
width: 30%;
width: 20%;
text-align: center;
}

Expand All @@ -178,6 +178,9 @@ html {
height: 30vh;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
background-color: white;
border-top: 1vh solid black;
}
Expand Down Expand Up @@ -232,7 +235,7 @@ html {
#selectionHeading {
color: white;
text-align: center;
font-size: 10vh;
font-size: 8vw;
margin-bottom: 20px;
font-weight: 600;
}
Expand All @@ -242,4 +245,4 @@ html {
margin-left: 1vh;
margin-bottom: 0.5vh;
font-weight: 400;
}
}

0 comments on commit 2c5decb

Please sign in to comment.