|
93 | 93 | if ( ! name ) { |
94 | 94 | setText( errorEl, pluginCheckNamer.messages.missingName ); |
95 | 95 | if ( errorEl ) { |
96 | | - errorEl.style.display = 'block'; |
| 96 | + errorEl.classList.remove( 'plugin-check-namer-hidden' ); |
97 | 97 | } |
98 | 98 | return; |
99 | 99 | } |
100 | 100 |
|
101 | 101 | // Clear previous results. |
102 | 102 | if ( resultWrap ) { |
103 | | - resultWrap.style.display = 'none'; |
| 103 | + resultWrap.classList.add( 'plugin-check-namer-hidden' ); |
104 | 104 | } |
105 | 105 | if ( verdictEl ) { |
106 | 106 | setText( verdictEl, '' ); |
|
109 | 109 | setHtml( explainEl, '' ); |
110 | 110 | } |
111 | 111 | if ( errorEl ) { |
112 | | - errorEl.style.display = 'none'; |
| 112 | + errorEl.classList.add( 'plugin-check-namer-hidden' ); |
113 | 113 | setText( errorEl, '' ); |
114 | 114 | } |
115 | 115 |
|
116 | 116 | if ( confusionPluginsDiv ) { |
117 | | - confusionPluginsDiv.style.display = 'none'; |
| 117 | + confusionPluginsDiv.classList.add( 'plugin-check-namer-hidden' ); |
118 | 118 | } |
119 | 119 | if ( confusionPluginsList ) { |
120 | 120 | confusionPluginsList.innerHTML = ''; |
121 | 121 | } |
122 | 122 | if ( confusionOthersDiv ) { |
123 | | - confusionOthersDiv.style.display = 'none'; |
| 123 | + confusionOthersDiv.classList.add( 'plugin-check-namer-hidden' ); |
124 | 124 | } |
125 | 125 | if ( confusionOthersList ) { |
126 | 126 | confusionOthersList.innerHTML = ''; |
127 | 127 | } |
128 | 128 | if ( timingDiv ) { |
129 | | - timingDiv.style.display = 'none'; |
| 129 | + timingDiv.classList.add( 'plugin-check-namer-hidden' ); |
130 | 130 | } |
131 | 131 | if ( timingValue ) { |
132 | 132 | setText( timingValue, '' ); |
133 | 133 | } |
134 | 134 | if ( tokensDiv ) { |
135 | | - tokensDiv.style.display = 'none'; |
| 135 | + tokensDiv.classList.add( 'plugin-check-namer-hidden' ); |
136 | 136 | } |
137 | 137 | if ( tokensValue ) { |
138 | 138 | setText( tokensValue, '' ); |
139 | 139 | } |
140 | 140 | if ( verdictContainer ) { |
141 | | - verdictContainer.style.display = 'none'; |
| 141 | + verdictContainer.classList.add( 'plugin-check-namer-hidden' ); |
142 | 142 | } |
143 | 143 |
|
144 | 144 | // Record start time. |
|
186 | 186 | verdict.indexOf( 'no issues' ) !== -1 |
187 | 187 | ) { |
188 | 188 | borderColor = '#00a32a'; // Green for good. |
| 189 | + } else if ( |
| 190 | + verdict.indexOf( 'generally allowable' ) !== -1 || |
| 191 | + verdict.indexOf( 'allowable' ) !== -1 |
| 192 | + ) { |
| 193 | + borderColor = '#2271b1'; // Blue for generally allowable. |
189 | 194 | } else if ( |
190 | 195 | verdict.indexOf( 'review' ) !== -1 || |
191 | 196 | verdict.indexOf( 'medium' ) !== -1 || |
|
200 | 205 | } |
201 | 206 |
|
202 | 207 | verdictContainer.style.borderLeftColor = borderColor; |
203 | | - verdictContainer.style.display = 'block'; |
| 208 | + verdictContainer.classList.remove( 'plugin-check-namer-hidden' ); |
204 | 209 | } |
205 | 210 |
|
206 | 211 | // Calculate and display elapsed time. |
|
211 | 216 | ); |
212 | 217 | timingValue.textContent = |
213 | 218 | elapsedSeconds + ' ' + 'seconds'; |
214 | | - timingDiv.style.display = 'block'; |
| 219 | + timingDiv.classList.remove( 'plugin-check-namer-hidden' ); |
215 | 220 | } |
216 | 221 |
|
217 | 222 | // Display token usage if available. |
|
259 | 264 | } |
260 | 265 |
|
261 | 266 | tokensValue.textContent = tokensText; |
262 | | - tokensDiv.style.display = 'block'; |
| 267 | + tokensDiv.classList.remove( 'plugin-check-namer-hidden' ); |
263 | 268 | } |
264 | 269 |
|
265 | 270 | // Display confusion_existing_plugins if available. |
|
273 | 278 | payload.data.confusion_existing_plugins.forEach( |
274 | 279 | function ( plugin ) { |
275 | 280 | const div = document.createElement( 'div' ); |
276 | | - div.style.cssText = |
277 | | - 'margin-bottom: 15px; padding: 10px; background: #fff; border-left: 4px solid #2271b1;'; |
| 281 | + div.className = 'plugin-check-namer-confusion-item'; |
278 | 282 | div.innerHTML = |
279 | 283 | '<strong>' + |
280 | 284 | escapeHtml( plugin.name || '' ) + |
281 | 285 | '</strong>' + |
282 | 286 | ( plugin.active_installations |
283 | | - ? ' <span style="color: #646970;">(' + |
| 287 | + ? ' <span class="plugin-check-namer-confusion-meta">(' + |
284 | 288 | escapeHtml( |
285 | 289 | plugin.active_installations |
286 | 290 | ) + |
|
289 | 293 | ')</span>' |
290 | 294 | : '' ) + |
291 | 295 | ( plugin.owner_username |
292 | | - ? ' <span style="color: #646970;"> - ' + |
| 296 | + ? ' <span class="plugin-check-namer-confusion-meta"> - ' + |
293 | 297 | escapeHtml( plugin.owner_username ) + |
294 | 298 | '</span>' |
295 | 299 | : '' ) + |
296 | 300 | '<br>' + |
297 | | - '<span style="color: #646970; font-size: 0.9em;">' + |
| 301 | + '<span class="plugin-check-namer-confusion-text">' + |
298 | 302 | escapeHtml( plugin.explanation || '' ) + |
299 | 303 | '</span>' + |
300 | 304 | ( plugin.link |
|
307 | 311 | confusionPluginsList.appendChild( div ); |
308 | 312 | } |
309 | 313 | ); |
310 | | - confusionPluginsDiv.style.display = 'block'; |
| 314 | + confusionPluginsDiv.classList.remove( 'plugin-check-namer-hidden' ); |
311 | 315 | } else if ( confusionPluginsDiv ) { |
312 | | - confusionPluginsDiv.style.display = 'none'; |
| 316 | + confusionPluginsDiv.classList.add( 'plugin-check-namer-hidden' ); |
313 | 317 | } |
314 | 318 |
|
315 | 319 | // Display confusion_existing_others if available. |
|
323 | 327 | payload.data.confusion_existing_others.forEach( |
324 | 328 | function ( item ) { |
325 | 329 | const div = document.createElement( 'div' ); |
326 | | - div.style.cssText = |
327 | | - 'margin-bottom: 15px; padding: 10px; background: #fff; border-left: 4px solid #dba617;'; |
| 330 | + div.className = 'plugin-check-namer-confusion-item plugin-check-namer-confusion-item-others'; |
328 | 331 | div.innerHTML = |
329 | 332 | '<strong>' + |
330 | 333 | escapeHtml( item.name || '' ) + |
331 | 334 | '</strong>' + |
332 | 335 | '<br>' + |
333 | | - '<span style="color: #646970; font-size: 0.9em;">' + |
| 336 | + '<span class="plugin-check-namer-confusion-text">' + |
334 | 337 | escapeHtml( item.explanation || '' ) + |
335 | 338 | '</span>' + |
336 | 339 | ( item.link |
|
343 | 346 | confusionOthersList.appendChild( div ); |
344 | 347 | } |
345 | 348 | ); |
346 | | - confusionOthersDiv.style.display = 'block'; |
| 349 | + confusionOthersDiv.classList.remove( 'plugin-check-namer-hidden' ); |
347 | 350 | } else if ( confusionOthersDiv ) { |
348 | | - confusionOthersDiv.style.display = 'none'; |
| 351 | + confusionOthersDiv.classList.add( 'plugin-check-namer-hidden' ); |
349 | 352 | } |
350 | 353 |
|
351 | 354 | if ( resultWrap ) { |
352 | | - resultWrap.style.display = 'block'; |
| 355 | + resultWrap.classList.remove( 'plugin-check-namer-hidden' ); |
353 | 356 | } |
354 | 357 | } ) |
355 | 358 | .catch( function ( err ) { |
|
360 | 363 | : pluginCheckNamer.messages.genericError |
361 | 364 | ); |
362 | 365 | if ( errorEl ) { |
363 | | - errorEl.style.display = 'block'; |
| 366 | + errorEl.classList.remove( 'plugin-check-namer-hidden' ); |
364 | 367 | } |
365 | 368 | } ) |
366 | 369 | .finally( function () { |
|
0 commit comments