|
8 | 8 | <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" |
9 | 9 | integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" |
10 | 10 | crossorigin="anonymous"></script> |
| 11 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
11 | 12 | <script src="https://cdn.jsdelivr.net/npm/popper.js@1.12.9/dist/umd/popper.min.js" |
12 | 13 | integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" |
13 | 14 | crossorigin="anonymous"></script> |
14 | 15 | <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/js/bootstrap.min.js" |
15 | 16 | integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" |
16 | 17 | crossorigin="anonymous"></script> |
17 | | - <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
18 | 18 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" |
19 | 19 | integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> |
20 | 20 | <link rel="stylesheet" href={{url_for('static', filename='style.css' )}}> |
21 | | - <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> |
| 21 | + <link href="https://use.fontawesome.com/releases/v4.7.0/css/font-awesome-css.min.css" rel="stylesheet"> |
22 | 22 | <title>Śpiewnik HK</title> |
| 23 | + <script type="text/javascript"> |
| 24 | + (function($){ |
| 25 | + |
| 26 | + }(jQuery || window.jQuery)); |
| 27 | + </script> |
| 28 | + <script> |
| 29 | + function filterFunction() { |
| 30 | + var input, filter, ul, li, a, i, txtValue, matched; |
| 31 | + input = document.getElementById('filterInput'); |
| 32 | + filter = input.value.toUpperCase(); |
| 33 | + {% for category in songList.keys() %} |
| 34 | + ul = document.getElementById("{{category.replace(' ', '')}}"); |
| 35 | + li = ul.getElementsByTagName('li'); |
| 36 | + matched = false; |
| 37 | + // Loop through all list items, and hide those who don't match the search query |
| 38 | + for (i = 0; i < li.length; i++) { |
| 39 | + a = li[i].getElementsByTagName("a")[0]; |
| 40 | + txtValue = a.textContent || a.innerText; |
| 41 | + if (txtValue.toUpperCase().indexOf(filter) > -1) { |
| 42 | + li[i].style.display = "" |
| 43 | + matched = true; |
| 44 | + } else { |
| 45 | + li[i].style.display = "none"; |
| 46 | + } |
| 47 | + } |
| 48 | + if (matched) { |
| 49 | + $("#{{category.replace(' ', '')}}").collapse('show') |
| 50 | + } |
| 51 | + {% endfor %} |
| 52 | + } |
| 53 | + </script> |
23 | 54 | </head> |
24 | 55 |
|
25 | 56 | <body> |
|
31 | 62 | <li data-toggle="collapse" data-target="#search"> |
32 | 63 | <div class="input-group justify-content-center"> |
33 | 64 | <div class="form-outline"> |
34 | | - <form method="GET" class="form-inline my-2 my-lg-0 w-auto" |
35 | | - action="/{{'{}/{}'.format(song.category, song.title) if song and song.category and song.title else ''}}"> |
36 | | - {{ filter.filter(class_ = "form-control w-auto", placeholder="Search for songs...", |
37 | | - style="width: auto;") }} |
38 | | - <button type="submit" value="Search" class="btn btn-primary"> |
39 | | - <i class="fa fa-search" type="submit" aria-hidden="true"></i> |
40 | | - </button> |
41 | | - </form> |
| 65 | + <input type="text" id="filterInput" onkeyup="filterFunction()" placeholder="Search for songs.."> |
42 | 66 | </div> |
43 | 67 | </div> |
44 | 68 | </li> |
45 | 69 | {% for category in songList.keys() %} |
46 | | - <li data-toggle="collapse" data-target="#{{category}}" class="collapsed category"> |
| 70 | + <li data-toggle="collapse" data-target="#{{category.replace(' ', '')}}" class="collapsed category"> |
47 | 71 | <a href="#">{{category}}<span class="arrow"></span></a> |
48 | 72 | </li> |
49 | | - <ul class="collapse song {{'show' if filterString or (hasattr(song, 'category') and category == song.category) else ''}}" id="{{category}}"> |
| 73 | + <ul class="collapse song {{'show' if filterString or (hasattr(song, 'category') and category == song.category) else ''}}" id="{{category.replace(' ', '')}}"> |
50 | 74 | {% for song in songList[category] %} |
51 | | - <li><a href="/{{category}}/{{song.title.replace('/', '')}}">{{song.title}}</a></li> |
| 75 | + <li><a href="{{url_for('start', category=category, song=song.title.replace('/', ''), chordShift=0)}}">{{song.title}}</a></li> |
52 | 76 | {% endfor %} |
53 | 77 | </ul> |
54 | 78 | {% endfor %} |
|
67 | 91 | <table width="100%"> |
68 | 92 | <tr> |
69 | 93 | <td> |
70 | | - <form method="GET" action="" align="center"> |
71 | | - <input type="hidden" name="chordShift" value="{{(chordShift-1) % 12}}"> |
| 94 | + <form action="{{url_for('start', category=song.category, song=song.title.replace('/', ''), chordShift=(chordShift-1) % 12)}}"> |
72 | 95 | <button type="submit" value="Down" class="btn btn-primary"> |
73 | 96 | <i class="fa fa-arrow-down" aria-hidden="true"></i> |
74 | 97 | </button> |
75 | 98 | </form> |
76 | 99 | </td> |
77 | 100 | <td> |
78 | | - <form method="GET" action="" align="center"> |
79 | | - <input type="hidden" name="chordShift" value="{{(chordShift+1) % 12}}"> |
80 | | - <button type="submit" value="Up" class="btn btn-primary"> |
81 | | - <i class="fa fa-arrow-up" aria-hidden="true"></i> |
| 101 | + <form action="{{url_for('start', category=song.category, song=song.title.replace('/', ''), chordShift=(chordShift+1) % 12)}}"> |
| 102 | + <button type="submit" value="Down" class="btn btn-primary"> |
| 103 | + <i class="fa fa-arrow-down" aria-hidden="true"></i> |
82 | 104 | </button> |
83 | 105 | </form> |
84 | 106 | </td> |
|
0 commit comments