|
19 | 19 |
|
20 | 20 | padding: 8px 12px 8px 12px;
|
21 | 21 |
|
22 |
| - border: none; |
| 22 | + border: solid 1px #222; |
23 | 23 | border-radius: 5px;
|
24 | 24 | margin-right: 5px;
|
25 | 25 |
|
26 | 26 | color: #ffffff;
|
27 | 27 | background-color: #000000;
|
28 | 28 | opacity: 0.5;
|
29 | 29 |
|
30 |
| - font-family: Monospace; |
31 |
| - font-size: 12px; |
32 |
| - font-weight: bold; |
| 30 | + font-family: monospace; |
| 31 | + font-size: 11px; |
33 | 32 |
|
34 | 33 | cursor: pointer;
|
35 | 34 | text-decoration: none;
|
36 | 35 |
|
| 36 | + text-transform: uppercase; |
| 37 | + |
37 | 38 | }
|
38 | 39 |
|
39 | 40 | button:hover, select:hover, a:hover {
|
40 | 41 |
|
41 | 42 | opacity: 1;
|
42 |
| - box-shadow: 0 0 4px #FFF; |
| 43 | + border: solid 1px #FFF; |
43 | 44 |
|
44 | 45 | }
|
45 | 46 |
|
|
137 | 138 | // Greetings to Iq/RGBA! ;)
|
138 | 139 |
|
139 | 140 | var quality = 2, quality_levels = [ 0.5, 1, 2, 4, 8 ];
|
140 |
| - var toolbar, compileButton, fullscreenButton, compileTimer, errorLines = []; |
141 |
| - var code, canvas, gl, buffer, currentProgram, vertexPosition, screenVertexPosition, panButton, timeButton, |
| 141 | + var toolbar, showButton, timeButton, compileButton, panButton, fullscreenButton, compileTimer, errorLines = []; |
| 142 | + var code, canvas, gl, buffer, currentProgram, vertexPosition, screenVertexPosition, |
142 | 143 | parameters = { startTime: Date.now(), time: 0, mouseX: 0.5, mouseY: 0.5, screenWidth: 0, screenHeight: 0 },
|
143 | 144 | surface = { centerX: 0, centerY: 0, width: 1, height: 1, isPanning: false, isZooming: false, lastX: 0, lastY: 0 },
|
144 | 145 | frontTarget, backTarget, screenProgram, getWebGL, resizer = {}, compileOnChangeCode = true;
|
|
194 | 195 | button.href = '/';
|
195 | 196 | rightside.appendChild( button );
|
196 | 197 |
|
197 |
| - var button = document.createElement( 'button' ); |
198 |
| - button.textContent = 'hide code'; |
199 |
| - button.addEventListener( 'click', function ( event ) { |
200 |
| - |
201 |
| - if ( isCodeVisible() ) { |
202 |
| - |
203 |
| - button.textContent = 'show code'; |
204 |
| - code.getWrapperElement().style.display = 'none'; |
205 |
| - compileButton.style.visibility = 'hidden'; |
206 |
| - set_save_button('hidden'); |
207 |
| - set_parent_button('hidden'); |
208 |
| - stopHideUI(); |
209 |
| - |
210 |
| - } else { |
211 |
| - |
212 |
| - button.textContent = 'hide code'; |
213 |
| - code.getWrapperElement().style.display = ''; |
214 |
| - compileButton.style.visibility = 'visible'; |
215 |
| - set_save_button('visible'); |
216 |
| - set_parent_button('visible'); |
| 198 | + showButton = document.createElement( 'button' ); |
| 199 | + showButton.textContent = 'show code'; |
| 200 | + showButton.addEventListener( 'click', function () { |
217 | 201 |
|
218 |
| - } |
| 202 | + isCodeVisible() ? hideCode() : showCode(); |
219 | 203 |
|
220 | 204 | }, false );
|
221 |
| - toolbar.appendChild( button ); |
| 205 | + toolbar.appendChild( showButton ); |
222 | 206 |
|
223 | 207 | timeButton = document.createElement( 'button' );
|
224 | 208 | timeButton.textContent = '0:00.00';
|
|
304 | 288 | }
|
305 | 289 | }
|
306 | 290 | });
|
307 |
| - code.getWrapperElement().style.display = ''; |
308 | 291 |
|
309 | 292 | resizer.offsetMouseX = 0;
|
310 | 293 | resizer.offsetMouseY = 0;
|
|
440 | 423 |
|
441 | 424 | compileScreenProgram();
|
442 | 425 |
|
| 426 | + // show code when is new effect |
| 427 | + |
| 428 | + location.hash === '' ? showCode() : hideCode(); |
| 429 | + |
| 430 | + } |
| 431 | + |
| 432 | + function showCode() { |
| 433 | + |
| 434 | + showButton.textContent = 'hide code'; |
| 435 | + code.getWrapperElement().style.visibility = 'visible'; |
| 436 | + compileButton.style.visibility = 'visible'; |
| 437 | + set_save_button('visible'); |
| 438 | + set_parent_button('visible'); |
| 439 | + |
| 440 | + } |
| 441 | + |
| 442 | + function hideCode() { |
| 443 | + |
| 444 | + showButton.textContent = 'show code'; |
| 445 | + code.getWrapperElement().style.visibility = 'hidden'; |
| 446 | + compileButton.style.visibility = 'hidden'; |
| 447 | + set_save_button('hidden'); |
| 448 | + set_parent_button('hidden'); |
| 449 | + stopHideUI(); |
| 450 | + |
443 | 451 | }
|
444 | 452 |
|
445 | 453 | function isCodeVisible() {
|
446 |
| - return code && code.getWrapperElement().style.display !== 'none'; |
| 454 | + |
| 455 | + return code && code.getWrapperElement().style.visibility === 'visible'; |
| 456 | + |
447 | 457 | }
|
448 | 458 |
|
449 | 459 | var hideUITimer;
|
|
558 | 568 |
|
559 | 569 | if ( !gl.getProgramParameter( program, gl.LINK_STATUS ) ) {
|
560 | 570 |
|
| 571 | + showCode(); |
| 572 | + |
561 | 573 | var error = gl.getProgramInfoLog( program );
|
562 | 574 |
|
563 | 575 | compileButton.title = error;
|
|
632 | 644 |
|
633 | 645 | if ( !gl.getProgramParameter( program, gl.LINK_STATUS ) ) {
|
634 | 646 |
|
| 647 | + showCode(); |
| 648 | + |
635 | 649 | console.error( 'VALIDATE_STATUS: ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ), 'ERROR: ' + gl.getError() );
|
636 | 650 |
|
637 | 651 | return;
|
|
748 | 762 |
|
749 | 763 | if ( !gl.getShaderParameter( shader, gl.COMPILE_STATUS ) ) {
|
750 | 764 |
|
| 765 | + showCode(); |
| 766 | + |
751 | 767 | var error = gl.getShaderInfoLog( shader );
|
752 | 768 |
|
753 | 769 | // Remove trailing linefeed, for FireFox's benefit.
|
|
0 commit comments