| @@ -22,9 +22,9 @@ | ||
| 22 | 22 | |
| 23 | 23 | /* Remove the editor, if its already been moved */ |
| 24 | 24 | t.removeEditor(); |
| 25 | 25 | |
| 26 | - /* Bail to avoid errors */ | |
| 26 | + /* Allow click to go through */ | |
| 27 | 27 | if ( ! reply || ! respond || ! cancel || ! parent ) { |
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | |
| @@ -54,9 +54,9 @@ | ||
| 54 | 54 | /* Add the editor where it now belongs */ |
| 55 | 55 | t.addEditor(); |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * When canceling a Reply. | |
| 58 | + * When cancelling a Reply. | |
| 59 | 59 | * |
| 60 | 60 | * @since 2.6.2 |
| 61 | 61 | * @returns {void} |
| 62 | 62 | */ |
| @@ -117,9 +117,9 @@ | ||
| 117 | 117 | form = t.getElement( 'new-post' ), |
| 118 | 118 | elemRect = form.getBoundingClientRect(), |
| 119 | 119 | position = (window.pageYOffset || document.scrollTop) - (document.clientTop || 0), |
| 120 | 120 | destination = ( position + elemRect.top ), |
| 121 | - negative = ( destination < position ), | |
| 121 | + negative = ( destination < position ), // jshint ignore:line | |
| 122 | 122 | adminbar = t.getElement( 'wpadminbar'), |
| 123 | 123 | offset = 0, |
| 124 | 124 | distance = 0; |
| 125 | 125 | |
| @@ -128,9 +128,12 @@ | ||
| 128 | 128 | offset = adminbar.scrollHeight; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /* Compute the difference, depending on direction */ |
| 132 | - distance = true === negative ? ( position - destination ) : ( destination - position ); | |
| 132 | + /* jshint ignore:start */ | |
| 133 | + distance = ( true === negative ) | |
| 134 | + ? ( position - destination ) | |
| 135 | + : ( destination - position ); | |
| 133 | 136 | |
| 134 | 137 | /* Do some math to compute the animation steps */ |
| 135 | 138 | var vast = ( distance > 800 ), |
| 136 | 139 | speed_step = vast ? 30 : 20, |
| @@ -138,12 +141,8 @@ | ||
| 138 | 141 | step = Math.round( distance / speed_step ), |
| 139 | 142 | steps = [], |
| 140 | 143 | timer = 0; |
| 141 | 144 | |
| 142 | - function scrollStep() { | |
| 143 | - window.scrollTo( 0, steps.shift() ); | |
| 144 | - } | |
| 145 | - | |
| 146 | 145 | /* Scroll up */ |
| 147 | 146 | if ( true === negative ) { |
| 148 | 147 | while ( position > destination ) { |
| 149 | 148 | position -= step; |
| @@ -153,9 +152,11 @@ | ||
| 153 | 152 | } |
| 154 | 153 | |
| 155 | 154 | steps.push( position - offset ); |
| 156 | 155 | |
| 157 | - setTimeout( scrollStep, timer * speed ); | |
| 156 | + setTimeout( function() { | |
| 157 | + window.scrollTo( 0, steps.shift() ); | |
| 158 | + }, timer * speed ); | |
| 158 | 159 | |
| 159 | 160 | timer++; |
| 160 | 161 | } |
| 161 | 162 | |
| @@ -169,13 +170,16 @@ | ||
| 169 | 170 | } |
| 170 | 171 | |
| 171 | 172 | steps.push( position - offset ); |
| 172 | 173 | |
| 173 | - setTimeout( scrollStep, timer * speed ); | |
| 174 | + setTimeout( function() { | |
| 175 | + window.scrollTo( 0, steps.shift() ); | |
| 176 | + }, timer * speed ); | |
| 174 | 177 | |
| 175 | 178 | timer++; |
| 176 | 179 | } |
| 177 | 180 | } |
| 181 | + /* jshint ignore:end */ | |
| 178 | 182 | }, |
| 179 | 183 | |
| 180 | 184 | /** |
| 181 | 185 | * Get an element by ID |