Backend for songs.zachdecook.com
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@extends('layouts.app')
@section('title', $song['title'])

@section('content')

    <div class='controlArea'>
    @if( isset( $back ) )
        <a class='back' href='{{route('song.show', ['song' => $back, 'playlist' => $playlist ?? ''])}}'>
        <b>{{$back->name}}</b>
        </a>
    @endif
    @if( $playlist ?? FALSE)
        <a class='home' href='{{route('playlist.show',['playlist' => $playlist->name])}}'>
            <i>Back to {{$playlist->name}}</i>
        </a>
    @else
        <a class='home' href='{{route('song.list')}}'>
        <i>Go home</i>
        </a>
    @endif
    @if( isset( $next ) )
        <a class='next' href='{{route('song.show', ['song' => $next, 'playlist' => $playlist ?? ''])}}'>
        <b>{{$next->name}}</b>
        </a>
    @endif
    </div>

    <h4>{{$song['title']}} - {{$song->author}}</h4>
    @if($song->audio)
        <audio controls src="{{$song->audio}}"></audio><br/>
    @endif
    @if($song->key)
        Key: {{$song->key}}<br/>
    @endif
    @if($song->verse)
        Scripture: {{$song->verse}}<br/>
    @endif
    @can('update', $song )
        <a href='{{ route( 'song.edit', [
            'song' => $song,
            'playlist' => $playlist ?? '',
            'key' => $key,
            ] ) }}'>edit this song</a>
    @endcan

    <form style="display: inline-block">
    <select name="transp" id="transp"
        value = "<?php echo $transp;?>"
    >
    @if($song->key)
        @foreach(['C','Db','D','E','F','F#','G','G#','A','Bb','B'] as $kay)
            <option {{$kay == ($_GET['transp'] ?? $song->key) ? 'selected' : ''}} value='{{$kay}}'>{{$kay}}</option>
        @endforeach
    @else
        <?php
            for ($i=-6; $i < 12; $i++) {
                if (($transp + 24)%12 == $i) $selected = 'selected';
                else $selected = '';
                $dir = "transpose";
                echo "<option value='$i' $selected>$dir $i semitones</option>";
            }
        ?>
    @endif
    </select>
        <button>Transpose</button>
    </form>
    @foreach (['G','D','C','A'] as $possibleKey)
        @if($possibleKey != ($_GET['transp'] ?? $song->key))
            <form style="display: inline-block;">
                <button>to {{$possibleKey}}</button>
                <input type='hidden' name='transp' value='{{$possibleKey}}'>
            </form>
        @endif
    @endforeach

    <pre>{!! $song['escapedText'] !!}</pre>
    <div id="chordarea">
        <canvas id='guitarregion' width="100" height="100" onclick="cycle(guitarObj);"></canvas>
        <canvas id='ukuleleregion' width="100" height="100" onclick="cycle(ukeObj);"></canvas>
    </div>

    @foreach ($suggestions as $sug)
        <div class='controlArea'>
            <a class='but' href='{{route('song.suggested', ['song' => $sug, 'from' => $song, 'playlist' => $playlist ?? ''])}}'><b>{{$sug->name}}</b></a>
            @if ($key && $sug->key)
            <a class='but' data-words='transposed to ' data-key='{{$key}}' href='{{route('song.suggested', ['song' => $sug, 'from' => $song, 'key' => $key, 'playlist' => $playlist ?? ''])}}'>
                <i>transposed to {{$key}}</i>
            </a>
            @endif
        </div>
    @endforeach

    @if ($addToPlaylist ?? null)
        <form action="/playlist/{{ $addToPlaylist }}/{{ $song->id }}" method="post">
            @csrf
            <button>Add to favorites</button>
        </form>
    @endif

<script src='/js/chordsdata/chords.js'></script>
<script src='/js/chordsdata/ukulelechords.js'></script>
<script src='/js/page.js'></script>
<script src='https://code.jquery.com/jquery-3.5.0.min.js'></script>
<script src='/js/jsonly.js'></script>
<script src='/js/ccharter.js'></script>
<!--<script src="https://api.reftagger.com/v2/RefTagger.js"></script>
<script>
    var refTagger = {
        settings: {
            bibleVersion: "NET",
            socialSharing:[],
            noSearchClassNames:["tabs"],
        }
    };
    (function(d, t) {
        var g = d.createElement(t), s = d.getElementsByTagName(t)[0];
        g.src = "//api.reftagger.com/v2/RefTagger.js";
        s.parentNode.insertBefore(g, s);
    }(document, "script"));
</script>-->

@endsection