@@ -27,8 +27,8 @@ if (!document.getElementById('__ga_grayLayout__')) {
2727 } ) ;
2828}
2929
30- sessionStorage . captureBoxPositionLeft = 0 ;
31- sessionStorage . captureBoxPositionTop = 0 ;
30+ sessionStorage . setItem ( ' captureBoxPositionLeft' , '0' ) ;
31+ sessionStorage . setItem ( ' captureBoxPositionTop' , '0' ) ;
3232
3333function showGrayLayout ( passphrase : string ) {
3434 let grayLayout = document . getElementById ( '__ga_grayLayout__' ) ;
@@ -67,8 +67,8 @@ function grayLayoutDown(event: MouseEvent) {
6767 return ;
6868 }
6969
70- sessionStorage . captureBoxPositionLeft = event . clientX ;
71- sessionStorage . captureBoxPositionTop = event . clientY ;
70+ sessionStorage . setItem ( ' captureBoxPositionLeft' , event . clientX . toString ( ) ) ;
71+ sessionStorage . setItem ( ' captureBoxPositionTop' , event . clientY . toString ( ) ) ;
7272 captureBox . style . left = event . clientX + 'px' ;
7373 captureBox . style . top = event . clientY + 'px' ;
7474 captureBox . style . width = '1px' ;
@@ -87,14 +87,20 @@ function grayLayoutMove(event: MouseEvent) {
8787 return ;
8888 }
8989
90- const captureBoxLeft =
91- Math . min ( sessionStorage . captureBoxPositionLeft , event . clientX ) ;
92- const captureBoxTop =
93- Math . min ( sessionStorage . captureBoxPositionTop , event . clientY ) ;
90+ const captureBoxLeft = Math . min (
91+ Number ( sessionStorage . getItem ( ' captureBoxPositionLeft' ) ) , event . clientX ) ;
92+ const captureBoxTop = Math . min (
93+ Number ( sessionStorage . getItem ( ' captureBoxPositionTop' ) ) , event . clientY ) ;
9494 const captureBoxWidth =
95- Math . abs ( sessionStorage . captureBoxPositionLeft - event . clientX ) - 1 ;
95+ Math . abs (
96+ Number ( sessionStorage . getItem ( 'captureBoxPositionLeft' ) ) -
97+ event . clientX ) -
98+ 1 ;
9699 const captureBoxHeight =
97- Math . abs ( sessionStorage . captureBoxPositionTop - event . clientY ) - 1 ;
100+ Math . abs (
101+ Number ( sessionStorage . getItem ( 'captureBoxPositionTop' ) ) -
102+ event . clientY ) -
103+ 1 ;
98104 captureBox . style . left = captureBoxLeft + 'px' ;
99105 captureBox . style . top = captureBoxTop + 'px' ;
100106 captureBox . style . width = captureBoxWidth + 'px' ;
@@ -120,13 +126,25 @@ function grayLayoutUp(event: MouseEvent, passphrase: string) {
120126 }
121127
122128 const captureBoxLeft =
123- Math . min ( sessionStorage . captureBoxPositionLeft , event . clientX ) + 1 ;
129+ Math . min (
130+ Number ( sessionStorage . getItem ( 'captureBoxPositionLeft' ) ) ,
131+ event . clientX ) +
132+ 1 ;
124133 const captureBoxTop =
125- Math . min ( sessionStorage . captureBoxPositionTop , event . clientY ) + 1 ;
134+ Math . min (
135+ Number ( sessionStorage . getItem ( 'captureBoxPositionTop' ) ) ,
136+ event . clientY ) +
137+ 1 ;
126138 const captureBoxWidth =
127- Math . abs ( sessionStorage . captureBoxPositionLeft - event . clientX ) - 1 ;
139+ Math . abs (
140+ Number ( sessionStorage . getItem ( 'captureBoxPositionLeft' ) ) -
141+ event . clientX ) -
142+ 1 ;
128143 const captureBoxHeight =
129- Math . abs ( sessionStorage . captureBoxPositionTop - event . clientY ) - 1 ;
144+ Math . abs (
145+ Number ( sessionStorage . getItem ( 'captureBoxPositionTop' ) ) -
146+ event . clientY ) -
147+ 1 ;
130148
131149 // make sure captureBox and grayLayout is hidden
132150 setTimeout ( ( ) => {
@@ -168,7 +186,8 @@ function pasteCode(code: string) {
168186 const _inputBoxes = document . getElementsByTagName ( 'input' ) ;
169187 const inputBoxes : HTMLInputElement [ ] = [ ] ;
170188 for ( let i = 0 ; i < _inputBoxes . length ; i ++ ) {
171- if ( _inputBoxes [ i ] . type === 'text' || _inputBoxes [ i ] . type === 'number' ) {
189+ if ( _inputBoxes [ i ] . type === 'text' || _inputBoxes [ i ] . type === 'number' ||
190+ _inputBoxes [ i ] . type === 'tel' ) {
172191 inputBoxes . push ( _inputBoxes [ i ] ) ;
173192 }
174193 }
0 commit comments