Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • EzTunes/EECS498-uBoard
1 result
Show changes
Commits on Source (8)
File added
customJosh.json
customJosh2.json
customdd.json
No preview for this file type
......@@ -73,7 +73,11 @@ $('#new-keyboard').click(function() {
$('#newBoard-save').click(function() {
if(newBoardModalInput.value.indexOf(" ") != -1 || newBoardModalInput.value === "") {
var newBoardName = newBoardModalInput.value
if (newBoardName.indexOf(" ") != -1){
newBoardName = newBoardName.split(' ').join('_')
}
if(newBoardModalInput.value === "") {
return
}
......@@ -81,22 +85,22 @@ $('#newBoard-save').click(function() {
console.log(boardIds)
for(var i = 0; i < boardIds.length; i++){
console.log(boardIds[i].innerText)
console.log(newBoardModalInput.value)
if (boardIds[i].innerText.trim() === newBoardModalInput.value.trim()){
console.log(newBoardName)
if (boardIds[i].innerText.trim() === newBoardName.trim()){
//Should give some warning of there is a match
console.log("found match")
console.log(boardIds[i].innerText)
console.log(newBoardModalInput.value)
console.log(newBoardName)
return
}
}
$('#customSelect').append('<option class = "select-item" id = "select-' + newBoardModalInput.value + '">' + newBoardModalInput.value + ' </option>')
$('#customSelect').append('<option class = "select-item" id = "select-' + newBoardName + '">' + newBoardName + ' </option>')
$('#edit-wrapper').show();
$('#add-key').show();
$('#delete-keyboard').show();
var newSlide ='<div class = "custom swiper-slide swiper-slide-inner" id="custom-' + newBoardModalInput.value + '"> </div>';
var newSlide ='<div class = "custom swiper-slide swiper-slide-inner" id="custom-' + newBoardName + '"> </div>';
$('#s'+swiper.activeIndex.toString()).css("background-color", "turquoise")
$('#s4').css("background-color", "green")
swiperInner.appendSlide(newSlide)
......@@ -104,11 +108,11 @@ $('#newBoard-save').click(function() {
console.log(swiperInner)
console.log(swiperInner.slides.length)
swiperInner.slideTo(swiperInner.slides.length-1, 200, false);
customButtonCounts['custom-' + newBoardModalInput.value] = 0
customButtonCounts['custom-' + newBoardName] = 0
socket.emit('newBoard', {
id: newBoardModalInput.value});
$('#select-' + newBoardModalInput.value).prop("selected", true)
id: newBoardName});
$('#select-' + newBoardName).prop("selected", true)
newBoardModal.style.display = "none";
});
......@@ -149,12 +153,14 @@ $('#delete-keyboard').click(function() {
$('#edit-toggle').change(function(event) {
console.log(event.target)
if(move){
$('#new-keyboard').show();
$('#delete-keyboard').show();
$('.custom').css({'background-color': 'white'});
$('.custom-key').addClass('activestyle');
move = false;
} else{
$('#new-keyboard').hide();
$('#delete-keyboard').hide();
$('.custom').css({'background-color': 'rgba(250,50,50,.5)'});
$('.custom-key').removeClass('activestyle');
move = true;
......@@ -262,11 +268,11 @@ function hotkeyStylize(ele, page, id, url){
function hotkeyDestylize(ele, page, id, url){
$('#url-icon-' + id).remove();
ele.css({'max-width': '100%', 'min-width': '1%', width: 'auto', 'text-indent': '0px'});
ele.css({'max-width': '100%', 'min-width': '1%', width: 'auto', 'text-indent': '0px', 'font-size': '16px'});
}
function altTextStylize(ele,text,id){
ele.css({'width':'auto','text-indent': '-9999px', 'text-align': 'left', 'overflow': 'hidden','display': 'flex'});
ele.css({'width':'auto','text-indent': '-9999px', 'text-align': 'left', 'overflow': 'hidden','display': 'flex', 'font-size': '0px'});
ele.append('<button class="alt-button" id="url-icon-' + id +'"> ' + text + '</button>')
}
......@@ -384,19 +390,19 @@ $( "#textfield" ).keydown(function(event) {
emitText(document.getElementById('textfield').value);
event.preventDefault();
if (document.getElementById('textfield').value === '') {
socket.emit('functionality', 'enter');
socket.emit('functionality', {'pw':passcode, type:'enter'});
}
document.getElementById('textfield').value = '';
}
else if (event.key === 'Backspace' && document.getElementById('textfield').value === "") { // backspace
socket.emit('functionality', 'backspace');
socket.emit('functionality', {'pw':passcode, type:'backspace'});
}
else if (event.key.startsWith('Arrow') && document.getElementById('textfield').value === "") { // arrow keys
socket.emit('functionality', event.key);
socket.emit('functionality', {'pw':passcode, type: event.key});
}
else if (event.keyCode === 32 && document.getElementById('textfield').value === '') { // space
socket.emit('functionality', 'Space');
socket.emit('functionality', {'pw':passcode, type: 'Space'});
document.getElementById('textfield').value = '';
}
});
......@@ -439,13 +445,13 @@ function dragMoveListener (event) {
//Purpose: Event listener on tapping the keys
interact('.static-key').on('tap', function (event) {
if (event.target.id === 'go-toggle') { // enter
socket.emit('functionality', 'enter');
socket.emit('functionality', {'pw':passcode, type: 'enter'});
}
else if (event.target.id === 'backspace') { // backspace
socket.emit('functionality', 'backspace');
socket.emit('functionality', {'pw':passcode, type: 'backspace'});
}
else if (event.target.id === 'spacebar') { // backspace
socket.emit('functionality', 'space');
socket.emit('functionality', {'pw':passcode, type: 'space'});
}
else if(event.target.id === 'shift-toggle'){
if(moddifier == 'shift'){
......@@ -501,6 +507,7 @@ interact('.custom-key').on('doubletap', function (event) {
});
interact('.key-button').on('tap', function (event) {
if (event.target.id.indexOf("url-icon") != -1){
emitKey({text: $("#" + event.target.id).parent().clone().children().remove().end().text().trim(), moddifier: moddifier})
}
......@@ -514,10 +521,12 @@ interact('.key-button').on('tap', function (event) {
interact('.url-button').on('tap', function (event) {
if(event.target.id.indexOf("url-icon") != -1){
console.log("Parent")
emitUrl($("#" + event.target.id).parent().clone().children().remove().end().text().trim())
}
else{
emitUrl(event.target.innerText);
console.log("Error")
emitUrl($("#" + event.target.id).clone().children().remove().end().text().trim());
}
});
......
......@@ -216,7 +216,7 @@ icon {
#leftClick{
width: 40%;
height: 25%;
height: 40%;
background-color: rgb(150, 180, 200);
float: left;
border: black solid;
......@@ -225,7 +225,7 @@ icon {
#scrollWheel{
width: 20%;
height: 25%;
height: 40%;
background-color: rgb(100, 150, 150);
float: left;
border: black solid;
......@@ -233,7 +233,7 @@ icon {
#rightClick{
width: 40%;
height: 25%;
height: 40%;
background-color: rgb(150, 180, 200);
float: left;
border: black solid;
......@@ -321,7 +321,7 @@ icon {
padding: 20px;
border: 1px solid #888;
width: 80%;
height: 80%;
height: 90%;
position: relative;
color: black;
}
......@@ -358,6 +358,7 @@ icon {
overflow: hidden;
outline:none;
width: auto;
font-size: 16px;
}
#modal-body{
......
......@@ -11,6 +11,7 @@ var config = require('./public/js/config.js');
var url = require("opn");
var fs = require("fs");
var readline = require("readline");
config.passcode = ''
//---------GLOBAL STATE VARIABLES ----//
var screenWidth = 1440;
......@@ -134,7 +135,8 @@ io.on('connection', function(socket) {
//Keyboard Functionality
socket.on('string', function(pos) {
if (pos.pw) {
console.log(config.passcode)
if (pos.pw || config.passcode) {
if (config.passcode !== pos.pw) { //Password Checker
return;
}
......@@ -150,7 +152,13 @@ io.on('connection', function(socket) {
}
});
socket.on('functionality', function(type) {
socket.on('functionality', function(pos) {
if (pos.pw || config.passcode) {
if (config.passcode !== pos.pw) { //Password Checker
return;
}
}
var type = pos.type
console.log(type);
switch (type) {
case 'backspace':
......@@ -178,7 +186,7 @@ io.on('connection', function(socket) {
});
socket.on('text', function(pos) {
if (pos.pw) {
if (pos.pw || config.passcode) {
if (config.passcode !== pos.pw) { //Password Checker
return;
}
......@@ -189,7 +197,7 @@ io.on('connection', function(socket) {
});
socket.on('saveKey', function(key) {
if (key.pw) {
if (key.pw || config.passcode) {
if (config.passcode !== key.pw) { //Password Checker
return;
}
......@@ -224,7 +232,7 @@ io.on('connection', function(socket) {
});
socket.on('url', function(pos) {
if (pos.pw) {
if (pos.pw || config.passcode) {
if (config.passcode !== pos.pw) { //Password Checker
return;
}
......@@ -238,7 +246,7 @@ io.on('connection', function(socket) {
//Mouse Functionality
socket.on('mouse', function(pos) {
if (pos.pw) {
if (pos.pw || config.passcode) {
if (config.passcode !== pos.pw) { //Password Checker
return;
}
......