forked from nav-e/nav-e.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-markdown-files.html
More file actions
54 lines (42 loc) · 1.2 KB
/
github-markdown-files.html
File metadata and controls
54 lines (42 loc) · 1.2 KB
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
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-ajax/iron-ajax.html">
<link rel="import" href="bower_components/iron-collapse/iron-collapse.html">
<link rel="import" href="bower_components/paper-menu/paper-menu.html">
<link rel="import" href="bower_components/paper-menu/paper-submenu.html">
<dom-module id="github-markdown-files">
<template>
<iron-ajax
auto
url="[[ url ]]"
handle-as="json"
on-response="handleResponse"
debounce-duration="300"></iron-ajax>
</template>
</dom-module>
<script>
Polymer({
is: 'github-markdown-files',
properties: {
files: {
type: Array,
notify: true,
},
url: {
type: String
}
},
handleResponse: function(request) {
this.set('files', []);
for (var i = 0; i < request.detail.response.length; i++) {
var file = request.detail.response[i]
if (file.name.endsWith(".md")) {
this.unshift('files', {
name: file.name.replace('.md', ''),
path: file.download_url,
link: file.html_url
});
}
};
}
});
</script>