Created
December 29, 2017 07:48
-
-
Save Bat-Chat/971f1b8b8441a7a3c1b0e60c77d0336d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% layout none %} | |
<script> | |
var quotes = []; | |
</script> | |
{% for link in linklists.collections.links %} | |
{% assign parents = link | map: 'object' %} | |
{% assign child = link.links | map: 'object' %} | |
<script> | |
var temp = JSON.parse('{{ parents | json }}'); | |
temp[0]['title'] = '{{ link.title }}'; | |
temp[0]['child'] = JSON.parse('{{ child | json }}'); | |
var p_id = '{{ forloop.index }}'-1; | |
quotes[p_id] = temp[0]; | |
</script> | |
{% for sub_link in link.links %} | |
{% assign s_child = sub_link | map: 'object' %} | |
<script> | |
var s_id = '{{ forloop.index }}'-1; | |
quotes[p_id]['child'][s_id]['child'] = []; | |
</script> | |
{% for sub_sub_link in sub_link.links %} | |
{% assign s_s_child = sub_sub_link | map: 'object' %} | |
<script> | |
var temp = JSON.parse('{{ s_s_child | json }}'); | |
var s_s_id = '{{ forloop.index }}'-1; | |
quotes[p_id]['child'][s_id]['child'][s_s_id] = temp[0]; | |
</script> | |
{% endfor %} | |
{% endfor %} | |
{% endfor %} | |
{{ page.content }} | |
<div> | |
<script> | |
console.log(quotes); | |
// document.write(JSON.stringify(quotes)); | |
document.getElementById('rrr').innerHTML = JSON.stringify(quotes); | |
</script> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment