@@ -7,12 +7,19 @@ var s = Object.assign({
77 fullscreen :true ,
88 buzz : true ,
99 colortext : true ,
10+ keepunlocked : false ,
1011} , require ( 'Storage' ) . readJSON ( "counter2.json" , true ) || { } ) ;
1112
1213var sGlob = Object . assign ( {
1314 timeout : 10 ,
1415} , require ( 'Storage' ) . readJSON ( "setting.json" , true ) || { } ) ;
1516
17+ const lockTimeout = s . keepunlocked ? 0 : 1000 ;
18+ if ( s . keepunlocked ) {
19+ Bangle . setOptions ( { lockTimeout} ) ;
20+ Bangle . setLocked ( false ) ;
21+ }
22+
1623const f1 = ( s . colortext ) ? "#f00" : "#fff" ;
1724const f2 = ( s . colortext ) ? "#00f" : "#fff" ;
1825const b1 = ( s . colortext ) ? g . theme . bg : "#f00" ;
@@ -80,7 +87,7 @@ function updateScreen() {
8087Bangle . on ( 'lock' , e => {
8188 drag = undefined ;
8289 var timeOutTimer = sGlob . timeout * 1000 ;
83- Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout : timeOutTimer } ) ;
90+ Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout} ) ;
8491 if ( dragtimeout ) clearTimeout ( dragtimeout ) ;
8592 fastupdateoccurring = false ;
8693} ) ;
@@ -102,7 +109,7 @@ Bangle.on("drag", e => {
102109 drag = undefined ;
103110 if ( dragtimeout ) {
104111 let timeOutTimer = 1000 ;
105- Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout : timeOutTimer } ) ;
112+ Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout} ) ;
106113 clearTimeout ( dragtimeout ) ;
107114 }
108115 fastupdateoccurring = false ;
@@ -134,7 +141,7 @@ function resetcounter(which) {
134141 fastupdateoccurring = false ;
135142 if ( dragtimeout ) {
136143 let timeOutTimer = 1000 ;
137- Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout : timeOutTimer } ) ;
144+ Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout} ) ;
138145 clearTimeout ( dragtimeout ) ;
139146 }
140147 if ( which == null ) {
@@ -152,7 +159,6 @@ function resetcounter(which) {
152159 ignoreonce = true ;
153160}
154161
155-
156162updateScreen ( ) ;
157163
158164setWatch ( function ( ) {
@@ -163,6 +169,6 @@ setWatch(function() {
163169 }
164170 }
165171 var timeOutTimer = sGlob . timeout * 1000 ;
166- Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout : timeOutTimer } ) ;
172+ Bangle . setOptions ( { backlightTimeout : timeOutTimer , lockTimeout} ) ;
167173 load ( ) ;
168174} , BTN1 , { repeat :true , edge :"falling" } ) ;
0 commit comments