11var keyboard = ( function ( ) {
22
3- var _bind = function ( ) {
3+ var bind = { } ;
4+
5+ bind . esc = function ( ) {
46window . addEventListener ( "keydown" , function ( event ) {
57// esc
68if ( event . keyCode == 27 ) {
@@ -25,26 +27,46 @@ var keyboard = (function(){
2527} ;
2628data . save ( ) ;
2729} ;
30+ } , false ) ;
31+ } ;
32+
33+ bind . ctrAltA = function ( ) {
34+ window . addEventListener ( "keydown" , function ( event ) {
2835// ctrl+alt+a
2936if ( event . ctrlKey && event . altKey && event . keyCode == 65 ) {
3037if ( state . get ( ) . link . show ) {
3138menu . close ( ) ;
3239link . add ( ) ;
3340} ;
3441} ;
42+ } , false ) ;
43+ } ;
44+
45+ bind . ctrAltD = function ( ) {
46+ window . addEventListener ( "keydown" , function ( event ) {
3547// ctrl+alt+d
3648if ( event . ctrlKey && event . altKey && event . keyCode == 68 ) {
3749theme . toggle ( ) ;
3850theme . render . theme ( ) ;
3951control . update ( ) ;
4052data . save ( ) ;
4153} ;
54+ } , false ) ;
55+ } ;
56+
57+ bind . ctrAltM = function ( ) {
58+ window . addEventListener ( "keydown" , function ( event ) {
4259// ctrl+alt+m
4360if ( event . ctrlKey && event . altKey && event . keyCode == 77 ) {
4461shade . destroy ( ) ;
4562modal . destroy ( ) ;
4663menu . toggle ( ) ;
4764} ;
65+ } , false ) ;
66+ } ;
67+
68+ bind . ctrAltE = function ( ) {
69+ window . addEventListener ( "keydown" , function ( event ) {
4870// ctrl+alt+e
4971if ( event . ctrlKey && event . altKey && event . keyCode == 69 ) {
5072if ( state . get ( ) . link . show && bookmarks . get ( ) . length > 0 ) {
@@ -66,10 +88,15 @@ var keyboard = (function(){
6688data . save ( ) ;
6789} ;
6890} ;
91+ } , false ) ;
92+ } ;
93+
94+ bind . ctrAltR = function ( ) {
95+ window . addEventListener ( "keydown" , function ( event ) {
6996// ctrl+alt+r
7097if ( state . get ( ) . theme . accent . random . active && event . ctrlKey && event . altKey && event . keyCode == 82 ) {
71- accent . random ( ) ;
72- accent . render ( ) ;
98+ theme . render . accent . random ( ) ;
99+ theme . render . accent . color ( ) ;
73100link . clear ( ) ;
74101link . render . item . all ( ) ;
75102sortable ( ".link-area" ) ;
@@ -79,11 +106,17 @@ var keyboard = (function(){
79106} ;
80107
81108var init = function ( ) {
82- _bind ( ) ;
109+ bind . esc ( ) ;
110+ bind . ctrAltA ( ) ;
111+ bind . ctrAltD ( ) ;
112+ bind . ctrAltM ( ) ;
113+ bind . ctrAltE ( ) ;
114+ bind . ctrAltR ( ) ;
83115} ;
84116
85117return {
86- init : init
118+ init : init ,
119+ bind : bind
87120} ;
88121
89122} ) ( ) ;
0 commit comments