/** * FANCY FORMAT GDPR TEXT * @author Harshvardhan Pandit * @author me a.t. harshp dot com * LICENSE: MIT * * Using the data from gdpr.json, this script restructures the HTML to create * a hierarchical page that can be referenced by HTML id attributes */ // clear the body $('body').empty(); // insert title and other items $('body').append( $('
', { 'id': 'about', 'class': 'description', 'text': data.about })); // recitals var element_recital = $('
', { 'id': 'recital-' + recital.number, 'class': 'recital', 'text': '(' + recital.number + ') ' + recital.text })); }); $('body').append(element_recital); // chapters data.chapters.map(function(chapter) { var element_chapter = $('
', { 'id': 'article' + article.number + '-' + point.number, 'class': 'point', 'text': '(' + point.number + ') ' + point.text }); } else { var element_point = $('
', { 'class': 'point', 'text': point.text }); } point.subpoints.map(function(subpoint) { if (subpoint.number != null) { element_point.append( $('
', { 'id': 'article' + article.number + '-' + point.number + '-' + subpoint.number, 'class': 'subpoint', 'text': '(' + subpoint.number + ') ' + subpoint.text })); } else { element_point.append( $('
', { 'class': 'subpoint', 'text': '- ' + subpoint.text })); } }); element_article.append(element_point); }); return element_article; }; // process sections if chapter has sections if (chapter.contents[0].type == 'section') { chapter.contents.map(function(section) { var element_section = $('
', { 'id': 'citation-' + citation.number, 'class': 'citation', 'text': '(' + citation.number + ') ' + citation.text })); }); $('body').append(element_citation);