Created
April 7, 2015 05:26
-
-
Save johnko/8f70b27006ce0a4b40fc 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
var keymap = { | |
'0': 48, | |
'1': 49, | |
'2': 50, | |
'3': 51, | |
'4': 52, | |
'5': 53, | |
'6': 54, | |
'7': 55, | |
'8': 56, | |
'9': 57, | |
'a': 65, | |
'b': 66, | |
'c': 67, | |
'd': 68, | |
'e': 69, | |
'f': 70, | |
'g': 71, | |
'h': 72, | |
'i': 73, | |
'j': 74, | |
'k': 75, | |
'l': 76, | |
'm': 77, | |
'n': 78, | |
'o': 79, | |
'p': 80, | |
'q': 81, | |
'r': 82, | |
's': 83, | |
't': 84, | |
'u': 85, | |
'v': 86, | |
'w': 87, | |
'x': 88, | |
'y': 89, | |
'z': 90, | |
'backtick': 192, | |
'backspace': 8, | |
'tab': 9, | |
'capslock': 20, | |
'shift': 16, | |
'ctrl': 17, | |
'alt': 18, | |
'brand': 91, | |
'context': 0, | |
'enter': 13, | |
'minus': 189, | |
'equals': 187, | |
'squareopen': 219, | |
'squareclose': 221, | |
'slashback': 220, | |
'slashfwd': 191, | |
'semicolon': 186, | |
'singlequote': 222, | |
'comma': 188, | |
'period': 190, | |
'escape': 27, | |
'f1': 112, | |
'f2': 113, | |
'f3': 114, | |
'f4': 115, | |
'f5': 116, | |
'f6': 117, | |
'f7': 118, | |
'f8': 119, | |
'f9': 120, | |
'f10': 121, | |
'f11': 122, | |
'f12': 123, | |
'prtscr': 124, | |
'delete': 46, | |
'home': 36, | |
'end': 35, | |
'pgup': 33, | |
'pgdown': 34, | |
}; | |
var audiourl='https://192.168.255.122/api/get/4f09cc972c280a37781b10782b507be6878a5564443eea52ce2f3724884b9abab2c2d8bbe3fedf217d77423ffaac1355148b721e5f01df48678a3248d9e26768'; | |
$('#addtaginput').on('click',function(e){$('h2.page-header').empty();$('h2.page-header').html('<img src="'+audiourl.replace('/get/','/raw/')+'"/><audio id="mplayer" controls autoplay><source src="'+audiourl.replace('/get/','/raw/')+'"/></audio>');}); | |
$('#addtaginput').on('keydown',function(e){ | |
switch (event.which) { | |
case keymap['1']: | |
$('#mplayer').get(0).currentTime = 0; | |
break; | |
case keymap['2']: | |
$('#mplayer').get(0).currentTime = 2; | |
break; | |
case keymap['brand']: | |
$('#mplayer').get(0).currentTime = 10; | |
break; | |
} | |
$('#addtaginput').val(''); | |
console.log(event.type + ': ' + event.which); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment