File tree Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,30 @@ app.run(function(
137
137
}
138
138
} ) ;
139
139
140
+ hotkeys . add ( {
141
+ combo : [ 'mod+0' ] ,
142
+ description : 'Reset Window Scale to 1' ,
143
+ callback : function ( ) {
144
+ userConfig . scaleWindow ( "reset" ) ;
145
+ }
146
+ } ) ;
147
+
148
+ hotkeys . add ( {
149
+ combo : [ 'mod+=' , 'mod++' ] ,
150
+ description : 'Zoom in +0.1' ,
151
+ callback : function ( ) {
152
+ userConfig . scaleWindow ( "plus" ) ;
153
+ }
154
+ } ) ;
155
+
156
+ hotkeys . add ( {
157
+ combo : [ 'mod+-' ] ,
158
+ description : 'Zoom out -0.1' ,
159
+ callback : function ( ) {
160
+ userConfig . scaleWindow ( "minus" ) ;
161
+ }
162
+ } ) ;
163
+
140
164
} ) ;
141
165
142
166
angular . module ( 'infinite-scroll' ) . value ( 'THROTTLE_MILLISECONDS' , 200 ) ;
Original file line number Diff line number Diff line change 3
3
// Initialize modules
4
4
authentication . init ( ) ;
5
5
userConfig . windowState ( ) ;
6
+ userConfig . scaleState ( ) ;
6
7
guiConfig . init ( ) ;
Original file line number Diff line number Diff line change @@ -49,4 +49,38 @@ userConfig.saveWindow = function(width, height) {
49
49
window . localStorage . width = Math . round ( width ) ;
50
50
window . localStorage . height = Math . round ( height ) ;
51
51
}
52
- } ;
52
+ } ;
53
+
54
+ userConfig . scaleWindow = function ( scale ) {
55
+ if ( "plus" === scale ) {
56
+ var currentScale = window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom ;
57
+ var newScale = ( currentScale * 100 + 10 ) ;
58
+
59
+ window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom = newScale / 100 ;
60
+
61
+ userConfig . saveScale ( window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom ) ;
62
+ }
63
+ if ( "minus" === scale ) {
64
+ var currentScale = window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom ;
65
+ var newScale = newScale = ( currentScale - .1 ) ;
66
+
67
+ window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom = newScale ;
68
+
69
+ userConfig . saveScale ( window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom ) ;
70
+ }
71
+ if ( "reset" === scale ) {
72
+ window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom = 1 ;
73
+
74
+ userConfig . saveScale ( window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom ) ;
75
+ }
76
+ } ;
77
+
78
+ userConfig . saveScale = function ( scale ) {
79
+ window . localStorage . scale = scale ;
80
+ } ;
81
+
82
+ userConfig . scaleState = function ( ) {
83
+ if ( window . localStorage . scale ) {
84
+ window . document . getElementsByTagName ( "body" ) [ 0 ] . style . zoom = window . localStorage . scale ;
85
+ }
86
+ } ;
You can’t perform that action at this time.
0 commit comments