Created
June 6, 2012 17:40
-
-
Save AntoineAugusti/2883491 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Keyboard shortcuts | |
var isG = false; | |
var peutFaireAction = true; | |
$(document).ready(function() | |
{ | |
$("input").focus(function(){ | |
peutFaireAction = false; | |
}); | |
$("input").mouseover(function(){ | |
peutFaireAction = false; | |
}).mouseout(function(){ | |
peutFaireAction = true; | |
}); | |
$("textarea").focus(function(){ | |
peutFaireAction = false; | |
}); | |
$("textarea").mouseover(function(){ | |
peutFaireAction = false; | |
}).mouseout(function(){ | |
peutFaireAction = true; | |
}); | |
}); | |
$(document).keyup(function (e) | |
{ | |
isG = false; | |
}).keydown(function (e) | |
{ | |
if(e.which == 71) | |
{ | |
isG = true; | |
} | |
else | |
{ | |
isG = false; | |
} | |
if (peutFaireAction == true && isG == true) | |
{ | |
var key = e.which; | |
switch (key) | |
{ | |
// G + Q | |
case 81: | |
window.location.href = "../admin"; | |
return false; | |
break; | |
// G + A | |
case 65: | |
window.location.href = "../addquote"; | |
return false; | |
break; | |
// G + E | |
case 69: | |
window.location.href = "../editprofile"; | |
return false; | |
break; | |
// G + H | |
case 72: | |
window.location.href = "../"; | |
return false; | |
break; | |
// G + R | |
case 82: | |
window.location.href = "../random"; | |
return false; | |
break; | |
// G + P | |
case 80: | |
window.location.href = "../profile"; | |
return false; | |
break; | |
// G + M | |
case 77: | |
window.location.href = "../members"; | |
return false; | |
break; | |
// G + L | |
case 76: | |
window.location.href = "../?deconnexion"; | |
return false; | |
break; | |
// G + T | |
case 84: | |
window.location.href = "http://teen-quotes.com"; | |
return false; | |
break; | |
// G + K | |
case 75: | |
window.location.href = "http://kotado.fr"; | |
return false; | |
break; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment