Change line endings to unix

This commit is contained in:
Pedro de Oliveira 2016-10-17 18:38:35 +01:00
parent e9f18446d9
commit 41cfaaf791
3 changed files with 301 additions and 317 deletions

View File

@ -15,15 +15,8 @@ function reset() {
room(); room();
} }
/**
* @author cc
* Unified func for keydown and touch events
*/
function doAction(actionID) { function doAction(actionID) {
if(selected === 0) { if(selected === 0) {
switch(actionID) { switch(actionID) {
case 70: case 70:
selected = 1; selected = 1;
@ -60,28 +53,19 @@ function prepareCanvas(canvasDiv, canvasWidth, canvasHeight)
// Note: The above code is a workaround for IE 8and lower. Otherwise we could have used: // Note: The above code is a workaround for IE 8and lower. Otherwise we could have used:
// context = document.getElementById('canvas').getContext("2d"); // context = document.getElementById('canvas').getContext("2d");
/**
* @author: cc
* Do device validation, fix layout and assign their events
*/
//Check device //Check device
if( navigator.userAgent.match(/Android/i) || if (navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/iPhone|iPad|iPod/i) || navigator.userAgent.match(/iPhone|iPad|iPod/i) ||
navigator.userAgent.match(/IEMobile/i) ) { //is mobile navigator.userAgent.match(/IEMobile/i)) {
document.getElementById("infoDiv").style.display = "none"; document.getElementById("infoDiv").style.display = "none";
var elems = document.getElementById("touch-elems").getElementsByTagName("li"); var elems = document.getElementById("touch-elems").getElementsByTagName("li");
for(var i = 0; i < elems.length; i++) { for(var i = 0; i < elems.length; i++) {
elems[i].addEventListener("click", function(e) { elems[i].addEventListener("click", function(e) {
doAction( parseInt(e.target.id) ); doAction( parseInt(e.target.id) );
}, true); }, true);
} }
} else { //is desktop } else { //is desktop
document.getElementById("infoTouchDiv").style.display = "none";
document.getElementById("infoTouchDiv").style.display = "none";
window.addEventListener('keydown', function(e) { window.addEventListener('keydown', function(e) {
doAction(e.keyCode); doAction(e.keyCode);
}, true); }, true);