Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: heisenbuggers/game-off-2012
base: d79c67a542
...
head fork: heisenbuggers/game-off-2012
compare: 4afa99b0b6
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 35 additions and 1 deletion.
  1. +33 −0 static/script.js
  2. +1 −0  static/style.css
  3. +1 −1  views/index.ejs
33 static/script.js
View
@@ -92,6 +92,7 @@ $( function() {
},250);
});
+/*
$("#answer").keypress(function(e) {
$(this).css("background", "#000");
if(e.which >=32 && e.which <=126 && !e.ctrlKey && !e.altKey) //printable chars
@@ -108,4 +109,36 @@ $( function() {
socket.emit('answer', this.value.toLowerCase());
}
}).focus();
+*/
+//mouse drag
+ var flag=0;
+ var x="";
+ var y="";
+ var element = document.getElementById("question");
+ element.addEventListener("mousedown",function(){
+ flag=1;
+ return false;
+ });
+ element.addEventListener("mousemove",function(e){
+ var t = e.target.innerText;
+ var posx = e.offsetX;
+ var posy = e.offsetY;
+ if(flag==1 && (((30-posx)*(30-posx))+((30-posy)*(30-posy))) <= 900){
+ if(y!=t){
+ $(e.target).css("background","#fff");
+ x += t;
+ y=t;
+ }
+ return false;
+ }
+ });
+ element.addEventListener("mouseup",function(){
+ flag=0;
+ $(".qid").animate({backgroundColor : "#ccc"},750);
+ socket.emit('answer', x.toLowerCase());
+ $("#answer").val(x);
+ x="";
+ y="";
+ return false;
+ });
});
1  static/style.css
View
@@ -53,6 +53,7 @@ body {
border: solid 1px #fff;
border-top: 0;
border-left: 0;
+ cursor : pointer;
}
#answer {
2  views/index.ejs
View
@@ -10,7 +10,7 @@
<div id="question">
</div>
</div>
- <input type="text" id="answer" />
+ <input type="text" id="answer" disabled="disabled"/>
</div>
<div class="right circularbg">
<div id="queueContainer">

No commit comments for this range

Something went wrong with that request. Please try again.