|
14 | 14 | <h1>Looper</h1>
|
15 | 15 | <h2>A tool to create looperinos · <a href="https://github.com/spite/looper" >GitHub</a> | <b>Chrome and Safari Tech Preview only</b></h2>
|
16 | 16 | <div class="recordPanel">
|
17 |
| - <a href="#" class="btn orange" id="start">Record</a> |
18 |
| - </div> |
19 |
| - |
20 |
| - <div> |
21 |
| - <button class="btn back" style="margin-right: 4px" onclick="back()" >Before</button> |
22 |
| - <button class="btn next" onclick="next()" >Next</button> |
| 17 | + <a href="#" class="btn orange" id="start">⚫ Record</a> |
| 18 | + <a href="#" id="backButton" class="btn green">◀ Previous</a> |
| 19 | + <a href="#" id="nextButton" class="btn green">Next ▶</a> |
23 | 20 | </div>
|
24 | 21 | </header>
|
25 |
| - |
26 | 22 | <script>
|
27 |
| - function getIndex() { |
28 |
| - return parseInt(window.location.hash.replace('#', '')); |
29 |
| - } |
30 |
| - function back() { |
31 |
| - let index = getIndex(); |
| 23 | + function getIndex() { |
| 24 | + return parseInt(window.location.hash.replace('#', '')); |
| 25 | + } |
| 26 | + |
| 27 | + function prev(e) { |
| 28 | + let index = getIndex(); |
| 29 | + |
| 30 | + // beginning, dont do anything |
| 31 | + if (index === 1) return; |
| 32 | + window.location.hash = `${--index}`; |
| 33 | + e.preventDefault(); |
| 34 | + } |
| 35 | + |
| 36 | + function next(e) { |
| 37 | + let index = getIndex(); |
| 38 | + window.location.hash = ++index; |
| 39 | + e.preventDefault(); |
| 40 | + } |
32 | 41 |
|
33 |
| - // beginning, dont do anything |
34 |
| - if (index === 1) return; |
35 |
| - window.location.hash = --index; |
36 |
| - } |
37 |
| - function next() { |
38 |
| - let index = getIndex(); |
39 |
| - window.location.hash = ++index; |
40 |
| - } |
| 42 | + document.getElementById('backButton').addEventListener('click', (e) => prev(e)); |
| 43 | + document.getElementById('nextButton').addEventListener('click', (e) => next(e)); |
41 | 44 | </script>
|
42 | 45 | <script src="js/CCapture.all.min.js"></script>
|
43 | 46 | <script async type="module" src="modules/looper.js"></script>
|
|
0 commit comments