-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
75 lines (63 loc) · 2.56 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
---
layout: null
---
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.12/clipboard.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
<title>Plus One</title>
<meta name="description" content="Plus one and thumbs up gifs for use on Github or any markdown enabled input.">
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<link rel="shortcut icon" type="image/png" href="favicon.png">
</head>
<body>
<header>
<div class="container">
<h1>👍</h1>
<input id='search' type='text' placeholder='Search gifs' autofocus oninput="onSearch()">
</div>
</header>
<div class="container">
<section id="main_content">
{% for image in site.static_files %}
{% if image.path contains 'gifs/' %}
{% assign gif_file = image.path | split:"/" | last %}
<a class="gif"
data-clipboard-text='![:+1:]({{ site.github.url }}{{ image.path }} "+1")'
data-search-text="{{ gif_file | downcase }}"
onclick="toastr.success('Copied {{ gif_file }} to clipboard!')">
<img src="{{ site.github.url }}/static/{{ gif_file }}"/>
</a>
{% endif %}
{% endfor %}
</section>
<script>
new Clipboard('.gif');
$(function() {
$(".gif").hover(
function() {
var image = $(this).find("img");
image.attr("src", image.attr("src").replace(/static\//, "gifs/"));
},
function() {
var image = $(this).find("img");
image.attr("src", image.attr("src").replace(/gifs\//, "static/"));
}
);
});
function onSearch() {
var search = document.getElementById('search').value.toLowerCase();
for (var gif of document.getElementsByClassName('gif')) {
gif.style.display = gif.getAttribute('data-search-text').includes(search) ? 'inline' : 'none';
}
}
</script>
</div>
</body>
</html>