-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
165 lines (128 loc) · 8.43 KB
/
index.html
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/epiceditor/0.2.2/js/epiceditor.min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/2.6.2/lib/js/head.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/2.6.2/js/reveal.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/2.6.2/css/reveal.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/2.6.2/css/theme/night.css" id="theme" disabled="true">
<link rel="stylesheet" href="chord.css">
<style>
.reveal p {
line-height: 2em !important;
}
.reveal #slide.nochords p {
line-height: inherit !important;
}
.reveal #slide.nochords p .chord {
display:none;
}
span.chord {
font-style:italic;
}
</style>
<title>guitartabs.js - Edit song</title>
</head>
<body>
<div id="editor">
<textarea id="song" style="display:none;">## HERZ
*Obadja*
[a]Jes[G]us wir lieben [C7]dich [(C9)]
[a]Jes[G]us wir brauchen [C]dich [(C9)]
Wir wollen [F]bei dir sein [C]
ganz nah bei [a]dir
Wir wollen [F]bei dir sein [C]
an deinem [G]Herz
an deinem [a]Herz
Du bist unser [e]Gott
Wir loben deinen [F]Namen
Wir wollen bei dir sein
An deinem [a]Herz ...</textarea>
<div id="epiceditor"></div>
<input type="checkbox" id="show-chords-on-slides">
<label for="show-chords-on-slides">Include tabs on slide</label>
<button onClick="javascript:showSlide();">Show slide for song</button>
<p> Slide Theme:
<a href="?#/">Default</a> -
<a href="?theme=sky#/">Sky</a> -
<a href="?theme=beige#/">Beige</a> -
<a href="?theme=simple#/">Simple</a> -
<a href="?theme=serif#/">Serif</a> -
<a href="?theme=night#/">Night</a>
<a href="?theme=moon#/">Moon</a> -
<a href="?theme=solarized#/">Solarized</a></p>
<p>Choose Font:
<a href="javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.3.2",function($,L){var googleFonts=["Cantarell","Cardo","Crimson Text","Droid Sans","Droid Sans Mono","Droid Serif","IM Fell","Inconsolata","Josefin Sans Std Light","Lobster","Molengo","Nobile","OFL Sorts Mill Goudy TT","Old Standard TT","Reenie Beanie","Tangerine","Vollkorn","Yanone Kaffeesatz"],headerSel="span.chord",bodySel=".reveal p",$headerStyle=$('<style type="text/css"></style>'),$bodyStyle=$('<style type="text/css"></style>'),$chooser=$('<div class="google-font-chooser-wrapper" style="font-family: helvetica, sans-serif; padding: 5px; background-color: #222; color:#fff; position: fixed; bottom: 0; left: 0; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px"><span class="chooser-title" style="-moz-transform-origin: 0% 50%;">Google Font Chooser</span><div class="google-font-chooser" style="display:none; float: left;"><h3 style="color:#fff;">Griffe</h3><h4 style="color:#fff; font-size: .8em;">'+headerSel+'</h4><ul id="google-fonts-headers-select"></ul></div><div class="google-font-chooser" style="display:none; float: left;"><h3 style="color:#fff;">Liedschrift</h3><h4 style="color:#fff; font-size: .8em;">'+bodySel+'</h4><ul id="google-fonts-body-select"></ul></div></div>');$.each(googleFonts,function(i,l){var font=l,fontLink="http://fonts.googleapis.com/css?family="+font.replace(/ /ig,"+"),headerLi=$('<li style="cursor:pointer;">'+font+"</li>").click(function(){if($("link[href="+fontLink+"]").length===0){$("link:last").after("<link href='"+fontLink+"' rel='stylesheet' type='text/css'/>");}$headerStyle.html(headerSel+' { font-family: "'+font+'", arial, sans-serif; }');$(this).attr("style","background-color: #eee; color: #222;").siblings().attr("style","cursor:pointer;");}),bodyLi=$('<li style="cursor:pointer;">'+font+"</li>").click(function(){if($("link[href="+fontLink+"]").length===0){$("link:last").after("<link href='"+fontLink+"' rel='stylesheet' type='text/css'/>");}$bodyStyle.html(bodySel+'{ font-family: "'+font+'", Helvetica, sans-serif; }');$(this).attr("style","background-color: #eee; color: #222;").siblings().attr("style","cursor:pointer;");});$("#google-fonts-headers-select",$chooser).append(headerLi);$("#google-fonts-body-select",$chooser).append(bodyLi);});$("body").append($headerStyle).append($bodyStyle).append($chooser);$chooser.find("span.chooser-title").css("cursor","pointer").toggle(function(){$(".google-font-chooser",$chooser).show("fast");$(this).html("X").css({position:"absolute",top:"5px",right:"5px"});},function(){$(".google-font-chooser",$chooser).hide("fast");$(this).html("Google Font Chooser").css({position:"static",top:"auto",right:"auto",left:"auto"});});});">Google Fonts Chooser</a>
</p>
</div>
<div id="hidden-slides" class="reveal" style="display:none;">
<div class="slides">
<section id="slide" style="height:100%; overflow-y:auto;">
## empty
</section>
</div>
</div>
<script type="text/javascript">
function markedAndChordify(text) {
text = marked(text);
return chordify(text);
}
function chordify(text) {
return text.replace(/\[([^\n^\]]+)\]/g, "<span class='chord'>$1</span>");
}
function removeChordsOnSlide() {
document.querySelector('#slide').classList.add("nochords");
}
function showChordsOnSlide() {
document.querySelector('#slide').classList.remove("nochords");
}
var opts = {
textarea: 'song',
basePath: 'https://cdnjs.cloudflare.com/ajax/libs/epiceditor/0.2.2',
parser: markedAndChordify,
theme: {
preview: 'https://madmuffin1.github.io/guitartabs.js/preview.css'
},
autogrow: true,
button: {
bar: true,
}
};
var editor = new EpicEditor(opts);
editor.load();
Reveal.initialize({
controls: false,
progress: false,
history: false,
center: true,
keyboard: false,
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
});
document.querySelector('#theme').disabled=true;
function showSlide() {
document.getElementById('slide').innerHTML = markedAndChordify(editor.getElement('editor').body.innerHTML.replace(/\<br[\/]*>/g, '\n'));
if(document.querySelector('#show-chords-on-slides').checked) {
showChordsOnSlide();
} else {
removeChordsOnSlide();
}
document.getElementById('editor').style.display = "none";
document.getElementById('hidden-slides').style.display = "block";
document.querySelector('#theme').disabled=false;
// re-layout slides to have useful scale (otherwise it will stay with default scale)
Reveal.layout();
document.addEventListener('keydown', leavePresentationMode);
}
function leavePresentationMode(e) {
if (e.which == 27) {
document.getElementById('editor').style.display = "";
document.getElementById('hidden-slides').style.display = "none";
document.querySelector('#theme').disabled=true;
document.removeEventListener('keydown', leavePresentationMode)
}
}
</script>
</body>
</html>