w
clone your own copy | download snapshot

Snapshots | iceberg

No images in this repository’s iceberg at this time

Inside this repository

default.html
text/html

Download raw (2.2 KB)

{% load static compress %}
<!DOCTYPE html>
<html>
<head>
<title>{{ flatpage.title }}</title>
    <link rel="stylesheet" href="{% static 'playground/vendors/reset.css' %}">
    {% compress css %}
    <link rel="stylesheet" type="text/css" href="{% static 'playground/css/styles.css' %}">
    {% endcompress %}
</head>
<body class="help__content content">
{% load flatpages %}
{% get_flatpages as flatpages %}
<!-- <ul> -->
<!--     {% for page in flatpages|dictsort:"title" %} -->
<!--         <li><a href="/pages/{{ page.url }}">{{ page.title }}</a></li> -->
<!--     {% endfor %} -->
<!-- </ul> -->

{{ flatpage.content }}

<script src="{% static 'playground/vendors/jquery.min.js' %}"></script>
<script charset="utf-8">
    $('h3').each(function() { 
        $(this)
            .click(function() { $(this).toggleClass('help__section--closed'); })
            .addClass('help__section help__section--closed')
            .nextUntil("h3, h2, h1")
            .wrapAll('<div class="help__inner"></div>');
    });

    $('h2').each(function() { 
        $(this)
            .click(function() { $(this).toggleClass('help__section--closed'); })
            .addClass('help__section help__section--closed')
            .nextUntil("h2, h1")
            .wrapAll('<div class="help__inner"></div>');
    });

    // Taken from <https://gist.github.com/mathewbyrne/1280286>
    function slugify(text) {
        return text
            .toString()
            .toLowerCase()
            .normalize('NFD').replace(/[\u0300-\u036f]/g, "") // strip accents
            .replace(/\s+/g, '-')           // Replace spaces with -
            .replace(/[^\w\-]+/g, '')       // Remove all non-word chars
            .replace(/\-\-+/g, '-')         // Replace multiple - with single -
            .replace(/^-+/, '')             // Trim - from start of text
            .replace(/-+$/, '');            // Trim - from end of text
    }

    $("h2, h3, h4").each(function() {
         var txt = $(this).text();
         var id =  slugify(txt);
         $(this).attr('id', id).append(" ");
         var $a = $('<a>¶</a>').attr('href', '#' + id).addClass('permalink');
         $(this).append($a);
    });
</script>
</body>
</html>