Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying to GitHub Pages. #1

Merged
merged 21 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
95aa9b7
changing things. will push to main before requesting pull from gh-pages
DanielOnGitHub17 Apr 20, 2024
67f0c73
HTML okay
DanielOnGitHub17 Apr 21, 2024
fd28996
loading OKAY
DanielOnGitHub17 Apr 21, 2024
539f16c
styling nice (to me anyway)
DanielOnGitHub17 Apr 21, 2024
5616b87
made Switch (should turn to Toggle later) class.
DanielOnGitHub17 Apr 23, 2024
f3934b5
more markuping and styling (started styling SETUP screen)
DanielOnGitHub17 Apr 23, 2024
ee9a4d6
made the question class
DanielOnGitHub17 Apr 23, 2024
dab8f36
more styling
DanielOnGitHub17 Apr 23, 2024
7aae46c
start
DanielOnGitHub17 Apr 23, 2024
96073b6
to some point, done with setup
DanielOnGitHub17 Apr 24, 2024
62eadbe
started interview.js
DanielOnGitHub17 Apr 25, 2024
793a837
works for text based interviews
DanielOnGitHub17 Apr 25, 2024
c4c74fd
bug fix :)
DanielOnGitHub17 Apr 25, 2024
312ff0d
started doing for video
DanielOnGitHub17 Apr 25, 2024
bd58f06
works for both (still needs much changes, though)
DanielOnGitHub17 Apr 25, 2024
24d106b
I found a way to get speechSynthesis audio - recording the entire scr…
DanielOnGitHub17 Apr 26, 2024
48a9aa7
Update about.txt
DanielOnGitHub17 Apr 26, 2024
287a21a
final changes. checking if permission was given, will deploy to githu…
DanielOnGitHub17 Apr 26, 2024
ae14be3
Merge branch 'main' of https://github.com/DanielOnGitHub17/web-interveiw
DanielOnGitHub17 Apr 26, 2024
a6bc6f7
more changes. then I will move to gh-pages to add some more features
DanielOnGitHub17 Apr 26, 2024
439e935
Merge branch 'gh-pages' into main
DanielOnGitHub17 Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions about.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Made By Daniel Enesi, do not copy, do not pirate.
Made By Daniel Enesi. Do not misuse.

[email protected], +2347010081471

Asks interview questions and records answers, either in text or in voice
Asks interview questions and records answers, either in text or in video.
266 changes: 266 additions & 0 deletions classes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
class Question{
constructor(question="What do you want to be asked?"){
this._question = question;
this.build();
this.event();
Question.questions.push(this);
}
get question(){
return this.text.value;
}
set question(ask){
this.text.value = ask;
}
build(){
add(
(this.text = make("input"))
, add(this.box = make("li"), QUESTIONLIST)
).value = this._question;
this.text.type = "text";

["mover", "deleter"].forEach((type, i)=>{
add(
(this[type] = make("button")), this.box
).className = "icon";
this[type].textContent = Question.iconValues[i];
});
["box", "text", "mover", "deleter"].forEach(dom=>this[dom].obj=this);
this.mover.draggable = true;
}
event(){
this.deleter.onclick=()=>this.delete();
this.text.onkeyup=(event)=>{
event.key=="Enter" && event.ctrlKey && (new Question).text.focus();
}
this.mover.onkeydown=(event)=>{
Question.keys.includes(event.key) && event.preventDefault();
}
this.mover.onkeyup=(event)=>{
if (Question.keys.includes(event.key) &&
this.box[`${Question.keyMap[event.key]}ElementSibling`]){
event.preventDefault();
if (event.key.includes("Up")){
QUESTIONLIST.insertBefore(this.box, this.box.previousElementSibling);
} else{
QUESTIONLIST.insertBefore(this.box.nextElementSibling, this.box);
}
this.mover.focus();
}
}
this.mover.ondragstart=(event)=>{
this.box.classList.add("highlight");
}
this.mover.ondragend=(event)=>{
let at = document.elementFromPoint(event.x, event.y);
if (at && at.obj && at.obj != this){
QUESTIONLIST.insertBefore(this.box, at.obj.box)
}
this.box.classList.remove("highlight");
}
// this.mover.onmouse
this.text.onblur=()=>{
if (!this.question.trim()){
this.question = this._question;
}
}
}
delete(){
this.box.remove();
remove(this, Question.questions);
Question.deletedQuestions.push(this);
}
restore(){
QUESTIONLIST.append(this.box);
}
static restoreLast(){
SETUP.checkVisibility() && Question.deletedQuestions.length && Question.deletedQuestions.pop().restore();
}
static questions = [];
static iconValues = ['<>', 'X'];
static deletedQuestions = [];
static keyMap = {"ArrowUp": "previous", "ArrowDown": "next"};
static keys = Object.keys(Question.keyMap);
}

class Switch{
constructor(where, obj, property, values){
[this.container, this.obj, this.property, this.values] = arguments;
this.build();
this.event();
Switch.swtiches.push(this);
}
build(){
add((this.switch = make())
, add((this.holder = make()), this.container)
).className = "switch";
this.holder.className = "switchold";
// this.switch.tabIndex = -1;
}
event(){
this.switch.onclick = (event)=>{
event.preventDefault();
this.holder.classList.contains("off")
?this.holder.classList.remove("off")
:this.holder.classList.add("off");
this.action();
}
}
get on(){
return !this.holder.classList.contains("off")
}
action(){
// all switches will set a property of something
// between to two values (flex/none) (true/false)
// 1/0
let [obj, property, values] = [this.obj, this.property, this.values];
obj[property] = obj[property] == values[0]?values[1]:values[0]
}
static swtiches = [];
}

class Help{
constructor(){
this.messages = [
"Use ctrl+z to restore last delted question"
, "Hit enter on a question box to add another question"
, "etc"
]
}
}

class SearchUI{
// to specific
constructor(where, values){
[this.container, this._values] = arguments;
this.build();
this.event();
}
get values(){
if (typeof this._values == "function"){
return this._values();
} else{
return this._values;
}
}
build(){
add((this.searchBox = make("input"))
, add((this.box = make())
, this.container)).type = "text";
this.box.className = "searchui";
add((this.list = make("ul")), this.box).hidden = true;
this.list.size = 20
}
event(){
// change onvoice... to event variable/not
speechSynthesis.onvoiceschanged=(event)=>{
let voices = this.values;
for (let i in voices){
add(make("li"), this.list).textContent = voices[i];
}
}
this.searchBox.onfocus=()=>this.list.hidden=false;
this.searchBox.addEventListener("blur"
, ()=>setTimeout(()=>this.list.hidden=true, 500));
this.searchBox.oninput=(event)=>{
[...this.list.children].forEach(child=>{
child.hidden = !(child.textContent.toLowerCase().includes(this.searchBox.value.toLowerCase()));
});
if (this.value){
TALK.voice = getVoice(this.value);
}
}
this.list.onclick=(event)=>{
event.stopImmediatePropagation();
event.stopPropagation();
if (event.target.parentElement == this.list){
this.value = event.target.textContent;
}
}
}
get value(){
if (this.values.includes(this.searchBox.value)){
return this.searchBox.value;
};
return false;
}
set value(name){
this.searchBox.value = name;
TALK.voice = getVoice(name);
}
}

// modals
class Modal{
constructor(buttons){
this.buttons = buttons;
this.message = "";
this.build();
this.event();
Modal.modals.push(this);
}
build(){
add(this.modal = make()).className = "modal";
add(this.messageBox = make('p'), this.modal);
this.buttons.forEach((button, pos)=>{
add(this[button] = make("button"), this.modal).textContent = button;
this[button].pos = pos;
})
}
event(){
this.modal.onclick=(event)=>{
if (event.target.nodeName == "BUTTON"){
this.method(event.target.pos);
this.close();
}
}
}
changeButtons(buttons){
this.buttons.forEach((button, pos)=>{
this[button].textContent = buttons[pos];
this[button].pos = pos;
this[buttons[pos]] = this[button];
})
this.buttons = buttons;
}
open(message, buttons){
// do not do anything if a modal is already up
if (Modal.showing) {
this.blink();
return;
};
showLoading()
if (buttons) this.changeButtons(buttons);
this.messageBox.innerHTML = message;
this.modal.classList.add("shown");
this[this.buttons[this.buttons.length-1]].focus();
// promise
// will be given to the event onclick
return new Promise((resolve)=>this.method = resolve);
}
close(){
this.modal.classList.remove("shown", "blink");
hideLoading();
}
blink(){
this.modal.classList.add("blink");
setTimeout(()=>this.modal.classList.remove("blink"), 500);
}
get shown(){
return this.modal.classList.contains("shown");
}
static get showing(){
return Modal.modals.some(modal=>modal.shown);
}
static modals = [];
static alertBox = new Modal(["CLOSE"]);
static confirmBox = new Modal(["CANCEL", "OK"]);
}
function alert(message, buttons){
return Modal.alertBox.open(message, buttons);
}
function confirm(message, buttons){
return Modal.confirmBox.open(message, buttons);
}

// maise: young girl
// make search better by giving properties
Loading