<!doctype html>
<html>
<head>
    <title>perfectloops</title>
</head>
<body>
    <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script type="text/javascript">
    $.getJSON("https://www.reddit.com/r/perfectloops/.json", function(res) {
        var urls = res.data.children
            .filter(function(c) {
                return c.data.media && c.data.media.oembed;
            })
            .map(function(c) {
                var url = c.data.media.oembed.thumbnail_url;
                return url.substring(0, url.lastIndexOf(".gif") + 4);
            });

        var targetUrl = window.location.href;
        targetUrl = targetUrl.substring(0, targetUrl.indexOf("perfectloops")) + "?delay=5&sites=" + urls;
        window.location.href = targetUrl;
    });
    </script>
</body>
</html>

Add some perfectloops magic sauce
Add some perfectloops magic sauce
