Last active
December 17, 2015 06:08
-
-
Save DKunin/5562788 to your computer and use it in GitHub Desktop.
Arrows and wheels capture for some stuff on the page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('keydown',function(e){ | |
document.passTime = setTimeout(function(){passMatch=""},2000); | |
var passWord = 'IDDQD'; | |
var keys = { | |
73:"I", | |
68:"D", | |
81:"Q" | |
}; | |
if(e.keyCode===73||e.keyCode===68||e.keyCode===81||e.keyCode===40){ | |
passMatch+= keys[e.keyCode]; | |
} | |
if(passMatch===passWord) { | |
adjustStuff(); | |
}; | |
if(passWord.indexOf(passMatch)===-1) { | |
passMatch = ""; | |
} | |
}) | |
function adjustStuff(){ | |
$(document).on('keydown',function(e){ | |
var curRegion = $('.map-navigation-wrapper .map-navigation-item.active'); | |
var curRegionId = curRegion.data().id; | |
var curObj = _.find(regionsData,function(o){return o.id===parseInt(curRegionId)}) | |
if(e.keyCode===13) { | |
console.log(startingData); | |
} | |
if(e.keyCode===37||e.keyCode===38||e.keyCode===39||e.keyCode===40){ | |
if(e.keyCode===37) { | |
curObj.offsetLeft--; | |
} | |
if(e.keyCode===39) { | |
curObj.offsetLeft++; | |
} | |
if(e.keyCode===38) { | |
curObj.offsetTop--; | |
} | |
if(e.keyCode===40) { | |
curObj.offsetTop++; | |
} | |
} | |
if(e.keyCode===107||e.keyCode===109){ | |
if(e.keyCode===107) { | |
curObj.scale = curObj.scale+0.01; | |
} | |
if(e.keyCode===109) { | |
curObj.scale = curObj.scale-0.01; | |
} | |
} | |
if(e.keyCode===37||e.keyCode===38||e.keyCode===39||e.keyCode===40||e.keyCode===107||e.keyCode===109){ | |
curRegion.find('.info').click() | |
console.log(curObj); | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment