| | var copyButton = document.getElementById( 'copy-button' ); |
| | |
| | -copyButton.addEventListener( 'click', function( event ) { |
| | - var output = document.getElementById( 'output' ); |
| | - var oldClass = output.className; |
| | +if( copyButton ) { |
| | + copyButton.addEventListener( 'click', function( event ) { |
| | + var output = document.getElementById( 'output' ); |
| | + var oldClass = output.className; |
| | |
| | - output.className = 'newlines'; |
| | - var text = output.innerText || output.textContent; |
| | - setClipboard( text ); |
| | + output.className = 'newlines'; |
| | + var text = output.innerText || output.textContent; |
| | + setClipboard( text ); |
| | |
| | - output.className = oldClass; |
| | -}); |
| | + output.className = oldClass; |
| | + }); |
| | +} |
| | |
| | var sampleButton = document.getElementById( 'sample-button' ); |
| | |
| | -sampleButton.addEventListener( 'click', function( event ) { |
| | - var source = document.getElementById( 'source' ); |
| | - source.value = "''E's got a 'ittle box 'n a big 'un,' she said, 'wit' th' 'ittle 'un 'bout 2'×6\". An' no, y'ain't cryin' on th' \"soap box\" to me no mo, y'hear. 'Cause it 'tweren't ever a spec o' fun!' I says to my frien'."; |
| | -}); |
| | +if( sampleButton ) { |
| | + sampleButton.addEventListener( 'click', function( event ) { |
| | + var source = document.getElementById( 'source' ); |
| | + source.value = "''E's got a 'ittle box 'n a big 'un,' she said, 'wit' th' 'ittle 'un 'bout 2'×6\". An' no, y'ain't cryin' on th' \"soap box\" to me no mo, y'hear. 'Cause it 'tweren't ever a spec o' fun!' I says to my frien'."; |
| | + }); |
| | +} |
| | </script> |
| | </body> |