{% extends 'internal/base.html' %}

{% set title = 'Info' %}
{% set sticky_banners = true %}
{% set localized = false %}
{% set content_lang = 'fi' %}

{% block content %}

<div class="container">
    <div class="row">
        <div class="col-12">
            <!-- Automatic height overrides the 600px height from stylesheet.css -->
            <div class="card info-card box-shadow" style="height: auto;">
                <div class="card-header">
                    <h3 class="card-title">Forecast7.com -sää</h3>
                </div>
                <div id="forecast7">
                    <a class="weatherwidget-io" href="https://forecast7.com/en/60d4522d27/turku/" data-label_1="TURKU" data-label_2="Sää" data-theme="original">TURKU Sää</a>
                    <script>
                        !function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = 'https://weatherwidget.io/js/widget.min.js'; fjs.parentNode.insertBefore(js, fjs); } }(document, 'script', 'weatherwidget-io-js');
                    </script>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <div class="card info-card box-shadow">
                <div id="twitter">
                    <a class="twitter-timeline" data-height="600" data-dnt="true" data-theme="light" href="https://twitter.com/Turkukaupunki?ref_src=twsrc%5Etfw">Tweets by Turkukaupunki</a>
                    <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="card info-card box-shadow">
                <div class="card-header">
                    <h3 class="card-title">Visit Turku -uutiset</h3>
                </div>
                <div id="visitTurku">
                    <script type="text/javascript" src="http://output92.rssinclude.com/output?type=js&amp;id=1172169&amp;hash=c1c032487ad85904644bb22308686454"></script>
                </div>
            </div>
        </div>
    </div>
</div>

{% endblock content %}

{% block scripts %}
{{- super() }}

<script>

    $(document).ready(function () {
        console.log("Document ready.");

        $('#visitTurku').disableExternalLinks(); //Working
        $('#forecast7').disableExternalLinks(); //Not working
        $('#twitter').disableExternalLinks(); //Not working

        // First, load the widgets.js file asynchronously
        window.twttr = (function (d, s, id) {
            console.log("window.twttr");
            var js, fjs = d.getElementsByTagName(s)[0],
                t = window.twttr || {};
            if (d.getElementById(id)) return;
            js = d.createElement(s);
            js.id = id;
            js.src = "https://platform.twitter.com/widgets.js";
            fjs.parentNode.insertBefore(js, fjs);

            t._e = [];
            t.ready = function (f) {
                t._e.push(f);
            };

            return t;
        }(document, "script", "twitter-wjs"));

        twttr.events.ready(function (twttr) {
            console.log("twttr.events.ready");
            twttr.events.bind('loaded', function () { $('#twitter').disableExternalLinks(); })
        });
    });
</script>

{% endblock scripts %}