[팁] 핫키 소스
2017.06.29 09:20
95
0
https://eond.com/391158
object(HotopayModel)#862 (23) { ["error"]=> int(0) ["message"]=> string(7) "success" ["variables"]=> array(0) { } ["httpStatusCode"]=> int(200) ["module"]=> string(7) "hotopay" ["module_info"]=> NULL ["origin_module_info"]=> NULL ["module_config"]=> NULL ["module_path"]=> string(52) "/home/eond/web/eond.com/public_html/modules/hotopay/" ["xml_info"]=> NULL ["module_srl"]=> NULL ["mid"]=> NULL ["act"]=> NULL ["template_path"]=> NULL ["template_file"]=> NULL ["layout_path"]=> NULL ["layout_file"]=> NULL ["edited_layout_file"]=> NULL ["stop_proc"]=> bool(false) ["user"]=> object(Rhymix\Framework\Helpers\SessionHelper)#861 (20) { ["member_srl"]=> int(0) ["user_id"]=> NULL ["user_name"]=> NULL ["nick_name"]=> NULL ["email_address"]=> NULL ["phone_number"]=> NULL ["homepage"]=> NULL ["blog"]=> NULL ["birthday"]=> NULL ["denied"]=> NULL ["status"]=> NULL ["is_admin"]=> string(1) "N" ["is_site_admin"]=> NULL ["profile_image"]=> NULL ["image_name"]=> NULL ["image_mark"]=> NULL ["signature"]=> NULL ["description"]=> NULL ["group_list"]=> array(0) { } ["menu_list"]=> array(0) { } } ["request"]=> object(Rhymix\Framework\Request)#10 (13) { ["method"]=> string(3) "GET" ["compat_method"]=> string(3) "GET" ["url"]=> string(32) "javascript/391158/comment/464616" ["hostname"]=> string(8) "eond.com" ["domain"]=> NULL ["protocol"]=> string(5) "https" ["callback_function"]=> string(0) "" ["_route_status":protected]=> int(200) ["_route_options":protected]=> object(stdClass)#11 (5) { ["cache_control"]=> bool(true) ["check_csrf"]=> bool(true) ["is_forwarded"]=> bool(false) ["is_indexable"]=> bool(true) ["enable_session"]=> bool(true) } ["module"]=> string(5) "board" ["mid"]=> string(10) "javascript" ["act"]=> string(16) "dispBoardContent" ["args"]=> array(5) { ["category"]=> string(6) "360820" ["document_srl"]=> string(6) "391158" ["comment_srl"]=> string(6) "464616" ["mid"]=> string(10) "javascript" ["act"]=> string(16) "dispBoardContent" } } ["ajaxRequestMethod"]=> array(2) { [0]=> string(6) "XMLRPC" [1]=> string(4) "JSON" } ["gzhandler_enable"]=> bool(true) }

XE 레이아웃 혹은 XE 애드온에 삽입 가능한 핫키 소스입니다.

hotkey.js

function checkHotkey(){
  if ( (event.srcElement.tagName != 'INPUT') && (event.srcElement.tagName != 'TEXTAREA') && (event.srcElement.getAttribute('contenteditable') != 'true') ){
    if ( (event.keyCode=='48') || (event.keyCode=='101') ) location.replace('/eond'); /* e, 0 */
 if ( (event.keyCode=='49') || (event.keyCode=='119') )location.replace('/web'); /* w, 1 */
 if (event.keyCode=='50' || event.keyCode=='100') location.replace('/webmal'); /* d, 2 */
 if (event.keyCode=='51' || event.keyCode=='99') location.replace('/community'); /* c, 3 */
 if (event.keyCode=='52' || event.keyCode=='108') location.replace('/look'); /* l, 4 */
 if ( (event.keyCode=='53') || (event.keyCode=='114') ) location.replace('/rosso'); /* r, 5 */
 if ( (event.keyCode=='54') || (event.keyCode=='115') ) location.replace('/is'); /* s, 6 */
 if (event.keyCode=='55' || event.keyCode=='110') location.replace('/mynote'); /* n, 7 */
 if (event.keyCode=='56' || event.keyCode=='102') location.replace('/likefirst'); /* f, 8 */
 if (event.keyCode=='57' || event.keyCode=='104') location.replace('/hera'); /* h, 9 */
 if (event.keyCode=='121') location.replace('/yncare'); /* y */
 }
}
document.onkeypress=checkHotkey;
// jQuery(document).not('input, textarea, [contenteditable=true]').keypress(checkHotkey);


input이나 textarea, 그리고 엘리먼트에 요소 중 contenteditable이 true가 아닌 경우에

keycode를 입력할 경우 원하는 페이지로 이동하는 소스입니다.

document.onkeypress=checkHotkey;

아무 키를 누르며녀 checkHotkey 펑션이 동작을 하게 됩니다.


라르게덴님이 제이쿼리로 알려주신 부분은 아래 주석으로 처리된 부분입니다.

input, textarea, 요소 중 contenteditable=true가 아닌 경우에 keypress (키를 누르는 동작)을 하면 checkHotkey가 동작이 됩니다.


참조 : https://github.com/madrobby/keymaster/issues/45



라이믹스는 이온디와 함께

닫기

마이페이지

로그인을 해주세요

네이버로 로그인