Skip to content

Commit 688e7ac

Browse files
committed
gist: 5 min auto-refresh
1 parent 50bafbb commit 688e7ac

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ lang: en-GB
33
title: cdcl
44
header_extra: |
55
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
6-
<script type="text/javascript" src="js/main.js"></script>
6+
<script type="text/javascript" src="main.js"></script>

js/main.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

main.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
$(function(){
2+
$('div.gist').each(function(){
3+
const gist = $(this);
4+
const URL = "https://api.github.com/gists/" + gist.text();
5+
setInterval(function(){
6+
$.get(URL, function(data){
7+
const content = Object.values(data.files)[0].content;
8+
gist.html(content.split("\n").join("<br/>"));
9+
});
10+
}, 1000 * 60 * 5);
11+
});
12+
});

0 commit comments

Comments
 (0)