-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
84 lines (71 loc) · 3.45 KB
/
index.php
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Oslovujeme, voláme!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="code: Tomas -kozleek- Musiol (tomas.musiol@gmail.com)">
<meta name="description" content="Oslovujeme, voláme! Správné oslovení uživatelů.">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Oslovujeme, voláme!</h1>
<p>Správné oslovení uživatelů podle 5. pádu.</p>
</div> <!-- /page-header -->
<p>Zadejte jméno uživatele v 1. pádu, jednotného čísla:</p>
<form action="/" method="post" class="js-names form-inline">
<div class="form-group">
<input type="text" class="form-control input-lg" id="in-name" placeholder="Tomáš" required>
</div>
<input type="submit" class="btn btn-primary btn-lg" value="Odeslat" />
</form> <!-- /js-names, form-inline -->
</div>
<div id="js-result" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Oslovujeme, voláme!</h4>
</div>
<div class="modal-body">
<p>Správné oslovení uživatele je: <strong id="js-result-name">Tomáši</strong></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
<button type="button" class="btn btn-primary" data-clipboard-target="#js-result-name">Zkopírovat do schránky</button>
</div>
</div> <!-- /modal-content -->
</div> <!-- /modal-dialog -->
</div> <!-- /js-result, modal -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.12/clipboard.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// kopirovani do schranky
new Clipboard('.btn');
// Ajax XML
$(".js-names").submit(function(){
var userName = $("#in-name").val();
userName = userName.trim();
$.ajax({
type: "GET",
url: "names.xml",
cache: false,
dataType: "xml",
success: function(xml) {
var selector = 'item[name="'+ userName +'"]';
var name = $(xml).find(selector).attr('vokativ');
// zobrazeni vysledku
$("#js-result-name").text(name.toString());
$('#js-result').modal('show')
}
});
return false;
});
});
</script>
</body>
</html>