1 /*jslint 2 browser: true, 3 nomen: false, 4 debug: true, 5 forin: true, 6 undef: true, 7 white: false, 8 onevar: false 9 */ 10 var sc, DOMParser, shortcut; 11 12 /** 13 * this is really a wrapper for shortcut.add in shortcut.js 14 * @param {string} shortcut The shortcut key combination should be specified in this format: Modifier[+Modifier..]+Key 15 * @param {Object} func The function to be called when key is pressed 16 * @param {Object} opts A hash of options 17 * @param {string} [opts.type] The event type - can be 'keydown','keyup','keypress'. Default: 'keydown' 18 * @param {Boolean} [opts.disable_in_input] If this is set to true, keyboard capture will be disabled in input and textarea fields. Default is TRUE 19 * @param {Object} [opts.target] The dom node that should be watched for the keyboard event. Default is the document element 20 * @param {Boolean} [opts.propagate] If the key event should propagate. Default is FALSE 21 * @param {Number} [opts.keycode] Watch for the given keycode 22 * @member sc.helpers 23 */ 24 sc.helpers.key_add = function(keystroke, func, opts) { 25 opts = sch.defaults({ 26 'type':'keydown', 27 'disable_in_input':'true' 28 29 }, opts); 30 31 shortcut.add(keystroke, func, opts); 32 }; 33 34 /** 35 * this is really a wrapper for shortcut.remove in shortcut.js 36 * @member sc.helpers 37 */ 38 sc.helpers.key_remove = function(keystroke) { 39 shortcut.remove(keystroke); 40 }; 41 42 /** 43 * @todo 44 * @member sc.helpers 45 */ 46 sc.helpers.getModKey = function() { 47 // get the primary modkey based on the OS 48 // if OS X, use 'Meta' 49 // if Win or Linux, use 'Ctrl' 50 };